Than you for the comments which are very helpful.


On Fri, 18 Jun 2021 at 18:18, <gretl-users-request@gretlml.univpm.it> wrote:
Send Gretl-users mailing list submissions to
        gretl-users@gretlml.univpm.it

To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
        gretl-users-request@gretlml.univpm.it

You can reach the person managing the list at
        gretl-users-owner@gretlml.univpm.it

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gretl-users digest..."

Today's Topics:

   1. Re: Regression Cross-Validation (George Matysiak)
   2. Re: Saving excluded observations from a Random sub-sample
      (George Matysiak)
   3. Re: Regression Cross-Validation (Sven Schreiber)
   4. Re: Saving excluded observations from a Random sub-sample
      (Sven Schreiber)
   5. Re: Saving excluded observations from a Random sub-sample
      (Riccardo (Jack) Lucchetti)
   6. Re: Regression Cross-Validation (Riccardo (Jack) Lucchetti)


----------------------------------------------------------------------

Date: Fri, 18 Jun 2021 15:05:45 +0200
From: George Matysiak <gmatysiak@gmail.com>
Subject: [Gretl-users] Re: Regression Cross-Validation
To: gretl-users@gretlml.univpm.it
Message-ID:
        <CAEWMk7ucC=+iG0aSd-Usf7=SeqfoshPEWChJJfpQnaE2dWayvQ@mail.gmail.com>
Content-Type: multipart/alternative;
        boundary="000000000000e0f39205c509fc63"

--000000000000e0f39205c509fc63
Content-Type: text/plain; charset="UTF-8"

Is it possible to undertake k-fold cross-validation in estimating
regression equations? Thanks.

--000000000000e0f39205c509fc63
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:tahoma,s=
ans-serif;font-size:small">Is it possible to undertake k-fold cross-validat=
ion in estimating regression equations? Thanks.<br clear=3D"all"></div><div=
><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signatu=
re"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div =
dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"lt=
r"><div><div dir=3D"ltr"><div><font style=3D"background-color:rgb(255,255,2=
55)" face=3D"comic sans ms, sans-serif"><br></font></div></div></div></div>=
</div></div></div></div></div></div></div></div></div></div></div></div></d=
iv></div></div>

--000000000000e0f39205c509fc63--

------------------------------

Date: Fri, 18 Jun 2021 15:35:33 +0200
From: George Matysiak <gmatysiak@gmail.com>
Subject: [Gretl-users] Re: Saving excluded observations from a Random
        sub-sample
To: gretl-users@gretlml.univpm.it
Message-ID:
        <CAEWMk7th4SsOgC_jmoZ6FhdAmCTdW2ScFxzi0PYcwyUbQSSJmw@mail.gmail.com>
Content-Type: multipart/alternative;
        boundary="0000000000006cb46f05c50a679a"

--0000000000006cb46f05c50a679a
Content-Type: text/plain; charset="UTF-8"

Having selected a Random sub-sample, is it possible to save the excluded
observations as variables? Thanks.

--0000000000006cb46f05c50a679a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:tahoma,s=
ans-serif;font-size:small">Having selected a Random sub-sample, is it possi=
ble to save the excluded observations as variables? Thanks.<br clear=3D"all=
"></div><div><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"g=
mail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr=
"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><d=
iv dir=3D"ltr"><div><div dir=3D"ltr"><div><font style=3D"background-color:r=
gb(255,255,255)" face=3D"comic sans ms, sans-serif"><br></font></div></div>=
</div></div></div></div></div></div></div></div></div></div></div></div></d=
iv></div></div></div></div>

--0000000000006cb46f05c50a679a--

------------------------------

Date: Fri, 18 Jun 2021 15:51:36 +0200
From: Sven Schreiber <svetosch@gmx.net>
Subject: [Gretl-users] Re: Regression Cross-Validation
To: gretl-users@gretlml.univpm.it
Message-ID: <d636eebf-a7a7-63c5-54f4-86a3d974d160@gmx.net>
Content-Type: multipart/alternative;
        boundary="------------E7450D5FBB186983D61973CE"

This is a multi-part message in MIME format.
--------------E7450D5FBB186983D61973CE
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Am 18.06.2021 um 15:05 schrieb George Matysiak:
> Is it possible to undertake k-fold cross-validation in estimating
> regression equations? Thanks.
>
Hi, for regularized LS under Model/Other linear models you get CV. (For
GUI access it could be that you need a post-2021b snapshot, not sure
right now.) If you want to stick to OLS, I guess you could imitate that
by using Ridge with an extremely loose penalty.

Then there are two contributed packages by Artur (Tarassow),
CvDataSplitter and TsCrossValidation - the latter hasn't been updated in
a while, but actually it could be that he is working on a replacement (?).

cheers

sven


--------------E7450D5FBB186983D61973CE
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-=
8">
  </head>
  <body>
    <div class=3D"moz-cite-prefix">Am 18.06.2021 um 15:05 schrieb George
      Matysiak:<br>
    </div>
    <blockquote type=3D"cite"
cite=3D"mid:CAEWMk7ucC=3D+iG0aSd-Usf7=3DSeqfoshPEWChJJfpQnaE2dWayvQ@mail.g=
mail.com">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUT=
F-8">
      <div dir=3D"ltr">
        <div class=3D"gmail_default"
          style=3D"font-family:tahoma,sans-serif;font-size:small">Is it
          possible to undertake k-fold cross-validation in estimating
          regression equations? Thanks.<br clear=3D"all">
        </div>
        <br>
      </div>
    </blockquote>
    <p>Hi, for regularized LS under Model/Other linear models you get
      CV. (For GUI access it could be that you need a post-2021b
      snapshot, not sure right now.) If you want to stick to OLS, I
      guess you could imitate that by using Ridge with an extremely
      loose penalty.</p>
    <p>Then there are two contributed packages by Artur (Tarassow),
      CvDataSplitter and TsCrossValidation - the latter hasn't been
      updated in a while, but actually it could be that he is working on
      a replacement (?).</p>
    <p>cheers</p>
    <p>sven=C2=A0 <br>
    </p>
  </body>
