├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── MOTE.Rproj ├── NAMESPACE ├── R ├── apa.R ├── bn1-data.R ├── bn2-data.R ├── chisq-data.R ├── d.dep.t.avg.R ├── d.dep.t.diff.R ├── d.dep.t.diff.t.R ├── d.dep.t.rm.R ├── d.ind.t.R ├── d.ind.t.t.R ├── d.prop.R ├── d.single.t.R ├── d.single.t.t.R ├── d.to.r.R ├── d.z.mean.R ├── d.z.z.R ├── delta.ind.t.R ├── dept-data.R ├── epsilon.full.SS.R ├── eta.F.R ├── eta.full.SS.R ├── eta.partial.SS.R ├── g.ind.t.R ├── ges.partial.SS.mix.R ├── ges.partial.SS.rm.R ├── indt-data.R ├── mix2-data.R ├── odds.R ├── omega.F.R ├── omega.full.SS.R ├── omega.gen.SS.rm.R ├── omega.partial.SS.bn.R ├── omega.partial.SS.rm.R ├── r.correl.R ├── rm1-data.R ├── rm2-data.R ├── singt-data.R └── v.chi.sq.R ├── README.md ├── data ├── .Rapp.history ├── bn1_data.RData ├── bn2_data.RData ├── chisq_data.RData ├── dept_data.RData ├── indt_data.RData ├── mix2_data.RData ├── rm1_data.RData ├── rm2_data.RData └── singt_data.RData ├── inst └── CITATION └── man ├── .Rapp.history ├── apa.Rd ├── bn1_data.Rd ├── bn2_data.Rd ├── chisq_data.Rd ├── d.dep.t.avg.Rd ├── d.dep.t.diff.Rd ├── d.dep.t.diff.t.Rd ├── d.dep.t.rm.Rd ├── d.ind.t.Rd ├── d.ind.t.t.Rd ├── d.prop.Rd ├── d.single.t.Rd ├── d.single.t.t.Rd ├── d.to.r.Rd ├── d.z.mean.Rd ├── d.z.z.Rd ├── delta.ind.t.Rd ├── dept_data.Rd ├── epsilon.full.SS.Rd ├── eta.F.Rd ├── eta.full.SS.Rd ├── eta.partial.SS.Rd ├── g.ind.t.Rd ├── ges.partial.SS.mix.Rd ├── ges.partial.SS.rm.Rd ├── indt_data.Rd ├── mix2_data.Rd ├── odds.Rd ├── omega.F.Rd ├── omega.full.SS.Rd ├── omega.gen.SS.rm.Rd ├── omega.partial.SS.bn.Rd ├── omega.partial.SS.rm.Rd ├── r.correl.Rd ├── rm1_data.Rd ├── rm2_data.Rd ├── singt_data.Rd └── v.chi.sq.Rd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^\.travis\.yml$ 2 | ^.*\.Rproj$ 3 | ^\.Rproj\.user$ 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .Rproj.user 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | # just the current release 4 | language: R 5 | r: 6 | - release 7 | 8 | cache: packages 9 | 10 | # Needed R packages 11 | r_packages: 12 | - MBESS 13 | 14 | addons: 15 | apt: 16 | packages: 17 | - libgsl-dev # GNU scientific library for MBESS 18 | - libnlopt-dev # nloptr library issues 19 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: MOTE 2 | Version: 1.0.2 3 | Date: 2019-04-10 4 | Title: Effect Size and Confidence Interval Calculator 5 | Authors@R: c(person("Erin M.", "Buchanan", role = c("aut", "cre"), 6 | email = "buchananlab@gmail.com", 7 | comment = c(ORCID = "0000-0002-9689-4189")), 8 | person("Amber M", "Gillenwaters", role = "aut", 9 | comment = c(ORCID = "0000-0002-7580-3591")), 10 | person("John E.", "Scofield", role = "aut", 11 | comment = c(ORCID = "0000-0001-6345-1181")), 12 | person("K. D.", "Valentine", role = "aut", 13 | comment = c(ORCID = "0000-0001-6349-5395"))) 14 | Depends: R (>= 3.1.0) 15 | Imports: MBESS, stats, ez, reshape 16 | Description: Measure of the Effect ('MOTE') is an effect size calculator, including a 17 | wide variety of effect sizes in the mean differences family (all versions of d) and 18 | the variance overlap family (eta, omega, epsilon, r). 'MOTE' provides non-central 19 | confidence intervals for each effect size, relevant test statistics, and output 20 | for reporting in APA Style (American Psychological Association, 2010, 21 | ) with 'LaTeX'. In research, an over-reliance on p-values 22 | may conceal the fact that a study is under-powered (Halsey, Curran-Everett, 23 | Vowler, & Drummond, 2015 ). A test may be statistically 24 | significant, yet practically inconsequential (Fritz, Scherndl, & Kühberger, 2012 25 | ). Although the American Psychological Association 26 | has long advocated for the inclusion of effect sizes (Wilkinson & American 27 | Psychological Association Task Force on Statistical Inference, 1999 28 | ), the vast majority of peer-reviewed, 29 | published academic studies stop short of reporting effect sizes and confidence 30 | intervals (Cumming, 2013, ). 'MOTE' simplifies 31 | the use and interpretation of effect sizes and confidence intervals. For more 32 | information, visit . 33 | License: LGPL-3 34 | Encoding: UTF-8 35 | LazyData: true 36 | RoxygenNote: 7.1.2 37 | -------------------------------------------------------------------------------- /MOTE.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(apa) 4 | export(d.dep.t.avg) 5 | export(d.dep.t.diff) 6 | export(d.dep.t.diff.t) 7 | export(d.dep.t.rm) 8 | export(d.ind.t) 9 | export(d.ind.t.t) 10 | export(d.prop) 11 | export(d.single.t) 12 | export(d.single.t.t) 13 | export(d.to.r) 14 | export(d.z.mean) 15 | export(d.z.z) 16 | export(delta.ind.t) 17 | export(epsilon.full.SS) 18 | export(eta.F) 19 | export(eta.full.SS) 20 | export(eta.partial.SS) 21 | export(g.ind.t) 22 | export(ges.partial.SS.mix) 23 | export(ges.partial.SS.rm) 24 | export(odds) 25 | export(omega.F) 26 | export(omega.full.SS) 27 | export(omega.gen.SS.rm) 28 | export(omega.partial.SS.bn) 29 | export(omega.partial.SS.rm) 30 | export(r.correl) 31 | export(v.chi.sq) 32 | import(MBESS) 33 | import(ez) 34 | import(reshape) 35 | import(stats) 36 | -------------------------------------------------------------------------------- /R/apa.R: -------------------------------------------------------------------------------- 1 | #' APA Format 2 | #' 3 | #' A function that formats decimals and leading zeroes 4 | #' for creating reports in scientific style. 5 | #' 6 | #' @param value A set of numeric values, either a single number, vector, or set of columns. 7 | #' @param decimals The number of decimal points desired in the output. 8 | #' @param leading Logical value: \code{TRUE} for leading zeroes on decimals 9 | #' and \code{FALSE} for no leading zeroes on decimals. The default is \code{TRUE}. 10 | #' @keywords APA, decimals, formatting 11 | #' @details 12 | #' This function creates "pretty" character vectors from numeric variables 13 | #' for printing as part of a report. The value can take a single number, 14 | #' matrix, vector, or multiple columns from a data frame, as long as they are 15 | #' numeric. The values will be coerced into numeric if they are characters or 16 | #' logical values, but this process may result in an error if values are 17 | #' truly alphabetical. 18 | #' @examples 19 | #' apa(value = 0.54674, decimals = 3, leading = TRUE) 20 | #' @export 21 | 22 | apa <- function(value, decimals = 3, leading = TRUE) { 23 | 24 | if (missing(value)) { 25 | stop("Be sure to include the numeric values you wish to format.") 26 | } 27 | 28 | if (!is.numeric(value)){ 29 | stop("The values you provided are not numeric.") 30 | } 31 | 32 | if (leading == T) { 33 | formnumber <- format(round(as.numeric(value), decimals), digits = decimals, nsmall = decimals) 34 | } 35 | if (leading == F) { 36 | formnumber <- sub("^(-?)0.", "\\1.", sprintf(paste("%.", decimals, "f", sep = ""), as.numeric(value))) 37 | } 38 | return(formnumber) 39 | } 40 | 41 | #' @rdname apa 42 | #' @export 43 | -------------------------------------------------------------------------------- /R/bn1-data.R: -------------------------------------------------------------------------------- 1 | #' Between Subjects One-way ANOVA Example Data 2 | #' 3 | #' Dataset for use in \code{\link{eta.F}}, \code{\link{eta.full.SS}}, 4 | #' \code{\link{omega.F}}, \code{\link{omega.full.SS}}, 5 | #' and \code{\link{epsilon.full.SS}}, including ratings of 6 | #' inter-personal attachments of 45-year-olds categorized as 7 | #' being in excellent, fair, or poor health. 8 | #' 9 | #' @docType data 10 | #' 11 | #' @usage data(bn1_data) 12 | #' 13 | #' @format A data frame of ratings of close interpersonal attachments 14 | #' 15 | #' poor: individuals in poor health 16 | #' fair: individuals in fair health 17 | #' excellent: individuals in excellent health 18 | #' 19 | #' @keywords datasets 20 | #' 21 | #' @references Nolan and Heizen Statistics for the Behavioral Sciences 22 | #' (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 23 | #' 24 | "bn1_data" 25 | -------------------------------------------------------------------------------- /R/bn2-data.R: -------------------------------------------------------------------------------- 1 | #' Between Subjects Two-way ANOVA Example Data 2 | #' 3 | #' Dataset for use in \code{\link{omega.partial.SS.bn}}, 4 | #' \code{\link{eta.partial.SS}}, and other between-subject's ANOVA 5 | #' designs. This data includes (fake) atheletic budgets for baseball, 6 | #' basketball, football, soccer, and volleyball teams 7 | #' with new and old coaches to determine if there are differences in 8 | #' spending across coaches and sports. 9 | #' 10 | #' @docType data 11 | #' 12 | #' @usage data(bn2_data) 13 | #' 14 | #' @format A data frame of ratings of close interpersonal attachments 15 | #' 16 | #' coach: an old or new coach 17 | #' type: varying sports - baseball, basketball, football, soccer, volleyball 18 | #' money: athletic spending (in thousands of dollars) 19 | #' 20 | #' @keywords datasets 21 | #' 22 | "bn2_data" 23 | -------------------------------------------------------------------------------- /R/chisq-data.R: -------------------------------------------------------------------------------- 1 | #' Chi-Square Example Data 2 | #' 3 | #' Dataset for use in \code{\link{v.chi.sq}}, 4 | #' Individuals were polled and asked to report their number of friends 5 | #' (low, medium, high) and number of kids (1, 2, 3+) 6 | #' to determine if there was a relationship between friend 7 | #' groups and number of children. It was hypothesized that 8 | #' those with more children may have less time for 9 | #' friendship maintaining activities. 10 | #' 11 | #' @docType data 12 | #' 13 | #' @usage data(chisq_data) 14 | #' 15 | #' @format A data frame of number of friends and number of children 16 | #' 17 | #' friends: number of reported friends 18 | #' kids: number of children 19 | #' 20 | #' @keywords datasets 21 | #' 22 | #' @references Nolan and Heizen Statistics for the Behavioral Sciences 23 | #' (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 24 | #' 25 | "chisq_data" 26 | -------------------------------------------------------------------------------- /R/d.dep.t.avg.R: -------------------------------------------------------------------------------- 1 | #' d for Dependent t with Average SD Denominator 2 | #' 3 | #' This function displays d and the non-central confidence interval 4 | #' for repeated measures data, using the average standard deviation of 5 | #' each level as the denominator. 6 | #' 7 | #' To calculate d, mean two is subtracted from mean one, which is then 8 | #' divided by the average standard deviation. 9 | #' 10 | #' d_av = (m1 - m2) / ((sd1 + sd2) / 2) 11 | #' 12 | #' \href{https://www.aggieerin.com/shiny-server/tests/deptavgm.html}{Learn more on our example page.} 13 | #' 14 | #' @param m1 mean from first level 15 | #' @param m2 mean from second level 16 | #' @param sd1 standard deviation from first level 17 | #' @param sd2 standard deviation from second level 18 | #' @param n sample size 19 | #' @param a significance level 20 | #' @return The effect size (Cohen's d) with associated confidence intervals, 21 | #' the confidence intervals associated with the means of each group, 22 | #' standard deviations of the means for each group. 23 | #' 24 | #' \item{d}{effect size} 25 | #' \item{dlow}{lower level confidence interval d value} 26 | #' \item{dhigh}{upper level confidence interval d value} 27 | #' \item{M1/M2}{mean one and two} 28 | #' \item{M1low/M2low}{lower level confidence interval of mean one or two} 29 | #' \item{M1high/M2high}{upper level confidence interval of mean one or two} 30 | #' \item{sd1/sd2}{standard deviation of mean one and two} 31 | #' \item{se1/se2}{standard error of mean one and two} 32 | #' \item{n}{sample size} 33 | #' \item{df}{degrees of freedom (sample size - 1)} 34 | #' \item{estimate}{the d statistic and confidence interval in APA style for markdown printing} 35 | #' 36 | #' @keywords effect size, dependent t-test, cohen's d, d average, paired-sample, 37 | #' repeated measures 38 | #' @import MBESS 39 | #' @import stats 40 | #' @export 41 | #' @examples 42 | #' 43 | #' #The following example is derived from the "dept_data" dataset included 44 | #' #in the MOTE library. 45 | #' 46 | #' #In a study to test the effects of science fiction movies on people's 47 | #' #belief in the supernatural, seven people completed a measure of belief 48 | #' #in the supernatural before and after watching a popular science fiction 49 | #' #movie. Higher scores indicated higher levels of belief. 50 | #' 51 | #' t.test(dept_data$before, dept_data$after, paired = TRUE) 52 | #' 53 | #' #You can type in the numbers directly, or refer to the dataset, 54 | #' #as shown below. 55 | #' 56 | #' d.dep.t.avg(m1 = 5.57, m2 = 4.43, sd1 = 1.99, 57 | #' sd2 = 2.88, n = 7, a = .05) 58 | #' 59 | #' d.dep.t.avg(5.57, 4.43, 1.99, 2.88, 7, .05) 60 | #' 61 | #' d.dep.t.avg(mean(dept_data$before), mean(dept_data$after), 62 | #' sd(dept_data$before), sd(dept_data$after), 63 | #' length(dept_data$before), .05) 64 | #' 65 | #' #The mean measure of belief on the pretest was 5.57, with a standard 66 | #' #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 67 | #' #but the dependent t-test was not significant using alpha = .05, 68 | #' #t(7) = 1.43, p = .203, d_av = 0.47. The effect size was a medium effect suggesting 69 | #' #that the movie may have influenced belief in the supernatural. 70 | 71 | d.dep.t.avg <- function (m1, m2, sd1, sd2, n, a = .05) { 72 | 73 | if (missing(m1)){ 74 | stop("Be sure to include m1 for the first mean.") 75 | } 76 | 77 | if (missing(m2)){ 78 | stop("Be sure to include m2 for the second mean.") 79 | } 80 | 81 | if (missing(sd1)){ 82 | stop("Be sure to include sd1 for the first mean.") 83 | } 84 | 85 | if (missing(sd2)){ 86 | stop("Be sure to include sd2 for the second mean.") 87 | } 88 | 89 | if (missing(n)){ 90 | stop("Be sure to include the sample size n.") 91 | } 92 | 93 | if (a < 0 || a > 1) { 94 | stop("Alpha should be between 0 and 1.") 95 | } 96 | 97 | d <- (m1 - m2) / ((sd1 + sd2) / 2) 98 | se1 <- sd1 / sqrt(n) 99 | se2 <- sd2 / sqrt(n) 100 | t <- (m1 - m2) / ((se1 + se2) / 2) 101 | ncpboth <- conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 102 | dlow <- ncpboth$Lower.Limit / sqrt(n) 103 | dhigh <- ncpboth$Upper.Limit / sqrt(n) 104 | M1low <- m1 - se1 * qt(a / 2, n - 1, lower.tail = FALSE) 105 | M1high <- m1 + se1 * qt(a / 2, n - 1, lower.tail = FALSE) 106 | M2low <- m2 - se2 * qt(a / 2, n - 1, lower.tail = FALSE) 107 | M2high <- m2 + se2 * qt(a / 2, n - 1, lower.tail = FALSE) 108 | 109 | output = list("d" = d, #d stats 110 | "dlow" = dlow, 111 | "dhigh" = dhigh, 112 | "M1" = m1, #level 1 stats 113 | "sd1" = sd1, 114 | "se1" = se1, 115 | "M1low" = M1low, 116 | "M1high" = M1high, 117 | "M2" = m2, #level 2 stats 118 | "sd2" = sd2, 119 | "se2" = se2, 120 | "M2low" = M2low, 121 | "M2high" = M2high, 122 | "n" = n, #sample stats 123 | "df" = (n - 1), 124 | "estimate" = paste("$d_{av}$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 125 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = "") 126 | ) #no t/p as not appropriate for sig testing 127 | 128 | return(output) 129 | } 130 | 131 | #' @rdname d.dep.t.avg 132 | #' @export 133 | -------------------------------------------------------------------------------- /R/d.dep.t.diff.R: -------------------------------------------------------------------------------- 1 | #' d for Dependent t with SD Difference Scores Denominator 2 | #' 3 | #' This function displays d and the non-central confidence interval 4 | #' for repeated measures data, using the standard deviation 5 | #' of the difference score as the denominator. 6 | #' 7 | #' To calculate d, the mean difference score is divided by 8 | #' divided by the standard deviation of the difference scores. 9 | #' 10 | #' d_z = mdiff / sddiff 11 | #' 12 | #' \href{https://www.aggieerin.com/shiny-server/tests/deptdiffm.html}{Learn more on our example page.} 13 | #' 14 | #' @param mdiff mean difference score 15 | #' @param sddiff standard deviation of the difference scores 16 | #' @param n sample size 17 | #' @param a significance level 18 | #' @return The effect size (Cohen's d) with associated confidence intervals, mean 19 | #' differences with associated confidence intervals, standard 20 | #' deviation of the differences, standard error, sample size, degrees of 21 | #' freedom, the t-statistic, and the p-value. 22 | #' 23 | #' \item{d}{effect size} 24 | #' \item{dlow}{lower level confidence interval d value} 25 | #' \item{dhigh}{upper level confidence interval d value} 26 | #' \item{mdiff}{mean difference score} 27 | #' \item{Mlow}{lower level of confidence interval of the mean} 28 | #' \item{Mhigh}{upper level of confidence interval of the mean} 29 | #' \item{sddiff}{standard deviation of the difference scores} 30 | #' \item{n}{sample size} 31 | #' \item{df}{degrees of freedom (sample size - 1)} 32 | #' \item{t}{t-statistic} 33 | #' \item{p}{p-value} 34 | #' \item{estimate}{the d statistic and confidence interval in 35 | #' APA style for markdown printing} 36 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 37 | #' 38 | #' @keywords effect size, dependent t-test 39 | #' @import MBESS 40 | #' @import stats 41 | #' @export 42 | #' @examples 43 | #' 44 | #' #The following example is derived from the "dept_data" dataset included 45 | #' #in the MOTE library. 46 | #' 47 | #' #In a study to test the effects of science fiction movies on people's 48 | #' #belief in the supernatural, seven people completed a measure of belief 49 | #' #in the supernatural before and after watching a popular science fiction movie. 50 | #' #Higher scores indicated higher levels of belief. The mean difference score was 1.14, 51 | #' #while the standard deviation of the difference scores was 2.12. 52 | #' 53 | #' #You can type in the numbers directly as shown below, 54 | #' #or refer to your dataset within the function. 55 | #' 56 | #' d.dep.t.diff(mdiff = 1.14, sddiff = 2.12, n = 7, a = .05) 57 | #' 58 | #' d.dep.t.diff(1.14, 2.12, 7, .05) 59 | #' 60 | #' d.dep.t.diff(mdiff = mean(dept_data$before - dept_data$after), 61 | #' sddiff = sd(dept_data$before - dept_data$after), 62 | #' n = length(dept_data$before), 63 | #' a = .05) 64 | #' 65 | #' #The mean measure of belief on the pretest was 5.57, with a standard 66 | #' #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 67 | #' #but the dependent t-test was not significant using alpha = .05, 68 | #' #t(7) = 1.43, p = .203, d_z = 0.54. The effect size was a medium 69 | #' #effect suggesting that the movie may have influenced belief 70 | #' #in the supernatural. 71 | #' 72 | 73 | d.dep.t.diff <- function (mdiff, sddiff, n, a = .05) { 74 | 75 | if (missing(mdiff)) { 76 | stop("Be sure to include the mean difference score mdiff.") 77 | } 78 | 79 | if (missing(sddiff)){ 80 | stop("Be sure to include the standard deviation of the difference scores sddiff.") 81 | } 82 | 83 | if (missing(n)){ 84 | stop("Be sure to include the sample size n.") 85 | } 86 | 87 | if (a < 0 || a > 1) { 88 | stop("Alpha should be between 0 and 1.") 89 | } 90 | 91 | d <- mdiff / sddiff 92 | se <- sddiff / sqrt(n) 93 | t <- mdiff / se 94 | ncpboth <- conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 95 | dlow <- ncpboth$Lower.Limit / sqrt(n) 96 | dhigh <- ncpboth$Upper.Limit / sqrt(n) 97 | Mlow <- mdiff - se * qt(a / 2, n - 1, lower.tail = FALSE) 98 | Mhigh <- mdiff + se * qt(a / 2, n - 1, lower.tail = FALSE) 99 | p <- pt(abs(t), n - 1, lower.tail = F) * 2 100 | 101 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 102 | 103 | output = list("d" = d, #d stats 104 | "dlow" = dlow, 105 | "dhigh" = dhigh, 106 | "mdiff" = mdiff, #mean stats 107 | "Mlow" = Mlow, 108 | "Mhigh" = Mhigh, 109 | "sddiff" = sddiff, 110 | "se" = se, 111 | "n" = n, #sample stats 112 | "df" = (n - 1), 113 | "t" = t, #sig stats 114 | "p" = p, 115 | "estimate" = paste("$d_z$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 116 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 117 | "statistic" = paste("$t$(", (n-1), ") = ", apa(t,2,T), ", $p$ ", reportp, sep = "") 118 | ) 119 | 120 | return(output) 121 | } 122 | 123 | #' @rdname d.dep.t.diff 124 | #' @export 125 | -------------------------------------------------------------------------------- /R/d.dep.t.diff.t.R: -------------------------------------------------------------------------------- 1 | #' d from t for Repeated Measures with SD Difference Scores Denominator 2 | #' 3 | #' This function displays d for repeated measures data 4 | #' and the non-central confidence interval using the 5 | #' standard deviation of the differences as the denominator 6 | #' estimating from the t-statistic. 7 | #' 8 | #' To calculate d, the t-statistic is divided by the square root of the sample size. 9 | #' 10 | #' d_z = t / sqrt(n) 11 | #' 12 | #' \href{https://www.aggieerin.com/shiny-server/tests/deptdifft.html}{Learn more on our example page.} 13 | #' 14 | #' @param t t-test value 15 | #' @param n sample size 16 | #' @param a significance level 17 | #' @return 18 | #' \item{d}{effect size} 19 | #' \item{dlow}{lower level confidence interval d value} 20 | #' \item{dhigh}{upper level confidence interval d value} 21 | #' \item{n}{sample size} 22 | #' \item{df}{degrees of freedom (sample size - 1)} 23 | #' \item{p}{p-value} 24 | #' \item{estimate}{the d statistic and confidence interval in APA 25 | #' style for markdown printing} 26 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 27 | #' 28 | #' @keywords effect size, dependent t-test, paired sample, 29 | #' repeated measures, t-test 30 | #' @import MBESS 31 | #' @import stats 32 | #' @export 33 | #' @examples 34 | #' 35 | #' #The following example is derived from the "dept_data" dataset included 36 | #' #in the MOTE library. 37 | #' 38 | #' #In a study to test the effects of science fiction movies on people’s belief 39 | #' #in the supernatural, seven people completed a measure of belief in 40 | #' #the supernatural before and after watching a popular science 41 | #' #fiction movie. Higher scores indicated higher levels of belief. 42 | #' 43 | #' scifi = t.test(dept_data$before, dept_data$after, paired = TRUE) 44 | #' 45 | #' #The t-test value was 1.43. You can type in the numbers directly, 46 | #' #or refer to the dataset, as shown below. 47 | #' 48 | #' d.dep.t.diff.t(t = 1.43, n = 7, a = .05) 49 | #' 50 | #' d.dep.t.diff.t(1.43, 7, .05) 51 | #' 52 | #' d.dep.t.diff.t(scifi$statistic, length(dept_data$before), .05) 53 | #' 54 | #' #The mean measure of belief on the pretest was 5.57, with a standard 55 | #' #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 56 | #' #but the dependent t-test was not significant using alpha = .05, 57 | #' #t(7) = 1.43, p = .203, d_z = 0.54. The effect size was a medium effect suggesting 58 | #' #that the movie may have influenced belief in the supernatural. 59 | 60 | d.dep.t.diff.t <- function (t, n, a = .05) { 61 | 62 | if (missing(t)){ 63 | stop("Be sure to include your t-value from your dependent t-test.") 64 | } 65 | 66 | if (missing(n)){ 67 | stop("Be sure to include your sample size value n.") 68 | } 69 | 70 | if (a < 0 || a > 1) { 71 | stop("Alpha should be between 0 and 1.") 72 | } 73 | 74 | d <- t / sqrt(n) 75 | ncpboth <- conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 76 | dlow <- ncpboth$Lower.Limit / sqrt(n) 77 | dhigh <- ncpboth$Upper.Limit / sqrt(n) 78 | p <- pt(abs(t), n - 1, lower.tail = F) * 2 79 | 80 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 81 | 82 | output = list("d" = d, #d stats 83 | "dlow" = dlow, 84 | "dhigh" = dhigh, 85 | "n" = n, #sample stats 86 | "df" = (n - 1), 87 | "t" = t, #sig stats 88 | "p" = p, 89 | "estimate" = paste("$d_z$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 90 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 91 | "statistic" = paste("$t$(", (n-1), ") = ", apa(t,2,T), ", $p$ ", reportp, sep = "") 92 | ) 93 | 94 | return(output) 95 | } 96 | 97 | #' @rdname d.dep.t.diff.t 98 | #' @export 99 | -------------------------------------------------------------------------------- /R/d.dep.t.rm.R: -------------------------------------------------------------------------------- 1 | #' d for Repeated Measures with Average SD Denominator 2 | #' 3 | #' This function displays d and the non-central confidence interval 4 | #' for repeated measures data, using the average standard deviation of 5 | #' each level as the denominator, but controlling for r. 6 | #' 7 | #' To calculate d, mean two is subtracted from mean one, which is 8 | #' divided by the average standard deviation, while mathematically 9 | #' controlling for the correlation coefficient (r). 10 | #' 11 | #' d_rm = ((m1 - m2) / sqrt(( sd1^2 + sd2^2 ) - (2 x r x sd1 x sd2))) x sqrt(2 x (1-r)) 12 | #' 13 | #' \href{https://www.aggieerin.com/shiny-server/tests/deptrm.html}{Learn more on our example page.} 14 | #' 15 | #' @param m1 mean from first level 16 | #' @param m2 mean from second level 17 | #' @param sd1 standard deviation from first level 18 | #' @param sd2 standard deviation from second level 19 | #' @param r correlation between first and second level 20 | #' @param n sample size 21 | #' @param a significance level 22 | #' @return Controls for correlation and provides the effect size (Cohen's d) 23 | #' with associated confidence intervals,m the confidence intervals associated 24 | #' with the means of each group,mstandard deviations and standard errors of 25 | #' the means for each group. 26 | #' 27 | #' \item{d}{effect size} 28 | #' \item{dlow}{lower level confidence interval d value} 29 | #' \item{dhigh}{upper level confidence interval d value} 30 | #' \item{M1}{mean one} 31 | #' \item{sd1}{standard deviation of mean one} 32 | #' \item{se1}{standard error of mean one} 33 | #' \item{M1low}{lower level confidence interval of mean one} 34 | #' \item{M1high}{upper level confidence interval of mean one} 35 | #' \item{M2}{mean two} 36 | #' \item{sd2}{standard deviation of mean two} 37 | #' \item{se2}{standard error of mean two} 38 | #' \item{M2low}{lower level confidence interval of mean two} 39 | #' \item{M2high}{upper level confidence interval of mean two} 40 | #' \item{r}{correlation} 41 | #' \item{n}{sample size} 42 | #' \item{df}{degrees of freedom (sample size - 1)} 43 | #' \item{estimate}{the d statistic and confidence interval in 44 | #' APA style for markdown printing} 45 | #' 46 | #' @keywords effect size, dependent t-test, cohen's d, paired-sample, 47 | #' repeated measures, correlation 48 | #' @import MBESS 49 | #' @import stats 50 | #' @export 51 | #' @examples 52 | #' 53 | #' #The following example is derived from the "dept_data" dataset included 54 | #' #in the MOTE library. 55 | #' 56 | #' #In a study to test the effects of science fiction movies on people's 57 | #' #belief in the supernatural, seven people completed a measure of belief 58 | #' #in the supernatural before and after watching a popular science fiction 59 | #' #movie. Higher scores indicated higher levels of belief. 60 | #' 61 | #' t.test(dept_data$before, dept_data$after, paired = TRUE) 62 | #' 63 | #' scifi_cor = cor(dept_data$before, dept_data$after, method = "pearson", 64 | #' use = "pairwise.complete.obs") 65 | #' 66 | #' #You can type in the numbers directly, or refer to the dataset, 67 | #' #as shown below. 68 | #' 69 | #' d.dep.t.rm(m1 = 5.57, m2 = 4.43, sd1 = 1.99, 70 | #' sd2 = 2.88, r = .68, n = 7, a = .05) 71 | #' 72 | #' d.dep.t.rm(5.57, 4.43, 1.99, 2.88, .68, 7, .05) 73 | #' 74 | #' d.dep.t.rm(mean(dept_data$before), mean(dept_data$after), 75 | #' sd(dept_data$before), sd(dept_data$after), 76 | #' scifi_cor, length(dept_data$before), .05) 77 | #' 78 | #' #The mean measure of belief on the pretest was 5.57, with a standard 79 | #' #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 80 | #' #but the dependent t-test was not significant using alpha = .05, 81 | #' #t(7) = 1.43, p = .203, d_rm = 0.43. The effect size was a medium effect suggesting 82 | #' #that the movie may have influenced belief in the supernatural. 83 | #' 84 | 85 | d.dep.t.rm <- function (m1, m2, sd1, sd2, r, n, a = .05) { 86 | 87 | if (missing(m1)){ 88 | stop("Be sure to include m1 for the first mean.") 89 | } 90 | 91 | if (missing(m2)){ 92 | stop("Be sure to include m2 for the second mean.") 93 | } 94 | 95 | if (missing(sd1)){ 96 | stop("Be sure to include sd1 for the first mean.") 97 | } 98 | 99 | if (missing(sd2)){ 100 | stop("Be sure to include sd2 for the second mean.") 101 | } 102 | 103 | if (missing(r)){ 104 | stop("Be sure to include the correlation r between the two levels.") 105 | } 106 | 107 | if (missing(n)){ 108 | stop("Be sure to include the sample size n.") 109 | } 110 | 111 | if (a < 0 || a > 1) { 112 | stop("Alpha should be between 0 and 1.") 113 | } 114 | 115 | d <- ((m1 - m2) / sqrt((sd1^2+sd2^2) - (2*r*sd1*sd2))) * sqrt(2*(1-r)) 116 | se1 <- sd1 / sqrt(n) 117 | se2 <- sd2 / sqrt(n) 118 | t <- ((m1 - m2) / (sqrt((sd1^2 + sd2^2)-(2*r*sd1*sd2))/sqrt(n))) * sqrt(2*(1-r)) 119 | ncpboth <- conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 120 | dlow <- ncpboth$Lower.Limit / sqrt(n) 121 | dhigh <- ncpboth$Upper.Limit / sqrt(n) 122 | M1low <- m1 - se1 * qt(a / 2, n - 1, lower.tail = FALSE) 123 | M1high <- m1 + se1 * qt(a / 2, n - 1, lower.tail = FALSE) 124 | M2low <- m2 - se2 * qt(a / 2, n - 1, lower.tail = FALSE) 125 | M2high <- m2 + se2 * qt(a / 2, n - 1, lower.tail = FALSE) 126 | 127 | output = list("d" = d, #d stats 128 | "dlow" = dlow, 129 | "dhigh" = dhigh, 130 | "M1" = m1, #level 1 stats 131 | "sd1" = sd1, 132 | "se1" = se1, 133 | "M1low" = M1low, 134 | "M1high" = M1high, 135 | "M2" = m2, #level 2 stats 136 | "sd2" = sd2, 137 | "se2" = se2, 138 | "M2low" = M2low, 139 | "M2high" = M2high, 140 | "r" = r, 141 | "n" = n, #sample stats 142 | "df" = (n - 1), 143 | "estimate" = paste("$d_{rm}$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 144 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = "") 145 | ) #no t/p as not appropriate for sig testing 146 | 147 | return(output) 148 | } 149 | 150 | #' @rdname d.dep.t.rm 151 | #' @export 152 | -------------------------------------------------------------------------------- /R/d.ind.t.t.R: -------------------------------------------------------------------------------- 1 | #' d from t for Between Subjects 2 | #' 3 | #' This function displays d for between subjects data 4 | #' and the non-central confidence interval estimating from the t-statistic. 5 | #' 6 | #' To calculate d, the t-statistic is multiplied by two then divided by 7 | #' the square root of the degrees of freedom. 8 | #' 9 | #' d_s = 2 * t / sqrt(n1 + n2 - 2) 10 | #' 11 | #' \href{https://www.aggieerin.com/shiny-server/tests/indtt.html}{Learn more on our example page.} 12 | #' 13 | #' @param t t-test value 14 | #' @param n1 sample size group one 15 | #' @param n2 sample size group two 16 | #' @param a significance level 17 | #' @return Provides the effect size (Cohen's d) with associated confidence intervals, 18 | #' degrees of freedom, t-statistic, and p-value. 19 | #' 20 | #' \item{d}{effect size} 21 | #' \item{dlow}{lower level confidence interval of d value} 22 | #' \item{dhigh}{upper level confidence interval of d value} 23 | #' \item{n1}{sample size} 24 | #' \item{n2}{sample size} 25 | #' \item{df}{degrees of freedom (n1 - 1 + n2 - 1)} 26 | #' \item{t}{t-statistic} 27 | #' \item{p}{p-value} 28 | #' \item{estimate}{the d statistic and confidence interval in APA style for markdown printing} 29 | #' \item{statistic}{the t-statistic in APA for the t-test} 30 | #' 31 | #' @keywords effect size, independent t 32 | #' @import MBESS 33 | #' @import stats 34 | #' @export 35 | #' @examples 36 | #' 37 | #' #The following example is derived from the "indt_data" dataset, included 38 | #' #in the MOTE library. 39 | #' 40 | #' #A forensic psychologist conducted a study to examine whether 41 | #' #being hypnotized during recall affects how well a witness 42 | #' #can remember facts about an event. Eight participants 43 | #' #watched a short film of a mock robbery, after which 44 | #' #each participant was questioned about what he or she had 45 | #' #seen. The four participants in the experimental group 46 | #' #were questioned while they were hypnotized. The four 47 | #' #participants in the control group recieved the same 48 | #' #questioning without hypnosis. 49 | #' 50 | #' hyp = t.test(correctq ~ group, data = indt_data) 51 | #' 52 | #' #You can type in the numbers directly, or refer to the dataset, 53 | #' #as shown below. 54 | #' 55 | #' d.ind.t.t(t = -2.6599, n1 = 4, n2 = 4, a = .05) 56 | #' 57 | #' d.ind.t.t(-2.6599, 4, 4, .05) 58 | #' 59 | #' d.ind.t.t(hyp$statistic, 60 | #' length(indt_data$group[indt_data$group == 1]), 61 | #' length(indt_data$group[indt_data$group == 2]), 62 | #' .05) 63 | #' 64 | #' #Contrary to the hypothesized result, the group that underwent hypnosis were 65 | #' #significantly less accurate while reporting facts than the control group 66 | #' #with a large effect size, t(6) = -2.66, p = .038, d_s = 2.17. 67 | #' 68 | 69 | d.ind.t.t <- function (t, n1, n2, a = .05) { 70 | 71 | if (missing(t)){ 72 | stop("Be sure to include the t-value found from your t-test.") 73 | } 74 | 75 | if (missing(n1)){ 76 | stop("Be sure to include the sample size n1 for group 1.") 77 | } 78 | 79 | if (missing(n2)){ 80 | stop("Be sure to include the sample size n2 for group 2.") 81 | } 82 | 83 | if (a < 0 || a > 1) { 84 | stop("Alpha should be between 0 and 1.") 85 | } 86 | 87 | 88 | d <- 2 * t / sqrt(n1 + n2 - 2) 89 | ncpboth <- conf.limits.nct(t, (n1 - 1 + n2 - 1), conf.level = (1 - a), sup.int.warns = TRUE) 90 | dlow <- ncpboth$Lower.Limit / sqrt(((n1 * n2) / (n1 + n2))) 91 | dhigh <- ncpboth$Upper.Limit / sqrt(((n1 * n2) / (n1 + n2))) 92 | p <- pt(abs(t), (n1 - 1 + n2 - 1), lower.tail = F) * 2 93 | 94 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 95 | 96 | output = list("d" = d, #d stats 97 | "dlow" = dlow, 98 | "dhigh" = dhigh, 99 | "n1" = n1, #sample stats 100 | "n2" = n2, 101 | "df" = (n1 - 1 + n2 - 1), 102 | "t" = t, #sig stats, 103 | "p" = p, 104 | "estimate" = paste("$d_s$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 105 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 106 | "statistic" = paste("$t$(", (n1-1+n2-1), ") = ", 107 | apa(t,2,T), ", $p$ ", reportp, sep = "") 108 | ) 109 | 110 | return(output) 111 | } 112 | 113 | #' @rdname d.ind.t.t 114 | #' @export 115 | 116 | -------------------------------------------------------------------------------- /R/d.prop.R: -------------------------------------------------------------------------------- 1 | #' d for Independent Proportions 2 | #' 3 | #' This function displays d and central confidence interval 4 | #' calculated from differences in independent proportions. 5 | #' Independent proportions are two percentages that are from 6 | #' different groups of participants. 7 | #' 8 | #' To calculate z, the proportion of group two is substracted 9 | #' from group one, which is then divided by the standard error. 10 | #' 11 | #' z = (p1 - p2) / se 12 | #' 13 | #' To calculate d, the proportion of group two is divided by 14 | #' the standard error of group two which is then subtracted 15 | #' from the proportion of group one divided by the standard 16 | #' error of group one. 17 | #' 18 | #' z1 = p1 / se1 19 | #' 20 | #' z2 = p2 / se2 21 | #' 22 | #' d = z1 - z2 23 | #' 24 | #' \href{https://www.aggieerin.com/shiny-server/tests/indtprop.html}{Learn more on our example page.} 25 | #' 26 | #' @param p1 proportion for group one 27 | #' @param p2 proportion for group two 28 | #' @param n1 sample size group one 29 | #' @param n2 sample size group two 30 | #' @param a significance level 31 | #' @return 32 | #' 33 | #' \item{d}{effect size} 34 | #' \item{dlow}{lower level confidence interval d value} 35 | #' \item{dhigh}{upper level confidence interval d value} 36 | #' \item{p1}{proportion of group one} 37 | #' \item{se1}{standard error of the proportion of group one} 38 | #' \item{z1}{z-statistic group one} 39 | #' \item{z1low}{lower level confidence interval of z} 40 | #' \item{z1high}{upper level confidence interval of z} 41 | #' \item{p2}{proportion of group two} 42 | #' \item{se2}{standard error of the proportion of group two} 43 | #' \item{z2}{z-statistic of group two} 44 | #' \item{z2low}{lower level confidence interval of z} 45 | #' \item{z2high}{upper level confidence interval of z} 46 | #' \item{n1}{sample size group one} 47 | #' \item{n2}{sample size group two} 48 | #' \item{z}{z-statistic for the differences} 49 | #' \item{ppooled}{pooled proportion to calculate standard error} 50 | #' \item{se}{standard error} 51 | #' \item{p}{p-value for the differences} 52 | #' \item{estimate}{the d statistic and confidence interval in 53 | #' APA style for markdown printing} 54 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 55 | #' 56 | #' @keywords effect size, prop test, proportions, independent proportions 57 | #' @import MBESS 58 | #' @import stats 59 | #' @export 60 | #' @examples 61 | #' 62 | #' #Several researchers were examining the data on the number 63 | #' #of students who retake a course after they receive a D, F, 64 | #' #or withdraw from the course. They randomly sampled form 65 | #' #a large university two groups of students: traditional 66 | #' #(less than 25 years old) and non-traditional (25 and older). 67 | #' #Each group included 100 participants. About 25% of students 68 | #' #of the traditional group reported they would retake a course, 69 | #' #while the non-traditional group showed about 35% would 70 | #' #retake the course. 71 | #' 72 | #' #You can type in the numbers directly as shown below, 73 | #' #or refer to your dataset within the function. 74 | #' 75 | #' d.prop(p1 = .25, p2 = .35, n1 = 100, n2 = 100, a = .05) 76 | #' 77 | #' d.prop(.25, .35, 100, 100, .05) 78 | 79 | 80 | d.prop <- function (p1, p2, n1, n2, a = .05) { 81 | 82 | if (missing(p1)){ 83 | stop("Be sure to include p1 for the first proportion.") 84 | } 85 | 86 | if (p1 > 1 | p2 > 1 | p1 < 0 | p2 < 0){ 87 | stop("Be sure to enter your values as proportions, 88 | rather than percentages, values should be less than 1. 89 | Also make sure all proportion values are positive.") 90 | } 91 | 92 | if (missing(p2)){ 93 | stop("Be sure to include p2 for the second proportion.") 94 | } 95 | 96 | if (missing(n1)){ 97 | stop("Be sure to include the sample size n1 for the first group.") 98 | } 99 | 100 | if (missing(n2)){ 101 | stop("Be sure to include the sample size n2 for the second group.") 102 | } 103 | 104 | if (a < 0 || a > 1) { 105 | stop("Alpha should be between 0 and 1.") 106 | } 107 | 108 | ppooled <- (p1 * n1 + p2 * n2) / (n1 + n2) 109 | se <- sqrt(ppooled * (1 - ppooled) * ((1 / n1) + (1 / n2))) 110 | z <- (p1 - p2)/ se 111 | p <- pnorm(abs(z), lower.tail = F) * 2 112 | se1 <- sqrt((p1 * (1 - p1) / n1)) 113 | se2 <- sqrt((p2 * (1 - p2) / n2)) 114 | z1 <- p1 / se1 115 | z2 <- p2 / se2 116 | z1low <- z1 - qnorm(a / 2, lower.tail = F) * se1 117 | z1high <- z1 + qnorm(a / 2, lower.tail = F) * se1 118 | z2low <- z2 - qnorm(a / 2, lower.tail = F) * se2 119 | z2high <- z2 + qnorm(a / 2, lower.tail = F) * se2 120 | d <- z1 - z2 121 | dlow <- d - qnorm(a / 2, lower.tail = F) * se 122 | dhigh <- d + qnorm(a / 2, lower.tail = F) * se 123 | 124 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 125 | 126 | output = list("d" = d, #d stats 127 | "dlow" = dlow, 128 | "dhigh" = dhigh, 129 | "p1" = p1, #group 1 stats 130 | "se1" = se1, 131 | "z1" = z1, 132 | "z1low" = z1low, 133 | "z1high" = z1high, 134 | "p2" = p2, #group 2 stats 135 | "se2" = se2, 136 | "z2" = z2, 137 | "z2low" = z2low, 138 | "z2high" = z2high, 139 | "n1" = n1, #sample stats 140 | "n2" = n2, 141 | "z" = z, #sig stats, 142 | "ppooled" = ppooled, 143 | "se" = se, 144 | "p" = p, 145 | "estimate" = paste("$d_prop$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 146 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 147 | "statistic" = paste("$Z$", " = ", apa(z,2,T), ", $p$ ", 148 | reportp, sep = "") 149 | ) 150 | 151 | return(output) 152 | } 153 | 154 | #' @rdname d.prop 155 | #' @export 156 | -------------------------------------------------------------------------------- /R/d.single.t.R: -------------------------------------------------------------------------------- 1 | #' d for Single t from Means 2 | #' 3 | #' This function displays d and non-central confidence interval for single t from means. 4 | #' 5 | #' To calculate d, the population is subtracted from the sample mean, 6 | #' which is then divided by the standard deviation. 7 | #' 8 | #' d = (m - u) / sd 9 | #' 10 | #' \href{https://www.aggieerin.com/shiny-server/tests/singletm.html}{Learn more on our example page.} 11 | #' 12 | #' @param m sample mean 13 | #' @param u population mean 14 | #' @param sd sample standard deviation 15 | #' @param n sample size 16 | #' @param a significance level 17 | #' @return 18 | #' 19 | #' \item{d}{effect size} 20 | #' \item{dlow}{lower level confidence interval d value} 21 | #' \item{dhigh}{upper level confidence interval d value} 22 | #' \item{m}{sample mean} 23 | #' \item{sd}{standard deviation of the sample} 24 | #' \item{se}{standard error of the sample} 25 | #' \item{Mlow}{lower level confidence interval of the sample mean} 26 | #' \item{Mhigh}{upper level confidence interval of the sample mean} 27 | #' \item{u}{population mean} 28 | #' \item{n}{sample size} 29 | #' \item{df}{degrees of freedom (n - 1)} 30 | #' \item{t}{t-statistic} 31 | #' \item{p}{p-value} 32 | #' \item{estimate}{the d statistic and confidence interval in 33 | #' APA style for markdown printing} 34 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 35 | #' 36 | #' @keywords effect size, single t, single-sample, mu, u, population mean, sample mean 37 | #' @import MBESS 38 | #' @import stats 39 | #' @export 40 | #' @examples 41 | #' 42 | #' #The following example is derived from the "singt_data" dataset included 43 | #' #in the MOTE library. 44 | #' 45 | #' #A school has a gifted/honors program that they claim is 46 | #' #significantly better than others in the country. The gifted/honors 47 | #' #students in this school scored an average of 1370 on the SAT, 48 | #' #with a standard deviation of 112.7, while the national average 49 | #' #for gifted programs is a SAT score of 1080. 50 | #' 51 | #' gift = t.test(singt_data, mu = 1080, alternative = "two.sided") 52 | #' 53 | #' #You can type in the numbers directly as shown below, 54 | #' #or refer to your dataset within the function. 55 | #' 56 | #' d.single.t(m = 1370, u = 1080, sd = 112.7, n = 14, a = .05) 57 | #' 58 | #' d.single.t(1370, 1080, 112.7, 100, .05) 59 | #' 60 | #' d.single.t(gift$estimate, gift$null.value, 61 | #' sd(singt_data$SATscore), 62 | #' length(singt_data$SATscore), .05) 63 | 64 | d.single.t = function (m, u, sd, n, a = .05) { 65 | 66 | if (missing(m)){ 67 | stop("Be sure to include m for the sample mean.") 68 | } 69 | 70 | if (missing(u)){ 71 | stop("Be sure to include me for the population.") 72 | } 73 | 74 | if (missing(sd)){ 75 | stop("Be sure to include sd for the sample mean.") 76 | } 77 | 78 | if (missing(n)){ 79 | stop("Be sure to include the sample size n for the sample.") 80 | } 81 | 82 | if (a < 0 || a > 1) { 83 | stop("Alpha should be between 0 and 1.") 84 | } 85 | 86 | se <- sd / sqrt(n) 87 | d <- (m - u) / sd 88 | t <- (m - u) / se 89 | ncpboth = conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 90 | dlow = ncpboth$Lower.Limit / sqrt(n) 91 | dhigh = ncpboth$Upper.Limit / sqrt(n) 92 | Mlow = m - se*qt(a / 2, n - 1, lower.tail = FALSE) 93 | Mhigh = m + se*qt(a / 2, n - 1, lower.tail = FALSE) 94 | p = pt(abs(t), n - 1, lower.tail = F)*2 95 | 96 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 97 | 98 | output = list("d" = d, #d stats 99 | "dlow" = dlow, 100 | "dhigh" = dhigh, 101 | "m" = m, #mean stats 102 | "sd" = sd, 103 | "se" = se, 104 | "Mlow" = Mlow, 105 | "Mhigh" = Mhigh, 106 | "u" = u, 107 | "n" = n, #sample stats 108 | "df" = (n - 1), 109 | "t" = t, #sig stats, 110 | "p" = p, 111 | "estimate" = paste("$d$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 112 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 113 | "statistic" = paste("$t$(", (n-1), ") = ", apa(t,2,T), ", $p$ ", 114 | reportp, sep = "") 115 | ) 116 | 117 | return(output) 118 | } 119 | 120 | #' @rdname d.single.t 121 | #' @export 122 | -------------------------------------------------------------------------------- /R/d.single.t.t.R: -------------------------------------------------------------------------------- 1 | #' d for Single t from t 2 | #' 3 | #' This function displays d and non-central confidence interval for single t 4 | #' estimated from the t-statistic. 5 | #' 6 | #' To calculate d, the t-statistic is divided by the square root of the sample size. 7 | #' 8 | #' d = t / sqrt(n) 9 | #' 10 | #' \href{https://www.aggieerin.com/shiny-server/tests/singlett.html}{Learn more on our example page.} 11 | #' 12 | #' 13 | #' @param t t-test value 14 | #' @param n sample size 15 | #' @param a significance level 16 | #' @return The effect size (Cohen's d) with associated confidence intervals 17 | #' and relevant statistics. 18 | #' 19 | #' \item{d}{effect size} 20 | #' \item{dlow}{lower level confidence interval d value} 21 | #' \item{dhigh}{upper level confidence interval d value} 22 | #' \item{n}{sample size} 23 | #' \item{df}{degrees of freedom (sample size - 1)} 24 | #' \item{t}{sig stats} 25 | #' \item{p}{p-value} 26 | #' \item{estimate}{the d statistic and confidence interval in 27 | #' APA style for markdown printing} 28 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 29 | #' 30 | #' @keywords effect size, single t 31 | #' @import MBESS 32 | #' @import stats 33 | #' @export 34 | #' @examples 35 | #' 36 | #' #A school has a gifted/honors program that they claim is 37 | #' #significantly better than others in the country. The gifted/honors 38 | #' #students in this school scored an average of 1370 on the SAT, 39 | #' #with a standard deviation of 112.7, while the national average 40 | #' #for gifted programs is a SAT score of 1080. 41 | #' 42 | #' gift = t.test(singt_data, mu = 1080, alternative = "two.sided") 43 | #' 44 | #' #According to a single-sample t-test, the scores of the students 45 | #' #from the program were significantly higher than the national 46 | #' #average, t(14) = 9.97, p < .001. 47 | #' 48 | #' #You can type in the numbers directly as shown below, or refer 49 | #' #to your dataset within the function. 50 | #' 51 | #' d.single.t.t(t = 9.968, n = 15, a = .05) 52 | #' 53 | #' d.single.t.t(9.968, 15, .05) 54 | #' 55 | #' d.single.t.t(gift$statistic, length(singt_data$SATscore), .05) 56 | 57 | 58 | d.single.t.t <- function (t, n, a = .05) { 59 | 60 | if (missing(t)){ 61 | stop("Be sure to include t from the t-test statistic.") 62 | } 63 | 64 | if (missing(n)){ 65 | stop("Be sure to include the sample size n for the sample.") 66 | } 67 | 68 | if (a < 0 || a > 1) { 69 | stop("Alpha should be between 0 and 1.") 70 | } 71 | 72 | d <- t / sqrt(n) 73 | ncpboth <- conf.limits.nct(t, (n - 1), conf.level = (1 - a), sup.int.warns = TRUE) 74 | dlow <- ncpboth$Lower.Limit / sqrt(n) 75 | dhigh <- ncpboth$Upper.Limit / sqrt(n) 76 | p <- pt(abs(t), n - 1, lower.tail = F) * 2 77 | 78 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 79 | 80 | output = list("d" = d, #d stats 81 | "dlow" = dlow, 82 | "dhigh" = dhigh, 83 | "n" = n, #sample stats 84 | "df" = (n - 1), 85 | "t" = t, #sig stats 86 | "p" = p, 87 | "estimate" = paste("$d$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 88 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 89 | "statistic" = paste("$t$(", (n - 1), ") = ", apa(t,2,T), ", $p$ ", 90 | reportp, sep = "") 91 | ) 92 | 93 | return(output) 94 | 95 | } 96 | 97 | #' @rdname d.single.t.t 98 | #' @export 99 | -------------------------------------------------------------------------------- /R/d.to.r.R: -------------------------------------------------------------------------------- 1 | #' r and Coefficient of Determination (R2) from d 2 | #' 3 | #' Calculates r from d and then translates r to r2 to calculate 4 | #' the non-central confidence interval for r2 using the F distribution. 5 | #' 6 | #' The correlation coefficient (r) is calculated by dividing Cohen's d 7 | #' by the square root of the total sample size squared - divided 8 | #' by the product of the sample sizes of group one and group two. 9 | #' 10 | #' r = d / sqrt(d^2 + (n1 + n2)^2 / (n1*n2)) 11 | #' 12 | #' \href{https://www.aggieerin.com/shiny-server/tests/dtor.html}{Learn more on our example page.} 13 | #' 14 | #' @param d effect size statistic 15 | #' @param n1 sample size group one 16 | #' @param n2 sample size group two 17 | #' @param a significance level 18 | #' @return Provides the effect size (correlation coefficient) with associated 19 | #' confidence intervals, the t-statistic, F-statistic, and other estimates 20 | #' appropriate for d to r translation. Note this CI is not based on the 21 | #' traditional r-to-z transformation but rather non-central F using the 22 | #' ci.R function from MBESS. 23 | #' 24 | #' \item{r}{correlation coefficient} 25 | #' \item{rlow}{lower level confidence interval r} 26 | #' \item{rhigh}{upper level confidence interval r} 27 | #' \item{R2}{coefficient of determination} 28 | #' \item{R2low}{lower level confidence interval of R2} 29 | #' \item{R2high}{upper level confidence interval of R2} 30 | #' \item{se}{standard error} 31 | #' \item{n}{sample size} 32 | #' \item{dfm}{degrees of freedom of mean} 33 | #' \item{dfe}{degrees of freedom error} 34 | #' \item{t}{t-statistic} 35 | #' \item{F}{F-statistic} 36 | #' \item{p}{p-value} 37 | #' \item{estimate}{the r statistic and confidence interval in 38 | #' APA style for markdown printing} 39 | #' \item{estimateR2}{the R^2 statistic and confidence interval in 40 | #' APA style for markdown printing} 41 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 42 | #' 43 | #' @keywords effect size, correlation 44 | #' @import MBESS 45 | #' @import stats 46 | #' @export 47 | #' @examples 48 | #' 49 | #' #The following example is derived from the "indt_data" dataset, included 50 | #' #in the MOTE library. 51 | #' 52 | #' #A forensic psychologist conducted a study to examine whether 53 | #' #being hypnotized during recall affects how well a witness 54 | #' #can remember facts about an event. Eight participants 55 | #' #watched a short film of a mock robbery, after which 56 | #' #each participant was questioned about what he or she had 57 | #' #seen. The four participants in the experimental group 58 | #' #were questioned while they were hypnotized. The four 59 | #' #participants in the control group recieved the same 60 | #' #questioning without hypnosis. 61 | #' 62 | #' t.test(correctq ~ group, data = indt_data) 63 | #' 64 | #' #You can type in the numbers directly, or refer to the dataset, 65 | #' #as shown below. 66 | #' 67 | #' d.ind.t(m1 = 17.75, m2 = 23, sd1 = 3.30, 68 | #' sd2 = 2.16, n1 = 4, n2 = 4, a = .05) 69 | #' 70 | #' d.ind.t(17.75, 23, 3.30, 2.16, 4, 4, .05) 71 | #' 72 | #' d.ind.t(mean(indt_data$correctq[indt_data$group == 1]), 73 | #' mean(indt_data$correctq[indt_data$group == 2]), 74 | #' sd(indt_data$correctq[indt_data$group == 1]), 75 | #' sd(indt_data$correctq[indt_data$group == 2]), 76 | #' length(indt_data$correctq[indt_data$group == 1]), 77 | #' length(indt_data$correctq[indt_data$group == 2]), 78 | #' .05) 79 | #' 80 | #' #Contrary to the hypothesized result, the group that underwent 81 | #' #hypnosis were significantly less accurate while reporting 82 | #' #facts than the control group with a large effect size, t(6) = -2.66, 83 | #' #p = .038, d_s = 1.88. 84 | #' 85 | #' d.to.r(d = -1.88, n1 = 4, n2 = 4, a = .05) 86 | 87 | 88 | d.to.r <- function (d, n1, n2, a = .05) { 89 | 90 | if (missing(d)){ 91 | stop("Be sure to include d effect size.") 92 | } 93 | 94 | if (missing(n1)){ 95 | stop("Be sure to include the sample size n1 for the first group.") 96 | } 97 | 98 | if (missing(n2)){ 99 | stop("Be sure to include the sample size n2 for the second group.") 100 | } 101 | 102 | if (a < 0 || a > 1) { 103 | stop("Alpha should be between 0 and 1.") 104 | } 105 | 106 | correct = (n1 + n2)^2 / (n1*n2) 107 | n = n1 + n2 108 | r <- d / sqrt(d^2 + correct) 109 | rsq <- (r) ^ 2 110 | se <- sqrt(4 * rsq * ((1 - rsq) ^ 2) * ((n - 3) ^ 2) / ((n ^ 2 - 1) * (3 + n))) 111 | t <- r / sqrt((1 - rsq) / (n - 2)) 112 | Fvalue <- t ^ 2 113 | dfm <- 1 114 | dfe <- n - 2 115 | 116 | limits <- ci.R2(R2 = rsq, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 117 | ciforr <- ci.R(R = abs(r), df.1 = dfm, df.2 = dfe, conf.level = (1 - a)) 118 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 119 | 120 | #deal with negative r / d values 121 | if (r < 0) { 122 | rlow = 0 - ciforr$Lower.Conf.Limit.R 123 | rhigh = 0 - ciforr$Upper.Conf.Limit.R 124 | } else { 125 | rlow = ciforr$Lower.Conf.Limit.R 126 | rhigh = ciforr$Upper.Conf.Limit.R 127 | } 128 | 129 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 130 | 131 | output = list("r" = r, #r stats 132 | "rlow" = rlow, 133 | "rhigh" = rhigh, 134 | "R2" = rsq, #R squared stats 135 | "R2low" = limits$Lower.Conf.Limit.R2, 136 | "R2high" = limits$Upper.Conf.Limit.R2, 137 | "se" = se, 138 | "n" = n, #sample stats 139 | "dfm" = 1, #sig stats 140 | "dfe" = (n - 2), 141 | "t" = t, 142 | "F" = Fvalue, 143 | "p" = p, 144 | "estimate" = paste("$r$ = ", apa(r,2,F), ", ", (1-a)*100, "\\% CI [", 145 | apa(rlow,2,F), ", ", apa(rhigh,2,F), "]", sep = ""), 146 | "estimateR2" = paste("$R^2$ = ", apa(rsq,2,F), ", ", (1-a)*100, "\\% CI [", 147 | apa(limits$Lower.Conf.Limit.R2,2,F), ", ", 148 | apa(limits$Upper.Conf.Limit.R2,2,F), "]", sep = ""), 149 | "statistic" = paste("$t$(", (n-2), ") = ", apa(t,2,T), ", $p$ ", 150 | reportp, sep = "") 151 | ) 152 | 153 | return(output) 154 | } 155 | 156 | #' @rdname d.to.r 157 | #' @export 158 | -------------------------------------------------------------------------------- /R/d.z.mean.R: -------------------------------------------------------------------------------- 1 | #' d for Z-test from Population Mean and SD 2 | #' 3 | #' This function displays d for Z-test with the 4 | #' population mean and standard deviation. 5 | #' The normal confidence interval is also provided. 6 | #' 7 | #' d is calculated by deducting the population mean from the sample study mean 8 | #' and dividing by the alpha level. 9 | #' 10 | #' d = (m1 - mu) / sig 11 | #' 12 | #' \href{https://www.aggieerin.com/shiny-server/tests/zm.html}{Learn more on our example page.} 13 | #' 14 | #' @param mu population mean 15 | #' @param m1 sample study mean 16 | #' @param sig population standard deviation 17 | #' @param sd1 standard deviation from the study 18 | #' @param n sample size 19 | #' @param a significance level 20 | #' @return The effect size (Cohen's d) with associated confidence intervals 21 | #' and relevant statistics. 22 | #' 23 | #' \item{d}{effect size} 24 | #' \item{dlow}{lower level confidence interval d value} 25 | #' \item{dhigh}{upper level confidence interval d value} 26 | #' \item{M1}{mean of sample} 27 | #' \item{sd1}{standard deviation of sample} 28 | #' \item{se1}{standard error of sample} 29 | #' \item{M1low}{lower level confidence interval of the mean} 30 | #' \item{M1high}{upper level confidence interval of the mean} 31 | #' \item{Mu}{population mean} 32 | #' \item{Sigma}{standard deviation of population} 33 | #' \item{se2}{standard error of population} 34 | #' \item{z}{z-statistic} 35 | #' \item{p}{p-value} 36 | #' \item{n}{sample size} 37 | #' \item{estimate}{the d statistic and confidence interval in 38 | #' APA style for markdown printing} 39 | #' \item{statistic}{the Z-statistic in APA style for markdown printing} 40 | #' 41 | #' @keywords effect size, z-test 42 | #' @import MBESS 43 | #' @import stats 44 | #' @export 45 | #' @examples 46 | #' 47 | #' #The average quiz test taking time for a 10 item test is 22.5 48 | #' #minutes, with a standard deviation of 10 minutes. My class of 49 | #' #25 students took 19 minutes on the test with a standard deviation of 5. 50 | #' 51 | #' d.z.mean(mu = 22.5, m1 = 19, sig = 10, sd1 = 5, n = 25, a = .05) 52 | 53 | 54 | d.z.mean <- function (mu, m1, sig, sd1, n, a = .05) { 55 | 56 | if (missing(m1)){ 57 | stop("Be sure to include m1 for the sample mean.") 58 | } 59 | 60 | if (missing(mu)){ 61 | stop("Be sure to include mu for the population mean.") 62 | } 63 | 64 | if (missing(sig)){ 65 | stop("Be sure to include sig for the population standard deviation.") 66 | } 67 | 68 | if (missing(sd1)){ 69 | stop("Be sure to include sd1 for the sample standard deviation") 70 | } 71 | 72 | if (missing(n)){ 73 | stop("Be sure to include the sample size n for the sample.") 74 | } 75 | 76 | if (a < 0 || a > 1) { 77 | stop("Alpha should be between 0 and 1.") 78 | } 79 | 80 | d <- (m1 - mu) / sig 81 | se1 <- sig / sqrt(n) 82 | se2 <- sd1 / sqrt(n) 83 | dlow <- d-qnorm(a/2, lower.tail = F)*sig 84 | dhigh <- d+qnorm(a/2, lower.tail = F)*sig 85 | z <- (m1 - mu) / se1 86 | p <- pnorm(abs(z), lower.tail = FALSE)*2 87 | M1low <- m1 - se2 * qnorm(a/2, lower.tail = FALSE) 88 | M1high <- m1 + se2 * qnorm(a/2, lower.tail = FALSE) 89 | 90 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 91 | 92 | output = list("d" = d, #d stats 93 | "dlow" = dlow, 94 | "dhigh" = dhigh, 95 | "M1" = m1, #level 1 stats 96 | "sd1" = sd1, 97 | "se1" = se2, 98 | "M1low" = M1low, 99 | "M1high" = M1high, 100 | "Mu" = mu,#population stats 101 | "Sigma" = sig, 102 | "se2" = se1, 103 | "z" = z, 104 | "p" = p, 105 | "n" = n, #sample stats 106 | "estimate" = paste("$d$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 107 | apa(dlow,2,T), ", ", apa(dhigh,2,T), "]", sep = ""), 108 | "statistic" = paste("$Z$", " = ", apa(z,2,T), ", $p$ ", 109 | reportp, sep = "") 110 | ) 111 | 112 | return(output) 113 | } 114 | 115 | #' @rdname d.z.mean 116 | #' @export 117 | -------------------------------------------------------------------------------- /R/d.z.z.R: -------------------------------------------------------------------------------- 1 | #' d from z-statistic for Z-test 2 | #' 3 | #' This function displays d for Z-tests when all you have is the z-statistic. 4 | #' The normal confidence interval is also provided if you have sigma. 5 | #' If sigma is left blank, then you will not see a confidence interval. 6 | #' 7 | #' To calculate d, z is divided by the square root of N. 8 | #' 9 | #' d = z / sqrt(N) 10 | #' 11 | #' \href{https://www.aggieerin.com/shiny-server/tests/zz.html}{Learn more on our example page.} 12 | #' 13 | #' @param z z statistic 14 | #' @param sig population standard deviation 15 | #' @param n sample size 16 | #' @param a significance level 17 | #' @return The effect size (Cohen's d) with associated confidence intervals and 18 | #' relevant statistics. 19 | #' 20 | #' \item{d}{effect size} 21 | #' \item{dlow}{lower level confidence interval d value} 22 | #' \item{dhigh}{upper level confidence interval d value} 23 | #' \item{sigma}{sample size} 24 | #' \item{z}{sig stats} 25 | #' \item{p}{p-value} 26 | #' \item{n}{sample size} 27 | #' \item{estimate}{the d statistic and confidence interval in 28 | #' APA style for markdown printing} 29 | #' \item{statistic}{the Z-statistic in APA style for markdown printing} 30 | #' 31 | #' @keywords effect size, z-test 32 | #' @import MBESS 33 | #' @import stats 34 | #' @export 35 | #' @examples 36 | #' 37 | #' #A recent study suggested that students (N = 100) learning 38 | #' #statistics improved their test scores with the use of 39 | #' #visual aids (Z = 2.5). The population standard deviation is 4. 40 | #' 41 | #' #You can type in the numbers directly as shown below, 42 | #' #or refer to your dataset within the function. 43 | #' 44 | #' d.z.z(z = 2.5, sig = 4, n = 100, a = .05) 45 | #' 46 | #' d.z.z(z = 2.5, n = 100, a = .05) 47 | #' 48 | #' d.z.z(2.5, 4, 100, .05) 49 | 50 | 51 | d.z.z <- function (z, sig = NA, n, a = .05) { 52 | 53 | if (missing(z)){ 54 | stop("Be sure to include z from the z-statistic.") 55 | } 56 | 57 | if (missing(n)){ 58 | stop("Be sure to include the sample size n for the sample.") 59 | } 60 | 61 | if (a < 0 || a > 1) { 62 | stop("Alpha should be between 0 and 1.") 63 | } 64 | 65 | d <- z / sqrt(n) 66 | if (is.na(sig)){ 67 | dlow <- NA 68 | dhigh <- NA 69 | } else { 70 | dlow <- d-qnorm(a/2, lower.tail = F)*sig 71 | dhigh <- d+qnorm(a/2, lower.tail = F)*sig 72 | } 73 | p <- pnorm(z, lower.tail = FALSE)*2 74 | 75 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 76 | 77 | output = list("d" = d, #d stats 78 | "dlow" = dlow, 79 | "dhigh" = dhigh, 80 | "sigma" = sig, #population stats 81 | "z" = z, #sig stats 82 | "p" = p, 83 | "n" = n, #sample stats 84 | "estimate" = paste("$d$ = ", apa(d,2,T), ", ", (1-a)*100, "\\% CI [", 85 | apa((d-qnorm(a/2, lower.tail = F)*sig),2,T), ", ", apa((d+qnorm(a/2, lower.tail = F))*sig,2,T), "]", sep = ""), 86 | "statistic" = paste("$Z$", " = ", apa(z,2,T), ", $p$ ", 87 | reportp, sep = "") 88 | ) 89 | 90 | return(output) 91 | } 92 | 93 | #' @rdname d.z.z 94 | #' @export 95 | -------------------------------------------------------------------------------- /R/dept-data.R: -------------------------------------------------------------------------------- 1 | #' Dependent t Example Data 2 | #' 3 | #' Dataset for use in \code{\link{d.dep.t.diff}}, \code{\link{d.dep.t.diff.t}}, 4 | #' \code{\link{d.dep.t.avg}}, and \code{\link{d.dep.t.rm}} exploring the before 5 | #' and after effects of scifi movies on supernatural beliefs. 6 | #' 7 | #' @docType data 8 | #' 9 | #' @usage data(dept_data) 10 | #' 11 | #' @format A data frame of before and after scores for rating 12 | #' supernatural beliefs. 13 | #' 14 | #' before: scores rated before watching a scifi movie 15 | #' after: scores rated after watching a scifi movie 16 | #' 17 | #' @keywords datasets 18 | #' 19 | #' @references Nolan and Heizen Statistics for the Behavioral Sciences 20 | #' (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 21 | #' 22 | "dept_data" 23 | -------------------------------------------------------------------------------- /R/epsilon.full.SS.R: -------------------------------------------------------------------------------- 1 | #' Epsilon for ANOVA from F and Sum of Squares 2 | #' 3 | #' This function displays epsilon squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula works for one way and multi way designs with careful 6 | #' focus on the sum of squares total calculation. 7 | #' 8 | #' To calculate epsilon, first, the mean square for the error is 9 | #' substracted from the mean square for the model. The difference 10 | #' is multiplied by the degrees of freedom for the model. The 11 | #' product is divided by the sum of squares total. 12 | #' 13 | #' epsilon^2 = (dfm * (msm - mse)) / (sst) 14 | #' 15 | #' \href{https://www.aggieerin.com/shiny-server/tests/epsilon.html}{Learn more on our example page.} 16 | #' 17 | #' @param dfm degrees of freedom for the model/IV/between 18 | #' @param dfe degrees of freedom for the error/residual/within 19 | #' @param msm mean square for the model/IV/between 20 | #' @param mse mean square for the error/residual/within 21 | #' @param sst sum of squares total 22 | #' @param a significance level 23 | #' @return Provides the effect size (epsilon) with associated 24 | #' confidence intervals from the F-statistic. 25 | #' 26 | #' \item{epsilon}{effect size} 27 | #' \item{epsilonlow}{lower level confidence interval of epsilon} 28 | #' \item{epsilonhigh}{upper level confidence interval of epsilon} 29 | #' \item{dfm}{degrees of freedom for the model/IV/between} 30 | #' \item{dfe}{degrees of freedom for the error/residual/within} 31 | #' \item{F}{F-statistic} 32 | #' \item{p}{p-value} 33 | #' \item{estimate}{the epsilon statistic and confidence interval in 34 | #' APA style for markdown printing} 35 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 36 | #' 37 | #' @keywords effect size, epsilon, ANOVA 38 | #' @import MBESS 39 | #' @import stats 40 | #' @export 41 | #' @examples 42 | #' 43 | #' #The following example is derived from the "bn1_data" dataset, included 44 | #' #in the MOTE library. 45 | #' 46 | #' #A health psychologist recorded the number of close inter-personal 47 | #' #attachments of 45-year-olds who were in excellent, fair, or poor 48 | #' #health. People in the Excellent Health group had 4, 3, 2, and 3 49 | #' #close attachments; people in the Fair Health group had 3, 5, 50 | #' #and 8 close attachments; and people in the Poor Health group 51 | #' #had 3, 1, 0, and 2 close attachments. 52 | #' 53 | #' anova_model = lm(formula = friends ~ group, data = bn1_data) 54 | #' summary.aov(anova_model) 55 | #' 56 | #' epsilon.full.SS(dfm = 2, dfe = 8, msm = 12.621, 57 | #' mse = 2.458, sst = (25.24+19.67), a = .05) 58 | 59 | 60 | epsilon.full.SS <- function (dfm, dfe, msm, mse, sst, a = .05) { 61 | 62 | if (missing(dfm)){ 63 | stop("Be sure to include the degrees of freedom for the model (IV).") 64 | } 65 | 66 | if (missing(dfe)){ 67 | stop("Be sure to include the degrees of freedom for the error.") 68 | } 69 | 70 | if (missing(msm)){ 71 | stop("Be sure to include the mean square value for your model (IV).") 72 | } 73 | 74 | if (missing(mse)){ 75 | stop("Be sure to include the mean square value for the error.") 76 | } 77 | 78 | if (missing(sst)){ 79 | stop("Be sure to include the sum of squares total for your ANOVA.") 80 | } 81 | 82 | if (a < 0 || a > 1) { 83 | stop("Alpha should be between 0 and 1.") 84 | } 85 | 86 | epsilon <- (dfm * (msm - mse)) / (sst) 87 | Fvalue <- msm / mse 88 | 89 | limits <- ci.R2(R2 = epsilon, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 90 | 91 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 92 | 93 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 94 | 95 | output <- list("epsilon" = epsilon, #epsilon stats 96 | "epsilonlow" = limits$Lower.Conf.Limit.R2, 97 | "epsilonhigh" = limits$Upper.Conf.Limit.R2, 98 | "dfm" = dfm, #sig stats 99 | "dfe" = dfe, 100 | "F" = Fvalue, 101 | "p" = p, 102 | "estimate" = paste("$\\epsilon^2$ = ", apa(epsilon,2,T), ", ", (1-a)*100, "\\% CI [", 103 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 104 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 105 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 106 | apa(Fvalue,2,T), ", $p$ ", 107 | reportp, sep = "")) 108 | 109 | return(output) 110 | 111 | } 112 | 113 | #' @rdname epsilon.full.SS 114 | #' @export 115 | -------------------------------------------------------------------------------- /R/eta.F.R: -------------------------------------------------------------------------------- 1 | #' Eta and Coefficient of Determination (R2) for ANOVA from F 2 | #' 3 | #' This function displays eta squared from ANOVA analyses 4 | #' and their non-central confidence interval based on the F distribution. 5 | #' These values are calculated directly from F statistics and can be used 6 | #' for between subjects and repeated measures designs. 7 | #' Remember if you have two or more IVs, these values are partial eta squared. 8 | #' 9 | #' Eta is calculated by multiplying the degrees of freedom of 10 | #' the model by the F-statistic. This is divided by the product 11 | #' of degrees of freedom of the model, the F-statistic, and 12 | #' the degrees of freedom for the error or residual. 13 | #' 14 | #' eta^2 = (dfm * Fvalue) / (dfm * Fvalue + dfe) 15 | #' 16 | #' \href{https://www.aggieerin.com/shiny-server/tests/etaf.html}{Learn more on our example page.} 17 | #' 18 | #' @param dfm degrees of freedom for the model/IV/between 19 | #' @param dfe degrees of freedom for the error/residual/within 20 | #' @param Fvalue F statistic 21 | #' @param a significance level 22 | #' @return Provides eta with associated confidence intervals and relevant statistics. 23 | #' 24 | #' \item{eta}{effect size} 25 | #' \item{etalow}{lower level confidence interval of eta} 26 | #' \item{etahigh}{upper level confidence interval of eta} 27 | #' \item{dfm}{degrees of freedom for the model/IV/between} 28 | #' \item{dfe}{degrees of freedom for the error/resisual/within} 29 | #' \item{F}{F-statistic} 30 | #' \item{p}{p-value} 31 | #' \item{estimate}{the eta squared statistic and confidence interval in 32 | #' APA style for markdown printing} 33 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 34 | #' 35 | #' @keywords effect size, eta, ANOVA 36 | #' @import MBESS 37 | #' @import stats 38 | #' @export 39 | #' @examples 40 | #' 41 | #' #The following example is derived from the "bn1_data" dataset, included 42 | #' #in the MOTE library. 43 | #' 44 | #' #A health psychologist recorded the number of close inter-personal 45 | #' #attachments of 45-year-olds who were in excellent, fair, or poor 46 | #' #health. People in the Excellent Health group had 4, 3, 2, and 3 47 | #' #close attachments; people in the Fair Health group had 3, 5, 48 | #' #and 8 close attachments; and people in the Poor Health group 49 | #' #had 3, 1, 0, and 2 close attachments. 50 | #' 51 | #' anova_model = lm(formula = friends ~ group, data = bn1_data) 52 | #' summary.aov(anova_model) 53 | #' 54 | #' eta.F(dfm = 2, dfe = 8, 55 | #' Fvalue = 5.134, a = .05) 56 | 57 | 58 | eta.F <- function (dfm, dfe, Fvalue, a = .05) { 59 | 60 | if (missing(dfm)){ 61 | stop("Be sure to include the degrees of freedom for the model (IV).") 62 | } 63 | 64 | if (missing(dfe)){ 65 | stop("Be sure to include the degrees of freedom for the error.") 66 | } 67 | 68 | if (missing(Fvalue)){ 69 | stop("Be sure to include the F-statistic from your ANOVA.") 70 | } 71 | 72 | if (a < 0 || a > 1) { 73 | stop("Alpha should be between 0 and 1.") 74 | } 75 | 76 | eta <- (dfm * Fvalue) / (dfm * Fvalue + dfe) 77 | 78 | limits <- ci.R2(R2 = eta, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 79 | 80 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 81 | 82 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 83 | 84 | output <- list("eta" = eta, #eta stats 85 | "etalow" = limits$Lower.Conf.Limit.R2, 86 | "etahigh" = limits$Upper.Conf.Limit.R2, 87 | "dfm" = dfm, #sig stats 88 | "dfe" = dfe, 89 | "F" = Fvalue, 90 | "p" = p, 91 | "estimate" = paste("$\\eta^2$ = ", apa(eta,2,T), ", ", (1-a)*100, "\\% CI [", 92 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 93 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 94 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 95 | apa(Fvalue,2,T), ", $p$ ", 96 | reportp, sep = "")) 97 | 98 | return(output) 99 | 100 | } 101 | 102 | #' @rdname eta.F 103 | #' @export 104 | -------------------------------------------------------------------------------- /R/eta.full.SS.R: -------------------------------------------------------------------------------- 1 | #' Eta for ANOVA from F and Sum of Squares 2 | #' 3 | #' This function displays eta squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula works for one way and multi way designs with careful 6 | #' focus on the sum of squares total. 7 | #' 8 | #' Eta squared is calculated by dividing the sum of squares for the model 9 | #' by the sum of squares total. 10 | #' 11 | #' eta^2 = ssm / sst 12 | #' 13 | #' \href{https://www.aggieerin.com/shiny-server/tests/etass.html}{Learn more on our example page.} 14 | #' 15 | #' @param dfm degrees of freedom for the model/IV/between 16 | #' @param dfe degrees of freedom for the error/residual/within 17 | #' @param ssm sum of squares for the model/IV/between 18 | #' @param sst sum of squares total 19 | #' @param Fvalue F statistic 20 | #' @param a significance level 21 | #' @return Provides eta with associated confidence intervals and relevant statistics. 22 | #' 23 | #' \item{eta}{effect size} 24 | #' \item{etalow}{lower level confidence interval of eta} 25 | #' \item{etahigh}{upper level confidence interval of eta} 26 | #' \item{dfm}{degrees of freedom for the model/IV/between} 27 | #' \item{dfe}{degrees of freedom for the error/resisual/within} 28 | #' \item{F}{F-statistic} 29 | #' \item{p}{p-value} 30 | #' \item{estimate}{the eta squared statistic and confidence interval in 31 | #' APA style for markdown printing} 32 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 33 | #' 34 | #' @keywords effect size, eta, ANOVA 35 | #' @import MBESS 36 | #' @import stats 37 | #' @export 38 | #' @examples 39 | #' 40 | #' #The following example is derived from the "bn1_data" dataset, included 41 | #' #in the MOTE library. 42 | #' 43 | #' #A health psychologist recorded the number of close inter-personal 44 | #' #attachments of 45-year-olds who were in excellent, fair, or poor 45 | #' #health. People in the Excellent Health group had 4, 3, 2, and 3 46 | #' #close attachments; people in the Fair Health group had 3, 5, 47 | #' #and 8 close attachments; and people in the Poor Health group 48 | #' #had 3, 1, 0, and 2 close attachments. 49 | #' 50 | #' anova_model = lm(formula = friends ~ group, data = bn1_data) 51 | #' summary.aov(anova_model) 52 | #' 53 | #' eta.full.SS(dfm = 2, dfe = 8, ssm = 25.24, 54 | #' sst = (25.24+19.67), Fvalue = 5.134, a = .05) 55 | 56 | 57 | eta.full.SS <- function (dfm, dfe, ssm, sst, Fvalue, a = .05) { 58 | 59 | if (missing(dfm)){ 60 | stop("Be sure to include the degrees of freedom for the model (IV).") 61 | } 62 | 63 | if (missing(dfe)){ 64 | stop("Be sure to include the degrees of freedom for the error.") 65 | } 66 | 67 | if (missing(ssm)){ 68 | stop("Be sure to include the sum of squares for your model (IV).") 69 | } 70 | 71 | if (missing(sst)){ 72 | stop("Be sure to include the sum of squares total from your ANOVA.") 73 | } 74 | 75 | if (missing(Fvalue)){ 76 | stop("Be sure to include the F-statistic from your ANOVA.") 77 | } 78 | 79 | if (a < 0 || a > 1) { 80 | stop("Alpha should be between 0 and 1.") 81 | } 82 | 83 | eta <- ssm / sst 84 | 85 | limits <- ci.R2(R2 = eta, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 86 | 87 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 88 | 89 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 90 | 91 | output <- list("eta" = eta, #eta stats 92 | "etalow" = limits$Lower.Conf.Limit.R2, 93 | "etahigh" = limits$Upper.Conf.Limit.R2, 94 | "dfm" = dfm, #sig stats 95 | "dfe" = dfe, 96 | "F" = Fvalue, 97 | "p" = p, 98 | "estimate" = paste("$\\eta^2$ = ", apa(eta,2,T), ", ", (1-a)*100, "\\% CI [", 99 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 100 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 101 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 102 | apa(Fvalue,2,T), ", $p$ ", 103 | reportp, sep = "")) 104 | 105 | return(output) 106 | 107 | } 108 | 109 | #' @rdname eta.full.SS 110 | #' @export 111 | -------------------------------------------------------------------------------- /R/eta.partial.SS.R: -------------------------------------------------------------------------------- 1 | #' Partial Eta Squared for ANOVA from F and Sum of Squares 2 | #' 3 | #' This function displays partial eta squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula works for one way and multi way designs. 6 | #' 7 | #' Partial eta squared is calculated by dividing the sum of squares 8 | #' of the model by the sum of the sum of squares of the model and 9 | #' sum of squares of the error. 10 | #' 11 | #' partial eta^2 = ssm / (ssm + sse) 12 | #' 13 | #' \href{https://www.aggieerin.com/shiny-server/tests/etapss.html}{Learn more on our example page.} 14 | #' 15 | #' @param dfm degrees of freedom for the model/IV/between 16 | #' @param dfe degrees of freedom for the error/residual/within 17 | #' @param ssm sum of squares for the model/IV/between 18 | #' @param sse sum of squares for the error/residual/within 19 | #' @param Fvalue F statistic 20 | #' @param a significance level 21 | #' 22 | #' @return Provides partial eta squared with associated confidence intervals 23 | #' and relevant statistics. 24 | #' 25 | #' \item{eta}{partial eta squared effect size} 26 | #' \item{etalow}{lower level confidence interval of partial eta squared} 27 | #' \item{etahigh}{upper level confidence interval of partial eta squared} 28 | #' \item{dfm}{degrees of freedom for the model/IV/between} 29 | #' \item{dfe}{degrees of freedom for the error/resisual/within} 30 | #' \item{F}{F-statistic} 31 | #' \item{p}{p-value} 32 | #' \item{estimate}{the eta squared statistic and confidence interval in 33 | #' APA style for markdown printing} 34 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 35 | #' 36 | #' @keywords effect size, eta, ANOVA 37 | #' @import MBESS 38 | #' @import stats 39 | #' @import ez 40 | #' @export 41 | #' @examples 42 | #' 43 | #' #The following example is derived from the "bn2_data" dataset, included 44 | #' #in the MOTE library. 45 | #' 46 | #' #Is there a difference in atheletic spending budget for different sports? 47 | #' #Does that spending interact with the change in coaching staff? This data includes 48 | #' #(fake) atheletic budgets for baseball, basketball, football, soccer, and volleyball teams 49 | #' #with new and old coaches to determine if there are differences in 50 | #' #spending across coaches and sports. 51 | #' 52 | #' library(ez) 53 | #' bn2_data$partno = 1:nrow(bn2_data) 54 | #' anova_model = ezANOVA(data = bn2_data, 55 | #' dv = money, 56 | #' wid = partno, 57 | #' between = .(coach, type), 58 | #' detailed = TRUE, 59 | #' type = 3) 60 | #' 61 | #' #You would calculate one eta for each F-statistic. 62 | #' #Here's an example for the interaction with typing in numbers. 63 | #' eta.partial.SS(dfm = 4, dfe = 990, 64 | #' ssm = 338057.9, sse = 32833499, 65 | #' Fvalue = 2.548, a = .05) 66 | #' 67 | #' #Here's an example for the interaction with code. 68 | #' eta.partial.SS(dfm = anova_model$ANOVA$DFn[4], 69 | #' dfe = anova_model$ANOVA$DFd[4], 70 | #' ssm = anova_model$ANOVA$SSn[4], 71 | #' sse = anova_model$ANOVA$SSd[4], 72 | #' Fvalue = anova_model$ANOVA$F[4], 73 | #' a = .05) 74 | 75 | 76 | eta.partial.SS <- function (dfm, dfe, ssm, sse, Fvalue, a = .05) { 77 | 78 | if (missing(dfm)){ 79 | stop("Be sure to include the degrees of freedom for the model (IV).") 80 | } 81 | 82 | if (missing(dfe)){ 83 | stop("Be sure to include the degrees of freedom for the error.") 84 | } 85 | 86 | if (missing(ssm)){ 87 | stop("Be sure to include the sum of squares for your model (IV).") 88 | } 89 | 90 | if (missing(sse)){ 91 | stop("Be sure to include the sum of squares for the error.") 92 | } 93 | 94 | if (missing(Fvalue)){ 95 | stop("Be sure to include the F-statistic from your ANOVA.") 96 | } 97 | 98 | if (a < 0 || a > 1) { 99 | stop("Alpha should be between 0 and 1.") 100 | } 101 | 102 | eta <- ssm / (ssm + sse) 103 | 104 | limits <- ci.R2(R2 = eta, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 105 | 106 | p <- pf(Fvalue, dfm, dfe, lower.tail = FALSE) 107 | 108 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,FALSE), sep = "")} 109 | 110 | output <- list("eta" = eta, #eta stats 111 | "etalow" = limits$Lower.Conf.Limit.R2, 112 | "etahigh" = limits$Upper.Conf.Limit.R2, 113 | "dfm" = dfm, #sig stats 114 | "dfe" = dfe, 115 | "F" = Fvalue, 116 | "p" = p, 117 | "estimate" = paste("$\\eta^2_{p}$ = ", apa(eta,2,FALSE), ", ", (1-a)*100, "\\% CI [", 118 | apa(limits$Lower.Conf.Limit.R2,2,TRUE), ", ", apa(limits$Upper.Conf.Limit.R2,2,TRUE), "]", sep = ""), 119 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 120 | apa(Fvalue,2,T), ", $p$ ", 121 | reportp, sep = "") 122 | ) 123 | 124 | return(output) 125 | 126 | } 127 | 128 | #' @rdname eta.partial.SS 129 | #' @export 130 | -------------------------------------------------------------------------------- /R/ges.partial.SS.mix.R: -------------------------------------------------------------------------------- 1 | #' Partial Generalized Eta-Squared for Mixed Design ANOVA from F 2 | #' 3 | #' This function displays partial generalized eta-squared (GES) from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula works for mixed designs. 6 | #' 7 | #' To calculate partial generalized eta squared, first, the sum of 8 | #' squares of the model, sum of squares of the subject 9 | #' variance, sum of squares for the subject variance, 10 | #' and the sum of squares for the error/residual/within are added together. 11 | #' The sum of squares of the model is divided by this value. 12 | #' 13 | #' partial ges = ssm / (ssm + sss + sse) 14 | #' 15 | #' \href{https://www.aggieerin.com/shiny-server/tests/gesmixss.html}{Learn more on our example page.} 16 | #' 17 | #' @param dfm degrees of freedom for the model/IV/between 18 | #' @param dfe degrees of freedom for the error/residual/within 19 | #' @param ssm sum of squares for the model/IV/between 20 | #' @param sss sum of squares subject variance 21 | #' @param sse sum of squares for the error/residual/within 22 | #' @param Fvalue F statistic 23 | #' @param a significance level 24 | #' 25 | #' @return Partial generalized eta-squared (GES) with associated confidence intervals 26 | #' and relevant statistics. 27 | #' \item{ges}{effect size} 28 | #' \item{geslow}{lower level confidence interval for ges} 29 | #' \item{geshigh}{upper level confidence interval for ges} 30 | #' \item{dfm}{degrees of freedom for the model/IV/between} 31 | #' \item{dfe}{degrees of freedom for the error/residual/within} 32 | #' \item{F}{F-statistic} 33 | #' \item{p}{p-value} 34 | #' \item{estimate}{the generalized eta squared statistic and confidence interval in 35 | #' APA style for markdown printing} 36 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 37 | #' 38 | #' @keywords effect size, ges, ANOVA 39 | #' @import MBESS 40 | #' @import stats 41 | #' @import ez 42 | #' @import reshape 43 | #' @export 44 | #' @examples 45 | #' 46 | #' #The following example is derived from the "mix2_data" dataset, included 47 | #' #in the MOTE library. 48 | #' 49 | #' #Given previous research, we know that backward strength in free 50 | #' #association tends to increase the ratings participants give when 51 | #' #you ask them how many people out of 100 would say a word in 52 | #' #response to a target word (like Family Feud). This result is 53 | #' #tied to people’s overestimation of how well they think they know 54 | #' #something, which is bad for studying. So, we gave people instructions 55 | #' #on how to ignore the BSG. Did it help? Is there an interaction 56 | #' #between BSG and instructions given? 57 | #' 58 | #' library(ez) 59 | #' mix2_data$partno = 1:nrow(mix2_data) 60 | #' 61 | #' library(reshape) 62 | #' long_mix = melt(mix2_data, id = c("partno", "group")) 63 | #' 64 | #' anova_model = ezANOVA(data = long_mix, 65 | #' dv = value, 66 | #' wid = partno, 67 | #' between = group, 68 | #' within = variable, 69 | #' detailed = TRUE, 70 | #' type = 3) 71 | #' 72 | #' #You would calculate one partial GES value for each F-statistic. 73 | #' #Here's an example for the interaction with typing in numbers. 74 | #' ges.partial.SS.mix(dfm = 1, dfe = 156, 75 | #' ssm = 71.07608, 76 | #' sss = 30936.498, 77 | #' sse = 8657.094, 78 | #' Fvalue = 1.280784, a = .05) 79 | #' 80 | #' #Here's an example for the interaction with code. 81 | #' ges.partial.SS.mix(dfm = anova_model$ANOVA$DFn[4], 82 | #' dfe = anova_model$ANOVA$DFd[4], 83 | #' ssm = anova_model$ANOVA$SSn[4], 84 | #' sss = anova_model$ANOVA$SSd[1], 85 | #' sse = anova_model$ANOVA$SSd[4], 86 | #' Fvalue = anova_model$ANOVA$F[4], 87 | #' a = .05) 88 | 89 | ges.partial.SS.mix <- function (dfm, dfe, ssm, sss, sse, Fvalue, a = .05) { 90 | 91 | if (missing(dfm)){ 92 | stop("Be sure to include the degrees of freedom for the model (IV).") 93 | } 94 | 95 | if (missing(dfe)){ 96 | stop("Be sure to include the degrees of freedom for the error.") 97 | } 98 | 99 | if (missing(ssm)){ 100 | stop("Be sure to include the sum of squares for your model (IV).") 101 | } 102 | 103 | if (missing(sss)){ 104 | stop("Be sure to include the sum of squares for the subject variance.") 105 | } 106 | 107 | if (missing(sse)){ 108 | stop("Be sure to include the sum of squares for your error for the model.") 109 | } 110 | 111 | if (missing(Fvalue)){ 112 | stop("Be sure to include the Fvalue from your ANOVA.") 113 | } 114 | 115 | if (a < 0 || a > 1) { 116 | stop("Alpha should be between 0 and 1.") 117 | } 118 | 119 | ges <- ssm / (ssm + sss+ sse) 120 | 121 | limits <- ci.R2(R2 = ges, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 122 | 123 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 124 | 125 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 126 | 127 | output <- list("ges" = ges, #ges stats 128 | "geslow" = limits$Lower.Conf.Limit.R2, 129 | "geshigh" = limits$Upper.Conf.Limit.R2, 130 | "dfm" = dfm, #sig stats 131 | "dfe" = dfe, 132 | "F" = Fvalue, 133 | "p" = p, 134 | "estimate" = paste("$\\eta^2_{G}$ = ", apa(ges,2,T), ", ", (1-a)*100, "\\% CI [", 135 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 136 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 137 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 138 | apa(Fvalue,2,T), ", $p$ ", 139 | reportp, sep = "")) 140 | 141 | return(output) 142 | 143 | } 144 | 145 | #' @rdname ges.partial.SS.mix 146 | #' @export 147 | -------------------------------------------------------------------------------- /R/indt-data.R: -------------------------------------------------------------------------------- 1 | #' Independent t Example Data 2 | #' 3 | #' Dataset for use in \code{\link{d.ind.t}}, \code{\link{d.ind.t.t}}, 4 | #' \code{\link{delta.ind.t}} exploring the effects of hypnotism on 5 | #' the effects of recall after witnessing a crime. 6 | #' 7 | #' @docType data 8 | #' 9 | #' @usage data(indt_data) 10 | #' 11 | #' @format A data frame including two groups, one recieving a 12 | #' hypnotism intervention, and one control group, to determine how 13 | #' hypnotism effects recall after witnessing a crime. 14 | #' 15 | #' @keywords datasets 16 | #' 17 | "indt_data" 18 | -------------------------------------------------------------------------------- /R/mix2-data.R: -------------------------------------------------------------------------------- 1 | #' Mixed Two-way ANOVA Example Data 2 | #' 3 | #' Dataset for use in \code{\link{ges.partial.SS.mix}}. 4 | #' Given previous research, we know that backward strength 5 | #' in free association tends to increase the ratings 6 | #' participants give when you ask them how many people 7 | #' out of 100 would say a word in response to a target 8 | #' word (like Family Feud). This result is tied to 9 | #' people's overestimation of how well they think they 10 | #' know something, which is bad for studying. So, we 11 | #' gave people instructions on how to ignore the BSG. 12 | #' Did it help? Is there an interaction between BSG 13 | #' and instructions given? 14 | #' 15 | #' @docType data 16 | #' 17 | #' @usage data(mix2_data) 18 | #' 19 | #' @format A data frame including group type and backward strength rating. 20 | #' 21 | #' group: Regular JAM Task or Debiasing JAM task 22 | #' bsglo: estimate of response to target word in a Low BSG condition 23 | #' bsghi: estimate of response to target word in a High BSG condition 24 | #' 25 | #' @keywords datasets 26 | #' 27 | #' 28 | "mix2_data" 29 | -------------------------------------------------------------------------------- /R/odds.R: -------------------------------------------------------------------------------- 1 | #' Chi-Square Odds Ratios 2 | #' 3 | #' This function displays odds ratios and their normal confidence intervals. 4 | #' 5 | #' This statistic is the ratio between level 1.1 divided by level 1.2, and 6 | #' level 2.1 divided by 2.2. In other words, these are the odds of level 1.1 7 | #' given level 1 overall versus level 2.1 given level 2 overall. 8 | #' 9 | #' To calculate odds ratios, First, the sample size for level 1.1 10 | #' is divided by the sample size for level 1.2. This value is divided 11 | #' by the sample size for level 2.1, after dividing by the sample 12 | #' size of level 2.2. 13 | #' 14 | #' odds <- (n11 / n12) / (n21 / n22) 15 | #' 16 | #' \href{https://www.aggieerin.com/shiny-server/tests/chio.html}{Learn more on our example page.} 17 | #' 18 | #' @param n11 sample size for level 1.1 19 | #' @param n12 sample size for level 1.2 20 | #' @param n21 sample size for level 2.1 21 | #' @param n22 sample size for level 2.2 22 | #' @param a significance level 23 | #' @return Provides odds ratios with associated confidence intervals 24 | #' and relevant statistics. 25 | #' 26 | #' \item{odds}{odds statistic} 27 | #' \item{olow}{lower level confidence interval of odds statistic} 28 | #' \item{ohigh}{upper level confidence interval of odds statistic} 29 | #' \item{se}{standard error} 30 | #' \item{estimate}{the oods statistic and confidence interval in 31 | #' APA style for markdown printing} 32 | #' 33 | #' @keywords effect size, odds ratios 34 | #' @import MBESS 35 | #' @import stats 36 | #' @export 37 | #' @examples 38 | #' 39 | #' #A health psychologist was interested in the rates of anxiety in 40 | #' #first generation and regular college students. They polled campus 41 | #' #and found the following data: 42 | #' 43 | #' #| | First Generation | Regular | 44 | #' #|--------------|------------------|---------| 45 | #' #| Low Anxiety | 10 | 50 | 46 | #' #| High Anxiety | 20 | 15 | 47 | #' 48 | #' #What are the odds for the first generation students to have anxiety? 49 | #' 50 | #' odds(n11 = 10, n12 = 50, n21 = 20, n22 = 15, a = .05) 51 | 52 | 53 | odds <- function (n11, n12, n21, n22, a = .05) { 54 | 55 | if (missing(n11)){ 56 | stop("Be sure to include the sample size for row 1 and column 1.") 57 | } 58 | 59 | if (missing(n12)){ 60 | stop("Be sure to include the sample size for row 1 and column 2.") 61 | } 62 | 63 | if (missing(n21)){ 64 | stop("Be sure to include the sample size for row 2 and column 1.") 65 | } 66 | 67 | if (missing(n22)){ 68 | stop("Be sure to include the sample size for row 2 and column 2.") 69 | } 70 | 71 | if (a < 0 || a > 1) { 72 | stop("Alpha should be between 0 and 1.") 73 | } 74 | 75 | odds <- (n11 / n12) / (n21 / n22) 76 | se <- sqrt((1 / n11) + (1 / n12) + (1 / n21) + (1 / n22)) 77 | olow <- exp(log(odds)) - qnorm(a / 2, lower.tail = F) * se 78 | ohigh <- exp(log(odds)) + qnorm(a / 2, lower.tail = F) * se 79 | 80 | output = list("odds" = odds, #odds stats 81 | "olow" = olow, 82 | "ohigh" = ohigh, 83 | "se" = se, 84 | "estimate" = paste("$Odds$ = ", apa(odds,2,F), ", ", (1-a)*100, "\\% CI [", 85 | apa(olow,2,F), ", ", apa(ohigh,2,F), "]", sep = "")) 86 | 87 | return(output) 88 | 89 | } 90 | 91 | #' @rdname odds 92 | #' @export 93 | -------------------------------------------------------------------------------- /R/omega.F.R: -------------------------------------------------------------------------------- 1 | #' Omega Squared for ANOVA from F 2 | #' 3 | #' This function displays omega squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' These values are calculated directly from F statistics and can be used 6 | #' for between subjects and repeated measures designs. 7 | #' Remember if you have two or more IVs, these values are partial omega squared. 8 | #' 9 | #' Omega squared or partial omega squared is calculated by subtracting one 10 | #' from the F-statistic and multiplying it by degrees of freedom of the model. This is 11 | #' divided by the same value after adding the number of valid responses. This 12 | #' value will be omega squared for one-way ANOVA designs, and will be 13 | #' partial omega squared for multi-way ANOVA designs (i.e. with more than one IV). 14 | #' 15 | #' omega^2 = (dfm * (Fvalue-1)) / ((dfm * (Fvalue-1)) + n) 16 | #' 17 | #' \href{https://www.aggieerin.com/shiny-server/tests/omegaf.html}{Learn more on our example page.} 18 | #' 19 | #' 20 | #' @param dfm degrees of freedom for the model/IV/between 21 | #' @param dfe degrees of freedom for the error/residual/within 22 | #' @param Fvalue F statistic 23 | #' @param n full sample size 24 | #' @param a significance level 25 | #' @return The effect size (Cohen's d) with associated confidence intervals 26 | #' and relevant statistics. 27 | #' 28 | #' \item{omega}{omega statistic} 29 | #' \item{omegalow}{lower level confidence interval d value} 30 | #' \item{omegahigh}{upper level confidence interval d value} 31 | #' \item{dfm}{degrees of freedom for the model/IV/between} 32 | #' \item{dfe}{degrees of freedom for the error/residual/within} 33 | #' \item{F}{F-statistic} 34 | #' \item{p}{p-value} 35 | #' \item{estimate}{the omega squared statistic and confidence interval in 36 | #' APA style for markdown printing} 37 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 38 | #' 39 | #' @keywords effect size, omega, ANOVA 40 | #' @import MBESS 41 | #' @import stats 42 | #' @export 43 | #' @examples 44 | #' 45 | #' #The following example is derived from the "bn1_data" dataset, included 46 | #' #in the MOTE library. 47 | #' 48 | #' #A health psychologist recorded the number of close inter-personal 49 | #' #attachments of 45-year-olds who were in excellent, fair, or poor 50 | #' #health. People in the Excellent Health group had 4, 3, 2, and 3 51 | #' #close attachments; people in the Fair Health group had 3, 5, 52 | #' #and 8 close attachments; and people in the Poor Health group 53 | #' #had 3, 1, 0, and 2 close attachments. 54 | #' 55 | #' anova_model = lm(formula = friends ~ group, data = bn1_data) 56 | #' summary.aov(anova_model) 57 | #' 58 | #' omega.F(dfm = 2, dfe = 8, 59 | #' Fvalue = 5.134, n = 11, a = .05) 60 | 61 | 62 | omega.F <- function (dfm, dfe, Fvalue, n, a = .05) { 63 | 64 | if (missing(dfm)){ 65 | stop("Be sure to include the degrees of freedom for the model (IV).") 66 | } 67 | 68 | if (missing(dfe)){ 69 | stop("Be sure to include the degrees of freedom for the error.") 70 | } 71 | 72 | if (missing(Fvalue)){ 73 | stop("Be sure to include the Fvalue from your ANOVA.") 74 | } 75 | 76 | if (missing(n)){ 77 | stop("Be sure to include total sample size.") 78 | } 79 | 80 | if (a < 0 || a > 1) { 81 | stop("Alpha should be between 0 and 1.") 82 | } 83 | 84 | omega <- (dfm * (Fvalue-1)) / ((dfm * (Fvalue-1)) + n) 85 | 86 | limits <- ci.R2(R2 = omega, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 87 | 88 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 89 | 90 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 91 | 92 | output <- list("omega" = omega, #omega stats 93 | "omegalow" = limits$Lower.Conf.Limit.R2, 94 | "omegahigh" = limits$Upper.Conf.Limit.R2, 95 | "dfm" = dfm, #sig stats 96 | "dfe" = dfe, 97 | "F" = Fvalue, 98 | "p" = p, 99 | "estimate" = paste("$\\omega^2$ = ", apa(omega,2,T), ", ", (1-a)*100, "\\% CI [", 100 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 101 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 102 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 103 | apa(Fvalue,2,T), ", $p$ ", 104 | reportp, sep = "")) 105 | 106 | return(output) 107 | 108 | } 109 | 110 | #' @rdname omega.F 111 | #' @export 112 | 113 | -------------------------------------------------------------------------------- /R/omega.full.SS.R: -------------------------------------------------------------------------------- 1 | #' Omega Squared for One-Way and Multi-Way ANOVA from F 2 | #' 3 | #' This function displays omega squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula works for one way and multi way designs with careful 6 | #' focus on which error term you are using for the calculation. 7 | #' 8 | #' Omega squared is calculated by deducting the mean square of the error 9 | #' from the mean square of the model and multiplying by the degrees of freedom for the model. 10 | #' This is divided by the sum of the sum of squares total and the mean square of the error. 11 | #' 12 | #' omega = (dfm * (msm - mse)) / (sst + mse) 13 | #' 14 | #' \href{https://www.aggieerin.com/shiny-server/tests/omegass.html}{Learn more on our example page.} 15 | #' 16 | #' @param dfm degrees of freedom for the model/IV/between 17 | #' @param dfe degrees of freedom for the error/residual/within 18 | #' @param msm mean square for the model/IV/between 19 | #' @param mse mean square for the error/residual/within 20 | #' @param sst sum of squares total 21 | #' @param a significance level 22 | #' @return Provides omega squared with associated confidence intervals 23 | #' and relevant statistics. 24 | #' 25 | #' \item{omega}{omega squared} 26 | #' \item{omegalow}{lower level confidence interval of omega} 27 | #' \item{omegahigh}{upper level confidence interval of omega} 28 | #' \item{dfm}{degrees of freedom for the model/IV/between} 29 | #' \item{dfe}{degrees of freedom for the error/resisual/within} 30 | #' \item{F}{F-statistic} 31 | #' \item{p}{p-value} 32 | #' \item{estimate}{the omega squared statistic and confidence interval in 33 | #' APA style for markdown printing} 34 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 35 | #' 36 | #' @keywords effect size, omega, ANOVA 37 | #' @import MBESS 38 | #' @import stats 39 | #' @export 40 | #' @examples 41 | #' 42 | #' #The following example is derived from the "bn1_data" dataset, included 43 | #' #in the MOTE library. 44 | #' 45 | #' #A health psychologist recorded the number of close inter-personal 46 | #' #attachments of 45-year-olds who were in excellent, fair, or poor 47 | #' #health. People in the Excellent Health group had 4, 3, 2, and 3 48 | #' #close attachments; people in the Fair Health group had 3, 5, 49 | #' #and 8 close attachments; and people in the Poor Health group 50 | #' #had 3, 1, 0, and 2 close attachments. 51 | #' 52 | #' anova_model = lm(formula = friends ~ group, data = bn1_data) 53 | #' summary.aov(anova_model) 54 | #' 55 | #' omega.full.SS(dfm = 2, dfe = 8, 56 | #' msm = 12.621, mse = 2.548, 57 | #' sst = (25.54+19.67), a = .05) 58 | 59 | 60 | 61 | omega.full.SS <- function (dfm, dfe, msm, mse, sst, a = .05) { 62 | 63 | if (missing(dfm)){ 64 | stop("Be sure to include the degrees of freedom for the model (IV).") 65 | } 66 | 67 | if (missing(dfe)){ 68 | stop("Be sure to include the degrees of freedom for the error.") 69 | } 70 | 71 | if (missing(msm)){ 72 | stop("Be sure to include the mean squared model for your model (IV).") 73 | } 74 | 75 | if (missing(mse)){ 76 | stop("Be sure to include the mean squared error for your model.") 77 | } 78 | 79 | if (missing(sst)){ 80 | stop("Be sure to include the sum of squares total for your model.") 81 | } 82 | 83 | if (a < 0 || a > 1) { 84 | stop("Alpha should be between 0 and 1.") 85 | } 86 | 87 | omega <- (dfm * (msm - mse)) / (sst + mse) 88 | 89 | Fvalue <- msm / mse 90 | 91 | limits <- ci.R2(R2 = omega, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 92 | 93 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 94 | 95 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 96 | 97 | output <- list("omega" = omega, #omega stats 98 | "omegalow" = limits$Lower.Conf.Limit.R2, 99 | "omegahigh" = limits$Upper.Conf.Limit.R2, 100 | "dfm" = dfm, #sig stats 101 | "dfe" = dfe, 102 | "F" = Fvalue, 103 | "p" = p, 104 | "estimate" = paste("$\\omega^2$ = ", apa(omega,2,T), ", ", (1-a)*100, "\\% CI [", 105 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 106 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 107 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 108 | apa(Fvalue,2,T), ", $p$ ", 109 | reportp, sep = "")) 110 | 111 | return(output) 112 | 113 | } 114 | 115 | #' @rdname omega.full.SS 116 | #' @export 117 | -------------------------------------------------------------------------------- /R/omega.partial.SS.bn.R: -------------------------------------------------------------------------------- 1 | #' Partial Omega Squared for Between Subjects ANOVA from F 2 | #' 3 | #' This function displays omega squared from ANOVA analyses 4 | #' and its non-central confidence interval based on the F distribution. 5 | #' This formula is appropriate for multi-way between subjects designs. 6 | #' 7 | #' Partial omega squared is calculated by subtracting the mean square for the error 8 | #' from the mean square of the model, which is multiplied by degrees of freedom of 9 | #' the model. This is divided by the product of the degrees of freedom 10 | #' for the model are deducted from the sample size, multiplied by the 11 | #' mean square of the error, plus the sum of squares for the model. 12 | #' 13 | #' omega^2 <- (dfm * (msm - mse)) / (ssm + (n-dfm)*mse) 14 | #' 15 | #' \href{https://www.aggieerin.com/shiny-server/tests/omegapbnss.html}{Learn more on our example page.} 16 | #' 17 | #' @param dfm degrees of freedom for the model/IV/between 18 | #' @param dfe degrees of freedom for the error/residual/within 19 | #' @param msm mean square for the model/IV/between 20 | #' @param mse mean square for the error/residual/within 21 | #' @param ssm sum of squares for the model/IV/between 22 | #' @param n total sample size 23 | #' @param a significance level 24 | #' 25 | #' @return Provides omega squared with associated confidence intervals 26 | #' and relevant statistics. 27 | #' 28 | #' \item{omega}{omega squared} 29 | #' \item{omegalow}{lower level confidence interval of omega} 30 | #' \item{omegahigh}{upper level confidence interval of omega} 31 | #' \item{dfm}{degrees of freedom for the model/IV/between} 32 | #' \item{dfe}{degrees of freedom for the error/resisual/within} 33 | #' \item{F}{F-statistic} 34 | #' \item{p}{p-value} 35 | #' \item{estimate}{the omega squared statistic and confidence interval in 36 | #' APA style for markdown printing} 37 | #' \item{statistic}{the F-statistic in APA style for markdown printing} 38 | #' 39 | #' @keywords effect size, omega, ANOVA 40 | #' @import MBESS 41 | #' @import stats 42 | #' @export 43 | #' @examples 44 | #' 45 | #' #The following example is derived from the "bn2_data" dataset, included 46 | #' #in the MOTE library. 47 | #' 48 | #' #Is there a difference in atheletic spending budget for different sports? 49 | #' #Does that spending interact with the change in coaching staff? This data includes 50 | #' #(fake) atheletic budgets for baseball, basketball, football, soccer, and volleyball teams 51 | #' #with new and old coaches to determine if there are differences in 52 | #' #spending across coaches and sports. 53 | #' 54 | #' library(ez) 55 | #' bn2_data$partno = 1:nrow(bn2_data) 56 | #' anova_model = ezANOVA(data = bn2_data, 57 | #' dv = money, 58 | #' wid = partno, 59 | #' between = .(coach, type), 60 | #' detailed = TRUE, 61 | #' type = 3) 62 | #' 63 | #' #You would calculate one eta for each F-statistic. 64 | #' #Here's an example for the interaction with typing in numbers. 65 | #' omega.partial.SS.bn(dfm = 4, dfe = 990, 66 | #' msm = 338057.9 / 4, 67 | #' mse = 32833499 / 990, 68 | #' ssm = 338057.9, 69 | #' n = 1000, a = .05) 70 | #' 71 | #' #Here's an example for the interaction with code. 72 | #' omega.partial.SS.bn(dfm = anova_model$ANOVA$DFn[4], 73 | #' dfe = anova_model$ANOVA$DFd[4], 74 | #' msm = anova_model$ANOVA$SSn[4] / anova_model$ANOVA$DFn[4], 75 | #' mse = anova_model$ANOVA$SSd[4] / anova_model$ANOVA$DFd[4], 76 | #' ssm = anova_model$ANOVA$SSn[4], 77 | #' n = nrow(bn2_data), 78 | #' a = .05) 79 | 80 | omega.partial.SS.bn <- function (dfm, dfe, msm, mse, ssm, n, a = .05) { 81 | 82 | if (missing(dfm)){ 83 | stop("Be sure to include the degrees of freedom for the model (IV).") 84 | } 85 | 86 | if (missing(dfe)){ 87 | stop("Be sure to include the degrees of freedom for the error.") 88 | } 89 | 90 | if (missing(msm)){ 91 | stop("Be sure to include the mean squared model for your model (IV).") 92 | } 93 | 94 | if (missing(mse)){ 95 | stop("Be sure to include the mean squared error for your model.") 96 | } 97 | 98 | if (missing(ssm)){ 99 | stop("Be sure to include the sum of squares for your model (IV).") 100 | } 101 | 102 | if (missing(n)){ 103 | stop("Be sure to include total sample size.") 104 | } 105 | 106 | if (a < 0 || a > 1) { 107 | stop("Alpha should be between 0 and 1.") 108 | } 109 | 110 | omega <- (dfm * (msm - mse)) / (ssm + (n-dfm)*mse) 111 | 112 | Fvalue <- msm / mse 113 | 114 | limits <- ci.R2(R2 = omega, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 115 | 116 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 117 | 118 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 119 | 120 | output <- list("omega" = omega, #omega stats 121 | "omegalow" = limits$Lower.Conf.Limit.R2, 122 | "omegahigh" = limits$Upper.Conf.Limit.R2, 123 | "dfm" = dfm, #sig stats 124 | "dfe" = dfe, 125 | "F" = Fvalue, 126 | "p" = p, 127 | "estimate" = paste("$\\omega^2_{p}$ = ", apa(omega,2,T), ", ", (1-a)*100, "\\% CI [", 128 | apa(limits$Lower.Conf.Limit.R2,2,T), ", ", 129 | apa(limits$Upper.Conf.Limit.R2,2,T), "]", sep = ""), 130 | "statistic" = paste("$F$(", dfm, ", ", dfe, ") = ", 131 | apa(Fvalue,2,T), ", $p$ ", 132 | reportp, sep = "")) 133 | 134 | return(output) 135 | 136 | } 137 | 138 | #' @rdname omega.partial.SS.bn 139 | #' @export 140 | 141 | -------------------------------------------------------------------------------- /R/r.correl.R: -------------------------------------------------------------------------------- 1 | #' r to Coefficient of Determination (R2) from F 2 | #' 3 | #' This function displays transformation from r to r2 to calculate 4 | #' the non-central confidence interval for r2 using the F distribution. 5 | #' 6 | #' The t-statistic is calculated by first dividing one minus the 7 | #' square root of r squared by degrees of freedom of the error. 8 | #' r is divided by this value. 9 | #' 10 | #' t = r / sqrt((1 - rsq) / (n - 2)) 11 | #' 12 | #' The F-statistic is the t-statistic squared. 13 | #' 14 | #' Fvalue = t ^ 2 15 | #' 16 | #' \href{https://www.aggieerin.com/shiny-server/tests/rcorrel.html}{Learn more on our example page.} 17 | #' 18 | #' @param r correlation coefficient 19 | #' @param n sample size 20 | #' @param a significance level 21 | #' @return Provides correlation coefficient and coefficient of 22 | #' determination with associated confidence intervals 23 | #' and relevant statistics. 24 | #' 25 | #' \item{r}{correlation coefficient} 26 | #' \item{rlow}{lower level confidence interval r} 27 | #' \item{rhigh}{upper level confidence interval r} 28 | #' \item{R2}{coefficient of determination} 29 | #' \item{R2low}{lower level confidence interval of R2} 30 | #' \item{R2high}{upper level confidence interval of R2} 31 | #' \item{se}{standard error} 32 | #' \item{n}{sample size} 33 | #' \item{dfm}{degrees of freedom of mean} 34 | #' \item{dfe}{degrees of freedom of error} 35 | #' \item{t}{t-statistic} 36 | #' \item{F}{F-statistic} 37 | #' \item{p}{p-value} 38 | #' \item{estimate}{the r statistic and confidence interval in 39 | #' APA style for markdown printing} 40 | #' \item{estimateR2}{the R^2 statistic and confidence interval in 41 | #' APA style for markdown printing} 42 | #' \item{statistic}{the t-statistic in APA style for markdown printing} 43 | #' 44 | #' @keywords effect size, correlation 45 | #' @import MBESS 46 | #' @import stats 47 | #' @export 48 | #' @examples 49 | #' 50 | #' #This example is derived from the mtcars dataset provided in R. 51 | #' 52 | #' #What is the correlation between miles per gallon and car weight? 53 | #' 54 | #' cor.test(mtcars$mpg, mtcars$wt) 55 | #' 56 | #' r.correl(r = -0.8676594, n = 32, a = .05) 57 | 58 | r.correl <- function (r, n, a = .05) { 59 | 60 | if (missing(r)){ 61 | stop("Be sure to include the correlation r.") 62 | } 63 | 64 | if (missing(n)){ 65 | stop("Be sure to include the sample size.") 66 | } 67 | 68 | if (a < 0 || a > 1) { 69 | stop("Alpha should be between 0 and 1.") 70 | } 71 | 72 | rsq <- (r) ^ 2 73 | se <- sqrt(4 * rsq * ((1 - rsq) ^ 2) * ((n - 3) ^ 2) / ((n ^ 2 - 1) * (3 + n))) 74 | t <- r / sqrt((1 - rsq) / (n - 2)) 75 | Fvalue <- t ^ 2 76 | dfm <- 1 77 | dfe <- n - 2 78 | 79 | limits <- ci.R2(R2 = rsq, df.1 = dfm, df.2 = dfe, conf.level = (1-a)) 80 | 81 | ciforr <- ci.R(R = abs(r), df.1 = dfm, df.2 = dfe, conf.level = (1 - a)) 82 | p <- pf(Fvalue, dfm, dfe, lower.tail = F) 83 | 84 | #deal with negative r / d values 85 | if (r < 0) { 86 | rlow = 0 - ciforr$Lower.Conf.Limit.R 87 | rhigh = 0 - ciforr$Upper.Conf.Limit.R 88 | } else { 89 | rlow = ciforr$Lower.Conf.Limit.R 90 | rhigh = ciforr$Upper.Conf.Limit.R 91 | } 92 | 93 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 94 | 95 | output = list("r" = r, #r stats 96 | "rlow" = rlow, 97 | "rhigh" = rhigh, 98 | "R2" = rsq, #R squared stats 99 | "R2low" = limits$Lower.Conf.Limit.R2, 100 | "R2high" = limits$Upper.Conf.Limit.R2, 101 | "se" = se, 102 | "n" = n, #sample stats 103 | "dfm" = 1, #sig stats 104 | "dfe" = (n - 2), 105 | "t" = t, 106 | "F" = Fvalue, 107 | "p" = p, 108 | "estimate" = paste("$r$ = ", apa(r,2,F), ", ", (1-a)*100, "\\% CI [", 109 | apa(rlow,2,F), ", ", apa(rhigh,2,F), "]", sep = ""), 110 | "estimateR2" = paste("$R^2$ = ", apa(rsq,2,F), ", ", (1-a)*100, "\\% CI [", 111 | apa(limits$Lower.Conf.Limit.R2,2,F), ", ", 112 | apa(limits$Upper.Conf.Limit.R2,2,F), "]", sep = ""), 113 | "statistic" = paste("$t$(", (n-2), ") = ", apa(t,2,T), ", $p$ ", 114 | reportp, sep = "")) 115 | 116 | return(output) 117 | } 118 | 119 | #' @rdname r.correl 120 | #' @export 121 | -------------------------------------------------------------------------------- /R/rm1-data.R: -------------------------------------------------------------------------------- 1 | #' Repeated Measures Oneway ANOVA Example Data 2 | #' 3 | #' Dataset for use in \code{\link{omega.F}}. 4 | #' Participants were tested over several days to measure 5 | #' variations in their pulse given different types of stimuli. 6 | #' One stimulus was a neutral picture (like a toaster), 7 | #' while other stimuli were cute/happy pictures (puppies, babies), 8 | #' and negative stimuli (mutilated faces, pictures of war). 9 | #' Were there differences in pulse for each participant 10 | #' across the stimuli? 11 | #' 12 | #' @docType data 13 | #' 14 | #' @usage data(rm1_data) 15 | #' 16 | #' @format A data frame including ratings toward pictures. 17 | #' 18 | #' neutral: pulse during exposure to neutral stimuli 19 | #' positive: pulse during exposure to positive stimuli 20 | #' negative: pulse during exposure to negative stimuli 21 | #' 22 | #' @keywords datasets 23 | #' 24 | #' 25 | "rm1_data" 26 | -------------------------------------------------------------------------------- /R/rm2-data.R: -------------------------------------------------------------------------------- 1 | #' Repeated Measures Two-way ANOVA Example Data 2 | #' 3 | #' Dataset for use in \code{\link{omega.partial.SS.rm}} and other 4 | #' repeated measures ANOVA designs. This dataset includes a group variable 5 | #' used for mixed repeated measures designs, a subject number, and two 6 | #' repeated measures variables. These variables include FSG (forward strength) 7 | #' which is a measure of the relation between two words like cheddar to cheese. 8 | #' The second variable is BSG (backward strength), which is the opposite 9 | #' relation (cheese to cheddar). Participants rated those word pairs in and the 10 | #' strength of FSG and BSG was manipulated to measure overestimation of strength. 11 | #' 12 | #' @docType data 13 | #' 14 | #' @usage data(rm2_data) 15 | #' 16 | #' @format A data frame of ratings of word pair relation 17 | #' 18 | #' group: A between-subjects variable indicating the type of instructions 19 | #' subject: A subject number 20 | #' fsglobsglo: A repeated measures condition of low FSG-BSG 21 | #' fsghihbsglo: A repeated measures condition of high FSG, low BSG 22 | #' fsglobsghi: A repeated measures condition of low FSG, high BSG 23 | #' fsghibsghi: A repeated measures condition of high FSG-BSG 24 | #' 25 | #' @keywords datasets 26 | #' 27 | "rm2_data" 28 | -------------------------------------------------------------------------------- /R/singt-data.R: -------------------------------------------------------------------------------- 1 | #' Single Sample t Example Data 2 | #' 3 | #' A simulated dataset for use in \code{\link{d.single.t}} and \code{\link{d.single.t.t}}, including 4 | #' gifted/honors student SAT scores from a specific school to use for comparison with the 5 | #' national average SAT score (1080) of gifted/honors students nationwide. 6 | #' 7 | #' @docType data 8 | #' 9 | #' @usage data(singt_data) 10 | #' 11 | #' @format A data frame including a single sample consisting of SAT scores of students from 12 | #' a gifted/honors program at a specific school. 13 | #' 14 | #' @keywords datasets 15 | #' 16 | "singt_data" 17 | -------------------------------------------------------------------------------- /R/v.chi.sq.R: -------------------------------------------------------------------------------- 1 | #' V for Chi-Square 2 | #' 3 | #' This function displays V and non-central confidence interval 4 | #' for the specified chi-square statistic. 5 | #' 6 | #' V is calculated by finding the square root of chi-squared divided by the product 7 | #' of the sample size and the degrees of freedom with the lowest value. 8 | #' 9 | #' v = sqrt(x2 / (n * dfsmall)) 10 | #' 11 | #' \href{https://www.aggieerin.com/shiny-server/tests/chiv.html}{Learn more on our example page.} 12 | #' 13 | #' @param x2 chi-square statistic 14 | #' @param n sample size 15 | #' @param r number of rows in the contingency table 16 | #' @param c number of columns in the contingency table 17 | #' @param a significance level 18 | #' @return Provides V with associated confidence intervals 19 | #' and relevant statistics. 20 | #' 21 | #' \item{v}{v-statistic} 22 | #' \item{vlow}{lower level confidence interval of V} 23 | #' \item{vhigh}{upper level confidence interval of V} 24 | #' \item{n}{sample size} 25 | #' \item{df}{degrees of freedom} 26 | #' \item{x2}{significance statistic} 27 | #' \item{p}{p-value} 28 | #' \item{estimate}{the V statistic and confidence interval in 29 | #' APA style for markdown printing} 30 | #' \item{statistic}{the X2-statistic in APA style for markdown printing} 31 | #' 32 | #' @keywords effect size, chi-square 33 | #' @import MBESS 34 | #' @import stats 35 | #' @export 36 | #' @examples 37 | #' 38 | #' #The following example is derived from the "chisq_data" dataset, included 39 | #' #in the MOTE library. 40 | #' 41 | #' #Individuals were polled about their number of friends (low, medium, high) 42 | #' #and their number of kids (1, 2, 3+) to determine if there was a 43 | #' #relationship between friend groups and number of children, as we 44 | #' #might expect that those with more children may have less time for 45 | #' #friendship maintaining activities. 46 | #' 47 | #' chisq.test(chisq_data$kids, chisq_data$friends) 48 | #' 49 | #' v.chi.sq(x2 = 2.0496, n = 60, r = 3, c = 3, a = .05) 50 | #' 51 | #' #Please note, if you see a warning, that implies the lower effect should 52 | #' #be zero, as noted. 53 | 54 | v.chi.sq <- function (x2, n, r, c, a = .05) { 55 | 56 | if (missing(x2)){ 57 | stop("Be sure to include chi-square statistic value.") 58 | } 59 | 60 | if (missing(n)){ 61 | stop("Be sure to include the sample size.") 62 | } 63 | 64 | if (missing(r)){ 65 | stop("Be sure to include number of rows.") 66 | } 67 | 68 | if (missing(c)){ 69 | stop("Be sure to include number of columns") 70 | } 71 | 72 | if (a < 0 || a > 1) { 73 | stop("Alpha should be between 0 and 1.") 74 | } 75 | 76 | dfsmall <- min(r - 1, c - 1) 77 | v <- sqrt(x2 / (n * dfsmall)) 78 | dftotal <- (r - 1) * (c - 1) 79 | ncpboth <- conf.limits.nc.chisq(x2, df = dftotal, conf.level = (1 - a)) 80 | vlow <- sqrt((ncpboth$Lower.Limit + dftotal) / (n * dfsmall)) 81 | vhigh <- sqrt((ncpboth$Upper.Limit + dftotal) / (n * dfsmall)) 82 | p <- pchisq(x2, dftotal, lower.tail = F) 83 | 84 | if (p < .001) {reportp = "< .001"} else {reportp = paste("= ", apa(p,3,F), sep = "")} 85 | 86 | output = list("v" = v, #v stats 87 | "vlow" = vlow, 88 | "vhigh" = vhigh, 89 | "n" = n, #sample stats 90 | "df" = dftotal, 91 | "x2" = x2, #sig stats, 92 | "p" = p, 93 | "estimate" = paste("$V$ = ", apa(v,2,F), ", ", (1-a)*100, "\\% CI [", 94 | apa(vlow,2,F), ", ", apa(vhigh,2,F), "]", sep = ""), 95 | "statistic" = paste("$\\chi^2$(", dftotal, ") = ", apa(x2,2,T), ", $p$ ", 96 | reportp, sep = "")) 97 | 98 | return(output) 99 | } 100 | 101 | #' @rdname v.chi.sq 102 | #' @export 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MOTE 2 | 3 | [![Travis build status](https://travis-ci.org/doomlab/MOTE.svg?branch=master)](https://travis-ci.org/doomlab/MOTE) 4 | 5 | [![](https://cranlogs.r-pkg.org/badges/MOTE)](https://cran.r-project.org/package=MOTE) 6 | ![](http://cranlogs.r-pkg.org/badges/last-week/MOTE) 7 | ![](http://cranlogs.r-pkg.org/badges/last-day/MOTE) 8 | ![](http://cranlogs.r-pkg.org/badges/grand-total/MOTE) 9 | 10 | 11 | We gladly take comments and updates! You can check out videos on my [YouTube channel](https://www.youtube.com/channel/UCMdihazndR0f9XBoSXWqnYg), as well as watching or starring the github repo. 12 | 13 | You can look at our how-to guide by going to: https://www.aggieerin.com/shiny-server/. This information is also present in the help files for each function, however, pictures are included on the website. 14 | 15 | You can now install `MOTE` directly from CRAN: `install.packages("MOTE")`. 16 | 17 | To install the development version of the package take the following steps: 18 | 19 | 1) Install `devtools` if you do not have it. `devtools` is a package that allows you to install packages from github. 20 | `install.packages("devtools")` 21 | 22 | 2) Install the `MOTE` package by running the following: 23 | `devtools::install_github("doomlab/MOTE")` 24 | 25 | 3) Load the library to get started! 26 | `library(MOTE)` 27 | 28 | 4) Enjoy MOTE. 29 | 30 | You can also use the [Shiny App](http://aggieerin.com/shiny/mote/)! 31 | 32 | # Build information 33 | 34 | 1.0.3 - Fixed a few typos 35 | 36 | 1.0.2 - Updated mathematical error in `d.dep.t.rm` confidence interval calculation. 37 | 38 | 1.0.1 - Initial CRAN release 39 | -------------------------------------------------------------------------------- /data/.Rapp.history: -------------------------------------------------------------------------------- 1 | load("/Users/buchanan/OneDrive - Missouri State University/RESEARCH/2 projects/MOTE/data/dept_data.RData") 2 | -------------------------------------------------------------------------------- /data/bn1_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/bn1_data.RData -------------------------------------------------------------------------------- /data/bn2_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/bn2_data.RData -------------------------------------------------------------------------------- /data/chisq_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/chisq_data.RData -------------------------------------------------------------------------------- /data/dept_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/dept_data.RData -------------------------------------------------------------------------------- /data/indt_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/indt_data.RData -------------------------------------------------------------------------------- /data/mix2_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/mix2_data.RData -------------------------------------------------------------------------------- /data/rm1_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/rm1_data.RData -------------------------------------------------------------------------------- /data/rm2_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/rm2_data.RData -------------------------------------------------------------------------------- /data/singt_data.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/data/singt_data.RData -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite MOTE in publications, please use:") 2 | 3 | year <- sub("-.*", "", meta$Date) 4 | note <- sprintf("R package version %s", meta$Version) 5 | 6 | bibentry(bibtype = "Manual", 7 | title = "{MOTE: Measure of the Effect}: Package to assist in effect size calculations and their confidence intervals", 8 | author = c(person("Erin M.", "Buchanan"), 9 | person("Amber", "Gillenwaters"), 10 | person("John E.", "Scofield"), 11 | person("K.D.", "Valentine")), 12 | year = year, 13 | note = note, 14 | url = "http://github.com/doomlab/MOTE") 15 | -------------------------------------------------------------------------------- /man/.Rapp.history: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doomlab/MOTE/b6256ab4e0241badf267fa70a42bdef94e96cfb9/man/.Rapp.history -------------------------------------------------------------------------------- /man/apa.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/apa.R 3 | \name{apa} 4 | \alias{apa} 5 | \title{APA Format} 6 | \usage{ 7 | apa(value, decimals = 3, leading = TRUE) 8 | } 9 | \arguments{ 10 | \item{value}{A set of numeric values, either a single number, vector, or set of columns.} 11 | 12 | \item{decimals}{The number of decimal points desired in the output.} 13 | 14 | \item{leading}{Logical value: \code{TRUE} for leading zeroes on decimals 15 | and \code{FALSE} for no leading zeroes on decimals. The default is \code{TRUE}.} 16 | } 17 | \description{ 18 | A function that formats decimals and leading zeroes 19 | for creating reports in scientific style. 20 | } 21 | \details{ 22 | This function creates "pretty" character vectors from numeric variables 23 | for printing as part of a report. The value can take a single number, 24 | matrix, vector, or multiple columns from a data frame, as long as they are 25 | numeric. The values will be coerced into numeric if they are characters or 26 | logical values, but this process may result in an error if values are 27 | truly alphabetical. 28 | } 29 | \examples{ 30 | apa(value = 0.54674, decimals = 3, leading = TRUE) 31 | } 32 | \keyword{APA,} 33 | \keyword{decimals,} 34 | \keyword{formatting} 35 | -------------------------------------------------------------------------------- /man/bn1_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bn1-data.R 3 | \docType{data} 4 | \name{bn1_data} 5 | \alias{bn1_data} 6 | \title{Between Subjects One-way ANOVA Example Data} 7 | \format{ 8 | A data frame of ratings of close interpersonal attachments 9 | 10 | poor: individuals in poor health 11 | fair: individuals in fair health 12 | excellent: individuals in excellent health 13 | } 14 | \usage{ 15 | data(bn1_data) 16 | } 17 | \description{ 18 | Dataset for use in \code{\link{eta.F}}, \code{\link{eta.full.SS}}, 19 | \code{\link{omega.F}}, \code{\link{omega.full.SS}}, 20 | and \code{\link{epsilon.full.SS}}, including ratings of 21 | inter-personal attachments of 45-year-olds categorized as 22 | being in excellent, fair, or poor health. 23 | } 24 | \references{ 25 | Nolan and Heizen Statistics for the Behavioral Sciences 26 | (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 27 | } 28 | \keyword{datasets} 29 | -------------------------------------------------------------------------------- /man/bn2_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bn2-data.R 3 | \docType{data} 4 | \name{bn2_data} 5 | \alias{bn2_data} 6 | \title{Between Subjects Two-way ANOVA Example Data} 7 | \format{ 8 | A data frame of ratings of close interpersonal attachments 9 | 10 | coach: an old or new coach 11 | type: varying sports - baseball, basketball, football, soccer, volleyball 12 | money: athletic spending (in thousands of dollars) 13 | } 14 | \usage{ 15 | data(bn2_data) 16 | } 17 | \description{ 18 | Dataset for use in \code{\link{omega.partial.SS.bn}}, 19 | \code{\link{eta.partial.SS}}, and other between-subject's ANOVA 20 | designs. This data includes (fake) atheletic budgets for baseball, 21 | basketball, football, soccer, and volleyball teams 22 | with new and old coaches to determine if there are differences in 23 | spending across coaches and sports. 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/chisq_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chisq-data.R 3 | \docType{data} 4 | \name{chisq_data} 5 | \alias{chisq_data} 6 | \title{Chi-Square Example Data} 7 | \format{ 8 | A data frame of number of friends and number of children 9 | 10 | friends: number of reported friends 11 | kids: number of children 12 | } 13 | \usage{ 14 | data(chisq_data) 15 | } 16 | \description{ 17 | Dataset for use in \code{\link{v.chi.sq}}, 18 | Individuals were polled and asked to report their number of friends 19 | (low, medium, high) and number of kids (1, 2, 3+) 20 | to determine if there was a relationship between friend 21 | groups and number of children. It was hypothesized that 22 | those with more children may have less time for 23 | friendship maintaining activities. 24 | } 25 | \references{ 26 | Nolan and Heizen Statistics for the Behavioral Sciences 27 | (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 28 | } 29 | \keyword{datasets} 30 | -------------------------------------------------------------------------------- /man/d.dep.t.avg.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.dep.t.avg.R 3 | \name{d.dep.t.avg} 4 | \alias{d.dep.t.avg} 5 | \title{d for Dependent t with Average SD Denominator} 6 | \usage{ 7 | d.dep.t.avg(m1, m2, sd1, sd2, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m1}{mean from first level} 11 | 12 | \item{m2}{mean from second level} 13 | 14 | \item{sd1}{standard deviation from first level} 15 | 16 | \item{sd2}{standard deviation from second level} 17 | 18 | \item{n}{sample size} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | The effect size (Cohen's d) with associated confidence intervals, 24 | the confidence intervals associated with the means of each group, 25 | standard deviations of the means for each group. 26 | 27 | \item{d}{effect size} 28 | \item{dlow}{lower level confidence interval d value} 29 | \item{dhigh}{upper level confidence interval d value} 30 | \item{M1/M2}{mean one and two} 31 | \item{M1low/M2low}{lower level confidence interval of mean one or two} 32 | \item{M1high/M2high}{upper level confidence interval of mean one or two} 33 | \item{sd1/sd2}{standard deviation of mean one and two} 34 | \item{se1/se2}{standard error of mean one and two} 35 | \item{n}{sample size} 36 | \item{df}{degrees of freedom (sample size - 1)} 37 | \item{estimate}{the d statistic and confidence interval in APA style for markdown printing} 38 | } 39 | \description{ 40 | This function displays d and the non-central confidence interval 41 | for repeated measures data, using the average standard deviation of 42 | each level as the denominator. 43 | } 44 | \details{ 45 | To calculate d, mean two is subtracted from mean one, which is then 46 | divided by the average standard deviation. 47 | 48 | d_av = (m1 - m2) / ((sd1 + sd2) / 2) 49 | 50 | \href{https://www.aggieerin.com/shiny-server/tests/deptavgm.html}{Learn more on our example page.} 51 | } 52 | \examples{ 53 | 54 | #The following example is derived from the "dept_data" dataset included 55 | #in the MOTE library. 56 | 57 | #In a study to test the effects of science fiction movies on people's 58 | #belief in the supernatural, seven people completed a measure of belief 59 | #in the supernatural before and after watching a popular science fiction 60 | #movie. Higher scores indicated higher levels of belief. 61 | 62 | t.test(dept_data$before, dept_data$after, paired = TRUE) 63 | 64 | #You can type in the numbers directly, or refer to the dataset, 65 | #as shown below. 66 | 67 | d.dep.t.avg(m1 = 5.57, m2 = 4.43, sd1 = 1.99, 68 | sd2 = 2.88, n = 7, a = .05) 69 | 70 | d.dep.t.avg(5.57, 4.43, 1.99, 2.88, 7, .05) 71 | 72 | d.dep.t.avg(mean(dept_data$before), mean(dept_data$after), 73 | sd(dept_data$before), sd(dept_data$after), 74 | length(dept_data$before), .05) 75 | 76 | #The mean measure of belief on the pretest was 5.57, with a standard 77 | #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 78 | #but the dependent t-test was not significant using alpha = .05, 79 | #t(7) = 1.43, p = .203, d_av = 0.47. The effect size was a medium effect suggesting 80 | #that the movie may have influenced belief in the supernatural. 81 | } 82 | \keyword{average,} 83 | \keyword{cohen's} 84 | \keyword{d} 85 | \keyword{d,} 86 | \keyword{dependent} 87 | \keyword{effect} 88 | \keyword{measures} 89 | \keyword{paired-sample,} 90 | \keyword{repeated} 91 | \keyword{size,} 92 | \keyword{t-test,} 93 | -------------------------------------------------------------------------------- /man/d.dep.t.diff.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.dep.t.diff.R 3 | \name{d.dep.t.diff} 4 | \alias{d.dep.t.diff} 5 | \title{d for Dependent t with SD Difference Scores Denominator} 6 | \usage{ 7 | d.dep.t.diff(mdiff, sddiff, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{mdiff}{mean difference score} 11 | 12 | \item{sddiff}{standard deviation of the difference scores} 13 | 14 | \item{n}{sample size} 15 | 16 | \item{a}{significance level} 17 | } 18 | \value{ 19 | The effect size (Cohen's d) with associated confidence intervals, mean 20 | differences with associated confidence intervals, standard 21 | deviation of the differences, standard error, sample size, degrees of 22 | freedom, the t-statistic, and the p-value. 23 | 24 | \item{d}{effect size} 25 | \item{dlow}{lower level confidence interval d value} 26 | \item{dhigh}{upper level confidence interval d value} 27 | \item{mdiff}{mean difference score} 28 | \item{Mlow}{lower level of confidence interval of the mean} 29 | \item{Mhigh}{upper level of confidence interval of the mean} 30 | \item{sddiff}{standard deviation of the difference scores} 31 | \item{n}{sample size} 32 | \item{df}{degrees of freedom (sample size - 1)} 33 | \item{t}{t-statistic} 34 | \item{p}{p-value} 35 | \item{estimate}{the d statistic and confidence interval in 36 | APA style for markdown printing} 37 | \item{statistic}{the t-statistic in APA style for markdown printing} 38 | } 39 | \description{ 40 | This function displays d and the non-central confidence interval 41 | for repeated measures data, using the standard deviation 42 | of the difference score as the denominator. 43 | } 44 | \details{ 45 | To calculate d, the mean difference score is divided by 46 | divided by the standard deviation of the difference scores. 47 | 48 | d_z = mdiff / sddiff 49 | 50 | \href{https://www.aggieerin.com/shiny-server/tests/deptdiffm.html}{Learn more on our example page.} 51 | } 52 | \examples{ 53 | 54 | #The following example is derived from the "dept_data" dataset included 55 | #in the MOTE library. 56 | 57 | #In a study to test the effects of science fiction movies on people's 58 | #belief in the supernatural, seven people completed a measure of belief 59 | #in the supernatural before and after watching a popular science fiction movie. 60 | #Higher scores indicated higher levels of belief. The mean difference score was 1.14, 61 | #while the standard deviation of the difference scores was 2.12. 62 | 63 | #You can type in the numbers directly as shown below, 64 | #or refer to your dataset within the function. 65 | 66 | d.dep.t.diff(mdiff = 1.14, sddiff = 2.12, n = 7, a = .05) 67 | 68 | d.dep.t.diff(1.14, 2.12, 7, .05) 69 | 70 | d.dep.t.diff(mdiff = mean(dept_data$before - dept_data$after), 71 | sddiff = sd(dept_data$before - dept_data$after), 72 | n = length(dept_data$before), 73 | a = .05) 74 | 75 | #The mean measure of belief on the pretest was 5.57, with a standard 76 | #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 77 | #but the dependent t-test was not significant using alpha = .05, 78 | #t(7) = 1.43, p = .203, d_z = 0.54. The effect size was a medium 79 | #effect suggesting that the movie may have influenced belief 80 | #in the supernatural. 81 | 82 | } 83 | \keyword{dependent} 84 | \keyword{effect} 85 | \keyword{size,} 86 | \keyword{t-test} 87 | -------------------------------------------------------------------------------- /man/d.dep.t.diff.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.dep.t.diff.t.R 3 | \name{d.dep.t.diff.t} 4 | \alias{d.dep.t.diff.t} 5 | \title{d from t for Repeated Measures with SD Difference Scores Denominator} 6 | \usage{ 7 | d.dep.t.diff.t(t, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{t}{t-test value} 11 | 12 | \item{n}{sample size} 13 | 14 | \item{a}{significance level} 15 | } 16 | \value{ 17 | \item{d}{effect size} 18 | \item{dlow}{lower level confidence interval d value} 19 | \item{dhigh}{upper level confidence interval d value} 20 | \item{n}{sample size} 21 | \item{df}{degrees of freedom (sample size - 1)} 22 | \item{p}{p-value} 23 | \item{estimate}{the d statistic and confidence interval in APA 24 | style for markdown printing} 25 | \item{statistic}{the t-statistic in APA style for markdown printing} 26 | } 27 | \description{ 28 | This function displays d for repeated measures data 29 | and the non-central confidence interval using the 30 | standard deviation of the differences as the denominator 31 | estimating from the t-statistic. 32 | } 33 | \details{ 34 | To calculate d, the t-statistic is divided by the square root of the sample size. 35 | 36 | d_z = t / sqrt(n) 37 | 38 | \href{https://www.aggieerin.com/shiny-server/tests/deptdifft.html}{Learn more on our example page.} 39 | } 40 | \examples{ 41 | 42 | #The following example is derived from the "dept_data" dataset included 43 | #in the MOTE library. 44 | 45 | #In a study to test the effects of science fiction movies on people’s belief 46 | #in the supernatural, seven people completed a measure of belief in 47 | #the supernatural before and after watching a popular science 48 | #fiction movie. Higher scores indicated higher levels of belief. 49 | 50 | scifi = t.test(dept_data$before, dept_data$after, paired = TRUE) 51 | 52 | #The t-test value was 1.43. You can type in the numbers directly, 53 | #or refer to the dataset, as shown below. 54 | 55 | d.dep.t.diff.t(t = 1.43, n = 7, a = .05) 56 | 57 | d.dep.t.diff.t(1.43, 7, .05) 58 | 59 | d.dep.t.diff.t(scifi$statistic, length(dept_data$before), .05) 60 | 61 | #The mean measure of belief on the pretest was 5.57, with a standard 62 | #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 63 | #but the dependent t-test was not significant using alpha = .05, 64 | #t(7) = 1.43, p = .203, d_z = 0.54. The effect size was a medium effect suggesting 65 | #that the movie may have influenced belief in the supernatural. 66 | } 67 | \keyword{dependent} 68 | \keyword{effect} 69 | \keyword{measures,} 70 | \keyword{paired} 71 | \keyword{repeated} 72 | \keyword{sample,} 73 | \keyword{size,} 74 | \keyword{t-test} 75 | \keyword{t-test,} 76 | -------------------------------------------------------------------------------- /man/d.dep.t.rm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.dep.t.rm.R 3 | \name{d.dep.t.rm} 4 | \alias{d.dep.t.rm} 5 | \title{d for Repeated Measures with Average SD Denominator} 6 | \usage{ 7 | d.dep.t.rm(m1, m2, sd1, sd2, r, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m1}{mean from first level} 11 | 12 | \item{m2}{mean from second level} 13 | 14 | \item{sd1}{standard deviation from first level} 15 | 16 | \item{sd2}{standard deviation from second level} 17 | 18 | \item{r}{correlation between first and second level} 19 | 20 | \item{n}{sample size} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | Controls for correlation and provides the effect size (Cohen's d) 26 | with associated confidence intervals,m the confidence intervals associated 27 | with the means of each group,mstandard deviations and standard errors of 28 | the means for each group. 29 | 30 | \item{d}{effect size} 31 | \item{dlow}{lower level confidence interval d value} 32 | \item{dhigh}{upper level confidence interval d value} 33 | \item{M1}{mean one} 34 | \item{sd1}{standard deviation of mean one} 35 | \item{se1}{standard error of mean one} 36 | \item{M1low}{lower level confidence interval of mean one} 37 | \item{M1high}{upper level confidence interval of mean one} 38 | \item{M2}{mean two} 39 | \item{sd2}{standard deviation of mean two} 40 | \item{se2}{standard error of mean two} 41 | \item{M2low}{lower level confidence interval of mean two} 42 | \item{M2high}{upper level confidence interval of mean two} 43 | \item{r}{correlation} 44 | \item{n}{sample size} 45 | \item{df}{degrees of freedom (sample size - 1)} 46 | \item{estimate}{the d statistic and confidence interval in 47 | APA style for markdown printing} 48 | } 49 | \description{ 50 | This function displays d and the non-central confidence interval 51 | for repeated measures data, using the average standard deviation of 52 | each level as the denominator, but controlling for r. 53 | } 54 | \details{ 55 | To calculate d, mean two is subtracted from mean one, which is 56 | divided by the average standard deviation, while mathematically 57 | controlling for the correlation coefficient (r). 58 | 59 | d_rm = ((m1 - m2) / sqrt(( sd1^2 + sd2^2 ) - (2 x r x sd1 x sd2))) x sqrt(2 x (1-r)) 60 | 61 | \href{https://www.aggieerin.com/shiny-server/tests/deptrm.html}{Learn more on our example page.} 62 | } 63 | \examples{ 64 | 65 | #The following example is derived from the "dept_data" dataset included 66 | #in the MOTE library. 67 | 68 | #In a study to test the effects of science fiction movies on people's 69 | #belief in the supernatural, seven people completed a measure of belief 70 | #in the supernatural before and after watching a popular science fiction 71 | #movie. Higher scores indicated higher levels of belief. 72 | 73 | t.test(dept_data$before, dept_data$after, paired = TRUE) 74 | 75 | scifi_cor = cor(dept_data$before, dept_data$after, method = "pearson", 76 | use = "pairwise.complete.obs") 77 | 78 | #You can type in the numbers directly, or refer to the dataset, 79 | #as shown below. 80 | 81 | d.dep.t.rm(m1 = 5.57, m2 = 4.43, sd1 = 1.99, 82 | sd2 = 2.88, r = .68, n = 7, a = .05) 83 | 84 | d.dep.t.rm(5.57, 4.43, 1.99, 2.88, .68, 7, .05) 85 | 86 | d.dep.t.rm(mean(dept_data$before), mean(dept_data$after), 87 | sd(dept_data$before), sd(dept_data$after), 88 | scifi_cor, length(dept_data$before), .05) 89 | 90 | #The mean measure of belief on the pretest was 5.57, with a standard 91 | #deviation of 1.99. The posttest scores appeared lower (M = 4.43, SD = 2.88) 92 | #but the dependent t-test was not significant using alpha = .05, 93 | #t(7) = 1.43, p = .203, d_rm = 0.43. The effect size was a medium effect suggesting 94 | #that the movie may have influenced belief in the supernatural. 95 | 96 | } 97 | \keyword{cohen's} 98 | \keyword{correlation} 99 | \keyword{d,} 100 | \keyword{dependent} 101 | \keyword{effect} 102 | \keyword{measures,} 103 | \keyword{paired-sample,} 104 | \keyword{repeated} 105 | \keyword{size,} 106 | \keyword{t-test,} 107 | -------------------------------------------------------------------------------- /man/d.ind.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.ind.t.R 3 | \name{d.ind.t} 4 | \alias{d.ind.t} 5 | \title{d for Between Subjects with Pooled SD Denominator} 6 | \usage{ 7 | d.ind.t(m1, m2, sd1, sd2, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m1}{mean group one} 11 | 12 | \item{m2}{mean group two} 13 | 14 | \item{sd1}{standard deviation group one} 15 | 16 | \item{sd2}{standard deviation group two} 17 | 18 | \item{n1}{sample size group one} 19 | 20 | \item{n2}{sample size group two} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | Provides the effect size (Cohen's d) with associated confidence intervals, 26 | the t-statistic, the confidence intervals associated with the means of 27 | each group, as well as the standard deviations and standard errors 28 | of the means for each group. 29 | 30 | \item{d}{effect size} 31 | \item{dlow}{lower level confidence interval of d value} 32 | \item{dhigh}{upper level confidence interval of d value} 33 | \item{M1}{mean of group one} 34 | \item{sd1}{standard deviation of group one mean} 35 | \item{se1}{standard error of group one mean} 36 | \item{M1low}{lower level confidence interval of group one mean} 37 | \item{M1high}{upper level confidence interval of group one mean} 38 | \item{M2}{mean of group two} 39 | \item{sd2}{standard deviation of group two mean} 40 | \item{se2}{standard error of group two mean} 41 | \item{M2low}{lower level confidence interval of group two mean} 42 | \item{M2high}{upper level confidence interval of group two mean} 43 | \item{spooled}{pooled standard deviation} 44 | \item{sepooled}{pooled standard error} 45 | \item{n1}{sample size of group one} 46 | \item{n2}{sample size of group two} 47 | \item{df}{degrees of freedom (n1 - 1 + n2 - 1)} 48 | \item{t}{t-statistic} 49 | \item{p}{p-value} 50 | \item{estimate}{the d statistic and confidence interval in 51 | APA style for markdown printing} 52 | \item{statistic}{the t-statistic in APA style for markdown printing} 53 | } 54 | \description{ 55 | This function displays d for between subjects data 56 | and the non-central confidence interval using the 57 | pooled standard deviation as the denominator. 58 | } 59 | \details{ 60 | To calculate d, mean two is subtracted from mean one and divided 61 | by the pooled standard deviation. 62 | 63 | d_s = (m1 - m2) / spooled 64 | 65 | \href{https://www.aggieerin.com/shiny-server/tests/indtm.html}{Learn more on our example page.} 66 | } 67 | \examples{ 68 | 69 | #The following example is derived from the "indt_data" dataset, included 70 | #in the MOTE library. 71 | 72 | #A forensic psychologist conducted a study to examine whether 73 | #being hypnotized during recall affects how well a witness 74 | #can remember facts about an event. Eight participants 75 | #watched a short film of a mock robbery, after which 76 | #each participant was questioned about what he or she had 77 | #seen. The four participants in the experimental group 78 | #were questioned while they were hypnotized. The four 79 | #participants in the control group recieved the same 80 | #questioning without hypnosis. 81 | 82 | t.test(correctq ~ group, data = indt_data) 83 | 84 | #You can type in the numbers directly, or refer to the dataset, 85 | #as shown below. 86 | 87 | d.ind.t(m1 = 17.75, m2 = 23, sd1 = 3.30, 88 | sd2 = 2.16, n1 = 4, n2 = 4, a = .05) 89 | 90 | d.ind.t(17.75, 23, 3.30, 2.16, 4, 4, .05) 91 | 92 | d.ind.t(mean(indt_data$correctq[indt_data$group == 1]), 93 | mean(indt_data$correctq[indt_data$group == 2]), 94 | sd(indt_data$correctq[indt_data$group == 1]), 95 | sd(indt_data$correctq[indt_data$group == 2]), 96 | length(indt_data$correctq[indt_data$group == 1]), 97 | length(indt_data$correctq[indt_data$group == 2]), 98 | .05) 99 | 100 | #Contrary to the hypothesized result, the group that underwent hypnosis were 101 | #significantly less accurate while reporting facts than the control group 102 | #with a large effect size, t(6) = -2.66, p = .038, d_s = 1.88. 103 | 104 | } 105 | \keyword{between-subjects,} 106 | \keyword{deviation,} 107 | \keyword{effect} 108 | \keyword{independent} 109 | \keyword{pooled} 110 | \keyword{sd} 111 | \keyword{size,} 112 | \keyword{standard} 113 | \keyword{t,} 114 | -------------------------------------------------------------------------------- /man/d.ind.t.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.ind.t.t.R 3 | \name{d.ind.t.t} 4 | \alias{d.ind.t.t} 5 | \title{d from t for Between Subjects} 6 | \usage{ 7 | d.ind.t.t(t, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{t}{t-test value} 11 | 12 | \item{n1}{sample size group one} 13 | 14 | \item{n2}{sample size group two} 15 | 16 | \item{a}{significance level} 17 | } 18 | \value{ 19 | Provides the effect size (Cohen's d) with associated confidence intervals, 20 | degrees of freedom, t-statistic, and p-value. 21 | 22 | \item{d}{effect size} 23 | \item{dlow}{lower level confidence interval of d value} 24 | \item{dhigh}{upper level confidence interval of d value} 25 | \item{n1}{sample size} 26 | \item{n2}{sample size} 27 | \item{df}{degrees of freedom (n1 - 1 + n2 - 1)} 28 | \item{t}{t-statistic} 29 | \item{p}{p-value} 30 | \item{estimate}{the d statistic and confidence interval in APA style for markdown printing} 31 | \item{statistic}{the t-statistic in APA for the t-test} 32 | } 33 | \description{ 34 | This function displays d for between subjects data 35 | and the non-central confidence interval estimating from the t-statistic. 36 | } 37 | \details{ 38 | To calculate d, the t-statistic is multiplied by two then divided by 39 | the square root of the degrees of freedom. 40 | 41 | d_s = 2 * t / sqrt(n1 + n2 - 2) 42 | 43 | \href{https://www.aggieerin.com/shiny-server/tests/indtt.html}{Learn more on our example page.} 44 | } 45 | \examples{ 46 | 47 | #The following example is derived from the "indt_data" dataset, included 48 | #in the MOTE library. 49 | 50 | #A forensic psychologist conducted a study to examine whether 51 | #being hypnotized during recall affects how well a witness 52 | #can remember facts about an event. Eight participants 53 | #watched a short film of a mock robbery, after which 54 | #each participant was questioned about what he or she had 55 | #seen. The four participants in the experimental group 56 | #were questioned while they were hypnotized. The four 57 | #participants in the control group recieved the same 58 | #questioning without hypnosis. 59 | 60 | hyp = t.test(correctq ~ group, data = indt_data) 61 | 62 | #You can type in the numbers directly, or refer to the dataset, 63 | #as shown below. 64 | 65 | d.ind.t.t(t = -2.6599, n1 = 4, n2 = 4, a = .05) 66 | 67 | d.ind.t.t(-2.6599, 4, 4, .05) 68 | 69 | d.ind.t.t(hyp$statistic, 70 | length(indt_data$group[indt_data$group == 1]), 71 | length(indt_data$group[indt_data$group == 2]), 72 | .05) 73 | 74 | #Contrary to the hypothesized result, the group that underwent hypnosis were 75 | #significantly less accurate while reporting facts than the control group 76 | #with a large effect size, t(6) = -2.66, p = .038, d_s = 2.17. 77 | 78 | } 79 | \keyword{effect} 80 | \keyword{independent} 81 | \keyword{size,} 82 | \keyword{t} 83 | -------------------------------------------------------------------------------- /man/d.prop.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.prop.R 3 | \name{d.prop} 4 | \alias{d.prop} 5 | \title{d for Independent Proportions} 6 | \usage{ 7 | d.prop(p1, p2, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{p1}{proportion for group one} 11 | 12 | \item{p2}{proportion for group two} 13 | 14 | \item{n1}{sample size group one} 15 | 16 | \item{n2}{sample size group two} 17 | 18 | \item{a}{significance level} 19 | } 20 | \value{ 21 | \item{d}{effect size} 22 | \item{dlow}{lower level confidence interval d value} 23 | \item{dhigh}{upper level confidence interval d value} 24 | \item{p1}{proportion of group one} 25 | \item{se1}{standard error of the proportion of group one} 26 | \item{z1}{z-statistic group one} 27 | \item{z1low}{lower level confidence interval of z} 28 | \item{z1high}{upper level confidence interval of z} 29 | \item{p2}{proportion of group two} 30 | \item{se2}{standard error of the proportion of group two} 31 | \item{z2}{z-statistic of group two} 32 | \item{z2low}{lower level confidence interval of z} 33 | \item{z2high}{upper level confidence interval of z} 34 | \item{n1}{sample size group one} 35 | \item{n2}{sample size group two} 36 | \item{z}{z-statistic for the differences} 37 | \item{ppooled}{pooled proportion to calculate standard error} 38 | \item{se}{standard error} 39 | \item{p}{p-value for the differences} 40 | \item{estimate}{the d statistic and confidence interval in 41 | APA style for markdown printing} 42 | \item{statistic}{the t-statistic in APA style for markdown printing} 43 | } 44 | \description{ 45 | This function displays d and central confidence interval 46 | calculated from differences in independent proportions. 47 | Independent proportions are two percentages that are from 48 | different groups of participants. 49 | } 50 | \details{ 51 | To calculate z, the proportion of group two is substracted 52 | from group one, which is then divided by the standard error. 53 | 54 | z = (p1 - p2) / se 55 | 56 | To calculate d, the proportion of group two is divided by 57 | the standard error of group two which is then subtracted 58 | from the proportion of group one divided by the standard 59 | error of group one. 60 | 61 | z1 = p1 / se1 62 | 63 | z2 = p2 / se2 64 | 65 | d = z1 - z2 66 | 67 | \href{https://www.aggieerin.com/shiny-server/tests/indtprop.html}{Learn more on our example page.} 68 | } 69 | \examples{ 70 | 71 | #Several researchers were examining the data on the number 72 | #of students who retake a course after they receive a D, F, 73 | #or withdraw from the course. They randomly sampled form 74 | #a large university two groups of students: traditional 75 | #(less than 25 years old) and non-traditional (25 and older). 76 | #Each group included 100 participants. About 25\% of students 77 | #of the traditional group reported they would retake a course, 78 | #while the non-traditional group showed about 35\% would 79 | #retake the course. 80 | 81 | #You can type in the numbers directly as shown below, 82 | #or refer to your dataset within the function. 83 | 84 | d.prop(p1 = .25, p2 = .35, n1 = 100, n2 = 100, a = .05) 85 | 86 | d.prop(.25, .35, 100, 100, .05) 87 | } 88 | \keyword{effect} 89 | \keyword{independent} 90 | \keyword{prop} 91 | \keyword{proportions} 92 | \keyword{proportions,} 93 | \keyword{size,} 94 | \keyword{test,} 95 | -------------------------------------------------------------------------------- /man/d.single.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.single.t.R 3 | \name{d.single.t} 4 | \alias{d.single.t} 5 | \title{d for Single t from Means} 6 | \usage{ 7 | d.single.t(m, u, sd, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m}{sample mean} 11 | 12 | \item{u}{population mean} 13 | 14 | \item{sd}{sample standard deviation} 15 | 16 | \item{n}{sample size} 17 | 18 | \item{a}{significance level} 19 | } 20 | \value{ 21 | \item{d}{effect size} 22 | \item{dlow}{lower level confidence interval d value} 23 | \item{dhigh}{upper level confidence interval d value} 24 | \item{m}{sample mean} 25 | \item{sd}{standard deviation of the sample} 26 | \item{se}{standard error of the sample} 27 | \item{Mlow}{lower level confidence interval of the sample mean} 28 | \item{Mhigh}{upper level confidence interval of the sample mean} 29 | \item{u}{population mean} 30 | \item{n}{sample size} 31 | \item{df}{degrees of freedom (n - 1)} 32 | \item{t}{t-statistic} 33 | \item{p}{p-value} 34 | \item{estimate}{the d statistic and confidence interval in 35 | APA style for markdown printing} 36 | \item{statistic}{the t-statistic in APA style for markdown printing} 37 | } 38 | \description{ 39 | This function displays d and non-central confidence interval for single t from means. 40 | } 41 | \details{ 42 | To calculate d, the population is subtracted from the sample mean, 43 | which is then divided by the standard deviation. 44 | 45 | d = (m - u) / sd 46 | 47 | \href{https://www.aggieerin.com/shiny-server/tests/singletm.html}{Learn more on our example page.} 48 | } 49 | \examples{ 50 | 51 | #The following example is derived from the "singt_data" dataset included 52 | #in the MOTE library. 53 | 54 | #A school has a gifted/honors program that they claim is 55 | #significantly better than others in the country. The gifted/honors 56 | #students in this school scored an average of 1370 on the SAT, 57 | #with a standard deviation of 112.7, while the national average 58 | #for gifted programs is a SAT score of 1080. 59 | 60 | gift = t.test(singt_data, mu = 1080, alternative = "two.sided") 61 | 62 | #You can type in the numbers directly as shown below, 63 | #or refer to your dataset within the function. 64 | 65 | d.single.t(m = 1370, u = 1080, sd = 112.7, n = 14, a = .05) 66 | 67 | d.single.t(1370, 1080, 112.7, 100, .05) 68 | 69 | d.single.t(gift$estimate, gift$null.value, 70 | sd(singt_data$SATscore), 71 | length(singt_data$SATscore), .05) 72 | } 73 | \keyword{effect} 74 | \keyword{mean} 75 | \keyword{mean,} 76 | \keyword{mu,} 77 | \keyword{population} 78 | \keyword{sample} 79 | \keyword{single} 80 | \keyword{single-sample,} 81 | \keyword{size,} 82 | \keyword{t,} 83 | \keyword{u,} 84 | -------------------------------------------------------------------------------- /man/d.single.t.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.single.t.t.R 3 | \name{d.single.t.t} 4 | \alias{d.single.t.t} 5 | \title{d for Single t from t} 6 | \usage{ 7 | d.single.t.t(t, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{t}{t-test value} 11 | 12 | \item{n}{sample size} 13 | 14 | \item{a}{significance level} 15 | } 16 | \value{ 17 | The effect size (Cohen's d) with associated confidence intervals 18 | and relevant statistics. 19 | 20 | \item{d}{effect size} 21 | \item{dlow}{lower level confidence interval d value} 22 | \item{dhigh}{upper level confidence interval d value} 23 | \item{n}{sample size} 24 | \item{df}{degrees of freedom (sample size - 1)} 25 | \item{t}{sig stats} 26 | \item{p}{p-value} 27 | \item{estimate}{the d statistic and confidence interval in 28 | APA style for markdown printing} 29 | \item{statistic}{the t-statistic in APA style for markdown printing} 30 | } 31 | \description{ 32 | This function displays d and non-central confidence interval for single t 33 | estimated from the t-statistic. 34 | } 35 | \details{ 36 | To calculate d, the t-statistic is divided by the square root of the sample size. 37 | 38 | d = t / sqrt(n) 39 | 40 | \href{https://www.aggieerin.com/shiny-server/tests/singlett.html}{Learn more on our example page.} 41 | } 42 | \examples{ 43 | 44 | #A school has a gifted/honors program that they claim is 45 | #significantly better than others in the country. The gifted/honors 46 | #students in this school scored an average of 1370 on the SAT, 47 | #with a standard deviation of 112.7, while the national average 48 | #for gifted programs is a SAT score of 1080. 49 | 50 | gift = t.test(singt_data, mu = 1080, alternative = "two.sided") 51 | 52 | #According to a single-sample t-test, the scores of the students 53 | #from the program were significantly higher than the national 54 | #average, t(14) = 9.97, p < .001. 55 | 56 | #You can type in the numbers directly as shown below, or refer 57 | #to your dataset within the function. 58 | 59 | d.single.t.t(t = 9.968, n = 15, a = .05) 60 | 61 | d.single.t.t(9.968, 15, .05) 62 | 63 | d.single.t.t(gift$statistic, length(singt_data$SATscore), .05) 64 | } 65 | \keyword{effect} 66 | \keyword{single} 67 | \keyword{size,} 68 | \keyword{t} 69 | -------------------------------------------------------------------------------- /man/d.to.r.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.to.r.R 3 | \name{d.to.r} 4 | \alias{d.to.r} 5 | \title{r and Coefficient of Determination (R2) from d} 6 | \usage{ 7 | d.to.r(d, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{d}{effect size statistic} 11 | 12 | \item{n1}{sample size group one} 13 | 14 | \item{n2}{sample size group two} 15 | 16 | \item{a}{significance level} 17 | } 18 | \value{ 19 | Provides the effect size (correlation coefficient) with associated 20 | confidence intervals, the t-statistic, F-statistic, and other estimates 21 | appropriate for d to r translation. Note this CI is not based on the 22 | traditional r-to-z transformation but rather non-central F using the 23 | ci.R function from MBESS. 24 | 25 | \item{r}{correlation coefficient} 26 | \item{rlow}{lower level confidence interval r} 27 | \item{rhigh}{upper level confidence interval r} 28 | \item{R2}{coefficient of determination} 29 | \item{R2low}{lower level confidence interval of R2} 30 | \item{R2high}{upper level confidence interval of R2} 31 | \item{se}{standard error} 32 | \item{n}{sample size} 33 | \item{dfm}{degrees of freedom of mean} 34 | \item{dfe}{degrees of freedom error} 35 | \item{t}{t-statistic} 36 | \item{F}{F-statistic} 37 | \item{p}{p-value} 38 | \item{estimate}{the r statistic and confidence interval in 39 | APA style for markdown printing} 40 | \item{estimateR2}{the R^2 statistic and confidence interval in 41 | APA style for markdown printing} 42 | \item{statistic}{the t-statistic in APA style for markdown printing} 43 | } 44 | \description{ 45 | Calculates r from d and then translates r to r2 to calculate 46 | the non-central confidence interval for r2 using the F distribution. 47 | } 48 | \details{ 49 | The correlation coefficient (r) is calculated by dividing Cohen's d 50 | by the square root of the total sample size squared - divided 51 | by the product of the sample sizes of group one and group two. 52 | 53 | r = d / sqrt(d^2 + (n1 + n2)^2 / (n1*n2)) 54 | 55 | \href{https://www.aggieerin.com/shiny-server/tests/dtor.html}{Learn more on our example page.} 56 | } 57 | \examples{ 58 | 59 | #The following example is derived from the "indt_data" dataset, included 60 | #in the MOTE library. 61 | 62 | #A forensic psychologist conducted a study to examine whether 63 | #being hypnotized during recall affects how well a witness 64 | #can remember facts about an event. Eight participants 65 | #watched a short film of a mock robbery, after which 66 | #each participant was questioned about what he or she had 67 | #seen. The four participants in the experimental group 68 | #were questioned while they were hypnotized. The four 69 | #participants in the control group recieved the same 70 | #questioning without hypnosis. 71 | 72 | t.test(correctq ~ group, data = indt_data) 73 | 74 | #You can type in the numbers directly, or refer to the dataset, 75 | #as shown below. 76 | 77 | d.ind.t(m1 = 17.75, m2 = 23, sd1 = 3.30, 78 | sd2 = 2.16, n1 = 4, n2 = 4, a = .05) 79 | 80 | d.ind.t(17.75, 23, 3.30, 2.16, 4, 4, .05) 81 | 82 | d.ind.t(mean(indt_data$correctq[indt_data$group == 1]), 83 | mean(indt_data$correctq[indt_data$group == 2]), 84 | sd(indt_data$correctq[indt_data$group == 1]), 85 | sd(indt_data$correctq[indt_data$group == 2]), 86 | length(indt_data$correctq[indt_data$group == 1]), 87 | length(indt_data$correctq[indt_data$group == 2]), 88 | .05) 89 | 90 | #Contrary to the hypothesized result, the group that underwent 91 | #hypnosis were significantly less accurate while reporting 92 | #facts than the control group with a large effect size, t(6) = -2.66, 93 | #p = .038, d_s = 1.88. 94 | 95 | d.to.r(d = -1.88, n1 = 4, n2 = 4, a = .05) 96 | } 97 | \keyword{correlation} 98 | \keyword{effect} 99 | \keyword{size,} 100 | -------------------------------------------------------------------------------- /man/d.z.mean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.z.mean.R 3 | \name{d.z.mean} 4 | \alias{d.z.mean} 5 | \title{d for Z-test from Population Mean and SD} 6 | \usage{ 7 | d.z.mean(mu, m1, sig, sd1, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{mu}{population mean} 11 | 12 | \item{m1}{sample study mean} 13 | 14 | \item{sig}{population standard deviation} 15 | 16 | \item{sd1}{standard deviation from the study} 17 | 18 | \item{n}{sample size} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | The effect size (Cohen's d) with associated confidence intervals 24 | and relevant statistics. 25 | 26 | \item{d}{effect size} 27 | \item{dlow}{lower level confidence interval d value} 28 | \item{dhigh}{upper level confidence interval d value} 29 | \item{M1}{mean of sample} 30 | \item{sd1}{standard deviation of sample} 31 | \item{se1}{standard error of sample} 32 | \item{M1low}{lower level confidence interval of the mean} 33 | \item{M1high}{upper level confidence interval of the mean} 34 | \item{Mu}{population mean} 35 | \item{Sigma}{standard deviation of population} 36 | \item{se2}{standard error of population} 37 | \item{z}{z-statistic} 38 | \item{p}{p-value} 39 | \item{n}{sample size} 40 | \item{estimate}{the d statistic and confidence interval in 41 | APA style for markdown printing} 42 | \item{statistic}{the Z-statistic in APA style for markdown printing} 43 | } 44 | \description{ 45 | This function displays d for Z-test with the 46 | population mean and standard deviation. 47 | The normal confidence interval is also provided. 48 | } 49 | \details{ 50 | d is calculated by deducting the population mean from the sample study mean 51 | and dividing by the alpha level. 52 | 53 | d = (m1 - mu) / sig 54 | 55 | \href{https://www.aggieerin.com/shiny-server/tests/zm.html}{Learn more on our example page.} 56 | } 57 | \examples{ 58 | 59 | #The average quiz test taking time for a 10 item test is 22.5 60 | #minutes, with a standard deviation of 10 minutes. My class of 61 | #25 students took 19 minutes on the test with a standard deviation of 5. 62 | 63 | d.z.mean(mu = 22.5, m1 = 19, sig = 10, sd1 = 5, n = 25, a = .05) 64 | } 65 | \keyword{effect} 66 | \keyword{size,} 67 | \keyword{z-test} 68 | -------------------------------------------------------------------------------- /man/d.z.z.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/d.z.z.R 3 | \name{d.z.z} 4 | \alias{d.z.z} 5 | \title{d from z-statistic for Z-test} 6 | \usage{ 7 | d.z.z(z, sig = NA, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{z}{z statistic} 11 | 12 | \item{sig}{population standard deviation} 13 | 14 | \item{n}{sample size} 15 | 16 | \item{a}{significance level} 17 | } 18 | \value{ 19 | The effect size (Cohen's d) with associated confidence intervals and 20 | relevant statistics. 21 | 22 | \item{d}{effect size} 23 | \item{dlow}{lower level confidence interval d value} 24 | \item{dhigh}{upper level confidence interval d value} 25 | \item{sigma}{sample size} 26 | \item{z}{sig stats} 27 | \item{p}{p-value} 28 | \item{n}{sample size} 29 | \item{estimate}{the d statistic and confidence interval in 30 | APA style for markdown printing} 31 | \item{statistic}{the Z-statistic in APA style for markdown printing} 32 | } 33 | \description{ 34 | This function displays d for Z-tests when all you have is the z-statistic. 35 | The normal confidence interval is also provided if you have sigma. 36 | If sigma is left blank, then you will not see a confidence interval. 37 | } 38 | \details{ 39 | To calculate d, z is divided by the square root of N. 40 | 41 | d = z / sqrt(N) 42 | 43 | \href{https://www.aggieerin.com/shiny-server/tests/zz.html}{Learn more on our example page.} 44 | } 45 | \examples{ 46 | 47 | #A recent study suggested that students (N = 100) learning 48 | #statistics improved their test scores with the use of 49 | #visual aids (Z = 2.5). The population standard deviation is 4. 50 | 51 | #You can type in the numbers directly as shown below, 52 | #or refer to your dataset within the function. 53 | 54 | d.z.z(z = 2.5, sig = 4, n = 100, a = .05) 55 | 56 | d.z.z(z = 2.5, n = 100, a = .05) 57 | 58 | d.z.z(2.5, 4, 100, .05) 59 | } 60 | \keyword{effect} 61 | \keyword{size,} 62 | \keyword{z-test} 63 | -------------------------------------------------------------------------------- /man/delta.ind.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/delta.ind.t.R 3 | \name{delta.ind.t} 4 | \alias{delta.ind.t} 5 | \title{d-delta for Between Subjects with Control Group SD Denominator} 6 | \usage{ 7 | delta.ind.t(m1, m2, sd1, sd2, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m1}{mean from control group} 11 | 12 | \item{m2}{mean from experimental group} 13 | 14 | \item{sd1}{standard deviation from control group} 15 | 16 | \item{sd2}{standard deviation from experimental group} 17 | 18 | \item{n1}{sample size from control group} 19 | 20 | \item{n2}{sample size from experimental group} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | Provides the effect size (Cohen's d) with associated confidence intervals, 26 | the t-statistic, the confidence intervals associated with the means of each group, as well as the 27 | standard deviations and standard errors of the means for each group. 28 | 29 | \item{d}{d-delta effect size} 30 | \item{dlow}{lower level confidence interval of d-delta value} 31 | \item{dhigh}{upper level confidence interval of d-delta value} 32 | \item{M1}{mean of group one} 33 | \item{sd1}{standard deviation of group one mean} 34 | \item{se1}{standard error of group one mean} 35 | \item{M1low}{lower level confidence interval of group one mean} 36 | \item{M1high}{upper level confidence interval of group one mean} 37 | \item{M2}{mean of group two} 38 | \item{sd2}{standard deviation of group two mean} 39 | \item{se2}{standard error of group two mean} 40 | \item{M2low}{lower level confidence interval of group two mean} 41 | \item{M2high}{upper level confidence interval of group two mean} 42 | \item{spooled}{pooled standard deviation} 43 | \item{sepooled}{pooled standard error} 44 | \item{n1}{sample size of group one} 45 | \item{n2}{sample size of group two} 46 | \item{df}{degrees of freedom (n1 - 1 + n2 - 1)} 47 | \item{t}{t-statistic} 48 | \item{p}{p-value} 49 | \item{estimate}{the d statistic and confidence interval in 50 | APA style for markdown printing} 51 | \item{statistic}{the t-statistic in APA style for markdown printing} 52 | } 53 | \description{ 54 | This function displays d-delta for between subjects data 55 | and the non-central confidence interval using the 56 | control group standard deviation as the denominator. 57 | } 58 | \details{ 59 | To calculate d-delta, the mean of the experimental group 60 | is subtracted from the mean of the control group, which 61 | is divided by the standard deviation of the control group. 62 | 63 | d_delta = (m1 - m2) / sd1 64 | 65 | \href{https://www.aggieerin.com/shiny-server/tests/indtdelta.html}{Learn more on our example page.} 66 | } 67 | \examples{ 68 | 69 | #The following example is derived from the "indt_data" dataset, included 70 | #in the MOTE library. 71 | 72 | #A forensic psychologist conducted a study to examine whether 73 | #being hypnotized during recall affects how well a witness 74 | #can remember facts about an event. Eight participants 75 | #watched a short film of a mock robbery, after which 76 | #each participant was questioned about what he or she had 77 | #seen. The four participants in the experimental group 78 | #were questioned while they were hypnotized. The four 79 | #participants in the control group recieved the same 80 | #questioning without hypnosis. 81 | 82 | hyp = t.test(correctq ~ group, data = indt_data) 83 | 84 | #You can type in the numbers directly, or refer to the dataset, 85 | #as shown below. 86 | 87 | delta.ind.t(m1 = 17.75, m2 = 23, 88 | sd1 = 3.30, sd2 = 2.16, 89 | n1 = 4, n2 = 4, a = .05) 90 | 91 | delta.ind.t(17.75, 23, 3.30, 2.16, 4, 4, .05) 92 | 93 | delta.ind.t(mean(indt_data$correctq[indt_data$group == 1]), 94 | mean(indt_data$correctq[indt_data$group == 2]), 95 | sd(indt_data$correctq[indt_data$group == 1]), 96 | sd(indt_data$correctq[indt_data$group == 2]), 97 | length(indt_data$correctq[indt_data$group == 1]), 98 | length(indt_data$correctq[indt_data$group == 2]), 99 | .05) 100 | 101 | #Contrary to the hypothesized result, the group that underwent hypnosis were 102 | #significantly less accurate while reporting facts than the control group 103 | #with a large effect size, t(6) = -2.66, p = .038, d_delta = 1.59. 104 | 105 | } 106 | \keyword{delta,} 107 | \keyword{effect} 108 | \keyword{independent} 109 | \keyword{size,} 110 | \keyword{t} 111 | -------------------------------------------------------------------------------- /man/dept_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dept-data.R 3 | \docType{data} 4 | \name{dept_data} 5 | \alias{dept_data} 6 | \title{Dependent t Example Data} 7 | \format{ 8 | A data frame of before and after scores for rating 9 | supernatural beliefs. 10 | 11 | before: scores rated before watching a scifi movie 12 | after: scores rated after watching a scifi movie 13 | } 14 | \usage{ 15 | data(dept_data) 16 | } 17 | \description{ 18 | Dataset for use in \code{\link{d.dep.t.diff}}, \code{\link{d.dep.t.diff.t}}, 19 | \code{\link{d.dep.t.avg}}, and \code{\link{d.dep.t.rm}} exploring the before 20 | and after effects of scifi movies on supernatural beliefs. 21 | } 22 | \references{ 23 | Nolan and Heizen Statistics for the Behavioral Sciences 24 | (\href{https://www.macmillanlearning.com/Catalog/product/statisticsforthebehavioralsciences-rentalonly-fourthedition-nolan}{Book Link}) 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/epsilon.full.SS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/epsilon.full.SS.R 3 | \name{epsilon.full.SS} 4 | \alias{epsilon.full.SS} 5 | \title{Epsilon for ANOVA from F and Sum of Squares} 6 | \usage{ 7 | epsilon.full.SS(dfm, dfe, msm, mse, sst, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{msm}{mean square for the model/IV/between} 15 | 16 | \item{mse}{mean square for the error/residual/within} 17 | 18 | \item{sst}{sum of squares total} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | Provides the effect size (epsilon) with associated 24 | confidence intervals from the F-statistic. 25 | 26 | \item{epsilon}{effect size} 27 | \item{epsilonlow}{lower level confidence interval of epsilon} 28 | \item{epsilonhigh}{upper level confidence interval of epsilon} 29 | \item{dfm}{degrees of freedom for the model/IV/between} 30 | \item{dfe}{degrees of freedom for the error/residual/within} 31 | \item{F}{F-statistic} 32 | \item{p}{p-value} 33 | \item{estimate}{the epsilon statistic and confidence interval in 34 | APA style for markdown printing} 35 | \item{statistic}{the F-statistic in APA style for markdown printing} 36 | } 37 | \description{ 38 | This function displays epsilon squared from ANOVA analyses 39 | and its non-central confidence interval based on the F distribution. 40 | This formula works for one way and multi way designs with careful 41 | focus on the sum of squares total calculation. 42 | } 43 | \details{ 44 | To calculate epsilon, first, the mean square for the error is 45 | substracted from the mean square for the model. The difference 46 | is multiplied by the degrees of freedom for the model. The 47 | product is divided by the sum of squares total. 48 | 49 | epsilon^2 = (dfm * (msm - mse)) / (sst) 50 | 51 | \href{https://www.aggieerin.com/shiny-server/tests/epsilon.html}{Learn more on our example page.} 52 | } 53 | \examples{ 54 | 55 | #The following example is derived from the "bn1_data" dataset, included 56 | #in the MOTE library. 57 | 58 | #A health psychologist recorded the number of close inter-personal 59 | #attachments of 45-year-olds who were in excellent, fair, or poor 60 | #health. People in the Excellent Health group had 4, 3, 2, and 3 61 | #close attachments; people in the Fair Health group had 3, 5, 62 | #and 8 close attachments; and people in the Poor Health group 63 | #had 3, 1, 0, and 2 close attachments. 64 | 65 | anova_model = lm(formula = friends ~ group, data = bn1_data) 66 | summary.aov(anova_model) 67 | 68 | epsilon.full.SS(dfm = 2, dfe = 8, msm = 12.621, 69 | mse = 2.458, sst = (25.24+19.67), a = .05) 70 | } 71 | \keyword{ANOVA} 72 | \keyword{effect} 73 | \keyword{epsilon,} 74 | \keyword{size,} 75 | -------------------------------------------------------------------------------- /man/eta.F.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/eta.F.R 3 | \name{eta.F} 4 | \alias{eta.F} 5 | \title{Eta and Coefficient of Determination (R2) for ANOVA from F} 6 | \usage{ 7 | eta.F(dfm, dfe, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{Fvalue}{F statistic} 15 | 16 | \item{a}{significance level} 17 | } 18 | \value{ 19 | Provides eta with associated confidence intervals and relevant statistics. 20 | 21 | \item{eta}{effect size} 22 | \item{etalow}{lower level confidence interval of eta} 23 | \item{etahigh}{upper level confidence interval of eta} 24 | \item{dfm}{degrees of freedom for the model/IV/between} 25 | \item{dfe}{degrees of freedom for the error/resisual/within} 26 | \item{F}{F-statistic} 27 | \item{p}{p-value} 28 | \item{estimate}{the eta squared statistic and confidence interval in 29 | APA style for markdown printing} 30 | \item{statistic}{the F-statistic in APA style for markdown printing} 31 | } 32 | \description{ 33 | This function displays eta squared from ANOVA analyses 34 | and their non-central confidence interval based on the F distribution. 35 | These values are calculated directly from F statistics and can be used 36 | for between subjects and repeated measures designs. 37 | Remember if you have two or more IVs, these values are partial eta squared. 38 | } 39 | \details{ 40 | Eta is calculated by multiplying the degrees of freedom of 41 | the model by the F-statistic. This is divided by the product 42 | of degrees of freedom of the model, the F-statistic, and 43 | the degrees of freedom for the error or residual. 44 | 45 | eta^2 = (dfm * Fvalue) / (dfm * Fvalue + dfe) 46 | 47 | \href{https://www.aggieerin.com/shiny-server/tests/etaf.html}{Learn more on our example page.} 48 | } 49 | \examples{ 50 | 51 | #The following example is derived from the "bn1_data" dataset, included 52 | #in the MOTE library. 53 | 54 | #A health psychologist recorded the number of close inter-personal 55 | #attachments of 45-year-olds who were in excellent, fair, or poor 56 | #health. People in the Excellent Health group had 4, 3, 2, and 3 57 | #close attachments; people in the Fair Health group had 3, 5, 58 | #and 8 close attachments; and people in the Poor Health group 59 | #had 3, 1, 0, and 2 close attachments. 60 | 61 | anova_model = lm(formula = friends ~ group, data = bn1_data) 62 | summary.aov(anova_model) 63 | 64 | eta.F(dfm = 2, dfe = 8, 65 | Fvalue = 5.134, a = .05) 66 | } 67 | \keyword{ANOVA} 68 | \keyword{effect} 69 | \keyword{eta,} 70 | \keyword{size,} 71 | -------------------------------------------------------------------------------- /man/eta.full.SS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/eta.full.SS.R 3 | \name{eta.full.SS} 4 | \alias{eta.full.SS} 5 | \title{Eta for ANOVA from F and Sum of Squares} 6 | \usage{ 7 | eta.full.SS(dfm, dfe, ssm, sst, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{ssm}{sum of squares for the model/IV/between} 15 | 16 | \item{sst}{sum of squares total} 17 | 18 | \item{Fvalue}{F statistic} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | Provides eta with associated confidence intervals and relevant statistics. 24 | 25 | \item{eta}{effect size} 26 | \item{etalow}{lower level confidence interval of eta} 27 | \item{etahigh}{upper level confidence interval of eta} 28 | \item{dfm}{degrees of freedom for the model/IV/between} 29 | \item{dfe}{degrees of freedom for the error/resisual/within} 30 | \item{F}{F-statistic} 31 | \item{p}{p-value} 32 | \item{estimate}{the eta squared statistic and confidence interval in 33 | APA style for markdown printing} 34 | \item{statistic}{the F-statistic in APA style for markdown printing} 35 | } 36 | \description{ 37 | This function displays eta squared from ANOVA analyses 38 | and its non-central confidence interval based on the F distribution. 39 | This formula works for one way and multi way designs with careful 40 | focus on the sum of squares total. 41 | } 42 | \details{ 43 | Eta squared is calculated by dividing the sum of squares for the model 44 | by the sum of squares total. 45 | 46 | eta^2 = ssm / sst 47 | 48 | \href{https://www.aggieerin.com/shiny-server/tests/etass.html}{Learn more on our example page.} 49 | } 50 | \examples{ 51 | 52 | #The following example is derived from the "bn1_data" dataset, included 53 | #in the MOTE library. 54 | 55 | #A health psychologist recorded the number of close inter-personal 56 | #attachments of 45-year-olds who were in excellent, fair, or poor 57 | #health. People in the Excellent Health group had 4, 3, 2, and 3 58 | #close attachments; people in the Fair Health group had 3, 5, 59 | #and 8 close attachments; and people in the Poor Health group 60 | #had 3, 1, 0, and 2 close attachments. 61 | 62 | anova_model = lm(formula = friends ~ group, data = bn1_data) 63 | summary.aov(anova_model) 64 | 65 | eta.full.SS(dfm = 2, dfe = 8, ssm = 25.24, 66 | sst = (25.24+19.67), Fvalue = 5.134, a = .05) 67 | } 68 | \keyword{ANOVA} 69 | \keyword{effect} 70 | \keyword{eta,} 71 | \keyword{size,} 72 | -------------------------------------------------------------------------------- /man/eta.partial.SS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/eta.partial.SS.R 3 | \name{eta.partial.SS} 4 | \alias{eta.partial.SS} 5 | \title{Partial Eta Squared for ANOVA from F and Sum of Squares} 6 | \usage{ 7 | eta.partial.SS(dfm, dfe, ssm, sse, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{ssm}{sum of squares for the model/IV/between} 15 | 16 | \item{sse}{sum of squares for the error/residual/within} 17 | 18 | \item{Fvalue}{F statistic} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | Provides partial eta squared with associated confidence intervals 24 | and relevant statistics. 25 | 26 | \item{eta}{partial eta squared effect size} 27 | \item{etalow}{lower level confidence interval of partial eta squared} 28 | \item{etahigh}{upper level confidence interval of partial eta squared} 29 | \item{dfm}{degrees of freedom for the model/IV/between} 30 | \item{dfe}{degrees of freedom for the error/resisual/within} 31 | \item{F}{F-statistic} 32 | \item{p}{p-value} 33 | \item{estimate}{the eta squared statistic and confidence interval in 34 | APA style for markdown printing} 35 | \item{statistic}{the F-statistic in APA style for markdown printing} 36 | } 37 | \description{ 38 | This function displays partial eta squared from ANOVA analyses 39 | and its non-central confidence interval based on the F distribution. 40 | This formula works for one way and multi way designs. 41 | } 42 | \details{ 43 | Partial eta squared is calculated by dividing the sum of squares 44 | of the model by the sum of the sum of squares of the model and 45 | sum of squares of the error. 46 | 47 | partial eta^2 = ssm / (ssm + sse) 48 | 49 | \href{https://www.aggieerin.com/shiny-server/tests/etapss.html}{Learn more on our example page.} 50 | } 51 | \examples{ 52 | 53 | #The following example is derived from the "bn2_data" dataset, included 54 | #in the MOTE library. 55 | 56 | #Is there a difference in atheletic spending budget for different sports? 57 | #Does that spending interact with the change in coaching staff? This data includes 58 | #(fake) atheletic budgets for baseball, basketball, football, soccer, and volleyball teams 59 | #with new and old coaches to determine if there are differences in 60 | #spending across coaches and sports. 61 | 62 | library(ez) 63 | bn2_data$partno = 1:nrow(bn2_data) 64 | anova_model = ezANOVA(data = bn2_data, 65 | dv = money, 66 | wid = partno, 67 | between = .(coach, type), 68 | detailed = TRUE, 69 | type = 3) 70 | 71 | #You would calculate one eta for each F-statistic. 72 | #Here's an example for the interaction with typing in numbers. 73 | eta.partial.SS(dfm = 4, dfe = 990, 74 | ssm = 338057.9, sse = 32833499, 75 | Fvalue = 2.548, a = .05) 76 | 77 | #Here's an example for the interaction with code. 78 | eta.partial.SS(dfm = anova_model$ANOVA$DFn[4], 79 | dfe = anova_model$ANOVA$DFd[4], 80 | ssm = anova_model$ANOVA$SSn[4], 81 | sse = anova_model$ANOVA$SSd[4], 82 | Fvalue = anova_model$ANOVA$F[4], 83 | a = .05) 84 | } 85 | \keyword{ANOVA} 86 | \keyword{effect} 87 | \keyword{eta,} 88 | \keyword{size,} 89 | -------------------------------------------------------------------------------- /man/g.ind.t.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/g.ind.t.R 3 | \name{g.ind.t} 4 | \alias{g.ind.t} 5 | \title{d-g Corrected for Independent t} 6 | \usage{ 7 | g.ind.t(m1, m2, sd1, sd2, n1, n2, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{m1}{mean group one} 11 | 12 | \item{m2}{mean group two} 13 | 14 | \item{sd1}{standard deviation group one} 15 | 16 | \item{sd2}{standard deviation group two} 17 | 18 | \item{n1}{sample size group one} 19 | 20 | \item{n2}{sample size group two} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | D-g corrected with associated confidence intervals, 26 | the confidence intervals associated with the means of each group, 27 | standard deviations of the means for each group, relevant statistics. 28 | 29 | \item{d}{d-g corrected effect size} 30 | \item{dlow}{lower level confidence interval d-g corrected} 31 | \item{dhigh}{upper level confidence interval d-g corrected} 32 | \item{M1}{mean group one} 33 | \item{sd1}{standard deviation of group one} 34 | \item{se1}{standard error of group one} 35 | \item{M1low}{lower level confidence interval of mean one} 36 | \item{M1high}{upper level confidence interval of mean one} 37 | \item{M2}{mean two} 38 | \item{sd2}{standard deviation of mean two} 39 | \item{se1}{standard error of mean two} 40 | \item{M2low}{lower level confidence interval of mean two} 41 | \item{M2high}{upper level confidence interval of mean two} 42 | \item{spooled}{pooled standard deviation} 43 | \item{sepooled}{pooled standard error} 44 | \item{correction}{g corrected} 45 | \item{n1}{size of sample one} 46 | \item{n2}{size of sample two} 47 | \item{df}{degrees of freedom} 48 | \item{t}{t-statistic} 49 | \item{p}{p-value} 50 | \item{estimate}{the d statistic and confidence interval in 51 | APA style for markdown printing} 52 | \item{statistic}{the t-statistic in APA style for markdown printing} 53 | } 54 | \description{ 55 | This function displays d-g corrected 56 | and the non-central confidence interval for independent t. 57 | } 58 | \details{ 59 | The correction is calculated by dividing three by the sum of both 60 | sample sizes after multiplying by four and subtracting nine. 61 | This amount is deducted from one. 62 | 63 | correction = 1 - (3 / (4 * (n1 + n2) - 9)) 64 | 65 | D-g corrected is calculated by substracting mean two from mean one, 66 | dividing by the pooled standard deviation which is multiplied 67 | by the correction above. 68 | 69 | d_g corrected = ((m1 - m2) / spooled) * correction 70 | 71 | \href{https://www.aggieerin.com/shiny-server/tests/indtg.html}{Learn more on our example page.} 72 | } 73 | \examples{ 74 | 75 | #The following example is derived from the "indt_data" dataset, included 76 | #in the MOTE library. 77 | 78 | #A forensic psychologist conducted a study to examine whether 79 | #being hypnotized during recall affects how well a witness 80 | #can remember facts about an event. Eight participants 81 | #watched a short film of a mock robbery, after which 82 | #each participant was questioned about what he or she had 83 | #seen. The four participants in the experimental group 84 | #were questioned while they were hypnotized. The four 85 | #participants in the control group recieved the same 86 | #questioning without hypnosis. 87 | 88 | t.test(correctq ~ group, data = indt_data) 89 | 90 | #You can type in the numbers directly, or refer to the dataset, 91 | #as shown below. 92 | 93 | g.ind.t(m1 = 17.75, m2 = 23, sd1 = 3.30, 94 | sd2 = 2.16, n1 = 4, n2 = 4, a = .05) 95 | 96 | g.ind.t(17.75, 23, 3.30, 2.16, 4, 4, .05) 97 | 98 | g.ind.t(mean(indt_data$correctq[indt_data$group == 1]), 99 | mean(indt_data$correctq[indt_data$group == 2]), 100 | sd(indt_data$correctq[indt_data$group == 1]), 101 | sd(indt_data$correctq[indt_data$group == 2]), 102 | length(indt_data$correctq[indt_data$group == 1]), 103 | length(indt_data$correctq[indt_data$group == 2]), 104 | .05) 105 | 106 | #Contrary to the hypothesized result, the group that underwent hypnosis were 107 | #significantly less accurate while reporting facts than the control group 108 | #with a large effect size, t(6) = -2.66, p = .038, d_g = 1.64. 109 | 110 | } 111 | \keyword{correction} 112 | \keyword{effect} 113 | \keyword{independent} 114 | \keyword{size,} 115 | \keyword{t,} 116 | -------------------------------------------------------------------------------- /man/ges.partial.SS.mix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ges.partial.SS.mix.R 3 | \name{ges.partial.SS.mix} 4 | \alias{ges.partial.SS.mix} 5 | \title{Partial Generalized Eta-Squared for Mixed Design ANOVA from F} 6 | \usage{ 7 | ges.partial.SS.mix(dfm, dfe, ssm, sss, sse, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{ssm}{sum of squares for the model/IV/between} 15 | 16 | \item{sss}{sum of squares subject variance} 17 | 18 | \item{sse}{sum of squares for the error/residual/within} 19 | 20 | \item{Fvalue}{F statistic} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | Partial generalized eta-squared (GES) with associated confidence intervals 26 | and relevant statistics. 27 | \item{ges}{effect size} 28 | \item{geslow}{lower level confidence interval for ges} 29 | \item{geshigh}{upper level confidence interval for ges} 30 | \item{dfm}{degrees of freedom for the model/IV/between} 31 | \item{dfe}{degrees of freedom for the error/residual/within} 32 | \item{F}{F-statistic} 33 | \item{p}{p-value} 34 | \item{estimate}{the generalized eta squared statistic and confidence interval in 35 | APA style for markdown printing} 36 | \item{statistic}{the F-statistic in APA style for markdown printing} 37 | } 38 | \description{ 39 | This function displays partial generalized eta-squared (GES) from ANOVA analyses 40 | and its non-central confidence interval based on the F distribution. 41 | This formula works for mixed designs. 42 | } 43 | \details{ 44 | To calculate partial generalized eta squared, first, the sum of 45 | squares of the model, sum of squares of the subject 46 | variance, sum of squares for the subject variance, 47 | and the sum of squares for the error/residual/within are added together. 48 | The sum of squares of the model is divided by this value. 49 | 50 | partial ges = ssm / (ssm + sss + sse) 51 | 52 | \href{https://www.aggieerin.com/shiny-server/tests/gesmixss.html}{Learn more on our example page.} 53 | } 54 | \examples{ 55 | 56 | #The following example is derived from the "mix2_data" dataset, included 57 | #in the MOTE library. 58 | 59 | #Given previous research, we know that backward strength in free 60 | #association tends to increase the ratings participants give when 61 | #you ask them how many people out of 100 would say a word in 62 | #response to a target word (like Family Feud). This result is 63 | #tied to people’s overestimation of how well they think they know 64 | #something, which is bad for studying. So, we gave people instructions 65 | #on how to ignore the BSG. Did it help? Is there an interaction 66 | #between BSG and instructions given? 67 | 68 | library(ez) 69 | mix2_data$partno = 1:nrow(mix2_data) 70 | 71 | library(reshape) 72 | long_mix = melt(mix2_data, id = c("partno", "group")) 73 | 74 | anova_model = ezANOVA(data = long_mix, 75 | dv = value, 76 | wid = partno, 77 | between = group, 78 | within = variable, 79 | detailed = TRUE, 80 | type = 3) 81 | 82 | #You would calculate one partial GES value for each F-statistic. 83 | #Here's an example for the interaction with typing in numbers. 84 | ges.partial.SS.mix(dfm = 1, dfe = 156, 85 | ssm = 71.07608, 86 | sss = 30936.498, 87 | sse = 8657.094, 88 | Fvalue = 1.280784, a = .05) 89 | 90 | #Here's an example for the interaction with code. 91 | ges.partial.SS.mix(dfm = anova_model$ANOVA$DFn[4], 92 | dfe = anova_model$ANOVA$DFd[4], 93 | ssm = anova_model$ANOVA$SSn[4], 94 | sss = anova_model$ANOVA$SSd[1], 95 | sse = anova_model$ANOVA$SSd[4], 96 | Fvalue = anova_model$ANOVA$F[4], 97 | a = .05) 98 | } 99 | \keyword{ANOVA} 100 | \keyword{effect} 101 | \keyword{ges,} 102 | \keyword{size,} 103 | -------------------------------------------------------------------------------- /man/ges.partial.SS.rm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ges.partial.SS.rm.R 3 | \name{ges.partial.SS.rm} 4 | \alias{ges.partial.SS.rm} 5 | \title{Partial Generalized Eta-Squared for ANOVA from F} 6 | \usage{ 7 | ges.partial.SS.rm(dfm, dfe, ssm, sss, sse1, sse2, sse3, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{ssm}{sum of squares for the model/IV/between} 15 | 16 | \item{sss}{sum of squares subject variance} 17 | 18 | \item{sse1}{sum of squares for the error/residual/within for the first IV} 19 | 20 | \item{sse2}{sum of squares for the error/residual/within for the second IV} 21 | 22 | \item{sse3}{sum of squares for the error/residual/within for the interaction} 23 | 24 | \item{Fvalue}{F statistic} 25 | 26 | \item{a}{significance level} 27 | } 28 | \value{ 29 | Partial generalized eta-squared (GES) with associated confidence intervals 30 | and relevant statistics. 31 | \item{ges}{effect size} 32 | \item{geslow}{lower level confidence interval for ges} 33 | \item{geshigh}{upper level confidence interval for ges} 34 | \item{dfm}{degrees of freedom for the model/IV/between} 35 | \item{dfe}{degrees of freedom for the error/residual/within} 36 | \item{F}{F-statistic} 37 | \item{p}{p-value} 38 | \item{estimate}{the generalized eta squared statistic and confidence interval in 39 | APA style for markdown printing} 40 | \item{statistic}{the F-statistic in APA style for markdown printing} 41 | } 42 | \description{ 43 | This function displays partial ges squared from ANOVA analyses 44 | and its non-central confidence interval based on the F distribution. 45 | This formula works for multi-way repeated measures designs. 46 | } 47 | \details{ 48 | To calculate partial generalized eta squared, first, the sum of 49 | squares of the model, sum of squares of the subject 50 | variance, sum of squares for the first and second independent variables, 51 | and the sum of squares for the interaction are added together. 52 | The sum of squares of the model is divided by this value. 53 | 54 | partial ges <- ssm / (ssm + sss + sse1 + sse2 + sse3) 55 | 56 | \href{https://www.aggieerin.com/shiny-server/tests/gesrmss.html}{Learn more on our example page.} 57 | } 58 | \examples{ 59 | 60 | #The following example is derived from the "rm2_data" dataset, included 61 | #in the MOTE library. 62 | 63 | #In this experiment people were given word pairs to rate based on 64 | #their "relatedness". How many people out of a 100 would put LOST-FOUND 65 | #together? Participants were given pairs of words and asked to rate them 66 | #on how often they thought 100 people would give the second word if shown 67 | #the first word. The strength of the word pairs was manipulated through 68 | #the actual rating (forward strength: FSG) and the strength of the reverse 69 | #rating (backward strength: BSG). Is there an interaction between FSG and 70 | #BSG when participants are estimating the relation between word pairs? 71 | 72 | library(ez) 73 | library(reshape) 74 | long_mix = melt(rm2_data, id = c("subject", "group")) 75 | long_mix$FSG = c(rep("Low-FSG", nrow(rm2_data)), 76 | rep("High-FSG", nrow(rm2_data)), 77 | rep("Low-FSG", nrow(rm2_data)), 78 | rep("High-FSG", nrow(rm2_data))) 79 | long_mix$BSG = c(rep("Low-BSG", nrow(rm2_data)*2), 80 | rep("High-BSG", nrow(rm2_data)*2)) 81 | 82 | anova_model = ezANOVA(data = long_mix, 83 | dv = value, 84 | wid = subject, 85 | within = .(FSG, BSG), 86 | detailed = TRUE, 87 | type = 3) 88 | 89 | #You would calculate one partial GES value for each F-statistic. 90 | #Here's an example for the interaction with typing in numbers. 91 | ges.partial.SS.rm(dfm = 1, dfe = 157, 92 | ssm = 2442.948, sss = 76988.13, 93 | sse1 = 5402.567, sse2 = 8318.75, sse3 = 6074.417, 94 | Fvalue = 70.9927, a = .05) 95 | 96 | #Here's an example for the interaction with code. 97 | ges.partial.SS.rm(dfm = anova_model$ANOVA$DFn[4], 98 | dfe = anova_model$ANOVA$DFd[4], 99 | ssm = anova_model$ANOVA$SSn[4], 100 | sss = anova_model$ANOVA$SSd[1], 101 | sse1 = anova_model$ANOVA$SSd[4], 102 | sse2 = anova_model$ANOVA$SSd[2], 103 | sse3 = anova_model$ANOVA$SSd[3], 104 | Fvalue = anova_model$ANOVA$F[4], 105 | a = .05) 106 | } 107 | \keyword{ANOVA} 108 | \keyword{effect} 109 | \keyword{ges,} 110 | \keyword{size,} 111 | -------------------------------------------------------------------------------- /man/indt_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/indt-data.R 3 | \docType{data} 4 | \name{indt_data} 5 | \alias{indt_data} 6 | \title{Independent t Example Data} 7 | \format{ 8 | A data frame including two groups, one recieving a 9 | hypnotism intervention, and one control group, to determine how 10 | hypnotism effects recall after witnessing a crime. 11 | } 12 | \usage{ 13 | data(indt_data) 14 | } 15 | \description{ 16 | Dataset for use in \code{\link{d.ind.t}}, \code{\link{d.ind.t.t}}, 17 | \code{\link{delta.ind.t}} exploring the effects of hypnotism on 18 | the effects of recall after witnessing a crime. 19 | } 20 | \keyword{datasets} 21 | -------------------------------------------------------------------------------- /man/mix2_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mix2-data.R 3 | \docType{data} 4 | \name{mix2_data} 5 | \alias{mix2_data} 6 | \title{Mixed Two-way ANOVA Example Data} 7 | \format{ 8 | A data frame including group type and backward strength rating. 9 | 10 | group: Regular JAM Task or Debiasing JAM task 11 | bsglo: estimate of response to target word in a Low BSG condition 12 | bsghi: estimate of response to target word in a High BSG condition 13 | } 14 | \usage{ 15 | data(mix2_data) 16 | } 17 | \description{ 18 | Dataset for use in \code{\link{ges.partial.SS.mix}}. 19 | Given previous research, we know that backward strength 20 | in free association tends to increase the ratings 21 | participants give when you ask them how many people 22 | out of 100 would say a word in response to a target 23 | word (like Family Feud). This result is tied to 24 | people's overestimation of how well they think they 25 | know something, which is bad for studying. So, we 26 | gave people instructions on how to ignore the BSG. 27 | Did it help? Is there an interaction between BSG 28 | and instructions given? 29 | } 30 | \keyword{datasets} 31 | -------------------------------------------------------------------------------- /man/odds.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/odds.R 3 | \name{odds} 4 | \alias{odds} 5 | \title{Chi-Square Odds Ratios} 6 | \usage{ 7 | odds(n11, n12, n21, n22, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{n11}{sample size for level 1.1} 11 | 12 | \item{n12}{sample size for level 1.2} 13 | 14 | \item{n21}{sample size for level 2.1} 15 | 16 | \item{n22}{sample size for level 2.2} 17 | 18 | \item{a}{significance level} 19 | } 20 | \value{ 21 | Provides odds ratios with associated confidence intervals 22 | and relevant statistics. 23 | 24 | \item{odds}{odds statistic} 25 | \item{olow}{lower level confidence interval of odds statistic} 26 | \item{ohigh}{upper level confidence interval of odds statistic} 27 | \item{se}{standard error} 28 | \item{estimate}{the oods statistic and confidence interval in 29 | APA style for markdown printing} 30 | } 31 | \description{ 32 | This function displays odds ratios and their normal confidence intervals. 33 | } 34 | \details{ 35 | This statistic is the ratio between level 1.1 divided by level 1.2, and 36 | level 2.1 divided by 2.2. In other words, these are the odds of level 1.1 37 | given level 1 overall versus level 2.1 given level 2 overall. 38 | 39 | To calculate odds ratios, First, the sample size for level 1.1 40 | is divided by the sample size for level 1.2. This value is divided 41 | by the sample size for level 2.1, after dividing by the sample 42 | size of level 2.2. 43 | 44 | odds <- (n11 / n12) / (n21 / n22) 45 | 46 | \href{https://www.aggieerin.com/shiny-server/tests/chio.html}{Learn more on our example page.} 47 | } 48 | \examples{ 49 | 50 | #A health psychologist was interested in the rates of anxiety in 51 | #first generation and regular college students. They polled campus 52 | #and found the following data: 53 | 54 | #| | First Generation | Regular | 55 | #|--------------|------------------|---------| 56 | #| Low Anxiety | 10 | 50 | 57 | #| High Anxiety | 20 | 15 | 58 | 59 | #What are the odds for the first generation students to have anxiety? 60 | 61 | odds(n11 = 10, n12 = 50, n21 = 20, n22 = 15, a = .05) 62 | } 63 | \keyword{effect} 64 | \keyword{odds} 65 | \keyword{ratios} 66 | \keyword{size,} 67 | -------------------------------------------------------------------------------- /man/omega.F.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/omega.F.R 3 | \name{omega.F} 4 | \alias{omega.F} 5 | \title{Omega Squared for ANOVA from F} 6 | \usage{ 7 | omega.F(dfm, dfe, Fvalue, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{Fvalue}{F statistic} 15 | 16 | \item{n}{full sample size} 17 | 18 | \item{a}{significance level} 19 | } 20 | \value{ 21 | The effect size (Cohen's d) with associated confidence intervals 22 | and relevant statistics. 23 | 24 | \item{omega}{omega statistic} 25 | \item{omegalow}{lower level confidence interval d value} 26 | \item{omegahigh}{upper level confidence interval d value} 27 | \item{dfm}{degrees of freedom for the model/IV/between} 28 | \item{dfe}{degrees of freedom for the error/residual/within} 29 | \item{F}{F-statistic} 30 | \item{p}{p-value} 31 | \item{estimate}{the omega squared statistic and confidence interval in 32 | APA style for markdown printing} 33 | \item{statistic}{the F-statistic in APA style for markdown printing} 34 | } 35 | \description{ 36 | This function displays omega squared from ANOVA analyses 37 | and its non-central confidence interval based on the F distribution. 38 | These values are calculated directly from F statistics and can be used 39 | for between subjects and repeated measures designs. 40 | Remember if you have two or more IVs, these values are partial omega squared. 41 | } 42 | \details{ 43 | Omega squared or partial omega squared is calculated by subtracting one 44 | from the F-statistic and multiplying it by degrees of freedom of the model. This is 45 | divided by the same value after adding the number of valid responses. This 46 | value will be omega squared for one-way ANOVA designs, and will be 47 | partial omega squared for multi-way ANOVA designs (i.e. with more than one IV). 48 | 49 | omega^2 = (dfm * (Fvalue-1)) / ((dfm * (Fvalue-1)) + n) 50 | 51 | \href{https://www.aggieerin.com/shiny-server/tests/omegaf.html}{Learn more on our example page.} 52 | } 53 | \examples{ 54 | 55 | #The following example is derived from the "bn1_data" dataset, included 56 | #in the MOTE library. 57 | 58 | #A health psychologist recorded the number of close inter-personal 59 | #attachments of 45-year-olds who were in excellent, fair, or poor 60 | #health. People in the Excellent Health group had 4, 3, 2, and 3 61 | #close attachments; people in the Fair Health group had 3, 5, 62 | #and 8 close attachments; and people in the Poor Health group 63 | #had 3, 1, 0, and 2 close attachments. 64 | 65 | anova_model = lm(formula = friends ~ group, data = bn1_data) 66 | summary.aov(anova_model) 67 | 68 | omega.F(dfm = 2, dfe = 8, 69 | Fvalue = 5.134, n = 11, a = .05) 70 | } 71 | \keyword{ANOVA} 72 | \keyword{effect} 73 | \keyword{omega,} 74 | \keyword{size,} 75 | -------------------------------------------------------------------------------- /man/omega.full.SS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/omega.full.SS.R 3 | \name{omega.full.SS} 4 | \alias{omega.full.SS} 5 | \title{Omega Squared for One-Way and Multi-Way ANOVA from F} 6 | \usage{ 7 | omega.full.SS(dfm, dfe, msm, mse, sst, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{msm}{mean square for the model/IV/between} 15 | 16 | \item{mse}{mean square for the error/residual/within} 17 | 18 | \item{sst}{sum of squares total} 19 | 20 | \item{a}{significance level} 21 | } 22 | \value{ 23 | Provides omega squared with associated confidence intervals 24 | and relevant statistics. 25 | 26 | \item{omega}{omega squared} 27 | \item{omegalow}{lower level confidence interval of omega} 28 | \item{omegahigh}{upper level confidence interval of omega} 29 | \item{dfm}{degrees of freedom for the model/IV/between} 30 | \item{dfe}{degrees of freedom for the error/resisual/within} 31 | \item{F}{F-statistic} 32 | \item{p}{p-value} 33 | \item{estimate}{the omega squared statistic and confidence interval in 34 | APA style for markdown printing} 35 | \item{statistic}{the F-statistic in APA style for markdown printing} 36 | } 37 | \description{ 38 | This function displays omega squared from ANOVA analyses 39 | and its non-central confidence interval based on the F distribution. 40 | This formula works for one way and multi way designs with careful 41 | focus on which error term you are using for the calculation. 42 | } 43 | \details{ 44 | Omega squared is calculated by deducting the mean square of the error 45 | from the mean square of the model and multiplying by the degrees of freedom for the model. 46 | This is divided by the sum of the sum of squares total and the mean square of the error. 47 | 48 | omega = (dfm * (msm - mse)) / (sst + mse) 49 | 50 | \href{https://www.aggieerin.com/shiny-server/tests/omegass.html}{Learn more on our example page.} 51 | } 52 | \examples{ 53 | 54 | #The following example is derived from the "bn1_data" dataset, included 55 | #in the MOTE library. 56 | 57 | #A health psychologist recorded the number of close inter-personal 58 | #attachments of 45-year-olds who were in excellent, fair, or poor 59 | #health. People in the Excellent Health group had 4, 3, 2, and 3 60 | #close attachments; people in the Fair Health group had 3, 5, 61 | #and 8 close attachments; and people in the Poor Health group 62 | #had 3, 1, 0, and 2 close attachments. 63 | 64 | anova_model = lm(formula = friends ~ group, data = bn1_data) 65 | summary.aov(anova_model) 66 | 67 | omega.full.SS(dfm = 2, dfe = 8, 68 | msm = 12.621, mse = 2.548, 69 | sst = (25.54+19.67), a = .05) 70 | } 71 | \keyword{ANOVA} 72 | \keyword{effect} 73 | \keyword{omega,} 74 | \keyword{size,} 75 | -------------------------------------------------------------------------------- /man/omega.gen.SS.rm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/omega.gen.SS.rm.R 3 | \name{omega.gen.SS.rm} 4 | \alias{omega.gen.SS.rm} 5 | \title{Generalized Omega Squared for Multi-Way and Mixed ANOVA from F} 6 | \usage{ 7 | omega.gen.SS.rm(dfm, dfe, ssm, ssm2, sst, mss, j, Fvalue, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{ssm}{sum of squares for the MAIN model/IV/between} 15 | 16 | \item{ssm2}{sum of squares for the OTHER model/IV/between} 17 | 18 | \item{sst}{sum of squares total across the whole ANOVA} 19 | 20 | \item{mss}{mean square for the subject variance} 21 | 22 | \item{j}{number of levels in the OTHER IV} 23 | 24 | \item{Fvalue}{F statistic from the output for your IV} 25 | 26 | \item{a}{significance level} 27 | } 28 | \value{ 29 | Provides omega squared with associated confidence intervals 30 | and relevant statistics. 31 | 32 | \item{omega}{omega squared} 33 | \item{omegalow}{lower level confidence interval of omega} 34 | \item{omegahigh}{upper level confidence interval of omega} 35 | \item{dfm}{degrees of freedom for the model/IV/between} 36 | \item{dfe}{degrees of freedom for the error/resisual/within} 37 | \item{F}{F-statistic} 38 | \item{p}{p-value} 39 | \item{estimate}{the omega squared statistic and confidence interval in 40 | APA style for markdown printing} 41 | \item{statistic}{the F-statistic in APA style for markdown printing} 42 | } 43 | \description{ 44 | This function displays generalized omega squared from ANOVA analyses 45 | and its non-central confidence interval based on the F distribution. 46 | This formula is appropriate for multi-way repeated measures 47 | designs and mix level designs. 48 | } 49 | \details{ 50 | Omega squared is calculated by subtracting the product of the 51 | degrees of freedom of the model and the mean square of the 52 | subject variance from the sum of squares for the model. 53 | 54 | This is divided by the value obtained after combining 55 | the sum of squares total, sum of squares for the other 56 | independent variable, and the mean square of the 57 | subject variance multiplied by the number of levels 58 | in the other model/IV/between. 59 | 60 | generalized omega^2 = (ssm - (dfm * mss)) / (sst + ssm2 + j*mss) 61 | 62 | \href{https://www.aggieerin.com/shiny-server/tests/gosrmss.html}{Learn more on our example page.} 63 | } 64 | \examples{ 65 | 66 | #The following example is derived from the "mix2_data" dataset, included 67 | #in the MOTE library. 68 | 69 | #Given previous research, we know that backward strength in free 70 | #association tends to increase the ratings participants give when 71 | #you ask them how many people out of 100 would say a word in 72 | #response to a target word (like Family Feud). This result is 73 | #tied to people’s overestimation of how well they think they know 74 | #something, which is bad for studying. So, we gave people instructions 75 | #on how to ignore the BSG. Did it help? Is there an interaction 76 | #between BSG and instructions given? 77 | 78 | library(ez) 79 | mix2_data$partno = 1:nrow(mix2_data) 80 | 81 | library(reshape) 82 | long_mix = melt(mix2_data, id = c("partno", "group")) 83 | 84 | anova_model = ezANOVA(data = long_mix, 85 | dv = value, 86 | wid = partno, 87 | between = group, 88 | within = variable, 89 | detailed = TRUE, 90 | type = 3) 91 | 92 | #You would calculate one partial GOS value for each F-statistic. 93 | #Here's an example for the main effect 1 with typing in numbers. 94 | omega.gen.SS.rm(dfm = 1, dfe = 156, 95 | ssm = 6842.46829, 96 | ssm2 = 14336.07886, 97 | sst = sum(c(30936.498, 6842.46829, 98 | 14336.07886, 8657.094, 71.07608)), 99 | mss = 30936.498 / 156, 100 | j = 2, Fvalue = 34.503746, a = .05) 101 | 102 | #Here's an example for the main effect 1 with code. 103 | omega.gen.SS.rm(dfm = anova_model$ANOVA$DFn[2], 104 | dfe = anova_model$ANOVA$DFd[2], 105 | ssm = anova_model$ANOVA$SSn[2], 106 | ssm2 = anova_model$ANOVA$SSn[3], 107 | sst = sum(c(anova_model$ANOVA$SSn[-1], anova_model$ANOVA$SSd[c(1,3)])), 108 | mss = anova_model$ANOVA$SSd[1]/anova_model$ANOVA$DFd[1], 109 | j = anova_model$ANOVA$DFn[3]+1, 110 | Fvalue = anova_model$ANOVA$F[2], a = .05) 111 | } 112 | \keyword{ANOVA} 113 | \keyword{effect} 114 | \keyword{omega,} 115 | \keyword{size,} 116 | -------------------------------------------------------------------------------- /man/omega.partial.SS.bn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/omega.partial.SS.bn.R 3 | \name{omega.partial.SS.bn} 4 | \alias{omega.partial.SS.bn} 5 | \title{Partial Omega Squared for Between Subjects ANOVA from F} 6 | \usage{ 7 | omega.partial.SS.bn(dfm, dfe, msm, mse, ssm, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{msm}{mean square for the model/IV/between} 15 | 16 | \item{mse}{mean square for the error/residual/within} 17 | 18 | \item{ssm}{sum of squares for the model/IV/between} 19 | 20 | \item{n}{total sample size} 21 | 22 | \item{a}{significance level} 23 | } 24 | \value{ 25 | Provides omega squared with associated confidence intervals 26 | and relevant statistics. 27 | 28 | \item{omega}{omega squared} 29 | \item{omegalow}{lower level confidence interval of omega} 30 | \item{omegahigh}{upper level confidence interval of omega} 31 | \item{dfm}{degrees of freedom for the model/IV/between} 32 | \item{dfe}{degrees of freedom for the error/resisual/within} 33 | \item{F}{F-statistic} 34 | \item{p}{p-value} 35 | \item{estimate}{the omega squared statistic and confidence interval in 36 | APA style for markdown printing} 37 | \item{statistic}{the F-statistic in APA style for markdown printing} 38 | } 39 | \description{ 40 | This function displays omega squared from ANOVA analyses 41 | and its non-central confidence interval based on the F distribution. 42 | This formula is appropriate for multi-way between subjects designs. 43 | } 44 | \details{ 45 | Partial omega squared is calculated by subtracting the mean square for the error 46 | from the mean square of the model, which is multiplied by degrees of freedom of 47 | the model. This is divided by the product of the degrees of freedom 48 | for the model are deducted from the sample size, multiplied by the 49 | mean square of the error, plus the sum of squares for the model. 50 | 51 | omega^2 <- (dfm * (msm - mse)) / (ssm + (n-dfm)*mse) 52 | 53 | \href{https://www.aggieerin.com/shiny-server/tests/omegapbnss.html}{Learn more on our example page.} 54 | } 55 | \examples{ 56 | 57 | #The following example is derived from the "bn2_data" dataset, included 58 | #in the MOTE library. 59 | 60 | #Is there a difference in atheletic spending budget for different sports? 61 | #Does that spending interact with the change in coaching staff? This data includes 62 | #(fake) atheletic budgets for baseball, basketball, football, soccer, and volleyball teams 63 | #with new and old coaches to determine if there are differences in 64 | #spending across coaches and sports. 65 | 66 | library(ez) 67 | bn2_data$partno = 1:nrow(bn2_data) 68 | anova_model = ezANOVA(data = bn2_data, 69 | dv = money, 70 | wid = partno, 71 | between = .(coach, type), 72 | detailed = TRUE, 73 | type = 3) 74 | 75 | #You would calculate one eta for each F-statistic. 76 | #Here's an example for the interaction with typing in numbers. 77 | omega.partial.SS.bn(dfm = 4, dfe = 990, 78 | msm = 338057.9 / 4, 79 | mse = 32833499 / 990, 80 | ssm = 338057.9, 81 | n = 1000, a = .05) 82 | 83 | #Here's an example for the interaction with code. 84 | omega.partial.SS.bn(dfm = anova_model$ANOVA$DFn[4], 85 | dfe = anova_model$ANOVA$DFd[4], 86 | msm = anova_model$ANOVA$SSn[4] / anova_model$ANOVA$DFn[4], 87 | mse = anova_model$ANOVA$SSd[4] / anova_model$ANOVA$DFd[4], 88 | ssm = anova_model$ANOVA$SSn[4], 89 | n = nrow(bn2_data), 90 | a = .05) 91 | } 92 | \keyword{ANOVA} 93 | \keyword{effect} 94 | \keyword{omega,} 95 | \keyword{size,} 96 | -------------------------------------------------------------------------------- /man/omega.partial.SS.rm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/omega.partial.SS.rm.R 3 | \name{omega.partial.SS.rm} 4 | \alias{omega.partial.SS.rm} 5 | \title{Partial Omega Squared for Repeated Measures ANOVA from F} 6 | \usage{ 7 | omega.partial.SS.rm(dfm, dfe, msm, mse, mss, ssm, sse, sss, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{dfm}{degrees of freedom for the model/IV/between} 11 | 12 | \item{dfe}{degrees of freedom for the error/residual/within} 13 | 14 | \item{msm}{mean square for the model/IV/between} 15 | 16 | \item{mse}{mean square for the error/residual/within} 17 | 18 | \item{mss}{mean square for the subject variance} 19 | 20 | \item{ssm}{sum of squares for the model/IV/between} 21 | 22 | \item{sse}{sum of squares for the error/residual/within} 23 | 24 | \item{sss}{sum of squares for the subject variance} 25 | 26 | \item{a}{significance level} 27 | } 28 | \value{ 29 | Provides omega squared with associated confidence intervals 30 | and relevant statistics. 31 | 32 | \item{omega}{omega squared} 33 | \item{omegalow}{lower level confidence interval of omega} 34 | \item{omegahigh}{upper level confidence interval of omega} 35 | \item{dfm}{degrees of freedom for the model/IV/between} 36 | \item{dfe}{degrees of freedom for the error/resisual/within} 37 | \item{F}{F-statistic} 38 | \item{p}{p-value} 39 | \item{estimate}{the omega squared statistic and confidence interval in 40 | APA style for markdown printing} 41 | \item{statistic}{the F-statistic in APA style for markdown printing} 42 | } 43 | \description{ 44 | This function displays omega squared from ANOVA analyses 45 | and its non-central confidence interval based on the F distribution. 46 | This formula is appropriate for multi-way repeated measures designs and mix level designs. 47 | } 48 | \details{ 49 | Partial omega squared is calculated by subtracting the mean 50 | square for the error from the mean square of the model, which is 51 | multiplied by degrees of freedom of the model. This is divided 52 | by the sum of the sum of squares for the model, sum of squares 53 | for the error, sum of squares for the subject, and the 54 | mean square of the subject. 55 | 56 | omega_p^2 = (dfm x (msm - mse)) / (ssm + sse + sss + mss) 57 | 58 | The F-statistic is calculated by dividing the mean square 59 | of the model by the mean square of the error. 60 | 61 | F = msm / mse 62 | 63 | \href{https://www.aggieerin.com/shiny-server/tests/omegaprmss.html}{Learn more on our example page.} 64 | } 65 | \examples{ 66 | 67 | #The following example is derived from the "rm2_data" dataset, included 68 | #in the MOTE library. 69 | 70 | #In this experiment people were given word pairs to rate based on 71 | #their "relatedness". How many people out of a 100 would put LOST-FOUND 72 | #together? Participants were given pairs of words and asked to rate them 73 | #on how often they thought 100 people would give the second word if shown 74 | #the first word. The strength of the word pairs was manipulated through 75 | #the actual rating (forward strength: FSG) and the strength of the reverse 76 | #rating (backward strength: BSG). Is there an interaction between FSG and 77 | #BSG when participants are estimating the relation between word pairs? 78 | 79 | library(ez) 80 | library(reshape) 81 | long_mix = melt(rm2_data, id = c("subject", "group")) 82 | long_mix$FSG = c(rep("Low-FSG", nrow(rm2_data)), 83 | rep("High-FSG", nrow(rm2_data)), 84 | rep("Low-FSG", nrow(rm2_data)), 85 | rep("High-FSG", nrow(rm2_data))) 86 | long_mix$BSG = c(rep("Low-BSG", nrow(rm2_data)*2), 87 | rep("High-BSG", nrow(rm2_data)*2)) 88 | 89 | anova_model = ezANOVA(data = long_mix, 90 | dv = value, 91 | wid = subject, 92 | within = .(FSG, BSG), 93 | detailed = TRUE, 94 | type = 3) 95 | 96 | #You would calculate one partial GOS value for each F-statistic. 97 | #You can leave out the MS options if you include all the SS options. 98 | #Here's an example for the interaction with typing in numbers. 99 | omega.partial.SS.rm(dfm = 1, dfe = 157, 100 | msm = 2442.948 / 1, 101 | mse = 5402.567 / 157, 102 | mss = 76988.130 / 157, 103 | ssm = 2442.948, sss = 76988.13, 104 | sse = 5402.567, a = .05) 105 | 106 | #Here's an example for the interaction with code. 107 | omega.partial.SS.rm(dfm = anova_model$ANOVA$DFn[4], 108 | dfe = anova_model$ANOVA$DFd[4], 109 | msm = anova_model$ANOVA$SSn[4] / anova_model$ANOVA$DFn[4], 110 | mse = anova_model$ANOVA$SSd[4] / anova_model$ANOVA$DFd[4], 111 | mss = anova_model$ANOVA$SSd[1] / anova_model$ANOVA$DFd[1], 112 | ssm = anova_model$ANOVA$SSn[4], 113 | sse = anova_model$ANOVA$SSd[4], 114 | sss = anova_model$ANOVA$SSd[1], 115 | a = .05) 116 | } 117 | \keyword{ANOVA} 118 | \keyword{effect} 119 | \keyword{omega,} 120 | \keyword{size,} 121 | -------------------------------------------------------------------------------- /man/r.correl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/r.correl.R 3 | \name{r.correl} 4 | \alias{r.correl} 5 | \title{r to Coefficient of Determination (R2) from F} 6 | \usage{ 7 | r.correl(r, n, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{r}{correlation coefficient} 11 | 12 | \item{n}{sample size} 13 | 14 | \item{a}{significance level} 15 | } 16 | \value{ 17 | Provides correlation coefficient and coefficient of 18 | determination with associated confidence intervals 19 | and relevant statistics. 20 | 21 | \item{r}{correlation coefficient} 22 | \item{rlow}{lower level confidence interval r} 23 | \item{rhigh}{upper level confidence interval r} 24 | \item{R2}{coefficient of determination} 25 | \item{R2low}{lower level confidence interval of R2} 26 | \item{R2high}{upper level confidence interval of R2} 27 | \item{se}{standard error} 28 | \item{n}{sample size} 29 | \item{dfm}{degrees of freedom of mean} 30 | \item{dfe}{degrees of freedom of error} 31 | \item{t}{t-statistic} 32 | \item{F}{F-statistic} 33 | \item{p}{p-value} 34 | \item{estimate}{the r statistic and confidence interval in 35 | APA style for markdown printing} 36 | \item{estimateR2}{the R^2 statistic and confidence interval in 37 | APA style for markdown printing} 38 | \item{statistic}{the t-statistic in APA style for markdown printing} 39 | } 40 | \description{ 41 | This function displays transformation from r to r2 to calculate 42 | the non-central confidence interval for r2 using the F distribution. 43 | } 44 | \details{ 45 | The t-statistic is calculated by first dividing one minus the 46 | square root of r squared by degrees of freedom of the error. 47 | r is divided by this value. 48 | 49 | t = r / sqrt((1 - rsq) / (n - 2)) 50 | 51 | The F-statistic is the t-statistic squared. 52 | 53 | Fvalue = t ^ 2 54 | 55 | \href{https://www.aggieerin.com/shiny-server/tests/rcorrel.html}{Learn more on our example page.} 56 | } 57 | \examples{ 58 | 59 | #This example is derived from the mtcars dataset provided in R. 60 | 61 | #What is the correlation between miles per gallon and car weight? 62 | 63 | cor.test(mtcars$mpg, mtcars$wt) 64 | 65 | r.correl(r = -0.8676594, n = 32, a = .05) 66 | } 67 | \keyword{correlation} 68 | \keyword{effect} 69 | \keyword{size,} 70 | -------------------------------------------------------------------------------- /man/rm1_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rm1-data.R 3 | \docType{data} 4 | \name{rm1_data} 5 | \alias{rm1_data} 6 | \title{Repeated Measures Oneway ANOVA Example Data} 7 | \format{ 8 | A data frame including ratings toward pictures. 9 | 10 | neutral: pulse during exposure to neutral stimuli 11 | positive: pulse during exposure to positive stimuli 12 | negative: pulse during exposure to negative stimuli 13 | } 14 | \usage{ 15 | data(rm1_data) 16 | } 17 | \description{ 18 | Dataset for use in \code{\link{omega.F}}. 19 | Participants were tested over several days to measure 20 | variations in their pulse given different types of stimuli. 21 | One stimulus was a neutral picture (like a toaster), 22 | while other stimuli were cute/happy pictures (puppies, babies), 23 | and negative stimuli (mutilated faces, pictures of war). 24 | Were there differences in pulse for each participant 25 | across the stimuli? 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /man/rm2_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rm2-data.R 3 | \docType{data} 4 | \name{rm2_data} 5 | \alias{rm2_data} 6 | \title{Repeated Measures Two-way ANOVA Example Data} 7 | \format{ 8 | A data frame of ratings of word pair relation 9 | 10 | group: A between-subjects variable indicating the type of instructions 11 | subject: A subject number 12 | fsglobsglo: A repeated measures condition of low FSG-BSG 13 | fsghihbsglo: A repeated measures condition of high FSG, low BSG 14 | fsglobsghi: A repeated measures condition of low FSG, high BSG 15 | fsghibsghi: A repeated measures condition of high FSG-BSG 16 | } 17 | \usage{ 18 | data(rm2_data) 19 | } 20 | \description{ 21 | Dataset for use in \code{\link{omega.partial.SS.rm}} and other 22 | repeated measures ANOVA designs. This dataset includes a group variable 23 | used for mixed repeated measures designs, a subject number, and two 24 | repeated measures variables. These variables include FSG (forward strength) 25 | which is a measure of the relation between two words like cheddar to cheese. 26 | The second variable is BSG (backward strength), which is the opposite 27 | relation (cheese to cheddar). Participants rated those word pairs in and the 28 | strength of FSG and BSG was manipulated to measure overestimation of strength. 29 | } 30 | \keyword{datasets} 31 | -------------------------------------------------------------------------------- /man/singt_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/singt-data.R 3 | \docType{data} 4 | \name{singt_data} 5 | \alias{singt_data} 6 | \title{Single Sample t Example Data} 7 | \format{ 8 | A data frame including a single sample consisting of SAT scores of students from 9 | a gifted/honors program at a specific school. 10 | } 11 | \usage{ 12 | data(singt_data) 13 | } 14 | \description{ 15 | A simulated dataset for use in \code{\link{d.single.t}} and \code{\link{d.single.t.t}}, including 16 | gifted/honors student SAT scores from a specific school to use for comparison with the 17 | national average SAT score (1080) of gifted/honors students nationwide. 18 | } 19 | \keyword{datasets} 20 | -------------------------------------------------------------------------------- /man/v.chi.sq.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/v.chi.sq.R 3 | \name{v.chi.sq} 4 | \alias{v.chi.sq} 5 | \title{V for Chi-Square} 6 | \usage{ 7 | v.chi.sq(x2, n, r, c, a = 0.05) 8 | } 9 | \arguments{ 10 | \item{x2}{chi-square statistic} 11 | 12 | \item{n}{sample size} 13 | 14 | \item{r}{number of rows in the contingency table} 15 | 16 | \item{c}{number of columns in the contingency table} 17 | 18 | \item{a}{significance level} 19 | } 20 | \value{ 21 | Provides V with associated confidence intervals 22 | and relevant statistics. 23 | 24 | \item{v}{v-statistic} 25 | \item{vlow}{lower level confidence interval of V} 26 | \item{vhigh}{upper level confidence interval of V} 27 | \item{n}{sample size} 28 | \item{df}{degrees of freedom} 29 | \item{x2}{significance statistic} 30 | \item{p}{p-value} 31 | \item{estimate}{the V statistic and confidence interval in 32 | APA style for markdown printing} 33 | \item{statistic}{the X2-statistic in APA style for markdown printing} 34 | } 35 | \description{ 36 | This function displays V and non-central confidence interval 37 | for the specified chi-square statistic. 38 | } 39 | \details{ 40 | V is calculated by finding the square root of chi-squared divided by the product 41 | of the sample size and the degrees of freedom with the lowest value. 42 | 43 | v = sqrt(x2 / (n * dfsmall)) 44 | 45 | \href{https://www.aggieerin.com/shiny-server/tests/chiv.html}{Learn more on our example page.} 46 | } 47 | \examples{ 48 | 49 | #The following example is derived from the "chisq_data" dataset, included 50 | #in the MOTE library. 51 | 52 | #Individuals were polled about their number of friends (low, medium, high) 53 | #and their number of kids (1, 2, 3+) to determine if there was a 54 | #relationship between friend groups and number of children, as we 55 | #might expect that those with more children may have less time for 56 | #friendship maintaining activities. 57 | 58 | chisq.test(chisq_data$kids, chisq_data$friends) 59 | 60 | v.chi.sq(x2 = 2.0496, n = 60, r = 3, c = 3, a = .05) 61 | 62 | #Please note, if you see a warning, that implies the lower effect should 63 | #be zero, as noted. 64 | } 65 | \keyword{chi-square} 66 | \keyword{effect} 67 | \keyword{size,} 68 | --------------------------------------------------------------------------------