Dear R-help, I don't understand why Gls gives me an error when trying to fit a model with AR(2) errors, while gls (from nlme) does not. For example: library(nlme) library(rms) set.seed(1) d <- data.frame(x = rnorm(50), y = rnorm(50)) gls(y ~ x, data=d, correlation = corARMA(p=2)) #This works Gls(y ~ x, data=d, correlation = corARMA(p=2)) # Gives error # Error in `coef<-.corARMA`(`*tmp*`, value = value[parMap[, i]]) : # NA/NaN/Inf in foreign function call (arg 1) Gls(y ~ x, data=d, correlation = corARMA(p=1)) #This works I would rather use Gls than gls so that I can represent a variable with a spline using rcs. I'm using version 3-5.0 of rms in R 2.15.0. Thanks for any help you can give. Mark Seeto
Appears to be a definite bug, probably caused by having more than one correlation parameter. I hope to have this fixed within 3 days. Frank Mark Seeto wrote> > Dear R-help, > > I don't understand why Gls gives me an error when trying to fit a > model with AR(2) errors, while gls (from nlme) does not. For example: > > library(nlme) > library(rms) > set.seed(1) > d <- data.frame(x = rnorm(50), y = rnorm(50)) > gls(y ~ x, data=d, correlation = corARMA(p=2)) #This works > Gls(y ~ x, data=d, correlation = corARMA(p=2)) # Gives error > # Error in `coef<-.corARMA`(`*tmp*`, value = value[parMap[, i]]) : > # NA/NaN/Inf in foreign function call (arg 1) > Gls(y ~ x, data=d, correlation = corARMA(p=1)) #This works > > I would rather use Gls than gls so that I can represent a variable > with a spline using rcs. I'm using version 3-5.0 of rms in R 2.15.0. > > Thanks for any help you can give. > > Mark Seeto > > ______________________________________________ > R-help@ 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. >----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Gls-function-in-rms-package-tp4569521p4569829.html Sent from the R help mailing list archive at Nabble.com.
Frank, sorry if I seem impatient, but do you know approximately when this will be fixed? In the meantime, if I have library(nlme) library(rms) d <- data.frame(x = rnorm(50), y = rnorm(50)) and I'm interested in the 3 df test for x that I would get from anova(Gls(y ~ rcs(x, 4), data=d, correlation = corARMA(p=2))) is it sensible to instead do the following? d$x. <- rcspline.eval(d$x, nk=4)[, 1] d$x.. <- rcspline.eval(d$x, nk=4)[, 2] gls.intercept <- gls(y ~ 1, data=d, correlation=corARMA(p=2), method="ML") gls.rcs4 <- gls(y ~ x + x. + x.., data=d, correlation=corARMA(p=2), method="ML") anova(gls.intercept, gls.rcs4) Thanks, Mark Seeto National Acoustic Laboratories, Australia> Appears to be a definite bug, probably caused by having more than one correlation parameter. I hope to have this fixed within 3 days. > Frank > > Mark Seeto wrote >> Dear R-help, >> >> I don't understand why Gls gives me an error when trying to fit a >> model with AR(2) errors, while gls (from nlme) does not. For example: >> >> library(nlme) >> library(rms) >> set.seed(1) >> d <- data.frame(x = rnorm(50), y = rnorm(50)) >> gls(y ~ x, data=d, correlation = corARMA(p=2)) #This works >> Gls(y ~ x, data=d, correlation = corARMA(p=2)) # Gives error >> # Error in `coef<-.corARMA`(`*tmp*`, value = value[parMap[, i]]) : >> # NA/NaN/Inf in foreign function call (arg 1) >> Gls(y ~ x, data=d, correlation = corARMA(p=1)) #This works >> >> I would rather use Gls than gls so that I can represent a variable >> with a spline using rcs. I'm using version 3-5.0 of rms in R 2.15.0. >> >> Thanks for any help you can give. >> >> Mark Seeto