Learn R Programming

alR (version 2.2.0)

alKDE: Arc length matching for kernel density estimators.

Description

Estimate parameters of a linear model by matching the arc lengths of kernel density estimators.

Usage

alKDE(formula, data = list(), xin, q1, q2, type, ...)

# S3 method for default alKDE(formula, data = list(), xin, q1, q2, type, ...)

# S3 method for alKDE print(x, ...)

# S3 method for alKDE summary(object, ...)

# S3 method for summary.alKDE print(x, ...)

# S3 method for formula alKDE(formula, data = list(), xin, q1, q2, type, ...)

# S3 method for alKDE predict(object, newdata = NULL, ...)

Arguments

formula

An LHS ~ RHS formula, specifying the linear model to be estimated.

data

A data.frame which contains the variables in formula.

xin

Numeric vector of length equal to the number of independent variables, of initial values, for the parameters to be estimated.

q1, q2

Numeric vectors, for the lower and upper bounds of the intervals over which arc lengths are to be computed.

type

An integer specifying the bandwidth selection method, see bw.

...

Arguments to be passed on to the control argument of the optim function.

x

An alKDE object.

object

An alKDE object.

newdata

The data on which the estimated model is to be fitted.

Value

A generic S3 object with class alKDE.

alKDE.default: A list with all components from optim, as well as:

  • intercept: Did the model contain an intercept TRUE/FALSE?

  • coefficients: A vector of estimated coefficients.

  • df: Degrees of freedom of the model.

  • error: The value of the objective function.

  • fitted.values: A vector of estimated values.

  • residuals: The residuals resulting from the fitted model.

  • call: The call to the function.

  • h_y: The KDE bandwidth estimator for the dependent variable.

  • h_X: The KDE bandwidth estimator for the independent variables, i.e. \(\mathbf{X}\underline{\hat{\beta}}\).

  • ALy: Arc length segments of the KDE cast over the dependent variable.

  • ALX: Arc length segments of the KDE cast over the independent variables \(\mathbf{X}\underline{\hat{\beta}}\). p1: The vector of quantiles in the domain of \(y\) corresponding to q1. p2: The vector of quantiles in the domain of \(y\) corresponding to q2.

summary.alKDE: A list of class summary.alKDE with the following components:

  • call: Original call to the alKDE function.

  • coefficients: A vector with parameter estimates.

  • arclengths: A matrix of the arc length segments of the dependent and independent variables that were matched. The final row corresponds to the estimated bandwidth parameters for each, i.e. h_y and h_X, respectively.

  • r.squared: The \(r^{2}\) coefficient.

  • adj.r.squared: The adjusted \(r^{2}\) coefficient.

  • sigma: The residual standard error.

  • df: Degrees of freedom for the model.

  • error: Value of the objective function.

  • residSum: Summary statistics for the distribution of the residuals.

print.summary.alKDE: The object passed to the function is returned invisibly.

predict.alKDE: A vector of predicted values resulting from the estimated model.

Methods (by class)

  • default: default method for alKDE.

  • alKDE: print method for alKDE.

  • alKDE: summary method for alKDE.

  • summary.alKDE: print method for summary.alKDE.

  • formula: formula method for alKDE.

  • alKDE: predict method for alKDE.

Examples

Run this code
# NOT RUN {
x <- 1:10
y <- x+rnorm(10)
XIn <- lm(y~x)
alKDE(y~x, xin=coef(XIn), q1=c(0.025,0.5), q2=c(0.5,0.975), type=-1)

u <- 11:20
v <- u+rnorm(10)
XIn <- lm(y~x)
al <- alKDE(y~x, xin=coef(XIn), q1=c(0.025,0.5), q2=c(0.5,0.975), type=-1)
predict(al, newdata=data.frame(y=v, x=u))

# }

Run the code above in your browser using DataLab