You need to:
- move the
tikzmark
s to the other side of the equations ;
- invert the curve:
.. controls +(-1,0) and +(-1,0) ..
;
- readjust the starting positions:
\newcommand\sidecomment[5][-0.5,0.1]%
;
- move and align the text attached to the curve to the opposing side:
node[left,align=right]{#5}
.
Here's the result:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,calc}
\usepackage{amsmath}
\newcommand\sidecomment[5][-0.5,0.1]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth',thick]
($({pic cs:#4}|-{pic cs:#2})+(#1)$)
.. controls +(-1,0) and +(-1,0) ..
node[left,align=right]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1)$);
\end{tikzpicture}%
}
\begin{document}
\begin{align*}
\tikzmark{a}\beta_1^*
&= \frac{\sum_{i=1}^n(x_i^*-\hat x^*)y_i^*}{\sum_{i=1}^n(x_i^*-\hat x^*)^2}\\
\tikzmark{b}&= \frac{\sum_{i=1}^n(w_2x_i-w_2\hat x)w_1y_i}{\sum_{i=1}^n(w_2x_i-w_2\hat x)^2}
\end{align*}
\sidecomment{a}{b}{b}{since $y_i^*=w_1y_i$\\and $x_i*=w_2x_i$}
\end{document}
