| makessp {bigsplines} | R Documentation | 
Makes Objects to Fit Smoothing Splines with Parametric Effects
Description
This function creates a list containing the necessary information to fit a smoothing spline with parametric effects (see bigssp). 
Usage
makessp(formula,data=NULL,type=NULL,nknots=NULL,rparm=NA,
        lambdas=NULL,skip.iter=TRUE,se.fit=FALSE,rseed=1234,
        gcvopts=NULL,knotcheck=TRUE,thetas=NULL,weights=NULL,
        random=NULL,remlalg=c("FS","NR","EM","none"),remliter=500,
       remltol=10^-4,remltau=NULL)
Arguments
formula | 
 An object of class "  | 
data | 
 Optional data frame, list, or environment containing the variables in   | 
type | 
 List of smoothing spline types for predictors in   | 
nknots | 
 Two possible options: (a) scalar giving total number of random knots to sample, or (b) vector indexing which rows of   | 
rparm | 
 List of rounding parameters for each predictor. See Details.  | 
lambdas | 
 Vector of global smoothing parameters to try. Default uses   | 
skip.iter | 
 Logical indicating whether to skip the iterative smoothing parameter update. Using   | 
se.fit | 
 Logical indicating if the standard errors of the fitted values should be estimated.  | 
rseed | 
 Random seed for knot sampling. Input is ignored if   | 
gcvopts | 
 Control parameters for optimization. List with 3 elements: (a)   | 
knotcheck | 
 If   | 
thetas | 
 List of initial smoothing parameters for each predictor subspace. See Details.  | 
weights | 
 Vector of positive weights for fitting (default is vector of ones).  | 
random | 
 Adds random effects to model (see Random Effects section).  | 
remlalg | 
 REML algorithm for estimating variance components (see Random Effects section). Input is ignored if   | 
remliter | 
 Maximum number of iterations for REML estimation of variance components. Input is ignored if   | 
remltol | 
 Convergence tolerance for REML estimation of variance components. Input is ignored if   | 
remltau | 
 Initial estimate of variance parameters for REML estimation of variance components. Input is ignored if   | 
Details
See bigssp and below example for more details.
Value
An object of class "makessp", which can be input to bigssp.
Warning
When inputting a "makessp" class object into bigssp, the formula input to bigssp must be a nested version of the original formula input to makessp. In other words, you cannot add any new effects after a "makessp" object has been created, but you can drop (remove) effects from the model.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Gu, C. (2013). Smoothing spline ANOVA models, 2nd edition. New York: Springer.
Helwig, N. E. (2013). Fast and stable smoothing spline analysis of variance models for large samples with applications to electroencephalography data analysis. Unpublished doctoral dissertation. University of Illinois at Urbana-Champaign.
Helwig, N. E. (2016). Efficient estimation of variance components in nonparametric mixed-effects models with large samples. Statistics and Computing, 26, 1319-1336.
Helwig, N. E. (2017). Regression with ordered predictors via ordinal smoothing splines. Frontiers in Applied Mathematics and Statistics, 3(15), 1-13.
Helwig, N. E. and Ma, P. (2015). Fast and stable multiple smoothing parameter selection in smoothing spline analysis of variance models with large samples. Journal of Computational and Graphical Statistics, 24, 715-732.
Helwig, N. E. and Ma, P. (2016). Smoothing spline ANOVA for super-large samples: Scalable computation via rounding parameters. Statistics and Its Interface, 9, 433-444.
Examples
##########   EXAMPLE  ##########
# function with two continuous predictors
set.seed(773)
myfun <- function(x1v,x2v){
  sin(2*pi*x1v) + log(x2v+.1) + cos(pi*(x1v-x2v))
}
x1v <- runif(500)
x2v <- runif(500)
y <- myfun(x1v,x2v) + rnorm(500)
# fit 2 possible models (create information 2 separate times)
system.time({
  intmod <- bigssp(y~x1v*x2v,type=list(x1v="cub",x2v="cub"),nknots=50)
  addmod <- bigssp(y~x1v+x2v,type=list(x1v="cub",x2v="cub"),nknots=50)
})
# fit 2 possible models (create information 1 time)
system.time({
  makemod <- makessp(y~x1v*x2v,type=list(x1v="cub",x2v="cub"),nknots=50)
  int2mod <- bigssp(y~x1v*x2v,makemod)
  add2mod <- bigssp(y~x1v+x2v,makemod)
})
# check difference (no difference)
crossprod( intmod$fitted.values - int2mod$fitted.values )
crossprod( addmod$fitted.values - add2mod$fitted.values )