【问题标题】:Gretl - how to compute a matrixGretl - 如何计算矩阵
【发布时间】:2013-04-15 06:04:56
【问题描述】:

我有一个线性回归模型:

yi = α + βxi + ui

我想计算:

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

我可以在 gretl 中做到这一点吗?怎么做? 如果不是,如何从 gretl 中取出 X 矩阵?

非常感谢您的回复!!!

【问题讨论】:

标签: statistics linear-regression gretl


【解决方案1】:

这是一种方法。如果您想了解更多信息,我强烈建议您阅读gretl guide 的第 13 章。

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 

【讨论】:

    【解决方案2】:

    dickoa:我想你的回答是:

    open galton
    list xlist = const parent # or list xlist 0 1 2 
    matrix X = {xlist}
    ols child const parent --quiet
    scalar sigma_u = $sigma
    matrix res = sigma_u^2 * inv(X'X)
    res
    

    无论如何,这是一种更简单的方法:

    open galton
    list xlist = const parent # or list xlist 0 1 2 
    matrix X = {xlist}
    ols child const parent --quiet
    matrix res = $vcv
    res
    

    【讨论】:

      猜你喜欢
      • 2015-05-17
      • 2023-02-04
      • 1970-01-01
      • 2017-02-25
      • 2019-09-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多