I want to check accuracy of what i predicted using linear regression.
I'm using R studio and R.
I want to use the accuracy function, however it keeps giving me:
Error: could not find function "accuracy"
I have done the following:
install.packages("forecast")
install.packages("zoo")
library("forecast")
library("zoo")
I installed the required packages, but i still get the same result, what is the issue here, and what goes wrong?
Code:
install.packages("forecast")
install.packages("zoo")
library("forecast")
library("zoo")
linearRegression2 <- lm(formula = Average.Cost.for.two ~ Aggregate.rating, data = avgCostData)
summary(linearRegression2)
newData2 <- data.frame(Aggregate.rating = c(3))
predictAvgCost2 <- predict(linearRegression2, newData2)
predictAvgCost2
accuracy(predictAvgCost2,avgCostData)