HiI am using the boot function in boot package. I am facing a problem in getting the values of bias and st.error in the output. r<-36n<-40shape<-2theta11<-exp(1) # (=2.718282)theta21<-exp(.5) #( =1.648721)m0<- function(Ti,Tj) #a function that generates the MLestimates{ loglik<-function(ti,tj,alpha,theta1,theta2){ -1*( log(n)-log(n1)-log(r-n1)-r*lgamma(alpha)-alpha*n1*log(theta1)-alpha*(r-n1)*log(theta2)+(alpha-1) *sum(log(Ti))+(alpha-1)*sum(log(Tj-tau+(theta2/theta1)*tau))-(1/theta1)*sum(Ti)- (1/theta2)*sum(Tj-tau+(theta2/theta1)*tau)+(n-r)*log(1-pgamma((max(Tj)-tau+ (theta2/theta1)*tau)/theta2,alpha,1))) } V<-mle2(minuslogl = loglik, start = list(alpha= 2,theta1= 11,theta2= 3), data = list(size = 20)) Est<-coef(V)}sample1<-function(n,r,tau,shape,theta1,theta2) #the function that generate the sample{ U<-runif(n) Us<-sort(U) F1tau<- pgamma((tau/theta1),shape,1) n1<-sum(Us<F1tau) X1<- Us[1:n1] ! X2<- theta1*qgamma(Us[1:n1],shape,1) Ti<- X2 w=n1+1 V<- Us[w:r] V1<-theta2*qgamma(V,shape,1) Tj<-V1+tau-(theta2/theta1)*tau c(Ti,Tj) } sample1(40,36,5,2,exp(1),exp(.5))func2<- function(data,mle){ sample1(n,length(data),tau,shape,mle[2],mle[3]) }func1<-function(data){ loglik<-function(data,alpha,theta1,theta2){ -1*( log(n)-log(n1)-log(r-n1)-r*lgamma(alpha)-alpha*n1*log(theta1)-alpha*(r-n1)*log(theta2)+(alpha-1) *sum(log(Ti))+(alpha-1)*sum(log(Tj-tau+(theta2/theta1)*tau))-(1/theta1)*sum(Ti)- (1/theta2)*sum(Tj-tau+(theta2/theta1)*tau)+(n-r)*log(1-pgamma((max(Tj)-tau+ (theta2/theta1)*tau)/theta2,alpha,1))) } V<-mle2(minuslogl = loglik, start = list(alpha= 2,theta1= 11,theta2= 3), data = list(size = 20)) Est<-coef(V) } bootobject <- boot(data=c(Ti,Tj) , statistic= func1 , R=1000,sim='parametric', ran.gen=func2, mle= m0(Ti,Tj) ) boot.ci(! bootobject, conf=.90, type= 'bca') Thank you and take care.Laila [[alternative HTML version deleted]]
______________________________________________ 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.