Feverish123
Feverish123

Reputation: 115

Finding RMSE for predicted values

I am trying to find the RMSE model of the predicted values for log(price) and log(lotSize) by using the dataset SaratogoaHouses in the library(mosiacData). lotSize has two values equal to 0, which will produce -infinity when you take the log. Remove these rows from the data

This is what I have so far but I get an error:

install.packages("mosaicData")
library(mosaicData)
data("SaratogaHouses")

model = predict(lm(log(price)~log(livingArea),data = SaratogaHouses))

x <- summary(model)

x$sigma

Error in x$sigma : $ operator is invalid for atomic vectors

Upvotes: 0

Views: 159

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 388797

You need to take summary of the model and not the predicted values. Try :

model <- lm(log(price)~log(livingArea),data = SaratogaHouses)
predicted_values <- predict(model)
x <- summary(model)
x$sigma
#[1] 0.3298453

Upvotes: 1

Related Questions