R FOR SOCIAL SCIENCES AND HUMANITIES�Prof. Mbe Egom Nja �Dept. Statistics�University of Calabar.�nja@uncial.edu.ng�+2347036507635
R for social sciences
CLASSICAL LINEAR REGRESSION
Where is the estimate or predicted value of the response variable. The x’s are the independent variables, the ’s are parameter estimates.
Example:
In the linear regression model below:
= 0.8 + 3x1 + 2x2
3( the coefficient of x1) is the number of times y will increase if x1 increases by 1 unit
vtd | 3 | 1 | 5 | 4 | 6 | 1 | 2 | 7 | 4 |
Age | 16 | 40 | 19 | 20 | 21 | 38 | 20 | 19 | 25 |
IQ | 135 | 120 | 142 | 100 | 110 | 140 | 145 | 114 | 137 |
vtd | 3 | 6 | 4 | 3 | 5 | 5 | |
Age | 24 | 36 | 22 | 18 | 35 | 23 | |
IQ | 106 | 100 | 147 | 143 | 138 | 117 |
Data entry in R
Creating a data frame
Model summary
LOGISTIC REGRESSION
LOGISTICS REGRESSION: DICHOTOMOUS (BINARY)�RESPONSE:
The Model:
The logistic regression model is usually applied in a cross classification data situation. See the example below:
Table Leadership Style data
S/N | Gender | Family type | Leadership Status Corrupt Not Corrupt |
Total | |
1 | Male | Rich | 9 | 4 | 13 |
2 | Male | Poor | 13 | 6 | 19 |
3 | Female | Rich | 9 | 7 | 16 |
4 | Female | Poor | 5 | 7 | 12 |
TOTAL | 60 |
Excel raw sheet
Excel raw sheet
Excel raw sheet
Imported data from Excel
Imported data from Excel
Data Structure
Test and training of data
logistic regression model / summary of dataset
Summary of data
Summary of data
ODDS RATIO
This means that females are 2.4 times more likely to be more corrupt than males when occupying public positions, going by this illustrative example.
This may not be true in real life.
THANK YOU