texlive[72958] Master/texmf-dist: linearregression (24nov24)

commits+karl at tug.org commits+karl at tug.org
Sun Nov 24 21:53:25 CET 2024


Revision: 72958
          https://tug.org/svn/texlive?view=revision&revision=72958
Author:   karl
Date:     2024-11-24 21:53:25 +0100 (Sun, 24 Nov 2024)
Log Message:
-----------
linearregression (24nov24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/linearregression/README.txt
    trunk/Master/texmf-dist/doc/latex/linearregression/linearregression.pdf
    trunk/Master/texmf-dist/source/latex/linearregression/linearregression.dtx
    trunk/Master/texmf-dist/tex/latex/linearregression/linearregression.sty

Modified: trunk/Master/texmf-dist/doc/latex/linearregression/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/linearregression/README.txt	2024-11-24 20:53:16 UTC (rev 72957)
+++ trunk/Master/texmf-dist/doc/latex/linearregression/README.txt	2024-11-24 20:53:25 UTC (rev 72958)
@@ -1,4 +1,4 @@
-2024-06-10
+2024-11-23
 ---------------------------------------------------------------------
 This file is ** README.txt **  for the ** linearregression ** package
 ---------------------------------------------------------------------
@@ -19,20 +19,22 @@
 the commands and functions.
 
 The distribution includes: 
-    README.txt 		     (this file)
-    linearregression.dtx     (a self extracting and self documenting file)
-    linearregressionpkg.ins  (used to only extract the package)
-    linearregression.pdf     (documentation)
+  +  README.txt 	      (this file)
+  +  linearregression.dtx     (a self extracting and self documenting file)
+  +  linearregressionpkg.ins  (used to only extract the package)
+  +  linearregression.pdf     (documentation)
 
 Running pdflatex  linearregression.dtx  generates:
-    linearregression.pfd     (full documentation, three pass needed)
-    mainlinearregression.tex (interactive main-program document)
-    linearregression.sty     (package)
-    sampledata.txt           (as the name says)
+  *  linearregression.pfd     (full documentation, three pass needed)
+  *  mainlinearregression.tex (interactive main-program document)
+  *  linearregression.sty     (package)
+  *  sampledata.txt           (as the name says)
     
-Running pdflatex linearregressionpkg.ins generates: linearregression.sty     
-(and linearregressionpkg.log)
+Running pdflatex linearregressionpkg.ins generates: 
+  * linearregression.sty     
+only.
 
+
 This program may be used, distributed and modified under 
 the conditions of the LaTeX Project Public License.
 (see:http://www.latex-project.org/lppl.txt)

Modified: trunk/Master/texmf-dist/doc/latex/linearregression/linearregression.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/linearregression/linearregression.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/linearregression/linearregression.dtx	2024-11-24 20:53:16 UTC (rev 72957)
+++ trunk/Master/texmf-dist/source/latex/linearregression/linearregression.dtx	2024-11-24 20:53:25 UTC (rev 72958)
@@ -2,7 +2,6 @@
 % file:    linearregression.dtx
 % author:  Battista Benciolini
 % contact: benciolinibattista at gmail dot com
-% date:    see preamble 
 % 
 % process this file with pdflatex to obtain:
 %
@@ -22,7 +21,7 @@
 \keepsilent
 \preamble
 ------------------------------------------------------------------------
-[2024-06-10]
+[2024-11-23]
 This file is part of the (expanded) distribution of linearregression
 The author of  linearregression  is  Battista Benciolini 
 <benciolinibattista at gmail dot com >
@@ -119,7 +118,7 @@
 % parameter $a$ e $b$ of the regression line $y = ax+b$, 
 % and finally to draw also this line on the same graph.
 % \end{quotation}
-% A summary description of the the problem is therefore the following.
+% A summary description of the problem is therefore the following.
 % A set of data pairs  is available and each pair is represented as a point 
 % in the plain. A straight line is searched that optimally approximates 
 % the points. The first step is therefore the choice of an optimality criterion. 
@@ -147,7 +146,7 @@
 % the same uncertainty. The two considered situations will prove 
 % to be quite different.
 %
-% \section{Geometric definition of there optimality criteria}
+% \section{Geometric definition of three optimality criteria}
 % \begin{figure}
 % \setlength\unitlength{4cm}
 % \begin{picture}(1, 0.7)(0.,0.)
@@ -282,6 +281,9 @@
 %\iffalse
 %</main>
 %\fi
+% The plot just includes the points and the line obtained with the classical 
+% linear regression. Line 8 must be modified if a different result is desired.
+% See the next section for details.
 %
 % \section{A user manual for the package\label{manual}}
 % The various analysis of a data set and the representation of the data 
@@ -310,6 +312,8 @@
 % The macro \DescribeMacro{\lrprint} 
 % \cs{lrprint} generates a table with all the estimated 
 % parameters and some information about the data. 
+% (The computed numbers are printed with four decimal digit. 
+% The choice is quite arbitrary.)
 % \par 
 % The macro \DescribeMacro{\lrplot} 
 % \cs{lrplot}\marg{imagewidth}\marg{key1}\marg{key2}\marg{key3}\marg{key4} 
@@ -320,10 +324,10 @@
 % with classical regression with inverted role of the coordinates and 
 % with symmetric regression. 
 % The four items, i.e.\ the set of points and the three lines, are drawn 
-% or not according to the corresponding character found in |key|$i$. 
-% Each item is not plotted if the character is a |-|, it is plotted in any other
-% case. Furthermore the lines are accompanied by a label made by the
-% corresponding |key|, unless it is just a |+|.  
+% or not according to the corresponding string found in |key|$i$. 
+% Each item is not plotted if the string is the character |-|, it is plotted 
+% in any other case. Furthermore the lines are accompanied by a label made 
+% by the corresponding |key|, unless it is just a |+| or a |-|.  
 % \par
 % Few words are necessary about the format of the data file.
 % Each record of the file hold the two values related to a point.
@@ -428,7 +432,7 @@
 % that is introduced as usual. Most of the macros require 
 % the \LaTeX3 syntax.
 %    \begin{macrocode}
-\ProvidesPackage{linearregression}[2024-06-10]
+\ProvidesPackage{linearregression}[2024-11-23]
 \RequirePackage{pict2e}        	
 \ExplSyntaxOn
 %    \end{macrocode}
@@ -573,7 +577,7 @@
 % A second scan of the data is performed to compute the
 % sums that appears in \reff{matrixC} and to determine the 
 % the extremal values of the coordinates. Record scan can be regulated 
-% by a record counter, because the the number of points is now known.
+% by a record counter, because the number of points is now known.
 %    \begin{macrocode}
 \fp_zero:N  \g_BBLR_abscissa_SecOrdMoment_fp                      
 \fp_zero:N  \g_BBLR_ordinate_SecOrdMoment_fp                      
@@ -636,6 +640,9 @@
 % \label{e}\end{equation}
 % i.e.\ the difference between the empirical value $y_{2\ipoint}$ 
 % and its model counterpart $ay_{1\ipoint}+b$.
+% This is the already mentioned  classical linear regression. In fact the 
+% absolute value of $e_\ipoint$ expressed in (\ref{e}) is the lenght 
+% of the segments shown in the leftmost scheeme of figure (\ref{fig:criteria}).
 % The global discrepancy between the data and the model is measured by the 
 % least square objective function defined by:
 % \begin{equation} \psi=\pointsum e_\ipoint^2 \label{psiab} \end{equation}
@@ -723,7 +730,7 @@
 % supplemented by $\dor\ge 0$, 
 % is quite convenient because the parameters will assume 
 % a significant geometrical meaning:
-% $\coeff$ is the unit vector orthogonal to the line and $\dor$ 
+% $\coeff$ is a unit vector orthogonal to the line and $\dor$ 
 % is the distance of the line from the origin. 
 % The expression 
 % \begin{equation}  d=\dor-\coeff\trasp\point \label{distance} \end{equation}
@@ -751,6 +758,8 @@
 % vanishes if the choice of $\dor$ is: 
 % \begin{equation} \dor=\coeff\trasp\barycenter{\point}.
 % \label{estd} \end{equation}
+% Both (\ref{estb}) and (\ref{estd}) means that the optimal line includes 
+% the mean point.
 % Then it is necessary to minimize the function
 % \begin{equation}   \phi_{(\coeff)} =  \coeff\trasp\mC\coeff
 % \label{quadraticfun} \end{equation}
@@ -783,8 +792,8 @@
 % can be described geometrically in the following way:
 % (i) the optimal line includes the barycenter of the data;  
 % (ii) the optimal line is orthogonal to the eigenvector of 
-% $\mC$ corresponding to the minimum eigenvalue.\par
-% The obtained result is also valid in $\Renne$.
+% $\mC$ corresponding to the minimum eigenvalue .\par
+% The obtained result can be generalized in $\Renne$.
 % A set of points in $\Renne$ must be approximated by an $(n-1)$-dimensional 
 % affine subspace. (Other more general situations can be considered.)
 % \par
@@ -796,7 +805,7 @@
 % \begin{equation}  \frac{n\lambda_{\textrm{min}}}{\tr(\mC)} 
 % \end{equation}  
 % can be used as an indicator of the relative residual 
-% dispersion of the data around the optimal line.
+% dispersion of the data around the optimal affine subspace.
 % The defined index is dimensionless and it is 
 % always between $0$ and $1$.
 % \par
@@ -900,29 +909,29 @@
  Data~File:                & \g_BBLR_file_name_tl                   \\ \hline
  Number~of~points:         & \int_use:N\g_BBLR_number_of_points_int \\ \hline 
  Mean~values~of~the~coordinates:              &% 
- $\fp_use:N \g_BBLR_mean_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_mean_ordinate_fp$ \\ \hline
+ $\BBLR_print_fp:N \g_BBLR_mean_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_mean_ordinate_fp$ \\ \hline
  Minimum~values~of~the~coordinates:        &% 
- $\fp_use:N \g_BBLR_min_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_min_ordinate_fp$    \\ \hline
+ $\BBLR_print_fp:N \g_BBLR_min_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_min_ordinate_fp$    \\ \hline
   Maximum~values~of~the~coordinates:    &% 
- $\fp_use:N \g_BBLR_max_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_max_ordinate_fp$    \\ \hline 
+ $\BBLR_print_fp:N \g_BBLR_max_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_max_ordinate_fp$    \\ \hline 
  {Second~order~moments}\phantom{xxxxxxxxx}{abscissa} &%
- $\fp_use:N \g_BBLR_abscissa_SecOrdMoment_fp$ \\
+ $\BBLR_print_fp:N \g_BBLR_abscissa_SecOrdMoment_fp$ \\
  \multicolumn{1}{|r|}{mixed}   & %
-$\fp_use:N \g_BBLR_mixed_SecOrdMoment_fp$ ~ \\ 
+$\BBLR_print_fp:N \g_BBLR_mixed_SecOrdMoment_fp$ ~ \\ 
 \multicolumn{1}{|r|}{ordinate}   & %
-$\fp_use:N \g_BBLR_ordinate_SecOrdMoment_fp$  \\ \hline 
-  Slope~and~intercept~of~optimal~line  & $\fp_use:N \g_BBLR_slope_A_fp$ \\
- (estimated~with~errors~in~ordinate)&$\fp_use:N \g_BBLR_intercept_A_fp$\\ \hline
-  Slope~and~intercept~of~optimal~line & $\fp_use:N \g_BBLR_slope_B_fp$ \\ 
- (estimated~with~errors~in~abscissa)&$\fp_use:N \g_BBLR_intercept_B_fp$\\ \hline
-  Components~of~unit~vector~along~the~line & $\fp_use:N  \g_BBLR_cos_fp$ \\
-  &  $\fp_use:N \g_BBLR_sin_fp$   \\
-  Slope~and~intercept~of~optimal~line &$\fp_use:N \g_BBLR_slope_S_fp$ \\
+$\BBLR_print_fp:N \g_BBLR_ordinate_SecOrdMoment_fp$  \\ \hline 
+  Slope~and~intercept~of~optimal~line  & $\BBLR_print_fp:N \g_BBLR_slope_A_fp$ \\
+ (estimated~with~errors~in~ordinate)&$\BBLR_print_fp:N \g_BBLR_intercept_A_fp$\\ \hline
+  Slope~and~intercept~of~optimal~line & $\BBLR_print_fp:N \g_BBLR_slope_B_fp$ \\ 
+ (estimated~with~errors~in~abscissa)&$\BBLR_print_fp:N \g_BBLR_intercept_B_fp$\\ \hline
+  Components~of~unit~vector~along~the~line & $\BBLR_print_fp:N  \g_BBLR_cos_fp$ \\
+  &  $\BBLR_print_fp:N \g_BBLR_sin_fp$   \\
+  Slope~and~intercept~of~optimal~line &$\BBLR_print_fp:N \g_BBLR_slope_S_fp$ \\
 (estimated~with~symmetric~regression) & 
- $\fp_use:N \g_BBLR_intercept_S_fp$\\ \hline 
+ $\BBLR_print_fp:N \g_BBLR_intercept_S_fp$\\ \hline 
 \end{tabular}
 \end{center}
 }
@@ -997,7 +1006,7 @@
 % \marginpar{\raggedleft\texttt{
 % \textbackslash{}BBLR\textunderscore{}decode\textunderscore{}data:}}
 % extract two numeric values from the string read from the file.
-% Some tricky actions are necessary because 
+% Some clever actions are necessary because 
 % a so called csv file sometime do not contains the separating commas. 
 %    \begin{macrocode}
 \cs_new_protected:Nn \BBLR_decode_data: {             
@@ -1106,8 +1115,17 @@
 }                                                             
 }                                                 
 %    \end{macrocode}
