Description Usage Arguments Details Value Examples
This is an internal function of package ggam
.
1 |
B |
The bernstein basis matrix. |
Q2 |
The |
K |
The energy matrix to construct penalty matrix. |
lambda |
The smoothing penalty parameter. |
Y |
Response variable. |
fx |
indicates whether the term is a fixed d.f. regression.
spline ( |
fold |
number of folders to do cross validation. |
Z |
The parametric model matrix. set to ' |
The method is a computationally efficient means of applying cross validation to the problem of smoothing parameter selection:
\min _ { \boldsymbol { β } , \boldsymbol { γ } } \frac { 1 } { 2 } ≤ft{ \| \mathbf { Y } - \mathbf { Z } \boldsymbol { β } - \mathbf { B } \boldsymbol { γ } \| ^ { 2 } + λ \boldsymbol { γ } ^ { \top } \mathbf { P } γ \right}
subject to constraints \mathbf { H } γ = \mathbf { 0 }.
Z
is a parametrix design matrix, β a parameter vector, Y a data vector,
γ is the berstein coefficients, B is the Bernsterin basis matrix,
H is contraint matrix.
A list of fit information.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(GgAM)
library(Matrix)
library(BPST)
data("eg2pop_dat")
eg2_V20=eg2pop_dat[['V20']]
eg2_T20=eg2pop_dat[['T20']]
eg2pop=eg2pop_dat[['pop']]
d=2
r=1
sam=eg2pop[sample(1:dim(eg2pop)[1],100),]
B0=basis(eg2_V20,eg2_T20, d, r, sam[,3:4])
B=B0$Bi
ind=B0$Ind.inside
Q2=B0$Q2
K=B0$K
Z=sam[ind,c(5:12)]
Y=sam[ind,'Y']
lambda=10^(seq(-2,5,by=1))
plsfitCV(as.matrix(B),Q2,K,lambda,Y,fx=FALSE,Z=Z)
### without parametric part
plsfitCV(as.matrix(B),Q2,K,lambda,Y,fx=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.