Created
December 22, 2020 09:25
-
-
Save darioappsilon/210f00c5ec06f53265879d64eb740c3f to your computer and use it in GitHub Desktop.
004_linear_regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(caTools) | |
| set.seed(42) | |
| # Train/Test split in 70:30 ratio | |
| sample_split <- sample.split(Y = df$Weight, SplitRatio = 0.7) | |
| train_set <- subset(x = df, sample_split == TRUE) | |
| test_set <- subset(x = df, sample_split == FALSE) | |
| # Fit the model and obtain summary | |
| model <- lm(Weight ~ ., data = train_set) | |
| summary(model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment