Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to...
Transcript of Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to...
![Page 1: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/1.jpg)
Model Linear Terampat(Generalized Linear Model / GLM)
Dr. Kusman Sadik, M.Si
Departemen Statistika IPB, 2017/2018
![Page 2: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/2.jpg)
2
Function: The structure of the association between the
variables (e.g., linear or some other function).
Parameters: How a change in a predictor variable, X, is
expected to affect an outcome variable, Y.
Partial parameters: How a change in one of the predictor
variables affects the outcome variable while controlling for
the effects of other predictor variables included in the model.
Smooth prediction: What the expected (or predicted) value of
the outcome variable might be for any given values of the
predictor variables.
![Page 3: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/3.jpg)
3
The random component : refers to the distribution of the
outcome variable (Y);
The systematic component : refers to the predictor
variables (X);
The link function : refers to the way in which the outcome
variable (or, more specifically, its expected value) is
transformed so that a linear relationship can be used to
model the association between the predictors (X) and the
transformed outcome.
![Page 4: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/4.jpg)
4
The random component of a GLM is the probability
distribution that is assumed to underlie the dependent or
outcome variable.
When the outcome or response variable is continuous, such
as in simple linear regression or analysis of variance
(ANOVA), we typically assume that the normal distribution is
the random component.
When the dependent or outcome variable is categorical it can
no longer be assumed that its values in the population are
normally distributed.
![Page 5: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/5.jpg)
5
The systematic component of a GLM consists of the
independent, predictor, or explanatory variables (X)
that a researcher hypothesizes will predict (or explain)
differences in the dependent or outcome variables.
These variables are combined to form the linear
predictor, which is simply a linear combination of the
predictors
![Page 6: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/6.jpg)
6
The key to GLMs is to “link” the random and systematic
components of the model with some mathematical
function, call it g(.), such that this function of the
expected value of the outcome can be properly modeled
using the systematic component:
The link function is the mathematical function that is
used to transform the dependent or outcome variable so
that it can be modeled as a linear function of the
predictors.
![Page 7: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/7.jpg)
7
In this case, the predicted or expected outcome, E(Y),
does not need to be transformed to be linearly related to
the predictor.
More technically, if g(.) represents the link function, the
transformation of E(Y) by g in this case is g(E(Y)) = E(Y).
This is referred to as the identity link function because
applying the g(.) function of E(Y) in this case results in
the same value, E(Y).
![Page 8: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/8.jpg)
8
For example, suppose that the outcome variable was the
probability that a student will pass (as opposed to fail) a
specific test, so the predicted value is E(Y) = π.
Transformation:
This particular link function (or transformation) is called the
logit link function, and the resulting GLM is called the logistic
regression model.
![Page 9: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/9.jpg)
9
When the outcome variable is a count variable, and thus the
random component is assumed to follow a Poisson
distribution.
The outcome variable is a count so by definition it cannot be
lower than zero, but if a linear regression model was fit using
the untransformed outcome, nonsensical negative values
could theoretically result as predictions for low values of X.
On the other hand, when the predicted outcome, E(Y), is
transformed using the natural log function,
![Page 10: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/10.jpg)
10
This particular transformation is called the log link function
and this model is called the Poisson regression model.
The log function typically works well with outcome variables
that represent counts or a random component that follows a
Poisson distribution.
Another GLM that uses the log link function is the log-linear
model, in which the predictor variables are typically
categorical and the outcome variable, rather than
representing yet another, separate variable, is the count or
frequency obtained in each of the categories of the
predictors.
![Page 11: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/11.jpg)
11
![Page 12: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/12.jpg)
12
a. Install Program R versi terbaru.
b. Membaca input data dalam format : txt, excel, csv, dsb.
c. Deskripsi data melalui tabel dan grafik untuk data
kategorik: histogram, x-y plot, tabel frekuensi, tabel
kontingensi, dsb.
d. Deskripsi data secara numerik untuk data kategorik: kuartil,
persentil, dsb.
e. Gunakan data pada Tabel 1 (terlampir) untuk mengerjakan
poin b, c, dan d tersebut.
![Page 13: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/13.jpg)
13
Responden J.Kelamin T.Pendidikan T.Pendapatan
1 1 1 4
2 1 3 6
3 1 2 4
4 1 2 5
5 1 4 4
6 1 4 1
7 1 3 3
8 0 4 3
9 1 1 5
10 1 2 5
11 1 2 2
12 1 3 5
13 0 4 5
14 1 4 4
15 1 3 3
16 1 3 4
17 0 4 4
18 1 1 6
19 1 2 3
20 0 4 3
21 1 1 6
22 1 1 2
23 1 3 3
24 1 1 5
25 1 2 3
Responden J.Kelamin T.Pendidikan T.Pendapatan
26 1 2 3
27 0 2 5
28 1 3 2
29 1 1 6
30 1 4 2
31 1 2 3
32 1 1 4
33 1 3 2
34 1 1 6
35 1 3 1
36 1 2 4
37 1 1 3
38 1 4 1
39 1 4 5
40 0 4 1
41 1 4 6
42 1 2 4
43 0 2 2
44 1 1 1
45 1 2 4
46 0 4 3
47 0 2 3
48 1 4 5
49 1 1 5
50 1 1 1
![Page 14: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/14.jpg)
14
Pustaka
1. Azen, R. dan Walker, C.R. (2011). Categorical Data
Analysis for the Behavioral and Social Sciences.
Routledge, Taylor and Francis Group, New York.
2. Agresti, A. (2002). Categorical Data Analysis 2nd. New
York: Wiley.
3. Pustaka lain yang relevan.
![Page 15: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/15.jpg)
15
Bisa di-download di
kusmansadik.wordpress.com
![Page 16: Model Linear Terampat - kusmansadik.files.wordpress.com file08.02.2017 · The key to GLMs is to “link” the random and systematic components of the model with some mathematical](https://reader031.fdocuments.us/reader031/viewer/2022011809/5d55bbb788c99329498b97dc/html5/thumbnails/16.jpg)
16
Terima Kasih