testC: linear contrast of c_st

Description Usage Arguments Details Value Examples

Description

estimates linear contrasts of the elements of c, c_s, c_t, or c_st from a predPref object

Usage

1
2
testC(x, b, mu = 0, alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95, sig.level = 0.05)

Arguments

x

a predPref object as fit by the eponymous function

b

a vector to linearly transform c_st

mu

a number to test the linear contrast against in the null

alternative

string to specify alternative hypothesis

conf.level

confidence level of the interval

sig.level

determines null/alternative hypothesis value of c_st from predPref

Details

The input vector b performs the linear transformation t(b) %*% matrix(c_st), so that c_st becomes a column vector by indexing t first and then s. Hence there is no requirement of a linear contrast, any linear transformation such that t(b) %*% matrix(1, nrow=length(b)) != 0 is allowed.

Of the two estimated hypotheses in the underlying call to predPref, the linear transformation b is applied to the hypothesis that is determined by the choice of sig.level.

Value

A list with class '"htest"' containing the following components:

statistic: the value of the t-statistic.

parameter: the degrees of freedom for the t-statistic.

p.value: the p-value for the test.

conf.int: a confidence interval for the mean appropriate to the specified alternative hypothesis.

estimate: the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test.

null.value: the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test.

alternative: a character string describing the alternative hypothesis.

method: a character string indicating what type of t-test was performed.

data.name: a character string giving the names of the data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# set parameters
Predators <- Traps <- 100
PreySpecies <- 2
Times <- 5
g <- matrix(sqrt(2), nrow=Times, ncol=PreySpecies)     # gamma
l <- matrix(seq(0.4,1.8,length.out=5)*sqrt(2), nrow=Times, ncol=PreySpecies) # ct

# fit model and contrast
## Not run: 
set.seed(0)
fdata <- simPref(PreySpecies, Times, Predators, Traps, l, g, EM=FALSE) # p-value=0.305
pref <- predPref(fdata$eaten, fdata$caught, hypotheses=c('ct', 'cst'))
testC(pref, b = c(0,1, -1, 0, 0)) # p-value > sig.level => ct is used, not cst

## End(Not run)

spiders documentation built on May 2, 2019, 12:30 p.m.