Displaying 20 results from an estimated 2000 matches similar to: "How to construct confidence bands from a gls fit?"
2011 Jan 30
2
ggplot2 -- scale_colour_manual()
According to Hadley's ggplot book (p. 109), both the graphs below should have a legend, and yet none appears in my hands.
Any suggestions? I can't see a typo. Is there a bug?
library(ggplot2)
data(LakeHuron)
huron = data.frame(year=1875:1972,level=LakeHuron)
p = ggplot(huron, aes(year)) +
geom_line(aes(y= level - 5), colour = 'blue') +
geom_line(aes(y= level + 5), colour
2009 Dec 01
1
ggplot legend for multiple time series
Hello All,
I am trying to create a legend for a black-white graph. The package I
use is ggplot2. It can add colors to the legend key but not line types.
Can you please help?
# example from Wickman (2009, ggplot2 - elegant graphics for data
analysis, page 109)
library(ggplot2)
huron <- data.frame(year=1875:1972, level=LakeHuron)
ggplot(huron, aes(year)) +
2012 May 25
1
Problem with Autocorrelation and GLS Regression
Hi,
I have a problem with a regression I try to run. I did an estimation of the
market model with daily data. You can see to output below:
/> summary(regression_resn)
Time series regression with "ts" data:
Start = -150, End = -26
Call:
dynlm(formula = ror_resn ~ ror_spi_resn)
Residuals:
Min 1Q Median 3Q Max
-0.0255690 -0.0030378 0.0002787
2008 Mar 20
5
time series regression
Hi Everyone,
I am trying to do a time series regression using the lm function. However,
according to the durbin watson test the errors are autocorrelated. And then
I tried to use the gls function to accomodate for the autocorrelated errors.
My question is how do I know what ARMA process (order) to use in the gls
function? Or is there any other way to do the time series regression in R? I
highly
2003 Oct 31
0
strange logLik results in gls (nlme)
I am trying to analyse a data with gls/lm using the following set of models
prcn.0.lm <- lm( log10(Y)~(cond-1)+(cond-1):t ,prcn)
prcn.1.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn,cor=corAR1())
prcn.0.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn)
prcn.1m.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn,cor=corAR1(),method="ML")
I get the following AICs for these models:
2004 Sep 03
0
ML vs. REML with gls()
Hello listmembers,
I've been thinking of using gls in the nlme package to test for serial
correlation in my data set. I've simulated a sample data set and have
found a large discrepancy in the results I get when using the default
method REML vs. ML.
The data set involves a response that is measured twice a day (once for
each level of a treatment factor). In my simulated data set, I
2010 Jul 08
0
Psudeo R^2 (or other effect size) in spatial gls regressions
Dear all,
I have been using the function gls in the package nlme in R to fit some spatial
regressions (as described in Dormann et al.). However, I have been struggling
trying to find a way to calculate a measure of effect size from these models, so
I wanted to know if any of you had an idea on how to do this.
More precisely, I am producing a multiple model with an exponential correlation
2002 Apr 14
0
gls
Dear all, I am confused.
I have encountered some strange behaviour of gls
> data(co2)
> co2.y <- aggregate(co2,1,mean)
> co2.y.data <- data.frame(co2=as.numeric(co2.y),year=seq(1959-1980,along=co2.y))
> co2.1.gls <- gls(co2~year+I(year^2), co2.y.data)
> co2.2.gls <- update(CO2.1.gls, corr=corAR1())
> summary(CO2.2.gls)
> plot(CO2.2.gls)
plot shows standardized
2011 Nov 22
0
Error in gls function in loop structure
Hi, r-users
I got a problem when I try to call a *gls* function in loop structure.
The gls function seems not able to recognize the parameters that I pass
into the loop function!
(But, if I use lm function, it works.)
The code looks like this:
=================================================
gls.lm <- function(Data, iv1, dv1)
{
gls.model <- gls(Data[ , dv1] ~ Data[ , iv1], correlation =
2009 Mar 04
0
'anova.gls' in 'nlme' (PR#13567)
There is a bug in 'anova.gls' in the 'nlme' package (3.1-90). The=20
bug is triggered by calling the function with a single 'gls' object=20
and specifying the 'Terms' argument but not the 'L' argument:
> library(nlme)
> fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont,
+ correlation =3D corSymm(form =3D ~ 1 |
2011 Dec 12
0
Confidence intervals of gls function?
Dear gls-experts,
while reading and testing some examples of the book
"introductionary time series analysis with R",
I encountered the following fact which puzzles me.
Confidence intervals for global temperature time series (P99)
computed from general least squares (GLS) to fit the time series.
I repeat the example from the book and get the same results:
temp.gls=gls(temp ~
2006 Aug 09
1
Joint confidence intervals for GLS models?
Dear All,
I would like to be able to estimate confidence intervals for a linear
combination of coefficients for a GLS model. I am familiar with John
Foxton's helpful paper on Time Series Regression and Generalised Least
Squares (GLS) and have learnt a bit about the gls function.
I have downloaded the gmodels package so I can use the estimable
function. The estimable function is very
2005 Feb 02
0
Not reproducing GLS estimates
Dear List:
I am having some trouble reproducing some GLS estimates using matrix
operations that I am not having with other R procedures. Here are some
sample data to see what I am doing along with all code:
mu<-c(100,150,200,250)
Sigma<-matrix(c(400,80,16,3.2,80,400,80,16,16,80,400,80,3.2,16,80,400),n
c=4)
sample.size<-100
temp <-
2012 Apr 19
2
Gls function in rms package
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
2011 Jun 08
1
Autocorrelation in R
Hi,
I am trying to learn time series, and I am attending a colleague's
course on Econometrics. However, he uses e-views, and I use R. I am
trying to reproduce his examples in R, but I am having problems
specifying a AR(1) model. Would anyone help me with my code?
Thanks in advance!
Reproducible code follows:
download.file("https://sites.google.com/a/proxima.adm.br/main/ex_32.csv
2003 Sep 25
1
Error from gls call (package nlme)
Hi
I have a huge array with series of data. For each cell in the array I
fit a linear model, either using lm() or gls()
with lm() there is no problem, but with gls() I get an error:
Error in glsEstimate(glsSt, control = glsEstControl) :
computed gls fit is singular, rank 2
as soon as there are data like this:
> y1 <- c(0,0,0,0)
> x1 <- c(0,1,1.3,0)
> gls(y1~x1)
2003 Jul 21
0
correlated residuals in gls: Coefficient matrix not invertible
Dear Rers,
I have threes series, x, y, z and I want to fit a model z ~ x + y. First of
all, I fit a lm. I found the residuals are correlated, by looking at the
acf() and pacf(). Then I tried to fit a gls model allowing residuals to be
correlated (correlation = corARMA(p=5, q=1)):
y.na <- as.data.frame(y[complete.cases(y),])
y.gls <- gls(z ~ x + y, data = y.na, correlation=corARMA(p=5,
2009 Sep 22
1
odd (erroneous?) results from gls
A couple weeks ago I posted a message on this topic to r-help, the response
was that this seemed like odd behavior, and that I ought to post it to one
of the developer lists. I posted to r-sig-mixed-models, but didn't get any
response. So, with good intentions, I decided to try posting once more, but
to this more general list.
The goal is (1) FYI, to make you aware of this issue, in case it
2009 Feb 16
0
problem with gls finding model terms without specifying data=named.object
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:
2009 Jan 28
1
gls prediction using the correlation structure in nlme
How does one coerce predict.gls to incorporate the fitted correlation
structure from the gls object into predictions? In the example below
the AR(1) process with phi=0.545 is not used with predict.gls. Is
there another function that does this? I'm going to want to fit a few
dozen models varying in order from AR(1) to AR(3) and would like to
look at the fits with the correlation structure