# Generating Empirical Bayses estimates in PROC MIXED

#### noetsi

##### No cake for spunky
I have found various suggestions this be done, it shrinks estimates to the grand mean based on reliability. But I can not find anywhere in the SAS documentation how to request these.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I did this once, I wont be in office until Monday. I think you likely add just an option word. If i recall empirical bayes just uses the mean as the prior.

#### noetsi

##### No cake for spunky
I think you do the code SOLUTION which I just found.

Do you know a simple way to do the chi square test for two different deviance results in SAS. The code is probably simple. I know you run the model, it has to be nested, once then the more complex model, save the two deviance values and then run a chi square.

For testing slopes I am not sure what the DF is. If you are testing through a chi square test if making a slope random is accurate, how do you know in SAS what the DF is.

Last edited:

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I know I am the best. This is the code I had saved, so not exactly what your looking for. Please provide a link to what you found.

Code:
/**************************************************************************/

/* Bayesian: Jeffrey's Priors on Variance and Flat priors on fixed effects */

/* Resources: https://communities.sas.com/t5/Statistical-Procedures/PRIOR-statement-in-mixed-procedure/td-p/246010

SEE SAS Inc. MLM Book PDF Ch. 13

Paper: Nonconjugate Bayesian Analysis of Variance Component Model, 2000 Biometrics.

/****************************************************************************/

/*FEV1*/

ods graphics on;

proc mixed data=complete_step covtest cl method=reml asycov;

class MRN;

model FEV1 = Recovery_Time_20

Max_HR_10

Min_Sat_5

Age_5

BMI_calc/ s residual influence cl;

random int age_5 /  subject=MRN s;

prior / nsample=1e4 seed=1234 out=post psearch ptrans;

run;

ods graphics off;

#### noetsi

##### No cake for spunky
I didn't find anything yet hlsmith. I am just learning how to do multilevel modeling