R/expit1.R

Defines functions expit1

expit1 <- function(lp,ref=1){
	
# compute expit with respect to category ref
	k = length(lp)+1
	G = matrix(diag(k)[,-ref],k,k-1)
	p = exp(G%*%lp); p = p/sum(p)
	p = as.vector(p)
	Der = (diag(p)-p%o%p)%*%G
	out = list(p=p,Der=Der)
		
}

Try the LMest package in your browser

Any scripts or data that you put into this service are public.

LMest documentation built on Aug. 27, 2023, 5:06 p.m.