help get_train_test

Title

get_train_test- Splitting an initial dataset into training and testing datasets

Syntax

get_train_test,
dataname(data_name)
split(shares)
split_var(name)
rseed(integer)

Description

The get_train_test command generates the training and testing datasets from an initial dataset loaded in the current Stata session.

Options

options

dataname(data_name) specifies the name of the dataset open in the current Stata session

split(shares) requests to provide two numbers (ranging from 0 to 1)
representing the shares of the training and testing datasets.

split_var(name) generates a flag variable distinguishing the training and testing observations.

seed(#) where #specifies a integer seed to assure replication of same results.

Returns

The get_test_train command generates the training dataset as
data_name_train and a testing datset as data_name_test.
They are automatically located in the Stata current directory.

Author

Giovanni Cerulli

IRCrES-CNR

Research Institute for Sustainable Economic Growth, National Research Council of Italy

E-mail: giovanni.cerulli@ircres.cnr.it

Also see

Online: python, c_ml_stata_cv, r_ml_stata_cv