[R] Different standard errors from R and other software
Hi all, Sorry to bother you. I'm estimating a discrete choice model in R using the maxBFGS command. Since I wrote the log-likelihood myself, in order to double check, I run the same model in Limdep. It turns out that the coefficient estimates are quite close; however, the standard errors are very different. I also computed the hessian and outer product of the gradients in R using the numDeriv package, but the results are still very different from those in Limdep. Is it the routine to compute the inverse hessian that causes the difference? Thank you very much! Best wishes. Min -- Min Chen Ph.D. Candidate Department of Agricultural, Food, and Resource Economics 125 Cook Hall Michigan State University [[alternative HTML version deleted]] __ 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.
[R] Mixed logit models with a random coefficient
Hi All, Sorry to bother you. I'm trying to estimate a set of discrete choice data in R with mixed logit models where one coefficient is random and normally distributed. I've searched on the R help archive and don't see much information very specific to what I'm doing, so I write the code myself, which involves simulated maximum likelihood. But it doesn't work, as I compare the results with Limdep. Could anyone please take a look at it? It's a bit longer though..Comments are highly appreciated. Thank you very much! /*1,000 people, Three alternatives, two variables, their coefficients are B1 and B2 respectively, B1 is random*/ library(maxLik) RP<-function(theta,y,X) { m1<-theta[1]/* mean s1<-theta[2] /*standard deviations b2<-theta[3]/*B2 P<-NULL b1<-rnorm(500,mean=m1,sd=s1) /*generate 500 random draws for B1 for(m in 0:999) { Dm<-X[(1+3*m):(3+3*m),]/*Extract the data for one person Pn<-NULL for(n in 1:500) { b<-rbind(b1[n],b2) an<-sum(exp(Dm%*%b)) Pmn<-exp(Dm%*%b)/an /*Under each B1, compute the choice probabilities Pn<-cbind(Pn,Pmn) } Pm<-rowMeans(Pn)/* The simulated probabilities for one person P<-rbind(P,Pm) /* Obtain the choice probabilities for all 1,000 people } sum(log(P)*(as.numeric(y))) /* Log-likelihood function, where y is the variable for choices } A<-matrix(c(0,1,0),1,3) B<-0 rp<-maxBFGS(RP,start=c(-0.072,0.8,0.539),y=Y,X=EV,constraints=list(ineqA=A,ineqB=B)) /* Constrained MLE, to ensure that the estimated standard deviation is positive; the start values are taken from conditional logit estimation -- Min Chen Graduate Student Department of Agricultural, Food, and Resource Economics 208 Cook Hall Michigan State University chenm...@msu.edu / chenmin0...@gmail.com [[alternative HTML version deleted]] __ 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.
[R] Nested logit in GEV family
Hi All, I know someone has posted similar messages before, but there is no reply. So I wonder whether there is a way to run a nested logit model in R. It is in the GEV family; however, the commands fitting GEV don't seem to work for nested logit. Or maybe I have to write down the log-liklihood function and let R maximize it? Thank you! Best wishes. Min -- Min Chen Graduate Student Department of Agricultural, Food, and Resource Economics 208 Cook Hall Michigan State University chenm...@msu.edu / chenmin0...@gmail.com [[alternative HTML version deleted]] __ 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.
[R] Fitted probabilities in conditional logit regression
Dear R-help, I'm doing conditional logit regression for a discrete choice model. I want to know whether there's a way to get the fitted probabilities. In Stata, "predict" works for clogit, but it seems that in R "predict" does not. Thank you very much! Best wishes. Sincerely, Min -- Min Chen Graduate Student Department of Agricultural, Food and Resource Economics Michigan State University [[alternative HTML version deleted]] __ 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.