从lmodel2 R包输出中为OLS(通常为最小二乘)回归计算标准误差

时间:2019-06-12 01:55:51

标签: r linear-regression

如何从lmodel2 OLS输出获取y截距的标准误差(标准偏差)?

lmodel2手册的摘录内容如下:

  

对于OLS的截距,使用   统计教科书中的标准公式;结果是   与标准统计软件相同。没有这样的公式,   其他三种方法都知道提供正确的α覆盖率。

library(tibble)
library(lmodel2)

my_df <- tibble(x = rnorm(10, mean = 0, sd = 1), 
                y = runif(10, min = 1, max = 5))


lmodel2(y ~ x, data = my_df, range.y = NULL, range.x = NULL, nperm = 99)

这是运行示例的输出:

Model II regression

Call: lmodel2(formula = y ~ x, data = my_df, range.y = NULL, range.x = NULL, nperm = 99)

n = 10   r = -0.3888185   r-square = 0.1511798 
Parametric P-values:   2-tailed = 0.2668003    1-tailed = 0.1334002 
Angle between the two OLS regression lines = 47.50357 degrees

Permutation tests of OLS, MA, RMA slopes: 1-tailed, tail corresponding to sign
A permutation test of r is equivalent to a permutation test of the OLS slope
P-perm for SMA = NA because the SMA slope cannot be tested

Regression results
  Method Intercept      Slope Angle (degrees) P-perm (1-tailed)
1    OLS  2.852733 -0.3837849       -20.99605              0.12
2     MA  2.873461 -0.9670480       -44.04027              0.12
3    SMA  2.874172 -0.9870542       -44.62672                NA

Confidence intervals
  Method 2.5%-Intercept 97.5%-Intercept 2.5%-Slope 97.5%-Slope
1    OLS       2.270049        3.435417  -1.125204   0.3576345
2     MA       2.817874        2.774773   1.809865   0.5970973
3    SMA       2.856617        2.909315  -1.975915  -0.4930760

Eigenvalues: 0.9390495 0.4130699 

H statistic used for computing C.I. of MA: 0.9319756

0 个答案:

没有答案