waldtest(object, R, r, type=c('default','iid','robust','cluster'),
lhs=NULL, df1, df2)"felm", a result of a call
to felm.waldtest computes and returns a named numeric vector
containing the following elements.pis the p-value for the Chi^2-testchi2is the Chi^2-distributed statistic.df1is the degrees of freedom for the Chi^2 statistic.p.Fis the p-value for the F statisticsFis the F-distributed statistic.df2is the additional degrees of freedom for the F statistic.The return value has an attribute 'formula' which encodes the restrictions.
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.
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.
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)`)Run the code above in your browser using DataLab