Recently Published
homework 4 draft
error code
```{r}
confusionMatrix(data = tr_predcl,
model.dat2train$usecondom,
positive = "1" )
```
Which produces the same accuracy, but decreases the sensitivity at the cost of increased specificity.
Next we do this on the test set to evaluate model performance outside of the training data
```{r}
pred_test<-predict(glm1,
newdata=model.dat2test,
type="response")
pred_cl<-factor(ifelse(pred_test > mean( I(model.dat2test$usecondom==1)), 1, 0))
table(model.dat2test$usecondom,pred_cl)
confusionMatrix(data = pred_cl,model.dat2test$usecondom)
```
In the test data, the model does about as well as it did on the training data, which is ideal.
Homework 1
C. Sparks class
Stats 2
HW 7
7