pzivich / zEpid

Epidemiology analysis package
http://zepid.readthedocs.org
MIT License
141 stars 33 forks source link

V0.4.0 #35

Closed pzivich closed 5 years ago

pzivich commented 5 years ago

@CamDavidsonPilon I added all your suggestions. I ran into some trouble incorporating kwargs for the plots. With the addition of kwargs, the use of plot and scatter caused some issues, since the arguments for these don't mesh (s is not in plot). Originally, I planned on using errorbars, which would make my life easier, but the error bars do not work as expected. It is especially problematic for the ratio measures where SD is the SD of the logarithm of the ratio.

If you have any suggestions over the current approach, I am happy to hear them. I haven't thought of another approach that retains kwargs.

Below is some sample code to see what the generated plots look like with kwargs

import matplotlib.pyplot as plt
import zepid as ze

df = ze.load_sample_data(False)

rd = ze.RiskDifference()
rd.fit(df, exposure='art', outcome='dead')

rd.plot()  # No kwargs
plt.show()

rd.plot(color='r')  # Color only
plt.show()

rd.plot(marker='*', markersize=20, color='r')  # Custom markers
plt.show()
CamDavidsonPilon commented 5 years ago

I'll play around a bit with the kwargs stuff today 👍

Edit: I too want to use errorbars in lifelines, so it would be nice to figure this out.