如何用sas中的proc混合计算回归系数?

时间:2016-04-10 15:25:59

标签: sas linear-regression

以下是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的一部分:

Solutions for Fixed Effects

由于x1有两个级别,因此表中有两行。通过对这两个值求和,我得到x1的效果:第一行是-109.07而第二行是0,还是我应该做其他的?请注意,这是2^k设计。 x1的效果应计算为yx1高(20)和低(10)时{ "color": [ 45, 200, 34 ], "docnum": 5183, "form": "avoir", "graph": "jdm.N.flat", "id": 0, "lang": "fr", "neighbors": 17, "pos": "N", "pzero": true, "rank": 1, "score": 0.0028284271, "type": 1 }, { "color": [ 45, 200, 34 ], "docnum": 22809, "form": "argent", "graph": "jdm.N.flat", "id": 1, "lang": "fr", "neighbors": 65, "pos": "N", "pzero": false, "rank": 2, "score": 0.0028284271, "type": 1 }, 的平均值之差的一半。

2 个答案:

答案 0 :(得分:1)

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

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

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

答案 1 :(得分:0)

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

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

文档中的Random Coefficients示例与您的问题非常接近。

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

相关问题