Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Predictive Analytics with R

You're reading from   Mastering Predictive Analytics with R Master the craft of predictive modeling by developing strategy, intuition, and a solid foundation in essential concepts

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781783982806
Length 414 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Gearing Up for Predictive Modeling 2. Linear Regression FREE CHAPTER 3. Logistic Regression 4. Neural Networks 5. Support Vector Machines 6. Tree-based Methods 7. Ensemble Methods 8. Probabilistic Graphical Models 9. Time Series Analysis 10. Topic Modeling 11. Recommendation Systems Index

Assessing linear regression models

We'll proceed once again with using the lm() function to fit linear regression models to our data. For both of our data sets, we'll want to use all the input features that remain in our respective data frames. R provides us with a shorthand to write formulas that include all the columns of a data frame as features, excluding the one chosen as the output. This is done using a single period, as the following code snippets show:

> machine_model1 <- lm(PRP ~ ., data = machine_train)
> cars_model1 <- lm(Price ~ ., data = cars_train)

Training a linear regression model may be a one-line affair once we have all our data prepared, but the important work comes straight after, when we study our model in order to determine how well we did. Fortunately, we can instantly obtain some important information about our model using the summary() function. The output of this function for our CPU data set is shown here:

> summary(machine_model1)

Call...
You have been reading a chapter from
Mastering Predictive Analytics with R
Published in: Jun 2015
Publisher:
ISBN-13: 9781783982806
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image