+% The function |\BBLR_print_fp:N |  \marginpar{\raggedleft\texttt{
+% \textbackslash{}BBLR\textunderscore{}print\textunderscore{}fp:N }}
+% is used to print floating point numbers with a limited number
+% of decimal digit.
 %
 %    \begin{macrocode}
+\cs_new_protected:Nn \BBLR_print_fp:N { {\fp_eval:n{trunc(#1 ,4)}}}
+%    \end{macrocode}
+
+%
+%    \begin{macrocode}
 \ExplSyntaxOff
 %    \end{macrocode}
 %
@@ -1116,19 +1134,27 @@
 %</package>
 %\fi
 %
+% \section{Versions and possible improvements}
+% 2024-06-10:  first post on CTAN.\par
+% 2024-11-23: small changes in the text, 
+% different format of numbers in the table.\par
+% Desired improvements: 
+% more code comment (text),  flexible output (code).
+% 
 % \section{Acknowledgments}
 % The colleagues Paolo Zatelli, Alfonso Vitti and Giulia Graldi
 % read some preliminary version 
-% of this text and suggested several improvements. \par
+% of this text and suggested several improvements. 
+% Claudio Beccari usefully commented about the first version 
+% when I was preparating the second version. \par
 %
-% \section{About the references}
+% \section{Citations and references}
 % \subsection*{Mathematics}
 % The books by Lang \cite{Lang} and by Strang \cite{Strang} give 
 % all the background on linear algebra.\par
 % The texts by Sansò \cites{Sanso1, Sanso2} (in italian) treat the
 % teory of probability and its application to metrology. 
-% See: |http://www.geolab.polimi.it/text-books/|.\par
-% The paper  by Karl Pearson \cite{Pearson} is the oldest text that 
+% The paper  by Pearson \cite{Pearson} is the oldest text that 
 % I have found on the symmetric regression, or total regression.
 % \subsection*{Programming}
 % The two documents \cites{L3A, L3B} are the fountamental and official guide
@@ -1136,8 +1162,7 @@
 % and Leslie Lamport \cites{Lamport} are still essential references. 
 % The papers by Enrico Gregorio \cites{egreg1, egreg2, egreg3, egreg4, egreg5}
 % explain some general and some special aspect of \LaTeX3 programming. 
-%
-% \section{References}
+% \subsection*{References}
 % \begin{biblist}[\normalsize]   
 % \bib{egreg1}{article}{
 % author={Gregorio, Enrico}, 
@@ -1211,6 +1236,7 @@
 % date={1996},
 % publisher={Città-Studi},
 % place={Milano},
+% note={see: http://www.geolab.polimi.it/text-books/},
 % }
 % \bib{Sanso2}{book}{
 % author={Sansò, Fernando},
@@ -1218,6 +1244,7 @@
 % date={1996},
 % publisher={Città-Studi},
 % place={Milano},
+% note={see: http://www.geolab.polimi.it/text-books/},
 % }
 % \bib{Strang}{book}{
 % author={Strang, Gilbert},

Modified: trunk/Master/texmf-dist/tex/latex/linearregression/linearregression.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/linearregression/linearregression.sty	2024-11-24 20:53:16 UTC (rev 72957)
+++ trunk/Master/texmf-dist/tex/latex/linearregression/linearregression.sty	2024-11-24 20:53:25 UTC (rev 72958)
@@ -18,7 +18,7 @@
 %% the conditions of the LaTeX Project Public License.
 %% (see: http://www.latex-project.org/lppl.txt)
 %% ------------------------------------------------------------------------
-\ProvidesPackage{linearregression}[2024-06-10]
+\ProvidesPackage{linearregression}[2024-11-23]
 \RequirePackage{pict2e}         
 \ExplSyntaxOn
 \ior_new:N  \g_BBLR_file_ior
@@ -181,29 +181,29 @@
  Data~File:                & \g_BBLR_file_name_tl                   \\ \hline
  Number~of~points:         & \int_use:N\g_BBLR_number_of_points_int \\ \hline
  Mean~values~of~the~coordinates:              &%
- $\fp_use:N \g_BBLR_mean_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_mean_ordinate_fp$ \\ \hline
+ $\BBLR_print_fp:N \g_BBLR_mean_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_mean_ordinate_fp$ \\ \hline
  Minimum~values~of~the~coordinates:        &%
- $\fp_use:N \g_BBLR_min_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_min_ordinate_fp$    \\ \hline
+ $\BBLR_print_fp:N \g_BBLR_min_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_min_ordinate_fp$    \\ \hline
   Maximum~values~of~the~coordinates:    &%
- $\fp_use:N \g_BBLR_max_abscissa_fp$ \\ &
- $\fp_use:N \g_BBLR_max_ordinate_fp$    \\ \hline
+ $\BBLR_print_fp:N \g_BBLR_max_abscissa_fp$ \\ &
+ $\BBLR_print_fp:N \g_BBLR_max_ordinate_fp$    \\ \hline
  {Second~order~moments}\phantom{xxxxxxxxx}{abscissa} &%
- $\fp_use:N \g_BBLR_abscissa_SecOrdMoment_fp$ \\
+ $\BBLR_print_fp:N \g_BBLR_abscissa_SecOrdMoment_fp$ \\
  \multicolumn{1}{|r|}{mixed}   & %
-$\fp_use:N \g_BBLR_mixed_SecOrdMoment_fp$ ~ \\
+$\BBLR_print_fp:N \g_BBLR_mixed_SecOrdMoment_fp$ ~ \\
 \multicolumn{1}{|r|}{ordinate}   & %
-$\fp_use:N \g_BBLR_ordinate_SecOrdMoment_fp$  \\ \hline
-  Slope~and~intercept~of~optimal~line  & $\fp_use:N \g_BBLR_slope_A_fp$ \\
- (estimated~with~errors~in~ordinate)&$\fp_use:N \g_BBLR_intercept_A_fp$\\ \hline
-  Slope~and~intercept~of~optimal~line & $\fp_use:N \g_BBLR_slope_B_fp$ \\
- (estimated~with~errors~in~abscissa)&$\fp_use:N \g_BBLR_intercept_B_fp$\\ \hline
-  Components~of~unit~vector~along~the~line & $\fp_use:N  \g_BBLR_cos_fp$ \\
-  &  $\fp_use:N \g_BBLR_sin_fp$   \\
-  Slope~and~intercept~of~optimal~line &$\fp_use:N \g_BBLR_slope_S_fp$ \\
+$\BBLR_print_fp:N \g_BBLR_ordinate_SecOrdMoment_fp$  \\ \hline
+  Slope~and~intercept~of~optimal~line  & $\BBLR_print_fp:N \g_BBLR_slope_A_fp$ \\
+ (estimated~with~errors~in~ordinate)&$\BBLR_print_fp:N \g_BBLR_intercept_A_fp$\\ \hline
+  Slope~and~intercept~of~optimal~line & $\BBLR_print_fp:N \g_BBLR_slope_B_fp$ \\
+ (estimated~with~errors~in~abscissa)&$\BBLR_print_fp:N \g_BBLR_intercept_B_fp$\\ \hline
+  Components~of~unit~vector~along~the~line & $\BBLR_print_fp:N  \g_BBLR_cos_fp$ \\
+  &  $\BBLR_print_fp:N \g_BBLR_sin_fp$   \\
+  Slope~and~intercept~of~optimal~line &$\BBLR_print_fp:N \g_BBLR_slope_S_fp$ \\
 (estimated~with~symmetric~regression) &
- $\fp_use:N \g_BBLR_intercept_S_fp$\\ \hline
+ $\BBLR_print_fp:N \g_BBLR_intercept_S_fp$\\ \hline
 \end{tabular}
 \end{center}
 }
@@ -329,6 +329,8 @@
 \put(\fp_use:N\fp_tmpa_fp, \fp_use:N\fp_tmpb_fp){#3}
 }
 }
+\cs_new_protected:Nn \BBLR_print_fp:N { {\fp_eval:n{trunc(#1 ,4)}}}
+
 \ExplSyntaxOff
 \endinput
 %%



More information about the tex-live-commits mailing list.