The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

statelier

Confidence intervals and hypothesis tests in R, printed in a consistent layout organized for teaching.

Every result is laid out in the same three sections — sample information, intermediary calculations, and the final answer — so students always know where to look, whichever function produced it. The same functions also return every reported quantity in a standard R object for further use.

This package covers the elementary one- and two-sample procedures:

Function What it does
ci_mean() CI for a mean or a difference in means
ht_mean() t test for a mean or a difference in means
ci_prop() Wald CI for a proportion or a difference in proportions
ht_prop() z test for a proportion or a difference in proportions

The longer names ci_mean_stats(), ht_mean_stats(), ci_prop_stats() and ht_prop_stats() are kept as aliases, so existing code keeps working unchanged.

Installation

install.packages("statelier")

Example

library(statelier)

set.seed(1)
x <- rnorm(30, mean = 100, sd = 15)

ht_mean(x, null_value = 100, alpha = 0.05)
#> One-Sample Hypothesis Test for Population Mean
#> ==============================================
#>
#> Sample Information:
#> -------------------
#> Sample Mean:                  101.237
#> Sample Standard Deviation:     13.862
#> Sample Size (non-NA):              30
#> Missing Observations:               0
#>
#> Intermediary Calculations:
#> --------------------------
#> Standard Error:                 2.531
#> Degrees of Freedom:                29
#> T-Statistic:                    0.489
#>
#> Final Answer:
#> -------------
#> Null Hypothesis (mu):         100.000
#> Alternative Hypothesis: mu not equal to 100
#> P-Value:                        0.629
#> Significance Level:               5.0%
#> Conclusion: Fail to Reject Null Hypothesis
#> ==============================================

Omit alpha and the significance level and conclusion are left off, so students must compare the p-value to a significance level of their own choosing.

Assigning the result suppresses printing and keeps every number:

res <- ht_mean(x, null_value = 100)
res$p_value
#> [1] 0.629

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.