Skip to content

Commit

Permalink
fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rajitachandak committed Mar 20, 2024
1 parent 57c068e commit e6f1f56
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 82 deletions.
8 changes: 4 additions & 4 deletions R/lpcde/R/lpbwcde.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##################################################################################################
#' @title Data-driven Bandwidth Selection for Local Polynomial Conditional Density Estimators
#' @title Data-driven bandwidth selection for local polynomial conditional density estimators
#'
#' @description \code{\link{lpbwcde}} implements the bandwidth selection methods for local
#' polynomial based conditionaldensity (and derivatives) estimation proposed and studied
Expand All @@ -24,8 +24,8 @@
#' \code{1} (default) for the density funtion, etc.
#' @param nu Nonnegative integer, specifies the derivative with respect to \code{X} of the
#' distribution function to be estimated.
#' @param grid_spacing String. If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points.
#' @param ng int. number of grid points to be used in generating bandwidth estimates.
#' @param grid_spacing String, If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points.
#' @param ng Int, number of grid points to be used in generating bandwidth estimates.
#' @param kernel_type String, specifies the kernel function, should be one of
#' \code{"triangular"}, \code{"uniform"} or \code{"epanechnikov"}.
#' @param bw_type String, specifies the method for data-driven bandwidth selection. This option will be
Expand All @@ -49,7 +49,7 @@
#'
#' Xinwei Ma, University of California San Diego. \email{x1ma@ucsd.edu}.
#'
# @seealso Supported methods: \code{\link{coef.lpbwdensity}},
#' @seealso Supported methods: \code{\link{coef.lpbwdensity}},
# \code{\link{print.lpbwdensity}}, \code{\link{summary.lpbwdensity}}.
#'
#' @examples
Expand Down
4 changes: 2 additions & 2 deletions R/lpcde/R/lpcde.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file contains code for generating conditional density estimate (External Functions)
############################################################################################

#' @title Local Polynomial Conditional Density Estimation
#' @title Local polynomial conditional density estimation
#' @description \code{\link{lpcde}} implements the local polynomial regression based
#' conditional density (and derivatives). The estimator proposed in
#' \insertCite{bernoulli}{lpcde}.
Expand Down Expand Up @@ -85,7 +85,7 @@
#'
#' Xinwei Ma, University of California San Diego. \email{x1ma@ucsd.edu}.
#'
#' Supported methods: \code{\link{coef.lpcde}}, \code{\link{confint.lpcde}},
#' @seealso Supported methods: \code{\link{coef.lpcde}}, \code{\link{confint.lpcde}},
#' \code{\link{plot.lpcde}}, \code{\link{print.lpcde}},
#' \code{\link{summary.lpcde}}, \code{\link{vcov.lpcde}}
#'
Expand Down
64 changes: 32 additions & 32 deletions R/lpcde/R/lpcde_fns.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# This file contains code for generating point estimates (Internal Functions)
#######################################################################################

