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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
How to fix the value of random intercepts (lmer/MCMCglmm)
6 messages · PATRICK, Samantha, Jarrod Hadfield, Ben Bolker +1 more
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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Hi Jarrod The structure of the data is: Y = Cumulative number of offspring. X = Age. Age is mean centred so the intercept is at 22 years old. This is where the intercepts are fitted and for each individual I have an exact number of offspring at this age. I want to examine how the number of offspring increases with age. I am using random slopes to examine within individual changes with age. If I don't constrain the intercept at the individual level then the slope does not represent the actual increase with age, and you get results that are largely driven by the age at last sampling. If I constrain the intercepts, as I understand, the slope will represent the actual increase in fitness with age for each individual. Happy to post data if this is not clear enough/it would help. 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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ From: Jarrod Hadfield<mailto:j.hadfield at ed.ac.uk> Sent: ?Monday?, ?25? ?August? ?2014 ?11?:?33 To: Samantha Patrick<mailto:spatrick at glos.ac.uk> Cc: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org> 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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
Hi, There will be strong dependencies between observations not captured in the model and this is likely to result in spurious results. To see this, take Y(x) as the cumulative number of offspring at age x, and y(x) as the number of offspring produced at age x then Y(1) = y(1), Y(2) = y(1) + y(2), Y(3) = y(1) + y(2) + y(3) and so on... Why not model the number of offspring at each age (i.e. y(x)), and then work out the consequences of this model for total number of offspring at a given age ? For example, if the regression of y(x) on age is zero, then Y(x) increases linearly, and if the regression is negative it is decelerating etc. Cheers, Jarrod Quoting "PATRICK, Samantha" <spatrick at glos.ac.uk> on Mon, 25 Aug 2014 15:41:30 +0000:
Hi Jarrod The structure of the data is: Y = Cumulative number of offspring. X = Age. Age is mean centred so the intercept is at 22 years old. This is where the intercepts are fitted and for each individual I have an exact number of offspring at this age. I want to examine how the number of offspring increases with age. I am using random slopes to examine within individual changes with age. If I don't constrain the intercept at the individual level then the slope does not represent the actual increase with age, and you get results that are largely driven by the age at last sampling. If I constrain the intercepts, as I understand, the slope will represent the actual increase in fitness with age for each individual. Happy to post data if this is not clear enough/it would help. 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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ From: Jarrod Hadfield<mailto:j.hadfield at ed.ac.uk> Sent: ?Monday?, ?25? ?August? ?2014 ?11?:?33 To: Samantha Patrick<mailto:spatrick at glos.ac.uk> Cc: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org> 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 ******From 1st August - 14th November 2014 I will be based in Montr?al, which is 5 hours behind GMT ****** Tel: 07740 472 719 Skype: sammy_patrick https://sites.google.com/site/samanthacpatrick/ - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. - ?In the top 5 in the Green League Table; committed to sustainability? This email is confidential to the intended recipient. If you have received it in error please notify the sender and delete it from your computer. The University of Gloucestershire is a company limited by guarantee registered in England and Wales. Registered number: 06023243. Registered office: The Park, Cheltenham, GL50 2RH Please consider the environment before printing this email. -
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
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)
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
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