Extracting coefficients from glm()
Sometimes, we specifically care about model coefficients and their confidence intervals.
The coef()
function extracts coefficients and confint()
extracts the confidence intervals.
These functions work the same for both linear and generalized linear models.
The GLM you fit in the previous exercise (poisson_out
) has been loaded for you.
This is a part of the course
“Generalized Linear Models in R”
Exercise instructions
- Using
coef()
, extract the regression coefficients frompoisson_out
. - Using
confint()
, extract the confidence intervals for the regression coefficients frompoisson_out
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Extract the regression coefficients
___
# Extract the confidence intervals
___
This exercise is part of the course
Generalized Linear Models in R
The Generalized Linear Model course expands your regression toolbox to include logistic and Poisson regression.
This chapter teaches you how generalized linear models are an extension of other models in your data science toolbox. The chapter also uses Poisson regression to introduce generalize linear models.
Exercise 1: Limitations of linear modelsExercise 2: Assumptions of linear modelsExercise 3: Refresher on fitting linear modelsExercise 4: Poisson regressionExercise 5: Fitting a Poisson regression in RExercise 6: Comparing linear and Poisson regressionExercise 7: Intercepts-comparisons versus meansExercise 8: Basic lm() functions with glm()Exercise 9: Applying summary(), print(), and tidy() to glmExercise 10: Extracting coefficients from glm()Exercise 11: Predicting with glm()What is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.