Hello,
I want to estimate the exponential parameter by using optim with the following 
input, where t contains 40% of the data and q contains 60% of the data within 
an interval. In implementing the code command for optim i want it to contain 
both the t and q data so i can obtain the correct estimate. Is there any 
suggestion as to how this can be done. I have tried h<-c(t,q) but it is not 
working because q lies within an interval.

rate<-15;n<-100;a<-40;b<-60;rr<-1000
ms11=ms22=0
bia11=bia22=0
t<-rexp(a,rate)
for(i in 1:rr){
C1<-runif(b,0,rate)
C2<-rexp(b,rate)
f2 <- function(C1, C2) {
  r <- pmax(C1 , C2 + C1)
  cbind(C1, r)
} 
m<-f2(C1,C2)
x[1:b]<-(m[,1])
u<-x[1:b]
x[1:b]<-(m[,2])
v<-x[1:b]
q<-cbind(u,v)

h<-c(t,q)

z<-function(data ){ 
rate<-p[2]
log1<--(n/log(p[2]))-sum(t/(p[2]))+sum(log(exp(-(u/(p[2])))-exp(-(v/(p[2])))))
return(-log1)
}
}
start <- c(1,1)
zz<-optim(start,fn=z,data=h,hessian=T)
m1<-zz$par[2]

thank you

chris b guure
researcher
institute for mathematical research 
upm  


______________________________________________
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.

Reply via email to