| 1 |
% !TeX TXS-program:compile = txs:///arara |
| 2 |
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} |
| 3 |
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') |
| 4 |
|
| 5 |
\documentclass[11pt,a4paper]{ltxdoc} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage[utf8]{inputenc} |
| 8 |
\usepackage{amssymb} |
| 9 |
\usepackage{xint-regression} |
| 10 |
\usepackage{fancyvrb} |
| 11 |
\usepackage{fancyhdr} |
| 12 |
\usepackage{hyperref} |
| 13 |
\usepackage{tkz-grapheur} |
| 14 |
\usepackage{tcolorbox} |
| 15 |
\usepackage{minted2} |
| 16 |
\tcbuselibrary{skins,minted} |
| 17 |
\fancyhf{} |
| 18 |
\renewcommand{\headrulewidth}{0pt} |
| 19 |
\lfoot{\sffamily\small [xint-regression]} |
| 20 |
\rfoot{\sffamily\small - \thepage{} -} |
| 21 |
\usepackage{hologo} |
| 22 |
\providecommand\tikzlogo{Ti\textit{k}Z} |
| 23 |
\providecommand\TeXLive{\TeX{}Live\xspace} |
| 24 |
\providecommand\PSTricks{\textsf{PSTricks}\xspace} |
| 25 |
\let\pstricks\PSTricks |
| 26 |
\let\TikZ\tikzlogo |
| 27 |
|
| 28 |
\urlstyle{same} |
| 29 |
\hypersetup{pdfborder=0 0 0} |
| 30 |
\usepackage[margin=2cm]{geometry} |
| 31 |
\setlength{\parindent}{0pt} |
| 32 |
\def\TPversion{0.1.3} |
| 33 |
\def\TPdate{17/02/2026} |
| 34 |
\usepackage{soul} |
| 35 |
\usepackage{tabularray} |
| 36 |
\sethlcolor{lightgray!25} |
| 37 |
\NewDocumentCommand\MontreCode{ m }{% |
| 38 |
\hl{\vphantom{\texttt{pf}}\texttt{#1}}% |
| 39 |
} |
| 40 |
\usepackage{babel} |
| 41 |
|
| 42 |
\renewcommand{\footnoterule}{\vfill\kern -3pt \hrule width 0.4\columnwidth \kern 2.6pt} |
| 43 |
|
| 44 |
\begin{document} |
| 45 |
|
| 46 |
\pagestyle{fancy} |
| 47 |
|
| 48 |
\thispagestyle{empty} |
| 49 |
|
| 50 |
\begin{center} |
| 51 |
\begin{minipage}{0.88\linewidth} |
| 52 |
\begin{tcolorbox}[colframe=yellow,colback=yellow!15] |
| 53 |
\begin{center} |
| 54 |
\begin{tabular}{c} |
| 55 |
{\Huge \texttt{xint-regression}}\\ |
| 56 |
\\ |
| 57 |
{\LARGE Classic regressions, with \textsf{xint}.}\\ |
| 58 |
\\ |
| 59 |
{\small \texttt{Version \TPversion{} -- \TPdate}} |
| 60 |
\end{tabular} |
| 61 |
\end{center} |
| 62 |
\end{tcolorbox} |
| 63 |
\end{minipage} |
| 64 |
\end{center} |
| 65 |
|
| 66 |
\begin{center} |
| 67 |
\begin{tabular}{c} |
| 68 |
\texttt{Cédric Pierquet}\\ |
| 69 |
{\ttfamily c pierquet -- at -- outlook . fr}\\ |
| 70 |
\texttt{\url{https://github.com/cpierquet/latex-packages/tree/main/xint-regression}} \\ |
| 71 |
\end{tabular} |
| 72 |
\end{center} |
| 73 |
|
| 74 |
\hrule |
| 75 |
|
| 76 |
\vfill |
| 77 |
|
| 78 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 79 |
\def\LISTEX{1,2,3,4,5,6} |
| 80 |
\def\LISTEY{8.74,8.80,9.52,10.42,11.83,14.62} |
| 81 |
|
| 82 |
\xintEXPreg[Alt]{\LISTEX}{\LISTEY} %raw results |
| 83 |
$a \approx \exprega$ and $b \approx \expregb$ |
| 84 |
|
| 85 |
\xintEXPreg[Alt,round=2]{\LISTEX}{\LISTEY} %rounded results |
| 86 |
$a \approx \exprega$ and $b \approx \expregb$\\ |
| 87 |
|
| 88 |
So $y \approx \mathrm{e}^{\exprega x+\expregb}$. |
| 89 |
\end{tcblisting} |
| 90 |
|
| 91 |
\vspace*{5mm} |
| 92 |
|
| 93 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 94 |
\def\LISTEXX{0,50,100,140} |
| 95 |
\def\LISTEYY{275,290,315,350} |
| 96 |
|
| 97 |
\xintEXPOFFreg[offset=250]{\LISTEXX}{\LISTEYY} %raw results |
| 98 |
$a \approx \expregoffa$ and $b \approx \expregoffb$ |
| 99 |
|
| 100 |
\xintEXPOFFreg[offset=250,round=2/1]{\LISTEXX}{\LISTEYY} %rounded results |
| 101 |
$a \approx \expregoffa$ and $b \approx \expregoffb$\\ |
| 102 |
|
| 103 |
So $y \approx 250+\expregoffb e^{\expregoffa x}$ |
| 104 |
\end{tcblisting} |
| 105 |
|
| 106 |
\vfill |
| 107 |
|
| 108 |
\vspace*{5mm} |
| 109 |
|
| 110 |
\pagebreak |
| 111 |
|
| 112 |
\phantomsection |
| 113 |
|
| 114 |
\hypertarget{matoc}{} |
| 115 |
|
| 116 |
\tableofcontents |
| 117 |
|
| 118 |
\vspace*{5mm} |
| 119 |
|
| 120 |
\hrule |
| 121 |
|
| 122 |
\vspace*{5mm} |
| 123 |
|
| 124 |
\pagebreak |
| 125 |
|
| 126 |
\section{Introduction} |
| 127 |
|
| 128 |
\subsection{Global usage} |
| 129 |
|
| 130 |
This package offers \textsf{xint}-based commands for working with classical regressions: |
| 131 |
|
| 132 |
\begin{itemize} |
| 133 |
\item linear regression $ax+b$; |
| 134 |
\item quadratic regression $ax^2+bx+c$; |
| 135 |
\item cubic regression $ax^3+bx^2+cx+d$; |
| 136 |
\item power regression $ax^b$; |
| 137 |
\item exponential regression $ab^x$ or $e^{ax+b}$ or $be^{ax}$ or $C + be^{ax}$ (with \textit{fixed} $C$); |
| 138 |
\item logarithmic regression $a+b\ln(x)$; |
| 139 |
\item hyperbolic regression $a+\displaystyle\frac{b}{x}$; |
| 140 |
\item logistic regression $\displaystyle\frac{L}{1 + ae^{-bx}}$ (with \textit{fixed} $L$). |
| 141 |
\end{itemize} |
| 142 |
|
| 143 |
For each type of regression, results (including the coefficient of correlation/determination $r$ or $r^2$) can be stored in macros, either raw or with rounding (with individuals \MontreCode{[optional keys]}). |
| 144 |
|
| 145 |
\smallskip |
| 146 |
|
| 147 |
For example, if \MontreCode{[coeffa=xxA]}, the macro that will contain the value of coefficient \texttt{a} will be \MontreCode{\textbackslash xxA}. |
| 148 |
|
| 149 |
\medskip |
| 150 |
|
| 151 |
$\blacktriangleright$ If the lists differ in size, operations are applied only to the elements within the range of the shorter list. |
| 152 |
|
| 153 |
\subsection{Packages used} |
| 154 |
|
| 155 |
This package uses \MontreCode{simplekv}, \MontreCode{xintexpr}, \MontreCode{listofitems} and \MontreCode{xstring}. |
| 156 |
|
| 157 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 158 |
%loading |
| 159 |
\usepackage{xint-regression} |
| 160 |
\end{tcblisting} |
| 161 |
|
| 162 |
\subsection{Warnings} |
| 163 |
|
| 164 |
The precision of the (determination) results seems to be good, which should normally guarantee satisfactory calculations and plots. |
| 165 |
|
| 166 |
Nevertheless, it is advisable to be cautious about the results obtained and those expected. |
| 167 |
|
| 168 |
\pagebreak |
| 169 |
|
| 170 |
\section{The commands} |
| 171 |
|
| 172 |
\subsection{Linear regression (xintLINreg or xintlinreg)} |
| 173 |
|
| 174 |
The equation is \fbox{$ax+b$}. |
| 175 |
|
| 176 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 177 |
\xintLINreg[coeffa=...,coeffa=...,coeffr=...,coeffrr=...,round=...]{xlist}{ylist} |
| 178 |
\end{tcblisting} |
| 179 |
|
| 180 |
By default, \MontreCode{coeffa=linrega}; \MontreCode{coeffb=linregb} and \MontreCode{round} is empty. |
| 181 |
|
| 182 |
By default, \MontreCode{coeffr=linregr}; \MontreCode{coeffrr=linregrr} and \MontreCode{round} is empty. |
| 183 |
|
| 184 |
\MontreCode{round=...} can be given within \MontreCode{round=global} or \MontreCode{round=a/b}. |
| 185 |
|
| 186 |
\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% |
| 187 |
\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% |
| 188 |
|
| 189 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 190 |
\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% |
| 191 |
\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% |
| 192 |
\end{tcblisting} |
| 193 |
|
| 194 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 195 |
%default output |
| 196 |
\xintLINreg{\LLX}{\LLY}% |
| 197 |
$a \approx \linrega$ and $b \approx \linregb$ \\ |
| 198 |
$r \approx \linregr$ and $r^2 \approx \linregrr$ |
| 199 |
\end{tcblisting} |
| 200 |
|
| 201 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 202 |
%personal macros + global rounding |
| 203 |
\xintLINreg[coeffa=LINa,coeffb=LINb,round=2]{\LLX}{\LLY}% |
| 204 |
$a \approx \LINa$ and $b \approx \LINb$ |
| 205 |
\end{tcblisting} |
| 206 |
|
| 207 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 208 |
%personal macros + individual rounding |
| 209 |
\xintLINreg[coeffa=LINEARa,coeffb=LINEARb,round=2/0]{\LLX}{\LLY}% |
| 210 |
$a \approx \LINEARa$ and $b \approx \LINEARb$ |
| 211 |
\end{tcblisting} |
| 212 |
|
| 213 |
\subsection{Quadratic regression (xintQUADreg or xintquadreg)} |
| 214 |
|
| 215 |
The equation is \fbox{$ax^2+bx+c$}. |
| 216 |
|
| 217 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 218 |
\xintQUADreg[coeffa=...,coeffb=...,coeffc=...,coeffrr=...,round=...]{xlist}{ylist} |
| 219 |
\end{tcblisting} |
| 220 |
|
| 221 |
By default, \MontreCode{coeffa=quadrega}; \MontreCode{coeffb=quadregb}, \MontreCode{coeffc=quadrega} and \MontreCode{round} is empty. |
| 222 |
|
| 223 |
By default, \MontreCode{coeffrr=quadregrr} is not rounded. |
| 224 |
|
| 225 |
\MontreCode{round=...} can be given within \MontreCode{round=global} or \MontreCode{round=a/b/...}. |
| 226 |
|
| 227 |
\def\LLX{1,2,3,4,5,6,7,8,9,10}% |
| 228 |
\def\LLY{3.1,9.8,20.5,35.2,54.1,77.3,103.8,135.0,169.5,208.2}% |
| 229 |
|
| 230 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 231 |
\def\LLX{1,2,3,4,5,6,7,8,9,10}% |
| 232 |
\def\LLY{3.1,9.8,20.5,35.2,54.1,77.3,103.8,135.0,169.5,208.2}% |
| 233 |
\end{tcblisting} |
| 234 |
|
| 235 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 236 |
%default output |
| 237 |
\xintQUADreg{\LLX}{\LLY}% |
| 238 |
$a \approx \quadrega$; $b \approx \quadregb$ and $c \approx \quadregc$ |
| 239 |
|
| 240 |
$r^2 \approx \quadregrr$ |
| 241 |
\end{tcblisting} |
| 242 |
|
| 243 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 244 |
%personal macros + global rounding |
| 245 |
\xintQUADreg[coeffa=QUADa,coeffb=QUADb,coeffc=QUADc,round=2]{\LLX}{\LLY}% |
| 246 |
$a \approx \QUADa$; $b \approx \QUADb$ and $c \approx \QUADc$ |
| 247 |
\end{tcblisting} |
| 248 |
|
| 249 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 250 |
%personal macros + individual rounding |
| 251 |
\xintQUADreg[coeffa=QUADRAa,coeffb=QUADRAb,coeffc=QUADRAc,round=4/3/2]{\LLX}{\LLY}% |
| 252 |
$a \approx \QUADRAa$; $b \approx \QUADRAb$ and $c \approx \QUADRAc$ |
| 253 |
\end{tcblisting} |
| 254 |
|
| 255 |
\subsection{Cubic regression (xintCUBreg or xintcubreg)}%, hyperbolic and logarithmic regression} |
| 256 |
|
| 257 |
The equation for cubic is \fbox{$ax^3+bx^2+cx+d$}. |
| 258 |
|
| 259 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 260 |
\xintCUBreg[coeffa=...,coeffb=...,coeffc=...,coeffd=...,coeffrr=...,round=...]% |
| 261 |
{xlist} |
| 262 |
{ylist} |
| 263 |
\end{tcblisting} |
| 264 |
|
| 265 |
By default, \MontreCode{coeffa=cubrega}; \MontreCode{coeffb=cubregb}; \MontreCode{coeffc=cubregc} and \MontreCode{coeffd=cubregd}. |
| 266 |
|
| 267 |
By default, \MontreCode{coeffrr=cubregrr} is not rounded. |
| 268 |
|
| 269 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 270 |
\def\LLY{2.1,7.9,22.3,49.8,95.2,163.4,259.1,387.5}% |
| 271 |
|
| 272 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 273 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 274 |
\def\LLY{2.1,7.9,22.3,49.8,95.2,163.4,259.1,387.5}% |
| 275 |
\end{tcblisting} |
| 276 |
|
| 277 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 278 |
%individual roudings |
| 279 |
\xintCUBreg[round=5/3/2/1]{\LLX}{\LLY}% |
| 280 |
$a \approx \cubrega$; $b \approx \cubregb$; $c \approx \cubregc$ and $d \approx \cubregd$ |
| 281 |
|
| 282 |
$r^2 \approx \cubregrr$ |
| 283 |
\end{tcblisting} |
| 284 |
|
| 285 |
\subsection{Hyperbolic regression (xintHYPreg or xinthypreg)} |
| 286 |
|
| 287 |
The equation for hyperbolic is \fbox{$a+\displaystyle\frac{b}{x}$}. |
| 288 |
|
| 289 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 290 |
\xintHYPreg[coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 291 |
\end{tcblisting} |
| 292 |
|
| 293 |
By default, \MontreCode{coeffa=hyprega} and \MontreCode{coeffb=hypregb}. |
| 294 |
|
| 295 |
By default, \MontreCode{coeffrr=hypregrr} is not rounded. |
| 296 |
|
| 297 |
\def\LLX{1,2,4,5,8,10,20}% |
| 298 |
\def\LLY{12.1,7.4,4.3,3.8,2.7,2.3,1.7}% |
| 299 |
|
| 300 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 301 |
\def\LLX{1,2,4,5,8,10,20}% |
| 302 |
\def\LLY{12.1,7.4,4.3,3.8,2.7,2.3,1.7}% |
| 303 |
\end{tcblisting} |
| 304 |
|
| 305 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 306 |
%global roudings |
| 307 |
\xintHYPreg[round=2]{\LLX}{\LLY}% |
| 308 |
$a \approx \hyprega$ and $b \approx \hypregb$ |
| 309 |
|
| 310 |
$r^2 \approx \hypregrr$ |
| 311 |
\end{tcblisting} |
| 312 |
|
| 313 |
\subsection{Logarithmic regression (xintLOGreg or xintlogreg)} |
| 314 |
|
| 315 |
The equation for logarithmic is \fbox{$a+b\,\log(x)$}. |
| 316 |
|
| 317 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 318 |
\xintLOGreg[coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 319 |
\end{tcblisting} |
| 320 |
|
| 321 |
By default, \MontreCode{coeffa=logrega} and \MontreCode{coeffb=logregb}. |
| 322 |
|
| 323 |
By default, \MontreCode{coeffrr=logregrr} is not rounded. |
| 324 |
|
| 325 |
\def\LLX{1,2,5,10,20,50,100}% |
| 326 |
\def\LLY{2.1,3.5,5.7,7.2,8.8,10.9,12.3}% |
| 327 |
|
| 328 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 329 |
\def\LLX{1,2,5,10,20,50,100}% |
| 330 |
\def\LLY{2.1,3.5,5.7,7.2,8.8,10.9,12.3}% |
| 331 |
\end{tcblisting} |
| 332 |
|
| 333 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 334 |
%individual roudings |
| 335 |
\xintLOGreg[round=1/4]{\LLX}{\LLY}% |
| 336 |
$a \approx \logrega$ and $b \approx \logregb$ |
| 337 |
|
| 338 |
$r^2 \approx \logregrr$ |
| 339 |
\end{tcblisting} |
| 340 |
|
| 341 |
\subsection{Power regression (xintPOWreg or xintpowreg)} |
| 342 |
|
| 343 |
The equation for power is \fbox{$a \times x^{b}$}. |
| 344 |
|
| 345 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 346 |
\xintPOWreg[coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 347 |
\end{tcblisting} |
| 348 |
|
| 349 |
By default, \MontreCode{coeffa=powrega} and \MontreCode{coeffb=powregb}. |
| 350 |
|
| 351 |
By default, \MontreCode{coeffrr=powregrr} is not rounded. |
| 352 |
|
| 353 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 354 |
\def\LLY{2.1,5.9,10.8,17.2,25.1,34.1,44.8,57.2}% |
| 355 |
|
| 356 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 357 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 358 |
\def\LLY{2.1,5.9,10.8,17.2,25.1,34.1,44.8,57.2}% |
| 359 |
\end{tcblisting} |
| 360 |
|
| 361 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 362 |
%default output |
| 363 |
\xintPOWreg{\LLX}{\LLY}% |
| 364 |
$a \approx \powrega$ and $b \approx \powregb$ |
| 365 |
|
| 366 |
$r^2 \approx \powregrr$ |
| 367 |
\end{tcblisting} |
| 368 |
|
| 369 |
\subsection{Exponential regression} |
| 370 |
|
| 371 |
Available regressions are: |
| 372 |
|
| 373 |
\begin{itemize} |
| 374 |
\item \fbox{$a \times b^{x}$} (\texttt{xintEXPABreg} or \texttt{xintexpabreg}); |
| 375 |
\item \fbox{$e^{ax+b}$} (\texttt{xintEXPreg} or \texttt{xintexpreg}); |
| 376 |
\item \fbox{$b\,e^{ax}$} (\texttt{xintEXPreg} or \texttt{xintexpreg} with \MontreCode{[Alt]} key); |
| 377 |
\item \fbox{$C+b\,e^{ax}$} with \textit{fixed} $C$ (\texttt{xintEXPOFFreg} or \texttt{xintexpoffreg}). |
| 378 |
\end{itemize} |
| 379 |
|
| 380 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 381 |
%a*b^x |
| 382 |
\xintEXPABreg[coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 383 |
\end{tcblisting} |
| 384 |
|
| 385 |
By default, \MontreCode{coeffa=expabrega} and \MontreCode{coeffb=expabregb}. |
| 386 |
|
| 387 |
By default, \MontreCode{coeffrr=expabregrr} is not rounded. |
| 388 |
|
| 389 |
\smallskip |
| 390 |
|
| 391 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 392 |
%e^(ax+b) |
| 393 |
\xintEXPreg[coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 394 |
\end{tcblisting} |
| 395 |
|
| 396 |
By default, \MontreCode{coeffa=exprega} and \MontreCode{coeffb=expregb}. |
| 397 |
|
| 398 |
By default, \MontreCode{coeffrr=expregrr} is not rounded. |
| 399 |
|
| 400 |
\smallskip |
| 401 |
|
| 402 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 403 |
%b*e^(ax) |
| 404 |
\xintEXPreg[Alt,coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 405 |
\end{tcblisting} |
| 406 |
|
| 407 |
By default, \MontreCode{coeffa=exprega} and \MontreCode{coeffb=expregb}. |
| 408 |
|
| 409 |
By default, \MontreCode{coeffrr=expregrr} is not rounded. |
| 410 |
|
| 411 |
\smallskip |
| 412 |
|
| 413 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 414 |
%C+b*e^(ax) |
| 415 |
\xintEXPOFFreg[offset=C,coeffa=...,coeffb=...,coeffrr=...,round=...]{xlist}{ylist} |
| 416 |
\end{tcblisting} |
| 417 |
|
| 418 |
By default, \MontreCode{coeffa=expregoffa} and \MontreCode{coeffb=expregoffb}. |
| 419 |
|
| 420 |
By default, \MontreCode{coeffrr=expregoffrr} is not rounded. |
| 421 |
|
| 422 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 423 |
\def\LLY{2.1,5.9,10.8,17.2,25.1,34.1,44.8,57.2}% |
| 424 |
|
| 425 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 426 |
\def\LLX{1,2,3,4,5,6,7,8}% |
| 427 |
\def\LLY{2.1,5.9,10.8,17.2,25.1,34.1,44.8,57.2}% |
| 428 |
\end{tcblisting} |
| 429 |
|
| 430 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 431 |
%a*b^x |
| 432 |
\xintEXPABreg{\LLX}{\LLY} |
| 433 |
$a \approx \expabrega$ and $b \approx \expabregb$ and $r^2 \approx \expabregrr$ |
| 434 |
|
| 435 |
%e^(ax+b) |
| 436 |
\xintEXPreg{\LLX}{\LLY} |
| 437 |
$a \approx \exprega$ and $b \approx \expregb$ and $r^2 \approx \expregrr$ |
| 438 |
|
| 439 |
%b*e^(ax) |
| 440 |
\xintEXPreg[Alt]{\LLX}{\LLY} |
| 441 |
$a \approx \exprega$ and $b \approx \expregb$ and $r^2 \approx \expregrr$ |
| 442 |
\end{tcblisting} |
| 443 |
|
| 444 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 445 |
%C+b*e^(ax) |
| 446 |
\def\LLX{0,50,100,140}% |
| 447 |
\def\LLY{275,290,315,350}% |
| 448 |
\xintEXPOFFreg[offset=250]{\LLX}{\LLY} |
| 449 |
$a \approx \expregoffa$ and $b \approx \expregoffb$ and $r^2 \approx \expregoffrr$ |
| 450 |
\end{tcblisting} |
| 451 |
|
| 452 |
\subsection{Logistic regression (xintLOGISTreg or xintlogistreg)} |
| 453 |
|
| 454 |
The equation for logistic is \fbox{$\displaystyle\frac{L}{1+a \times e^{-bx}}$} with \textit{fixed} $L$, given by \textit{asmyptote}. |
| 455 |
|
| 456 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 457 |
\xintLOGISTreg[asymptote=...,coeffa=...,coeffb=...,coeffL=...,coeffrr=...,round=...]% |
| 458 |
{xlist} |
| 459 |
{ylist} |
| 460 |
\end{tcblisting} |
| 461 |
|
| 462 |
By default, \MontreCode{coeffa=logista}, \MontreCode{coeffb=logistb}, and \MontreCode{coeffL=logistL}. |
| 463 |
|
| 464 |
By default, \MontreCode{asymptote=10} (user \textbf{must} provide the asymptote value). |
| 465 |
|
| 466 |
By default, \MontreCode{coeffrr=logistrr} is not rounded. |
| 467 |
|
| 468 |
\def\LLX{0,1,2,3,4,5,6}% |
| 469 |
\def\LLY{1,2,4.5,7,8.5,9.2,9.6}% |
| 470 |
|
| 471 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2,listing only} |
| 472 |
\def\LLX{0,1,2,3,4,5,6}% |
| 473 |
\def\LLY{1,2,4.5,7,8.5,9.2,9.6}% |
| 474 |
\end{tcblisting} |
| 475 |
|
| 476 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 477 |
%default output with asymptote L=10 |
| 478 |
\def\LLX{0,1,2,3,4,5,6}% |
| 479 |
\def\LLY{1,2,4.5,7,8.5,9.2,9.6}% |
| 480 |
|
| 481 |
\xintLOGISTreg[asymptote=10]{\LLX}{\LLY}% |
| 482 |
$L = \logistL$, $a \approx \logista$ and $b \approx \logistb$ |
| 483 |
|
| 484 |
$r^2 \approx \logistrr$ |
| 485 |
\end{tcblisting} |
| 486 |
|
| 487 |
\pagebreak |
| 488 |
|
| 489 |
\section{Integration with other packages} |
| 490 |
|
| 491 |
\subsection{Number formatting} |
| 492 |
|
| 493 |
It is possible to format the results, according to locale rules, for example with \textsf{sinuitx}. |
| 494 |
|
| 495 |
\smallskip |
| 496 |
|
| 497 |
With \MontreCode{[locale=FR]}: |
| 498 |
|
| 499 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 500 |
%a*b^x |
| 501 |
\xintEXPABreg[round=1/3]{\LLX}{\LLY}% |
| 502 |
So we obtain $y \approx \num{\expabrega} \times e^{\num{\expabregb}\times x}$ |
| 503 |
\end{tcblisting} |
| 504 |
|
| 505 |
\subsection{Plotting} |
| 506 |
|
| 507 |
It is also possible to integrate the package's commands into a plotting environment, such as \textsf{tikz} or \textsf{pgfplots}. |
| 508 |
|
| 509 |
\smallskip |
| 510 |
|
| 511 |
For example, with \textsf{tkz-grapheur} package: |
| 512 |
|
| 513 |
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=teal,colback=lightgray!2} |
| 514 |
\def\LISTEXX{0,50,100,140}% |
| 515 |
\def\LISTEYY{275,290,315,350}% |
| 516 |
|
| 517 |
\begin{GraphiqueTikz} |
| 518 |
[x=0.05cm,y=0.04cm,Xmin=0,Xmax=160,Xgrille=20,Xgrilles=10, |
| 519 |
Origy=250,Ymin=250,Ymax=400,Ygrille=25,Ygrilles=5] |
| 520 |
%window |
| 521 |
\TracerAxesGrilles[Elargir=2.5mm,Police=\footnotesize]{auto}{auto} |
| 522 |
%points |
| 523 |
\TracerNuage[Style=o,CouleurNuage=red]{\LISTEXX}{\LISTEYY} |
| 524 |
%regression expoffset C+b*epx(ax) |
| 525 |
\xintEXPOFFreg[offset=250]{\LISTEXX}{\LISTEYY} |
| 526 |
\DefinirCourbe[Nom=ajust,Couleur=blue,Trace] |
| 527 |
<ajust> |
| 528 |
{250+\expregoffb*exp(\expregoffa*x)} |
| 529 |
%constructions |
| 530 |
\PlacerImages[Couleurs=cyan/magenta,Traits]{ajust}{80} |
| 531 |
\PlacerAntecedents[Style=x,Couleurs=blue/green!50!black,Traits]{ajust}{325} |
| 532 |
\end{GraphiqueTikz} |
| 533 |
\end{tcblisting} |
| 534 |
|
| 535 |
\pagebreak |
| 536 |
|
| 537 |
\section{History} |
| 538 |
|
| 539 |
\begin{quote} |
| 540 |
\begin{verbatim} |
| 541 |
0.1.3: logistic regression + r² for other regressions |
| 542 |
0.1.2: r and r² for linreg + new names (tks to quark67 for suggestion) |
| 543 |
0.1.1: Bugfix |
| 544 |
0.1.0: Initial version |
| 545 |
\end{verbatim} |
| 546 |
\end{quote} |
| 547 |
|
| 548 |
\end{document} |