Skip to content

23241a6749/R-Regression-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š R You Ready for Regression?

This project is my submission for the "R You Ready for Regression" AI/ML challenge. It demonstrates how to perform simple linear regression using R on two classic built-in datasets: mtcars and iris.


πŸ“ Files

  • regression_analysis.R – R script for data analysis and plotting
  • plot_mtcars.png – Regression of MPG vs Weight (mtcars)
  • plot_iris.png – Regression of Petal Length vs Petal Width (iris)

πŸ“Œ Dataset 1: mtcars

Model: mpg ~ wt

  • Predicts Miles per Gallon (mpg) from Weight (wt)
  • Shows a negative relationship: as weight increases, MPG decreases

Sample Output:

Call: lm(formula = mpg ~ wt, data = mtcars)

Coefficients: (Intercept) wt 37.285 -5.344


πŸ“Œ Dataset 2: iris

Model: Petal.Length ~ Petal.Width

  • Predicts Petal Length based on Petal Width
  • Strong positive correlation: wider petals tend to be longer

Sample Output:

Call: lm(formula = Petal.Length ~ Petal.Width, data = iris)

Coefficients: (Intercept) Petal.Width 1.084 2.229


πŸ–ΌοΈ Plots

MPG vs Weight (mtcars)

mtcars

Petal Length vs Petal Width (iris)

iris


▢️ How to Run

Make sure R is installed on your system. Then run the following command in your terminal or RStudio:

Rscript regression_analysis.R

This will:

  • Print model summaries in the console
  • Save the plots as:
    • plot_mtcars.png
    • plot_iris.png

πŸ“š Libraries Used

  • ggplot2 – for creating regression plots

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages