# [R-sig-Geo] random effect

valerio.bartolino at uniroma1.it valerio.bartolino at uniroma1.it
Thu Oct 21 12:46:05 CEST 2010

```Dear R-sig-Geo list,
I've a question about a spatial regression model I'm working with. Here
is my problem and question:

I'm modeling the local densities of a species (y) as a second order
polynom of the geographical position (lon,lat), time (year), and a
certain number of other variables:

mod1 <- lm( y ~ ... + poly(lon,lat, degree=2)*as.factor(year))

Then, I know that the sampling has a certain spatial resolution, that I
can represent with a regular grid. Thus, I was thinking that
observations within the same cell of the grid (gr.id) cannot be
considered completely independent, and that this could be represented
with a random effect like:

mod2 <- lme( y ~ ... + poly(lon,lat, degree=2)*as.factor(year),
random=list(gr.id=~1))

An additional level of complexity within my formulation, is given by the
temporal resolution. Thus, I would like to group the spatial dependency
of observations from the same cell within certain time intervals
(time.gr). Here my problem comes. I'm a bit confused on how to formulate
exactly the random effect expressed above into time.gr groups. I have
alternative slightly different formulations in mind, but I miss their
difference in practice.

Thanks in advance for any help or advice.

Valerio

--
Valerio Bartolino, PhD

Institute of Marine Research - Swedish Board of Fisheries
PO Box 4, 45321 Lysekil, Sweden

Department of Earth Sciences - Gothenburg University
PO Box 460, 40530 Göteborg, Sweden

e-mail: valerio.bartolino at gvc.gu.se
valerio.bartolino at gmail.com

><(((*> ----- ><(((*> ----- ><(((*> ----- ><(((*>
```