File: phtest.Rd

package info (click to toggle)
r-cran-plm 2.6-2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,032 kB
  • sloc: sh: 13; makefile: 4
file content (112 lines) | stat: -rw-r--r-- 3,650 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test_general.R
\name{phtest}
\alias{phtest}
\alias{phtest.formula}
\alias{phtest.panelmodel}
\title{Hausman Test for Panel Models}
\usage{
phtest(x, ...)

\method{phtest}{formula}(
  x,
  data,
  model = c("within", "random"),
  effect = c("individual", "time", "twoways"),
  method = c("chisq", "aux"),
  index = NULL,
  vcov = NULL,
  ...
)

\method{phtest}{panelmodel}(x, x2, ...)
}
\arguments{
\item{x}{an object of class \code{"panelmodel"} or \code{"formula"},}

\item{\dots}{further arguments to be passed on (currently none).}

\item{data}{a \code{data.frame},}

\item{model}{a character vector containing the names of two models
(length(model) must be 2),}

\item{effect}{a character specifying the effect to be introduced to both models,
one of \code{"individual"}, \code{"time"}, or \code{"twoways"} (only for formula method),}

\item{method}{one of \code{"chisq"} or \code{"aux"},}

\item{index}{an optional vector of index variables,}

\item{vcov}{an optional covariance function,}

\item{x2}{an object of class \code{"panelmodel"} (only for panelmodel method/interface),}
}
\value{
An object of class \code{"htest"}.
}
\description{
Specification test for panel models.
}
\details{
The Hausman test (sometimes also called Durbin--Wu--Hausman test)
is based on the difference of the vectors of coefficients of two
different models.  The \code{panelmodel} method computes the original
version of the test based on a quadratic form
\insertCite{HAUS:78}{plm}. The \code{formula} method, if
\code{method = "chisq"} (default), computes the original version of the
test based on a quadratic form; if \code{method ="aux"} then the
auxiliary-regression-based version as in \insertCite{WOOL:10;textual}{plm},
Sec.10.7.3. Only the latter can be robustified by specifying a robust
covariance estimator as a function through the argument \code{vcov} (see
\strong{Examples}).

The \code{effect} argument is only relevant for the formula method/interface and
is then applied to both models. For the panelmodel method/interface, the test
is run with the effects of the already estimated models.

The equivalent tests in the \strong{one-way} case using a between
model (either "within vs. between" or "random vs. between")
\insertCite{@see @HAUS:TAYL:81 or @BALT:13 Sec.4.3}{plm} can also
be performed by \code{phtest}, but only for \code{test = "chisq"}, not for
the regression-based test. NB: These equivalent tests using the
between model do not extend to the two-ways case.  There are,
however, some other equivalent tests,
\insertCite{@see @KANG:85 or @BALT:13 Sec.4.3.7}{plm},
but those are unsupported by \code{phtest}.
}
\examples{

data("Gasoline", package = "plm")
form <- lgaspcar ~ lincomep + lrpmg + lcarpcap
wi <- plm(form, data = Gasoline, model = "within")
re <- plm(form, data = Gasoline, model = "random")
phtest(wi, re)
phtest(form, data = Gasoline)
phtest(form, data = Gasoline, effect = "time")

# Regression-based Hausman test
phtest(form, data = Gasoline, method = "aux")

# robust Hausman test with vcov supplied as a function and 
# with additional parameters
phtest(form, data = Gasoline, method = "aux", vcov = vcovHC)
phtest(form, data = Gasoline, method = "aux",
  vcov = function(x) vcovHC(x, method="white2", type="HC3"))

}
\references{
\insertRef{HAUS:78}{plm}

\insertRef{HAUS:TAYL:81}{plm}

\insertRef{KANG:85}{plm}

\insertRef{WOOL:10}{plm}

\insertRef{BALT:13}{plm}
}
\author{
Yves Croissant, Giovanni Millo
}
\keyword{htest}