Posts

Overall Car Performance Analysis Using R and Python

Image
 By Shivathmica The mtcars dataset's goal is to investigate the performance of various cars. The collection includes details on 32 distinct automobiles, such as their weight, size, horsepower, fuel economy, and other performance specs. Linear Regression: A straight line is used to depict the relationship between variables in a regression model called linear regression. In this example, regression analysis was used to find out whether the car's weight will have impact on the miles per (gallon) it can travel. Code: library(readxl) mtcars <- read_excel("C:/Users/HP/Desktop/mtcars.xlsx", col_names = TRUE) x<-mtcars$wt y<-mtcars$mpg n<- nrow (mtcars) xmean <- mean(mtcars$wt) ymean <- mean(mtcars$mpg) xiyi <- x * y numerator <- sum(xiyi) - n* xmean * ymean denominator <- sum(x^2)- n* (xmean^2) bl <- numerator / denominator b0 <- ymean - bl * xmean bl b0 model_mtcars <- lm(mtcars$wt ~ mtcars$mpg) model_mtcars call: lm(formula = mtcars$wt...