R: diferència entre les revisions

19 bytes afegits ,  1 juny 2005
Línia 589: Línia 589:
4-Cálculos si hemos recibido un modelo de regresión lineal:
4-Cálculos si hemos recibido un modelo de regresión lineal:


if(class(model)[1]=="lm")
if(class(model)[1]=="lm")
{
{
df<-model$df
df<-model$df
p<-(1-nivell)/2
p<-(1-nivell)/2
punt<-round(co[,1],digits=digits)
punt<-round(co[,1],digits=digits)
inf<-round(confint(model,level=nivell)[,1],digits=digits)
inf<-round(confint(model,level=nivell)[,1],digits=digits)
sup<-round(confint(model,level=nivell)[,2],digits=digits)
sup<-round(confint(model,level=nivell)[,2],digits=digits)
tot<-cbind(punt,inf,sup)
tot<-cbind(punt,inf,sup)
dimnames(tot)<-list(row.names(summary(model)$coef),c("B","inf","sup"))
dimnames(tot)<-list(row.names(summary(model)$coef),c("B","inf","sup"))
}
}


5-Cáculos si hemos recibido un modelo de riesgos proporcionales de Cox:
5-Cáculos si hemos recibido un modelo de riesgos proporcionales de Cox:


if(class(model)[1]=="coxph")
if(class(model)[1]=="coxph")
{
{
punt<-round(exp(co[,1]),digits=digits)
punt<-round(exp(co[,1]),digits=digits)
inf<-round(exp(co[,1]-nivell2*co[,3]),digits=digits)
inf<-round(exp(co[,1]-nivell2*co[,3]),digits=digits)
sup<-round(exp(co[,1]+nivell2*co[,3]),digits=digits)
sup<-round(exp(co[,1]+nivell2*co[,3]),digits=digits)
tot<-cbind(punt,inf,sup)
tot<-cbind(punt,inf,sup)
dimnames(tot)<-list(row.names(summary(model)$coef),c("HR","inf","sup"))
dimnames(tot)<-list(row.names(summary(model)$coef),c("HR","inf","sup"))
alfa<-T
alfa<-T
}
}


6-Cálculos si hemos recibido un ''glm'' (logística, logbinomial, poisson):
6-Cálculos si hemos recibido un ''glm'' (logística, logbinomial, poisson):
Usuari anònim