Learn R Programming

generalCorr (version 1.2.0)

kern2ctrl: Kernel regression with control variables and optional residuals and gradients. version 2 regtype="ll" for local linear, bwmethod="cv.aic" for AIC-based bandwidth selection. It admits control variables.

Description

Kernel regression with control variables and optional residuals and gradients. version 2 regtype="ll" for local linear, bwmethod="cv.aic" for AIC-based bandwidth selection. It admits control variables.

Usage

kern2ctrl(
  dep.y,
  reg.x,
  ctrl,
  tol = 0.1,
  ftol = 0.1,
  gradients = FALSE,
  residuals = FALSE
)

Arguments

dep.y

Data on the dependent (response) variable

reg.x

Data on the regressor (stimulus) variable

ctrl

Data matrix on the control variable(s) kept outside the causal paths. A constant vector is not allowed as a control variable.

tol

Tolerance on the position of located minima of the cross-validation function (default=0.1)

ftol

Fractional tolerance on the value of cross validation function evaluated at local minima (default=0.1)

gradients

Set to TRUE if gradients computations are desired

residuals

Set to TRUE if residuals are desired

Value

Creates a model object `mod' containing the entire kernel regression output. If this function is called as mod=kern_ctrl(x,y,ctrl=z), the researcher can simply type names(mod) to reveal the large variety of outputs produced by `npreg' of the `np' package. The user can access all of them at will using the dollar notation of R.

References

Vinod, H. D. `Generalized Correlation and Kernel Causality with Applications in Development Economics' in Communications in Statistics -Simulation and Computation, 2015, 10.1080/03610918.2015.1122048

See Also

See kern.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
set.seed(34);x=matrix(sample(1:600)[1:50],ncol=5)
require(np)
k1=kern_ctrl(x[,1],x[,2],ctrl=x[,4:5])
print(k1$R2) #prints the R square of the kernel regression
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab