## Example 1:
d <- list(x1=matrix(runif(48), nrow=12))
within(d, example1 <- P(x = x1, deg = 2))
# \donttest{
## Example 2: Use the function in a formula
## 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 quadratic effect is identified in the formula argument using the \link[fdesigns]{P} function.
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)
# }
Run the code above in your browser using DataLab