Skip to contents

This function makes a list object containing all of the information to fit splines to continuous data.

Usage

makesplineParams(
  data,
  varlist,
  predictionData = NULL,
  degree = NULL,
  spl_all = NULL
)

Arguments

data

Data frame containing columns of covariates listed in varlist. Column names must match with names in varlist

varlist

Vector of variable names for the covariates of interest

predictionData

Data frame containing columns of covariates listed in varlist. Column names must match with those in varlist. This parameter is used to find the maximum range of covariates between the data and prediction data. If predictionData is NULL then the range of the data is used.

degree

Vector specifying the degree of the spline. If unspecified, degree 2 is stored.

Details

The information is stored in list slots [[2]] and onward (slot [[1]] is reserved for a spatial term). Specifically:

covar. Name of covariate.

explanatory. Vector of covariate data.

knots. Knot(s) for spline fitting. This function initialises with a knot at the mean covariate value.

bd. This specifies the boundary knots. If predictionData is NULL then this is the range of the covariate data. Otherwise, the boundary knots are the maximum combined range of the data and prediction data.

degree. The degree of a B-spline. This function retuns 2 by default.

See runSALSA2D for details on the spatial slot ([[1]])

Examples

# load data
data(ns.data.re)
# load prediction data
data(ns.predict.data.re)

splineParams<- makesplineParams(ns.data.re, varlist=c('observationhour', 'DayOfMonth'),
                predictionData=ns.predict.data.re)