PartialSplines: Estimates a partial splines model

Description Usage Arguments Value Examples

View source: R/PartialSplines.R

Description

PartialSplines function allows you to estimate a model where the linear relationship between the response variable and the explanatory ones is summarized by coefficients Beta; on the other hand, coefficients Delta explain the unspecified functional relationship between y and the spline variable 'tx'.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
PartialSplines(
  y,
  x,
  tx,
  prop.knots = NULL,
  intercept = T,
  n.basis = 15,
  alpha = NULL,
  tol = 10^-4,
  b.start = NULL,
  d.start = NULL,
  trace = T,
  max.iter = 100,
  r = NULL
)

Arguments

y

response variable, must be a vector

x

data frame of explanatory variables

tx

spline variable, must be a vector

prop.knots

proportion of nodes to be interpolated, if NULL the value will be estimated through cross validation

intercept

if model has to be estimated with an intercept

n.basis

number of basis for estimating the B-spline

alpha

tuning parameter for the bending of the spline, if NULL the value will be estimated through cross validation

tol

tolerance parameter

b.start

initial values for beta parameters

d.start

initial values for delta parameters

trace

if TRUE, information is printed during the running of optimization process

max.iter

maximum number of iterations

r

sequence of values form which the basis will be estimated. It mainly has an internal use, it's advisable to not change it

Value

PartialSplines return an object of class "PSM" which is a list containing several objects

Examples

1
2
3
4
5
x <- data.frame(x = rnorm(100))
tx <- rnorm(100)
eps <- rnorm(100)
y <- x[,1] + tx^4 + eps
psm <- PartialSplines(y, x, tx)

reealpeppe/PSM documentation built on Dec. 22, 2021, 2:06 p.m.