coef.hetprobit: Extractor Methods for hetprobit Objects

Description Usage Arguments Details Value See Also Examples

Description

Methods for extracting information from fitted heteroscedastic probit model objects.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'hetprobit'
coef(object, model = c("full", "mean", "scale"), ...)
## S3 method for class 'hetprobit'
vcov(object, model = c("full", "mean", "scale"), ...)

## S3 method for class 'hetprobit'
terms(x, model = c("mean", "scale", "full"), ...)
## S3 method for class 'hetprobit'
model.matrix(object, model = c("mean", "scale"), ...)

Arguments

object, x

a fitted model object of class hetprobit.

model

for which component of the model the information should be returned?

...

currently not used.

Details

The default extracts the information of the full model (mean and scale). With mean or scale information of the mean or scale part of the model is returned.

In addition to the methods above, a set of standard extractor functions for "hetprobit" objects is available, see link[hetprobit]{hetprobit} for an overview.

Value

A vector or matrix with model information.

See Also

hetprobit

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## packages
require("glmx")

## artificial example
## data-generating process
dgp <- function(n = 500, coef = c(0.5, -1.5, 0, 1, 0)) {
  d <- data.frame(
    x1 = runif(n, -1, 1),
    x2 = runif(n, -1, 1)
  )
  d$ystar <- rnorm(n,
    mean = coef[1] + coef[2] * d$x1 + coef[3] * d$x2,
    sd = exp(coef[4] * d$x1 + coef[5] * d$x2)
  )
  d$y <- ifelse(d$ystar > 0, 1, 0)
  return(d)
}

## data
set.seed(2017-05-20)
d <- dgp()

## estimate model
m1 <- hetprobit(y ~ x1 + x2, data = d)

## extract coefficients of the full model (default)
coef(m1)

## extract coefficients of either the mean or scale model
coef(m1, model = "mean")
coef(m1, model = "scale")

## corresponding model matrices
head(model.matrix(m1, model = "mean"))
head(model.matrix(m1, model = "scale"))

## corresponding covariances 
vcov(m1)

## compare covariances with benchmark model m0 
## using hetglm.fit from package glmx
m0 <- hetglm(y ~ x1 + x2, data = d, method = "BFGS", hessian = TRUE)

vcov(m0)

hetprobit documentation built on May 2, 2019, 5:19 p.m.