sigma2.NN {FRD}R Documentation

Fast routine to calculate conditional variance based on nearest neighbours based on linear regression.

Description

Fast routine to calculate conditional variance based on nearest neighbours based on linear regression.

Usage

sigma2.NN(x, d, y, R = 5, type = "regression NN")

Arguments

x

Running variable. Note that the entries of this vector have to be sorted.

d

Treatment status.

y

Outcome variable.

R

Number of neares neighbours to use. Default is 5.

type

Either "regression NN" calculates variance based on local linear projections of R-nearest neighbours or "mean NN" calculates conditional variance based on mean of R-nearest neighbours.

Details

This function calculates local conditional variances. The output is a nx4 matrix. The first column equals$\sigma_y^2$, the second and third columns $\sigma_YT$ and the forth column $\sigma_T^2$


[Package FRD version 1.0.1 Index]