On Fri, 18 Jun 2021, Riccardo (Jack) Lucchetti wrote:
On Fri, 18 Jun 2021, George Matysiak wrote:
> Having selected a Random sub-sample, is it possible to save the excluded
> observations as variables? Thanks.
I'm not sure I understand what you mean, but I'll give it a shot anyway: if
you want to create a dummy variable holding included/excluded observations,
there is more than one way to do so: a particularly simple one is to create a
series of 1s when subsampling is in effect and then fill the excluded
observation with 0s, as in
<hansl>
open data7-24
smpl 100 --random
series selected = 1
ols salepric const sqft age city
smpl full
selected = misszero(selected)
</hansl>
of course, more sophisticated variants of the above are possible.
Here's a slight variation on Jack's theme.
<hansl>
open data7-24
smpl 100 --random
ols salepric const sqft age city
series uh = $uhat
smpl full
series excluded = missing(uh)
print uh excluded --byobs
</hansl>
However, my version gives an exact record of the observations
excluded by the random sampling only if all the included
observations were usable by ols.
Allin