Mixed Effects Model: Writing Out Level 1/Level 2 Models











up vote
3
down vote

favorite












Suppose I have an LMER output (using Grunfeld data from plm package) as:



summary(lmer(inv ~ value + capital + (1|firm), data = Grunfeld))

> Random effects:
Groups Name Variance Std.Dev. Corr
firm (Intercept) 7367 85.83
Residual 2781 52.74 0.831
Number of obs: 200, groups: firm, 10

Fixed effects:
Estimate Std. Error t value
(Intercept) -57.86442 29.37776 -1.97
value 0.10979 0.01053 10.43
capital 0.30819 0.01717 17.95

Correlation of Fixed Effects:
(Intr) value
value -0.328
capital -0.019 -0.368


I know we can write a Level 1/Level 2 model based on this as:



Level 1:
y = alpha_0 + alpha_1 * value + alpha_2 * capital + eps
Level 2:
alpha_0 = gamma_00 + u_0
alpha_1 = gamma_01 + u_1
alpha_2 = gamma_02 + u_2


The level 1 model should have alpha_0=-57.864, alpha_1=0.109, alpha_2=0.308.



Now, I'm actually not sure if this is the correct form of the level 2 model. Im wondering what exactly the level 1/2 models would be here (for example, are the gammas in the level 2 model concrete values, or are they RV's. For example, here, it is not clear what those values are supposed to be). And also what the correlation of the fixed effects means versus the correlation of random effects. I can't seem to find definitive answers online.










share|cite|improve this question









New contributor




