Displaying 3 results from an estimated 3 matches for "lprobs".
Did you mean:
probs
2002 Feb 05
2
passing parameters in optim()
Hi all,
I am using optim() to get estimate for parameter 'a' which will minimize
the output of lprob.catch(a) and I got an error message:
> optim(2,lprob.catch(x, freq,1, 0.5,0.5, a,- 0.7, 1, -0.7,0.1,
1,0.2,2,1,data.sf.mont))
Error in catch2.fun(k, f1, f2, a, b, A, B, R, n0, av, index.n) :
Object "a" not found
Why wasn't the initial value of a=2 passed to
2007 Oct 26
5
help
hello,
please can anyone help me out. Am a new user of R
program. Am having problem
with this code below, not getting the expected
results.
1. Each m, the cumulative sum should be 1.000 but the
2nd and 3rd m returned 2.000 and 3.000
instead of 1.000.
2. to get the LCL(m) and UCL(m) for each m base on
these instructions
if out.cum > 0.025 then LCL(m)= y-1
if out.cum >0.975
2007 May 11
0
EM covergence problem
...%Beta[(i-1)*2+1:2]
v2 = Y%*%Beta[(i-1)*2+1:2]
p1 = exp(v1)/(exp(v1)+exp(v2))
p2 = exp(v2)/(exp(v1)+exp(v2))
probs[,i] = ifelse (D==0,log(p1),log(p2))
}
return (probs)
}
#H [individuals][class]
E_step = function(alpha,Beta){#calc posterior of H
tmpH = matrix(,nrow = 1000,ncol =3)
lprobs = logProbInd(Beta)
for(i in 1:3){#classes
tmpH[,i] = alpha[i]*exp(lprobs[,i])
}
H = tmpH /apply(tmpH,1,sum)
return( H)
}
M_step = function(H,Beta){
#first part use direct estimation
aita = apply(H,2,sum)/1000
opt.c = optim(Beta,Q2,H=H,method="BFGS",control = list(fnscale = -1)...