ancova: Robust ANCOVA

Description Usage Arguments Value References See Also Examples

Description

This function computes robust ANCOVA for 2 independent groups and one covariate. It compares trimmed means. No parametric assumption (e.g. homogeneity) is made about the form of the regression lines. A running interval smoother is used. A bootstrap version which computes confidence intervals using a percentile t-bootstrap is provided as well.

Usage

1
2
3
ancova(formula, data, tr = 0.2, fr1 = 1, fr2 = 1, pts = NA)

ancboot(formula, data, tr = 0.2, nboot = 599, fr1 = 1, fr2 = 1, pts = NA)

Arguments

formula

an object of class formula.

data

an optional data frame for the input data.

tr

trim level for the mean.

fr1

values of the span for the first group (1 means unspecified)

fr2

values of the span for the second group (1 means unspecified)

pts

can be used to specify the design points where the regression lines are to be compared; if NA design points are chosen.

nboot

number of bootstrap samples

Value

Returns an object of class ancova containing:

evalpts

covariate values (including points close to these values) where the test statistic is evaluated

n1

number of subjects at evaluation point (first group)

n2

number of subjects at evaluation point (first group)

trDiff

trimmed mean differences

se

standard errors for trimmed mean differences

ci.low

lower confidence limit for trimmed mean differences

ci.hi

upper confidence limit for trimmed mean differences

test

values of the test statistic

crit.vals

critical values

p.vals

p-values

fitted.values

fitted values from interval smoothing

call

function call

References

Wilcox, R. (2012). Introduction to Robust Estimation and Hypothesis Testing (3rd ed.). Elsevier.

See Also

t2way

Examples

1
2
3
4
5
6
7
8
head(invisibility)
ancova(mischief2 ~ cloak + mischief1, data = invisibility)

## specifying covariate evaluation points
ancova(mischief2 ~ cloak + mischief1, data = invisibility, pts = c(3, 4, 8, 1))

## bootstrap version
ancboot(mischief2 ~ cloak + mischief1, data = invisibility)

Example output

     cloak mischief1 mischief2
1 No Cloak         4        11
2 No Cloak         5         7
3 No Cloak         8         8
4 No Cloak         6         7
5 No Cloak         6        10
6 No Cloak         4         7
Call:
ancova(formula = mischief2 ~ cloak + mischief1, data = invisibility)

              n1 n2   diff     se lower CI upper CI statistic p-value
mischief1 = 2 21 17 1.4056 0.7444  -0.6734   3.4846    1.8882  0.0723
mischief1 = 4 31 26 1.7336 0.5538   0.2270   3.2401    3.1302  0.0037
mischief1 = 5 32 26 1.0125 0.6039  -0.6394   2.6644    1.6766  0.1044
mischief1 = 6 29 24 1.1711 0.5067  -0.2059   2.5480    2.3109  0.0273
mischief1 = 7 24 17 1.3750 0.5259  -0.0791   2.8291    2.6145  0.0150

Call:
ancova(formula = mischief2 ~ cloak + mischief1, data = invisibility, 
    pts = c(3, 4, 8, 1))

              n1 n2   diff     se lower CI upper CI statistic p-value
mischief1 = 3 24 24 1.1250 0.6200  -0.5169   2.7669    1.8146  0.0801
mischief1 = 4 31 26 1.7336 0.5538   0.2768   3.1903    3.1302  0.0037
mischief1 = 8 21  9 1.5385 0.8225  -0.8669   3.9439    1.8706  0.0879
mischief1 = 1 15 10 1.8889 0.8190  -0.6157   4.3935    2.3064  0.0469

Call:
ancboot(formula = mischief2 ~ cloak + mischief1, data = invisibility)

              n1 n2   diff lower CI upper CI statistic p-value
mischief1 = 2 21 17 1.4056  -0.6596   3.4708    1.8882  0.0584
mischief1 = 4 31 26 1.7336   0.1971   3.2700    3.1302  0.0050
mischief1 = 5 32 26 1.0125  -0.6628   2.6878    1.6766  0.1202
mischief1 = 6 29 24 1.1711  -0.2348   2.5769    2.3109  0.0367
mischief1 = 7 24 17 1.3750  -0.0840   2.8340    2.6145  0.0200

WRS2 documentation built on May 2, 2019, 4:46 p.m.