% !TEX root = ../main.tex

\chapter{Empirical Results}
\thispagestyle{myheadings}

Regression results are sorted and presented in Table \ref{tb:models_result}. First-line in each cell is the coefficients of models. Second-line is standard error, which indicate the significance of the corresponding coefficient. \\

According to HAR model and PACF in Figure \ref{PACF}, rolling averaged Realized Volatility is regressed, Matched with PACF in Figure \ref{PACF}, $\log(RV_{t-1})$ follows AR(1) process which provides positive and significant impact. Seconded the functionality of HAR model, $\log(RV_{t-1|t-7})$ has the strongest significance over positive coefficient in terms of estimating Realized Volatility. Same as what is shown on Figure \ref{PACF}, $\log(RV_{t-1|t-30})$ has slightly negative effect onto $\log(RV_t)$ but not significant. However remove $\log(RV_{t-1|t-30})$ result in very limited difference in explainability.\\

\begin{comment}
\begin{equation}
RV_t = -0.7749 + 0.2463 RV_{t-1} + 0.6804 RV_{t-1|t-7} - 0.0073RV_{t-1|t-30}+u_t
\label{HAR_equation}
\end{equation}
\end{comment}

Conjointly with Quarticity. $RV_{t-1}$ and $RV_{t-1|t-7}$ broken down into logarithmic $RQ_{t-1}^{1/2}\cdot RV_{t-1}$ and $RQ_{t-1|t-7}^{1/2}\cdot RV_{t-1|t-7}$, they are added to regression for the purpose of exploration coefficients in HAR model\footnote{The order of calculating RQ is to logarithm after multiply}. The outcome of HARQ model corroborates the assumption of Brownian Motion's negative effect over Realized Volatility. The existence of Realized Quarticity reduces prediction loss compared with HAR model from same data source under time intervals in all 10 min, 30 min, 60 min and 120 min intervals obtained from Table \ref{MSE_under_intervals}.sHARQ model gives similar results compared to HARQ model. Significant and positive $\log(RV_{t-1})$ and $\log(RV_{t-1|t-7})$, negative and insignificant Quarticity.\\
\\

\begin{comment}
\begin{equation}
RV_t=-1.2690+(0.3355-0.0459RQ_{t-1}^{1/2})RV_{t-1}+(0.8166-0.0704RQ_{t-1|t-7}^{1/2})RV_{t-1|t-7}+u_t
\label{HARQ_equation}
\end{equation}
\end{comment}

\begin{comment}
\section{HAR-X}
\begin{equation}
\begin{split}
RV_t=&-1.8182+0.2312RV_{t-1}+0.6751RV_{t-1|t-7}-0.0304RV_{t-1|t-30}\\&+0.3222adjustedTxVolume(USD)-0.5050txCount\\
    &-0.2751marketcap(USD)+1.0979medianTxValue(USD)\\
    &+0.2657averageDifficulty+u_t
\end{split}
\label{HARX_equation}
\end{equation}

\section{HARQ-X}
\begin{equation}
\begin{split}
RV_t=&-2.1669+(0.2714-0.0226RQ_{t-1}^{1/2})RV_{t-1}+(0.8003-0.0684RQ_{t-1|t-7}^{1/2})RV_{t-1|t-7}\\&+0.2988adjustedTxVolume(USD)-0.3945txCount\\
    &-0.3222marketcap(USD)+1.1473medianTxValue(USD)\\
    &+0.2655averageDifficulty+u_t
\end{split}
\label{HARQX_equation}
\end{equation}
\end{comment}

\begin{figure}[H]
\centering
\fbox{\includegraphics[width=\linewidth]{figures/HARQX}}
\caption{HARQ-X Model Predictability (under 10min interval)}
\label{HARQ-X_Model_Predictability}
\end{figure}

HAR-X model is constructed for comparison with the HAR model and HARQ-X model.  Figure \ref{HARQ-X_Model_Predictability} is the visualisation of the forecast of HARQ-X model where the green line is the real Realized Volatility, and Red-line is the prediction value.\\

From the table, we unveil in a number of regular patterns. Firstly $/log(RV_{t-1|t-7})$ are significant through all models. Horizontally compare, including Quarticity (both $\log (RQ_{t-1}^{1/2}\cdot RV_{t-1})$ and $\log (RQ_{t-1|t-7}^{1/2}\cdot RV_{t-1|t-7})$) makes interesting change to the coefficient of corresponding $\log(RV)$. After splitting $\log(RV)$, HARQ model, sHARQ model and HARQ-X model have their coefficient of $\log(RV)$ raised while new Quarticity produced negative value. Specifically sHARQ model which has only $\log(RV_{t-1})$ separated displays the difference in coefficients.$\log(RV_{t-1})$ are raised with existence of Quarticity while $\log(RV_{t-1|t-7})$ remains unchanged. \\

