[R] t-test with autocorrelation correction
Christoph Buser
buser at stat.math.ethz.ch
Fri May 12 12:15:17 CEST 2006
Dear Denis
I do not know the correction by Dale and Fortin, but assuming
that it is closely related to page 15 of Cressie, 1993, it's
probably similar.
In Cressie page 15, it's assumed that the process has an AR(1)
structure. Therefore you could use the function gls() from the
"nlme" package with this correlation structure.
set.seed(1)
n <- 100
## Creating the data (AR(1) structure)
x <- rnorm(1,0,0.3)
for(i in 2:n)
x[i] <- x[i-1]*0.5 + rnorm(1,0,0.3)
## Calculating a model (only intercept)
res1 <- gls(model = x ~ 1, correlation = corAR1(), method = "ML")
summary(res1)
> Value Std.Error t-value p-value
> (Intercept) 0.06358824 0.04800817 1.324530 0.1884
## The test for the intercept is a one-sample t-test for the
## Null Hypothesis mu=0, using the correct standard error.
## Compare it to an ordinary t-test that has a too small
## standard error due to the disregard of the autocorrelation
## and therefore a too small p-value.
t.test(x)
> t = 2.3069, df = 99, p-value = 0.02314
There might be easier ways to implement a t-test with
autocorrelation. The advantage of this approach is that you can
calculate more general regression models with autocorrelation if
you do know the gls syntax.
Best regards,
Christoph
--------------------------------------------------------------
Credit and Surety PML study: visit our web page www.cs-pml.org
--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C13
ETH Zurich 8092 Zurich SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------
White.Denis at epamail.epa.gov writes:
> Has anyone implemented a t-test with the effective sample size
> correction proposed by Dale and Fortin, Ecoscience 9(2):162-167, 2002,
> using a discussion by Cressie, 1993, page 15?
>
> thanks,
> Denis
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list