Hi,
I was wondering if there is a way to figure out why in SAS random beta
coefficients are 0 vs. in R the beta-s are non zero.
The variables of the data are nidl, time, and sub (for subject). Time and
nidl are continuous variables. I am applying random coefficients model.
Any input is greatly appreciated, Thanks, Aldi
1. mixed model in SAS:
======================
ods output SolutionR = out1.randomnidltest2;
proc mixed data = a1 ;
class sub ;
model nidl = time / solution ;
random int time / sub = sub solution;
run;
ods output close;
2. mixed model in R:
====================
a1<-read.table(file="c:\\aldi\\a1.txt",sep=",",header=T)
library(nlme)
fm1nidl.lme<-lme(nidl~time,data=a1,random=~time | sub)
plot(coef(fm1nidl.lme))
3. SAS output:
==============
Plot of nidl*time. Symbol used is '*'.
40
*
*
* *
* *
* * *
20 * * *
* *****
* ** **
* *** **** *
* *** ** *
* * ****** *
* ****** * *
* * ******* * *
0 * * ******** *
------------------------------------
0 25 50 75
time
NOTE: 684 obs hidden.
Dimensions
Covariance Parameters 3
Columns in X 2
Columns in Z Per Subject 2
Subjects 425
Max Obs Per Subject 2
Number of Observations
Number of Observations Read 763
Number of Observations Used 763
Number of Observations Not Used 0
Covariance Parameter Estimates
Cov Parm Subject Estimate
Intercept sub 17.1773
time sub 0
Residual 27.0023
The Mixed Procedure
Fit Statistics
-2 Res Log Likelihood 5005.5
AIC (smaller is better) 5009.5
AICC (smaller is better) 5009.5
BIC (smaller is better) 5017.6
Solution for Fixed Effects
Standard
Effect Estimate Error DF t Value Pr > |t|
Intercept 7.7608 0.3214 424 24.15 <.0001
time -0.08148 0.01605 337 -5.08 <.0001
Solution for Random Effects
Std Err
Effect sub Estimate Pred DF t Value Pr > |t|
Intercept 1 5.6722 3.2426 0 1.75 .
time 1 0 . . . .
Intercept 2 3.6722 3.2426 0 1.13 .
time 2 0 . . . .
Intercept 3 -2.0774 2.7539 0 -0.75 .
time 3 0 . . . .
... ... .... ... .... ...
R output:
(Intercept) time
1 17.432680 -0.3155496745
2 14.024527 -0.2345787274
3 3.105323 0.0469759240
4 23.047062 -0.5565796200
5 10.708267 -0.1557909941
... ... ...
> summary(fm1nidl.lme)
Linear mixed-effects model fit by REML
Data: a1
AIC BIC logLik
4982.15 5009.958 -2485.075
Random effects:
Formula: ~time | sub
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 6.0090637 (Intr)
time 0.1717771 -0.831
Residual 4.2885993
Fixed effects: nidl ~ time
Value Std.Error DF t-value p-value
(Intercept) 7.779379 0.3582945 424 21.71225 0
time -0.086206 0.0158615 337 -5.43494 0
Correlation:
(Intr)
time -0.675
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.0234047 -0.5132952 -0.2246854 0.4249250 3.5611259
Number of Observations: 763
Number of Groups: 425
3. data:
========
see the text file (comma delimited) attached.
nidl,time,sub
22.3496,0,1
17.2055,0,2
0,0,3
6.0642,25,3
34.3472,0,4
0.455,25,4
12.2001,0,5
9.9727,0,6
7.7544,22,6
13.5892,0,7
7.1522,22,7
5.7119,0,8
12.7931,21,8
0,0,9
0,26,9
0,0,10
0,28,10
0,0,11
1.8355,21,11
0,0,12
16.5008,22,12
0,0,13
0.5594,21,13
0,0,14
0,21,14
12.8021,0,15
1.9445,21,15
0,0,16
0.8927,21,16
1.0208,0,17
0,28,17
5.847,0,18
13.7787,23,18
4.1497,0,19
5.3699,20,19
0,0,20
8.8429,0,21
3.4002,21,21
0,0,22
2.6035,22,22
21.8354,0,23
16.4304,22,23
0,0,24
0,22,24
5.2156,0,25
2.9183,25,25
0.5441,0,26
0.602,21,26
0,0,27
3.4627,21,27
7.8185,0,28
12.0204,24,28
20.9305,0,29
9.1964,22,29
7.6726,0,30
1.2206,27,30
14.0354,0,31
1.4076,21,31
29.5637,0,32
26.034,22,32
0.777,0,33
0,21,33
0,0,34
3.7423,24,34
0,0,35
5.1796,25,35
0.4898,0,36
6.7602,0,37
0.3149,21,37
24.2513,0,38
0,0,39
1.8954,26,39
11.5367,0,40
17.8427,21,40
18.494,0,41
7.7884,0,42
16.5991,0,43
19.594,21,43
21.8929,0,44
9.3343,21,44
8.8201,0,45
6.5991,0,46
4.4924,22,46
0,0,47
0.6605,22,47
4.3771,0,48
23.5654,0,49
3.6462,23,49
0,0,50
0,0,51
0,33,51
18.2174,0,52
2.5682,21,52
0.654,0,53
3.3976,0,54
6.1463,21,54
4.3894,0,55
7.7765,21,55
1.4277,0,56
11.1315,22,56
3.719,0,57
0,0,58
4.4496,21,58
23.0375,0,59
1.0871,0,60
1.1439,21,60
22.3187,0,61
11.4435,0,62
5.2414,21,62
1.7845,0,63
7.1964,21,63
12.5185,0,64
8.0531,22,64
0.6197,0,65
1.4239,22,65
8.2245,0,66
3.8262,21,66
5.8396,0,67
2.6924,23,67
6.8087,0,68
4.9219,22,68
0,0,69
9.685,21,69
4.1845,0,70
0.9566,0,71
0,0,72
0,26,72
0,0,73
0,21,73
0,0,74
0,29,74
24.0695,0,75
14.4467,21,75
15.2448,0,76
5.7294,0,77
6.3938,22,77
20.412,0,78
22.4224,22,78
0,0,79
8.7659,19,79
25.207,0,80
15.3331,22,80
4.367,0,81
0.7526,25,81
0.9409,21,82
0,0,83
11.2625,22,83
14.6429,0,84
8.2428,21,84
8.9603,0,85
10.0817,0,86
14.2268,21,86
23.3275,0,87
8.8705,21,87
11.4943,0,88
3.5161,22,88
30.4313,0,89
8.8993,22,89
8.8905,0,90
18.6315,22,90
13.7142,0,91
2.329,22,91
0,0,92
0,26,92
0,0,93
0,22,93
0,0,94
3.9725,22,94
0.939,0,95
0,21,95
14.0751,0,96
0.9575,21,96
11.9635,0,97
9.7135,22,97
6.1225,0,98
0.7382,24,98
16.323,0,99
13.1488,21,99
6.3992,0,100
6.0698,21,100
9.7145,0,101
27.7407,23,101
9.9813,0,102
14.3668,0,103
13.5239,30,103
16.0936,0,104
18.6939,0,105
6.6012,0,106
0.7264,23,106
0,0,107
0,21,107
1.7815,0,108
2.0719,64,108
0,0,109
2.5766,20,109
15.0395,0,110
7.6504,22,110
17.0585,0,111
17.1633,25,111
2.1678,0,112
12.8978,22,112
8.9256,0,113
0,0,114
1.6161,0,115
3.7596,22,115
4.7765,0,116
0,29,117
0,0,118
0,23,118
0,0,119
0,21,119
12.2646,0,120
2.2472,27,120
18.0407,0,121
10.4095,0,122
5.7023,22,122
0.7445,0,123
9.2378,26,123
23.6184,0,124
11.7622,21,124
15.9235,0,125
8.5182,21,125
0.9362,0,126
1.8955,21,126
26.8911,0,127
12.7305,22,127
0,0,128
0,20,128
0,0,129
4.0602,21,129
0,0,130
15.9924,28,130
0,0,131
2.9294,20,131
17.5817,0,132
13.1542,23,132
6.216,0,133
2.1522,22,133
4.3002,0,134
0,21,134
14.073,0,135
0.3734,0,136
0,22,136
0,0,137
1.8727,20,137
0.9172,0,138
0,23,138
13.9418,0,139
18.9259,21,139
2.8602,0,140
10.2596,22,140
0,0,141
3.5887,27,141
7.8799,0,142
5.6405,26,142
12.7288,0,143
3.9129,22,143
1.3893,0,144
4.8176,25,144
0,0,145
0,21,145
0,0,146
2.1911,21,146
7.24,0,147
1.0249,22,147
13.8787,0,148
6.1951,0,149
5.1758,0,150
8.7129,0,151
4.8967,21,151
3.9818,0,152
0.5157,22,152
12.7533,0,153
6.5712,26,153
8.6884,0,154
3.6829,22,154
0.4128,0,155
0,22,155
4.4051,0,156
4.9423,21,156
14.1195,0,157
14.8691,28,157
0,0,158
0,21,158
0,0,159
1.6127,21,159
0,0,160
4.0677,22,160
5.571,0,161
6.8436,28,161
0.9781,0,162
6.9048,21,162
5.5094,0,163
7.1634,21,163
5.8924,0,164
6.8814,21,164
6.7169,0,165
13.4057,0,166
14.1217,26,166
0,0,167
0.8767,28,167
10.0944,0,168
3.263,28,168
15.204,0,169
7.3994,28,169
0,0,170
0,22,170
0,0,171
0,21,171
14.3579,0,172
14.4705,21,172
0,0,173
0,22,173
0,0,174
6.2254,22,174
7.3016,0,175
19.2073,28,175
16.4873,0,176
7.9911,21,176
17.621,0,177
8.7814,0,178
5.771,21,178
15.024,0,179
7.4293,21,179
0.5603,0,180
1.2324,28,180
0,0,181
0,21,181
0.8832,0,182
0.6865,26,182
18.1791,0,183
4.5151,28,183
19.649,0,184
18.5984,21,184
14.0022,0,185
10.5308,28,185
7.7568,0,186
10.1785,21,186
15.7069,0,187
8.7617,21,187
9.8403,0,188
12.0767,21,188
3.9395,0,189
2.2662,21,189
4.057,0,190
8.988,21,190
0,0,191
0,21,191
16.7468,0,192
0,21,192
19.4647,0,193
6.1432,21,193
0,0,194
3.5065,0,195
6.3467,21,195
1.5471,0,196
1.2166,23,196
16.526,0,197
5.4159,23,197
6.6765,0,198
15.9434,0,199
7.9881,21,199
27.9357,0,200
8.6086,21,200
6.8732,0,201
3.0314,28,201
3.5684,0,202
7.9373,28,202
5.9096,0,203
1.0948,28,203
0.907,0,204
7.1563,24,204
10.1761,0,205
13.3898,21,205
4.7842,0,206
2.2249,21,206
7.7183,0,207
8.5427,35,207
9.1127,0,208
6.819,21,208
0,0,209
1.0145,21,209
6.243,0,210
9.3569,21,210
7.4083,0,211
1.4332,21,211
23.1587,0,212
2.3943,21,212
8.9076,0,213
1.1368,21,213
8.3776,0,214
13.2682,26,214
1.4854,0,215
2.2268,27,215
11.7657,0,216
5.6098,0,217
3.3751,28,217
4.1479,0,218
15.8051,21,218
3.5057,0,219
12.2713,0,220
2.1499,42,220
7.2376,0,221
9.0468,21,221
6.3418,0,222
13.6814,29,222
15.6082,0,223
9.5099,28,223
0,0,224
3.5761,30,224
0,0,225
1.4854,21,225
0.0122,0,226
1.9494,27,226
15.3707,0,227
7.3777,23,227
0,0,228
0.7406,20,228
5.054,0,229
17.9677,21,229
11.2482,0,230
10.1169,28,230
13.5413,0,231
0,0,232
3.6448,0,233
5.605,28,233
0,0,234
7.3289,24,234
7.0971,0,235
0.9318,24,235
13.1583,0,236
11.4023,24,236
5.3482,0,237
3.4457,27,237
22.6083,0,238
18.2903,28,238
3.9473,0,239
5.7534,28,239
0,0,240
0,16,240
0,0,241
0,21,241
13.1284,0,242
7.9946,26,242
9.1066,0,243
12.9632,53,243
0,0,244
3.0889,23,244
4.1494,0,245
0.2351,0,246
0,21,246
1.3201,0,247
3.4926,28,247
5.6071,0,248
6.1724,22,248
6.3334,0,249
3.0272,23,249
1.0249,0,250
0,22,250
26.9722,0,251
4.8333,23,251
22.5316,0,252
0,0,253
0,21,253
2.0684,0,254
4.3709,25,254
15.4438,0,255
12.0267,26,255
0,0,256
0,21,256
6.8504,0,257
11.9782,21,257
9.6138,0,258
1.0584,28,258
1.8436,0,259
3.7644,28,259
6.4596,0,260
0.3051,28,260
14.3438,0,261
11.8102,21,261
11.9528,0,262
15.9966,0,263
16.3263,21,263
1.5317,0,264
0.4967,0,265
4.1162,0,266
0,0,267
1.5645,27,267
0,0,268
8.6602,0,269
10.4215,0,270
6.9841,22,270
0,0,271
0,20,271
0,0,272
0,21,272
0,0,273
3.6498,23,273
25.0724,0,274
16.2888,21,274
6.8701,0,275
16.48,0,276
5.5017,27,276
6.1018,0,277
9.1988,22,277
4.899,0,278
14.1639,0,279
1.0357,21,279
7.101,0,280
9.4006,21,280
0,0,281
0.3788,19,281
26.944,0,282
14.7506,21,282
5.8786,0,283
20.6822,0,284
0.8725,21,284
3.8464,0,285
0.9651,24,285
3.6563,0,286
22.5583,34,286
8.638,0,287
3.6004,21,287
13.8767,0,288
1.3025,22,288
13.9266,0,289
2.6923,27,289
11.6216,0,290
5.7039,21,290
0.7605,0,291
17.4649,23,291
0,0,292
0,21,292
7.0122,0,293
11.0186,21,293
17.9023,0,294
0,0,295
9.6091,20,295
0,0,296
0,21,296
0,0,297
0,21,297
1.5474,0,298
9.3691,20,298
0,0,299
0,21,299
0,0,300
0,25,300
22.7169,0,301
4.8114,21,301
0,0,302
2.0886,21,302
0,0,303
0,28,303
3.3213,0,304
6.5311,0,305
2.1649,21,305
1.8541,0,306
12.7095,21,306
17.8402,0,307
16.3128,22,307
22.4625,0,308
4.8777,21,308
8.0343,0,309
14.0223,21,309
16.3104,0,310
8.4626,21,310
0.4195,0,311
1.7584,23,311
14.8376,0,312
6.9423,21,312
10.1444,0,313
1.5886,21,313
3.9643,0,314
1.9118,23,314
11.3525,0,315
7.3115,21,315
7.0621,0,316
0,21,316
10.2506,0,317
4.5695,21,317
12.1735,0,318
4.6646,21,318
10.9439,0,319
2.8744,23,319
1.651,0,320
20.3431,0,321
5.5197,22,321
19.8919,0,322
6.4143,17,322
3.9899,0,323
0,28,323
13.0746,0,324
12.4283,23,324
11.3119,0,325
8.9607,28,325
4.627,0,326
6.2912,25,326
4.4786,0,327
0.5993,19,327
2.516,0,328
1.6945,21,328
1.5714,0,329
8.1722,26,329
0,0,330
0.2892,29,330
7.1802,0,331
6.5152,0,332
0.1381,41,332
3.934,0,333
0,0,334
4.8775,32,334
11.6242,0,335
5.6064,21,335
11.4944,0,336
3.8192,21,336
8.2451,0,337
16.3087,22,337
7.5841,0,338
2.9673,28,338
1.7089,0,339
4.9676,27,339
16.4922,0,340
16.0444,29,340
1.7581,0,341
5.4522,28,341
0,0,342
4.5885,26,342
19.8653,0,343
5.8134,21,343
1.1571,0,344
0.7604,21,344
5.6628,0,345
10.526,23,345
10.1026,0,346
2.1584,21,346
15.9167,0,347
3.7287,22,347
0,0,348
0,24,348
17.8204,0,349
1.459,19,349
14.7863,0,350
1.754,16,350
9.3694,0,351
1.6104,21,351
0.316,30,352
11.0988,0,353
10.3779,0,354
17.2198,26,354
10.5452,0,355
6.3449,30,355
20.6589,0,356
19.2916,21,356
6.5536,0,357
13.4289,33,357
0,0,358
11.6986,28,358
18.8868,0,359
1.714,21,359
19.1789,0,360
6.4825,28,360
4.9963,0,361
1.3682,0,362
0.459,30,362
18.7413,0,363
3.937,42,363
16.9049,0,364
12.9645,20,364
12.3706,0,365
2.2762,22,365
9.653,0,366
4.2963,24,366
10.7536,0,367
0.9741,21,367
0,0,368
0,28,368
2.6067,0,369
3.8308,27,369
18.8111,0,370
0.6839,24,370
0.2333,0,371
1.33,0,372
0.8974,33,372
11.9507,0,373
0.1184,21,373
19.2241,0,374
6.373,21,374
0.8263,0,375
0,29,375
9.0687,0,376
1.3772,21,376
3.5907,0,377
2.4523,21,377
22.0119,0,378
0,21,378
21.3049,0,379
4.1597,21,379
15.5817,0,380
13.0825,21,380
15.0589,0,381
3.7875,0,382
17.7111,0,383
6.7993,21,383
6.5412,0,384
9.1826,21,384
4.0999,0,385
8.8445,34,385
2.9534,0,386
11.4596,21,386
9.2508,0,387
2.5914,0,388
0,0,389
4.4395,21,389
19.3068,0,390
12.8178,26,390
8.29,0,391
3.2018,21,391
3.9942,0,392
1.3907,0,393
0,21,393
0.9556,0,394
1.1831,26,394
0.3031,0,395
5.0391,28,395
6.8001,0,396
18.8593,0,397
11.707,0,398
0.254,30,398
7.4124,0,399
13.2366,21,399
15.9727,0,400
5.8779,21,400
4.9204,0,401
4.4781,0,402
0,0,403
3.884,0,404
5.8386,0,405
12.1557,28,405
4.3119,0,406
17.7209,0,407
5.7033,23,407
5.9478,0,408
3.213,0,409
13.8083,0,410
0,0,411
2.5252,0,412
7.5144,0,413
1.4252,0,414
17.0363,0,415
14.4673,0,416
9.003,21,416
9.0533,0,417
5.1471,0,418
2.3873,21,418
4.2274,0,419
9.2259,0,420
0.2801,0,421
0,23,421
13.956,0,422
10.1587,0,423
11.4046,0,424
1.528,0,425
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.