split_data {HTLR} | R Documentation |
Split Data into Train and Test Partitions
Description
This function splits the input data and response variables into training and testing parts.
Usage
split_data(X, y, p.train = 0.7, n.train = round(nrow(X) * p.train))
Arguments
X |
Input matrix, of dimension |
y |
Vector of response variables. |
p.train |
Percentage of training set. |
n.train |
Number of cases for training; will override |
Value
List of training data x.tr
, y.tr
and testing data x.te
, y.te
.
Examples
dat <- gendata_MLR(n = 100, p = 10)
dat <- split_data(dat$X, dat$y, p.train = 0.7)
dim(dat$x.tr)
dim(dat$x.te)
[Package HTLR version 0.4-4 Index]