Non linear regression Flashcards
Detecting non- linearity
Plot residual from linear regression against fitted values -> there should be no pattern in the residuals (e.g. funnell)
Normal quantile plot
Assumptions
Same (except does not assume linear relationsip)
What to do it data is not linear
1) Transform X or Y
- Log-transformation = most versatile = good if Y is related to X by a power
- Reciprocal 1/x
- Square root transformation √x – usually for count data
- Arcsine – for proportions
- Raise x to a power xn
- Box-Cox - makes data normal
2) Check whether other models fit (piecewise linear, polynomial, piecewise polynomical, use models that assume a different disitribution like logistic regression)
3) predict response from explanaotry
Non- Linear regression overview
predicts the values of a response variable from values of an explanatory variable.
It fits a non-linear model to data (many different models) -> many options
Calculations to minimise distance between observations and predictions.
Piece wise linear models
Fits different linear models to different sections of data
knots / switch points are when gradient changes (although assumes lines are linear between knots
Polynomials (e.g. quadratic)
y= mx+nx^2+/-c
Can also do piecewisr polynomial models
Can use ANOVA table + partition variation by linear, quadratic and error components to determine which components explain significant proportions of the variation (eg. here is linear + quadratic)
Different distributions
Til now we have assumed we want to fit models assuming a normal disitrbution -> may not be the case
Poisson disitrbution
-> Used for count data
-> It gives the probability of an event happening a certain number of times (k) within a given interval of time or space
Binomial disitrbution
-> Used for proportion data (fixed between O and 1)
Exponential disitrbution
-> Used for survival data
Tranformations
- Instead of choosing a non-linear model, we could transform the data to make it linear.
Dealing with binary data
Either:
- Binary data can be fitted with a logistic regression model.
- Logistic regression predicts the probability of occurrence of a binary variable as a function of a continuous numerical variable.
- Binary data can be tranformed using the logs odds ratio and a linear model can be fitted.
- Linear model can be back tranformed so that occurance data can be predicted.