sm_regression: Kernel-weighted regression models

Description Usage Arguments Examples

Description

The user specifies a regression model and a variable for weighting, and 'sm_regression“ will estimate a weighted regression model for each unique value of the specified variable.

Usage

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

Arguments

data

data frame

method

function to use

formula

formula

weighting_var

columns name(s) of variables used to calculate weights

newdata

new data frame. Default is 'data'.

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 stats::dist is acceptable.

verbose

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

Examples

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

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