[R-sig-ME] How to fix the value of random intercepts (lmer/MCMCglmm)

Steve Walker steve.walker at utoronto.ca
Mon Aug 25 18:14:09 CEST 2014


On 2014-08-25, 12:06 PM, Ben Bolker wrote:
>    Fitting a cumulative distribution is sometimes statistically dicey,
> since the successive values will be correlated; is there a reason you
> can't take first differences?
>
>    Technically speaking, to do this in lme4 I think you would want to use
> a slope-only model and include an intercept for individuals as an offset:
>
> lmer (Y ~Intercept + Continuous Variable +
>      offset(indiv_intercept)+
>     (Continuous Variable +0|Individual)
>

In case its useful, you can compute the `indiv_intercept` variable with 
(for example),

set.seed(1)
(individual <- factor(rep(letters[1:5], 4)))
(intercepts <- setNames(rnorm(5), letters[1:5]))
intercepts[as.character(individual)]

Cheers,
Steve

>
>
>
> On 14-08-25 11:33 AM, Jarrod Hadfield wrote:
>> Hi Sam,
>>
>> You could do this in MCMCglmm but it sounds like it might (possibly) be
>> a bad idea. Could you give more details on how Y is actually obtained?
>>
>> Cheers,
>>
>> Jarrod
>>
>>
>> Quoting "PATRICK, Samantha" <spatrick at glos.ac.uk> on Mon, 25 Aug 2014
>> 15:16:27 +0000:
>>
>>> Hi All
>>>
>>> I am fitting a basic linear regression, where I want to estimate a
>>> single population intercept and slope.  In addition I am fitting
>>> random intercepts and slopes such that:
>>>
>>> lmer (Y ~Intercept + Continuous Variable + (Continuous Variable
>>> |Indiviudal Group))
>>>
>>> However the exact value of the individual group intercepts is known
>>> from the data set.  The reasons for this are a little involved but
>>> essentially Y is a cumulative total and so at the intercept I want to
>>> fit the actual cumulative total at this point for each individual.  It
>>> is important as the slope per individual needs to be constrained to
>>> pass through the actual intercept per individual.
>>>
>>> So I want to fit this model, estimating the population intercept and
>>> slope.  I then want to fix the individual group deviation from the
>>> population intercept (random intercepts), and from this model extract
>>> estimates of individual group random slopes.
>>>
>>> I have been unable to find any examples of fixing intercepts, unless
>>> they are fixed as a constant.  Is it possible to code the model in
>>> such a way? The model can be run in MCMCglmm or lmer  which ever
>>> package would allow me to constrain the intercepts.
>>>
>>> Thanks
>>>
>>> Sam​
>>>
>>>
>>> Dr Samantha Patrick
>>> Research Fellow
>>> Biosciences QU116
>>> Francis Close Hall Campus
>>> University of Gloucestershire
>>> Cheltenham, GL50 4AZ, UK
>>>
>>> Research Associate: OxNav, University of Oxford
>>>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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