Going Beyond Linear Regression: Ita Cirovic Donev
Going Beyond Linear Regression: Ita Cirovic Donev
regression
GENERALIZED LINEAR MODELS IN PYTHON
salary = β0 + β1 × experience + ϵ
y = β0 + β1 x1 + ϵ
salary = β0 + β1 × experience + ϵ
y = β0 + β1 x1 + ϵ
where:
y - response variable (output)
salary = β0 + β1 × experience + ϵ
y = β0 + β1 x1 + ϵ
where:
y - response variable (output)
x - explanatory variable (input)
salary = β0 + β1 × experience + ϵ
y = β0 + β1 x1 + ϵ
where:
y - response variable (output)
x - explanatory variable (input)
β - model parameters
β0 - intercept
β1 - slope
salary = β0 + β1 × experience + ϵ
y = β0 + β1 x1 + ϵ
where:
y - response variable (output)
x - explanatory variable (input)
β - model parameters
β0 - intercept
β1 - slope
ϵ - random error
E[y] = μ = β0 + β1 x1
Assumptions
Linear in parameters
Constant variance
satellite crab ∼ female crab weight
y ~ weight
P (satellite crab is present) = P (y = 1)
Family: Gaussian()
Link: identity
g(μ) = μ = E(y)
Family: Binomial()
Link: logit
Family: Poisson()
Link: logarithm
Link function
Transforms the expected value of y
import statsmodels.api as sm
output ∼ input(s)
-1 : remove intercept
x1:x2 : an interaction term between x1 and x2
0 0.029309
1 0.470299
2 0.834983
3 0.972363
4 0.987941