# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
CPCAcpp <- function(Xij, Yinit, lambda, alpha, p, maxiter, tolerance, vs) {
.Call('_cvreg_CPCAcpp', PACKAGE = 'cvreg', Xij, Yinit, lambda, alpha, p, maxiter, tolerance, vs)
}
huberMean <- function(X, epsilon = 0.0001, maxIter = 500L) {
.Call('_cvreg_huberMean', PACKAGE = 'cvreg', X, epsilon, maxIter)
}
HuberPenalizedReg <- function(X, Y, lambda, gamma, penalty = "LASSO", phi0 = 0.0075, eta = 1.25, c_eps = 0.0001, t_eps = 0.0001, maxIter = 5000L, intercept = TRUE, k = 1.345) {
.Call('_cvreg_HuberPenalizedReg', PACKAGE = 'cvreg', X, Y, lambda, gamma, penalty, phi0, eta, c_eps, t_eps, maxIter, intercept, k)
}
huberCov <- function(X, epsilon = 0.001, maxIter = 500L) {
.Call('_cvreg_huberCov', PACKAGE = 'cvreg', X, epsilon, maxIter)
}
lmHuber <- function(X, Y, k = 1.345, epsilon = 0.00001, iteMax = 500L) {
.Call('_cvreg_lmHuber', PACKAGE = 'cvreg', X, Y, k, epsilon, iteMax)
}
ridgeHuber <- function(X, Y, lambda, k = 1.345, epsilon = 0.00001, iteMax = 500L) {
.Call('_cvreg_ridgeHuber', PACKAGE = 'cvreg', X, Y, lambda, k, epsilon, iteMax)
}
bats_em <- function(rX, rY, rnu, rs) {
.Call('_cvreg_bats_em', PACKAGE = 'cvreg', rX, rY, rnu, rs)
}
batsWoodberry_em <- function(rX, rY, rnu, rs) {
.Call('_cvreg_batsWoodberry_em', PACKAGE = 'cvreg', rX, rY, rnu, rs)
}
blasso_em <- function(rX, rY, rpriorLambda) {
.Call('_cvreg_blasso_em', PACKAGE = 'cvreg', rX, rY, rpriorLambda)
}
bridge_em <- function(rX, rY, rkappa, rshape, rrate) {
.Call('_cvreg_bridge_em', PACKAGE = 'cvreg', rX, rY, rkappa, rshape, rrate)
}
gdp_em <- function(rX, rY, ralpha, rzeta) {
.Call('_cvreg_gdp_em', PACKAGE = 'cvreg', rX, rY, ralpha, rzeta)
}
#' @name Laplace Kernel
#' @title Quickly calculate a Laplacian kernel without kernlab
#' @param X a matrix of numeric data
#' @param sigma a scale parameter. defaults to 1.
#' @description This is an alternative to using kernlab to construct a kernel function.
#'
#' @returns an n-by-n dimensional matrix.
#' @export
LaplaceKernel <- function(X, sigma = 1) {
.Call('_cvreg_LaplaceKernel', PACKAGE = 'cvreg', X, sigma)
}
#' @name Spherical Kernel
#' @title Quickly calculate a spherical kernel without kernlab
#' @param X a matrix of numeric data
#' @param theta a scale parameter. defaults to 1.
#' @description This is an alternative to using kernlab to construct a kernel function.
#'
#' @returns an n-by-n dimensional matrix.
#' @export
SphereKernel <- function(X, theta = 1) {
.Call('_cvreg_SphereKernel', PACKAGE = 'cvreg', X, theta)
}
#' @name Radial Basis Function (Gaussian) Kernel
#' @title Quickly calculate a Gaussian kernel without kernlab
#' @param X a matrix of numeric data
#' @param sigma a scale parameter. defaults to 1.
#' @description This is an alternative to using kernlab to construct a kernel function.
#'
#' @returns an n-by-n dimensional matrix.
#' @export
RbfKernel <- function(X, sigma = 1) {
.Call('_cvreg_RbfKernel', PACKAGE = 'cvreg', X, sigma)
}
#' @name Student's T Kernel
#' @title Quickly calculate a Student T kernel without kernlab
#' @description This is an alternative to using kernlab to construct a kernel function.
#' @param X a matrix of numeric data
#' @param nu a degrees of freedom parameter. defaults to 3. lower bound is 1 which yields
#' a Cauchy kernel.
#' @returns an n-by-n dimensional matrix.
#' @export
StudentTKernel <- function(X, nu = 3) {
.Call('_cvreg_StudentTKernel', PACKAGE = 'cvreg', X, nu)
}
#' @name Sigmoid (Hyperbolic-Tangent) Kernel
#' @title Quickly calculate a sigmoid kernel without kernlab
#' @description This is an alternative to using kernlab to construct a kernel function.
#' @param X a matrix of numeric data
#' @param scale a scale parameter. defaults to 1.
#' @param offset an offset parameter. defaults to 1.
#' @returns an n-by-n dimensional matrix.
#' @export
SigmoidKernel <- function(X, scale = 1, offset = 1) {
.Call('_cvreg_SigmoidKernel', PACKAGE = 'cvreg', X, scale, offset)
}
#' @name Polynomial Kernel
#' @title Quickly calculate a polynomial kernel without kernlab
#' @description This is an alternative to using kernlab to construct a kernel function.
#' @param X a matrix of numeric data
#' @param scale a scale parameter. defaults to 1.
#' @param offset an offset parameter. defaults to 1.
#' @param degree the degree of the polynomial. defaults to 2.
#' @returns an n-by-n dimensional matrix.
#' @export
PolyKernel <- function(X, scale = 1, offset = 1, degree = 2) {
.Call('_cvreg_PolyKernel', PACKAGE = 'cvreg', X, scale, offset, degree)
}
orderCpp <- function(x) {
.Call('_cvreg_orderCpp', PACKAGE = 'cvreg', x)
}
colMediansCpp <- function(x) {
.Call('_cvreg_colMediansCpp', PACKAGE = 'cvreg', x)
}
repval <- function(u, v) {
.Call('_cvreg_repval', PACKAGE = 'cvreg', u, v)
}
svdCPP <- function(x, method = "dc", eps = 1.490116e-08) {
.Call('_cvreg_svdCPP', PACKAGE = 'cvreg', x, method, eps)
}
svdCPPLeft <- function(x, method = "dc") {
.Call('_cvreg_svdCPPLeft', PACKAGE = 'cvreg', x, method)
}
svdCPPRight <- function(x, method = "dc") {
.Call('_cvreg_svdCPPRight', PACKAGE = 'cvreg', x, method)
}
makeRightSingularVecs <- function(x, u, d, eps) {
.Call('_cvreg_makeRightSingularVecs', PACKAGE = 'cvreg', x, u, d, eps)
}
makeLeftSingularVecs <- function(x, v, d, eps) {
.Call('_cvreg_makeLeftSingularVecs', PACKAGE = 'cvreg', x, v, d, eps)
}
fastSVDwide <- function(x, method = "dc", eps = 1.490116e-08) {
.Call('_cvreg_fastSVDwide', PACKAGE = 'cvreg', x, method, eps)
}
fastSVDlong <- function(x, method = "dc", eps = 1.490116e-08) {
.Call('_cvreg_fastSVDlong', PACKAGE = 'cvreg', x, method, eps)
}
mahdistcpp <- function(x, center, cov) {
.Call('_cvreg_mahdistcpp', PACKAGE = 'cvreg', x, center, cov)
}
geneigen <- function(A, B) {
.Call('_cvreg_geneigen', PACKAGE = 'cvreg', A, B)
}
col_minmax <- function(x, gap) {
.Call('_cvreg_col_minmax', PACKAGE = 'cvreg', x, gap)
}
boxcount_util <- function(tX, Imin, currentr) {
.Call('_cvreg_boxcount_util', PACKAGE = 'cvreg', tX, Imin, currentr)
}
matpowercpp <- function(X, p = -1) {
.Call('_cvreg_matpowercpp', PACKAGE = 'cvreg', X, p)
}
minkowski_dist <- function(RowMat, p = 2) {
.Call('_cvreg_minkowski_dist', PACKAGE = 'cvreg', RowMat, p)
}
kpcaCPP <- function(Kx) {
.Call('_cvreg_kpcaCPP', PACKAGE = 'cvreg', Kx)
}
disrCPP <- function(X, self, div, gamma, max_iter = 1000, tol = 1e-9) {
.Call('_cvreg_disrCPP', PACKAGE = 'cvreg', X, self, div, gamma, max_iter, tol)
}
#' Project a set of points to the closest point on a curve
#'
#' Finds the projection index for a matrix of points \code{x}, when
#' projected onto a curve \code{s}. The curve need not be of the same
#' length as the number of points.
#'
#' @param x a matrix of data points.
#' @param s a parametrized curve, represented by a polygon.
#' @param stretch A stretch factor for the endpoints of the curve,
#' allowing the curve to grow to avoid bunching at the end.
#' Must be a numeric value between 0 and 2. Defaults to 1.25.
#'
#' @return A structure is returned which represents a fitted curve. It has components
#' \item{scores}{The fitted points on the curve corresponding to each point \code{x}}
#' \item{ord}{the order of the fitted points}
#' \item{lambda}{The projection index for each point}
#' \item{dist}{The total squared distance from the curve}
#' \item{dist_ind}{The squared distances from the curve to each of the respective points}
#'
#' @seealso \code{\link{pcurves}}
#' @export
projectToCurve <- function(x, s, stretch = 1.25) {
.Call('_cvreg_projectToCurve', PACKAGE = 'cvreg', x, s, stretch)
}
robridge_em <- function(rX, rY, rkappa, rshape, rrate, rBeta) {
.Call('_cvreg_robridge_em', PACKAGE = 'cvreg', rX, rY, rkappa, rshape, rrate, rBeta)
}
#' @name hdmedian
#' @title Returns the Harrell-Davis Estimate of the Median
#' @description This returns the Harrell-Davis estimate of the median for a vector.
#' @returns a number
#' @export
#' @references
#' Harrell, F.E. & Davis, C.E. (1982) A new distribution-free quantile estimator. Biometrika, 69, 635-640.
hdmedian <- function(x) {
.Call('_cvreg_hdmedian', PACKAGE = 'cvreg', x)
}
hdquantileCPP <- function(x, probs = as.numeric( c(0.05, 0.25, 0.50, 0.75, 0.95))) {
.Call('_cvreg_hdquantileCPP', PACKAGE = 'cvreg', x, probs)
}
HDMAD <- function(x) {
.Call('_cvreg_HDMAD', PACKAGE = 'cvreg', x)
}
#' @name qcor
#' @title Quantile Correlation
#' @description This returns the quantile correlation estimator from
#' Li, Li, and Tsai (2015). The Harrell-Davis estimator is used for the quantile
#' estimation. Note that the quantile correlation is not symmetric, hence
#' qcor(x,y) != qcor(y,x). The reason is that this metric does not measure
#' the correlation at the qth quantile for both variables, but rather, whether
#' variable y is correlated with the qth quantile of x.
#' @returns the quantile correlation
#' @export
#' @references
#' Harrell, F. & Davis, C. (1982) A new distribution-free quantile estimator. Biometrika, 69, 635-640. \cr \cr
#' Li, G., Li, Y., & Tsai, C. (2015) Quantile correlations and quantile autoregressive modeling. J Am Stat Assoc. 110:246–261. doi: 10.1080/01621459.2014.892007
qcor <- function(x, y, q = 0.5) {
.Call('_cvreg_qcor', PACKAGE = 'cvreg', x, y, q)
}
#' @name qcov
#' @title Quantile Covariance
#' @description This returns the quantile covariance estimator from
#' Li, Li, and Tsai (2015). The Harrell-Davis estimator is used for the quantile
#' estimation. Note that the quantile covariance is not symmetric, hence
#' qcov(x,y) != qcov(y,x). The reason is that this metric does not measure
#' the covariance at the qth quantile for both variables, but rather, the
#' covariance of y with the qth quantile of x.
#' @returns the quantile covariance
#' @export
#' @references
#' Harrell, F. & Davis, C. (1982) A new distribution-free quantile estimator. Biometrika, 69, 635-640. \cr \cr
#' Li, G., Li, Y., & Tsai, C. (2015) Quantile correlations and quantile autoregressive modeling. J Am Stat Assoc. 110:246–261. doi: 10.1080/01621459.2014.892007
qcov <- function(x, y, q = 0.5) {
.Call('_cvreg_qcov', PACKAGE = 'cvreg', x, y, q)
}
tau_scale <- function(x, c1 = 4.5, c2 = 3) {
.Call('_cvreg_tau_scale', PACKAGE = 'cvreg', x, c1, c2)
}
pb_scale <- function(x, bend = 0.15) {
.Call('_cvreg_pb_scale', PACKAGE = 'cvreg', x, bend)
}
pb_loc <- function(x, bend = 0.15) {
.Call('_cvreg_pb_loc', PACKAGE = 'cvreg', x, bend)
}
tau_loc <- function(x, c1 = 4.5, c2 = 3) {
.Call('_cvreg_tau_loc', PACKAGE = 'cvreg', x, c1, c2)
}
AAD <- function(x) {
.Call('_cvreg_AAD', PACKAGE = 'cvreg', x)
}
coAAD <- function(x, y) {
.Call('_cvreg_coAAD', PACKAGE = 'cvreg', x, y)
}
coAADMatrix <- function(x) {
.Call('_cvreg_coAADMatrix', PACKAGE = 'cvreg', x)
}
coMedian <- function(x, y) {
.Call('_cvreg_coMedian', PACKAGE = 'cvreg', x, y)
}
coMedianMatrix <- function(x) {
.Call('_cvreg_coMedianMatrix', PACKAGE = 'cvreg', x)
}
coHDMedian <- function(x, y) {
.Call('_cvreg_coHDMedian', PACKAGE = 'cvreg', x, y)
}
coHDMedianMatrix <- function(x) {
.Call('_cvreg_coHDMedianMatrix', PACKAGE = 'cvreg', x)
}
#' @name L1median
#' @title Returns the spatial median (multivariate L1-median)
#' @description This returns the spatial median for a multivariate numeric data set.
#' @returns a list containing "center", the list of weights used to transform the
#' original data "w", and the number of iterations the estimation took.
#' @export
L1median <- function(x) {
.Call('_cvreg_L1median', PACKAGE = 'cvreg', x)
}
#' @name mvSmoothWt
#' @title Create casewise weights based on mahalanobis distances
#' @description This uses a two-parameter generalization of Tukey's Bisquare weight
#' function to create non-binary weights for the rows of a multivariate data set
#' based on each row's mahalanobis distance.
#' @param x a vector of mahalanobis distances
#' @param crit the critical value for declaring an outlier.
#' @param k the second tuning parameter. recommended to set as 1 or 2. the default is a compromise of 1.5.
#' @returns a numeric vector of weights
#' @keywords internal
#' @export
mvSmoothWt <- function(x, crit, k = 1.5) {
.Call('_cvreg_mvSmoothWt', PACKAGE = 'cvreg', x, crit, k)
}
SPC <- function(x, scale = 1) {
.Call('_cvreg_SPC', PACKAGE = 'cvreg', x, scale)
}
#' @name dslash
#' @title Slash distribution PDF
#' @description Probability density function for the slash distribution.
#' @param x vector of quantiles
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param log if TRUE, the log density is returned. defaults to FALSE.
#' @returns a numeric vector
#' @export
dslash <- function(x, location, scale, log = FALSE) {
.Call('_cvreg_dslash', PACKAGE = 'cvreg', x, location, scale, log)
}
#' @name pslash
#' @title Slash distribution CDF
#' @description Cumulative distribution function for the slash distribution.
#' @param q vector of quantiles
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param lower_tail if TRUE (default), probabilities are \eqn{P[X \le x]} otherwise, \eqn{P[X > x]}.
#' @param log if TRUE probabilities p are given as log(p). defaults to FALSE.
#' @returns a numeric vector
#' @export
pslash <- function(q, location, scale, lower_tail = TRUE, log = FALSE) {
.Call('_cvreg_pslash', PACKAGE = 'cvreg', q, location, scale, lower_tail, log)
}
#' @name rslash
#' @title Slash distribution RNG
#' @description Random number generator for the slash distribution.
#' @param n number of observations to generate
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @returns a numeric vector
#' @export
rslash <- function(n, location, scale) {
.Call('_cvreg_rslash', PACKAGE = 'cvreg', n, location, scale)
}
#' @name dhuber
#' @title Huber's distribution PDF
#' @description Probability density function for the Huber distribution.
#' @param x vector of quantiles
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param k the tuning constant. defaults to 1.345.
#' @param log if TRUE, the log density is returned. defaults to FALSE.
#' @returns a numeric vector
#' @export
dhuber <- function(x, location, scale, k, log = FALSE) {
.Call('_cvreg_dhuber', PACKAGE = 'cvreg', x, location, scale, k, log)
}
#' @name phuber
#' @title Huber's distribution CDF
#' @description Cumulative distribution function for Huber's distribution.
#' @param x vector of quantiles
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param k the tuning constant. defaults to 1.345.
#' @param lower_tail if TRUE (default), probabilities are \eqn{P[X \le x]} otherwise, \eqn{P[X > x]}.
#' @param log if TRUE probabilities p are given as log(p). defaults to FALSE.
#' @returns a numeric vector
#' @export
phuber <- function(x, location, scale, k, lower_tail = TRUE, log = FALSE) {
.Call('_cvreg_phuber', PACKAGE = 'cvreg', x, location, scale, k, lower_tail, log)
}
#' @name qhuber
#' @title Huber's distribution distribution ICDF
#' @description Probability density function for Huber's distribution.
#' @param x vector of quantiles
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param k the tuning constant. defaults to 1.345
#' @param log if TRUE, the log density is returned. defaults to FALSE.
#' @returns a numeric vector
#' @export
qhuber <- function(p, location, scale, k, lower_tail = TRUE, log = FALSE) {
.Call('_cvreg_qhuber', PACKAGE = 'cvreg', p, location, scale, k, lower_tail, log)
}
#' @name rhuber
#' @title Huber's distribution RNG
#' @description Random number generator for Huber's distribution.
#' @param n number of observations to generate
#' @param location vector of location parameters
#' @param scale vector of scale parameters
#' @param k the tuning constant. defaults to 1.345.
#' @returns a numeric vector
#' @export
rhuber <- function(n, location, scale, k) {
.Call('_cvreg_rhuber', PACKAGE = 'cvreg', n, location, scale, k)
}
theilsen <- function(x, y, maxit = 50L) {
.Call('_cvreg_theilsen', PACKAGE = 'cvreg', x, y, maxit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.