Skip to content

Commit

Permalink
Merge pull request #281 from michaelwalshe/survey-stats-python-comp
Browse files Browse the repository at this point in the history
Survey Statistics - Example/Comparison (Python)
  • Loading branch information
statasaurus authored Aug 19, 2024
2 parents a39ccaa + 0bc4005 commit 035b87a
Show file tree
Hide file tree
Showing 11 changed files with 9,134 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt

Expand Down

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion R/survey-stats-summary.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ When conducting large-scale trials on samples of the population, it can be neces

All of these designs need to be taken into account when calculating statistics, and when producing models. Only summary statistics are discussed in this document, and variances are calculated using the default Taylor series linearisation methods. For a more detailed introduction to survey statistics in R, see [@Lohr_2022] or [@tlumley_2004].

We will use the [`{survey}`](https://cran.r-project.org/web/packages/survey/index.html) package, which is the standard for survey statistics in R. Note that for those who prefer the tidyverse, the [`{srvyr}`](https://cran.r-project.org/web/packages/srvyr/index.html) package is a wrapper around `{survey}` with `{dplyr}` like syntax.

# Simple Survey Designs

We will use the [API]((https://r-survey.r-forge.r-project.org/survey/html/api.html)) dataset [@API_2000], which contains a number of datasets based on different samples from a dataset of academic performance. Initially we will just cover the methodology with a simple random sample and a finite population correction to demonstrate functionality.
Expand Down Expand Up @@ -145,7 +147,6 @@ svyby(~HI_CHOL, ~race, nhanes_design, svymean, na.rm=TRUE, deff=TRUE)
```{r}
#| echo: false
si <- sessioninfo::session_info("survey", dependencies = FALSE)
si$external <- structure(list("SAS" = "9.04.01M7P080520"), class = c("external_info", "list"))
si
```
:::
2 changes: 2 additions & 0 deletions SAS/survey-stats-summary.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ When conducting large-scale trials on samples of the population, it can be neces

All of these designs need to be taken into account when calculating statistics, and when producing models. Only summary statistics are discussed in this document, and variances are calculated using the default Taylor series linearisation methods. For a more detailed introduction to survey statistics in SAS, see [@Lohr_2022] or [@SAS_2018].

For survey summary statistics in SAS, we can use the `SURVEYMEANS` and `SURVEYFREQ` procedures.

# Simple Survey Designs

We will use the [API]((https://r-survey.r-forge.r-project.org/survey/html/api.html)) dataset [@API_2000], which contains a number of datasets based on different samples from a dataset of academic performance. Initially we will just cover the methodology with a simple random sample and a finite population correction to demonstrate functionality.
Expand Down
201 changes: 201 additions & 0 deletions data/apisrs.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 035b87a

Please sign in to comment.