In this video we will illustrate how to fit a logistic model in R. So I'm going to use the same data set that we've seen before, this academic performance data set that comes bundled with the R survey package. We will look at a logistic model to predict whether a school met the target for school-wide growth in the API score. Now in other words, did they improve their scores compared to the previous year? And then we will see how to test whether subset of coefficients is zero, the same way we did in the linear model. And we'll also look at odds ratios for a categorical predictor to see how that goes. So there's a number of variables in the API dataset and here are the ones that we're going to deal with in this illustration. School, sch.wide, is just an indicator, did the school meet the growth target? No or yes. ell, meals, mobility we’ve met before in previous videos. Enrollment is the number of students enrolled in the school. hsg is the percentage of parents who are high-school grads, the more educated the parents, the better the students may be doing. Then there's col.grad, that's percentage of parents with college degree. And then also there's an indicator, yes or no, for whether the school is a year-round school or not. Do they take off in the summer or do they go 12 months during the year? So here's the R code. Now some of this we've seen before just to get going. We require the package, tell it what data we're going to use, and then create a design object. Those statements we've seen before. We, once again, use the svyglm function to fit the model. This is the same function we used for the linear model. So we set up a formula here for, School-wide as predicted based on all the variables in that last table. And the thing that's different here is we use the family parameter, so we specify that as quasibinomial link = logit. That leads to logistic regression. If you put probit in here then you get probit, and cloglog would give you complimentary log-log. So here's the output. I do a summary on m2, which is where I saved the model result. And what have we got? We've got one variable, enrollment, highly significant. We've got two here that are significant at the 10% level, mobility and percent college graduates. So the other things, though, don't appear to be that important. Year-round school, close to 10% level significance but doesn't quite make it. And then the other things are test that is being fairly different from 0. Or not testing out is being fairly different from 0. Now we can test a subset of coefficients the same way we did in the linear model using the regTermTest function. So I specify in my model here, after tilde I specify the set of parameters I want to test. So I'm doing English language learners percentage with subsidized meals and percent of parents with high school grads. And I want to do a Wald test on that. So It echoes back what I ask it to do and gives me the F statistic as 0.2395 on 2 and 190 degrees of freedom. p value is 0.8686, so that's highly non-significant. So it looks like the evidence is pointing to all three of those parameters simultaneously being 0 in this model. So in the next video we'll follow up with how to estimate odds ratios in a logistic model.