BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yuliya
Obsidian | Level 7

Hi,

 

I would highly appreciate it if you could give me any guidance how I can simulate the joint Beta-binomial distribution.

 

Thank you in advance.

 

Regards,

Yuliya

1 ACCEPTED SOLUTION

Accepted Solutions
Yuliya
Obsidian | Level 7

Hi everyone,

 

thank you very much for your help.

 

I simulated with both ways.

 

Have a nice weekend.

 

Regards,

 

Yuliya

View solution in original post

14 REPLIES 14
Yuliya
Obsidian | Level 7

Hi,

 

thank you very much. Unfortunately, there is only ine part of the book with the simplest simulations. I need to simulate a joint distribution Beta - binomial. Any ideas?

 

Thank you again.

 

Regards,

Yuliya

 

Rick_SAS
SAS Super FREQ

I think

Ksharp
Super User
You should post it at IML forum.
Here is Gamma+Possion distribution:

http://blogs.sas.com/content/iml/2014/04/02/interpret-nb-distribution.html


Yuliya
Obsidian | Level 7
Thank you very much!
Ksharp
Super User
OK. Here is Beta-Binomial distribution.
Beta-Binomial is usually for Overdispersion Models .






data have;
pi=0.3;
Rho=0.2;
m=30;

c=(1-Rho**2)/(Rho**2) ;
a=c*pi;
b=c*(1-pi);

call streaminit(1234);
do i=1 to 1000000;
 p=rand('beta',a,b);
 x=rand('binomial',p,m);
 output;
end;
keep x;
run;


proc sgplot data=have;
 vbar x / stat=percent;
run;

Yuliya
Obsidian | Level 7

Hi everyone,

 

thank you very much for your help.

 

I simulated with both ways.

 

Have a nice weekend.

 

Regards,

 

Yuliya

Abdelkarim
Calcite | Level 5

Hello Ksharp;

I could not find PDF, CDF, and inverse CDF call functions for beta binomial in SAS. I appreciate your help in determining all possible values of unknown parameters, say eta1 and eta2 (reparameterized parameters) that satisfies two inverse beta binomial functions simultaneously. For example, if the inverse CDF of beta binomial is Q, then how we can solve the following equations together for eta1 and eta2 :

6=Q(0.8, eta1,eta2) and 2=Q(0.1,eta1,eta2)  and once we have these values, how we can keep them to be used in a following step in the program.                       

Thank you

Ksharp
Super User
Sorry. It is out of my knowledge. But maybe @Rick_SAS could help you.
Post your question at IML forum. Since it is about data simulation.


Rick_SAS
SAS Super FREQ

This thread is old and SOLVED (closed). It contains a link to a blog post that describes how to simulate from a compound distribution. The beta-binomial distribution is compound, so to generate random draws from the beta-binomial you can first draw p from a beta distribution and then draw X from the binomial(p) distribution.

 

If you want to use the other probability function such as PDF, CDF, and QUANTILE, please start a new thread in in this forum or in the Base SAS Community.

Abdelkarim
Calcite | Level 5

Hi,

How can I start a new thread in in this forum?

Thank you 

Rick_SAS
SAS Super FREQ
Click the "Please ask a new question" link at the top right. You can also go up one level to the General SAS Programming Community. However, if it is a question about the beta-binomial distribution you might want to post to the SAS Statistical Community
mikami-ms
Calcite | Level 5

I'm not sure, but if c=a+b and rho=1/(a+b+1), c=(1-rho)/rho?

Rick_SAS
SAS Super FREQ

See the article "Simulate data from the beta-binomial distribution in SAS."

If you also need the PDF, CDF, and quantile functions, see the article "Compute the CDF and quantiles of discrete distributions."

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 14 replies
  • 6279 views
  • 5 likes
  • 6 in conversation