Summarizes an ocf.marginal
object.
# S3 method for class 'ocf.marginal'
summary(object, latex = FALSE, ...)
Summarizes an ocf.marginal
object.
Compilation of the LATEX code requires the following packages: booktabs
, float
, adjustbox
. If
standard errors have been estimated, they are printed in parenthesis below each point estimate.
Di Francesco, R. (2023). Ordered Correlation Forest. arXiv preprint arXiv:2309.08755.
## Generate synthetic data.
set.seed(1986)
data <- generate_ordered_data(1000)
sample <- data$sample
Y <- sample$Y
X <- sample[, -1]
## Fit ocf.
forests <- ocf(Y, X)
## Marginal effects at the mean.
me <- marginal_effects(forests, eval = "atmean")
summary(me)
#> ocf marginal effects results
#>
#> Data info:
#> Number of classes: 3
#> Sample size: 1000
#>
#> Tuning parameters:
#> Evaluation: atmean
#> Bandwidth: 0.1
#> Number of trees: 2000
#> Honest forests: FALSE
#> Honesty fraction: 0
#>
#> Marginal Effects:
#> P'(Y=1) P'(Y=2) P'(Y=3)
#> x1 -0.195 -0.464 0.659
#> x2 -0.344 -0.013 0.356
#> x3 0.385 0.127 -0.512
#> x4 -0.297 0.126 0.170
#> x5 -0.002 0.272 -0.269
#> x6 -0.058 0.029 0.029
summary(me, latex = TRUE)
#> \begingroup
#> \setlength{\tabcolsep}{8pt}
#> \renewcommand{\arraystretch}{1.1}
#> \begin{table}[H]
#> \centering
#> \begin{adjustbox}{width = 0.75\textwidth}
#> \begin{tabular}{@{\extracolsep{5pt}}l c c c}
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> & Class 1 & Class 2 & Class 3 \\
#> \addlinespace[2pt]
#> \hline \\[-1.8ex]
#>
#> \texttt{x1} & -0.195 & -0.464 & 0.659 \\
#> \texttt{x2} & -0.344 & -0.013 & 0.356 \\
#> \texttt{x3} & 0.385 & 0.127 & -0.512 \\
#> \texttt{x4} & -0.297 & 0.126 & 0.17 \\
#> \texttt{x5} & -0.002 & 0.272 & -0.269 \\
#> \texttt{x6} & -0.058 & 0.029 & 0.029 \\
#>
#> \addlinespace[3pt]
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> \end{tabular}
#> \end{adjustbox}
#> \caption{Marginal effects.}
#> \label{table:ocf.marginal.effects}
#> \end{table}
#> \endgroup
## Add standard errors.
honest_forests <- ocf(Y, X, honesty = TRUE)
honest_me <- marginal_effects(honest_forests, eval = "atmean", inference = TRUE)
summary(honest_me, latex = TRUE)
#> \begingroup
#> \setlength{\tabcolsep}{8pt}
#> \renewcommand{\arraystretch}{1.1}
#> \begin{table}[H]
#> \centering
#> \begin{adjustbox}{width = 0.75\textwidth}
#> \begin{tabular}{@{\extracolsep{5pt}}l c c c}
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> & Class 1 & Class 2 & Class 3 \\
#> \addlinespace[2pt]
#> \hline \\[-1.8ex]
#>
#> \texttt{x1} & -0.234 & 0.017 & 0.218 \\
#> & (0.291) & (0.17) & (0.057) \\
#> \texttt{x2} & -0.231 & 0.063 & 0.168 \\
#> & (0.084) & (0.081) & (0.093) \\
#> \texttt{x3} & 0.081 & -0.086 & 0.005 \\
#> & (0.109) & (0.111) & (0.088) \\
#> \texttt{x4} & -0.133 & 0.075 & 0.058 \\
#> & (0.083) & (0.097) & (0.069) \\
#> \texttt{x5} & 0.051 & -0.056 & 0.005 \\
#> & (0.122) & (0.055) & (0.016) \\
#> \texttt{x6} & -0.029 & 0.03 & -0.001 \\
#> & (0.031) & (0.03) & (0.019) \\
#>
#> \addlinespace[3pt]
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> \end{tabular}
#> \end{adjustbox}
#> \caption{Marginal effects.}
#> \label{table:ocf.marginal.effects}
#> \end{table}
#> \endgroup