Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Variance Decomposition in felsdvreg

    Hello Stata Community,

    Can anyone identify or give more information on the variance decomposition used by the function felsdvreg when using the noisily option?

    On page 181 of the accompanying STATA journal article written by Cornelissen (The Stata Journal (2008) 8, Number 2, pp. 170–189), with doi: https://journals.sagepub.com/doi/pdf...867X0800800202

    they give an example of how the method decomposes the ability of each of the two fixed effects to explain the variance in y and gives the following output:
    Click image for larger version

Name:	Screenshot 2023-04-13 at 15.56.39.png
Views:	1
Size:	185.6 KB
ID:	1709670



    I have searched through the documentation and cannot see any additional detail. How does the model calculate these covariances given that they are either on matrices (xb) or vectors of different lengths (y and the fixed effects).

    Does anyone recognise this and have a link to a general explanation/application?

    Thank you,
    Joe
    Last edited by Joe Emmens; 13 Apr 2023, 08:15.

  • #2
    Suppose you have the variable mpg in the auto dataset. What is its variance? For one, we can get its standard deviation using summarize, and \(Var(X)= [SD(X)]^2\).

    Code:
    sysuse auto, clear
    sum mpg
    di "Var(mpg)=  `=r(sd)^2'"
    Res.:

    Code:
    . sum mpg
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
             mpg |         74     21.2973    5.785503         12         41
    
    .
    . di "Var(mpg)=  `=r(sd)^2'"
    Var(mpg)=  33.47204738985562
    What about the covariance of mpg and weight? We have that \(COV(X,Y)= r_{XY} \cdot SD_{X} \cdot SD_Y\) where \(r_{XY}\) is the correlation coefficient of \(X\) and \(Y\).

    Code:
    sysuse auto, clear
    sum mpg
    local SDm= r(sd)
    sum weight
    local SDw= r(sd)
    corr mpg weight
    di "Cov(mpg, weight)=  `=`r(rho)'*`SDm'*`SDw''"
    Res.:

    Code:
    . sum mpg
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
             mpg |         74     21.2973    5.785503         12         41
    
    .
    . local SDm= r(sd)
    
    .
    . sum weight
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
          weight |         74    3019.459    777.1936       1760       4840
    
    .
    . local SDw= r(sd)
    
    .
    . corr mpg weight
    (obs=74)
    
                 |      mpg   weight
    -------------+------------------
             mpg |   1.0000
          weight |  -0.8072   1.0000
    
    
    .
    . di "Cov(mpg, weight)=  `=`r(rho)'*`SDm'*`SDw''"
    Cov(mpg, weight)=  -3629.426138467234
    
    .
    So if you have variables, you can calculate variances and covariances.
    Last edited by Andrew Musau; 13 Apr 2023, 08:37.

    Comment


    • #3
      Thank you Andrew Musau for your quick reply. The problem is, as I briefly mention in the question but should have stressed more, is that for example

      cov(y, feffhat) takes the covariance between y and the estimated firm fixed effect, y is a vector of Nx1 whereas if there are J firms then the firm fixed effect a vector of Jx1. Therefore you cannot take te covariance as you describe.

      To me the STATA documentation appears to use some variance decomposition method that I am just not aware of, but these covariances to me make no mathematical sense, so possibly the documentation is missing some key information for beginners?

      Any ideas?

      Comment


      • #4
        I do not think so. Regardless of how many firms you have in the dataset, the predicted fixed effect is a variable. You always have a long layout for panel data. But I welcome a data example that contradicts my assertion. Also see https://www.statalist.org/forums/help#spelling on spelling Stata.

        Comment

        Working...
        X