trainTestPartition: Partition Dataframe into Train/Test Samples

Description Usage Arguments Value Author(s) Examples

View source: R/glmnetPredict.R

Description

Dataframe used to create training and test datasets using specified fraction for the training sample. The data matrix must be comprised of continuous variables only (no factors).

Usage

1
trainTestPartition(Xy, trainFrac = 2/3)

Arguments

Xy

Dataframe with column names, last column is the response variable and others are the regression input variables. The data matrix must be comprised of continuous variables only (no factors).

trainFrac

Fraction to be used for the training sample.

Value

A list with components

XyTr

Training dataframe.

XTr

Matrix, input training variables.

yTr

Vector, output training variable.

XyTe

Training dataframe.

XTe

Matrix, input test variables.

yTe

Vector, output test variable.

XyTr

Training dataframe.

XyTr

Training dataframe.

XyTr

Training dataframe.

Author(s)

A. I. McLeod

Examples

1
2
3

Example output

Loading required package: leaps
           OLS  StepAIC  StepBIC     RR1     RR2     RR3     RR4
PREC   24.7922  24.5506  22.6913  0.9227  1.1468  0.9663  1.1009
JANT   -2.0511   0.0000   0.0000 -0.2811 -0.3105 -0.2881 -0.3059
JULT  -17.2703  -8.8751   0.0000 -0.1116 -0.2800 -0.1400 -0.2409
OVR65 -11.3140   0.0000   0.0000 -0.3840 -0.3771 -0.3813 -0.3763
POPN   -7.7363   0.0000   0.0000 26.2878 26.8236 26.5222 26.8452
EDUC   -8.5628 -10.2329 -10.5808 -9.0382 -9.7324 -9.2145 -9.6318
HOUS   -7.0558   0.0000   0.0000 -0.4068 -0.4227 -0.4100 -0.4193
DENS   16.9880  15.8602  17.0955  0.0072  0.0085  0.0074  0.0082
NONW   18.8360  18.0960  13.2945  1.1536  1.3757  1.1988  1.3323
WWDRK  -2.5408   0.0000   0.0000 -0.3659 -0.3302 -0.3602 -0.3384
POOR   -1.7114   0.0000   0.0000  0.4566  0.4549  0.4576  0.4564
HC    -59.1364   0.0000   0.0000 -0.0153 -0.0179 -0.0158 -0.0173
NOX    54.6550   0.0000   0.0000 -0.0012  0.0012 -0.0007  0.0007
SOx    10.3891  16.3166  17.6953  0.1464  0.1730  0.1520  0.1680
HUMID  -3.6143   0.0000   0.0000  0.3401  0.3857  0.3514  0.3792
NORM   92.1202  40.3912  37.5363 27.8533 28.6081 28.1356 28.5900
RMSE   56.7118  56.3638  58.2911 54.9497 53.4939 54.6137 53.7420

bestglm documentation built on March 26, 2020, 7:25 p.m.