Re: [R] Discrete choice model maximum likelihood estimation

2012-05-15 Thread infinitehorizon
optim package. > > Best, JN > > > On 05/15/2012 06:00 AM, r-help-request@ wrote: >> Message: 13 >> Date: Mon, 14 May 2012 04:21:57 -0700 (PDT) >> From: infinitehorizon <barisvardar@> >> To: r-help@ >> Subject: Re: [R] Discrete choice model m

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-14 Thread infinitehorizon
ction(param, a, tt) { > > > llfn <- sum((a==1)*lL1+(a==2)*lL2+(a==3)*lL3) # sum of logs, it's a > log-likelihood. > return(-llfn) > } > > Rui Barradas > > infinitehorizon wrote >> >> Hello again, >> >> You are absolutely right about pro

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-14 Thread infinitehorizon
e > [1] 0 > > $counts > function gradient > 44 NA > > $convergence > [1] 0 > > $message > NULL > > > Note the optimum value of zero, est$value == 0 > > Rui Barradas > > infinitehorizon wrote >> >> By the way, in my l

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-14 Thread infinitehorizon
By the way, in my last post I forgot to return negative of llfn, hence the llfn will be as follows: llfn <- function(param) { bx <- param[1] b1 <- param[2] b2 <- param[3] b3 <- param[4] b <- param[5] lL1 <- log(L1(bx,b1,b2,b,tt)) lL2 <- log(L2(bx,b1,b2,b3,b,tt)) lL3 <- log(L3(bx,b1,b2,b3

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-14 Thread infinitehorizon
beforehand. Maybe it makes sense to assign the > choice and then call optim. > > In functions L2 and L1 you don't use the values of, resp., P33 and P22. > The calls to P3 and P2 are a waste of time. > > And, as a final note, optim minimizes it's objective function, so the

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-14 Thread infinitehorizon
> > After computing P11, etc, you're discarding those values and assigning 1 > to each of them. > Your likelihood functions just became constants... > And if this is a typo, if you meant P11 == 1, etc, it's even worse. You > can't expect that ratios of exponentials

[R] Discrete choice model maximum likelihood estimation

2012-05-13 Thread infinitehorizon
Hello, I am new to R and I am trying to estimate a discrete model with three choices. I am stuck at a point and cannot find a solution. I have probability functions for occurrence of these choices, and then I build the likelihood functions associated to these choices and finally I build the gener