Displaying 1 result from an estimated 1 matches for "simple_logit".
Did you mean:
simple_log
2009 Oct 30
2
Efficient way to code using optim()
...he sum of [exp(U(chosen)) / sum(exp(U(all alternatives)))]
When I have 6,7 predictors, the running time is about 10 minutes, and it slows down exponentially as I have more predictors. (More theta¡¯s to estimate)
I want to know if there is a way I can improve the running time.
Below is my code..
simple_logit = function(theta){
realized_prob = rep(0, max(data$CS))
theta_multiple = as.matrix(data[,4:35]) %*% as.matrix(theta)
realized_prob[1] = exp(theta_multiple[1]) / sum(exp(theta_multiple[1:cum_count[1]]))
for (i in 2:length(realized_prob)...