Description Usage Arguments Details Examples
Produces two types of plots. The first type of plot shows
histograms for the pointwise partial derivatives to examine the
heterogeneity in the marginal effects of each predictor (which
==1).
The second type of plot shows estimates of the conditional expectation
functions of E[Y|X] for each predictor (which==2
). For each
plot, the predictor of interest varies from its 1st to its 3rd quartile values, while
the other predictors are kept at the means (or other values specified in
setx
). For binary varibales the E[Y|X] are predicted at the
max and the min value of the predictor (instead of the range from the 1st
to the 3rd quantile).
1 2 3 4 5 |
x |
an object of class |
which |
if a subset of the plots is required, specify a subset of the numbers |
main |
main title for histograms of pointwise partial derivatives. |
setx |
either one of |
ask |
logical; if |
nvalues |
scalar that specifies the number of values at which conditional expectations should be plotted. |
probs |
vector with numbers between 0 and 1 that specify the quantiles that determine the range for of the predictor values for which the conditional expectation should be plotted. By default we vary each predictor from the 1st quartile to the 3rd quartile value. |
... |
additional arguments to be passed to lower level functions |
Notice that the histograms for the partial derivatives can only
be plotted if the KRLS object is the result of summary.krls2
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # non-linear example
# set up data
N <- 200
x1 <- rnorm(N)
x2 <- rbinom(N,size=1,prob=.2)
y <- x1^3 + .5*x2 + rnorm(N,0,.15)
X <- cbind(x1,x2)
# fit model and summarize
krlsout <- summary(krls(X=X,y=y))
# plot marginal effects and conditional expectation plots
plot(krlsout)
# binary exmaple
y <- rbinom(
N,
size = 1,
prob = 1/(1+exp(-y))
)
krlogout <- summary(
krls(X=X,y=y,loss='logistic',epsilon=0.01)
)
plot(krlogout)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.