Description Usage Arguments Value Author(s) Examples

The user will input a data frame, then designate the variable that is the outcome. Then the spline term is selected along with any other independent variables. Finally, a number K partitions is chosen for the algorithm to search for potential cubic spline knots based on the spline term and partition.

1 |

`d` |
A data frame data set with column names. |

`outcomeVariable` |
The variable from 'd' that is the outcome. |

`splineTerm` |
The spline term, inherited from 'd'. |

`additionalVars` |
A vector of additional variables to be included in the model. |

`K` |
The number of evenly spaced partitions to be searched. |

`fits` |
The fitted values of the linear model. |

`xhat` |
The entire feature matrix. |

`coefs` |
The significant coefficients of the model. |

`adjr2` |
The adjusted R^2 value. |

Eric Golinko

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## for simple spline model.
data(LakeHuron)
d <- data.frame(seq(1875, 1972, 1), LakeHuron)
names(d) <- c('date', 'lh')
fit <- part(d = d, outcomeVariable = 'lh', splineTerm = 'date', K = 20)
fit
plot(d$date, d$lh)
lines(d$date, fit$fits, col = 'red')
## multivariate
data(freeny)
freeny$time <- as.numeric(rownames(freeny))
fit <- part(d = freeny, outcomeVariable = 'y',
splineTerm = 'time', additionalVars = c('market.potential', 'income.level'), K =2)
fit$coefs
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.