Learn R Programming

lessR (version 1.5.2)

stats.t.test: Generic Method for t-test and Standardized Mean Difference from Summary Statistics

Description

Performs the independent-groups t-test for the comparison of means from the six basic summary statistics, the sample size, sample mean and sample standard deviation for each group. Displays the basic t-value and p-value and also many of the intermediate computations, such as the within-group or pooled standard deviation.

Usage

stats.t.test(n1 = NULL, n2 = NULL,  m1 = NULL, m2 = NULL, s1 = NULL, 
    s2 = NULL, Ynm = "Y", Xnm = "X", X1nm = "Group1", X2nm = "Group2", 
    conf.level = 0.95, digits = 2, ...)

Arguments

n1
Sample size for first group.
n2
Sample size for second group.
m1
Sample mean for first group.
m2
Sample mean for second group.
s1
Sample standard deviation for first group.
s2
Sample standard deviation for second group.
Ynm
Name of response variable.
Xnm
Name of predictor variable, the grouping variable or factor with exactly two levels.
X1nm
Value of grouping variable, the level that defines the first group.
X2nm
Value of grouping variable, the level that defines the second group.
conf.level
Confidence level of the interval, expressed as a proportion.
digits
Number of decimal places for which to display numeric values. Suggestion only.
...
Further arguments to be passed to or from methods.

Details

This function parallels the smd.t.test function included in this package, which performs the independent-groups t-test from the data. In contrast, stats.t.test performs the analysis from the six basic summary statistics: the sample size, sample mean and sample standard deviation for each group. Accordingly, there is no graphic output from this function as with smd.t.test.

This version of stats.t.test assumes homogeneity of variance in the computation of the standard error of the mean difference. Also, only a two-sided test is provided. The null hypothesis is a population mean difference of 0.

See Also

smd.t.test, t.test.

Examples

Run this code
stats.t.test(n1=19, n2=15, m1=9.5, m2=8, s1=1.4, s2=1.5, 
           Ynm="Y", Xnm="X", X1nm="Group1", X2nm="Group2", 
           conf.level=0.95, digits=2)

Run the code above in your browser using DataLab