I'm trying to analyze temporal trends in a community of amphibians and looking to see what variables may be important in understanding declines.
My response is a single vector of ln transformed abundance (it was averaged across multiple "traps" at a plot and so is not integer based).
My variables of interest are
plot = the level of sampling (fixed effect nested within site; coded as chr)
site = multiple plots per site (fixed effect nested within region; coded as chr)
region = multiple sites per region (random effect; coded as chr)
wateryear = just the year the sample was taken (fixed effect, coded as a factor in the data frame for repeated measures )
depth.30 = mean water depth 30 days prior to sample (fixed effect)
Here is my current model =
model= lmer(LN_total_1 ~ WATERYEAR*(1|REGION)*depth30.mean +
(1|REGION:SITE) +
(WATERYEAR|PLOT2) + ## this is the issue term data=ANOVA_basefile2)
I'm trying to use the (WATERYEAR|PLOT2) to denote that the plot is what is being measured repeatedly, but I'm not sure if this is the correct way of specifying that. Is this the correct way to code for repeated measures in this syntax?
I also tried doing WATERYEAR:PLOT2 -1 which would check to see if there was a sig difference across plots for each wateryear (I think...?) but that returns, "Error in is.nloptr(ret) : objective in x0 returns NA"
Also for the (1|REGION:SITE) that's specifying the fixed effect of site within the random effect of region, correct?
Thanks for the help!