tContrast: Conduct a t-contrast

Description Usage Arguments Details Author(s) References Examples

Description

Returns a t-value based on the given contrast weights Same as yuen.contrast (see Ryne's code, not implemented in russmisc) only no trimming is allowed. Created largely for sanity checks, yuen.contrast should generally be used.

Usage

1
2
3
4
5
tContrast(DV, IV, wgt = NULL, alpha = 0.05, EQVAR = FALSE,
  alternative = "greater")

## S3 method for class 'tContrast'
print(x, ...)

Arguments

DV

A numeric vector of the same length as IV containing the measured values.

IV

A factor of the same length as DV containing the independent variable codes.

wgt

A numeric vector containing the contrast weights corresponding to each successive level of the IV. If this value is left NULL, the function will try to use the contrasts set on the IV to conduct the test(s)

alpha

A numeric element > .00 and < 1.00 specifying the Type I error rate.

EQVAR

A logical indicating whether equal variances amongst the groups should be assumed.

alternative

A character vector specifying the alternative hypothesis. Must be one of "unequal", "greater", or "less".

x

an object used to select the method.

...

further arguments passed to or from other methods.

Details

This function computes a t-value for a DV given a set of contrast weights following Rosenthal, Rosnow, & Rubin (2000). If EQVAR=FALSE then degrees of freedom are calculated using Welch's method. The wgt option allows one to specify contrast weights to test hypotheses with more than 2 levels of an IV. By default it tests the hypothesis that the sum of the wgt vector times the DV means for each IV is greater than 0. To get a two-tailed p-value or one predicting a negative contrast, change the alternative parameter.

Author(s)

Ryne Sherman <rsherm13@fau.edu>; modifications by Russell S. Pierce <rpier001@ucr.edu>

References

Rosenthal, R., Rosnow, R.L., & Rubin, D.B. (2000). Contrasts and effect sizes in behavioral research: A correlational approach. New York: Cambridge University Press.

Rosenthal, R., Rosnow, R.L., & Rubin, D.B. (2000). Contrasts and correlations in effect-size estimation. Psychological science. 11(6), 446-453.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# To test a single contrast...
tContrast(warpbreaks$breaks,warpbreaks$tension,wgt=c(-1,0,1))
# To test multiple contrasts...
# We make a matrix with our desired contrasts
my.contr <- cbind(
 I = c(-1,0,1),
 II = c(1,0,-1),
 III = c(1,-2,1)
)
# Now we set the contrasts along side the variable
# Now we have to change how.many to match the number
# of contrasts we have 
contrasts(warpbreaks[,"tension"],how.many=3) <- my.contr # set the contrasts for the 'group' factor
tContrast(warpbreaks$breaks,warpbreaks$tension)

drknexus/repsych documentation built on May 15, 2019, 2:19 p.m.