similar to: prediction using gls with correlated residuals

Displaying 20 results from an estimated 8000 matches similar to: "prediction using gls with correlated residuals"

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,
2010 Jan 07
1
faster GLS code
Dear helpers, I wrote a code which estimates a multi-equation model with generalized least squares (GLS). I can use GLS because I know the covariance matrix of the residuals a priori. However, it is a bit slow and I wonder if anybody would be able to point out a way to make it faster (it is part of a bigger code and needs to run several times). Any suggestion would be greatly appreciated. Carlo
2008 Oct 13
0
correlation structure in gls or lme/lmer with several observations per day
Hi, To simplify, suppose I have 2 observations each day for three days. I would like to define the correlation structure of these 6 observations as follows: the correlation of 2 observations on the same day is, say, alpha, the correlation for 2 observations one day apart is rho and the correlation for 2 observations 2 days apart is rho^2. I.e. I would like to have an AR1 correlation + a
2003 Nov 21
0
gls with serial correlation
Hello there fellow R users, Im trying to fit a gls model to data which has serial correlation in the errors e(t)=p*e(t-1). However I dont seem to be having much luck in erradicating the autocorrelation in the residuals. I have created the following example. library(nlme) x<-rnorm(100) y<-3+2*x y<-y+arima.sim(100,model=list(ar=(0.6)))+rnorm(100,0,0.2) #Create a data set with first
2010 Dec 26
0
GLS with corAR(1) correlation structure residual/standard error calculation
I am using the gls function to fit a two-stage least squares model with first order autoregressive error terms. Since there is no automated adjustment for the use of two-stage least squares in this package, I am trying to manually replicate standard errors of the coefficient estimates in order to adjust for a first stage OLS estimate of endogenous variables. However, thus far I have been unable to
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
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 ~
2005 Apr 15
1
AR1 in gls function
Dear R-project users I would like to calculate a linear trend versus time taking into account a first order autoregressive process of a single time series (e.g. data$S80 in the following example) using th gls function. gls(S80 ~ tt,data=data,corAR1(value, form, fixed)) My question is what number to set in the position of value within corAR1? Should it be the acf at lag 1? I look forward for
2007 Jan 06
1
help with gls
Hello R-users, I am using gls function in R to fit a model with certain correlation structure. The medol as: fit.a<-gls(y~1,data=test.data,correlation=corAR1(form=~1|aa),method="ML") mu<-summary(fit.a)$coefficient With the toy data I made to test, the estimate of mu is exactly equal to the overall mean of y which can not be true. But, if I make a toy data with y more than two
2006 May 15
1
what's wrong with my "gls"? it does not allocate memory... even for the simplest AR1 model...
> myfit1 <- gls(col1 ~ col2+col3+col4+col5+col6-1, data=data2, corr=corAR1( 0.3202), method='ML') Error: cannot allocate vector of size 199712 Kb if I get rid of the "corr=corAR1(0.3202)" option, it works okay... can anybody help me? thanks a lot! [[alternative HTML version deleted]]
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
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
2004 Sep 23
1
R vs EViews - serial correlation
Dear all, I met with some problems when dealing with a time series with serial correlation. FIRST, I generate a series with correlated errors set.seed(1) x=1:50 y=x+arima.sim(n = 50, list(ar = c(0.47))) SECOND, I estimate three constants (a, b and rho) in the model Y=a+b*X+u, where u=rho*u(-1)+eps library(nlme) gls(y~x,correlation = corAR1(0.5)) # Is it the right procedure?
2005 Nov 17
1
anova.gls from nlme on multiple arguments within a function fails
Dear All -- I am trying to use within a little table producing code an anova comparison of two gls fitted objects, contained in a list of such object, obtained using nlme function gls. The anova procedure fails to locate the second of the objects. The following code, borrowed from the help page of anova.gls, exemplifies: --------------- start example code --------------- library(nlme) ##
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 <-
2006 Jul 13
1
Extracting Phi from gls/lme
I am trying to extract into a scalar the value of Phi from the printed output of gls or lme using corAR1 correlation. ie I want the estimate of the autocorrelation. I can't see how to do this and haven't seen it anywhere in str(model.lme). I can get all the other information - fixed and random effects etc. Is there an obvious way so that I can save the brick wall some damage? TIA
2009 Feb 02
0
repeated measures with gls
I am using the gls function of the nlme package to analyze data sets of soil respiration which have the following design: 3 complete blocks x 5 sampling dates (time from fertilization) x 3 fertilization levels. The fertilization dates are equal for all subjects (blocks) but not periodical (-46, 10, 24, 53, 123 days from the event). The code that I've been using is: fit.csnC<- gls(dno.C
2004 Dec 29
3
gls model and matrix operations
Dear List: I am estimating a gls model and am having to make some rather unconventional modifications to handle a particular problem I have identified. My aim is to fit a GLS with an AR1 structure, obtain the variance-covariance matrix (V), modify it as needed given my research problem, and then reestimate the GLS by brute force using matrix operations. All seems to be working almost perfectly,
2007 Nov 29
0
fatal error from R function "gls"
I would appreciate some help with the followiing error ... what did I do wrong and what is the woraroud. > library(nlme) > glmod <- gls(A ~ T +cosP +cos2P +cos4P +cos5P +sin3P +sin5P +cosP2 +sinP3 +P2, correlation=corAR1(),method="ML") Error: cannot allocate vector of size 491.3 Mb I have a bunch of humans' breathing signals. The recording frequency was 30 samples per