[R] NLME augPred Error

Pedro J. Aphalo pedro.aphalo at cc.jyu.fi
Thu Apr 8 08:52:24 CEST 2004


Dear Richard,

The problem that you report is documented (but no solution given) in the 
file ch08.R in the scripts directory of nlme package.

I have found the following workaround just by chance, but it may
give a clue of what is the problem to those who know how to program
in R.

The solution is to add an explicit call to factor in the nlme call.
In the case of the error reported by Richard the following call to nlme 
in the ch08.R file can be used:

fm4CO2.nlme <- update( fm3CO2.nlme,
   fixed = list(Asym + lrc ~ factor(Type) * factor(Treatment), c0 ~ 1),
   start = c(fm3CO2.fix[1:5], 0, 0, 0, fm3CO2.fix[6]) )

instead of:

fm4CO2.nlme <- update( fm3CO2.nlme,
   fixed = list(Asym + lrc ~ Type * Treatment, c0 ~ 1),
   start = c(fm3CO2.fix[1:5], 0, 0, 0, fm3CO2.fix[6]) )

I hope this helps,

Pedro.

Yang, Richard wrote:
> Dear all;
> 
> 	This error has been posted to the list a couple of times, but no
> answer / walk around solution is available. An example on P. 377 MEMSS
> 
> 
>>plot(augPred(fm5CO2.nlme, levels=0:1), layout =c(6,2))
> 
> 
> generates an error: "Error in predict.nlme(object, value[1:(nrow(value)/nL),
> , drop = FALSE], : Levels Quebec, Mississippi not allowed for Type.
> 
> for nlme ver. 3.1-45 in R.1.8.1, but it works fine in Splus6.2 or earlier
> versions. 
> 
> The source code for augPred() is very cryptica and identical in both S+ and
> R:
> 
> function (object, primary = NULL, minimum = min(primary), maximum =
> max(primary), 
>     length.out = 51, ...) 
> UseMethod("augPred").
> 
> The augPred() creates an augPred class object in S+ but generates the above
> error in R. Is there any difference in nlme3 in S+ and nlme versions in R?
> 
> 	Any ideas?
> 
> Richard
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
==================================================================
Pedro J. Aphalo
Department of Biological and Environmental Science
P.O. Box 35
FIN-40014 University of Jyväskylä
Finland
Phone  +358 14 260 2339
Mobile +358 50 3721504
Fax    +358 14 260 2321
mailto:pedro.aphalo at cc.jyu.fi
http://www.jyu.fi/~aphalo/                       ,,,^..^,,,




More information about the R-help mailing list