gplsim | R Documentation |
This function employs penalized spline (P-spline) to estimate generalized partially linear single index models, which extend the generalized linear models to include nonlinear effect for some predictors.
This function add formula interface to gplsim function
gplsim(...) ## Default S3 method: gplsim( Y = Y, X = X, Z = Z, family = gaussian(), penalty = TRUE, profile = TRUE, user.init = NULL, bs = "ps", ... ) ## S3 method for class 'formula' gplsim( formula, data, family = gaussian(), penalty = TRUE, profile = TRUE, user.init = NULL, bs = "ps", ... )
... |
includes optional arguments user can pass to |
Y |
Response variable, should be a vector. |
X |
Single index covariates. |
Z |
Partially linear covariates. |
family |
A |
penalty |
Whether use penalized splines or un-penalized splines to fit the model. The default is TRUE. |
profile |
profile is a logical variable that indicates whether the algorithm with profile likelihood or algorithm with NLS procedure should be used. The default algorithm is set to algorithm with profile likelihood. |
user.init |
The user.init is a numeric vector of the same length as the dimensionality of single index predictors. The users can use this argument to pass in any appropriate user-defined initial single-index coefficients based on prior information or domain knowledge. The default value is NULL. |
bs |
bs is a character variable that specifies the spline basis in the estimation of unknown univariate function of single index. Default is P-splines. |
formula |
A model formula; |
data |
A data matrix containing the variables in the formula. |
For formula method, see ?gplsim.formula
theta Estimation of Theta
coefficients the coefficients of the fitted model. Parametric coefficients are first, followed by coefficients for each spline term in turn.
... See GAM object
theta Estimation of Theta
coefficients the coefficients of the fitted model. Parametric coefficients are first, followed by coefficients for each spline term in turn.
... See GAM object
# parameter settings n=200 true.theta = c(1, 1, 1)/sqrt(3) # Gaussian case # This function generate a plain sin bump model with gaussian response. data <- generate_data(n,true.theta=true.theta,family="gaussian") y=data$Y # continous response X=data$X # single index term ; Z=data$Z # partially linear term ; result <- gplsim(y,X,Z,family = gaussian) result$theta result$coefficients summary(result) #plot the estimated single index function curve plot_si(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.