opt.h: Optimization routine based on hypothesis testing.

Description Usage Arguments Value Examples

Description

This function uses hypothesis tests to optimize a glm. If method is "joint", a joint significance tests of the full model against the model with only paramaeters that are significant in the full model is performed. If the insignificant variables are jointly significant, the alternative specification is returned. If the insignificant variables are jointly insignificant, the parameter with the largest p-value is dropped, and the test is repeated. If method is "single", the hypothesis tests are made between the full model and a model with one variable less. The tests are repeated till removing variables is not supported by the specified test. Single wald tests are equal to t-tests, F-tests are finite sample tests. Note that optimizing by single parameter tests is restrictive, for a discussion look up bonferonni corrections. Only the joint tests are available through autoGLM, for single tests opt.t is available. Though both methods use hypothesis testing a a decision criterion, the returned models may differ. This is a common result of hypothesis tests, and is one argument why model selection may be based on information criteria. for a discussion see for example "Comments on testing economic theories and the use of model selection criteria" by Granger, King and White (1995).

Usage

1
2
opt.h(model, Y, X, returntype = "model", tracelevel = 0, crit.p = 0.1,
  test = "LR", method = "joint", memorymanagement = FALSE)

Arguments

model

The model to be optimized. Supports "lm" for the linear probability model, "logit" for the logistic probability model, and "probit" for the probit model.

Y

The binary response variable.

X

A dataframe with collumns of exogenous regressors.

returntype

"model", "data", or "colnames"

tracelevel

level of printing.

crit.p

p value used in hypothesis tests.

test

type of test, either "LR", "F", or "Chisq".

memorymanagement

logical, indicating whether memory should be more actively managed.

Value

"model", "data", or "colnames", to be specified in returnype.

Examples

1
2
3
4
5
pars = c(0.5, -0.4, -0.3, 0.1, 0.05, 0.025, 0, 0, 0, 0,0,0,0)
randomlogit <- simulateLogit(nobs=8000, pars = pars)
Y=randomlogit[,1]
X=randomlogit[,-1]
hmod <- opt.h(model="logit", Y, X, returntype="model", tracelevel=1, crit.p=0.05, test="LR")

BPJandree/AutoGLM documentation built on May 5, 2019, 10:25 a.m.