## Monday, February 8, 2016

### 1. Summary

1) what you found, making sure you discuss the results for the associations between all of your explanatory variables and your response variable. Make sure to include statistical results (odds ratios, p-values, and 95% confidence intervals for the odds ratios) in your summary.

After adjusting for potential confounding factors (Nicotine dependency, social phobia), the odds of being a male were more than two times higher for participants with major depression than for participants without major depression (OR=1.69, 95% CI = 1.31-2.20, p<.0001).
Panic was also significantly associated with being male, such that participants with panic problems were significantly more likely to be males (OR= 1.51, 95% CI=1.1-2.09, p=.011).
Luckily the Model

My primary hypothesis that Males are more likely to have major life depressions is supported by the model
3) Discuss whether or not there was evidence of confounding for the association between your primary explanatory and the response variable (Hint: adding additional explanatory variables to your model one at a time will make it easier to identify which of the variables are confounding variables).

There was no evidence of confounders

### 2. the output from your logistic regression model.

```                           Logit Regression Results
==============================================================================
Dep. Variable:                   SEXO   No. Observations:                 1320
Model:                          Logit   Df Residuals:                     1317
Method:                           MLE   Df Model:                            2
Date:                Mon, 08 Feb 2016   Pseudo R-squ.:                 0.01697
Time:                        09:49:06   Log-Likelihood:                -899.14
converged:                       True   LL-Null:                       -914.66
LLR p-value:                 1.817e-07
================================================================================
coef    std err          z      P>|z|      [95.0% Conf. Int.]
--------------------------------------------------------------------------------
Intercept       -0.1599      0.066     -2.413      0.016        -0.290    -0.030
PANIC            0.4152      0.164      2.529      0.011         0.093     0.737
MAJORDEPLIFE     0.5272      0.132      3.980      0.000         0.268     0.787
================================================================================
Odds Ratios
Lower CI  Upper CI   OR
Intercept         0.75      0.97 0.85
PANIC             1.10      2.09 1.51
MAJORDEPLIFE      1.31      2.20 1.69```

## Sunday, February 7, 2016

### Countries with high Internet use have a high Alcohol Consumption

1. Summarize what you found. Discuss the results for the associations between all of your explanatory variables and your response variable. Make sure to include statistical results (Beta coefficients and p-values) in your summary.

The Study using the Gapminder Dataset shows a correlation between Alcohol and Internet. After controlling for urbanization rate, the a doubling in internet usage accounts for beta=11.5% of Alcohol consumption (p< 0,005). A second order Regression alcconsumption ~ urbanrate_c + I(urbanrate_c**2) + internetuserate_c shows a that 34% of the variability can be explained by the model, R^2=0,343, F statistic= 2.56e-11.

Discuss the results for the associations between all of your explanatory variables and your response variable.

Intercept sayst that Alcohol consumption with average internet use and urbanisation rate (variables are centered) is 8.63 litres (estimated average alcohol consumption, adult (15+) per capita consumption in litres pure alcohol)

urban rate (centered) has a small negative effect ~ -6% on alcohol consumption, but increases the explanatory power about 10% (compare the R^2 of the models with/without control for urbanization)

I(urbanrate_c ** 2) is significant with littel effect (- 0,31%)

```                            OLS Regression Results
==============================================================================
Dep. Variable:         alcconsumption   R-squared:                       0.343
Method:                 Least Squares   F-statistic:                     21.59
Date:                Sun, 07 Feb 2016   Prob (F-statistic):           2.56e-11
Time:                        12:40:28   Log-Likelihood:                -365.20
No. Observations:                 128   AIC:                             738.4
Df Residuals:                     124   BIC:                             749.8
Df Model:                           3
Covariance Type:            nonrobust
=======================================================================================
coef    std err          t      P>|t|      [95.0% Conf. Int.]
---------------------------------------------------------------------------------------
Intercept               8.6291      0.501     17.230      0.000         7.638     9.620
urbanrate_c            -0.0596      0.024     -2.466      0.015        -0.107    -0.012
I(urbanrate_c ** 2)    -0.0031      0.001     -3.980      0.000        -0.005    -0.002
internetuserate_c       0.1149      0.018      6.558      0.000         0.080     0.150
==============================================================================
Omnibus:                        5.219   Durbin-Watson:                   1.972
Prob(Omnibus):                  0.074   Jarque-Bera (JB):                5.213
Skew:                           0.316   Prob(JB):                       0.0738
Kurtosis:                       3.760   Cond. No.                         891.
==============================================================================
```

2. Report whether or not your results supported your hypothesis for the association between your primary explanatory response variable.

The result strongly suggests that there is a correlation between alcohol and internet use. It is both highly statistically significant (p>0,0005) and has an effect of  beta = 11.5%
3. Discuss whether or not there was evidence of confounding for the association between your primary explanatory and response variable.

There is no evidence of confounding since the internet use rate did not lose statistical significance after the addition of urbanization rate as an explanatory variable.

4. Generate regression diagnostic plots and write a few sentences describing what these plots tell you about your regression model in terms of the distribution of the residuals, model fit, influential observations, and outliers.

q-q plot: Residuals are pretty normaly distributed with two outliers on the upper quantiles. This indicates that there is very little systematic error, so probably the model can not be optimized further by adding other variables.

standardized residuals for all observations: We see that most of the residuals are in between two standard deviations. There are few major outliers, so the model captures well the variability in the dataset.

Also, these plots show that the data is pretty normal and explain the response variable well. "Urbanrate" has normally distributed residuals and a well fitting regression line with small negative effect on the response.

leverage plot: The data that has the most influence on the regression outcome has little residuals, which supports our claim that the model fits well the data and has predictive power.