Site icon R-bloggers

Example of linear regression and regularization in R

[This article was first published on R - Data School, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

When getting started in machine learning, it’s often helpful to see a worked example of a real-world problem from start to finish. But it can be hard to find an example with the “right” level of complexity for a novice. Here’s what I look for:

My linear regression example

In my Data Science class, we were assigned to perform linear regression on a dataset based on Kaggle’s Job Salary Prediction competition. I posted my solution on RPubs, and thought it might be helpful as a regression example for other machine learning novices. Here’s what my solution entails:

Please check it out, and let me know what you think! You can also run the code yourself if you download the data files into your working directory in R.

I’m happy to answer your questions! I admit that I didn’t include nearly enough explanation for someone who is unfamiliar with these techniques, though I hope you find it useful in any case.

Publishing your own document to RPubs

If you’ve never used RPubs, it’s an easy (and free) way to publish “R Markdown” documents directly from RStudio. It allows you to weave together your code, output (including plots), and explanation (written in standard Markdown) into a single document. Here’s how to get started with R Markdown, and how to publish to RPubs.

To leave a comment for the author, please follow the link and comment on their blog: R - Data School.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.