Secondly, read from table that including Quarticity potentially dropped significance of $\log(RV)$, By comparing a couple of model pairs such as mHAR model with HARQ model, mHAR model with sHARQ model, HAR-X model with HARQ-X model, $\log(RV_{t-1|t-7})$ remain unchanged under measurement of p-value at the scale of three decimals. However, the significance of $\log(RV_{t-1})$ in all HARQ, sHARQ and HARQ-X experienced drop statistically.\\

Thirdly, insignificance. In this table, all quarticities and most metrics are statistically insignificant if stand alone. However, insignificance is generated under the standard of the p-value, in terms of enhancement of predictability. Both metrics and quarticities improved significance according to Robustness Test in Table \ref{MSE_under_intervals}. \\

\begin{table}[H]\tiny%
\centering
\begin{threeparttable}
\begin{sideways}
\scalebox{1.4}{\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
                                                                & HAR              & mHAR             & HARQ             & sHARQ            & HAR-X            & HARQ-X            \\
\hline
Constant                                                        & $-0.7749^{***}$  & $-0.7651^{***}$  & $-1.2690^{***}$  & $-1.1799^{***}$  & $-1.8587^{***}$  & $-2.2109^{***}$   \\
std err                                                         & 0.118            & 0.111            & 0.357            & 0.350            & 0.454            & 0.566             \\
\hline
$\log (RV_{t-1})$                                               & $0.2463^{***}$   & $0.2463^{***}$   & $0.3355^{**}$    & $0.4325^{***}$   & $0.2273^{***}$   & $0.2566$        \\
std err                                                         & 0.029            & 0.029            & 0.171            & 0.152            & 0.030            & 0.176             \\
\hline
$\log (RQ_{t-1}^{1/2}\cdot RV_{t-1})$                           &                  &                  & $-0.0459$        & $-0.0892$        &                  & $-0.016$          \\
std err                                                         &                  &                  & 0.079            & 0.071            &                  & 0.082             \\
\hline
$\log (RV_{t-1|t-7})$                                           & $0.6804^{***}$   & $0.6748^{***}$   & $0.8166^{***}$   & $0.6640^{***}$   & $0.6563^{***}$   & $0.7944^{***}$    \\
std err                                                         & 0.039            & 0.031            & 0.127            & 0.032            & 0.033            & 0.133             \\
\hline
$\log (RQ_{t-1|t-7}^{1/2}\cdot RV_{t-1|t-7})$  &                  &                  & $-0.0704$        &                  &                  & $-0.0656$       \\
std err                                                         &                  &                  & 0.057            &                  &                  & 0.059             \\
\hline
$\log (RV_{t-1|t-30})$                                          & $-0.0073$        &                  &                  &                  &                  &                   \\
std err                                                         & 0.031            &                  &                  &                  &                  &                   \\
\hline
adjustedTxVolume(USD)                                           &                  &                  &                  &                  & $0.3691$         & $0.3358$          \\
std err                                                         &                  &                  &                  &                  & 0.449            & 0.354             \\
\hline
txCount                                                         &                  &                  &                  &                  & $-0.4240^{*}$    & $-0.3410$       \\
std err                                                         &                  &                  &                  &                  & 0.233            & 0.243             \\
\hline
marketcap(USD)                                                  &                  &                  &                  &                  & $-0.3052$      & $-0.3034$         \\
std err                                                         &                  &                  &                  &                  & 0.187            & 0.188             \\
\hline
medianTxValue(USD)                                              &                  &                  &                  &                  & $1.1188^{*}$     & $1.1468^{**}$     \\
std err                                                         &                  &                  &                  &                  & 0.563            & 0.563             \\
\hline
averageDifficulty                                               &                  &                  &                  &                  & \$0.1878\$       & $0.1504$          \\
std err                                                         &                  &                  &                  &                  & 0.154            & 0.158             \\
\hline
Adj. R-squared                                                  & 0.729            & 0.728            & 0.728            & 0.728            & 0.729            & 0.729             \\
\hline
\end{tabular}}
\end{sideways}
\begin{tablenotes}
\footnotesize
\item ***, ** and * stands for parameters depending on 10\%, 5\% and 1\% significance level respectively.
\end{tablenotes}
\end{threeparttable}
\caption{Models Result}
\label{tb:models_result}
\end{table}

