【问题标题】:How to compute regression coefficients with proc mixed in sas?如何在 sas 中混合 proc 计算回归系数?
【发布时间】:2016-05-27 03:37:39
【问题描述】:

这里是my data。数据结构如下:id x1 x2 x3 y

我用proc mixed分析过,现在想确定回归系数不知道怎么做。我只是sas 的初学者。从结果我看到x1x2x3x1x2x3是显着的影响,但是如何确定系数alpha, beta, gamma, delta, theta

y = theta + alpha*x1 + beta*x2 + gamma*x3 + delta*x1*x2*x3

这是我的代码:

ods graphics on;
proc mixed data=test;
  class x1 x2 x3;
  model y = x1 | x2 | x3 / solution residual;
  random id;
run;
ods graphics off;

编辑 1:这是表格的一部分 Solutions for Fixed Effects

由于x1 有两个级别,因此表中有两行。我是否可以通过将这两个值相加得到x1 的效果:第一行为-109.07,第二行为0,还是我应该做其他事情?请注意,这是2^k 设计。 x1 的影响应计算为当x1 高 (20) 和低 (10) 时 y 的平均值之差的一半。

【问题讨论】:

    标签: sas linear-regression


    【解决方案1】:

    根据您的模型,x1x2x3 应该被视为连续变量,那么您应该能够获得模型中的系数。

    proc mixed data=test;
    model y=x1 x2 x3 x1*x2*x3/ solution residual;
    random id/s;
    run;
    

    但是,根据您的代码以及 x1x2x3 的值,最好将它们视为分类变量,然后您表中的 Estimate 实际上就是平均值任何两个级别之间的差异。下面的链接可以帮助您了解您的结果。 http://support.sas.com/kb/38/384.htmlexplanation of estimation of coefficients

    【讨论】:

    • 非常感谢,我在 sas 帮助和在线文档中找了半个小时才找到这个。
    【解决方案2】:

    solution 选项应该会生成您的估计值。您需要将其包含在modelrandom 语句中。您应该看到两个表格,固定效应解决方案随机效应解决方案,其中包含估计值。

    proc mixed data=test;
    class x1 x2 x3;
    model y = x1 | x2 | x3 / solution residual;
    random id / s;
    run;
    

    文档中的随机系数示例与您的问题很接近。

    https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect034.htm

    【讨论】:

    • 亲爱的 Reeza,请查看编辑。我稍微澄清了这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 1970-01-01
    • 1970-01-01
    • 2013-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多