[R] parametric bootstrap
laila khalfan
byblus412 at hotmail.com
Mon Jul 28 14:32:08 CEST 2008
Hi
I 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<-36
n<-40
shape<-2
theta11<-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<- 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
More information about the R-help
mailing list