I just can't figure out what is wrong with my code. I fitted a logistic regression model with this dataset:
outcome predictor
1 0 -3
2 0 -4
3 1 0
4 1 -1
5 1 0
6 0 -3
I fitted this model:
model <- glm(data$outcome~data$predictor, family = "binomial")
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.01437719 0.07516923 -0.1912644 8.483185e-01
pvalue.us 0.19469804 0.03110934 6.2585081 3.886777e-10
Then I want to make predictions using this vector:
test
[1] -2 -5 0 -3 2 -3
predict(model, newdata = test)
And I get this error:
Error in eval(predvars, data, env) :
numeric 'envir' arg not of length one
What is wrong?