This function splits choice data into a train and a test part.
Examples
### simulate choices for demonstration
x <- simulate_choices(form = choice ~ covariate, N = 10, T = 10, J = 2)
### 70% of deciders in the train subsample,
### 30% of deciders in the test subsample
train_test(x, test_proportion = 0.3, by = "N")
#> $train
#> Simulated data of 70 choices.
#>
#> $test
#> Simulated data of 30 choices.
#>
### 2 randomly chosen choice occasions per decider in the test subsample,
### the rest in the train subsample
train_test(x, test_number = 2, by = "T", random = TRUE)
#> $train
#> Simulated data of 80 choices.
#>
#> $test
#> Simulated data of 20 choices.
#>