Closed imccart closed 6 months ago
Program in R: likelihood and gradient, estimation command
R multinomial logit with inequality constraints: multinomineq. Employs a bayesian approach and might be quite slow or impossible with our number of fixed effects.
When I last estimated a hospital choice model in R, I used the mclogit command: logit.reg <- mclogit(cbind(choice,id) ~ vars, data=data), where choice is a dummy variable for the observed choice and ID is a factor variable defining each case (in this setting, it was patient/admission).
1992 article in Marketing Science suggests an iterative algorithm https://www.jstor.org/stable/184095
How it would work in our case (and I will email some sample code):
Iterative procedure:
// ITERATIVE PROCEDURE FOR NONLINEAR PARAMETER
Define variable to hold values of exp(lna)*index: gen belief_s = .
Define a scalar to count the number of iterations until convergence: scalar iter8 = 0
Initialze values of lna (the scalar(alpha) is the true value used to simulate data): scalar lna_old = 4 scalar lna_new = ln(scalar(alpha))
Iterate until convergence:
(note the tolerance and max number of iterations) while abs( exp(scalar(lna_new)) - exp(scalar(lna_old)) ) > 0.005 & iter8 < 20 {
advance counter: scalar iter8 = scalar(iter8) + 1
update the constructed variable: scalar lna_old = scalar(lna_new) quietly replace belief_s = exp(scalar(lna_old))*m
estimate the logit quietly asclogit choice dist log_exp i.doc belief_s, nocons case(pat) alt(doc)
update the parameter scalar lna_new = scalar(lna_old) + _b[belief_s] - 1
report cycle dis "Iteration " iter8 " done" }
alpha coefficient is then exp(lna_new), with standard error exp(lna_new) * SE(coef on belief_s)