paired_ttest
tests that two samples have the
same mean, assuming paired data.
paired_ttest(x, y, confint = 0.95, alternative = c("both", "less", "greater", "all"))
paired_ttest
returns an object of class "paired_ttest"
.
An object of class "paired_ttest"
is a list containing the
following components:
Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.
# lower tail paired_ttest(hsb$read, hsb$write, alternative = 'less')#> Paired Samples Statistics #> --------------------------------------------------------------------------- #> Variables Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] #> --------------------------------------------------------------------------- #> read 200 52.23 0.72 10.25 50.8 53.66 #> write 200 52.77 0.67 9.48 51.45 54.09 #> --------------------------------------------------------------------------- #> diff 200 -0.55 0.63 8.89 -1.79 0.69 #> --------------------------------------------------------------------------- #> #> Paired Samples Correlations #> ------------------------------------------- #> Variables Obs Correlation Sig. #> read & write 200 0.60 0 #> ------------------------------------------- #> #> Paired Samples Test #> ------------------- #> Ho: mean(read - write) = 0 #> Ha: mean(read - write) < 0 #> #> --------------------------------------- #> Variables t df Sig. #> --------------------------------------- #> read - write -0.873 199 0.192 #> ---------------------------------------# upper tail paired_ttest(hsb$read, hsb$write, alternative = 'greater')#> Paired Samples Statistics #> --------------------------------------------------------------------------- #> Variables Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] #> --------------------------------------------------------------------------- #> read 200 52.23 0.72 10.25 50.8 53.66 #> write 200 52.77 0.67 9.48 51.45 54.09 #> --------------------------------------------------------------------------- #> diff 200 -0.55 0.63 8.89 -1.79 0.69 #> --------------------------------------------------------------------------- #> #> Paired Samples Correlations #> ------------------------------------------- #> Variables Obs Correlation Sig. #> read & write 200 0.60 0 #> ------------------------------------------- #> #> Paired Samples Test #> ------------------- #> Ho: mean(read - write) = 0 #> Ha: mean(read - write) > 0 #> #> --------------------------------------- #> Variables t df Sig. #> --------------------------------------- #> read - write -0.873 199 0.808 #> ---------------------------------------# both tails paired_ttest(hsb$read, hsb$write, alternative = 'both')#> Paired Samples Statistics #> --------------------------------------------------------------------------- #> Variables Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] #> --------------------------------------------------------------------------- #> read 200 52.23 0.72 10.25 50.8 53.66 #> write 200 52.77 0.67 9.48 51.45 54.09 #> --------------------------------------------------------------------------- #> diff 200 -0.55 0.63 8.89 -1.79 0.69 #> --------------------------------------------------------------------------- #> #> Paired Samples Correlations #> ------------------------------------------- #> Variables Obs Correlation Sig. #> read & write 200 0.60 0 #> ------------------------------------------- #> #> Paired Samples Test #> ------------------- #> Ho: mean(read - write) = 0 #> Ha: mean(read - write) ~= 0 #> #> --------------------------------------- #> Variables t df Sig. #> --------------------------------------- #> read - write -0.873 199 0.384 #> ---------------------------------------# all tails paired_ttest(hsb$read, hsb$write, alternative = 'all')#> Paired Samples Statistics #> --------------------------------------------------------------------------- #> Variables Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] #> --------------------------------------------------------------------------- #> read 200 52.23 0.72 10.25 50.8 53.66 #> write 200 52.77 0.67 9.48 51.45 54.09 #> --------------------------------------------------------------------------- #> diff 200 -0.55 0.63 8.89 -1.79 0.69 #> --------------------------------------------------------------------------- #> #> Paired Samples Correlations #> ------------------------------------------- #> Variables Obs Correlation Sig. #> read & write 200 0.60 0 #> ------------------------------------------- #> #> Ho: mean(read - write) = mean(diff) = 0 #> #> Ha: mean(diff) < 0 Ha: mean(diff) ~= 0 Ha: mean(diff) > 0 #> t = -0.873 t = -0.873 t = -0.873 #> P < t = 0.192 P > |t| = 0.384 P > t = 0.808