From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>

Date: Fri 10 Feb 2006 - 00:24:02 EST

Date: Fri 10 Feb 2006 - 00:24:02 EST

Please do not repeatedly post the same thing. This is the same as

https://stat.ethz.ch/pipermail/r-help/2006-February/086381.html

(except you remembered to sign that one).

You are fitting a weighted not a generalised least squares model: lm() will do that.

On Thu, 9 Feb 2006, nhy303@abdn.ac.uk wrote:

> I am trying to fit a generalised least squares model using gls in the nlme

*> package.
**>
**> The model seems to fit very well when I plot the fitted values against the
**> original values, and the model parameters have quite narrow confidence
**> intervals (all are significant at p<5%).
**>
**> The problem is that the log likelihood is always given as -Inf. This
**> doesn't seem to make sense because the model seems to fit my data so well.
**> I have checked that the residuals are stationary using an adf test. I
**> can't work out whether
**> - the model really doesn't fit at all
**> - there is something in my data that stops the implementation of logLik
**> working correctly (the -Inf value says the calculation hasn't worked)
**>
**> Possible causes are:
**> - There are lots of NAs in my data (model and response variables)
**> - There is some autocorrelation in the data that is not accounted for by
**> the model (most is accounted for).
**>
**> But, I've tried recreating the problem using a simpler data set, and have
**> never found the same problem.
*

Well, how then do you expect us to be able to recreate it?

As a pure guess, look at your weights. Are any numob4150 zero?

> The command I use to fit the model is...

*>
**>
**>
**> result2 <- gls(lci4150 ~ propCapInStomachs +
**> temperature +
**> as.factor(monthNumber) +
**> lagLci1 +
**> lagcap1 +
**> lagcap2,
**> data = monthly,
**> subset = subset1985,
**> na.action = na.approx,
**> weights = varFixed( ~ 1/numob4150)
**> )
**>
**>
**>
**> The output I get is...
**>
**>
**>
**> Generalized least squares fit by REML
**> Model: lci4150 ~ propCapInStomachs + temperature +
**> as.factor(monthNumber) + lagLci1 + lagcap1 + lagcap2
**> Data: monthly
**> Subset: subset1985
**> AIC BIC logLik
**> Inf Inf -Inf
**>
**> Variance function:
**> Structure: fixed weights
**> Formula: ~1/numob4150
**>
**> Coefficients:
**> Value Std.Error t-value p-value
**> (Intercept) -0.3282412 0.5795665 -0.566356 0.5717
**> propCapInStomachs 0.0093283 0.0039863 2.340107 0.0202
**> temperature 0.4342514 0.1526104 2.845490 0.0048
**> as.factor(monthNumber)2 0.3990717 0.3869991 1.031195 0.3036
**> as.factor(monthNumber)3 1.3788334 0.3675690 3.751223 0.0002
**> as.factor(monthNumber)4 1.4037195 0.3857764 3.638686 0.0003
**> as.factor(monthNumber)5 0.9903316 0.3436177 2.882074 0.0043
**> as.factor(monthNumber)6 0.3453741 0.3043698 1.134719 0.2577
**> as.factor(monthNumber)7 0.3948442 0.3035142 1.300909 0.1946
**> as.factor(monthNumber)8 0.5021812 0.3532413 1.421638 0.1565
**> as.factor(monthNumber)9 -0.0794319 0.3598981 -0.220707 0.8255
**> as.factor(monthNumber)10 0.3536805 0.3790538 0.933061 0.3518
**> as.factor(monthNumber)11 0.7874834 0.3557116 2.213826 0.0278
**> as.factor(monthNumber)12 0.1854279 0.3178320 0.583415 0.5602
**> lagLci1 0.5488437 0.0576144 9.526151 0.0000
**> lagcap1 0.0110994 0.0043669 2.541714 0.0117
**> lagcap2 -0.0088080 0.0041099 -2.143127 0.0332
**>
**>
**>
**> Does anyone have any suggestions of how I can get a meaningful value for
**> logLik? Or some other way that I can compare models.
**>
**> Thankyou,
**>
**> Lillian.
**>
*

-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Fri Feb 10 00:27:26 2006

*
This archive was generated by hypermail 2.1.8
: Sat 11 Feb 2006 - 02:00:26 EST
*