bread.systemfit: Bread for Sandwiches

Description Usage Arguments Value Warnings Author(s) See Also Examples

View source: R/bread.systemfit.R

Description

Extract the estimator for the bread of sandwhiches (see bread).

Usage

1
2
## S3 method for class 'systemfit'
bread( obj, ... )

Arguments

obj

an object of class systemfit.

...

further arguments (currently ignored).

Value

Quadratic symmetric matrix, which is an estimator for the expectation of the negative derivative of the estimating function (see estfun.systemfit).

Warnings

The sandwich package must be loaded before this method can be used.

This method might not be suitable for specific formulas for 3SLS estimations in case of unbalanced systems or different instruments for different equations.

Author(s)

Arne Henningsen

See Also

bread, systemfit.

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
45
46
47
48
49
50
51
52
53
data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )
inst <- ~ income + farmPrice + trend

## OLS estimation
fitols <- systemfit( system, "OLS", data = Kmenta )

## obtain the bread
library( "sandwich" )
bread( fitols )

## this is only true for OLS models
all.equal( bread( fitols ),
   solve( crossprod( model.matrix( fitols ) ) / 40 ) )


## 2SLS estimation
fit2sls <- systemfit( system, "2SLS", inst = inst, data = Kmenta )

## obtain the bread
bread( fit2sls )

## this is only true for 2SLS models
all.equal( bread( fit2sls ),
   solve( crossprod( model.matrix( fit2sls, which = "xHat" ) ) / 40 ) )


## iterated SUR estimation
fitsur <- systemfit( system, "SUR", data = Kmenta, maxit = 100 )

## obtain the bread
bread( fitsur )

## this should be true for SUR and WLS models
all.equal( bread( fitsur ),
   solve( t( model.matrix( fitsur ) ) %*%
      (  ( solve( fitsur$residCovEst ) %x% diag( nrow( Kmenta ) ) ) %*% 
      model.matrix( fitsur ) ) / 40 ), check.attributes = FALSE )


## 3SLS estimation
fit3sls <- systemfit( system, "3SLS", inst = inst, data = Kmenta )

## obtain the bread
bread( fit3sls )

## this should be true for 3SLS and W2SLS models
all.equal( bread( fit3sls ),
   solve( t( model.matrix( fit3sls, which = "xHat" ) ) %*%
      (  ( solve( fit3sls$residCovEst ) %x% diag( nrow( Kmenta ) ) ) %*% 
      model.matrix( fit3sls, which = "xHat" ) ) / 40 ), check.attributes = FALSE )

systemfit documentation built on May 29, 2017, 9:50 p.m.