Smooth basis constructor to define structured penalties (Randolph et al., 2012) for smooth terms.

```
# S3 method for peer.smooth.spec
smooth.construct(object, data, knots)
```

object

a `peer.smooth.spec`

object, usually generated by a
term `s(x, bs="peer")`

; see Details.

data

a list containing the data (including any `by`

variable)
required by this term, with names corresponding to `object$term`

(and `object$by`

). Only the first element of this list is used.

knots

not used, but required by the generic `smooth.construct`

.

An object of class `"peer.smooth"`

. See
`smooth.construct`

for the elements that this object will
contain.

The smooth specification object, defined using `s()`

, should
contain an `xt`

element. `xt`

will be a list that contains
additional information needed to specify the penalty. The type of penalty
is indicated by `xt$pentype`

. There are four types of penalties
available:

`xt$pentype=="RIDGE"`

for a ridge penalty, the default`xt$pentype=="D"`

for a difference penalty. The order of the difference penalty is specified by the`m`

argument of`s()`

.`xt$pentype=="DECOMP"`

for a decomposition-based penalty, \(bP_Q + a(I-P_Q)\), where \(P_Q = Q^t(QQ^t)^{-1}Q\). The \(Q\) matrix must be specified by`xt$Q`

, and the scalar \(a\) by`xt$phia`

. The number of columns of`Q`

must be equal to the length of the data. Each row represents a basis function where the functional predictor is expected to lie, according to prior belief.`xt$pentype=="USER"`

for a user-specified penalty matrix \(L\), supplied by`xt$L`

.

Randolph, T. W., Harezlak, J, and Feng, Z. (2012). Structured penalties for
functional linear models - partially empirical eigenvectors for regression.
*Electronic Journal of Statistics*, 6, 323-353.