BookmarkSubscribeRSS Feed
Cuneyt
Obsidian | Level 7

Dear All,

I am probably making a very simple and silly mistake in my code and I hope you guys can quickly point it out to me. I am estimating a very simple model as shown below. But the random variables are all come out as zero. Any help will be greatly appreciated.

Sincerely,

Cuneyt

 

data mydata;
	input y industry;
datalines;
-0.0005	326
-0.0092	326
 0.0107	321
-0.0463	321
 0.0088	321
-0.0051	335
 0.0000	335
-0.0009	327
-0.0031	327
-0.0055	336
 0.0157	336
 0.0095	336
-0.0132	336
 0.0196	336
 0.0187	336
-0.0071	336
-0.0154	321
 0.0155	321
-0.0155	321
 0.0145	321
;
run;

proc mixed data=mydata covtest;
	class industry;
	model y =  / solution ddfm=bw;
	random intercept / subject = industry solution;
run;

 

 

Covariance Parameter Estimates
Cov Parm Subject Estimate Standard
Error
Z Value Pr > Z
Intercept industry 0 . . .
Residual   0.000248 0.000080 3.08 0.0010

Fit Statistics
-2 Res Log Likelihood -100.8
AIC (Smaller is Better) -98.8
AICC (Smaller is Better) -98.6
BIC (Smaller is Better) -99.2

Solution for Fixed Effects
Effect Estimate Standard
Error
DF t Value Pr > |t|
Intercept -0.00044 0.003519 4 -0.13 0.9065

Solution for Random Effects
Effect industry Estimate Std Err Pred DF t Value Pr > |t|
Intercept 321 0 . . . .
Intercept 326 0 . . . .
Intercept 327 0 . . . .
Intercept 335 0 . . . .
Intercept 336 0 . . . .

 

 

4 REPLIES 4
SteveDenham
Jade | Level 19

The most likely answer is that there is either insufficient variablility or insufficient sample size to estimate a variance component for industry.  So the answer to how to get a value using a REML method is to increase the sample size, if possible.  A non-maximum likelihood method might be to use PROC VARCOMP or PROC GLM to estimate the variance using a method of moments approach.

 

SteveDenham

 

 

Cuneyt
Obsidian | Level 7

Hello Steve,

Thanks for your response. Even when I this same model with my original data set with 141,000 observations, I get an estimate of zero variance for the random effects. The SAS output is below. There are 96 subjects (naics4=industries). I seriously doubt that there is insufficient (virtually zero) variability within these subjects. What do you think?

 

The SAS System

The Mixed Procedure
Model Information
Data Set IG.SURVEYS6
Dependent Variable ch_tot_cases
Covariance Structure Variance Components
Subject Effect naics4
Estimation Method ML
Residual Variance Method Profile
Fixed Effects SE Method Model-Based
Degrees of Freedom Method Between-Within


Class Level Information
Class Levels Values
naics4 96 3111 3112 3113 3114 3115 3116 3117 3118 3119 3121 3122 3131 3132 3133 3141 3149 3151 3152 3159 3161 3162 3169 3211 3212 3216 3219 3221 3222 3223 3228 3231 3241 3251 3252 3253 3254 3255 3256 3259 3261 3262 3271 3272 3273 3274 3279 3311 3312 3313 3314 3315 3316 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3331 3332 3333 3334 3335 3336 3339 3341 3342 3343 3344 3345 3346 3351 3352 3353 3359 3361 3362 3363 3364 3365 3366 3369 3371 3372 3379 3390 3391 3399 3441 3523 3541 3728


Dimensions
Covariance Parameters 2
Columns in X 1
Columns in Z per Subject 1
Subjects 96
Max Obs per Subject 9470


Number of Observations
Number of Observations Read 141041
Number of Observations Used 141008
Number of Observations Not Used 33


Iteration History
Iteration Evaluations -2 Log Like Criterion
0 1 884853.71160320  
1 1 884853.71160320 0.00000000


Convergence criteria met.


Covariance Parameter Estimates
Cov Parm Subject Estimate Standard
Error
Z Value Pr > Z
Intercept naics4 0 . . .
Residual   31.1036 0.1171 265.53 <.0001


Fit Statistics
-2 Log Likelihood 884853.7
AIC (Smaller is Better) 884857.7
AICC (Smaller is Better) 884857.7
BIC (Smaller is Better) 884862.8


Solution for Fixed Effects
Effect Estimate Standard
Error
DF t Value Pr > |t|
Intercept -0.01564 0.01485 95 -1.05 0.2950


