-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Power documentation and Example #4091
base: main
Are you sure you want to change the base?
Conversation
I could use some help figuring out how the documentation system is supposed to work. A few issues:
|
Codecov Report
@@ Coverage Diff @@
## master #4091 +/- ##
==========================================
+ Coverage 80.26% 80.26% +<.01%
==========================================
Files 564 564
Lines 85555 85556 +1
Branches 9675 9675
==========================================
+ Hits 68669 68670 +1
- Misses 14656 14659 +3
+ Partials 2230 2227 -3
Continue to review full report at Codecov.
|
sphinx only rebuild the parts that have been changed, so it should be faster on repeated runs. AFAIR, I haven't done it in a while
That is done automatically by sphinx, I don't know if we can somehow force the missing signature. I don't see a |
@josef-pkt I added the What do you think of the rest of the content? |
I will try to go over it later today. We will most likely have to rename prop_ind_solve_power to prop_ztest_solve_power, because we need a different version also #1197 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this got lost,
I just found two pending review comments, but it looks like I didn't finish with the review.
I'm postponing this until after 0.9rc
docs/source/power.rst
Outdated
|
||
Similar to the difference in proportions, we can use the :code:`tt_ind_solve_power` function to analyze the power of an experiment where we'll use a t-test (e.g., if we want to compare the difference in means between two groups in our study). | ||
|
||
Imagine we're working on a study to compare the spending habits between two groups of students where the outcome of interest is the average amount spent on books. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"we are" I prefer not to use the shortened forms in written text
docs/source/power.rst
Outdated
|
||
Imagine we're working on a study to compare the spending habits between two groups of students where the outcome of interest is the average amount spent on books. | ||
|
||
In this example, let's assume that we have are conducting a study where we know what our sample-size will be in advance, and we want to calculate the smallest effect-size we'll be able to detect with 80% power. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"we have are conducting" ?
I also forgot about this. I'll take another pass over the weekend. |
I think this would fit now better in a examples/notebook, which makes it also easier for users to run the example interactively. Those notebooks are a mixed bag, some with extensive explanations and some just with code examples. |
Nice. I didn't even know about those. I'll at least convert what I have.
…On Fri, Apr 27, 2018 at 10:17 AM, Josef Perktold ***@***.***> wrote:
I think this would fit now better in a examples/notebook, which makes it
also easier for users to run the example interactively.
Those notebooks are a mixed bag, some with extensive explanations and some
just with code examples.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4091 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFJQYc6nJ_s_ZmFJyTRZfzWm5txB5DZOks5tsyiQgaJpZM4QKcp2>
.
|
be986f1
to
3d9fdad
Compare
Add documentation for power module
ac1fa86
to
411df78
Compare
@josef-pkt I moved what I had into a notebook in I still think we could improve the docs for this functionality (e.g., for tt_ind_solve_power) which is the first statsmodels result when you search python power analysis . In particular, something on that page that points either to the example notebook or a more info on the suite of power tests would be helpful for end users. LMK if I can help with that or if you just want to leave it. |
@mikekaminsky In our old sourceforge doc pages it was possible to directly link to the notebooks. I don't think it's currently possible in the new github site, but those links should (eventually) be available again. |
@josef-pkt works for me. I think this is an improvement that's good to go out as-is unless you have additional comments / suggestions. |
I put milestone 0.9 back. I'm not sure yet whether |
I think I was trying to both follow your patterns and show how to generate what you get in R
I can make the interface the same as the R one so that you just give two proportions (and the ES gets calculated under the hood) -- LMK what you think would be most useful to users |
|
@bashtage I don't really have time to pick this back up right now. Happy to simply close the PR. |
Thanks for this great functionality. I found the documentation of the class and methods to be a bit confusing to me particularly about the number of observations, i.e. if it was about the whole set or for each group. Meanwhile I managed to clarify this through a similar implementation in R. As I couldn't find a reply to this question I created a stackoverflow Q&A: https://stackoverflow.com/questions/68365921/statsmodels-power-analysis-number-of-observations/68366180#68366180 Hope this is of any use. Thanks, |
@EmanuelGoncalves So, the general pattern is that |
That makes sense, thank you. But isn't it still ambiguous in the plot_power function of the TTestIndPower class, since the argument is nobs? |
The name nobs is ambiguous or "wrong", but it's inherited and we would need to add a method to subclasses to adjust the signature of the method. I guess we should do this, but when I'm writing new things, I'm more focused on getting the code to work instead of thinking about every part of the api. That's were feedback becomes helpful. A bit similar: some functions work for both one and two sample cases, and we cannot have nobs and nobs1 at the same time. even though that would be appropriate. |
Improvements to power documentation. Comments and suggestions welcome!
Working on suggestions noted in #4085
Future Work:
plot_power()
functionpower()
function and point everyone to thesolve_power()
versions