user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    3
    down vote

    favorite












    Suppose I have an LMER output (using Grunfeld data from plm package) as:



    summary(lmer(inv ~ value + capital + (1|firm), data = Grunfeld))

    > Random effects:
    Groups Name Variance Std.Dev. Corr
    firm (Intercept) 7367 85.83
    Residual 2781 52.74 0.831
    Number of obs: 200, groups: firm, 10

    Fixed effects:
    Estimate Std. Error t value
    (Intercept) -57.86442 29.37776 -1.97
    value 0.10979 0.01053 10.43
    capital 0.30819 0.01717 17.95

    Correlation of Fixed Effects:
    (Intr) value
    value -0.328
    capital -0.019 -0.368


    I know we can write a Level 1/Level 2 model based on this as:



    Level 1:
    y = alpha_0 + alpha_1 * value + alpha_2 * capital + eps
    Level 2:
    alpha_0 = gamma_00 + u_0
    alpha_1 = gamma_01 + u_1
    alpha_2 = gamma_02 + u_2


    The level 1 model should have alpha_0=-57.864, alpha_1=0.109, alpha_2=0.308.



    Now, I'm actually not sure if this is the correct form of the level 2 model. Im wondering what exactly the level 1/2 models would be here (for example, are the gammas in the level 2 model concrete values, or are they RV's. For example, here, it is not clear what those values are supposed to be). And also what the correlation of the fixed effects means versus the correlation of random effects. I can't seem to find definitive answers online.










    share|cite|improve this question









    New contributor




    user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      Suppose I have an LMER output (using Grunfeld data from plm package) as:



      summary(lmer(inv ~ value + capital + (1|firm), data = Grunfeld))

      > Random effects:
      Groups Name Variance Std.Dev. Corr
      firm (Intercept) 7367 85.83
      Residual 2781 52.74 0.831
      Number of obs: 200, groups: firm, 10

      Fixed effects:
      Estimate Std. Error t value
      (Intercept) -57.86442 29.37776 -1.97
      value 0.10979 0.01053 10.43
      capital 0.30819 0.01717 17.95

      Correlation of Fixed Effects:
      (Intr) value
      value -0.328
      capital -0.019 -0.368


      I know we can write a Level 1/Level 2 model based on this as:



      Level 1:
      y = alpha_0 + alpha_1 * value + alpha_2 * capital + eps
      Level 2:
      alpha_0 = gamma_00 + u_0
      alpha_1 = gamma_01 + u_1
      alpha_2 = gamma_02 + u_2


      The level 1 model should have alpha_0=-57.864, alpha_1=0.109, alpha_2=0.308.



      Now, I'm actually not sure if this is the correct form of the level 2 model. Im wondering what exactly the level 1/2 models would be here (for example, are the gammas in the level 2 model concrete values, or are they RV's. For example, here, it is not clear what those values are supposed to be). And also what the correlation of the fixed effects means versus the correlation of random effects. I can't seem to find definitive answers online.










      share|cite|improve this question









      New contributor




      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Suppose I have an LMER output (using Grunfeld data from plm package) as:



      summary(lmer(inv ~ value + capital + (1|firm), data = Grunfeld))

      > Random effects:
      Groups Name Variance Std.Dev. Corr
      firm (Intercept) 7367 85.83
      Residual 2781 52.74 0.831
      Number of obs: 200, groups: firm, 10

      Fixed effects:
      Estimate Std. Error t value
      (Intercept) -57.86442 29.37776 -1.97
      value 0.10979 0.01053 10.43
      capital 0.30819 0.01717 17.95

      Correlation of Fixed Effects:
      (Intr) value
      value -0.328
      capital -0.019 -0.368


      I know we can write a Level 1/Level 2 model based on this as:



      Level 1:
      y = alpha_0 + alpha_1 * value + alpha_2 * capital + eps
      Level 2:
      alpha_0 = gamma_00 + u_0
      alpha_1 = gamma_01 + u_1
      alpha_2 = gamma_02 + u_2


      The level 1 model should have alpha_0=-57.864, alpha_1=0.109, alpha_2=0.308.



      Now, I'm actually not sure if this is the correct form of the level 2 model. Im wondering what exactly the level 1/2 models would be here (for example, are the gammas in the level 2 model concrete values, or are they RV's. For example, here, it is not clear what those values are supposed to be). And also what the correlation of the fixed effects means versus the correlation of random effects. I can't seem to find definitive answers online.







      mixed-model






      share|cite|improve this question









      New contributor




      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question









      New contributor




      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question








      edited 2 days ago





















      New contributor




      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      user3000877

      184




      184




      New contributor




      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user3000877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Note that you have only included a random intercept for the firm grouping variable. I.e., the model you are fitting is the following:



          $$left{
          begin{array}{l}
          texttt{Inv}_{ij} = beta_0 + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + b_i + varepsilon_{ij},\\
          b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2),
          end{array}
          right.$$



          where $texttt{Inv}_{ij}$ denotes the $j$-th measurement within the $i$-th firm for you outcome variable, and likewise $texttt{Value}_{ij}$ and $texttt{Capital}_{ij}$ denote the $j$-th measurement within the $i$-th firm for the two predictors.



          The estimated parameters according to the output are:




          • $hatbeta_0 = -57.86442$

          • $hatbeta_1 = 0.10979$

          • $hatbeta_2 = 0.30819$

          • $hatsigma_b = 85.83$

          • $hatsigma = 52.74$


          You could also rewrite the same model as:



          $$left{
          begin{array}{l}
          texttt{Inv}_{ij} = alpha_{0i} + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + varepsilon_{ij},\\
          alpha_{0i} = beta_0 + b_i,\\
          b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2).
          end{array}
          right.$$






          share|cite|improve this answer























          • Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
            – user3000877
            2 days ago










          • It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
            – Dimitris Rizopoulos
            2 days ago










          • My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
            – user3000877
            2 days ago












          • This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
            – Dimitris Rizopoulos
            yesterday










          • Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
            – user3000877
            yesterday




















          up vote
          1
          down vote













          It seems there are 10 firms in the dataset.



          Level 1 model:



          $$Y_{ki}=alpha_{0k} + alpha_1X_{1ki} + alpha_2X_{2ki} + epsilon_{ki}$$



          So the level 2 model can be written as:



          $$alpha_{0k} = alpha_0 + u_k$$



          where $k=,...,10$ is index for firm. $i$ is the i-th measurement. $X_{1ki}$ is value and $X_{2ki}$ capital.



          $u_ksim N(0,sigma_u^2)$ and $epsilon sim N(0,sigma^2)$.






          share|cite|improve this answer





















            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "65"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            user3000877 is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f380999%2fmixed-effects-model-writing-out-level-1-level-2-models%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Note that you have only included a random intercept for the firm grouping variable. I.e., the model you are fitting is the following:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = beta_0 + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + b_i + varepsilon_{ij},\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2),
            end{array}
            right.$$



            where $texttt{Inv}_{ij}$ denotes the $j$-th measurement within the $i$-th firm for you outcome variable, and likewise $texttt{Value}_{ij}$ and $texttt{Capital}_{ij}$ denote the $j$-th measurement within the $i$-th firm for the two predictors.



            The estimated parameters according to the output are:




            • $hatbeta_0 = -57.86442$

            • $hatbeta_1 = 0.10979$

            • $hatbeta_2 = 0.30819$

            • $hatsigma_b = 85.83$

            • $hatsigma = 52.74$


            You could also rewrite the same model as:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = alpha_{0i} + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + varepsilon_{ij},\\
            alpha_{0i} = beta_0 + b_i,\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2).
            end{array}
            right.$$






            share|cite|improve this answer























            • Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
              – user3000877
              2 days ago










            • It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
              – Dimitris Rizopoulos
              2 days ago










            • My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
              – user3000877
              2 days ago












            • This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
              – Dimitris Rizopoulos
              yesterday










            • Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
              – user3000877
              yesterday

















            up vote
            2
            down vote



            accepted










            Note that you have only included a random intercept for the firm grouping variable. I.e., the model you are fitting is the following:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = beta_0 + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + b_i + varepsilon_{ij},\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2),
            end{array}
            right.$$



            where $texttt{Inv}_{ij}$ denotes the $j$-th measurement within the $i$-th firm for you outcome variable, and likewise $texttt{Value}_{ij}$ and $texttt{Capital}_{ij}$ denote the $j$-th measurement within the $i$-th firm for the two predictors.



            The estimated parameters according to the output are:




            • $hatbeta_0 = -57.86442$

            • $hatbeta_1 = 0.10979$

            • $hatbeta_2 = 0.30819$

            • $hatsigma_b = 85.83$

            • $hatsigma = 52.74$


            You could also rewrite the same model as:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = alpha_{0i} + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + varepsilon_{ij},\\
            alpha_{0i} = beta_0 + b_i,\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2).
            end{array}
            right.$$






            share|cite|improve this answer























            • Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
              – user3000877
              2 days ago










            • It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
              – Dimitris Rizopoulos
              2 days ago










            • My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
              – user3000877
              2 days ago












            • This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
              – Dimitris Rizopoulos
              yesterday










            • Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
              – user3000877
              yesterday















            up vote
            2
            down vote



            accepted







            up vote
            2
            down vote



            accepted






            Note that you have only included a random intercept for the firm grouping variable. I.e., the model you are fitting is the following:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = beta_0 + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + b_i + varepsilon_{ij},\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2),
            end{array}
            right.$$



            where $texttt{Inv}_{ij}$ denotes the $j$-th measurement within the $i$-th firm for you outcome variable, and likewise $texttt{Value}_{ij}$ and $texttt{Capital}_{ij}$ denote the $j$-th measurement within the $i$-th firm for the two predictors.



            The estimated parameters according to the output are:




            • $hatbeta_0 = -57.86442$

            • $hatbeta_1 = 0.10979$

            • $hatbeta_2 = 0.30819$

            • $hatsigma_b = 85.83$

            • $hatsigma = 52.74$


            You could also rewrite the same model as:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = alpha_{0i} + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + varepsilon_{ij},\\
            alpha_{0i} = beta_0 + b_i,\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2).
            end{array}
            right.$$






            share|cite|improve this answer














            Note that you have only included a random intercept for the firm grouping variable. I.e., the model you are fitting is the following:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = beta_0 + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + b_i + varepsilon_{ij},\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2),
            end{array}
            right.$$



            where $texttt{Inv}_{ij}$ denotes the $j$-th measurement within the $i$-th firm for you outcome variable, and likewise $texttt{Value}_{ij}$ and $texttt{Capital}_{ij}$ denote the $j$-th measurement within the $i$-th firm for the two predictors.



            The estimated parameters according to the output are:




            • $hatbeta_0 = -57.86442$

            • $hatbeta_1 = 0.10979$

            • $hatbeta_2 = 0.30819$

            • $hatsigma_b = 85.83$

            • $hatsigma = 52.74$


            You could also rewrite the same model as:



            $$left{
            begin{array}{l}
            texttt{Inv}_{ij} = alpha_{0i} + beta_1 texttt{Value}_{ij} + beta_2 texttt{Capital}_{ij} + varepsilon_{ij},\\
            alpha_{0i} = beta_0 + b_i,\\
            b_i sim mathcal N(0, sigma_b^2), quad varepsilon_{ij} sim mathcal N(0, sigma^2).
            end{array}
            right.$$







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited yesterday

























            answered 2 days ago









            Dimitris Rizopoulos

            4,2801217




            4,2801217












            • Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
              – user3000877
              2 days ago










            • It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
              – Dimitris Rizopoulos
              2 days ago










            • My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
              – user3000877
              2 days ago












            • This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
              – Dimitris Rizopoulos
              yesterday










            • Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
              – user3000877
              yesterday




















            • Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
              – user3000877
              2 days ago










            • It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
              – Dimitris Rizopoulos
              2 days ago










            • My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
              – user3000877
              2 days ago












            • This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
              – Dimitris Rizopoulos
              yesterday










            • Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
              – user3000877
              yesterday


















            Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
            – user3000877
            2 days ago




            Thank you! This is great. I have also been trying to understand what the correlation of random effects exactly represents. For example, I understand the correlation of fixed effects measures the correlation between coefficients for each of the individual fits. But what does the correlation of random effects show?
            – user3000877
            2 days ago












            It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
            – Dimitris Rizopoulos
            2 days ago




            It is not clear which correlation you exactly mean. You only have a single random intercept per firm. BTW, when I run the same example in my laptop, I don't get the Corr column in the Random Effects output.
            – Dimitris Rizopoulos
            2 days ago












            My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
            – user3000877
            2 days ago






            My apologies, you are correct. Suppose I run this code: summary(lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld)). We see the correlation of random effects is -0.40. What does this term represent, exactly? The correlation of fixed effects measures the correlation between the coefficients for individual fits (which can be confirmed with, say, looking at LmList) but I cannot see what the -0.40 correlation for random effects corresponds to.
            – user3000877
            2 days ago














            This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
            – Dimitris Rizopoulos
            yesterday




            This is the (prior) correlation between the random intercepts and random slopes for value. Because it is negative it indicates that a-priori firms which have a positive intercept will tend to have a negative slope, and the otherway around.
            – Dimitris Rizopoulos
            yesterday












            Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
            – user3000877
            yesterday






            Thats what I thought, but if I do the following: x=lmer(inv ~ value + capital + (1+value|firm), data = Grunfeld), then: cor(ranef(x)$firm[,1], ranef(x)$firm[,2]), I get a value of -0.3, not -0.4, which does not make sense to me... where exactly would we see what the -0.4 is measuring?
            – user3000877
            yesterday














            up vote
            1
            down vote













            It seems there are 10 firms in the dataset.



            Level 1 model:



            $$Y_{ki}=alpha_{0k} + alpha_1X_{1ki} + alpha_2X_{2ki} + epsilon_{ki}$$



            So the level 2 model can be written as:



            $$alpha_{0k} = alpha_0 + u_k$$



            where $k=,...,10$ is index for firm. $i$ is the i-th measurement. $X_{1ki}$ is value and $X_{2ki}$ capital.



            $u_ksim N(0,sigma_u^2)$ and $epsilon sim N(0,sigma^2)$.






            share|cite|improve this answer

























              up vote
              1
              down vote













              It seems there are 10 firms in the dataset.



              Level 1 model:



              $$Y_{ki}=alpha_{0k} + alpha_1X_{1ki} + alpha_2X_{2ki} + epsilon_{ki}$$



              So the level 2 model can be written as:



              $$alpha_{0k} = alpha_0 + u_k$$



              where $k=,...,10$ is index for firm. $i$ is the i-th measurement. $X_{1ki}$ is value and $X_{2ki}$ capital.



              $u_ksim N(0,sigma_u^2)$ and $epsilon sim N(0,sigma^2)$.






              share|cite|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                It seems there are 10 firms in the dataset.



                Level 1 model:



                $$Y_{ki}=alpha_{0k} + alpha_1X_{1ki} + alpha_2X_{2ki} + epsilon_{ki}$$



                So the level 2 model can be written as:



                $$alpha_{0k} = alpha_0 + u_k$$



                where $k=,...,10$ is index for firm. $i$ is the i-th measurement. $X_{1ki}$ is value and $X_{2ki}$ capital.



                $u_ksim N(0,sigma_u^2)$ and $epsilon sim N(0,sigma^2)$.






                share|cite|improve this answer












                It seems there are 10 firms in the dataset.



                Level 1 model:



                $$Y_{ki}=alpha_{0k} + alpha_1X_{1ki} + alpha_2X_{2ki} + epsilon_{ki}$$



                So the level 2 model can be written as:



                $$alpha_{0k} = alpha_0 + u_k$$



                where $k=,...,10$ is index for firm. $i$ is the i-th measurement. $X_{1ki}$ is value and $X_{2ki}$ capital.



                $u_ksim N(0,sigma_u^2)$ and $epsilon sim N(0,sigma^2)$.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered 2 days ago









                user158565

                4,9051317




                4,9051317






















                    user3000877 is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    user3000877 is a new contributor. Be nice, and check out our Code of Conduct.













                    user3000877 is a new contributor. Be nice, and check out our Code of Conduct.












                    user3000877 is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Cross Validated!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f380999%2fmixed-effects-model-writing-out-level-1-level-2-models%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa