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. (2025). Ordered Correlation Forest. Econometric Reviews, 1–17. https://doi.org/10.1080/07474938.2024.2429596.
## Generate synthetic data.
set.seed(1986)
data <- generate_ordered_data(100)
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: 100
#>
#> 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.020 -0.086 0.106
#> x2 -0.497 0.701 -0.204
#> x3 -0.090 -0.004 0.094
#> x4 -0.564 -1.294 1.858
#> x5 -0.036 0.043 -0.007
#> x6 0.000 0.000 0.000
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.02 & -0.086 & 0.106 \\
#> \texttt{x2} & -0.497 & 0.701 & -0.204 \\
#> \texttt{x3} & -0.09 & -0.004 & 0.094 \\
#> \texttt{x4} & -0.564 & -1.294 & 1.858 \\
#> \texttt{x5} & -0.036 & 0.043 & -0.007 \\
#> \texttt{x6} & 0 & 0 & 0 \\
#>
#> \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.1 & -0.146 & 0.246 \\
#> & (0.033) & (0.141) & (0.144) \\
#> \texttt{x2} & -0.057 & 0.119 & -0.062 \\
#> & (0.276) & (0.509) & (0.209) \\
#> \texttt{x3} & -0.057 & 0.009 & 0.048 \\
#> & (0.05) & (0.093) & (0.076) \\
#> \texttt{x4} & -0.286 & -0.114 & 0.399 \\
#> & (0.125) & (0.422) & (0.338) \\
#> \texttt{x5} & -0.041 & 0.035 & 0.006 \\
#> & (0.034) & (0.024) & (0.012) \\
#> \texttt{x6} & 0 & 0 & 0 \\
#> & (0) & (0) & (0) \\
#>
#> \addlinespace[3pt]
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> \end{tabular}
#> \end{adjustbox}
#> \caption{Marginal effects.}
#> \label{table:ocf.marginal.effects}
#> \end{table}
#> \endgroup