search for: theta_multiple

Displaying 1 result from an estimated 1 matches for "theta_multiple".

2009 Oct 30
2
Efficient way to code using optim()
...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)){ realized_prob[i] = exp(theta_multiple[cum_count[(i-1)]+1]) / sum(exp...