Question: Hypothesis testing We'll comment briefly on hypothesis testing. Model summaries include results of t-tests for single coefficients, and are the standard way of assessing statistical
Hypothesis testing We'll comment briefly on hypothesis testing. Model summaries include results of t-tests for single coefficients, and are the standard way of assessing statistical significance. Testing multiple coefficients is somewhat more complicated. A useful approach is to use nested models, meaning that the terms in a simple "null" model are a subset of the terms in a more complex "alternative" model. The are formal tests for comparing the null and alternative models, even when several coefficients are added in the alternative model. Tests of this kind are required to assess the significance of a categorical predictor with more than two levels, as in the example below. fit_null = lm(price ~ stars + borough, data = nyc_airbnb) fit_alt = lm(price ~ stars + borough + room_type, data = nyc_airbnb) The test of interest is implemented in the anova() function which, of course, can be summarized using broom::tidy(). anova(fit_null, fit_alt) |> broom::tidy() Note that this works for nested models only. Comparing non-nested models is a common problem that requires other methods; we'll see one approach in cross validation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
