logit_c | R Documentation |
Conditional logit likelihood
logit_c(starts3, dat, otherdat, alts)
starts3 |
Starting values as a vector (num). For this likelihood,
the order takes: c([alternative-specific parameters],
[travel-distance parameters]). |
dat |
Data matrix, see output from shift_sort_x, alternatives with distance. |
otherdat |
Other data used in model (as a list containing objects
'intdat' and 'griddat'). |
alts |
Number of alternative choices in model as length equal to unity (as a numeric vector). |
ld: negative log likelihood
data(zi)
data(catch)
data(choice)
data(distance)
data(si)
optimOpt <- c(1000,1.00000000000000e-08,1,0)
methodname <- 'BFGS'
kk <- 4
si2 <- matrix(sample(1:5,dim(si)[1]*kk,replace=TRUE),dim(si)[1],kk)
zi2 <- sample(1:10,dim(zi)[1],replace=TRUE)
otherdat <- list(griddat=list(predicted_catch=as.matrix(predicted_catch),
si2=as.matrix(si2)), intdat=list(zi=as.matrix(zi),
zi2=as.matrix(zi2)))
initparams <- c(2.5, 2, -1, -2)
func <- logit_c
results <- discretefish_subroutine(catch,choice,distance,otherdat,
initparams,optimOpt,func,methodname)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.