This function estimates the squared conditional expectation E[(E[Y|X])^2] using Nadaraya-Watson regression with Gaussian kernel.
estimate_EY_X_squared(X, Y, grid_length = 10000, kernel = dnorm)A list containing:
Estimated value of E[(E[Y|X])^2]
Selected kernel bandwidth
Mean of Y
Variance of Y
Grid values of E[Y|X]
Estimated marginal density of X
Grid points used in estimation
A numeric vector of predictors.
A numeric vector of responses.
Number of grid points for numerical integration (default = 10000).
Kernel function (default is dnorm).
Zheng, S., Shi, N.Z., & Zhang, Z. (2012). Generalized Measures of Correlation for Asymmetry, Nonlinearity, and Beyond. Journal of the American Statistical Association, 107(499), 1239-1252. tools:::Rd_expr_doi("10.1080/01621459.2012.710509")