- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do i write a code for the equation below:
|a - b| - E|a - b|.
where E represents an expectation operator, while a and b are variables
Thanks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Equation (3) is the PDF of the binomial distribution. In SAS, you can use the PDF function to compute the binomial density.
The standard definition is
pdf = PDF("Binomial", numSuccess, prob, NumTrials);
For your notation:
pdf = PDF("Binomial", X_it, P_Bar, N_it);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS does not have a way to compute expected values of a distribution.
Are you trying to use the "mean of the data" instead of the "Expected value of a distribution"?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since E[A-B] = E[A] - E[B], this reduces to the expected value of a single random variable (rv).
If A and B are discrete r.v.'s, the expected value is a sum: E[X] = SUM( X_i * p_i ).
If they are continuous r.v.'s, then you are computing the means of the distributions. For many standard distributions, the mean has an explicit value in terms of the parameters of the distribution. For nonstandard distributions, you can compute the integral of x*f(x) over the support of the distribution. The QUAD function in SAS/IML can perform integrations like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response, i forgot to add that the expectation is calculated based on the
Binomial Distribution.
In the above question, i tried to simplify the real question.
please find attached pictures that explain the full question.
How do i find equation 2, especially the second term using SAS.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Equation (3) is the PDF of the binomial distribution. In SAS, you can use the PDF function to compute the binomial density.
The standard definition is
pdf = PDF("Binomial", numSuccess, prob, NumTrials);
For your notation:
pdf = PDF("Binomial", X_it, P_Bar, N_it);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Rick for your response,
Please in using the pdf as you specified above, how do i determine P_bar (prob) ?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The reference says that \bar{P}_t is the "cross-sectional average" of the P_{it}, which means averaged over the i, I suppose.
I don't have time to help you understand the paper, but perhaps others do. As always, the best way to get a good answer is to post data and the SAS code you are currently using. Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Rick, i did it with your help. Thanks again 👍