The LORI model is designed to analyse count data with covariates, using a Poisson log-linear model. In particular, it can be used to assess the effect of temporal and geographical covariates on species abundances.
Let \(Y\in\mathbb{N}^{n\times p}\) be a (incomplete) matrix of counts, and \(L\in\mathbb{R}^{np\times K}\) a matrix of covariates about the rows and columns of \(Y\). For example if \(Y\) counts the abundance of species across sites (rows) and time stamps (columns), \(L\) might contain temporal, spatial, and spatio-temporal information.
## Loading required package: Matrix
## Loading required package: foreach
## Loaded glmnet 2.0-16
The {Aravo data set} measures the abundance of \(82\) species of alpine plants in \(75\) sites in France. The data consist of a contingency table collecting the abundance of species across sampling sites. Covariates about the environments and species are also available.
## Aspect Slope Form PhysD ZoogD Snow
## AR07 7 2 1 50 no 140
## AR71 1 35 3 40 no 140
## AR26 5 0 3 20 no 140
## AR54 9 30 3 80 no 140
## AR60 9 5 1 80 no 140
## AR70 1 30 3 40 no 140
## Height Spread Angle Area Thick SLA N_mass Seed
## Agro.rupe 6 10 80 60.0 0.12 8.1 218.70 0.08
## Alop.alpi 5 20 20 190.9 0.20 15.1 203.85 0.21
## Anth.nipp 15 5 50 280.0 0.08 18.0 219.60 0.54
## Heli.sede 0 30 80 600.0 0.20 10.6 233.20 1.72
## Aven.vers 12 30 60 420.0 0.14 12.5 156.25 1.17
## Care.rosa 30 20 80 180.0 0.40 6.5 208.65 1.68
d <- dim(aravo$spe)
n <- d[1]
p <- d[2]
# Create covariate matrix, choose quantitative variables in Row and Column covariates
# and use covmat function to replicate species/environments
# center and scale covariate matrix
cov <- scale(covmat(aravo$env[, c(1,2,4,6)], aravo$traits, n, p))
lambda2 <- cv.glmnet(cov, unlist(c(aravo$spe)), family = "poisson")$lambda.min
lambda1 <- qut(aravo$spe, cov, lambda2)
##
1 / 100
2 / 100
3 / 100
4 / 100
5 / 100
6 / 100
7 / 100
8 / 100
9 / 100
10 / 100
11 / 100
12 / 100
13 / 100
14 / 100
15 / 100
16 / 100
17 / 100
18 / 100
19 / 100
20 / 100
21 / 100
22 / 100
23 / 100
24 / 100
25 / 100
26 / 100
27 / 100
28 / 100
29 / 100
30 / 100
31 / 100
32 / 100
33 / 100
34 / 100
35 / 100
36 / 100
37 / 100
38 / 100
39 / 100
40 / 100
41 / 100
42 / 100
43 / 100
44 / 100
45 / 100
46 / 100
47 / 100
48 / 100
49 / 100
50 / 100
51 / 100
52 / 100
53 / 100
54 / 100
55 / 100
56 / 100
57 / 100
58 / 100
59 / 100
60 / 100
61 / 100
62 / 100
63 / 100
64 / 100
65 / 100
66 / 100
67 / 100
68 / 100
69 / 100
70 / 100
71 / 100
72 / 100
73 / 100
74 / 100
75 / 100
76 / 100
77 / 100
78 / 100
79 / 100
80 / 100
81 / 100
82 / 100
83 / 100
84 / 100
85 / 100
86 / 100
87 / 100
88 / 100
89 / 100
90 / 100
91 / 100
92 / 100
93 / 100
94 / 100
95 / 100
96 / 100
97 / 100
98 / 100
99 / 100
100 / 100
## [1] -1.6986393 -1.2711974 -0.7957705 -1.2711985 -1.8417378 -0.9409538
## [7] -0.9101852 -1.2711949 -1.0393942 -0.9727056 -1.2286363 -0.9409528
## [13] -0.9101784 -0.7691116 -0.9101843 -0.9101815 -1.0394059 -1.1486007
## [19] -1.1486010 -1.3621735 -0.8513499 -0.9727056 -1.0744933 -0.7178215
## [25] -1.0394021 -0.6225047 -1.1108598 -1.6986449 -1.1108601 -0.6931328
## [31] -0.9102007 -0.9101930 -1.6341092 -2.4607678 -2.6149128 -1.6986469
## [37] -1.5163266 -1.4109736 -1.0055112 -0.7178280 -1.0055149 -1.1108726
## [43] -1.3621866 -1.0055163 -0.7431563 -1.2286591 -1.3621893 -1.0745091
## [49] -1.8417482 -1.9217884 -1.2712144 -1.2286605 -1.3156690 -1.6341164
## [55] -1.0745125 -1.5163365 -1.0745113 -1.0745122 -1.4622703 -1.3621881
## [61] -1.3156680 -1.3621869 -1.2712183 -1.0745090 -1.1878366 -1.5163337
## [67] -0.9409742 -1.0394147 -0.9101961 -1.2712164 -1.0394191 -1.0745073
## [73] -1.5734936 -1.0394085 -1.2712151
## [1] 0.78697994 1.12620719 0.01378591 -1.21831151 -0.02875385
## [6] 0.80602633 0.78699428 -0.52518249 -0.67932996 0.01378486
## [11] -1.77790082 -0.02875339 0.01378533 0.86108574 -1.08478478
## [16] 1.48013239 -0.21980042 -0.76633937 1.13982119 0.05460798
## [21] -0.86164629 -0.33102826 -0.21980598 -1.77790072 -1.77790086
## [26] -2.47098642 -2.47098640 0.44665260 0.01379271 0.26972078
## [31] -0.39164834 0.47332310 -1.21831085 -0.59928915 -2.47098640
## [36] -0.07320453 -0.52518267 -1.08478481 0.20302940 1.19245003
## [41] 0.82473078 -0.27387201 -0.76633932 -1.37245620 0.86109382
## [46] -0.11972330 -1.55476951 0.82472040 -0.76633938 -2.47098645
## [51] 1.13980804 0.59693555 1.01012469 -0.67933029 -1.55476962
## [56] -0.16851362 0.33224389 0.41926178 1.04043418 -2.06556228
## [61] -1.77790072 -2.06556231 -0.76633944 -0.02875112 0.01378498
## [66] -0.86164654 0.91328127 -0.96700510 -2.06556230 -0.21980059
## [71] -2.06556229 0.54930754 -0.21980567 -0.59928626 -2.47098650
## [76] -2.47098637 -1.55476961 -1.37245609 -0.76633932 -0.67932977
## [81] -2.47098647 -1.55476945