Displaying 1 result from an estimated 1 matches for "prob_ok".
Did you mean:
prob_1
2008 Oct 15
1
MLE Constraints
...states = c(1, 1, 2, 3, 1, 2, 3, 1, 1, 2, 2, 3, 1, 1)
prob_fn = rep(0,M)
Model=function(a, b, c, d, e, f, g, h, i, j, k, l)
{
p1 = exp(-(a g*x1 d*x2 j*x3))
p2 = exp(-(b h*x1 e*x2 k*x3))
p3 = exp(-(c i*x1 f*x2 l*x3))
### Set P
t5 = 0
while(t5<M)
{
t5 = t5 1
if(states[t5]==1) {prob_ok = p1[1]}
if(states[t5]==2) {prob_ok = p2[1]}
if(states[t5]==3) {prob_ok = p3[1]}
prob_fn[t5] = c(prob_ok)
}
prob_fn[prob_fn==0] = 0.0000000000001
### LL
ll_calc = -(sum(Y*log(prob_fn)))
return(ll_calc)
}
res = mle2(Model, start=list(a=1, b=1, c=1, d=0.15, e=0.15,
f=0.15, g=0.9, h=0.9, i=0.9, j...