@@ -129,7 +129,7 @@ \section{Basic options}
129
129
130
130
In case you wish to specify a sequence succinctly but with more
131
131
control, the package contains a utility function
132
- \texttt { lambda \_ sequence () }, which takes up to three arguments. The
132
+ \dtk {lambda_sequence ()}, which takes up to three arguments. The
133
133
first and second arguments (required) give the maximum $ s$ and the
134
134
number of values, while the third (optional) argument can be used to
135
135
give the minimum $ s$ (by default 0.0001). As with the \texttt {nlambda }
@@ -380,14 +380,14 @@ \section{Obtaining predicted values}
380
380
Optimization of out-of-sample prediction is of course the name of the
381
381
game with regularized regression. To obtain out-of-sample predictions
382
382
(and/or within-sample fitted values if you want them), the recommended
383
- approach is to use \texttt { regls \_ pred () }. This function takes two
383
+ approach is to use \dtk {regls_pred ()}. This function takes two
384
384
arguments: a bundle produced by \texttt {regls() } and the list passed
385
385
to \texttt {regls } as \texttt {X }. By default the return value is a
386
386
series holding predicted values.
387
387
388
388
If you use \texttt {mregls() } for estimation, the alternative
389
- prediction function \texttt { mregls \_ pred () } should be called in place
390
- of \texttt { regls \_ pred }. In that case the second argument should be a
389
+ prediction function \dtk {mregls_pred ()} should be called in place
390
+ of \dtk {regls_pred }. In that case the second argument should be a
391
391
matrix of regressors with the same number of columns as that passed to
392
392
\texttt {mregls }, and by default the return value is a column vector of
393
393
length equal to the row dimension of the matrix argument.
@@ -398,7 +398,7 @@ \section{Obtaining predicted values}
398
398
values---that is, the BIC minimizer if cross-validation is not
399
399
performed, or that corresponding to either \texttt {idxmin } or
400
400
\texttt {idx1se } (see above) after cross-validation. The
401
- \texttt {idxmin } value is used automatically unless \texttt { use \_ 1se }
401
+ \texttt {idxmin } value is used automatically unless \dtk {use_1se }
402
402
was set in the parameter bundle passed to \texttt {regls } or
403
403
\texttt {mregls }.
404
404
@@ -427,8 +427,8 @@ \subsection{Further options}
427
427
Beyond the default behavior of the prediction functions, if multiple
428
428
$ \lambda $ values were used in estimation you can control the output by
429
429
adding a preference to the bundle \texttt {b }, under the key
430
- \texttt {pred }, before passing it to \texttt { regls \_ pred } or
431
- \texttt { mregls \_ pred }. The admissible values for \texttt {pred } are as
430
+ \texttt {pred }, before passing it to \dtk {regls_pred } or
431
+ \dtk {mregls_pred }. The admissible values for \texttt {pred } are as
432
432
follows:
433
433
\begin {enumerate }
434
434
\item \texttt {idxmin }: use the \texttt {idxmin } column of the \texttt {B }
@@ -482,7 +482,7 @@ \section{Execution speed}
482
482
\item We implemented automatic `` farming out'' of cross validation to
483
483
multiple \textsf {MPI} processes (when \textsf {MPI} is available on
484
484
the host machine). It's possible to prevent this by adding
485
- \texttt { no \_ mpi } to the parameter bundle with a non-zero value.
485
+ \dtk {no_mpi } to the parameter bundle with a non-zero value.
486
486
\end {itemize }
487
487
In one benchmark case we considered---with 1500 training observations,
488
488
101 covariates, 50 values of $ \lambda $ and 10 randomized cross
@@ -574,34 +574,34 @@ \section{Ridge regression}
574
574
drive all coefficients to zero and so no `` natural'' maximum to serve
575
575
as a benchmark. We therefore offer the user three options for the
576
576
specification of `` \texttt {lfrac },'' controlled by the integer-valued
577
- parameter \texttt { lambda \_ scale }:
577
+ parameter \dtk {lambda_scale }:
578
578
\begin {itemize }
579
- \item \texttt { lambda \_ scale } = 0: no scaling is performed. The
579
+ \item \dtk {lambda_scale } = 0: no scaling is performed. The
580
580
`` \texttt {lfrac }'' values are taken as actual $ \lambda $ values (and
581
581
so do not have to be bounded by 1.0 above).
582
- \item \texttt { lambda \_ scale } = 1 (the default): we emulate
582
+ \item \dtk {lambda_scale } = 1 (the default): we emulate
583
583
\textsf {glmnet}. The largest value of $ \lambda $ is set to
584
584
$ 9.9 \times 10 ^{35}$ , which will drive all coefficients to
585
585
near-zero. The second-largest $ \lambda $ (call it $ \lambda _2 $ ) is
586
586
then set to 1000 times $ \| X'y\| _{\infty }$ , and subsequent values in
587
587
the sequence are scaled in relation to $ \lambda _2 $ .
588
- \item \texttt { lambda \_ scale } = 2: we follow the suggestion of some
588
+ \item \dtk {lambda_scale } = 2: we follow the suggestion of some
589
589
practitioners, setting $ \lambda _{\max }$ to the squared Frobenius
590
590
norm of $ X$ , which will not drive all coefficients to near-zero but
591
591
will impose substantial shrinkage in relation to OLS.
592
592
\end {itemize }
593
593
594
594
To be clear on the action of options 1 and 2 for
595
- \texttt { lambda \_ scale }, suppose our \texttt {lfrac } specification is
595
+ \dtk {lambda_scale }, suppose our \texttt {lfrac } specification is
596
596
\begin {code }
597
597
lfrac = {1, 0.5, 0.25, 0.125}
598
598
\end {code }
599
- Then if \texttt { lambda \_ scale } = 1 this translates to
599
+ Then if \dtk {lambda_scale } = 1 this translates to
600
600
\begin {code }
601
601
lam2 = 1000 * infnorm(X'y)
602
602
effective_lambda = {9.9e35, lam2, 0.5*lam2, 0.25*lam2}
603
603
\end {code }
604
- while if \texttt { lambda \_ scale } = 2 it becomes
604
+ while if \dtk {lambda_scale } = 2 it becomes
605
605
\begin {code }
606
606
lam1 = tr(X'X) # Frobenius norm squared
607
607
effective_lambda = {lam1, 0.5*lam1, 0.25*lam1, 0.125*lam1}
@@ -610,10 +610,10 @@ \section{Ridge regression}
610
610
standardization.
611
611
612
612
One further point on the scaling of $ \lambda $ : since the key
613
- \texttt {lfrac } doesn't look right when \texttt { lambda \_ scale } = 0, we
613
+ \texttt {lfrac } doesn't look right when \dtk {lambda_scale } = 0, we
614
614
accept \texttt {lambda } as an alternative key. In fact, if
615
615
\texttt {lambda } rather than \texttt {lfrac } is found in the input
616
- bundle, the default for \texttt { lambda \_ scale } switches to 0 (but an
616
+ bundle, the default for \dtk {lambda_scale } switches to 0 (but an
617
617
explicit setting will override this).
618
618
619
619
In addition to \texttt {BIC } and \texttt {R2 } the return bundle from
@@ -646,7 +646,7 @@ \section{The CCD option}
646
646
governed by two additional keys in the \texttt {parms } bundle:
647
647
\begin {itemize }
648
648
\item \texttt {ccd }: boolean, default 0. Set this to 1 to use CCD.
649
- \item \texttt { ccd \_ toler }: a positive scalar setting the convergence
649
+ \item \dtk {ccd_toler }: a positive scalar setting the convergence
650
650
tolerance for CCD. The default is $ 10 ^{-7}$ (as in \textsf {glmnet});
651
651
setting a smaller value will give greater accuracy at the expense of
652
652
more iterations.
@@ -683,7 +683,7 @@ \section{Elastic net}
683
683
In the \texttt {regls } function, elastic net is selected by specifying
684
684
a fractional value under the key \texttt {alpha } in the parameters
685
685
bundle. This automatically switches to the CCD algorithm
686
- (Section~\ref {sec:ccd }), so the \texttt { ccd \_ toler } option becomes
686
+ (Section~\ref {sec:ccd }), so the \dtk {ccd_toler } option becomes
687
687
applicable.\footnote {In principle the ADMM algorithm could handle
688
688
elastic net, but to date we have not implemented such support.}
689
689
@@ -802,20 +802,20 @@ \section{Reference: public functions}
802
802
\texttt {nlambda } & integer & number of automatic $ \lambda $ s \\
803
803
\texttt {stdize } & 0/1, default 1 & standardize the data \\
804
804
\texttt {ridge } & 0/1, default 0 & do Ridge regression \\
805
- \texttt { lambda \_ scale } & 0, 1 or 2, default 1 & see Section~\ref {sec:ridge } \\
805
+ \dtk {lambda_scale } & 0, 1 or 2, default 1 & see Section~\ref {sec:ridge } \\
806
806
\texttt {verbosity } & 0, 1, 2 or 3, default 1 & printing of output\\
807
807
\texttt {xvalidate } & 0/1, default 0 & do cross validation\\
808
808
\texttt {nfolds } & optional integer $ >1 $ , default 10 & number of
809
809
folds \\
810
810
\texttt {randfolds } & 0/1, default 0 & use random folds\\
811
- \texttt { use \_ 1se } & 0/1, default 0 & see Section~\ref {sec:xvalid } \\
811
+ \dtk {use_1se } & 0/1, default 0 & see Section~\ref {sec:xvalid } \\
812
812
\texttt {seed } & optional integer & controls random folds\\
813
- \texttt { single \_ b } & 0/1, default 0 & see Section~\ref {sec:xvalid }\\
814
- \texttt { no \_ mpi } & 0/1, default 0 & see Section~\ref {sec:speed }\\
813
+ \dtk {single_b } & 0/1, default 0 & see Section~\ref {sec:xvalid }\\
814
+ \dtk {no_mpi } & 0/1, default 0 & see Section~\ref {sec:speed }\\
815
815
\texttt {admmctrl } & optional control vector & see
816
816
Section~\ref {sec:add-controls } \\
817
817
\texttt {ccd } & 0/1, default 0 & see section~\ref {sec:ccd } \\
818
- \texttt { ccd \_ toler } & positive scalar, default $ 10 ^{-7}$ & see
818
+ \dtk {ccd_toler } & positive scalar, default $ 10 ^{-7}$ & see
819
819
Section~\ref {sec:ccd }\\
820
820
\texttt {alpha } & $ 0 \leq \alpha \leq 1 $ (default 1) & see
821
821
Section~\ref {sec:elnet }
@@ -883,7 +883,7 @@ \section{Reference: public functions}
883
883
$ R^2 $ , the sum of absolute values of the coefficients, and df (the
884
884
number of non-zero coefficients) associated with each value of
885
885
$ \lambda $ . Usage is illustrated in the example script
886
- \texttt { lambda \_ sequence .inp }, which is reproduced in part in
886
+ \dtk {lambda_sequence .inp}, which is reproduced in part in
887
887
Listing~\ref {script:lamseq }.
888
888
\end {funcdoc }
889
889
@@ -907,7 +907,7 @@ \section{Reference: public functions}
907
907
file, as described in the documentation for gretl's \texttt {gnuplot }
908
908
command. By default the plot is shown on screen.
909
909
910
- See also \texttt { mregls \_ coeff \_ plot } below.
910
+ See also \dtk {mregls_coeff_plot } below.
911
911
\end {funcdoc }
912
912
913
913
\begin {funcdoc }
@@ -937,7 +937,7 @@ \section{Reference: public functions}
937
937
handles the presence or absence of an estimated intercept, as well
938
938
as selection of a specific coefficient vector when estimation has
939
939
been performed for multiple values of the regularization parameter.
940
- See also \texttt { mregls \_ pred } below. See Section~\ref {sec:predict }
940
+ See also \dtk {mregls_pred } below. See Section~\ref {sec:predict }
941
941
for details.
942
942
\end {funcdoc }
943
943
@@ -959,7 +959,7 @@ \section{Reference: public functions}
959
959
\begin {verbatim }
960
960
matrix mregls_pred (const bundle b, const matrix X)
961
961
\end {verbatim }
962
- Companion to \texttt { regls \_ pred }, for a bundle obtained via
962
+ Companion to \dtk {regls_pred }, for a bundle obtained via
963
963
\texttt {mregls }. The matrix \texttt {X } must have the same number of
964
964
columns as that passed to \texttt {mregls }. The return value is by
965
965
default a column vector of length equal to the row dimension of
@@ -974,7 +974,7 @@ \section{Reference: public functions}
974
974
\begin {verbatim }
975
975
void mregls_coeff_plot (const bundle b, const matrix sel[null], string fname[null])
976
976
\end {verbatim }
977
- Works just like \texttt { regls \_ coeff \_ plot } (see above) except that
977
+ Works just like \dtk {regls_coeff_plot } (see above) except that
978
978
this variant is for use after \texttt {mregls } estimation. The
979
979
optional selection of coefficients to be tracked works via a
980
980
selection (row) vector. The elements of this vector should be column
@@ -1003,7 +1003,7 @@ \section{Reference: public functions}
1003
1003
Convenience function for facilitating comparison of results when the
1004
1004
same regularization task has been performed in gretl using
1005
1005
\texttt {regls } and in \textsf {R} using \texttt {glmnet }. The output
1006
- is like that of \texttt { regls \_ multiprint }. The matrices
1006
+ is like that of \dtk {regls_multiprint }. The matrices
1007
1007
\texttt {RB } and \texttt {Rlam } should be obtained from the object
1008
1008
returned by \texttt {glmnet() }; \texttt {b } should be the bundle
1009
1009
returned by \texttt {regls }. Usage is illustrated in
@@ -1019,8 +1019,8 @@ \section{Change log}
1019
1019
variable; make plots more robust; add descriptive labels to the
1020
1020
included murder-rates dataset; expand and update the documentation.\\ [4pt]
1021
1021
2023-05-20: Add support for matrix input via the \texttt {mregls }
1022
- function; simplify the signature of \texttt { regls \_ multiprint };
1023
- add function \texttt { glmnet \_ multiprint }.\\ [4pt]
1022
+ function; simplify the signature of \dtk {regls_multiprint };
1023
+ add function \dtk {glmnet_multiprint }.\\ [4pt]
1024
1024
2022-10-02: Enhancements for regls plots; document GUI usage; update
1025
1025
an internal function signature to comply with gretl's
1026
1026
new `` const inheritance'' policy.\\ [4pt]
@@ -1149,7 +1149,7 @@ \subsection{Ridge: SVD and CCD}
1149
1149
a tolerance of $ 10^{-9}$ or less. Note, however, that there seems to
1150
1150
be little point in reducing the CCD tolerance below $ 10^{-9}$ .
1151
1151
1152
- % % Ridge: CCD and SVD, using \texttt{ridge\_crit\_native .inp}
1152
+ % % Ridge: CCD and SVD, using \dtk{ridge_crit_native .inp}
1153
1153
\begin {figure}[htbp]
1154
1154
\begin {center}
1155
1155
\includegraphics [scale=0.9 ]{ccd_svd.pdf}
@@ -1181,7 +1181,7 @@ \subsection{LASSO: ADMM and CCD}
1181
1181
$ 10^{-7}$ to $ 10^{-9}$ Ridge time becomes slightly greater than SVD
1182
1182
time, while LASSO time becomes over twice that of ADMM.
1183
1183
1184
- % % LASSO: CCD and ADMM, using \texttt{lasso\_crit\_native .inp}
1184
+ % % LASSO: CCD and ADMM, using \dtk{lasso_crit_native .inp}
1185
1185
\begin {figure}[htbp]
1186
1186
\begin {center}
1187
1187
\includegraphics [scale=0.9 ]{ccd_admm.pdf}
0 commit comments