# Multicolumn and thead problem in tabularx

I am trying to implement a code using tabularx and multicolumn along with head, but I keep on getting an error. The code is as follows:

\begindocumnet{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{ragged2e}
\newcolumntype{L}{ >{\RaggedRight}X }
\usepackage{siunitx}
\usepackage{makecell}
\setlength\parindent{0pt}
\newcolumntype{Y}{ >{\Centering}X}
\usepackage[justification=centering]{caption}

\noindent

\newcolumntype{Y}{ >{\Centering}X}
\begin{tabularx}{\textwidth}{@{} lYYY @{}}

\toprule

& \multicolumn{2}{c}{\thead{1 Period}} & {\multicolumn{2}{c}{1 Period}} &

\midrule

Test-Statistic & 0 & 1.00 & 1.00 \\ \addlinespace

P-value & 0 & 0.59 & 1.00 \\ \addlinespace

\bottomrule

\end{tabularx}


To provide an idea, I basically want to make a chart with the following content

except I would like to have the layout in the following format :

However, I get the following error such as: "extra alignment tab has been change to \cr" could someone please help advise me where I am making a mistake with the code ? Thank you

You have mismatch in MWE (one multicolum is probably accidentally repeated). Corrected (and slightly improved) code is:

\documentclass{article}
\usepackage{booktabs,makecell,multirow,tabularx}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}

\newcommand\mc[1]{\multicolumn{2}{c}{#1}}
\usepackage[justification=centering]{caption}
\usepackage{ragged2e}
\usepackage{siunitx}

\usepackage[margin=20mm]{geometry}
\setlength\parindent{0pt}

\begin{document}
\begin{tabularx}{\textwidth}{@{} l *{6}{C} @{}}
\toprule
\cmidrule(rl){2-3}\cmidrule(rl){4-5}\cmidrule(rl){6-7}