guessStartVal: A function to efficiently obtain starting values for...

Description Usage Arguments Value Examples

Description

This function is called by generalizeToSpecific(), but may also be called by users directly to obtain an initial gues of starting values to be passed on to easygmmlogit().

Usage

1
2
guessStartVal(Y, X, model = "logit", s1 = 0.25, s2 = s1, c1 = 0.85,
  c2 = c1, tracelevel = 1, memorymanagement = TRUE)

Arguments

Y

A binary response variable.

X

A dataset containing multiple exogenous regressors.

model

The model for which starting values should be estimated. Either "logit" or "probit" for the logit or probit model, or "gmm_nlminb" for a logit model estimated with gmm using PORT routines (reliable) or "gmm_bfgs" using the BFGS algorithm (fast, but still very slow compared to option "logit").

s1

Share of the sample used for the guess

s2

share of the subsample used to initialize the guess. If s2 =0.25, s1 =0.25, the guess is initialized at a .05 share of the entire dataset, or .25 of s1*datasize.

c1

confidence of first sample, see getSamples.

c2

confidence of subsample, see getSamples. #' @param tracelevel Whether information should be printed during execution. Defaults to 1 for printing, set to 0 for no printing.

memorymanagement

TRUE/FALSE indicating whether garbage collection should be forec regularly when memory usage is high. Defaults to TRUE, recommended setting for large datasets.

Value

A vector of coefficients that can be passed on to numerical optimization algorithms.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
set.seed(234)

randomlogit <- simulateLogit(nobs=50000, pars = c(0.25, -0.2, -0.3, 0.1, 0.05, 0.025, 0.01,
                             0.005, 0.005, 0.005,0.005,0.0025,
                             0.0025,0.0025,0.0025,0,0,0,0,0,0))

Y=randomlogit[,1]
X=randomlogit[,-1]



# i5 4570 @ 3.2 GHz
system.time(guessStartVal(Y, X, model="logit"))
# user  system elapsed
0.29    0.00    0.30
system.time(logit(cbind(Y,X)))
# user  system elapsed
0.79    0.00    0.80
# the IWLS algorithm used for glm is already quite fast.

system.time(guessStartVal(Y, X, model="gmm_nlminb"))
# user  system elapsed
40.78    4.17    45.35
system.time(logit(cbind(Y,X), method ="gmm"))
# user  system elapsed
179.52   27.55  207.76
# the difference for gmm is quite large. It pays to do:
system.time(logit(cbind(Y,X), method ="gmm", start=guessStartVal(Y, X, model="logit")))
# user  system elapsed
160.55   21.79  182.48

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