lizzieinvancouver / wildhellgarden

0 stars 0 forks source link

check our models #6

Open lizzieinvancouver opened 1 year ago

lizzieinvancouver commented 1 year ago

@dbuona I looked at the pheno models we have (e.g. this one) and we did mess up (my fault). These models have population nested within species, like this:

   for (j in 1:n_pop){ //
     a_sppop[j] = a_sp[sp[j]] + a_sppop0[j];
   }

That's actually usually normal in most ecology studies -- individuals occur within populations within species. But in this case we got the species across all four population locations so species and site are crossed.

It's actually much easier to code this, you can check in with @DeirdreLoughnan and see her code here.

dbuona commented 1 year ago

I am happy to play with the stan models, in the meantime, I've fit some models in brms. If my understanding of lmer syntax is still good (https://stats.stackexchange.com/questions/228800/crossed-vs-nested-random-effects-how-do-they-differ-and-how-are-they-specified), this is the general form of models I am fitting: DOY~(1|plot)+(1|site) +(1|species) +(1|year), indicates a fully crossed design. Is this correct? and is this how we want to specify year and plot?

lizzieinvancouver commented 1 year ago

@dbuona That looks crossed to me. A couple more notes: I wouldn't include plot ... it seems a lot to ask the model to fit. Fitting year as a random effect seems hard depending on how many you have.

It would be good to check them in Stan some day as I don't guarantee that I understand the crossed syntax, but I am 99% sure that the below is nested:

DOY~(1|site/plot)

And so: DOY~(1|plot)+(1|site) Seems like it should be crossed.

dbuona commented 1 year ago

thanks! would you think its worth including year as a fixed-effect covariate? I think originally we decided one of the problems with the original model cat wrote was that there was a lot of inter-anunal variation being viewed by the model as population level

lizzieinvancouver commented 1 year ago

@dbouna Yes, I would try that rather than a random effect (as we just don't have enough years).

lizzieinvancouver commented 1 week ago

@dbuona Should we close this or use it to check the current models?