search for: corar1

Displaying 20 results from an estimated 133 matches for "corar1".

2011 Aug 08
1
mixed model fitting between R and SAS
...2 biopsy locations, and biopsy were taken at 2 time points. So each subject has 4 data points (from 2 biopsy locations and 2 time points). The objective is to study treatment difference.? I used lme to fit a mixed model that uses "biopsy.site nested within pid" as a random term, and used corAR1() as the correlation structure for between the 2 time points: library(nlme) test<-read.table("test.txt",sep='\t',header=T,row.names=1) fit<-lme(y~age + time * trt, random=~1|pid/biopsy.site, data = test, correlation=corAR1()) First, by above model specification, corAR1()...
2014 Jul 21
0
Error message for corAR1()
...del but keep getting an error message and am not sure what else to try. I should mention that Direction is being applied as the time covariate because each distance has an associated time stamp. G2<-gamm(density.km~f.Layer+direction+s(Distance.A,by=f.Layer), random=list(Platform.field=~1),corr=corAR1(form=~Distance.A|Platform.field/f.Layer), family=poisson,data=fish1) Maximum number of PQL iterations: 20 iteration 1 Error in Initialize.corAR1(X[[2L]], ...) : covariate must have unique values within groups for "corAR1" objects? Any help would be appreciated. Thanks [[alte...
2007 Mar 16
3
corAR1 in a random effects panel
...it rho belongs to (-1, 1) where: u and e are independent and normally zero-mean distributed. d is also independently normally zero-mean distributed. So, I want random effects for group i to be correlated in t, following an AR(1) process. I am using the mle command, including correlation=corAR1: lme(asis~prec+pobl+gola+entr,random=~1|codi,correlation=corAR1(0.8 ,form=~temp|codi))) i = codi t = temp I am not sure whether the AR(1) process is applied to the random effects (u_it) or the error term (e_it)... Any idea? Thanks. G -- Guillermo Villa Universidad Carlos III de Madrid Bus...
2008 Jan 25
1
Trouble setting up correlation structure in lme
...to model the correlation with AR(1) or even ARMA along those 6 time points. First, how is the order determined among the 6 levels of Time? Alphabetically? If so, I would have to be very careful about their labels? Or can I specify their order somehow? Secondly, I'm not so sure about the form in corAR1 here. Since the correlation is supposed to be along the Time points, is form=~1 | Subject/Time a correct setup? library(nlme) Data <- read.table("data.txt", header=TRUE) fm <- lme(Beta~Incent*Correctness+Oppor+(Time-1), random = ~1|Subj, correlation=corAR1(0.5, form=~1|Subj/Time...
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]]
2013 Jun 07
1
gamm in mgcv random effect significance
...eatment (z) and some not. xc is centered session number, int is the z*xc interaction. Based on prior work, xc is also smoothed Consider, for example, two models, both with AR(1) but one allowing a random effect on xc: g1 <- gamm(y ~ s(xc) +z+ int,family=binomial, weights=trial, correlation=corAR1()) g2 <- gamm(y ~ s(xc) +z+ int,family=binomial, weights=trial, random = list(xc=~1),correlation=corAR1()) I include the output for g1 and g2 below, but the question is how to test the significance of the random effect on xc. I considered a test comparing the Log-Likelihoods, but have no ide...
2002 Sep 18
1
memory allocation
Dear all; I experienced a memory allocation error while running gnls: > wBlplfe.wc <- update(wBlplfe.w, corr=corAR1()) Error: cannot allocate vector of size 37950 Kb In addition: Warning message: Reached total allocation of 256Mb: see help(memory.size) Increased memory limit to 512, 640 M, the allocation error persisted: > memory.limit(512) NULL > wBlplfe.wc <- update(wBlplfe.w, corr=corAR1()) Erro...
2007 Oct 09
2
Help with gamm errors
...unts' are obviously autocorrelated (with weeks closer together being more similar though the correlation may differ between gardens). Thus (I suspect) a gamm statement such as: > m1=gamm(present~s(week,bs="cc")+s(week,bs="cc",by=y1),random=list(garden=~1) , correlation=corAR1(form=~week|garden),family=binomial,data=count.data2) is required (y1 is year and the others are self explanatory, all variables are in count.data2). This yields the following output > Maximum number of PQL iterations: 20 > iteration 1 > Error in eval(expr, envir, enclos) : object &quo...
2008 Oct 13
0
correlation structure in gls or lme/lmer with several observations per day
..., 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 correlation for the same day. I tried with gls and lme from the nlme package, but with no success. One difficulty arises since corAR1 seems to require only one observation per day (see example below). Any idea on how to implement it, either with special correlation structures, or through random effects in lme/lmer ? should I try to define a "new" correlation structure corMultiAR1 ? If so, where can I find help on ho...
2006 Oct 30
3
correlation structure in lme without random effect
I was hoping to fit along the lines of g<-gl(20,5) y<-runif(100) fit<-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error "Incompatible formulas for groups in "random" and "correlation"" Any help would be greatly appreciated. Ben
2007 May 24
1
lme with corAR1 errors - can't find AR coefficient in output
Dear List, I am using the output of a ML estimation on a random effects model with first-order autocorrelation to make a further conditional test. My model is much like this (which reproduces the method on the famous Grunfeld data, for the econometricians out there it is Table 5.2 in Baltagi): library(Ecdat) library(nlme) data(Grunfeld)
2012 Jan 06
0
Correlated count data technique advice
...re below freezing. The counts were taken at the same location over a period of years. The data set is highly zero inflated and over-dispersed; glm with a quasipoisson error structure would seem to be appropriate, except that there is a high degree of correlation at lags of 1 making something like a corAR1 structure appropriate. My difficulty is that glm() does not take an argument for correlation. I could use lmer() to fit a model like: freezing days~years+(1|years), family=quasipoisson, correlation=corAR1 but lmer (and glmer) don't seem to be operating on quasi families anymore; I've fo...
2018 Apr 18
0
mgcv::gamm error when combining random smooths and correlation/autoregressive term
...e(index=rep(1:10,5), x=runif(50,0,1), subject = as.factor(sort(rep(1:5,10)))) # random intercept m1 = gamm(x~s(index), random=list(subject=~1), data=df, method = 'REML') #factor interaction, random intercept, AR errors m2 = gamm(x~s(index, by=subject), random=list(subject=~1), correlation=corAR1(form=~index|subject), data=df, method = 'REML') #factor interaction, random intercept and slope, AR errors m3 = gamm(x~s(index, by=subject), random=list(subject=~index), correlation=corAR1(form=~index|subject), data=df, method = 'REML') #random smooth on its own works ok m4 = gamm...
2006 Jan 06
2
panel data unit root tests
When finally got some time to do some coding, I started and stopped right after. The stationary test is a good starting point because it demonstrates how we should be able to move the very basic R matrices. I have a real- world small N data set with rows: id(n=1)---t1---variable1 ... id=(N=20)---T=21---variable1 Thus, a good test case. For first id I was considering something like this: lag
2011 Nov 18
1
[R-sig-ME] account for temporal correlation
...riment ?also having spatial correlation, to say, if subjects are are also grouped by their geographical position, > should i in this case be nesting location within subject? > If subjects were in spatial blocks then you would nest subject within location (~1|location/subject). Note (from ?corAR1) that you can also use an explicit time covariate, (~time|location/subject) -- otherwise the assumption is that observations within subject are ordered by time. > cheers > m. > > Il giorno 18 Nov 2011, alle ore 18:26, Ben Bolker ha scritto: > >> matteo dossena <matteo.dosse...
2004 Aug 12
1
correlation structures in NLME
I am using the latest version of R on a Windows machine and get the following error when I try to initialize a correlation structure with the function corAR1 in NLME. This example is taken from the book of Pinheiro and Bates, so it should work. What is going wrong? > library(nlme) > data(Orthodont) > cs1AR1 <- corAR1(0.8, form= ~1 | Subject) > cs1AR1 <- initialize(cs1AR1, data = Orthodont) Error in methodsPackageMetaName("C"...
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 your reply With kind regards Prodromos Zanis -- **************************************************** Dr. Prodromos Zanis Centre for Atmospheric P...
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 replicates (for each level of aa we have more than 2 abservati...
2005 Jun 28
1
How to extract the within group correlation structure matrix in "lme"
...from that model as an initial estimates to do multiple imputation for missing values of the response variable in the model. I am trying to extract the within group correlation matrix or covariance matrix. here is my code: f = lme(y ~x0+x1+trt+tim+x1:tim +tim:trt,random=~-1|subj, data=dat,corr =corAR1()) > f$sigma [1] 2.330854 b=summary(f)$modelStruct$corStruct > b Correlation structure of class corAR1 representing Phi 0.8518711 I think 0.8518711 and f$sigma is what I need to reconstruct the variance-cavariance matrix. So, How can I extract 0.8518711 so that I can assign it to a...
2006 Nov 20
1
My own correlation structure with nlme
...efine my own corStruct which is different from the classical one available in nlme. The structure of this correlation is given below. I am wondering to know how to continue with this structure by using specific functions (corMatrix, getCovariate, Initialize,...) in order to get a structure like corAR1, corSymm which will be working for my data. Thanks in advance. Regards M. Feddag *Correlation structure _ _* pairCorr <- function(A, B, lowerTriangle = TRUE){ n <- length(A) m <- length(B) if (n != m) stop("A and B must have same length") result <- matrix(0,...