我希望看一下随机变量ID的三个变量PS,TH和HW的固定效应。我也有兴趣了解每个固定效应的每个受试者(ID)随机斜率的估计值。有些科目有多年的数据,所以我必须在ID内嵌入一年。到目前为止,我有以下代码进行一些初步分析:
proc glimmix data=dat method=laplace;
class year;
class ID;
model use = PS TH HW / dist=binomial link=logit solution;
random intercept / subject = year(ID);
random PS / subject = year(ID) solution;
random TH / subject = year(ID) solution;
random HW / subject = year(ID) solution;
run;
当此代码运行时,我会获得每个固定效果的年份(ID)的随机斜率估计值,例如
Solution for Random Effects
Std Err
Effect Subject Estimate Pred
PS year (ID) 2 111 1.1714 0.7257
TH year (ID) 2 111 4.5081 1.2953
HW year (ID) 2 111 -1.3109 0.4196
PS year (ID) 4 114 0.5999 0.5608
TH year (ID) 4 114 4.7292 1.0664
HW year (ID) 4 114 -1.8526 0.3289
这很好,但我也希望得到只是 ID的随机斜率估计值。理想情况下,对于某些超过一年的ID,模型将帐户,并为我提供年度(ID) AND ID的随机斜率估计。
问题:如何告诉SAS输出ID的解决方案?
当我尝试运行以下代码来实现这一点时,我在输出中得到了一些奇怪的空格用于随机效果,并且参数估计值与我使用上面的代码获得的输出不同。下面的代码看起来过于复杂 - 上述代码不应该能够胜任这项工作吗?
proc glimmix data=dat method=laplace;
class year;
class ID;
model use = PS TH HW / dist=binomial link=logit solution;
random intercept / subject = ID;
random PS / subject = ID solution;
random TH / subject = ID solution;
random HW / subject = ID solution;
random intercept / subject = year(ID);
random PS / subject = year(ID) solution;
random TH / subject = year(ID) solution;
random HW / subject = year(ID) solution;
run;
Example of part of the "Solutions for Random Effects" table
Effect Subject Estimate Pred
PS ID 111 0.5587 1.4640
TH ID 111 4.2063 2.1891
HW ID 111 -0.9158 0.6462
PS Year(ID) 2 111 0.4944 1.4721
PS 0 1.8627
TH Year(ID) 2 111 0.3569 1.7628
TH 0 1.8037
HW Year(ID) 2 111 -0.3687 0.5800
HW 0 0.5639
PS ID 114 0.2531 1.3999
TH ID 114 4.4162 2.0840
HW ID 114 -1.2981 0.6914
PS Year(ID) 4 114 0.2240 1.4027
*注意 - 没有主题的每个固定效果中的所有“pred”值都是相同的。