Description Usage Arguments Details Value Examples
This is an internal function of package ggam
.
1 |
B |
The bernstein basis matrix. |
Q2 |
The |
P |
The penalty matrix. |
lambda |
The smoothing penalty parameter. |
Y |
Response variable. |
fx |
indicates whether the term is a fixed d.f. regression
spline ( |
Z |
The parametric model matrix. set to ' |
... |
other arguments. |
The method is a computationally efficient means of applying GCV
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 | library(Matrix)
library(BPST)
data("eg1pop_dat")
eg1_V1=eg1pop_dat[['V1']]
eg1_T1=eg1pop_dat[['T1']]
eg1pop_rho03=eg1pop_dat[['rho03']]
sam=eg1pop_rho03[sample(1:dim(eg1pop_rho03)[1],100),]
B0=basis(eg1_V1,eg1_T1, d=2, r=1, sam[,3:4])
B=B0$Bi
ind=B0$Ind.inside
Q2=B0$Q2
K=B0$K
P=t(Q2)%*%K%*%Q2
Z=sam[ind,c(5:12)]
Y=sam[ind,'Y']
lambda=10^(seq(-2,5,by=1))
plsfitGCV(as.matrix(B),Q2,P,lambda,Y,fx=FALSE,Z=Z)
### without parametric part
plsfitGCV(as.matrix(B),Q2,P,lambda,Y,fx=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.