\begin{comment}
\begin{table}[H]
\centering
\label{tb:prediction_punctuality}
\setlength{\tabcolsep}{12 mm}{
\begin{tabular}{|c|c|c|}
\hline
       & mHAR model & HARQ-X model  \\
\hline
10min  & 51.85\%    & 55.47\%       \\
\hline
30min  & 49.38\%    & 54.70\%       \\
\hline
60min  & 51.46\%    & 54.70\%       \\
\hline
120min & 48.61\%    & 53.00\%       \\
\hline
\end{tabular}}
\caption{Prediction Punctuality}
\end{table}
\end{comment}

Exert data comparison between mHAR model, HARQ-X model. Mean of Realized Volatility is calculated based on a different time basis in Table \ref{tb:predictionDeviation}.

\begin{table}[H]
\centering
\begin{threeparttable}
\refstepcounter{table}
\label{tb:predictionDeviation}
\begin{tabular}{|c|c|c|c|}
\hline
    & mean(logRV)        & mHAR (\% in deviation) & HARQ-X (\% in deviation)  \\
\hline
10m & -7.150118863410460 & 102.547\%              & 101.843\%                 \\
\hline
30m & -7.269433927005020 & 103.073\%              & 101.834\%                 \\
\hline
1h  & -7.368544527763180 & 102.757\%              & 102.021\%                 \\
\hline
2h  & -7.454135866216610 & 103.575\%              & 102.299\%                 \\
\hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item \% in deviation is calculated upon $\frac{\log(predictionValue)}{\log(realValue)}$
\end{tablenotes}
\end{threeparttable}
\caption{Prediction Deviation}
\end{table}

There is 0.9887\% change dropping from 2.988\% deviation on average in natural logarithmic value through different time intervals. Forecast shrink prediction deviation by 33.09\%


\documentclass{article}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{color}
%\include{macros}
%\usepackage{floatflt}
%\usepackage{graphics}
%\usepackage{epsfig}
\usepackage{float}%稳定图片位置
\usepackage{graphicx}%画图
\newcommand{\reals}{{\mathbb{R}}}
\newcommand{\dom}{{\bf{dom}}}
\newcommand{\symm}{{\bf{S}}}
\newcommand{\Tr}{{\bf{tr}}}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem*{defition}{Definition}
\newtheorem*{example}{Example}

\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{note}{Note}
\newtheorem*{exercise}{Exercise}

\setlength{\oddsidemargin}{-0.25 in}
\setlength{\evensidemargin}{-0.25 in} \setlength{\topmargin}{-0.25
in} \setlength{\textwidth}{7 in} \setlength{\textheight}{8.5 in}
\setlength{\headsep}{0.25 in} \setlength{\parindent}{0 in}
\setlength{\parskip}{0.1 in}

