I have a 7-parameter model to fit using mle.  I would like to generate 
fits for all
pairs of parameters (with others fixed)

  The following code looked like it should work:

library(stats4)

# dummy mll function for sake of example
mll = function (lnk=1.5,lnhs=-5,lnhi=-5,lnss=-5,lnsi=-5,lnws=-5,lnwi=-5) 
lnk^2 + lnhs^2 + lnhi^2+ lnss^2 + lnsi^2+ lnws^2 + lnwi^2

fit=1:6
pars = list(lnk=1.5,lnhs=-5,lnhi=-5,lnss=-5,lnsi=-5,lnws=-5,lnwi=-5)

for (i in 2:7)  {
    fit[i] = mle(mll,start=pars[c(1,i)],fixed= 
pars[-c(1,i)],method="Nelder")
}


but it gives the following error:
}
Error in fit[i] = mle(mll, start = pars[c(1, i)], fixed = pars[-c(1, 
i)],  :
   incompatible types (from S4 to integer) in subassignment type fix

What have I missed?

Thanks for any suggestions

John Hodgson


        [[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