## Load data from orf package.
set.seed(1986)
library(orf)
data(odata)
odata <- odata[1:200, ] # Subset to reduce elapsed time.
y <- as.numeric(odata[, 1])
X <- as.matrix(odata[, -1])
## Fit morf. Use large number of trees.
forests <- morf(y, X, n.trees = 4000)
## Marginal effects at the mean.
me <- marginal_effects(forests, eval = "atmean")
summary(me)
summary(me, latex = TRUE)
# \donttest{
## Add standard errors.
honest_forests <- morf(y, X, n.trees = 4000, honesty = TRUE)
honest_me <- marginal_effects(honest_forests, eval = "atmean", inference = TRUE)
summary(honest_me, latex = TRUE)# }
Run the code above in your browser using DataLab