[R-sig-Geo] Paired (before-after comparison) t-test with spatial locations
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Sat Jun 24 10:11:01 CEST 2017
The classic t-test is something like "are boys taller than girls?".
Throw the boy's heights and the girl's heights into `t.test` and out
comes an answer (and a p-value). Now suppose you want to add a
covariate? Are these boys taller than these girls, accounting for any
difference in their parent's social class, say (to look at stunted
development due to malnutrition or something). Hmm I don't see a way
of doing that with `t.test`....
What you would then do is fit a linear model, like lm(height ~ gender
+ status, data=kids), and then look at the coefficient of gender.
What you want for your data is a similar formula, but you want a
spatially varying covariate, something like lm(measurement =
beforeafter + S(x)), where S(x) is a smooth surface. I think if you
run a kriging model with beforeafter as a covariate you can get a
parameter estimate for the "beforeafter" parameter. I can never
remember if kriging with covariates is universal kriging, ordinary
kriging, or which of the other 57 kriging varieties. Use the `gstat`
package and put it in your model. You might also be able to use BayesX
via the R2BayesX package to do this if your data isn't nicely
Gaussian...
Alternatively, since you seem to have colocated before and after
measurements, compute the difference at each location and do a kriging
fit on that. Then you can compute the fitted difference and standard
error maps, and plot maps where the difference is significantly large.
I'm not sure how you'd do a single, global test of "is 'after'
different to 'before'" though, but you'd get maps of where the change
is.
Alternatively alternatively, you might be able to do space-time
kriging with two time points, but I'm not sure if two time points are
enough - you can't fit much of a temporal model with two time points,
especially if they are all the same time-distance apart.
Or I might be completely wrong...
Barry
On Sat, Jun 24, 2017 at 2:07 AM, Dora Pearce <dorapearce3 at gmail.com> wrote:
> Hello R-sig-geo list,
>
> We have soil chemistry data before and after fire at specific spatial
> locations.
>
> Is there a "paired t-test" equivalent that can incorporate geospatial
> coordinates and hence adjust for spatial dependence in the data?
>
> Apologies in advance if I have missed the obvious in *spdep* and *spatstat*,
> but I am new to *R* and would appreciate your advice.
>
> Dora Pearce
> Honorary: Faculty of Science and Technology
> Federation University Australia
> University Dr, Mount Helen VIC 3350
> https://federation.edu.au/faculties-and-schools/faculty-of-science-and-technology
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list