Search code examples
statisticslinear-regressiongretl

Gretl - how to compute a matrix


i have a linear regression model:

yi = α + βxi + ui

and I want to compute:

(\sigma_u)^2(X'X)^(-1)

Can I do that in gretl and how? If not, how to get the X matrix out of gretl?

I really appreciate your reply!!!


Solution

  • Here is one approach. If you want to learn more I urge you to read the chapter 13 of the gretl guide.

    open galton
    list xlist = const parent child # or list xlist 0 1 2 
    matrix X = {xlist}
    ols const child parent --quiet
    scalar sigma_u = $sigma
    matrix res = sigma_u^2 * inv(X'X)
    res
    
    ##  res
    ## res (3 x 3)
    
    ##    0.0010799  -1.2533e-05  -3.2771e-06 
    ##  -1.2533e-05   2.7165e-07  -8.8464e-08 
    ##  -3.2771e-06  -8.8464e-08   1.3688e-07