Solution for Random Effects
Effect naics4 Estimate Std Err Pred DF t Value Pr > |t|
Intercept 3111 0 . . . .
Intercept 3112 0 . . . .
Intercept 3113 0 . . . .
Intercept 3114 0 . . . .
Intercept 3115 0 . . . .
Intercept 3116 0 . . . .
Intercept 3117 0 . . . .
Intercept 3118 0 . . . .
Intercept 3119 0 . . . .
Intercept 3121 0 . . . .
Intercept 3122 0 . . . .
Intercept 3131 0 . . . .
Intercept 3132 0 . . . .
Intercept 3133 0 . . . .
Intercept 3141 0 . . . .
Intercept 3149 0 . . . .
Intercept 3151 0 . . . .
Intercept 3152 0 . . . .
Intercept 3159 0 . . . .
Intercept 3161 0 . . . .
Intercept 3162 0 . . . .
Intercept 3169 0 . . . .
Intercept 3211 0 . . . .
Intercept 3212 0 . . . .
Intercept 3216 0 . . . .
Intercept 3219 0 . . . .
Intercept 3221 0 . . . .
Intercept 3222 0 . . . .
Intercept 3223 0 . . . .
Intercept 3228 0 . . . .
Intercept 3231 0 . . . .
Intercept 3241 0 . . . .
Intercept 3251 0 . . . .
Intercept 3252 0 . . . .
Intercept 3253 0 . . . .
Intercept 3254 0 . . . .
Intercept 3255 0 . . . .
Intercept 3256 0 . . . .
Intercept 3259 0 . . . .
Intercept 3261 0 . . . .
Intercept 3262 0 . . . .
Intercept 3271 0 . . . .
Intercept 3272 0 . . . .
Intercept 3273 0 . . . .
Intercept 3274 0 . . . .
Intercept 3279 0 . . . .
Intercept 3311 0 . . . .
Intercept 3312 0 . . . .
Intercept 3313 0 . . . .
Intercept 3314 0 . . . .
Intercept 3315 0 . . . .
Intercept 3316 0 . . . .
Intercept 3320 0 . . . .
Intercept 3321 0 . . . .
Intercept 3322 0 . . . .
Intercept 3323 0 . . . .
Intercept 3324 0 . . . .
Intercept 3325 0 . . . .
Intercept 3326 0 . . . .
Intercept 3327 0 . . . .
Intercept 3328 0 . . . .
Intercept 3329 0 . . . .
Intercept 3331 0 . . . .
Intercept 3332 0 . . . .
Intercept 3333 0 . . . .
Intercept 3334 0 . . . .
Intercept 3335 0 . . . .
Intercept 3336 0 . . . .
Intercept 3339 0 . . . .
Intercept 3341 0 . . . .
Intercept 3342 0 . . . .
Intercept 3343 0 . . . .
Intercept 3344 0 . . . .
Intercept 3345 0 . . . .
Intercept 3346 0 . . . .
Intercept 3351 0 . . . .
Intercept 3352 0 . . . .
Intercept 3353 0 . . . .
Intercept 3359 0 . . . .
Intercept 3361 0 . . . .
Intercept 3362 0 . . . .
Intercept 3363 0 . . . .
Intercept 3364 0 . . . .
Intercept 3365 0 . . . .
Intercept 3366 0 . . . .
Intercept 3369 0 . . . .
Intercept 3371 0 . . . .
Intercept 3372 0 . . . .
Intercept 3379 0 . . . .
Intercept 3390 0 . . . .
Intercept 3391 0 . . . .
Intercept 3399 0 . . . .
Intercept 3441 0 . . . .
Intercept 3523 0 . . . .
Intercept 3541 0 . . . .
Intercept 3728 0 . . . .
StatsMan
SAS Super FREQ

MIXED puts a lower bound of 0 on variance components when ML or REML is used. If you switch to METHOD=TYPE3 in MIXED, that will remove the boundary and you should get a negative estimate for the variance on industry. 

 

What @SteveDenham says is correct. For this data, there is insufficient variability in the response to attribute variability to the industry effect. It may be that the variation within an industry is much greater than the variation between industries. 

 

If you treat industry as a fixed effect, my guess is that the effect of industry is highly insignificant. This is true for the sample of data provided. I understand that you do not want to use industry as fixed, but that may help explain that there is just not much difference across the industries compared to the differences seen within an industry.  

 

 

Cuneyt
Obsidian | Level 7

This makes sense. Thank you very much.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1129 views
  • 1 like
  • 3 in conversation