diff --git a/docs/LICENSE.html b/docs/LICENSE.html new file mode 100644 index 0000000..2689fc0 --- /dev/null +++ b/docs/LICENSE.html @@ -0,0 +1,129 @@ + + + +
+ + + + +YEAR: 2016-2017 +COPYRIGHT HOLDER: Aravind Hebbali ++ +
Using the mtcars data, compare the standard deviation in miles per gallon for automatic and manual vehicles.
+infer_ts_var_test(hsb, read, group_var = female, alternative = 'all')## Variance Ratio Test
## --------------------------------------------------
## Group Obs Mean Std. Err. Std. Dev.
## --------------------------------------------------
-## 4 44.5 2.47 4.93
-## 4 41.75 3.42 6.85
-## 2 34.5 0.5 0.71
-## 2 36.5 5.5 7.78
-## 3 39.33 3.93 6.81
-## 1 44 NaN NaN
-## 5 45 2.81 6.28
-## 3 49 1 1.73
-## 10 47.5 1.88 5.95
-## 2 48.5 1.5 2.12
-## 1 63 NaN NaN
-## 12 44 2.26 7.82
-## 1 55 NaN NaN
-## 9 45 3.13 9.39
-## 2 44 3 4.24
-## 11 48.27 2.9 9.62
-## 2 50.5 6.5 9.19
-## 15 52.53 2.25 8.71
-## 1 39 NaN NaN
-## 17 51.18 2.28 9.38
-## 3 51.33 3.48 6.03
-## 12 49.33 2.5 8.67
-## 25 57.16 1.63 8.15
-## 4 65.25 3.42 6.85
-## 4 57 5.6 11.2
-## 18 57.28 1.85 7.84
-## 4 64 4.53 9.06
-## 16 61.88 1.7 6.79
-## 7 63.43 3.47 9.18
+## 0 91 52.82 1.1 10.51
+## 1 109 51.73 0.96 10.06
## --------------------------------------------------
## combined 200 52.23 0.72 10.25
## --------------------------------------------------
@@ -446,16 +418,16 @@
## --------------------------------------------------
## F Num DF Den DF
## --------------------------------------------------
-## 0.5187 3 3
+## 1.0913 90 108
## --------------------------------------------------
##
## Null & Alternate Hypothesis
## ----------------------------------------
-## ratio = sd() / ()
+## ratio = sd(0) / (1)
## Ho: ratio = 1
##
## Ha: ratio < 1 Ha: ratio > 1
-## Pr(F < f) = 0.3016 Pr(F > f) = 0.6984
+## Pr(F < f) = 0.6694 Pr(F > f) = 0.3306
## ----------------------------------------
Author: Aravind Hebbali
License: MIT
Inferential statistics allows us to make generalizations about populations using data drawn from the population. We use them when it is impractical or impossible to collect data about the whole population under study and instead, we have a sample that represents the population under study and using inferential statistics technique, we make generalizations about the population from the sample.
The inferr package:
# install inferr from CRAN
-install.packages("inferr")
-
-# the development version from github
-# install.packages("devtools")
-devtools::install_github("rsquaredacademy/inferr")
infer_os_t_test(hsb$write, mu = 50, type = 'all')
-#> One-Sample Statistics
-#> ---------------------------------------------------------------------------------
-#> Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
-#> ---------------------------------------------------------------------------------
-#> write 200 52.775 0.6702 9.4786 51.4537 54.0969
-#> ---------------------------------------------------------------------------------
-#>
-#> Ho: mean(write) ~=50
-#>
-#> Ha: mean < 50 Ha: mean ~= 50 Ha: mean > 50
-#> t = 4.141 t = 4.141 t = 4.141
-#> P < t = 1.0000 P > |t| = 0.0001 P > t = 0.0000
infer_os_t_test(hsb, write, mu = 50, type = 'all')
+#> One-Sample Statistics
+#> ---------------------------------------------------------------------------------
+#> Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
+#> ---------------------------------------------------------------------------------
+#> write 200 52.775 0.6702 9.4786 51.4537 54.0969
+#> ---------------------------------------------------------------------------------
+#>
+#> Ho: mean(write) ~=50
+#>
+#> Ha: mean < 50 Ha: mean ~= 50 Ha: mean > 50
+#> t = 4.141 t = 4.141 t = 4.141
+#> P < t = 1.0000 P > |t| = 0.0001 P > t = 0.0000
infer_oneway_anova(hsb, 'write', 'prog')
-#> ANOVA
-#> ----------------------------------------------------------------------
-#> Sum of
-#> Squares DF Mean Square F Sig.
-#> ----------------------------------------------------------------------
-#> Between Groups 3175.698 2 1587.849 21.275 0.0000
-#> Within Groups 14703.177 197 74.635
-#> Total 17878.875 199
-#> ----------------------------------------------------------------------
-#>
-#> Report
-#> -----------------------------------------
-#> Category N Mean Std. Dev.
-#> -----------------------------------------
-#> 1 45 51.333 9.398
-#> 2 105 56.257 7.943
-#> 3 50 46.760 9.319
-#> -----------------------------------------
-#>
-#> Number of obs = 200 R-squared = 0.1776
-#> Root MSE = 8.6392 Adj R-squared = 0.1693
infer_oneway_anova(hsb, write, prog)
+#> ANOVA
+#> ----------------------------------------------------------------------
+#> Sum of
+#> Squares DF Mean Square F Sig.
+#> ----------------------------------------------------------------------
+#> Between Groups 3175.698 2 1587.849 21.275 0.0000
+#> Within Groups 14703.177 197 74.635
+#> Total 17878.875 199
+#> ----------------------------------------------------------------------
+#>
+#> Report
+#> -----------------------------------------
+#> Category N Mean Std. Dev.
+#> -----------------------------------------
+#> 1 45 51.333 9.398
+#> 2 105 56.257 7.943
+#> 3 50 46.760 9.319
+#> -----------------------------------------
+#>
+#> Number of obs = 200 R-squared = 0.1776
+#> Root MSE = 8.6392 Adj R-squared = 0.1693
infer_chisq_assoc_test(as.factor(hsb$female), as.factor(hsb$schtyp))
-#> Chi Square Statistics
-#>
-#> Statistics DF Value Prob
-#> ----------------------------------------------------
-#> Chi-Square 1 0.0470 0.8284
-#> Likelihood Ratio Chi-Square 1 0.0471 0.8282
-#> Continuity Adj. Chi-Square 1 0.0005 0.9822
-#> Mantel-Haenszel Chi-Square 1 0.0468 0.8287
-#> Phi Coefficient 0.0153
-#> Contingency Coefficient 0.0153
-#> Cramer's V 0.0153
-#> ----------------------------------------------------
infer_chisq_assoc_test(hsb, female, schtyp)
+#> Chi Square Statistics
+#>
+#> Statistics DF Value Prob
+#> ----------------------------------------------------
+#> Chi-Square 1 0.0470 0.8284
+#> Likelihood Ratio Chi-Square 1 0.0471 0.8282
+#> Continuity Adj. Chi-Square 1 0.0005 0.9822
+#> Mantel-Haenszel Chi-Square 1 0.0468 0.8287
+#> Phi Coefficient 0.0153
+#> Contingency Coefficient 0.0153
+#> Cramer's V 0.0153
+#> ----------------------------------------------------
infer_levene_test(hsb$read, group_var = hsb$race)
-#> Summary Statistics
-#> Levels Frequency Mean Std. Dev
-#> -----------------------------------------
-#> 1 24 46.67 10.24
-#> 2 11 51.91 7.66
-#> 3 20 46.8 7.12
-#> 4 145 53.92 10.28
-#> -----------------------------------------
-#> Total 200 52.23 10.25
-#> -----------------------------------------
-#>
-#> Test Statistics
-#> -------------------------------------------------------------------------
-#> Statistic Num DF Den DF F Pr > F
-#> -------------------------------------------------------------------------
-#> Brown and Forsythe 3 196 3.44 0.0179
-#> Levene 3 196 3.4792 0.017
-#> Brown and Forsythe (Trimmed Mean) 3 196 3.3936 0.019
-#> -------------------------------------------------------------------------
infer_levene_test(hsb, read, group_var = race)
+#> Summary Statistics
+#> Levels Frequency Mean Std. Dev
+#> -----------------------------------------
+#> 1 24 46.67 10.24
+#> 2 11 51.91 7.66
+#> 3 20 46.8 7.12
+#> 4 145 53.92 10.28
+#> -----------------------------------------
+#> Total 200 52.23 10.25
+#> -----------------------------------------
+#>
+#> Test Statistics
+#> -------------------------------------------------------------------------
+#> Statistic Num DF Den DF F Pr > F
+#> -------------------------------------------------------------------------
+#> Brown and Forsythe 3 196 3.44 0.0179
+#> Levene 3 196 3.4792 0.017
+#> Brown and Forsythe (Trimmed Mean) 3 196 3.3936 0.019
+#> -------------------------------------------------------------------------
infer_cochran_qtest(exam)
-#> Test Statistics
-#> ----------------------
-#> N 15
-#> Cochran's Q 4.75
-#> df 2
-#> p value 0.093
-#> ----------------------
himath <- ifelse(hsb$math > 60, 1, 0)
-hiread <- ifelse(hsb$read > 60, 1, 0)
-infer_mcnemar_test(table(himath, hiread))
-#> Controls
-#> ---------------------------------
-#> Cases 0 1 Total
-#> ---------------------------------
-#> 0 135 21 156
-#> 1 18 26 44
-#> ---------------------------------
-#> Total 153 47 200
-#> ---------------------------------
-#>
-#> McNemar's Test
-#> ----------------------------
-#> McNemar's chi2 0.2308
-#> DF 1
-#> Pr > chi2 0.631
-#> Exact Pr >= chi2 0.7493
-#> ----------------------------
-#>
-#> Kappa Coefficient
-#> --------------------------------
-#> Kappa 0.4454
-#> ASE 0.075
-#> 95% Lower Conf Limit 0.2984
-#> 95% Upper Conf Limit 0.5923
-#> --------------------------------
-#>
-#> Proportion With Factor
-#> ----------------------
-#> cases 0.78
-#> controls 0.765
-#> ratio 1.0196
-#> odds ratio 1.1667
-#> ----------------------
hb <-
+ hsb %>%
+ mutate(
+ himath = if_else(math > 60, 1, 0),
+ hiread = if_else(read > 60, 1, 0)
+ )
+infer_mcnemar_test(hb, himath, hiread)
+#> Controls
+#> ---------------------------------
+#> Cases 0 1 Total
+#> ---------------------------------
+#> 0 135 21 156
+#> 1 18 26 44
+#> ---------------------------------
+#> Total 153 47 200
+#> ---------------------------------
+#>
+#> McNemar's Test
+#> ----------------------------
+#> McNemar's chi2 0.2308
+#> DF 1
+#> Pr > chi2 0.631
+#> Exact Pr >= chi2 0.7493
+#> ----------------------------
+#>
+#> Kappa Coefficient
+#> --------------------------------
+#> Kappa 0.4454
+#> ASE 0.075
+#> 95% Lower Conf Limit 0.2984
+#> 95% Upper Conf Limit 0.5923
+#> --------------------------------
+#>
+#> Proportion With Factor
+#> ----------------------
+#> cases 0.78
+#> controls 0.765
+#> ratio 1.0196
+#> odds ratio 1.1667
+#> ----------------------
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.