I am trying to use the function cv.glm but it returns an error that the function was not found. How can I fix this problem?
rm(list = ls())
cat("\014")
set.seed(7)
x=rnorm(150)
y=x-2*x^2 rnorm(150)
Data <- data.frame(x, y)
fit.glm.1 <- glm(y ~ x)
a <- cv.glm(Data, fit.glm.1)$delta[1]`
CodePudding user response:
Do you mean removing the ` ?
Lets try a <- cv.glm(Data, fit.glm.1)$delta[1]
?
:-)Your code works well
CodePudding user response:
It did not work I corrected but still having errors
rm(list = ls())
cat("\014")
set.seed(7)
x=rnorm(150)
y=x-2*x^2 rnorm(150)
Data <- data.frame(x, y)
fit.glm.1 <- glm(y ~ x)
a <- cv.glm(Data, fit.glm.1)$delta[1]
Error in cv.glm(Data, fit.glm.1) : could not find function "cv.glm"