I have a dataset with both fixed and random effect and I'm trying to build a mixed effects model for it. The data looks like the following:
Subject, Program, Response 1, 1, 43.2 1, 1, 31.4 1, 1, 120.2 1, 1, 5.0 1, 1, 35.7 1, 1, 80.4 1, 2, 20.6 1, 2, 19.4 1, 2, 45.5 1, 2, 9.8 1, 2, 11.1 1, 2, 15.2 1, 3, 43 1, 3, 43 ... 90, 5, 2300.1 90, 5, 2508.6 90, 5, 1500.5 90, 5, 2804.6 90, 5, 3400.4
So there are 90 subjects with 30=6x5 samples each, grouped by the 'Program' category (6 samples for each 'Program' type). The 'Response' is expected to change slightly with different Programs. Response is always positive with heavy right-tail. Here is a re-scaled plot of the data with loglogistic fit:
My aim: I want to know the population-level effect of all five 'Program' types. For example, 'Program' 4 could reduce the 'Response' by 12%.
- Baseline and scale of 'Response' varies wildly between Subjects. The 'Program' effect can include both proportional and constant changes.
- The real baseline of 'Response' per subject is not known, it must be estimated together with 'Program' effect.
If I only allow proportional changes, I can just proceed with:
myfit = glmer(Response ~ Program + (1|User), data = data, family = gaussian(link='log'))
using R's 'lme4' or I can use BRMS package with command:
myfit = brm(Response ~ Program + (1|User),data = data, family = lognormal())
How can I incorporate both constant and proportional changes into model? Is the 'nmer' the recommended tool for this?
Ok, I realized that using log-normal distribution naturally solves proportional changes, but not constant. So:
'log' link $\rightarrow$ proportional change is linear, constant change is nonlinear
'identity' link $\rightarrow$ proportional change is nonlinear, constant change is linear
So I cannot have both when using a linear model (mixed or not). I have updated my question accordingly. The question about non-linear mixed modeling with both type of effects is still valid.