forked from DominiqueGravel/transition_maple
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFit_transitions_readme.rtf
More file actions
124 lines (116 loc) · 10.4 KB
/
Copy pathFit_transitions_readme.rtf
File metadata and controls
124 lines (116 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}
{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2}
{\list\listtemplateid3\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid201\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid3}
{\list\listtemplateid4\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid301\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid302\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid4}
{\list\listtemplateid5\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid401\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid5}
{\list\listtemplateid6\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid501\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid502\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid6}
{\list\listtemplateid7\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid601\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid602\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid7}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}{\listoverride\listid5\listoverridecount0\ls5}{\listoverride\listid6\listoverridecount0\ls6}{\listoverride\listid7\listoverridecount0\ls7}}
\margl1440\margr1440\vieww14140\viewh10120\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\f0\fs24 \cf0 Data input: \
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls1\ilvl0\cf0 {\listtext \'95 }transitions_r1.RData (with stateData, i.e. all plot-year observation for calibration and transitionsData, i.e. all pair of plots (transitions) for projection\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls2\ilvl0\cf0 {\listtext \'95 }projection_multimod_complete.txt OR projection_rf_complete.txt\
{\listtext \'95 }scale_info.Robj\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
Scripts:\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls3\ilvl0\cf0 {\listtext \'95 }3-transition_model.R and variants\
{\listtext \'95 }4-init_params.R\
{\listtext \'95 }5-fit_model.R (main script)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
Run the fit:\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls4\ilvl0\cf0 {\listtext \'95 }run Rscript 4-init_params.R subsetProportion\
\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural
\ls4\ilvl1\cf0 {\listtext \uc0\u8259 }> would produce 2 files "initForFit_name", one with random forest predictions and one with constant predictions\
{\listtext \uc0\u8259 }> uses subsample.r to select a subset of the data\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls4\ilvl0\cf0 {\listtext \'95 }run Rscript 5-fit_model.R initForFit_name option\
\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural
\ls4\ilvl1\cf0 {\listtext \uc0\u8259 }choose option 1 or 5 for intervals years\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
Look at results:\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls5\ilvl0\cf0 {\listtext \'95 }use 6-fastAnalysis.R to rapidly look at results\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
\f1 B M R T\
B 15358 794 203 0\
M 302 14433 51 960\
R 485 57 209 80\
T 0 891 40 15216
\f0 \
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\b \cf0 \ul \ulc0 Transition model
\b0 \ulnone \
\
The function computes the likelihood of observations, from data and a parameter set. It gives a value to minimize in GenSA (- sum of the log likelihood).\
\
There are 50 parameters (max) to fit in the complete model (each of the seven parameters of the transition model being function of climate). The functions of climate are build there.\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\f1 \cf0 logit_alphab = ab0 + ab1*ENV1 + ab2*ENV2 + ab3*ENV1^2 + ab4*ENV2^2 + ab5*ENV1^3 + ab6*ENV2^3\
logit_alphat = at0 + at1*ENV1 + at2*ENV2 + at3*ENV1^2 + at4*ENV2^2 + at5*ENV1^3 + at6*ENV2^3\
logit_betab = bb0 + bb1*ENV1 + bb2*ENV2 + bb3*ENV1^2 + bb4*ENV2^2 + bb5*ENV1^3 + bb6*ENV2^3\
logit_betat = bt0 + bt1*ENV1 + bt2*ENV2 + bt3*ENV1^2 + bt4*ENV2^2 + bt5*ENV1^3 + bt6*ENV2^3\
logit_theta = th0 + th1*ENV1 + th2*ENV2 + th3*ENV1^2 + th4*ENV2^2 + th5*ENV1^3 + th6*ENV2^3\
logit_thetat = tt0 + tt1*ENV1 + tt2*ENV2 + tt3*ENV1^2 + tt4*ENV2^2 + tt5*ENV1^3 + tt6*ENV2^3\
logit_eps = e0 + e1*ENV1 + e2*ENV2 + e3*ENV1^2 + e4*ENV2^2 + e5*ENV1^3 + e6*ENV2^3\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\f0 \cf0 \
N.B. \
Variables names are used here. The parameter vector in renamed internally in the transition model function. Be careful giving it in the right order.\
Transitions are converted to annual transitions or quinquenal transitions in option "5"\
\
\b \ul Parameter initialization
\b0 \ulnone \
\
Parameters were initialized using estimated probabilities for epsilon, theta, thetaT, betaB, betaT, alphaT, and alphaB.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\i \cf0 calculs:
\i0 \
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls6\ilvl0\cf0 {\listtext \'95 }epsilon was estimated by the average of: \
\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural
\ls6\ilvl1\cf0 {\listtext \uc0\u8259 }the proportion of BR transitions among plots with B at state 1 \
{\listtext \uc0\u8259 }the proportion of MR transitions among plots with M at state 1\
{\listtext \uc0\u8259 }the proportion of TR transitions among plots with T at state 1\
\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural
\ls6\ilvl0\cf0 {\listtext \'95 }theta (proba M->B or T) was estimated by the proportion of MT + MB transitions among plots with M at state 1\
{\listtext \'95 }thetaT (proba M->T) was estimated by the proportion of MT transitions among MT+MB transitions\
{\listtext \'95 }betaB ((proba T->M) / (B+M)) was estimated by the proportion of T.M transitions among plots with T at state 1 divided by the proportion of B+M among all plots at state 1\
{\listtext \'95 }betaT: same as betaB but for T\
{\listtext \'95 }alphaT and alphaB were calculed from 2 transitions (R->M and R->B) estimated as the proportion of RM or RB transitions among plots with R at state 1 and the proportions of M, T and B at state 1\
\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural
\ls6\ilvl1\cf0 {\listtext \uc0\u8259 }RM = alphat*(M+T)*alphab*(M+B)\
{\listtext \uc0\u8259 }RB = alphab*(M+B)*(1-alphat*(M+T))\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 GIVES\
\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural
\ls7\ilvl1\cf0 {\listtext \uc0\u8259 }alphaT = RM / ( (M+T)*(RM+RB) )\
{\listtext \uc0\u8259 }alphaB = (RM+RB) / (M+B)\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
The intercept terms were initialized by the estimated value (with logic transformation). All other terms were initialized at 0.\
\
To set up bound we tried with a coefficient of variation of 5 of the intercept term and added or subtracted it to the initial parameter values. Then we enlarged bounds and chose fixed variations according to parameters (+/- 200 and +/- 70).\
\
\b \ul subsample
\b0 \ulnone \
\
script: subsample.r\
\
The subsample is stratified by temperature. Plots are selected at different temperatures, which correspond to local differences in climate in space or time. This will correct for (or at least minimize) pseudo-replication bias.\
\
\
}