Displaying 1 result from an estimated 1 matches for "vutil2".
Did you mean:
util2
2007 Jun 19
1
Error handling
...are errors). Of course this is just an example, in the simulation study the error comes up quite rarely but still 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...