jrfiedler / causal_inference_python_code

Python code for part 2 of the book Causal Inference: What If, by Miguel Hernán and James Robins
1.25k stars 387 forks source link

Create Chapter 11 Alternative Method #2

Closed pettypychen closed 5 years ago

pettypychen commented 5 years ago

Chapter 11 Alternative Method of Calculating the Expected Value of Y When A = 90.

jrfiedler commented 5 years ago

So it looks like these lines

# Alternative method of calculating the expected value of Y when A =90
# .get_prediction is an easier way of calculating the expected value and 95% CI
pred = res.get_prediction(exog=[1,90])
# Will generate error message, but used to call out the data in a dataframe     
pred.summary_frame()

would replace cells 15 and 16 in the chapter11.ipynb notebook.

This looks good.

Can you put this in the notebook and submit the changed notebook in a pull request? I could do it (and cite this in the commit message), but I think a pull request gives you credit more directly. By the way, I didn't get an error or warning message with the pred.summary_frame() line.

pettypychen commented 5 years ago

Dear James,

Sorry, I am a GitHub newbie. I don’t know how to put my jupyter notebook in a pull request. I tried googling it, but I didn’t find anything that could help me. Do you think you can guide me through the steps?

Best regards,

Petty

On Feb 11, 2019, at 10:48 PM, jrfiedler <notifications@github.com mailto:notifications@github.com> wrote:

Alternative method of calculating the expected value of Y when A =90

.get_prediction is an easier way of calculating the expected value and 95% CI

pred = res.get_prediction(exog=[1,90])

Will generate error message, but used to call out the data in a dataframe

pred.summary_frame()

jrfiedler commented 5 years ago

Sure, no problem.

I'm assuming you have a local copy of the repo, on your own computer. If not, let me know.

I think the main thing is, in your local copy of the repo, you'll make the changes to the existing chapter11.ipynb. (And if you don't get the changes right the first time, for your final version restart the kernel and run all the cells, so that they're numbered sequentially, 1, 2, 3, ...) Then you'll commit those changes, and make the pull request as usual.

Let me know if there are particular steps you get stuck on. I'll be happy to help.

pettypychen commented 5 years ago

I managed to put the revision on my GitHub: https://github.com/pettypychen/PullRequest/blob/master/chapter11.ipynb https://github.com/pettypychen/PullRequest/blob/master/chapter11.ipynb.

But the pull request showed that there is nothing to compare. I can’t figure out how to get the Jupyter Notebook to show up in the pull request.

Thank you!

Petty

On Feb 13, 2019, at 6:41 AM, jrfiedler notifications@github.com wrote:

Sure, no problem.

I'm assuming you have a local copy of the repo, on your own computer. If not, let me know.

I think the main thing is, in your local copy of the repo, you'll make the changes to the existing chapter11.ipynb. (And if you don't get the changes right the first time, for your final version restart the kernel and run all the cells, so that they're numbered sequentially, 1, 2, 3, ...) Then you'll commit those changes, and make the pull request as usual.

Let me know if there are particular steps you get stuck on. I'll be happy to help.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/jrfiedler/causal_inference_python_code/pull/2#issuecomment-462967475, or mute the thread https://github.com/notifications/unsubscribe-auth/AlS1-rhjjg4OIusPa8GwaWeQ7mP9UH9wks5vM0MUgaJpZM4azZZo.

jrfiedler commented 5 years ago

I guess I'm not sure what process you are using, or the process you used to create the first pull request.

Here is how I would create the pull request. I don't know how this fits in with what you're doing already. Possibly you could follow all of these steps, or, if individual steps help, pick and choose.

  1. Create a fork of this repo in your GitHub account (using the "Fork" button on the main page of this repo)
  2. Clone your forked repo onto your computer.
  3. Make changes to the chapter11.ipynb in the clone on your computer
  4. Commit the changes, and push them to your fork on GitHub
  5. Create a pull request from your updated fork to this repo. This page might help: https://help.github.com/articles/creating-a-pull-request-from-a-fork/