Multinomial with p = 1/(1+exp(-th)) cdf/pdf and ders
This function computes the cdf, pdf, and associated derivatives
multinomcpdf(z, th, x)
z
: vector of responses taking values in 1,...,nL: as.number(z) if z is a factor!th
: th is a n x (L-1) matrix of parameters, i.e., mpar = a=[a_1,1,...a_1,k2,a_2,1,...a_2,k2,... a_L-1,1... a_L-1,k2], and first level is the baseline.x
: matrix of covariates (including the constant)x=matrix(c(1,1,-1,-1,0,2),nrow=2) z = c(1,3) th = matrix(c(1,2,3,4,5,6),nrow=2) out = multinomcpdf(z,th,x = x)
Pavel Krupskii and Bruno N. Remillard, January 20, 2022
Useful links