You are on page 1of 1

Experiment No 10

Aim:
Classification Model
a. Install relevant package for classification.
b. Choose classifier for classification problem.
c. Evaluate the performance of classifier.

Code:
# Load necessary libraries
library(ggplot2)

# Load the USArrests dataset


data(USArrests)

# Perform linear regression


linear_model <- lm(Murder ~ UrbanPop + Rape, data = USArrests)

# Create a scatter plot


scatter_plot <- ggplot(USArrests, aes(x = UrbanPop, y = Murder)) +
geom_point() + # Add points
geom_smooth(method = "lm", se = FALSE, color = "blue") # Add regression line

# Print the scatter plot

print(scatter_plot)

Conclusion:
The linear regression model indicates how the Murder rate is related to UrbanPop
(percentage of urban population) and Rape rate. The model's summary provides
information about coefficients, their significance, and the overall fit of the model.

You might also like