TransWikia.com

CSVREADER in creating a fancy table

TeX - LaTeX Asked by user221946 on May 14, 2021

I’m really struggling to create the following table in LaTeX where only the data comes from a csv file (the numbers in the file is in exactly the same format as it is in this table). The challenge is to have merged cells on the left. My LaTeX document starts with:
documentclass[11pt,times,letter]{article}
usepackage[margin=1in]{geometry}

enter image description here

Here is the code that I currently have for the table, but it has all numbers hardcoded.

begin{center}
begin{table}[h!]
caption{Annualized Sharpe ratios and standard deviations (in brackets) of four monthly rebalanced portfolios spanning the period January 6, 2006 through October 19, 2018. We condition on the event that the market index has monthly returns smaller than $-6.7%$ ($R_m<-6.7%$). The maximum values of the Sharpe ratios are highlighted in bold.} label{TableSharpeRatiosMonthly2}
begin{subtable}{linewidth}
centering
caption{US stocks}
begin{tabular}{|c|c|c|c|}
hline
multicolumn{2}{|c|}{}   & $q_m=0.5$ & $q_m=0.3$ 
hline
multirow{4}{*}{$q_p=0.2$} & $CoER^{leq}$ & $mathbf{-1.5538}  (0.2766)$  & $mathbf{0.0659}  (0.3538)$  cline{2-4}
& $CoER^{=}$ & $-4.0990  (0.2104)$ & $-3.2071  (0.2255)$  cline{2-4}
& Min.Var. & $-2.7377  (0.2406)$ & $-2.7377  (0.2406)$ cline{2-4}
& $1/n$ & $-6.1798  (0.2255)$ & $-6.1798  (0.2255)$ 
hline
multirow{4}{*}{$q_p=0.1$} & $CoER^{leq}$ & $mathbf{-1.9243}  (0.2638)$  & $mathbf{-1.0906}  (0.2946)$  cline{2-4}
& $CoER^{=}$ & $-4.1003  (0.2104)$ & $-3.3969  (0.2219)$  cline{2-4}
& Min.Var. & $-2.7377  (0.2406)$ & $-2.7377  (0.2406)$  cline{2-4}
& $1/n$ & $-6.1798  (0.2255)$ & $-6.1798  (0.2255)$ 
hline
end{tabular}
end{subtable}%
vspace*{10pt}
begin{subtable}{linewidth}
centering
caption{Canadian stocks}
begin{tabular}{|c|c|c|c|}
hline
multicolumn{2}{|c|}{}   & $q_m=0.5$ & $q_m=0.3$ 
hline
multirow{4}{*}{$q_p=0.2$} & $CoER^{leq}$ & $-3.8621  (0.2801)$  & $-3.8650  (0.2890)$  cline{2-4}
& $CoER^{=}$ & $-3.8872  (0.2465)$ & $-3.8912  (0.2604)$  cline{2-4}
& Min.Var. & $mathbf{-3.8466}  (0.2692)$ & $mathbf{-3.8466}  (0.2692)$  cline{2-4}
& $1/n$ & $-7.0936  (0.1028)$ & $-7.0936  (0.1028)$ 
hline
multirow{4}{*}{$q_p=0.1$} & $CoER^{leq}$ & $-3.8596  (0.2759)$  & $-3.8630  (0.2819)$  cline{2-4}
& $CoER^{=}$ & $-3.8862  (0.2465)$ & $-3.8895  (0.2576)$  cline{2-4}
& Min.Var. & $mathbf{-3.8466}  (0.2692)$ &  $mathbf{-3.8466}  (0.2692)$  cline{2-4}
& $1/n$ & $-7.0936  (0.1028)$ & $-7.0936  (0.1028)$ 
hline
end{tabular}
end{subtable}
end{table}
end{center}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP