Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ your needs. If, however, you need to implement something a bit different from
generic use cases, the package also includes lower level commands that can save
you time from having to code the entire cross-validation process. These
commands are named after the four-steps found in all cross-validation work:
`splitit`, `fitit`, `predictit`, and `validateit`. There are also a few utility
`splitit2`, `fitit`, `predictit`, and `validateit`. There are also a few utility
commands that take care of the metaprogramming tasks needed to allow these
commands to be applied to the correct fold/split of the data.

Expand Down Expand Up @@ -250,9 +250,9 @@ them.

# Phase Specific Commands

## splitit
## splitit2
```
splitit # [#] [if] [in] [, Uid(varlist) TPoint(string asis) KFold(integer 1)
splitit2 # [#] [if] [in] [, Uid(varlist) TPoint(string asis) KFold(integer 1)
SPLit(string asis) loo ]
```

Expand Down
2 changes: 1 addition & 1 deletion cmdmod.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ predictions are made on the appropriate out-of-sample portion of the data set.
{phang}
{opt spl:it} must contain the name of the variable that stores the test,
validation, and test splits. There will only be a single variable if the splits
were created using {help splitit}.
were created using {help splitit2}.

{dlgtab:Optional}

Expand Down
6 changes: 3 additions & 3 deletions crossvalidate.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ d implement multiple cross-validation procedures with estiamtion commands in
d Stata. There are two prefix commands -xv- and -xvloo- that are used to
d implement the entire cross-validation pipeline with the estimation command
d supplied by the user. For users that require more fine-grained control over
d the cross-validation process, the commands -splitit-, -fitit-, -predictit-, &
d the cross-validation process, the commands -splitit2-, -fitit-, -predictit-, &
d -validateit- implement each phase of cross-validation discretely. There are
d also several utility commands included as well. Lastly, the included Mata
d library contains over 40 different evaluation functions covering binary and
Expand Down Expand Up @@ -47,8 +47,8 @@ f libxv.mlib
f libxv.sthlp
f predictit.ado
f predictit.sthlp
f splitit.ado
f splitit.sthlp
f splitit2.ado
f splitit2.sthlp
f state.ado
f state.sthlp
f validateit.ado
Expand Down
4 changes: 2 additions & 2 deletions crossvalidate.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ individual commands.
{synopt :{opt {help xv}}}Cross-Validation{p_end}
{synopt :{opt {help xvloo}}}Leave-One-Out Cross-Validation{p_end}
{syntab:Lower Level Commands}
{synopt :{opt {help splitit}}}Splits the dataset into train/test or train/validation/test splits{p_end}
{synopt :{opt {help splitit2}}}Splits the dataset into train/test or train/validation/test splits{p_end}
{synopt :{opt {help fitit}}}Calls the estimation command on the appropriate split{p_end}
{synopt :{opt {help predictit}}}Predicts the outcome on the appropriate split{p_end}
{synopt :{opt {help validateit}}}Computes {p_end}
Expand Down Expand Up @@ -84,7 +84,7 @@ able to use this prefix.
{dlgtab:Lower Level Commands}

{phang}
{help splitit} is a command called by the prefix commands to create the splits
{help splitit2} is a command called by the prefix commands to create the splits
in the data in memory. As mentioned above, you can create train/test and
train/validation/test splits with or without K-Folds, using simple random
sampling or clustered sampling (which includes sampling panel units). This
Expand Down
2 changes: 1 addition & 1 deletion fitit.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ INCLUDE help xvphase-fit
{phang}
{opt spl:it} must contain the name of the variable that stores the test,
validation, and test splits. There will only be a single variable if the splits
were created using {help splitit}.
were created using {help splitit2}.

{phang}
{opt res:ults} is used to {help estimates_store:estimates store} the estimation
Expand Down
2 changes: 1 addition & 1 deletion libxv.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ the classes being predicted cannot be handled. Functions that might otherwise
allow the specification of a parameter to adjust the computation are also
unable to be accommodated. If you find the need to use that type of a
validation/test metric, you could still avoid having to write an entire
cross-validation pipeline by using {help splitit} and {help fitit} to do that
cross-validation pipeline by using {help splitit2} and {help fitit} to do that
work for you. Then, predict the values of interest and compute your metric. If
what we've provided in this package already meets your needs, feel free to use
the {help xv} prefix instead to let the computer do the work.
Expand Down
2 changes: 1 addition & 1 deletion predictit.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fitting the model to all of the training data.
{phang}
{opt spl:it} must contain the name of the variable that stores the test,
validation, and test splits. There will only be a single variable if the splits
were created using {help splitit}. Additionally, if you are passing an
were created using {help splitit2}. Additionally, if you are passing an
estimation command string as the first argument to this command, you must
pass the split variable name to this option.

Expand Down
7 changes: 4 additions & 3 deletions splitit.ado → splitit2.ado
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
* *
*******************************************************************************/

*! splitit
*! splitit2
*! splitit -> splitit2 to prevent collision with existing SSC routine
*! v 0.0.11
*! 28FEB2024

// Drop program from memory if already loaded
cap prog drop splitit
cap prog drop splitit2

// Define program
prog def splitit, rclass sortpreserve
prog def splitit2, rclass sortpreserve

