BookmarkSubscribeRSS Feed
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

Does anyone know about an example of how to use PRIOR statement with PROC MIXED? The documentation is not very specific about how to specify the densities. This help page indicates that you can use a DATA= option to specify the prior distributions (?) but I can’t find a concrete example of how to do it. The page says you can do a run of the procedure an export a "Base Densities" ODS table to get an example, but I can't seem to get that to work. I'm trying to find an example of the input data set to use with DATA= in the PRIOR statement.

 

This is from the documentation:

"DATA= enables you to input the prior densities of the variance components used by the sampling algorithm. This data set must contain the Type and Parm1Parmn variables, where n is the largest number of parameters among each of the base densities. The format of the DATA= data set matches that created by PROC MIXED in the "Base Densities" table, so you can output the densities from one run and use them as input for a subsequent run."

3 REPLIES 3
Patrick
Opal | Level 21

I copy/pasted your question just for fun into Copilot - and it made me laugh!

I don't have the skills to judge if the Copilot response is correct. Below the answer I got.

 

I understand your frustration with the documentation. Let's break it down step-by-step to create an example.

  1. Run PROC MIXED and Output Base Densities: First, you need to run PROC MIXED and output the "Base Densities" table to a data set. This will give you the format for the input data set you need for the PRIOR statement.

proc mixed data=your_dataset;
   class factor1 factor2;
   model response = factor1 factor2 / solution;
   random intercept / subject=subject;
   ods output BaseDensities=base_densities;
run;

 

  • Create the Input Data Set: The base_densities data set will contain the necessary columns (Type, Parm1, Parm2, etc.). You can use this data set directly or modify it if needed.

  • Run PROC MIXED with PRIOR Statement: Now, use the base_densities data set in the PRIOR statement.

 

proc mixed data=your_dataset;
   class factor1 factor2;
   model response = factor1 factor2 / solution;
   random intercept / subject=subject;
   prior (intercept) / data=base_densities;
run;

This should give you a concrete example of how to use the PRIOR statement with PROC MIXED. Does this help clarify things?

svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10
Nope, that does not work for me.
Ksharp
Super User

If you want to do Bayesian Analysis for Mixed model, Check PROC BGLIMM :

Ksharp_0-1739238566254.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 775 views
  • 6 likes
  • 3 in conversation