Learn R Programming

lfe (version 2.8-8)

waldtest: Compute Wald test for joint restrictions on coefficients

Description

Compute a Wald test for a linear hypothesis on the coefficients. Also supports Delta-approximation for non-linear hypotheses.

Usage

waldtest(
  object,
  R,
  r,
  type = c("default", "iid", "robust", "cluster"),
  lhs = NULL,
  df1,
  df2
)

Value

The function waldtest computes and returns a named numeric vector containing the following elements.

  • p is the p-value for the Chi^2-test

  • chi2 is the Chi^2-distributed statistic.

  • df1 is the degrees of freedom for the Chi^2 statistic.

  • p.F is the p-value for the F statistics

  • F is the F-distributed statistic.

  • df2 is the additional degrees of freedom for the F statistic.

The return value has an attribute 'formula' which encodes the restrictions.

Arguments

object

object of class "felm", a result of a call to felm.

R

matrix, character, formula, function, integer or logical. Specification of which exclusions to test.

r

numerical vector.

type

character. Error structure type.

lhs

character. Name of left hand side if multiple left hand sides.

df1

integer. If you know better than the default df, specify it here.

df2

integer. If you know better than the default df, specify it here.

Details

The function waldtest computes a Wald test for the H0: R beta = r, where beta is the estimated vector coef(object).

If R is a character, integer, or logical vector it is assumed to specify a matrix which merely picks out a subset of the coefficients for joint testing. If r is not specified, it is assumed to be a zero vector of the appropriate length.

R can also be a formula which is linear in the estimated coefficients, e.g. of the type ~Q-2|x-2*z which will test the joint hypothesis Q=2 and x=2*z.

If R is a function (of the coefficients), an approximate Wald test against H0: R(beta) == 0, using the Delta-method, is computed.

In case of an IV-estimation, the names for the endogenous variables in coef(object) are of the type "`Q(fit)`" which is a bit dull to type; if all the endogenous variables are to be tested they can be specified as "endovars". It is also possible to specify an endogenous variable simply as "Q", and waldtest will add the other syntactic sugar to obtain "`Q(fit)`".

The type argument works as follows. If type=='default' it is assumed that the residuals are i.i.d., unless a cluster structure was specified to felm. If type=='robust', a heteroscedastic structure is assumed, even if a cluster structure was specified in felm.

See Also

nlexpect

Examples

Run this code

x <- rnorm(10000)
x2 <- rnorm(length(x))
y <- x - 0.2*x2 + rnorm(length(x))
#Also works for lm
summary(est <- lm(y ~ x + x2  ))
# We do not reject the true values
waldtest(est, ~ x-1|x2+0.2|`(Intercept)`)
# The Delta-method coincides when the function is linear:
waldtest(est, function(x) x - c(0, 1, -0.2))

Run the code above in your browser using DataLab