Displaying 1 result from an estimated 1 matches for "loglikelihood2corrnan".
2010 Nov 03
3
optim works on command-line but not inside a function
...rs due to 0*log(0)
IRT.logLikelihood2 <- function(params, t, X){
pos<- sum(t * log(IRT.p(X,params[1],params[2])))
neg<- sum( (1-t) * log( (1-IRT.p(X,params[1],params[2])) ) )
-pos-neg
}
#Avoiding NaN problems due to 0*log(0)
#otherwise equivalent to IRT.logLikelihood2
IRT.logLikelihood2CorrNan <- function(params, t, X){
pos<- sum(t * log(IRT.oneOverP(X,params[1],params[2])))
neg<- sum((1-t) * log(IRT.oneOverPneg(X,params[1],params[2])))
-pos-neg
}
#IRT.p can also be espressed in terms of z and l
#where z=-ab and l=a <- makes it a standard logit function
IRT.pZ...