dspline | R Documentation |

Constructs simple linear spline on a data frame using the formula syntax of dutils that is adds (x-cuti)* (x>cuti) to the data-set for each knot of the spline. The full spline is thus given by x and spline variables added to the data-set.

dspline( data, y = NULL, x = NULL, breaks = 4, probs = NULL, equi = FALSE, regex = mets.options()$regex, sep = NULL, na.rm = TRUE, labels = NULL, all = FALSE, ... )

`data` |
if x is formula or names for data frame then data frame is needed. |

`y` |
name of variable, or fomula, or names of variables on data frame. |

`x` |
name of variable, or fomula, or names of variables on data frame. |

`breaks` |
number of breaks, for variables or vector of break points, |

`probs` |
groups defined from quantiles |

`equi` |
for equi-spaced breaks |

`regex` |
for regular expressions. |

`sep` |
seperator for naming of cut names. |

`na.rm` |
to remove NA for grouping variables. |

`labels` |
to use for cut groups |

`all` |
to do all variables, even when breaks are not unique |

`...` |
Optional additional arguments |

Thomas Scheike

data(TRACE) TRACE <- dspline(TRACE,~wmi,breaks=c(1,1.3,1.7)) cca <- coxph(Surv(time,status==9)~age+vf+chf+wmi,data=TRACE) cca2 <- coxph(Surv(time,status==9)~age+wmi+vf+chf+wmi.spline1+wmi.spline2+wmi.spline3,data=TRACE) anova(cca,cca2) nd=data.frame(age=50,vf=0,chf=0,wmi=seq(0.4,3,by=0.01)) nd <- dspline(nd,~wmi,breaks=c(1,1.3,1.7)) pl <- predict(cca2,newdata=nd) plot(nd$wmi,pl,type="l")

mets documentation built on Jan. 17, 2023, 5:12 p.m.

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.