[R-sig-ME] MCMCglmm Poisson with an offset term and splines

dani orchidn at live.com
Tue Sep 26 21:26:01 CEST 2017


Hi Jarrod,


Thank you so much for your kind answer! I have been struggling with it and went back to read more about MCMC. I will be posting the complete code and the data as soon as I get a chance this afternoon.


Best regards!

Dani N-M


Sent from Outlook<http://aka.ms/weboutlook>
________________________________
From: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org> on behalf of dani <orchidn at live.com>
Sent: Monday, September 25, 2017 10:08:08 AM
To: Jarrod Hadfield; Ben Bolker
Cc: r-sig-mixed-models at r-project.org; Matthew
Subject: Re: [R-sig-ME] MCMCglmm Poisson with an offset term and splines

Hello again,


Thank you so much for your prompt response. I apologize for the silly questions, I am a true beginner and I am ashamed of my ignorance. I guess I should explain what I did:


I used the spl2 function and obtained the fixed and random factors corresponding to the variable I needed the smoother for (named f_lfv_c).


newdatab$l_lfvcspo<-spl2(~s(f_lfv_c,k=10), data=newdatab, p=F)
newdatab$l_lfvcspn<-spl2(~s(f_lfv_c,k=10), data=newdatab)

I am not sure how to attach the random effects corresponding to the l_lfvcspn. I get this array of 8 variables and I am really not sure how to include them in the model. Should I get forget about spl2 and simply add the variable f_lfv_c as a fixed term and spl(f_lfv) in the idv random term?

Also, it seems to me that I have 11 fixed effects, I am not sure what to do.

I am really sorry about all these silly questions, I really do not understand how these things work, but I would like to know more about this.

Best regards!


Sent from Outlook<http://aka.ms/weboutlook>
________________________________
From: Jarrod Hadfield <j.hadfield at ed.ac.uk>
Sent: Monday, September 25, 2017 8:51:09 AM
To: dani; Ben Bolker
Cc: Matthew; r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] MCMCglmm Poisson with an offset term and splines


Hi,

The example is not reproducible: l_lfvcspn does not exist.

The error is telling you that you don't have 11 fixed effects in the model. Change k to the number of fixed effects in the model.

Jarrod


On 25/09/2017 16:39, dani wrote:
mc_spl1gna <- MCMCglmm(y ~ age+x2+x8+x9+x3+l_lfvcspo+x4+x5+x6+x7+offset,
                       random =~ STUDYID+class+idv(l_lfvcspn),
                       data   = newdatab,
                       family = "poisson"


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list