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(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.008 -0.167 0.159
#> x2 -0.034 0.066 -0.033
#> x3 -0.089 0.014 0.075
#> x4 -0.047 -0.148 0.194
#> x5 -0.022 0.027 -0.004
#> x6 0.009 -0.027 0.018
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.008 & -0.167 & 0.159 \\
#> \texttt{x2} & -0.034 & 0.066 & -0.033 \\
#> \texttt{x3} & -0.089 & 0.014 & 0.075 \\
#> \texttt{x4} & -0.047 & -0.148 & 0.194 \\
#> \texttt{x5} & -0.022 & 0.027 & -0.004 \\
#> \texttt{x6} & 0.009 & -0.027 & 0.018 \\
#>
#> \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.064 & -0.117 & 0.181 \\
#> & (0.032) & (0.136) & (0.09) \\
#> \texttt{x2} & -0.004 & 0.009 & -0.005 \\
#> & (0.028) & (0.052) & (0.016) \\
#> \texttt{x3} & -0.065 & 0.003 & 0.062 \\
#> & (0.049) & (0.078) & (0.081) \\
#> \texttt{x4} & -0.025 & -0.021 & 0.045 \\
#> & (0.01) & (0.037) & (0.033) \\
#> \texttt{x5} & -0.029 & 0.028 & 0.001 \\
#> & (0.022) & (0.019) & (0.009) \\
#> \texttt{x6} & -0.002 & -0.009 & 0.011 \\
#> & (0.019) & (0.043) & (0.028) \\
#>
#> \addlinespace[3pt]
#> \\[-1.8ex]\hline
#> \hline \\[-1.8ex]
#> \end{tabular}
#> \end{adjustbox}
#> \caption{Marginal effects.}
#> \label{table:ocf.marginal.effects}
#> \end{table}
#> \endgroup