Hi, I have a problem in programming for bootstrapping. I don't know why it show the error message. Please see my code below: #'st' is my original dataset. #functions of 'fml.mlogl','pcopula.fam4','ltd','invltd' are already defined
boot.OR<-function(data,i) { E=data[i,] ml1<-glm(c_VAsex90_bf ~ trt,family=binomial,data=E) ml2<-glm(c_VAsex90_bm ~ trt,family=binomial,data=E) marg.covariates<-cbind(rep(1,length(E$trt)),E$trt) dep.covariates<-cbind(rep(1,length(E$age_avr)),E$age_avr) start<-c(ml1$coef,ml2$coef,0,0) fml1<-optim(start,fml.mlogl,control=c(maxit=10000),hessian=F) x<-(1+exp(fml1$par[1]))^(-1) y<-(1+exp(fml1$par[3]))^(-1) b<-exp(fml1$par[5]+fml1$par[6]*43)+1 p00<-ltd(-log(pcopula.fam4(exp(-invltd(x,b)),exp(-invltd(y,b)),b)),b) p1<-exp(fml1$par[1])/(1+exp(fml1$par[1])) p2<-exp(fml1$par[3])/(1+exp(fml1$par[3])) OR<-p00*(p00+p1+p2-1)/(1-p2-p00)/(1-p1-p00) OR } set.seed(101) boot(st,boot.OR,R=500) #------------------------------------------------------------# I gives following error message: Error in fn(par, ...) : object "dep.covariates" not found I hope you can help me in this problem. Thanks, Becky ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.