[R] possible inconsistency in nlme logLik or me

From: Daniel O'Shea <dan.oshea_at_dnr.state.mn.us>
Date: Thu, 24 Jan 2008 09:01:23 -0600


Hello,

I am comparing 2 nonlinear models one with a correlation structure. I used the gnls command in the nlme package to fit model 1 and then the update(mod1,corr=corExp(form=~lat+lon,nugget=T) to fit the same model but with a correlation structure. I am comparing models using AIC, but I am getting results that don't seem to match. I get matching results for the model with no correlation structure, but non corresponding results for the model with a correlation structure. Below are logLik for the models along with additional information. Am I doing something wrong?????

Information for model 1

rss=sum(resid(mod1)^2)=1318.645
var=rss/n=1.654511
n=797
number of parameters (K) = 10 (this does include the variance estimate)

if I use logLik(mod1) I get -1331.541 with 10 d.f.

if I use the formula:

(-.5*n*log(var))-(797/2*log(2*pi))-(n/2)

from Burnham and Anderson 2002 page 12,
I get the same result as above: -1331.541

Information for model 2 with a correlation structure corr=corExp(form=~lat+lon,nugget=T)

rss=1338.92
n=797
var=rss/n=1.679950
K=12
logLik(mod2)=-1313.65 with 12 d.f.
If I use the equation from Burnham and Anderson I get: -1337.621 different than the logLik result??

Dan



R-help_at_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. Received on Thu 24 Jan 2008 - 15:04:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jan 2008 - 15:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive