Skip to main content
8 events
when toggle format what by license comment
May 5, 2020 at 16:22 comment added Gavin Simpson I'm not sure what you mean by "fixed effects" here; the intervals are mostly on the expected values of the response for the two groups as $x$ varies over it's range. That's fancy speak for an interval on the estimated mean value as a function of $x$. These are not prediction intervals or quantiles of the implied conditional distribution of the response; you could compute those, but that's not what these intervals are intended to represent. The scatter represents the variation in the data about the conditional mean.
May 5, 2020 at 14:37 comment added TJC It turns out that there seems to be an error in the plotting of the GAMM using itsadug in R version 4.0. I rolled back my R to 3.6.3, and also my itsadug version to 2.3 and the plotting works just fine now (no weird offsets). I have accepted @gavin-simpson answer now that everything looks fine. Also - is it normal that the confidence bands for the fixed effect predictions are so narrow relative to the visual scatter in individual points?
May 5, 2020 at 14:34 vote accept TJC
Apr 29, 2020 at 5:30 comment added TJC The gamma/tweedie distributions are a good idea to try and account for the nonconstant variance. I did however try recoding the id variable to be unique to each subject AND method, e.g., subject 122 now has two id values that relate to method A and B (122_A and 122_B). Recoding the id label like this, and fitting mdl2, produces the fit with the closest resemblance to the first two figures above. I just worry that the GAMM now thinks there are twice as many subjects now, and I'm not adequately accounting for the clustering of data within a subject... If that makes sense?
Apr 28, 2020 at 21:43 comment added Gavin Simpson Actually, ignore that (well, don't but I may be ignoring the random effects). Still it might be worth switching to a distribution that is positive if the response can't be negative.
Apr 28, 2020 at 21:41 comment added Gavin Simpson From the Fitted vs Observed plot it seems that the data have a non-constant mean variance relationship which suggests that assuming the response is conditionally distributed Gaussian is incorrect. Look at the plots produced by gam.check() and you should see problems in the residuals plots drawn. I would suggest using family = Gamma(link = 'log') or family = tw() as starting points to fix this problem, using the same model structure
Apr 28, 2020 at 19:49 comment added TJC I have tried both those suggestions and still get strange results. I edited my original question to include some example data and some figures of my attempt to use the GAM with your suggested random effect terms. Is it perhaps something to do with how my id or methods variables are coded? Or maybe the GAM is just not converging well enough? (Though I get no errors from the model output)
Apr 27, 2020 at 17:51 history answered Gavin Simpson CC BY-SA 4.0