l2lm: Fit the L2E Parameters of a Multivariate Linear Model with a...

Description Usage Arguments Value Examples

View source: R/l2lm.R

Description

Fit the L2E Parameters of a Multivariate Linear Model with a Univariate Response

Usage

1
l2lm(X, y, init_x, partial = F, init_w = 1, print_level = 0)

Arguments

X

a predictor matrix.

y

a response vector.

init_x

an initial estimate of a, b, and sig. Defaults respectively to the mean response mean(y), a vector zeros of length ncol(X), and the sample standard deviation sqrt(var(y))

partial

are the residuals modeled by a full density ε ~ N(0, σ^2) or a partial density ε ~ w N(0, σ^2) .

init_w

an initial estimate of w. If partial = FALSE then w is fixed at 1.

print_level

value of the argument print.level from the nlm function

Value

The function l2lm returns a list of L2E parameters

a

the intercept estimate

b

a vector of estimated coefficients

sig

an estimated standard deviation of the residuals

w

the weight of the partial L2E fit; it can be greater than 1

res

the residuals of the model

Examples

1
2
3
4
5
6
## simulate linear model with 20% contamination
X = c(3*(1:50) + rnorm(50, 0,20), rnorm(10, 0, 20))
y = 1:60
l2lm_out = l2lm(X = X, y = y, partial = F)
plot(X,y)
abline(l2lm_out$a, l2lm_out$b)

shayaa/l2e documentation built on May 29, 2019, 9:20 p.m.