Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mean_presc deprivation
- count 202.000000 202.000000
- mean 1.108072 106.306931
- std 0.139628 60.217804
- min 0.641107 1.000000
- 25% 1.033221 54.250000
- 50% 1.119174 107.500000
- 75% 1.206066 158.750000
- max 1.449776 209.00000
- mean_presc deprivation
- 0 1.074778 121
- 1 1.209622 144
- 2 1.106975 193
- 3 1.098038 16
- 4 0.906051 136
- y=depr_mean["mean_presc"]
- X=depr_mean["deprivation"]
- model = sm.OLS(y,X).fit()
- print (model.summary())
- > OLS Regression Results
- ==============================================================================
- Dep. Variable: mean_presc R-squared: 0.716
- Model: OLS Adj. R-squared: 0.715
- Method: Least Squares F-statistic: 507.8
- Date: Wed, 20 Jun 2018 Prob (F-statistic): 6.50e-57
- Time: 22:46:44 Log-Likelihood: -181.65
- No. Observations: 202 AIC: 365.3
- Df Residuals: 201 BIC: 368.6
- Df Model: 1
- Covariance Type: nonrobust
- ===============================================================================
- coef std err t P>|t| [0.025 0.975]
- -------------------------------------------------------------------------------
- deprivation 0.0077 0.000 22.535 0.000 0.007 0.008
- ==============================================================================
- Omnibus: 29.635 Durbin-Watson: 1.541
- Prob(Omnibus): 0.000 Jarque-Bera (JB): 7.996
- Skew: 0.065 Prob(JB): 0.0184
- Kurtosis: 2.034 Cond. No. 1.00
- ==============================================================================
- Warnings:
- [1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
- library (dplyr)
- depr_mean<-read.csv("depr_mean.csv")
- summary (depr_mean)
- X mean_presc deprivation
- Min. : 0.00 Min. :0.6411 Min. : 1.00
- 1st Qu.: 50.25 1st Qu.:1.0332 1st Qu.: 54.25
- Median :100.50 Median :1.1192 Median :107.50
- Mean :100.50 Mean :1.1081 Mean :106.31
- 3rd Qu.:150.75 3rd Qu.:1.2061 3rd Qu.:158.75
- Max. :201.00 Max. :1.4498 Max. :209.00
- head(depr_mean)
- X mean_presc deprivation
- 0 1.0747779 121
- 1 1.2096218 144
- 2 1.1069754 193
- 3 1.0980376 16
- 4 0.9060512 136
- 5 1.2064052 39
- model_pgr <- lm (mean~IMD, data=depr_desc)
- summary (model_pgr)
- Call:
- lm(formula = mean ~ IMD, data = depr_desc)
- Residuals:
- Min 1Q Median 3Q Max
- -0.49150 -0.05094 0.01817 0.08530 0.27441
- Coefficients:
- Estimate Std. Error t value Pr(>|t|)
- (Intercept) 1.1779952 0.0191975 61.362 < 2e-16 ***
- IMD -0.0006578 0.0001572 -4.184 4.29e-05 ***
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- Residual standard error: 0.1342 on 200 degrees of freedom
- Multiple R-squared: 0.08047, Adjusted R-squared: 0.07587
- F-statistic: 17.5 on 1 and 200 DF, p-value: 4.294e-05
Add Comment
Please, Sign In to add comment