Displaying 20 results from an estimated 2000 matches similar to: "help with gls"
2007 Jun 25
3
Bug in getVarCov.gls method (PR#9752)
Hello,
I am using R2.5 under Windows.
Looks like the following statement
vars <- (obj$sigma^2)*vw
in getVarCov.gls method (nlme package) needs to be replaced with:
vars <- (obj$sigma*vw)^2
With best regards
Andrzej Galecki
Douglas Bates wrote:
>I'm not sure when the getVarCov.gls method was written or by whom. To
>tell the truth I'm not really sure what
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,
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 Mar 07
1
lme and gls : accessing values from correlation structure and variance functions
Dear R-users
I am relatively new to R, i hope my many novice questions are welcome.
I have problems accessing some objects (specifically the random effects, correlation structure and variance function) from an object of class gls and lme.
I used the following models:
yah <- gls (outcome~ -1 + as.factor(Trial):as.factor(endpoint)+
2005 Jan 20
3
Constructing Matrices
Dear List:
I am working to construct a matrix of a particular form. For the most
part, developing the matrix is simple and is built as follows:
vl.mat<-matrix(c(0,0,0,0,0,64,0,0,0,0,64,0,0,0,0,64),nc=4)
Now to expand this matrix to be block-diagonal, I do the following:
sample.size <- 100 # number of individual students
I<- diag(sample.size)
bd.mat<-kronecker(I,vl.mat)
This
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]]
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
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
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
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 ~
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
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)
##
2007 Jun 20
2
Linear Mixed Models with nlme, more than one random effect
Hi, I' trying to learn how to use lme for Linear Mixed Models and I have a
problem when I have to include more than one random effect in my model. I
know that this could be a stupid question to ask, but I'm not able to solve
it by myself... One example: if my model is
response = operator + block + day
with operator and block as fixed effects and day as random effect, I use
res.lme
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
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 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
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
2005 May 31
0
prediction using gls with correlated residuals
Dear all,
I am a beginner user of R and I tried to fit a gls model with
explanatory variables and an AR(1) correlation component using the
function "gls" with:
correlation = corAR1 (form = ~ 1)
It should mean that the residual follows an AR(1) process, isn't it?
The problem is that, if I use the funcion "predict" I noticed that the
predicted values are the same as if I