samplics-org / samplics

Select, weight and analyze complex sample data
https://samplics-org.github.io/samplics/
MIT License
57 stars 11 forks source link

Getting Started Documentation Issue #54

Closed kevintcaron closed 4 months ago

kevintcaron commented 6 months ago

Hello,

It looks like the Getting Started documentation suggests the use of the following code snippet:

`import samplics from samplics.estimation import TaylorEstimation, ReplicateEstimator

zinc_mean_str = TaylorEstimator("mean").estimate( y=nhanes2f["zinc"], samp_weight=nhanes2f["finalwgt"], stratum=nhanes2f["stratid"], psu=nhanes2f["psuid"], exclude_nan=True )

ratio_wgt_hgt = ReplicateEstimator("brr", "ratio").estimate( y=nhanes2brr["weight"], samp_weight=nhanes2brr["finalwgt"], x=nhanes2brr["height"], rep_weights=nhanes2brr.loc[:, "brr_1":"brr_32"], exclude_nan = True )`

However, the init.py file for samplics.estimation uses TaylorEstimator, not TaylorEstimation. This caused me some confusion until I reoslved the issue by editing the provided snippet. Please consider updating the getting started material.

Thanks for your work on this awesome project!

Kevin

MamadouSDiallo commented 6 months ago

Will fix the issue, thanks for reporting.

kevintcaron commented 6 months ago

I noticed one other thing. I believe in this part of the snippet the current version of samplics uses remove_nan instead of exclude_nan as a param.

zinc_mean_str = TaylorEstimator("mean").estimate( y=nhanes2f["zinc"], samp_weight=nhanes2f["finalwgt"], stratum=nhanes2f["stratid"], psu=nhanes2f["psuid"], exclude_nan=True )

exclude_nan does not work for me, but remove_nan does.

MamadouSDiallo commented 4 months ago

I believe this was fixed. Thanks.