Thanks Thierry for your quick answer. Indeed this simplifies a lot my
method so I decided to apply it.
However I will be curious to check in which extend the coefficients
obtained with the gls function are similar to the ones obtained using
glm and whitening. It seems to me thant the method are indeed pretty
similar.
So if someone knows a function which allows me to predict my response
and its associated variance using R after whitening and glm (see
original question), I am still eager to know it.
Best,
Xo
<>< <>< <>< <><
Xochitl CORMON
+33 (0)3 21 99 56 84
Doctorante en écologie marine et science halieutique
PhD student in marine ecology and fishery science
<>< <>< <>< <><
IFREMER
Centre Manche Mer du Nord
150 quai Gambetta
62200 Boulogne-sur-Mer
<>< <>< <>< <><
Le 28/01/2015 16:19, ONKELINX, Thierry a écrit :
Dear Xochitl,
Have a look at gls() from the nlme package. It allows you to fit auto
correlated errors.
gls(k ~ NPw, correlation = corAR1(form = ~ Time))
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than
asking him to perform a post-mortem examination: he may be able to say what the
experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure
that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: R-help [mailto:r-help-boun...@r-project.org] Namens Xochitl CORMON
Verzonden: woensdag 28 januari 2015 15:09
Aan: Rlist; Rlist
Onderwerp: [R] Prediction of response after glm on whitened data
Hi all,
Here is a description of my case. I am sorry if my question is also statistic
related but it is difficult to disentangle. I will however try to make it only
R applied.
My response is a growth constant "k" and my descriptor is prey biomass "NP" and
time series is of 21 years.
I applied a gaussiam GLM (or LM) to this question. After the regression I
tested the residuals for autocorrelation using acf(). Because autocorrelation
was significant I decided to whiten my data using
{car}dwt() in order to obtain rho (an estimation of my correlation) and then
applying the following to my data in order to remove autocorrelation:
kw_i = k_i - rho * k_i-1
NPw_i = NPw_i - rho * NPw_i-1
(method from Jonathan Taylor,
http://statweb.stanford.edu/~jtaylo/courses/stats191/correlated_errors.html).
After that I fitted a model on this whitened data (kw_i ~ NPw_i), realised an
F-test and obtained classical results such as deviance explained, pvalues and
of course the intercept and coefficient of the last regression. However doing
that and coming to prediction using
predict() I can only obtained predictions of deltaK (kw_i) in function of
deltaNP (NPw_i) but I am actually interested in being able to predict k in
function of NP...
Is there a solution to predict directly k and its associated variance using R
without having to detail in the script all the mathematical process necessary
to come back to something like k_i = mu + rho * k_i-1
+ beta(NPw_i - rho * NPw_i-1) + epsilon
with mu being the intercept, beta the regression coefficient and epsilon the
error, ?
Thank you for your help,
Best,
Xochitl C.
--
<>< <>< <>< <><
Xochitl CORMON
+33 (0)3 21 99 56 84
Doctorante en écologie marine et science halieutique PhD student in marine
ecology and fishery science
<>< <>< <>< <><
IFREMER
Centre Manche Mer du Nord
150 quai Gambetta
62200 Boulogne-sur-Mer
<>< <>< <>< <><
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Disclaimer<https://www.inbo.be/nl/disclaimer-mailberichten-van-het-inbo>
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.