</html>

--------------E7450D5FBB186983D61973CE--

------------------------------

Date: Fri, 18 Jun 2021 16:01:26 +0200
From: Sven Schreiber <svetosch@gmx.net>
Subject: [Gretl-users] Re: Saving excluded observations from a Random
        sub-sample
To: gretl-users@gretlml.univpm.it
Message-ID: <132fa31a-3b8f-f011-e9c4-9c7d4791f2ea@gmx.net>
Content-Type: multipart/alternative;
        boundary="------------7DD10EE6B422A8373BD3852A"

This is a multi-part message in MIME format.
--------------7DD10EE6B422A8373BD3852A
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Am 18.06.2021 um 15:35 schrieb George Matysiak:
> Having selected a Random sub-sample, is it possible to save the
> excluded observations as variables? Thanks.

Do you mean the index numbers of the non-selected observations, or do
you mean the values of the variables in the non-selected set? Are you
working in a script or trying this via the GUI?

thanks

sven


--------------7DD10EE6B422A8373BD3852A
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Am 18.06.2021 um 15:35 schrieb George
      Matysiak:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEWMk7th4SsOgC_jmoZ6FhdAmCTdW2ScFxzi0PYcwyUbQSSJmw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small">Having
          selected a Random sub-sample, is it possible to save the
          excluded observations as variables? Thanks.<br clear="all">
        </div>
      </div>
    </blockquote>
    <p>Do you mean the index numbers of the non-selected observations,
      or do you mean the values of the variables in the non-selected
      set? Are you working in a script or trying this via the GUI?</p>
    <p>thanks</p>
    <p>sven<br>
    </p>
  </body>
</html>

--------------7DD10EE6B422A8373BD3852A--

------------------------------

Date: Fri, 18 Jun 2021 18:02:36 +0200 (CEST)
From: "Riccardo (Jack) Lucchetti" <p002264@staff.univpm.it>
Subject: [Gretl-users] Re: Saving excluded observations from a Random
        sub-sample
To: Gretl list <gretl-users@gretlml.univpm.it>
Message-ID:
        <alpine.DEB.2.22.394.2106181755180.7529@jack-SATELLITE-L850-1L1>
Content-Type: multipart/mixed;
        boundary="8323329-1436478366-1624032162=:7529"

--8323329-1436478366-1624032162=:7529
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

On Fri, 18 Jun 2021, George Matysiak wrote:

> Having selected a Random sub-sample, is it possible to save the exclude=
d
> observations as variables? Thanks.

I'm not sure I understand what you mean, but I'll give it a shot anyway:=20
if you want to create a dummy variable holding included/excluded=20
observations, there is more than one way to do so: a particularly simple=20
one is to create a series of 1s when subsampling is in effect and then=20
fill the excluded observation with 0s, as in

<hansl>
open data7-24
smpl 100 --random
series selected =3D 1
ols salepric const sqft age city
smpl full
selected =3D misszero(selected)
</hansl>

of course, more sophisticated variants of the above are possible.

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Universit=C3=A0 Politecnica delle Marche
   (formerly known as Universit=C3=A0 di Ancona)

   r.lucchetti@univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
--8323329-1436478366-1624032162=:7529--

------------------------------

Date: Fri, 18 Jun 2021 18:18:23 +0200 (CEST)
From: "Riccardo (Jack) Lucchetti" <p002264@staff.univpm.it>
Subject: [Gretl-users] Re: Regression Cross-Validation
To: Gretl list <gretl-users@gretlml.univpm.it>
Message-ID:
        <alpine.DEB.2.22.394.2106181809410.7529@jack-SATELLITE-L850-1L1>
Content-Type: multipart/mixed;
        boundary="8323329-282290097-1624033109=:7529"

--8323329-282290097-1624033109=:7529
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

On Fri, 18 Jun 2021, Sven Schreiber wrote:

> Am 18.06.2021 um 15:05 schrieb George Matysiak:
>> Is it possible to undertake k-fold cross-validation in estimating
>> regression equations? Thanks.
>>=20
> Hi, for regularized LS under Model/Other linear models you get CV. (For
> GUI access it could be that you need a post-2021b snapshot, not sure
> right now.) If you want to stick to OLS, I guess you could imitate that
> by using Ridge with an extremely loose penalty.
>
> Then there are two contributed packages by Artur (Tarassow),
> CvDataSplitter and TsCrossValidation - the latter hasn't been updated i=
n
> a while, but actually it could be that he is working on a replacement (=
?).

My advice is to use Artur's excellent code, but if you just want a=20
quick-n-dirty solution to take inspiration from, here's one:

<hansl>
set verbose off
open data7-24
list X =3D const sqft age city
scalar nfolds =3D 8
series fold =3D randgen(i, 1, nfolds)

series prederr =3D 0
loop f =3D 1 .. nfolds
     series d =3D (fold !=3D $f)
     wls d salepric X --quiet
     series prederr +=3D d ? 0 : $uhat
endloop

printf "x-validation criterion (%d random folds) =3D %12.4f\n", nfolds, s=
um(prederr^2)
</hansl>


-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Universit=C3=A0 Politecnica delle Marche
   (formerly known as Universit=C3=A0 di Ancona)

   r.lucchetti@univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
--8323329-282290097-1624033109=:7529--

------------------------------

Subject: Digest Footer

_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/


------------------------------

End of Gretl-users Digest, Vol 173, Issue 10
********************************************