#' @title lpcde_fn: conditional density estimator.
#' @title lpcde_fn: Conditional density estimator.
#' @description Function for estimating the density function and its derivatives.
#' @param y_data response variable dataset, vector.
#' @param x_data covariate dataset, vector or matrix.
#' @param y_data Response variable dataset, vector.
#' @param x_data Covariate dataset, vector or matrix.
#' @param y_grid Numeric vector, specifies the grid of evaluation points along y-direction.
#' @param x Numeric vector or matrix, specifies the grid of evaluation points along x-direction.
#' @param p polynomial order for y.
#' @param q polynomial order for covariates.
#' @param p Polynomial order for y.
#' @param q Polynomial order for covariates.
#' @param p_RBC Nonnegative integer, specifies the order of the local polynomial for \code{Y} used to
#' construct bias-corrected point estimates. (Default is \code{p+1}.)
#' @param q_RBC Nonnegative integer, specifies the order of the local polynomial for \code{X} used to
#' construct bias-corrected point estimates. (Default is \code{q+1}.)
#' @param bw Numeric, bandwidth vector.
#' @param mu degree of derivative with respect to y.
#' @param nu degree of derivative with respect to x.
#' @param kernel_type kernel function choice.
#' @param mu Degree of derivative with respect to y.
#' @param nu Degree of derivative with respect to x.
#' @param kernel_type Kernel function choice.
#' @param rbc Boolean for whether to return RBC estimate and standard errors.
# @param var_type String. type of variance estimator to implement.
# choose from "ustat" and "asymp".
#' @return conditional density estimate at all grid points.
#' @return Conditional density estimate at all grid points.
#' @keywords internal
#' @importFrom Rdpack reprompt
lpcde_fn = function(y_data, x_data, y_grid, x, p, q, p_RBC, q_RBC, bw, mu, nu,
Expand Down Expand Up @@ -114,19 +114,19 @@ lpcde_fn = function(y_data, x_data, y_grid, x, p, q, p_RBC, q_RBC, bw, mu, nu,
return(est_result)
}

#' @title fhat: estimator
#' @title Estimator construction
#' @description Function for estimating the density function and its derivatives.
#' @param y_data response variable dataset, vector.
#' @param x_data covariate dataset, vector or matrix.
#' @param y_data Response variable dataset, vector.
#' @param x_data Covariate dataset, vector or matrix.
#' @param y_grid Numeric vector, specifies the grid of evaluation points along y-direction.
#' @param x Numeric vector or matrix, specifies the grid of evaluation points along x-direction.
#' @param p polynomial order for y.
#' @param q polynomial order for covariates.
#' @param p Polynomial order for y.
#' @param q Polynomial order for covariates.
#' @param h Numeric, bandwidth vector.
#' @param mu degree of derivative with respect to y.
#' @param nu degree of derivative with respect to x.
#' @param kernel_type kernel function choice.
#' @return conditional density estimate at all grid points.
#' @param mu Degree of derivative with respect to y.
#' @param nu Degree of derivative with respect to x.
#' @param kernel_type Kernel function choice.
#' @return Conditional density estimate at all grid points.
#' @keywords internal
fhat = function(x_data, y_data, x, y_grid, p, q, mu, nu, h, kernel_type){
# setting constants
Expand Down Expand Up @@ -314,19 +314,19 @@ fhat = function(x_data, y_data, x, y_grid, p, q, mu, nu, h, kernel_type){

#' @title cov_hat: covariance estimator
#' @description Function for estimating the variance-covariance matrix.
#' @param y_data response variable dataset, vector.
#' @param x_data covariate dataset, vector or matrix.
#' @param y_data Response variable dataset, vector.
#' @param x_data Covariate dataset, vector or matrix.
#' @param y_grid Numeric vector, specifies the grid of evaluation points along
#' y-direction.
#' @param x Numeric vector or matrix, specifies the grid of evaluation points
#' along x-direction.
#' @param p polynomial order for y.
#' @param q polynomial order for covariates.
#' @param p Polynomial order for y.
#' @param q Polynomial order for covariates.
#' @param h Numeric, bandwidth vector.
#' @param mu degree of derivative with respect to y.
#' @param nu degree of derivative with respect to x.
#' @param kernel_type kernel function choice.
#' @return covariance matrix for all the grid points
#' @param mu Degree of derivative with respect to y.
#' @param nu Degree of derivative with respect to x.
#' @param kernel_type Kernel function choice.
#' @return Covariance matrix for all the grid points
#' @keywords internal
cov_hat = function(x_data, y_data, x, y_grid, p, q, mu, nu, h, kernel_type){
# setting constants
Expand Down Expand Up @@ -618,13 +618,13 @@ cov_hat = function(x_data, y_data, x, y_grid, p, q, mu, nu, h, kernel_type){
# Supplemental Functions
#######################################################################################

#' @title bx = constants for each data and evaluation point pair
#' @title bx
#' @description Function for estimating the constants in the estimation formula
#' @param datavec dataset, vector.
#' @param s_mat s_hat matrix.
#' @param q polynomial order.
#' @param kernel_type kernel function choice.
#' @return vector of products for each data point.
#' @param datavec Dataset, vector.
#' @param s_mat S_hat matrix.
#' @param q Polynomial order.
#' @param kernel_type Kernel function choice.
#' @return Vector of products for each data point.
#' @keywords internal
b_x = function(datavec, s_mat, e_vec, q, kernel_type){
eff_n = length(datavec[,1])
Expand Down
4 changes: 2 additions & 2 deletions R/lpcde/R/lpcde_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ coef.lpcde = function(object, ...) {
#' Vcov Method for Local Polynomial Density Conditional Estimation and Inference
#'
#' @title Variance-Covariance
#' @description The vcov method for local polynomial conditionaldensity objects.
#' @description The vcov method for local polynomial conditional density objects.
#'
#' @param object Class "lpdensity" object, obtained by calling \code{\link{lpcde}}.
#' @param ... Additional options.
Expand Down Expand Up @@ -341,7 +341,7 @@ vcov.lpcde = function(object, ...) {
#' @return
#' \item{Estimate}{A matrix containing grid points, estimates and confidence interval end points using p- and q-th order local polynomials
#' as well as bias-corrected estimates and corresponding confidence intervals.}
#' \item{crit_val}{the critical value used in computing the confidence interval end points.}
#' \item{crit_val}{The critical value used in computing the confidence interval end points.}
#'
#' @author
#' Matias D. Cattaneo, Princeton University. \email{cattaneo@princeton.edu}.
Expand Down
12 changes: 6 additions & 6 deletions R/lpcde/man/b_x.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R/lpcde/man/confint.lpcde.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions R/lpcde/man/cov_hat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions R/lpcde/man/fhat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions R/lpcde/man/lpbwcde.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions R/lpcde/man/lpcde.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6f1f56

Please sign in to comment.