gplsfitGCV: Generalized Penalized Least Square Fit under GCV

Description Usage Arguments Details Value Examples

View source: R/gplsfitGCV.R

Description

This is an internal function of package ggam.

Usage

1
2
3
4
gplsfitGCV(Y, B, Q2, P, UB = NULL, lambda, family, offset, theta = 0,
  fx, control, start = NULL, etastart = NULL, mustart = NULL,
  X = NULL, ind_c = 1:ncol(X), fixedSteps = (control$maxstep + 1),
  ...)

Arguments

Y

Response variable.

B

The bernstein basis matrix.

Q2

The Q2 matrix from QR decomposition of the transpose of the constraint matrix.

P

The penalty matrix.

UB

The univariate basis function matrix constructed.

lambda

The smoothing penalty parameter.

family

The family object, specifying the distribution and link to use.

offset

Can be used to supply a model offset for use in fitting. Note that this offset will always be completely ignored when predicting.

theta

The given theta values in negative binomial family.

fx

indicates whether the term is a fixed d.f. regression

control

A list of fit control parameters to replace defaults returned by plbpsm.control. Any control parameters not supplied stay at their default values. spline (TRUE) or a penalized regression spline (FALSE).

start

Initial values for model coefficients

etastart

Initial values for linear predictor.

mustart

Initial values for the expected response.

X

The parametric model matrix. set to 'NULL' if it is not provided.

ind_c

The vector of index to indicate the parametric part.

fixedSteps

How many steps to take: useful when only using this routine to get rough starting values for other methods.

...

other arguments.

Details

See section 4 'Implementation' in Shan et al. (2018).

Value

A list of fit information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(BPST)
data("eg_poi")
eg1_V1 <- eg_poi[['V1']]
eg1_T1 <- eg_poi[['T1']]
sam <- eg_poi[['sam_poi']]
d <- 2
r <- 1
B0 <- basis(eg1_V1,eg1_T1, d, r, sam[,c('loc1','loc2')])
B <- B0$Bi
ind <- B0$Ind.inside
Q2 <- B0$Q2
K <- B0$K
Z <- sam[ind,c(5:12)]
Y <- sam[ind,'y']
lambda_start <- 0.01
lambda_end <- 32
nlambda <- 10
lambda <- exp(seq(log(lambda_start),log(lambda_end),length.out=nlambda))
X <- sam[,1:15]
P <- t(Q2)%*%K%*%Q2
gplsfitGCV(Y,as.matrix(B),Q2,P,UB=NULL,lambda=lambda,family=poisson(),offset=0,fx=FALSE,
control = plbpsm.control(),X=as.matrix(X))

funstatpackages/GgAM documentation built on Nov. 4, 2019, 12:59 p.m.