This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################# | |
## 0/ simulate the data ## | |
################################# | |
set.seed(123) | |
N2 <- 50 # set the number of groups (higher level units) | |
N <- 1000 # number of observations | |
NM <- 2 # number of groups per observation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "spaMM" | |
output: html_document | |
--- | |
## Goal of this document: Compare AR1, exponential and Matern models (with between spatially correlated error variance and spatially uncorrelated (nugget) error variance using ASReml-R/spaMM | |
# Simulations | |
```{r} | |
## For a general intro see: http://kimura.univ-montp2.fr/%7Erousset/spaMM/spaMMintro.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Goal of this document: show that the first step of lmer (using 'lFormula') drops unused levels in a random effect | |
## 0/ Simulates some data | |
## 1/ Shows a way to trick lmer when the number of levels is lower than the number of observations | |
## 2/ Shows how this fail when the number of levels is higher than the number of observations | |
set.seed(3) | |
library(lme4) | |
################################# | |
## 0/ simulate the data ## |