[R] have aproblem --thank you
笑啸
dingdonglion at 126.com
Mon Oct 4 13:31:25 CEST 2010
dear professor:
thank you for your help,witn your help i develop the nomogram successfully.
after that i want to do the internal validation to the model.i ues the bootpred to do it,and then i encounter problem again,just like that.(错误于error to :complete.cases(x, y, wt) : 不是所有的参数都一样长(the length of the augment was different))
i hope you tell me where is the mistake,and maybe i have chosen the wrong function.
thank you
turly yours
......
load package 'rms'
> ddist <- datadist(dfr)
> options(datadist='ddist')
> n<-100
> set.seed(10)
> T.Grade<-factor(0:3,labels=c("G0", "G1", "G2","G3"))
> Sex<-factor(sample(0:1, 100, replace=TRUE),labels=c("F","M"))
> Smoking<-factor(sample(0:1, 100, replace=TRUE),labels=c("No","yes"))
> dfr$L<-with(dfr,0.559*as.numeric(T.Grade)-0.896*as.numeric(Smoking)+0.92*as.numeric(Sex)-1.338)
> dfr$y <- with(dfr, ifelse(runif(n) < plogis(L), 1, 0) )
> dfr <- data.frame(T.Grade,Sex,Smoking, L, y)
> ddist <- datadist(dfr)
> options(datadist='ddist')
> f<-lrm(y~T.Grade +Sex+Smoking, data=dfr)
> nom<-nomogram(f,fun=function(x)1/(1+exp(-x)),fun.at=c(.01,.05,seq(.1,.9,by=.2),.9,1),funlabel="Risk of Death")
> plot(nom, xfrac=0.45)
load package bootstrap
.................the problem....................
> theta.fit <- function(dfr,y){lsfit(dfr,y)}
> theta.predict <- function(fit,dfr){cbind(1,dfr)%*%fit$coef}
> sq.err <- function(y,yhat) { (y-yhat)^2}
> results <- bootpred(x,y,50,theta.fit,theta.predict,err.meas=sq.err)
错误于error to :complete.cases(x, y, wt) : 不是所有的参数都一样长(the length of the augment was different)
全国最低价,天天在家冲照片,24小时发货上门!
全国最低价,天天在家冲照片,24小时发货上门!
More information about the R-help
mailing list