xpssTtest: Performs a T-Test

Description Usage Arguments Details Value Author(s) Examples

View source: R/xpssTtest.R

Description

R implementation of the SPSS T-TEST function.

Usage

1
2
3
xpssTtest(x, variables = NULL, t_test = "testval", testval = NULL,
  criteria = 0.95, groupvar = NULL, groups = NULL, withvars = NULL,
  paired = FALSE, missing = "analysis")

Arguments

x

a (non-empty) data.frame or input data of class "xpssFrame".

variables

atomic character or character vector with the names of the variables.

t_test

atomic character definies the type of t-test. Default is testval, a one-sample t-test. Optional arguments are groups for an independent-sample test and pairs for an paires-sample test

testval

atomic numeric which indicates the value of mean difference.

criteria

atomic numeric which specifies the confidence interval for the mean differences. Default is "0.95", optionally a customized value between 0 and 1 can be used.

groupvar

atomic character with the name of the variable which shall be used for grouping.

groups

factor variable which specify the variables grouped for an independentsample t-test.

withvars

atomic characters or character vector with the name of the paired variables which shall be used for compare the means. Optionally the argument with can be chosen to compare the means of 2 pairs.

paired

logical. Indicating whether the comparison should be pair based or not.

missing

atomic character determines the method which indicates what should happen when the data contains NAs. Default is analysis. Optionally include oder listwise can be used.

Details

Performs a Student's T-Test. The xpssTtest compares the mean by calculating Students-t of the selected distributions.

It is possible to check the samples.

  1. against a specific value (one-sample) -> testval

  2. in difference of groups (independent-sample)-> groups

  3. in difference of variables (paired-sample) -> pairs

Simple statistics will be printed with every t-test. At the one-sample test, the mean difference will be visualized with the statistics
At the independend-sample test, the mean differnce and ANOVA will be visualized with the statistics
At the paired-sample test, the mean diference and a correlation statistic will be visualizied with the statistics

Value

returns a list depending upon the t-test.

All t-test contain:

statistics simple statistics.
parameter degrees of freedom.
p.value significance level.
conf.int confidence bound.
null.value value of null hypothesis.
alternative value of alternative hypothesis.
method character string with the name of the t-test.
data.name name of the data.

The independent t-test includes additonally:

anova anova of the groups.

The paired t-test includes additonally:

corr correlation of the pairs.

Author(s)

Bastian Wiessner

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
data(fromXPSS)


xpssTtest(fromXPSS,
                   variables = "V7_2",
                   t_test = "testval",
                   testval= 50,
                   criteria = 0.65)

xpssTtest(fromXPSS,
                   t_test = "pairs",
                   variables=c("V5",
                               "V6",
                               "V7_1",
                               "V7_2"),
                   paired = FALSE,
                   missing = "analysis",
                   criteria = 0.85)

xpssTtest(fromXPSS,
                   variables = "V7_2",
                   t_test = "groups",
                   groupvar = "V3",
                   groups = c(1, 2),
                   missing = "analysis",
                   criteria = 0.99)

translateSPSS2R documentation built on May 30, 2017, 4:31 a.m.