Description Usage Arguments Details Author(s) See Also 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 |
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 historgrams for the partial derivatives can only be plotted if the KRLS object was computed with krls(,derivatives=TRUE)
.
Jens Hainmueller (Stanford) and Chad Hazlett (MIT)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # 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
krlsout <- krls(X=X,y=y)
# summarize marginal effects and contribution of each variable
summary(krlsout)
# plot marginal effects and conditional expectation plots
plot(krlsout)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.