## Example 1:
## This example involves finding an A-optimal design for a functional linear model of 4 runs
## depending on one profile factor. The settings of the profile factor are represented by a
## B-spline basis of degree zero and a single knot at (0.5). The single functional parameter
## is represented with a linear power series basis. Five random starts are chosen.
example1 <- pflm(formula = ~ x1, nsd = 5, mc.cores = 1, npf = 1,
tbounds = c(0, 1), nruns = 4, startd = NULL, dx = c(0),
knotsx = list(c(0.5)), pars = c("power"), db = c(1),
knotsb = list(c()), criterion = "A", lambda = 0,
dlbound = -1, dubound = 1, tol = 0.0001, progress = FALSE)
print(example1) ## prints the output of example1.
##
## The number of profile factors is: 1
##
## The number of runs is: 4
##
## The objective criterion is: A-optimality
##
## The objective value is: 8.75
##
## The number of iterations is: 6
##
## The computing elapsed time is: 00:00:00
## plot(example1)
## then give the number of profile factor to plot
# \donttest{
## Example 2:
## This example involves finding a D-optimal design for a functional linear model of n=20 runs
## depending on two profile factors. In addition to the main effects, the model includes the
## interaction of the profile factors and the quadratic effect of the second profile factor.
## The settings of the profile factors are represented by B-spline basis of quadratic degrees
## and knots at (0.33, 0.66) and (0.25, 0.50, 0.75). The functional parameters are represented
## with linear power basis and quadratic B-spline basis with knots at (0.25, 0.50, 0.75).
## The complexity of the designs is penalised with the smoothing value equal to 1.
example2 <- pflm(formula = ~ x1 + x2 + x1:x2 + P(x2, 2), nsd = 1, mc.cores = 1,
npf = 2, tbounds = c(0, 1), nruns = 20, startd = NULL, dx = c(2, 2),
knotsx = list(c(0.33, 0.66), c(0.25, 0.50, 0.75)),
pars = c("power", "power", "bspline", "bspline"), db = c(1, 1, 2, 2),
knotsb = list(c(), c(), c(0.25, 0.50, 0.75), c(0.25, 0.50, 0.75)),
criterion = "D", lambda = 1, tol = 0.0001, dlbound = -1, dubound = 1,
progress = FALSE)
print(example2) ## prints the output of example2.
##
## The number of profile factors is: 2
##
## The number of runs is: 20
##
## The objective criterion is: D-optimality
##
## The objective value is: 0.05706758
##
## The number of iterations is: 6
##
## The computing elapsed time is: 00:00:17
# }
Run the code above in your browser using DataLab