[SOLVED] CS # BS1033 Lecture 1 Analysis Part 2

$25

File Name: CS_#_BS1033_Lecture_1_Analysis_Part_2.zip
File Size: 348.54 KB

5/5 - (1 vote)

# BS1033 Lecture 1 Analysis Part 2
# Author: Chris Hansman
# Email: [email protected]
# Date : 07/01/20

# Installing Packages
#install.packages(tidyverse)

# Loading Libraries
library(tidyverse)

# Loading Ames Data
#Reading Data
ames_training<-read_csv(“ames_training.csv”)ames_testing<-read_csv(“ames_testing.csv”)#Scatter Plotggplot(data = ames_training ) + geom_point(aes(x = Year.Built, y = log_price))#Building Simple Linear Modelames_model_1 <- lm(log_price ~ Year.Built, data=ames_training)summary(ames_model_1)#Predicting and Computing Mean Squared Errorlog_price_pred1=predict(ames_model_1, newdata=ames_testing)model_1_mse <- mean((log_price_pred1-ames_testing$log_price)^2)#Scaling Variables # Scaling xols_basics_scale <- ols_basics %>%
mutate(X_over_12=X/12) %>%
mutate(Y_times_1000=Y*1000)

# Basic Regression
ols_v1<-lm(Y~X, data= ols_basics)# Scaled Xols_v2<-lm(Y~X_over_12, data= ols_basics_scale)# Scaled Yols_v3<-lm(Y_times_1000~X, data= ols_basics_scale)# Summarizing Allsummary(ols_v1)summary(ols_v2)summary(ols_v3)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS # BS1033 Lecture 1 Analysis Part 2
$25