margeffPlot: Plot marginal effects / partial dependence curves

Description Usage Arguments Value Examples

Description

Plot marginal effects / partial dependence curves

Usage

1
margeffPlot(fit, X, y = NULL, predfun, wch = 1, res = 100, points = FALSE)

Arguments

fit

a model it

X

a data frame to be used. should not included the response variable.

y

the response variable. used only for plotting numeric covariates, and is optional.

predfun

a prediction function that takes the arguments fit and newdata, and returns a vector of predicted values.

wch

which variables to plot. can be a single number indexing the variable, or a vector of two numbers to plot the predicted values as a function of both variables.

res

the resolution of the plot, in other words, how many points along the function should define the curve/line.

points

if TRUE, and y is not NULL, the data points are plotted with the regression line.

Value

a plot

Examples

1
2
3
fit <- KIR(prog ~ .-sex, diabetes)
yhat <- predict(fit, newdata, type = "response")
margeffPlot(fit = fit, X = diabetes[,-c(2, 11)], predfun = yhat, wch = 4)

abnormally-distributed/cvreg documentation built on May 3, 2020, 3:45 p.m.