[R-sig-ME] start values for starting parameters, factors [SEC=UNCLASSIFIED]

Douglas Bates bates at stat.wisc.edu
Thu Jan 12 20:50:45 CET 2012


On Wed, Jan 11, 2012 at 9:13 PM, Gosse, Michelle
<Michelle.Gosse at foodstandards.gov.au> wrote:
> Hi again,
>
> More reading later, and I have the following model with the log likelihood function specified:
> male.lme2 <- lme(BoxCoxXY ~ ordered(AgeFactor) + IntakeDay,
>                                    data=Male.Group,
>                                    random= ~1|RespondentID)
>
> male.nlme <- nlme(IntakeAmt ~ log(1/sqrt(2*pi*(Scale^2))) +
>                                                (-(A*BoxCoxXY-(B*AgeFactor + C*IntakeDay))^2)/(2*Scale)+(Lambda.Value-1)*log(IntakeAmt),
>                                    data=Male.Group,
>                                    fixed = A - B + C ~ 1,
>                                    random = A ~ 1|RespondentID,
>                                    start=fixef(male.lme2)
>                                    )
>
> The nlme syntax gives me the error:
> "Error in nlme.formula(IntakeAmt ~ log(1/sqrt(2 * pi * (Scale^2))) + (-(A * :
>            starting values for the fixed component are not the correct length"
>
> Reading on the internet made me understand that this is because there needs to be 3 fixed component start parameters, as confirmed by the model below not giving that error:
> male.nlme <- nlme(IntakeAmt ~ log(1/sqrt(2*pi*(Scale^2))) +
>                                                (-(A*BoxCoxXY-(B*AgeFactor + C*IntakeDay))^2)/(2*Scale)+(Lambda.Value-1)*log(IntakeAmt),
>                                    data=Male.Group,
>                                    fixed = A - B + C ~ 1,
>                                    random = A ~ 1|RespondentID,
>                                    start=c(A=1,B=1,C=1)
>                                    )
>
> The test model immediately above gives the error:
> "Error in chol.default((value + t(value))/2) :
>            the leading minor of order 1 is not positive definite"
>
> Which I think is occurring because of the warning messages:
> 1: In Ops.ordered(B, AgeFactor) :
>            '*' is not meaningful for ordered factors
> 2: In Ops.factor(C, IntakeDay) : * not meaningful for factors
>
> Given that I have 3 AgeFactor and 1 IntakeDay parameters, as there are 4 and 2 factor levels respectively (lowest level omitted for each), how do I specify the nlme model and fixed effects without changing to dummy variable coding?
>
> Sorry for all my questions on this, at least this time I get the error on step 14 of the traceback() so I feel I am coming to grips with nlme slowly.

Well, as the messages say, it doesn't make sense to multiply AgeFactor
by B and IntakeDay by C.

You really should start from the beginning and decide what the model
you are trying to fit is.  It must be an expression in which every
name is a parameter or a covariate name or the name of a function.
The names of the parameters are determined by the names of the start
argument.  The names of the covariates are those in Male.Group.  Do
these include IntakeAmt, Scale and Lambda?

Also, it is unusual and generally misguided to include IntakeAmt on
both the left and the right hand side of the formula.

We don't know why you are using the expressions that you are and it
probably won't be productive to continue to guess what form the model
expression should be then report error messages to us.




More information about the R-sig-mixed-models mailing list