Displaying 2 results from an estimated 2 matches for "gompertz2".
Did you mean:
gompertz
2012 Jan 12
2
Function accepted by optim but not mle2 (?)
...]
shift<-data[1]
h.t<-a3*exp(b3*(t-shift))
S.t<-exp(a3/b3*(1-exp(b3*(t-shift))))
PF<-1-(exp(a3/b3*(1-exp(b3*(data[1]-shift)))))
QF<-1-(exp(a3/b3*(1-exp(b3*(data["length"(data)]-shift)))))
return(S.t*h.t/(QF-PF))
}
## GOMPERTZ - maximum likelihood
gompertz2<-function (x)
{
lnlk<-sum(log(gompertz(x,t=data)))
return(-lnlk)
}
## this works:
A<-optimx(c(0.1,0.1),gompertz2, method=c("Nelder-Mead"),control=list(fnscale=1))
## this doesn't:
A <- mle2(gompertz2(x),start=list(a3=0.03,b3=0.1),data=data)
## Error in gompertz2(x) : obj...
2012 Sep 29
5
Generating by inverting function
Hello,
I am trying to generate random survival times by inverting the function, S(t)= exp(b*F(t)), where b is constant and F(t) is some cumulative distribution function, let say that F(t) is cdf of normal distribution or any others distributions.
as we know that S(t) has uniform distribution on (0,1) so we can write that
U= exp(b*F(t)), where U is uniform (0,1). Now to generat the time t, we