Hello R-help
I am having trouble getting gls to find the R objects that comprise a linear
model when the data=named.object option(option!) is not specified. In the
gls() help it states data is "an optional data frame containing the variables
named in model, correlation, weights, and subset. By default the variables are
taken from the environment from which gls is called".
An example:
> temp <- data.frame(x=1:10,y=11:20+rnorm(10))
> temp
x y
1 1 11.52458
2 2 10.77643
3 3 12.56845
4 4 14.48822
5 5 13.58116
6 6 16.26223
7 7 17.89619
8 8 19.40359
9 9 18.56699
10 10 21.05374
> gls(temp$y~temp$x)
Error in eval(expr, envir, enclos) : object "y" not found
> gls(y~x,data=temp)
Generalized least squares fit by REML
Model: y ~ x
Data: temp
Log-restricted-likelihood: -14.00387
Coefficients:
(Intercept) x
9.366256 1.135619
Degrees of freedom: 10 total; 8 residual
Residual standard error: 0.9156084
I'm trying hard to avoid having to specify the data option if at all possible.
Paul
-------------------------------
R version 2.8.0 (2008-10-20) (yes I know its not 2.8.1 but nothing in the 2.8.1
news seemed to be relevant, I also tried on a different PC with R 2.7.0 but
same problem)
i386-pc-mingw32
locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nlme_3.1-89
loaded via a namespace (and not attached):
[1] grid_2.8.0 lattice_0.17-17
-----------------------------------------------
Information on package 'nlme'
Description:
Package: nlme
Version: 3.1-89
Date: 2008-06-07
Priority: recommended
Title: Linear and Nonlinear Mixed Effects Models
Author: Jose Pinheiro <[email protected]>, Douglas Bates
<[email protected]>,
Saikat DebRoy <[email protected]>, Deepayan Sarkar
<[email protected]>,
the R Core team.
Maintainer: R-core <[email protected]>
Description: Fit and compare Gaussian linear and nonlinear mixed-effects
models.
Paul Rustomji
Rivers and Estuaries
CSIRO Land and Water
GPO Box 1666
Canberra ACT 2601
ph +61 2 6246 5810
mobile 0406 375 739
______________________________________________
[email protected] 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.