optimSmoothingParameter: Penalized B-splines with Monotonicity Constraint - Finding...

Description Usage Arguments See Also Examples

Description

This function tries to find the optimal smoothing parameter value used in mpspline.fit.

Usage

1
optimSmoothingParameter(mpspline.params, alpha.init, useAIC, upper)

Arguments

mpspline.params

List of mpspline.fit function parameters. Required: the response variable response, and the explanatory variable on the abcissae x.var. See mpspline.fit for a full list of parameters.

alpha.init

Initial value for the smoothness regularizing parameter (>= 0). Default=2.

useAIC

Specifies if the AIC criteria is used for optimization. Otherwise, the BIC is used. Default=TRUE.

upper

The upper bound on the variable that will be optimized by optim.

See Also

mpspline.fit, optim

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
31
32
33
# Using Belgian B19 data
data("VZV_B19_BE_0103")
subset <- (VZV_B19_BE_0103$age<40.5)&(!is.na(VZV_B19_BE_0103$age))&
  (!is.na(VZV_B19_BE_0103$VZVmUIml))
data <- VZV_B19_BE_0103[subset,]

# Data to use when taking the continuous levels
z<-log(data$VZVmUIml[order(data$age)]+1)
a<-data$age[order(data$age)]

params <- list(response=z, x.var=a, ps.intervals=20, degree=3,
  link="identity", family="gaussian", order=2, kappa=1e8)

optimSmoothingParameter(params)

# Proportion positive, as a function of the corresponding half-year
# age categories, overlaid with the monotone p-spline fit and the FOI:
# with BIC optimal smoothing parameter
#
# Using Belgian B19 data
data("VZV_B19_BE_0103")
subset <- (VZV_B19_BE_0103$age<40.5)&(!is.na(VZV_B19_BE_0103$age))&
  (!is.na(VZV_B19_BE_0103$VZVmUIml)&(!is.na(VZV_B19_BE_0103$VZVres)))
data <- VZV_B19_BE_0103[subset,]

# Data to use when taking the binary indicators (different because some are inconclusive)
y <- data$VZVres[order(data$age)]
a <- data$age[order(data$age)]

params <- list(response=y, x.var=a, ps.intervals=20, degree=3,
  order=2, link="logit", family="binomial", kappa=1e8)

optimSmoothingParameter(params,useAIC=FALSE)

TeaKov/serostat documentation built on May 21, 2019, 1:21 p.m.