binsregtest: Data-driven Nonparametric Shape Restriction and Parametric...

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

Description

binsregtest implements binscatter-based hypothesis testing procedures for parametric functional forms of and nonparametric shape restrictions on the regression function estimators, following the results in Cattaneo, Crump, Farrell and Feng (2019a). If the binning scheme is not set by the user, the companion function binsregselect is used to implement binscatter in a data-driven (optimal) way and inference procedures are based on robust bias correction. Binned scatter plots can be constructed using the companion function binsreg.

Usage

1
2
3
4
5
6
7
8
binsregtest(y, x, w = NULL, deriv = 0, testmodel = c(3, 3),
  testmodelparfit = NULL, testmodelpoly = NULL, testshape = c(3, 3),
  testshapel = NULL, testshaper = NULL, testshape2 = NULL,
  bins = c(0, 0), nbins = NULL, binspos = "qs", binsmethod = "dpi",
  nbinsrot = NULL, nsims = 500, simsgrid = 20, simsseed = 666,
  vce = "HC1", cluster = NULL, dfcheck = c(20, 30),
  masspoints = "on", weights = NULL, subset = NULL, numdist = NULL,
  numclust = NULL)

Arguments

y

outcome variable. A vector.

x

independent variable of interest. A vector.

w

control variables. A matrix or a vector.

deriv

derivative order of the regression function for estimation, testing and plotting. The default is deriv=0, which corresponds to the function itself.

testmodel

a vector. testmodel=c(p,s) sets a piecewise polynomial of degree p with s smoothness constraints for parametric model specification testing. The default is testmodel=c(3,3), which corresponds to a cubic B-spline estimate of the regression function of interest for testing against the fitting from a parametric model specification.

testmodelparfit

a data frame or matrix which contains the evaluation grid and fitted values of the model(s) to be tested against. The column contains a series of evaluation points at which the binscatter model and the parametric model of interest are compared with each other. Each parametric model is represented by other columns, which must contain the fitted values at the corresponding evaluation points.

testmodelpoly

degree of a global polynomial model to be tested against.

testshape

a vector. testshape=c(p,s) sets a piecewise polynomial of degree p with s smoothness constraints for nonparametric shape restriction testing. The default is testshape=c(3,3), which corresponds to a cubic B-spline estimate of the regression function of interest for one-sided or two-sided testing.

testshapel

a vector of null boundary values for hypothesis testing. Each number a in the vector corresponds to one boundary of a one-sided hypothesis test to the left of the form H0: sup_x mu(x)<=a.

testshaper

a vector of null boundary values for hypothesis testing. Each number a in the vector corresponds to one boundary of a one-sided hypothesis test to the right of the form H0: inf_x mu(x)>=a.

testshape2

a vector of null boundary values for hypothesis testing. Each number a in the vector corresponds to one boundary of a two-sided hypothesis test ofthe form H0: sup_x |mu(x)-a|=0.

bins

Degree and smoothness for bin selection.

nbins

number of bins for partitioning/binning of x. If not specified, the number of bins is selected via the companion function binsregselect in a data-driven, optimal way whenever possible.

binspos

position of binning knots. The default is binspos="qs", which corresponds to quantile-spaced binning (canonical binscatter). The other options are "es" for evenly-spaced binning, or a vector for manual specification of the positions of inner knots (which must be within the range of x).

binsmethod

method for data-driven selection of the number of bins. The default is binsmethod="dpi", which corresponds to the IMSE-optimal direct plug-in rule. The other option is: "rot" for rule of thumb implementation.

nbinsrot

initial number of bins value used to construct the DPI number of bins selector. If not specified, the data-driven ROT selector is used instead.

nsims

number of random draws for constructing confidence bands and hypothesis testing. The default is nsims=500, which corresponds to 500 draws from a standard Gaussian random vector of size [(p+1)*J - (J-1)*s].

simsgrid

number of evaluation points of an evenly-spaced grid within each bin used for evaluation of the supremum (or infimum) operation needed to construct confidence bands and hypothesis testing procedures. The default is simsgrid=20, which corresponds to 20 evenly-spaced evaluation points within each bin for approximating the supremum (or infimum) operator.

simsseed

seed for simulation.

vce

Procedure to compute the variance-covariance matrix estimator. Options are

  • "const" homoskedastic variance estimator.

  • "HC0" heteroskedasticity-robust plug-in residuals variance estimator without weights.

  • "HC1" heteroskedasticity-robust plug-in residuals variance estimator with hc1 weights. Default.

  • "HC2" heteroskedasticity-robust plug-in residuals variance estimator with hc2 weights.

  • "HC3" heteroskedasticity-robust plug-in residuals variance estimator with hc3 weights.

cluster

cluster ID. Used for compute cluster-robust standard errors.

dfcheck

adjustments for minimum effective sample size checks, which take into account number of unique values of x (i.e., number of mass points), number of clusters, and degrees of freedom of the different stat models considered. The default is dfcheck=c(20, 30). See Cattaneo, Crump, Farrell and Feng (2019b) for more details.

masspoints

how mass points in x are handled. Available options:

  • "on" all mass point and degrees of freedom checks are implemented. Default.

  • "noadjust" mass point checks and the corresponding effective sample size adjustments are omitted.

  • "nolocalcheck" within-bin mass point and degrees of freedom checks are omitted.

  • "off" "noadjust" and "nolocalcheck" are set simultaneously.

  • "veryfew" forces the function to proceed as if x has only a few number of mass points (i.e., distinct values). In other words, forces the function to proceed as if the mass point and degrees of freedom checks were failed.

weights

an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. For more details, see lm.

subset

Optional rule specifying a subset of observations to be used.

numdist

Number of distinct for selection. Used to speed up computation.

numclust

Number of clusters for selection. Used to speed up computation.

Value

testshapeL

Results for testshapel, including: testvalL, null boundary values; stat.shapeL, test statistics; and pval.shapeL, p-value.

testshapeR

Results for testshaper, including: testvalR, null boundary values; stat.shapeR, test statistics; and pval.shapeR, p-value.

testshape2

Results for testshape2, including: testval2, null boundary values; stat.shape2, test statistics; and pval.shape2, p-value.

testpoly

Results for testmodelpoly, including: testpoly, the degree of global polynomial; stat.poly, test statistic; pval.poly, p-value.

testmodel

Results for testmodelparfit, including: stat.model, test statistics; pval.model, p-values.

opt

A list containing options passed to the function, as well as total sample size n, number of distinct values Ndist in x, number of clusters Nclust, and number of bins nbins.

Author(s)

Matias D. Cattaneo, University of Michigan, Ann Arbor, MI. cattaneo@umich.edu.

Richard K. Crump, Federal Reserve Bank of New York, New York, NY. richard.crump@ny.frb.org.

Max H. Farrell, University of Chicago, Chicago, IL. max.farrell@chicagobooth.edu.

Yingjie Feng (maintainer), University of Michigan, Ann Arbor, MI. yjfeng@umich.edu.

References

Cattaneo, M. D., R. K. Crump, M. H. Farrell, and Y. Feng. 2019a: On Binscatter. Working Paper.

Cattaneo, M. D., R. K. Crump, M. H. Farrell, and Y. Feng. 2019b: Binscatter Regressions. Working Paper.

See Also

binsreg, binsregselect.

Examples

1
2
3
 x <- runif(500); y <- sin(x)+rnorm(500)
 est <- binsregtest(y,x, testmodelpoly=1)
 summary(est)

binsreg documentation built on May 2, 2019, 12:19 p.m.