sm_predict: Kernel-weighted predictions from regression models

Description Usage Arguments Examples

Description

Calculates kernel-weighted predictions from regression models (i.e. outcomes that can be calculated from the predict function).

Usage

1
2
3
sm_predict(data, method, formula, type, newdata = data,
  method.args = NULL, lambda = 1, kernel = "epanechnikov",
  dist.method = "euclidean", verbose = FALSE)

Arguments

data

data frame

method

function to use

formula

formula

type

type of statistic to smooth (e.g. survival, median survival, etc.)

newdata

new data frame. Default is 'data'. Only requires covariates from the RHS of '~' and the time component from the outcome for some survival estimators.

method.args

List of additional arguments passed on to the modelling function defined by 'method'

lambda

The radius of the kernel for tri-cubic, Epanechnikov, and flat kernels. The standard deviation for the Gaussian kernel

kernel

Specifies the kernel to be used: 'epanechnikov', 'tricube', 'gaussian', and 'flat' are accepted. Default is 'epanechnikov'

dist.method

Specifies the distance measure to be used in the kernel. Default is 'euclidean'. Distance measures accepted by

verbose

Return full set of results as an attribute. Default is 'FALSE'

Examples

1
2
3
4
5
6
7
sm_predict(
  mtcars,
  method = "glm",
  formula = am ~ mpg,
  method.args = list(family = binomial(link = "logit")),
  type = "response"
)

ddsjoberg/sjosmooth documentation built on May 14, 2019, 5:16 p.m.