search for: achoic

Displaying 2 results from an estimated 2 matches for "achoic".

Did you mean: achaic
2007 Jun 19
1
Error handling
...ill it is annoying to handle it manually each time. Many thanks Peter The example: ------------ logfunc <- function (params) { vutil1 <- as.matrix(x2[,1:3]) %*% params vutil2 <- as.matrix(x2[,4:6]) %*% params logl <- 0 for (i in 1:6) { prob <- log((exp(vutil1[i])*achoices[i,1]+exp(vutil2[i])*achoices[i,2])/(exp(vutil1[i])+exp(vutil2[i]))) logl <- logl + prob } return (-logl) } x2 <- array(c(0,4,1,3,5,3,3,2,1,4,1,2,0,2,2,1,1,4,1.2233310 ,0.0000000 ,0.8155540 ,0.9320617 ,1.4272195 ,1.8349965 , 0.6116655, 3.2622160, 0.8155540, 3.7282469,0.0000000 ,4....
2008 Feb 15
2
lmList, tapply() and lm()
Howdee, *** I know that the lmList() function exists, yet I don't want to use it. *** Would anyone be kind enough to tell how I can apply the function lm() to each level of a given factor so to obtain the intercept and slope for each factor level within a matrix? For instance, suppose a dataframe containing 3 variables: id, x and y. I want to compute the function lm() for each level