Skip to contents

Conditional logit likelihood

Usage

logit_c(starts3, dat, otherdat, alts, project, expname, mod.name)

Arguments

starts3

Starting values as a vector (num). For this likelihood, the order takes: c([alternative-specific parameters], [travel-distance parameters]).

The alternative-specific parameters and travel-distance parameters are of length (# of alternative-specific variables) and (# of travel-distance variables) respectively.

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`).

For this likelihood, `intdat` are 'travel-distance variables', which are alternative-invariant variables that are interacted with travel distance to form the cost portion of the likelihood. Each variable name therefore corresponds to data with dimensions (number of observations) by (unity), and returns a single parameter.

In `griddat` are 'alternative-specific variables', that vary across alternatives, e.g. catch rates. Each variable name therefore corresponds to data with dimensions (number of observations) by (number of alternatives), and returns a single parameter for each variable (e.g. the marginal utility from catch).

For both objects any number of variables are allowed, as a list of matrices. Note the variables (each as a matrix) within `griddat` and `intdat` have no naming restrictions. 'Alternative-specific variables' may correspond to catches that vary by location, and 'travel-distance variables' may be vessel characteristics that affect how much disutility is suffered by traveling a greater distance. Note in this likelihood 'alternative-specific variables' vary across alternatives because each variable may have been estimated in a previous procedure (i.e. a construction of expected catch).

If there are no other data, the user can set `griddat` as ones with dimension (number of observations) by (number of alternatives) and `intdat` variables as ones with dimension (number of observations) by (unity).

alts

Number of alternative choices in model as length equal to unity (as a numeric vector).

project

Name of project

expname

Expected catch table

mod.name

Name of model run for model result output table

Value

ld: negative log likelihood

Graphical examples

Figure: logit_c_grid.png
Figure: logit_c_travel.png

Examples

if (FALSE) {
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)
}