Daniel Kapla

Dipl.-Ing.

Notice Message.
This site is still in development, its current state is a preview.

Installation Instructions

The package depends on the mda package (see: mda@cran.r-project. Therefore the first step is to install the mda package install.packages("mda") kern <- function(X, h) {
S <- tcrossprod(X)
D <- diag(S)
exp((-.5 / h^2) * (outer(D, D, FUN = `+`) - 2 * S))
}
opg <- function(X, y, d) {
n <- nrow(X)
p <- ncol(X)

h <- 2.34 * n^(-1 / (max(p, 3) + 6))
X <- scale(X)
K <- kern(X, h)

bmat <- matrix(NA, p, n)
for (i in 1:n) {
# Local weigted least squares (fit with but ignoring intercept)
Xi <- cbind(1, t(t(X) - X[i, ]))
Xw <- Xi * K[, i]
bmat[, i] <- solve(crossprod(Xw, Xi), colMeans(Xw * y))[-1] * n
}
beta <- eigen(tcrossprod(bmat))$vectors[, 1:d, drop = FALSE]

beta / attr(X, 'scaled:scale')
}

# Some examples # the end
cat("\033[91m")
for (i in 1:10) {
X <- matrix(rnorm(d * 13 * 19), 13 * 19)
y <- rnorm(13 * 19)
stopifnot(all.equal(opg(X, y, d), opg3(X, y, d)))
}
cat("\033[92mSuccess :-}\033[0m\n")
A release will be available in a few days.
Open R and then the following: # addapt to download file.
install.packages("path/to/cve_0.2.<end>", repos = NULL)
library(CVE) # Test installation.
Please consult the man-pages ?install.package and ?library for further information.

Installing Source

Cloning the CVE repository and using R's build and install routines from a terminal. # Clone repository
git clone https://git.art-ist.cc/daniel/CVE.git
# Go into the repository
cd CVE
# Build package tarbal
R CMD build CVE
# Install package
R CMD INSTALL CVE_0.2.tar.gz

Alternative Installing Source from within R

Using the devtools the package can also be directly installed from within R # Load the dectools
library(devtools)
# Go into package root
setwd("<path_to_repo>/CVE")
# Create source package
(path <- build(vignettes = FALSE))
# Install source package
install.packages(path, repos = NULL, type = "source")
# Test
library(CVE)

Windows / macOS

Installing from source (for any package which contains compiled code, in our case C) on Windows and MacOS requires additional tools. See R Installation and Administration from r-project manuals.