KingDan - 3 months ago 30

R Question

I have produced a linear data set and have used

`lm()`

`mse()`

I know the formula for MSE but I'm trying to use this function. What would be the proper way to do so? I have looked at the documentation, but I'm either dumb or it's just worded for people who actually know what they're doing.

`library(hydroGOF)`

x.linear <- seq(0, 200, by=1) # x data

error.linear <- rnorm(n=length(x.linear), mean=0, sd=1) # Error (0, 1)

y.linear <- x.linear + error.linear # y data

training.data <- data.frame(x.linear, y.linear)

training.model <- lm(training.data)

training.mse <- mse(training.model, training.data)

plot(training.data)

`mse()`

`lm()`