Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding generalized beta family PDF's in PS2 #6

Open
rickecon opened this issue Jan 12, 2017 · 2 comments
Open

Coding generalized beta family PDF's in PS2 #6

rickecon opened this issue Jan 12, 2017 · 2 comments

Comments

@rickecon
Copy link
Owner

I want you to code up your own PDF functions for the gamma (GA) distribution, generalized gamma (GG) distribution, and generalized beta 2 (GB2) distribution for Problem Set 2. But I want to give you some direction also.

@rickecon
Copy link
Owner Author

My first recommendation is to create the three pdf functions in a Python module. A module is just a Python file (e.g., filename.py) that contains function definitions. I recommend that you call your module distributions.py, as it will contain the function definitions for the three PDF functions you will use in your problem set. You can import these function definitions into your Python script that runs your analyses by including the following import command at the top of your script.

import distributions as dst

You can then use in your script any of the imported functions that you defined in your module by putting the dst. prefix on the function name. For example, if you defined a function named GA_pdf() for the gamma distribution, you could call that after importing it as shown above by using the command dst.GA_pdf().

@rickecon
Copy link
Owner Author

rickecon commented Jan 12, 2017

I also wanted to give you some direction as to where to find the special functions that are in the denominators of the gamma (GA), generalized gamma (GG), and generalized beta 2 (GB2) distributions. The GA and GG distributions both have a function in the denominator \Gamma(z) that is the gamma function. This is not to be confused with the gamma distribution. The scipy.special library has many special functions, including this gamma function. You can import the scipy.special functions by using the following command.

import scipy.special as spc

Then, in you definitions for the GA and GG PDF's, you can include the gamma function by writing the command spc.gamma(z). In the GB2 PDF, you can include the beta function by writing the command spc.beta(p, q).

rickecon pushed a commit that referenced this issue Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant