I've been programming maximum likelihood estimation models using the
function "optim." My current research requires modeling a particular
parameter as a categorical variable (what R calls a "factor"), not as a
continuous parameter.

(The research question is, at what level of X does a subject in our
experiment choose Y=1 instead of Y=0? So this is a "light switch" problem --
the subjects only switch from Y=0 to Y=1 after a particular threshold. And X
only comes as a categorical variable, with integer values of 0,1,2,3,4, or
5.)

So whenever optim tries to find the proper parameter for the threshold of X,
it tries different threshold values such as 4.5, 4.7, 4.9 -- none of which
make any difference because that wouldn't actually change the realizations
of whether the threshold has been crossed. And then it says the element of
the Hessian matrix for that parameter is zero, because changing it doesn't
seem to affect the log-likelihood.

Is there a way to tell optim that I'd like it to choose between only a
limited number of factor values for the parameter?

I've spent a lot of time on Google and in ?optim searching for the answer,
but haven't made progress so far. Thank you so much for your help. Apologies
for any confusing statements remaining in this message -- for me at least,
it's been a difficult problem to describe succinctly.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to