Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


PFLR (version 1.1.0)

ngr: Nested Group Bridge Regression Model

Description

Calculates a functional regression model using a nested group bridge approach.

Usage

ngr(
  Y,
  X,
  M,
  d,
  domain,
  extra = list(alphaPS = 10^(-10:0), kappa = 10^(-(9:7)), tau = exp(seq(-50, -15, len =
    20)), gamma = 0.5, niter = 100)
)

Value

beta: Estimated β(t) at discrete points.

extra: List containing other values which may be of use:

  • b: Estimated b-hat.

  • delta: Estimated cutoff point.

  • Ymean: Estimated y-hat.

  • Xmean: Estimated x-hat.

  • Optkappa: Optimal roughness penalty selected.

  • Opttau: Optimal group bridge penalty selected.

  • M: Integer representing the number of knots used in the model calculation.

  • d: Integer, degree of B-Splines used.

  • domain: The range over which the function X(t) was evaluated and the coefficient function β(t) was expanded by the B-spline basis functions.

Arguments

Y

Vector of length n.

X

Matrix of n x p, covariate matrix, should be dense.

M

Integer, t1,..., tM are M equally spaced knots.

d

Integer, the degree of B-Splines.

domain

The range over which the function X(t) is evaluated and the coefficient function β(t) is expanded by the B-spline basis functions.

extra

List containing other parameters which have defaults:

  • alphaPs: Smoothing parameter for the Penalized B-splines method, default is 10^(-10:0).

  • kappa: Tuning parameter for roughness penalty, default is 10^(-(9:7)).

  • tau: Tuning parameter for the group bridge penalty, default is exp(seq(-50,-15,len = 20)).

  • gamma: Real number, default is 0.5.

  • niter: Integer, maximum number of iterations, default is 100.

Examples

Run this code
library(fda)
betaind = 1
snr  = 2
nsim = 1
n    = 50
p    = 21
Y = array(NA,c(n,nsim))
X = array(NA,c(n,p,nsim))
domain = c(0,1)

M = 20
d = 3
norder   = d+1
nknots   = M+1
tobs = seq(domain[1],domain[2],length.out = p)
knots    = seq(domain[1],domain[2],length.out = nknots)
nbasis   = nknots + norder - 2
basis    = create.bspline.basis(knots,nbasis,norder)
basismat = eval.basis(tobs, basis)
h = (domain[2]-domain[1])/M
cef = c(1, rep(c(4,2), (M-2)/2), 4, 1)

V = eval.penalty(basis,int2Lfd(2))
alphaPS = 10^(-(10:3))
kappa   = 10^(-(8:7))
tau     = exp(seq(-35,-28,len=20))
gamma   = 0.5


for(itersim in 1:nsim)
{
dat = ngr.data.generator.bsplines(n=n,nknots=64,norder=4,p=p,domain=domain,snr=snr,betaind=betaind)
Y[,itersim]  = dat$Y
X[,,itersim] = dat$X
}

ngrfit = ngr(Y=Y[1:n,1],X=(X[1:n,,1]),M,d,domain,extra= list(alphaPS=alphaPS, kappa=kappa, tau=tau))

Run the code above in your browser using DataLab