[R-sig-ME] questions about the nlme model in R

Douglas Bates bates at stat.wisc.edu
Thu Sep 27 19:37:21 CEST 2012


On Tue, Sep 25, 2012 at 10:09 AM, Margo Law <MLaw at esurance.com> wrote:
> Hello.

> My name is Margo Law and I am new to programming in the R language.  I have
> been working within the R Studio and on the Nonlinear Mixed-Effects Models R
> documentation your name and email appear as an author.

As I indicated in our telephone conversation, it is better to send
such questions to the R-SIG-Mixed-Models at R-project.org mailing list as
several of the readers on that list can respond to you question and
often much sooner than I am able to.

> I am wondering if you would help me.  I have a data set that consists of:
>
> Daily date (each day from 2008-2012)
>
> Weekday (a factor with 7 levels)
>
> Input value
>
> Output value
>
> A variable for each individual holiday (for example new.years.day 1 for
> ‘yes’ and 0 for ‘no’)
>
>
>
> I’m trying to run the nlme model on input and output values I have (known
> values) with ultimately using this to predict unknown output values.
>
>
>
>
>
> The program I am inputting is:
>
>
>
> model<-nlme(output~input+new.years.day+new.years.day.observed+mlk+valentines+presidents.day+
> easter+mothers.day+
>
>
> memorial.day+fathers.day+july4+july4.observed+labor.day+columbus.day+veterans.day+
>
>
> veterans.day.observed+thanksgiving.day+christmas.observed+christmas.day+christmas.eve+new.years.eve,
>
>                       data= input.dataset,
>
>
> fixed=input+new.years.day+new.years.day.observed+mlk+valentines+presidents.day+easter+
>
>
> mothers.day+memorial.day+fathers.day+july4+july4.observed+
>
>
> labor.day+columbus.day+veterans.day+veterans.day.observed+thanksgiving.day+
>
>
> christmas.observed+christmas.day+christmas.eve+new.years.eve~1,
>
>                       random=input~1|Weekday,
>
>
> start=c(0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1))

Well, first that isn't a nonlinear mixed-effects model, as far as I
can see.  You seem to be using a linear model formula as the first
argument, not a nonlinear model.  That formula will not be interpreted
as a linear model and you won't get the result that you expect.

If you do want to fit a linear mixed-effects model you would use lme
from the nlme package or lmer from the lme4 package.  However, both of
them are unlikely to be able to fit this model because you have so
many fixed-effects terms.

> When I run this in R I get the following error:
>
>
>
> Error in MEEM(object, conLin, control$niterEM) :
>
>   Singularity in backsolve at level 0, block 1
>
>
>
>
>
>
>
> I have looked everywhere I can find, but I have no idea what this error
> means or is referring to in order to know how to go about fixing it.
>
>
>
>
>
> My question is could you explain to me what this error means and what I
> would then need to do to go about fixing this?  Also would it be possible to
> provide a broader explanation of the nlme model, in particular how each
> individual piece works (if I’m saying that right so that it makes sense).
>
>
>
>
>
> Any help you could provide is greatly appreciated.
>
> Thank you so much.
>
>
>
>
>
> Margo Law
>
>
>
>
> This email may contain confidential and privileged inf...{{dropped:10}}



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