Type: | Package |
Title: | Magnitude-Based Inferences |
Version: | 1.3.5 |
Date: | 2019-01-22 |
Maintainer: | Kyle Peterson <petersonkdon@gmail.com> |
Description: | Allows practitioners and researchers a wholesale approach for deriving magnitude-based inferences from raw data. A major goal of 'mbir' is to programmatically detect appropriate statistical tests to run in lieu of relying on practitioners to determine correct stepwise procedures independently. |
Imports: | graphics, stats, utils, effsize, psych |
URL: | http://mbir-project.us/ |
License: | GPL-2 |
Copyright: | Segments of the package are based upon Will G. Hopkins' work. See vignette and COPYRIGHT file for details. |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.0 |
Suggests: | knitr, testthat, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2019-01-22 17:40:10 UTC; ath_sportsci |
Author: | Kyle Peterson [aut, cre], Aaron Caldwell [aut] |
Repository: | CRAN |
Date/Publication: | 2019-01-22 17:50:02 UTC |
Accuracy in Parameter Estimation: Standardized Mean Difference
Description
Estimates sample size for paired or independent, two-sample study desings via Accuracy in Parameter Estimation. Calculates n so a given study is likely to obtain margin of error no larger than chosen target margin of error.
Usage
aipe_smd(moe, paired = c(TRUE, FALSE), conf.int, assur.lvl, r)
Arguments
moe |
target margin of error in standard deviation units |
paired |
(character) logical indicator specifying if |
conf.int |
(optional) confidence level of the interval. Defaults to |
assur.lvl |
(optional) desired level of assurance (percent experiments whose MOE is less than target MOE). Defaults to |
r |
(required if |
Details
Refer to vignette for further information.
References
Maxwell SE, Kelley K & Rausch JR. (2008). Sample size planning for statistical power and accuracy in parameter estimation. Annual Review of Psychology, 59, 537-563.
Kelley K & Rausch JR. (2006). Sample size planning for the standardized mean difference: Accuracy in parameter estimation via narrow confidence intervals. Psychological Methods, 11, 363–385.
Examples
aipe_smd(moe = 0.55, paired = TRUE, conf.int = .9, assur.lvl = .99, r = 0.75)
Bootstrap Confidence Intervals via Resampling
Description
Provides nonparametric confidence intervals via percentile-based resampling.
Usage
boot_test(x, y, conf.int, resample, med)
Arguments
x , y |
numeric vectors of data values |
conf.int |
(optional) confidence level of the interval. Defaults to |
resample |
(optional) number of resamples. Defaults to 10,000 |
med |
(optional) number indicating true difference in medians to test against. Defaults to zero. |
Details
Refer to vignette for further information.
Examples
require(graphics)
a <- rnorm(25, 80, 35)
b <- rnorm(25, 100, 50)
boot_test(a, b, 0.95, 10000)
Correlation Coefficient
Description
Provides magnitude-based inferences upon given r value and sample size. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
corr(r, n, conf.int = 0.9, swc = 0.1, plot = FALSE)
Arguments
r |
correlation coefficient |
n |
sample size |
conf.int |
(optional) confidence level of the interval. Defaults to |
swc |
(optional) number indicating smallest worthwhile change. Defaults to |
plot |
(optional) logical indicator specifying to print associated plot. Defaults to |
Details
Refer to vignette for further information.
References
Hopkins WG. (2007). A spreadsheet for deriving a confidence interval, mechanistic inference and clinical inference from a p value. Sportscience 11, 16-20. sportsci.org/2007/wghinf.htm
Examples
corr(.40, 25, 0.95)
Test of Two Correlations
Description
Provides statistical inference upon the difference between two independent correlations.
Usage
corr_diff(r1, n1, r2, n2, conf.int = 0.9, plot = FALSE)
Arguments
r1 |
correlation of group 1 |
n1 |
sample size of group 1 |
r2 |
correlation of group 2 |
n2 |
sample size of group 2 |
conf.int |
(optional) confidence level of the interval. Defaults to |
plot |
(optional) logical indicator specifying to print associated plot. Defaults to |
Details
Refer to vignette for further information.
References
Zou GY. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12, 399-413.
Examples
corr_diff(r1 = 0.20, n1 = 71, r2 = 0.55, n2 = 46)
Correlation Coefficient Test
Description
Provides magnitude-based inferences for the association between given data vectors. Evaluates normality assumption, performs either Pearson or Spearman correlation and subsequently estimates magnitude-based inferences.
Usage
corr_test(x, y, conf.int = 0.9, auto = TRUE, method = "pearson",
swc = 0.1, plot = FALSE)
Arguments
x , y |
numeric vectors of data values |
conf.int |
(optional) confidence level of the interval. Defaults to |
auto |
(character) logical indicator specifying if user wants function to programmatically detect statistical procedures. Defaults to |
method |
(character) if |
swc |
(optional) number indicating smallest worthwhile change. Defaults to |
plot |
(optional) logical indicator specifying to print associated plot. Defaults to |
Details
Refer to vignette for further information.
Value
Associated effect size measure, r, and respective confidence intervals.
Examples
a <- rnorm(25, 80, 35)
b <- rnorm(25, 100, 35)
corr_test(a, b, 0.95)
Effect Size Converter
Description
Converts between equivalent effect size measures: d, r, odds ratio.
Usage
es_convert(x, from = c("d", "or", "r"), to = c("d", "or", "r"))
Arguments
x |
numeric value |
from |
(character) current effect size of |
to |
(character) effect size measure to convert to |
Details
Refer to vignette for further information.
References
Rosenthal R. (1994). Parametric measures of effect size. In H. Cooper & LV. Hedges (Eds.), The Handbook of Research Synthesis. New York, NY: Sage.
Borenstein M, Hedges LV, Higgins JPT & Rothstein HR. (2009). Introduction to Meta-Analysis. Chichester, West Sussex, UK: Wiley.
Examples
# Odds ratio to Cohen's d
es_convert(1.25, from = "or", to = "d")
Odds Ratio
Description
Provides magnitude-based inferences upon given odds ratio and p-value. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
odds(or, p, conf.int = 0.9)
Arguments
or |
odds ratio |
p |
associated p-value |
conf.int |
(optional) confidence level of the interval. Defaults to |
Details
Refer to vignette for further information.
References
Hopkins WG. (2007). A spreadsheet for deriving a confidence interval, mechanistic inference and clinical inference from a p value. Sportscience 11, 16-20. sportsci.org/2007/wghinf.htm
Examples
odds(1.25, 0.06, 0.95)
Test of Two Proportions
Description
Provides magnitude-based inferences upon given proportions and sample sizes. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
prop(p1, n1, p2, n2, conf.int)
Arguments
p1 |
proportion of group 1 |
n1 |
sample size of group 1 |
p2 |
proportion of group 2 |
n2 |
sample size of group 2 |
conf.int |
(optional) confidence level of the interval. Defaults to |
Details
Refer to vignette for further information.
References
Hopkins WG. (2007). A spreadsheet for deriving a confidence interval, mechanistic inference and clinical inference from a p value. Sportscience 11, 16-20. sportsci.org/2007/wghinf.htm
Examples
prop(p1 = 0.7, n1 = 25, p2 = 0.5, n2 = 20)
Standardized Mean Difference
Description
Provides magnitude-based inferences upon given d, p-value, and degrees of freedom. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
smd(es, p, df, conf.int = 0.9, swc = 0.5, plot = FALSE)
Arguments
es |
effect size measure (Cohen's d) |
p |
associated p-value from t-statistic |
df |
associated degrees of freedom from t-statistic |
conf.int |
(optional) confidence level of the interval. Defaults to |
swc |
(optional) number indicating smallest worthwhile change. Defaults to |
plot |
(optional) logical indicator specifying to print associated plot. Defaults to |
Details
Refer to vignette for further information.
References
Hopkins WG. (2007). A spreadsheet for deriving a confidence interval, mechanistic inference and clinical inference from a p value. Sportscience 11, 16-20. sportsci.org/2007/wghinf.htm
Examples
smd(.75, 0.06, 20, 0.95)
Standardized Mean Difference Test
Description
Performs two-sample difference of means analysis to produce magnitude-based inferences. Evaluates both normality and homogeneity, performs either t-test or wilcoxon test, computes effect sizes and estimates magnitude-based inferences. Allows both independent and paired designs.
Usage
smd_test(x, y, paired = c(TRUE, FALSE), auto = TRUE, var = TRUE,
normal = TRUE, conf.int = 0.9, mu = 0, swc = 0.5, plot = FALSE)
Arguments
x , y |
numeric vectors of data values |
paired |
(character) logical indicator specifying if |
auto |
(character) logical indicator specifying if user wants function to programmatically detect statistical procedures. Defaults to |
var |
(optional) if |
normal |
(optional) if |
conf.int |
(optional) confidence level of the interval. Defaults to |
mu |
(optional) number indicating true difference in means to test against. Defaults to zero. |
swc |
(optional) number indicating smallest worthwhile change. Defaults to |
plot |
(optional) logical indicator specifying to print associated plot. Defaults to |
Details
Refer to vignette for further information.
Value
Associated effect size measures (d, r, odds ratio) and respective confidence intervals based upon which statistical test(s) performed.
Examples
a <- rnorm(25, 80, 35)
b <- rnorm(25, 100, 50)
smd_test(a, b, paired = FALSE, conf.int=0.95)
Sample Size Estimation: Correlation Coefficient
Description
Estimates magnitude-based inferences upon planned sample size and r value. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
ss_corr(n, r)
Arguments
n |
planned sample size |
r |
planned correlation coefficient |
Details
Refer to vignette for further information.
References
Hopkins WG. (2006). Estimating sample size for magnitude-based inferences. Sportscience 10, 63-70. sportsci.org/2006/wghss.htm
Examples
ss_corr(n = 20, r = 0.2)
Sample Size Estimation: Odds Ratio
Description
Estimates magnitude-based inferences upon planned sample size and odds ratio. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
ss_odds(exp, con, or)
Arguments
exp |
planned sample size of experimental group |
con |
planned sample size of control group |
or |
planned odds ratio |
Details
Refer to vignette for further information.
References
Hopkins WG. (2006). Estimating sample size for magnitude-based inferences. Sportscience 10, 63-70. sportsci.org/2006/wghss.htm
Examples
ss_odds(exp = 15, con = 18, or = 3.25)
Sample Size Estimation: Standardized Mean Difference
Description
Estimates magnitude-based inferences upon planned sample size and d value. Based upon WG Hopkins Microsoft Excel spreadsheet.
Usage
ss_smd(exp, con, es)
Arguments
exp |
planned sample size of experimental group |
con |
planned sample size of control group |
es |
planned Cohen's d |
Details
Refer to vignette for further information.
References
Hopkins WG. (2006). Estimating sample size for magnitude-based inferences. Sportscience 10, 63-70. sportsci.org/2006/wghss.htm
Examples
ss_smd(exp = 20, con = 15, es = 0.6)
Smallest Worthwhile Change: Individual
Description
Provides longitudinal magnitude-based inferences for an individual's change from previous time point and magnitude of deviation from trend line.
Usage
swc_ind(x, swc, type = c("previous", "trend"), ts, te, main, xlab, ylab)
Arguments
x |
numeric vectors of data values |
swc |
smallest worthwhile change |
type |
(character) indicator specifying which type of analysis: "previous" or "trend" |
ts |
(required if |
te |
(optional) typical error. Defaults to typical error of the estimate |
main |
(optional) plot title. Defaults to blank |
xlab |
(optional) x-axis label. Defaults to "Measurement" |
ylab |
(optional) y-axis label. Defaults to name of |
Details
Refer to vignette for further information.
References
Hopkins WG. (2017). A spreadsheet for monitoring an individual's changes and trend. Sportscience 21, 5-9. sportsci.org/2017/wghtrend.htm
Examples
df<-c(97.5,99.9,100.2,101,101.2,99.8)
swc_ind(x = df, swc = 0.5, te = 1, ts = 0.25, type = "trend")