Dear Colleagues,
I have a 'factor' predictor called 'type' (with 4 levels). In the
random part, I have used `||` so the levels of 'type' can't correlate
with each other.
But I wonder why still correlations are reported in the output?
Thanks, Simon
lmer(y~type + (type || ID), data = data)
Random effects:
Groups Name Std.Dev. Corr
ID type0 0.4276
type1 0.7012 0.81
type2 0.7115 0.72 0.97
type3 0.7655 0.83 1.00 0.98
Why || doesn't zero out the correlations in lmer
6 messages · Simon Harmel, Phillip Alday, ji@verissimo m@iii@g oii gm@ii@com
This is a well-documented issue: || doesn't zero correlations between a categorical variable's levels. As far as I know, there are software-development/technical reasons for this, not statistical ones. The afex package has an implementation that zeroes everything out.
On 8/10/21 4:32 pm, Simon Harmel wrote:
Dear Colleagues,
I have a 'factor' predictor called 'type' (with 4 levels). In the
random part, I have used `||` so the levels of 'type' can't correlate
with each other.
But I wonder why still correlations are reported in the output?
Thanks, Simon
lmer(y~type + (type || ID), data = data)
Random effects:
Groups Name Std.Dev. Corr
ID type0 0.4276
type1 0.7012 0.81
type2 0.7115 0.72 0.97
type3 0.7655 0.83 1.00 0.98
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Thank you, this is extremely helpful to know. You mentioned it's well documented, any possible links to share? Also, does nlme::lme() behave in the same manner in this regard?
On Fri, Oct 8, 2021 at 4:46 PM Phillip Alday <me at phillipalday.com> wrote:
This is a well-documented issue: || doesn't zero correlations between a categorical variable's levels. As far as I know, there are software-development/technical reasons for this, not statistical ones. The afex package has an implementation that zeroes everything out. On 8/10/21 4:32 pm, Simon Harmel wrote:
Dear Colleagues,
I have a 'factor' predictor called 'type' (with 4 levels). In the
random part, I have used `||` so the levels of 'type' can't correlate
with each other.
But I wonder why still correlations are reported in the output?
Thanks, Simon
lmer(y~type + (type || ID), data = data)
Random effects:
Groups Name Std.Dev. Corr
ID type0 0.4276
type1 0.7012 0.81
type2 0.7115 0.72 0.97
type3 0.7655 0.83 1.00 0.98
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
You can also convert your factor to (three) numerical predictors, according to its contrasts. In that case, the double bar will remove the correlation parameters. This is well explained by Reinhold Kliegl here: https://rpubs.com/Reinhold/22193 Jo?o
On Fri, 2021-10-08 at 17:07 -0500, Simon Harmel wrote:
Thank you, this is extremely helpful to know. You mentioned it's welldocumented, any possible links to share? Also, does nlme::lme() behave in the same manner in this regard? On Fri, Oct 8, 2021 at 4:46 PM Phillip Alday <me at phillipalday.com> wrote:
This is a well-documented issue: || doesn't zero correlations between acategorical variable's levels. As far as I know, there aresoftware-development/technical reasons for this, not statistical ones. The afex package has an implementation that zeroes everything out. On 8/10/21 4:32 pm, Simon Harmel wrote:
Dear Colleagues, I have a 'factor' predictor called 'type' (with 4 levels). In therandom part, I have used `||` so the levels of 'type' can't correlatewith each other. But I wonder why still correlations are reported in the output?Thanks, Simon lmer(y~type + (type || ID), data = data) Random effects: Groups Name Std.Dev. Corr ID type0 0.4276 type1 0.7012 0.81 type2 0.7115 0.72 0.97 type3 0.7655 0.83 1.00 0.98
_______________________________________________R-sig-mixed- models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
_______________________________________________R-sig-mixed-models at r- project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
On 10/8/21 17:07, Simon Harmel wrote:
Thank you, this is extremely helpful to know. You mentioned it's well documented, any possible links to share?
The lme4 documentation, e.g. https://www.rdocumentation.org/packages/lme4/versions/1.1-27.1/topics/lmer
(Because of the way it is implemented, the ||||-syntax /works only for design matrices containing numeric (continuous) predictors/; to fit models with independent categorical effects, see |dummy <https://www.rdocumentation.org/link/dummy?package=lme4&version=1.1-27.1>| or the |lmer_alt| function from the afex package.)
Also, does nlme::lme() behave in the same manner in this regard?
I am unaware of nlme supporting the double-bar syntax at all, but specifing the correlation structure to be diagonal (pdDiagonal? it's been a while) will force all correlations to zero.
On Fri, Oct 8, 2021 at 4:46 PM Phillip Alday <me at phillipalday.com> wrote:
This is a well-documented issue: || doesn't zero correlations between a categorical variable's levels. As far as I know, there are software-development/technical reasons for this, not statistical ones. The afex package has an implementation that zeroes everything out. On 8/10/21 4:32 pm, Simon Harmel wrote:
Dear Colleagues,
I have a 'factor' predictor called 'type' (with 4 levels). In the
random part, I have used `||` so the levels of 'type' can't correlate
with each other.
But I wonder why still correlations are reported in the output?
Thanks, Simon
lmer(y~type + (type || ID), data = data)
Random effects:
Groups Name Std.Dev. Corr
ID type0 0.4276
type1 0.7012 0.81
type2 0.7115 0.72 0.97
type3 0.7655 0.83 1.00 0.98
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Thank you all for the informative comments. Simon
On Fri, Oct 8, 2021 at 10:46 PM Phillip Alday <me at phillipalday.com> wrote:
On 10/8/21 17:07, Simon Harmel wrote:
Thank you, this is extremely helpful to know. You mentioned it's well documented, any possible links to share?
The lme4 documentation, e.g. https://www.rdocumentation.org/packages/lme4/versions/1.1-27.1/topics/lmer
(Because of the way it is implemented, the ||||-syntax /works only for design matrices containing numeric (continuous) predictors/; to fit models with independent categorical effects, see |dummy <https://www.rdocumentation.org/link/dummy?package=lme4&version=1.1-27.1>| or the |lmer_alt| function from the afex package.)
Also, does nlme::lme() behave in the same manner in this regard?
I am unaware of nlme supporting the double-bar syntax at all, but specifing the correlation structure to be diagonal (pdDiagonal? it's been a while) will force all correlations to zero.
On Fri, Oct 8, 2021 at 4:46 PM Phillip Alday <me at phillipalday.com> wrote:
This is a well-documented issue: || doesn't zero correlations between a categorical variable's levels. As far as I know, there are software-development/technical reasons for this, not statistical ones. The afex package has an implementation that zeroes everything out. On 8/10/21 4:32 pm, Simon Harmel wrote:
Dear Colleagues,
I have a 'factor' predictor called 'type' (with 4 levels). In the
random part, I have used `||` so the levels of 'type' can't correlate
with each other.
But I wonder why still correlations are reported in the output?
Thanks, Simon
lmer(y~type + (type || ID), data = data)
Random effects:
Groups Name Std.Dev. Corr
ID type0 0.4276
type1 0.7012 0.81
type2 0.7115 0.72 0.97
type3 0.7655 0.83 1.00 0.98
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models