admm: ADMM algorithm for fitting l1-penalized additive mixed models

Description Usage Arguments Examples

View source: R/admm.R

Description

This function obtains point estimates via the ADMM algorithm

Usage

1
2
3
admm(y, id, X, rand, lambda, tau, data, rho = 1, lmeUpdate = FALSE,
  epsilonAbs = 1e-04, epsilonRel = 1e-04, iterMax = 1000, warm = NULL,
  forCV = FALSE, centerZ = FALSE, verbose = FALSE, uniUpper = 1000)

Arguments

y

character string denoting output variable

id

character string denoting id variable

X

list of fixed effect design matrices setup by l1smooth

lambda

scalar smoothing parameter for random effects

tau

vector of smoothing parameters for fixed effects

data

dataset

rho

ADMM penalty parameter

lmeUpdate

TRUE/FALSE if TRUE, uses lme to estimate random effects. Only available for random intercept models.

epsilonAbs

absolute error in ADMM (tolerance for convergence)

epsilonRel

relative error in ADMM (tolerance for convergence)

warm

list of warm start parameters

forCV

TRUE/FALSE If FALSE, returns less information in fitted object

centerZ

TRUE/FALSE If TRUE, imposes centering constraints on random effects

verbose

TRUE/FALSE If TRUE, prints ADMM iteration

uniUpper

upper limit used by uniroot to estimate tau (only used when lmeUpdate = TRUE)

Z

random effect design matrix setup by randomEffects

S

random effect penalty matrix setup by randomEffects

iterMAx

maximum number of ADMM iterations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(psplinesl1)
data(simData)

# setup p-spline matrices
X <- list(ps(x = "x", data = simData, 
             norder = 2, k = 1, width = 0.05,
             center = TRUE))

# setup random effect matrices
rand <- re(x = "x", id = "id", data = simData,
           randomCurves = FALSE)

# fit model with ADMM
a1 <- admm(y = "y", X, Z = rand$Z, S = rand$S,
            lmeUpdate = TRUE,
            lambda = 0.169,
            rho = 0.169,
            data = simData)

# get and plot fitted model with confidence bands
CI <- ci(model = a1, alpha = 0.05)
plot(CI)

# extract values from ci object for custom plotting
CIpoly <- data.frame(x = c(CI[[1]]$x, rev(CI[[1]]$x)), 
                     y = c(CI[[1]]$lower, rev(CI[[1]]$upper)))

ggplot(aes(x = x, y = y), data = newDat)+
  geom_polygon(data = CIpoly, fill = "grey")+
  geom_line(aes(x = CI[[1]]$x, y = CI[[1]]$smooth))

bdsegal/psplinesl1 documentation built on July 22, 2019, 11:38 a.m.