conTest_ceq: Tests for iht with equality constraints only

View source: R/conTest.R

conTest_ceqR Documentation

Tests for iht with equality constraints only

Description

conTest_ceq tests linear equality restricted hypotheses for (robust) linear models by F-, Wald-, and score-tests. It can be used directly and is called by the conTest function if all restrictions are equalities.

Usage


## S3 method for class 'conLM'
conTest_ceq(object, test = "F", boot = "no", 
            R = 9999, p.distr = rnorm, parallel = "no", 
            ncpus = 1L, cl = NULL, seed = 1234, verbose = FALSE, ...)

## S3 method for class 'conRLM'
conTest_ceq(object, test = "F", boot = "no", 
            R = 9999, p.distr = rnorm, parallel = "no", 
            ncpus = 1L, cl = NULL, seed = 1234, verbose = FALSE, ...)
            
## S3 method for class 'conGLM'
conTest_ceq(object, test = "F", boot = "no", 
            R = 9999, p.distr = rnorm, parallel = "no", 
            ncpus = 1L, cl = NULL, seed = 1234, verbose = FALSE, ...)            

Arguments

object

an object of class conLM, conRLM or conGLM.

test

test statistic; for information about the null-distribution see details.

  • for object of class lm and glm; if "F" (default), the classical F-statistic is computed. If "Wald", the classical Wald-statistic is computed. If "score", the classical score test statistic is computed.

  • for object of class rlm; if "F" (default), a robust likelihood ratio type test statistic (Silvapulle, 1992a) is computed. If "Wald", a robust Wald test statistic (Silvapulle, 1992b) is computed. If "score", a score test statistic (Silvapulle, 1996) is computed.

boot

if "parametric", the p-value is computed based on the parametric bootstrap. See p.distr for available distributions. If "model.based", a model-based bootstrap method is used. Model-based bootstrapping is not supported for the conGLM object yet.

R

integer; number of bootstrap draws for boot. The default value is set to 9999.

p.distr

the p.distr function is specified by this function. For all available distributions see ?distributions. For example, if rnorm, samples are drawn from the normal distribution (default) with mean zero and variance one. If rt, samples are drawn from a t-distribution. If rchisq, samples are drawn from a chi-square distribution. The distributional parameters will be passed in via ....

parallel

the type of parallel operation to be used (if any). If missing, the default is set "no".

ncpus

integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs.

cl

an optional parallel or snow cluster for use if parallel = "snow". If not supplied, a cluster on the local machine is created for the duration of the conTest call.

seed

seed value. The default value is set to 1234.

verbose

logical; if TRUE, information is shown at each bootstrap draw.

...

additional arguments to be passed to the p.distr function.

Value

An object of class conTest, for which a print is available. More specifically, it is a list with the following items:

CON

a list with useful information about the constraints.

Amat

constraints matrix.

bvec

vector of right-hand side elements.

meq

number of equality constraints.

test

same as input.

Ts

test-statistic value.

df.residual

the residual degrees of freedom.

pvalue

tail probability for Ts.

b_unrestr

unrestricted regression coefficients.

b_restr

restricted regression coefficients.

R2_org

unrestricted R-squared.

R2_reduced

restricted R-squared.

Author(s)

Leonard Vanbrabant and Yves Rosseel

References

Silvapulle, M. (1992a). Robust tests of inequality constraints and one-sided hypotheses in the linear model. Biometrika, 79, 621–630.

Silvapulle, M. (1996) Robust bounded influence tests against one-sided hypotheses in general parametric models. Statistics and probability letters, 31, 45–50.

Silvapulle, M. (1992b). Robust Wald-Type Tests of One-Sided Hypotheses in the Linear Model. Journal of the American Statistical Association, 87, 156–161.

Silvapulle, M. (1996) Robust bounded influence tests against one-sided hypotheses in general parametric models. Statistics and probability letters, 31, 45–50.

See Also

quadprog, iht

Examples

## example 1:
# the data consist of ages (in months) at which an 
# infant starts to walk alone.

# prepare data
DATA1 <- subset(ZelazoKolb1972, Group != "Control")

# fit unrestricted linear model
fit1.lm <- lm(Age ~ -1 + Group, data = DATA1)

# the variable names can be used to impose constraints on
# the corresponding regression parameters.
coef(fit1.lm)

# constraint syntax: assuming that the walking 
# exercises would not have a negative effect of increasing the 
# mean age at which a child starts to walk. 
myConstraints1 <- ' GroupActive = GroupPassive = GroupNo '

iht(fit1.lm, myConstraints1)


# another way is to first fit the restricted model
fit_restr1 <- restriktor(fit1.lm, constraints = myConstraints1)

iht(fit_restr1)

 
# Or in matrix notation.
Amat1 <- rbind(c(-1, 0,  1),
               c( 0, 1, -1))
myRhs1 <- rep(0L, nrow(Amat1)) 
myNeq1 <- 2

iht(fit1.lm, constraints = Amat1,
    rhs = myRhs1, neq = myNeq1)


LeonardV/restriktor documentation built on April 12, 2024, 1:27 p.m.