// Version statement
version 15
Expand Down
34 changes: 17 additions & 17 deletions splitit.sthlp → splitit2.sthlp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{smcl}
{* *! version 0.0.7 06mar2024}{...}
{viewerjumpto "Syntax" "splitit##syntax"}{...}
{viewerjumpto "Description" "splitit##description"}{...}
{viewerjumpto "Options" "splitit##options"}{...}
{viewerjumpto "Examples" "splitit##examples"}{...}
{viewerjumpto "Returned Values" "splitit##retvals"}{...}
{viewerjumpto "Additional Information" "splitit##additional"}{...}
{viewerjumpto "Contact" "splitit##contact"}{...}
{viewerjumpto "Syntax" "splitit2##syntax"}{...}
{viewerjumpto "Description" "splitit2##description"}{...}
{viewerjumpto "Options" "splitit2##options"}{...}
{viewerjumpto "Examples" "splitit2##examples"}{...}
{viewerjumpto "Returned Values" "splitit2##retvals"}{...}
{viewerjumpto "Additional Information" "splitit2##additional"}{...}
{viewerjumpto "Contact" "splitit2##contact"}{...}
{title:Dataset Splitting and Folding for Cross-Validation in Stata}

{marker syntax}{...}
{title:Syntax}

{p 8 32 2}
{cmd:splitit} # [#] {ifin} [{cmd:,} {cmdab:u:id(}{it:varlist}{cmd:)}
{cmd:splitit2} # [#] {ifin} [{cmd:,} {cmdab:u:id(}{it:varlist}{cmd:)}
{cmdab:tp:oint(}{it:string asis}{cmd:)} {cmdab:k:fold(}{it:integer}{cmd:)}
{cmdab:spl:it(}{it:string asis}{cmd:)} {cmd:loo}]{p_end}

Expand Down Expand Up @@ -68,7 +68,7 @@ set.
{phang}
{opt spl:it} is used to specify the name of a new variable that will store the
identifiers for the splits in the data. If no argument is passed to this option
{cmd splitit} will store the result in a variable named {it:_xvsplit}.
{cmd splitit2} will store the result in a variable named {it:_xvsplit}.

{phang}
{opt loo} is an option used to alter the underlying logic used to compute the
Expand All @@ -87,27 +87,27 @@ the predicted and observed values for all of the training set units in aggregate

{p 4 4 2}Simple Random Sampling{p_end}
{p 6 4 2}Test/Train Split{p_end}
{p 8 4 2}{stata splitit .8, ret(splitvar)}{p_end}
{p 8 4 2}{stata splitit2 .8, ret(splitvar)}{p_end}
{p 6 4 2}Train/Validation/Test Split{p_end}
{p 8 4 2}{stata splitit .6 .2, ret(splitvar)}{p_end}
{p 8 4 2}{stata splitit2 .6 .2, ret(splitvar)}{p_end}

{p 4 4 2}K-Fold Simple Random Sampling{p_end}
{p 6 4 2}Test/Train Split{p_end}
{p 8 4 2}{stata splitit .8, ret(splitvar) k(5)}{p_end}
{p 8 4 2}{stata splitit2 .8, ret(splitvar) k(5)}{p_end}
{p 6 4 2}Train/Validation/Test Split{p_end}
{p 8 4 2}{stata splitit .6 .2, ret(splitvar) k(5)}{p_end}
{p 8 4 2}{stata splitit2 .6 .2, ret(splitvar) k(5)}{p_end}

{p 4 4 2}Clustered Random Sampling{p_end}
{p 6 4 2}Test/Train Split{p_end}
{p 8 4 2}{stata splitit .8, ret(splitvar) uid(foreign)}{p_end}
{p 8 4 2}{stata splitit2 .8, ret(splitvar) uid(foreign)}{p_end}
{p 6 4 2}Train/Validation/Test Split{p_end}
{p 8 4 2}{stata splitit .6 .2, ret(splitvar) uid(foreign)}{p_end}
{p 8 4 2}{stata splitit2 .6 .2, ret(splitvar) uid(foreign)}{p_end}

{p 4 4 2}K-Fold Clustered Random Sampling{p_end}
{p 6 4 2}Test/Train Split{p_end}
{p 8 4 2}{stata splitit .8, ret(splitvar) k(5) uid(foreign)}{p_end}
{p 8 4 2}{stata splitit2 .8, ret(splitvar) k(5) uid(foreign)}{p_end}
{p 6 4 2}Train/Validation/Test Split{p_end}
{p 8 4 2}{stata splitit .6 .2, ret(splitvar) k(5) uid(foreign)}{p_end}
{p 8 4 2}{stata splitit2 .6 .2, ret(splitvar) k(5) uid(foreign)}{p_end}


{marker retvals}{...}
Expand Down
2 changes: 1 addition & 1 deletion test/crossvalidatetest.do
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ di "Test Suite for the Cross-Validation Suite"
do test/libxvtests.do
do test/classifytests.do
do test/cmdmodtests.do
do test/splitittests.do
do test/splitit2tests.do
do test/fitittests.do
do test/predictittests.do
do test/validateittests.do
Expand Down
Loading