\newcommand{\homework}[4]{
\pagestyle{myheadings} \thispagestyle{plain}
\newpage
\setcounter{page}{1} \setcounter{section}{#4} \noindent
\begin{center}
\framebox{ \vbox{\vspace{2mm} \hbox to 6.28in { {\bf
VE485,~Optimization~in~Machine~Learning (Summer 2020) \hfill Homework: #1} }
\vspace{6mm} \hbox to 6.28in { {\Large \hfill #1 \hfill} }
\vspace{6mm} \hbox to 6.28in { {\it Lecturer: #2 \hfill} }
\vspace{2mm} \hbox to 6.28in { {\it Student: #3 \hfill} }
\vspace{2mm} } }
\end{center}
\markboth{#1}{#1} \vspace*{4mm} }

\begin{document}

\homework{3. Convex Optimization}{Xiaolin Huang \hspace{5mm} {\tt
xiaolinhuang@sjtu.edu.cn}}{Chongdan Pan
\hspace{5mm} {\tt panddddda@sjtu.edu.cn } }{9}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section 2.  Problem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section*{Problem 1} \label{ex-midpoint-cvx}
Consider the following \emph{Square LP},
\[
\begin{array}{ll}
\mbox{minimize}   & c^T x \\
\mbox{subject to} & Ax \preceq b,
\end{array}
\]
with $A$ square and nonsingular.
Show that the optimal value is given by
\[
p^\star = \left\{ \begin{array}{ll}
 c^TA^{-1}b & A^{-T}c \preceq 0 \\
 -\infty & \mbox{�������} \end{array} \right.
\]

{\bf{Answer:
\\$p^\star=c^TA^{-1}(Ax)=(A^{-T}c)^T(Ax)$
\\When $A^{-T}c\succ0$, $p^\star=-\infty$ when $Ax=-\infty$
\\When $A^{-T}c\preceq0$, $p^\star=c^TA^{-1}b$ when $Ax=b$
}}

\section*{Problem 2}\label{e-lin-frac-image}%
\emph{Relaxation of Boolean LP.}
In a \emph{Boolean linear program}, the variable $x$ is constrained
to have components equal to zero or one:
\begin{equation} \label{e-bool-lp}
\begin{array}{ll}
\mbox{minimize} & c^T x \\
\mbox{subject to} & Ax \preceq b \\
& x_i \in \{0,1 \}, \quad i=1,\ldots,n.
\end{array}
\end{equation}
In general, such problems are very difficult to solve, even
though the feasible set is finite (containing at most $2^n$ points).

In a general method called \emph{relaxation}, the constraint that
$x_i$ be zero or one is replaced with the
linear inequalities $0\leqslant x_i \leqslant 1$:
\begin{equation} \label{e-bool-lp-relax}
\begin{array}{ll}
\mbox{minimize} & c^T x \\
\mbox{subject to} & Ax \preceq b\\
& 0 \leqslant x_i \leqslant 1, \quad i=1,\ldots,n.
\end{array}
\end{equation}
We refer to this problem as the \emph{LP relaxation} of the
Boolean LP~(\ref{e-bool-lp}).  The LP relaxation is far easier
to solve than the original Boolean LP.

\begin{enumerate}
\item Show that the optimal value of the LP relaxation~(\ref{e-bool-lp-relax}) is a lower bound on the optimal value of the Boolean LP~(\ref{e-bool-lp}).  What can you say about the Boolean LP if the LP relaxation is infeasible?

\item It sometimes happens that the LP relaxation has a solution with $x_i \in \{ 0,1\}$.  What can you say in this case?
\end{enumerate}

{\bf{Answer:
\begin{enumerate}
    \item Assume $c^Tx_1$ is the optimal value of Boolean LP, then $0\leq x_{1i}\leq1$ since $x_{1i}\in\{0,1\}$
    \\Therefore, $x_1$ satisfies LP relaxation's constraints.
    \\Assume $c^Tx_2$ is the optimal value of LP relaxation, then $c^Tx_2\leq c^Tx_1$
    \\Hence $c^Tx_2$ is a lower bound on the optimal value of the Boolean LP
    \\\\If LP relaxation is infeasible, then there is no x satisfying its constraints or dom.
    \\The Boolean LP's feasible solution set is contained in the LP relaxation's, which is empty.
    \\Hence Boolean LP's feasible solution set is also empty, and the problem is infeasible
    \item The LP relaxation's optimal value is also Boolean LP's, and the solution happens to be both problems' optimal solution.
\end{enumerate}
}}

\section*{Problem 3}\label{exe-sep-hyp-strict-counterexample}
Consider the QCQP
\[
\begin{array}{ll}
\mbox{minimize} & (1/2)x^T Px + q^T x + r \\
\mbox{subject to} & x^T x \leqslant 1,
\end{array}
\]
with $P\in\symm^n_{++}$.  Show that $x^\star = -(P+\lambda I)^{-1} q$
where $\lambda = \max\{0, \bar \lambda\}$
and $\bar\lambda$ is the largest solution of the nonlinear equation
\[
q^T (P+\lambda I)^{-2} q  = 1.
\]

{\bf{Answer:
\\$(1/2)x^TPx+q^Tx+r=\frac{1}{2}(x+P^{-1}q)^TP(x+P^{-1}q)+r-\frac{1}{2}q^TP^{-1}q$
\\So we just need to minimize $(x+P^{-1}q)^TP(x+P^{-1}q)=(Px+q)^TP^{-1}(Px+q)$
\\Since $P\in\symm^n_{++},(Px+q)^TP^{-1}(Px+q)\geq0$, and it's minimal when $||Px+q||_2$ is minimal
\\Since $x$ is located in a unit circle, $||Px+q||_2$ is minimal when $Px+q=\lambda x,x=-(P+\lambda I)^{-1}q$
\\\\When $\bar{\lambda}<0,q$ is the interior point of ellipsoid $q^TP^{-2}q\leq1$
\\$x^Tx=q^TP^{-2}q\leq1$, satisfying the constraint
\\$\lambda=0,x=-P^{-1}q,(Px+q)^TP^{-1}(Px+q)=0$
\\The optimal value is $r-\frac{1}{2}q^TP^{-1}q$
\\\\When $\bar{\lambda}\geq0,q$ is a boundary point of a larger ellipsoid $q^T(P+\bar{\lambda}I)^{-2}q\leq1$
\\$\forall \lambda<\bar{\lambda},q^T(P+\lambda I)^{-2}q=x^Tx>1$ because the axis is shorter
\\$\forall \lambda>\bar{\lambda},||\lambda x||_2>||\bar{\lambda} x||_2$, so $||Px+q||_2$ is minimal when $\lambda=\bar{\lambda}$
\\Therefore when $\lambda=\max\{0,\bar{\lambda}\}$, we can get the optimal value.
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reference
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}