1. Next time you might try emailing the mixed-effects mailing list.

2. Maybe I'm missing some detail about your example, but have you
considered corAR1()?  Here is an example with negative correlation:

library(agridat)
dat <- kempton.competition
# Fixed genotype effects, random rep effects,
# Autocorrelation of neighboring plots within the same rep
require("nlme")
m1 <- lme(yield ~ -1+gen, random=~1|rep, data=dat,
          corr=corAR1(form=~col|rep))
print(m1)
Correlation Structure: AR(1)
 Formula: ~col | rep
 Parameter estimate(s):
       Phi
-0.2203263

# Lag 1 autocorrelation is negative--evidence of competition
plot(ACF(m1), alpha=.05, grid=TRUE)

Kevin Wright



On Sun, May 5, 2013 at 1:12 PM, Seth <sjmy...@syr.edu> wrote:

> Hi,
>
> I have a nonlinear model with residuals that are negatively autocorrelated
> at short distances.
>
> I can find no spatial correlation structures in nlme that can easily handle
> negative autocorrelation as most have bounds on parameter values so that
> correlation is from 0 to 1.
>
> First, is there something I am missing?
>
> I tried to roll my own by calculating a correlation matrix with some
> negative values off the diagonal and then setting the correlation structure
> as follows within the function gnls:
>
> correlation=corSymm(corr9x[lower.tri(corr9x)])
>
> where corr9x is the n x n matrix of correlations that I set up based upon
> distances between points in the data set.  Some of these correlations are
> positive and some are negative.  They are based on a Moran's I correlogram
> that I calculated from the residuals returned from a gnls model fit with NO
> spatial correlation employed.
>
> I get the following error:
>
> Initial values for corSymm do not define a positive-definite correlation
> structure
>
> I am unsure if the matrix is rejected out of hand because it contains
> negative values or if there is something I can do to coerce it.  I have
> checked the lower triangle matrix returned and it matches what I intended.
>
> Any input is appreciated.
>
> Seth Myers
>
>
>
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/negative-correlation-with-corSymm-in-nlme-or-another-way-tp4666357.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org 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.
>



-- 
Kevin Wright

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to