---------------------------------------------------------------------------------------------------------------------------
name: <unnamed>
log: C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\fall_2021_logs\class13.log
log type: text
opened on: 1 Nov 2021, 09:57:31
. search medeff
. which medeff
c:\ado\plus\m\medeff.ado
.
. *class starts here. Let’s look at 2 models from the Excel sheet LRT page, Models M2 and M3.
. logit married age age_sq if age>16
Iteration 0: log likelihood = -67581.342
Iteration 1: log likelihood = -59611.157
Iteration 2: log likelihood = -59606.232
Iteration 3: log likelihood = -59606.232
Logistic regression Number of obs = 99,215
LR chi2(2) = 15950.22
Prob > chi2 = 0.0000
Log likelihood = -59606.232 Pseudo R2 = 0.1180
------------------------------------------------------------------------------
married | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
age | .2399034 .0021659 110.76 0.000 .2356583 .2441486
age_sq | -.0022193 .0000215 -103.23 0.000 -.0022614 -.0021771
_cons | -5.263343 .0493725 -106.60 0.000 -5.360112 -5.166575
------------------------------------------------------------------------------
. logit married age age_sq yrsed if age>16
Iteration 0: log likelihood = -67581.342
Iteration 1: log likelihood = -59455.156
Iteration 2: log likelihood = -59450.943
Iteration 3: log likelihood = -59450.942
Logistic regression Number of obs = 99,215
LR chi2(3) = 16260.80
Prob > chi2 = 0.0000
Log likelihood = -59450.942 Pseudo R2 = 0.1203
------------------------------------------------------------------------------
married | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
age | .23473 .0021882 107.27 0.000 .2304412 .2390188
age_sq | -.0021575 .0000218 -99.05 0.000 -.0022002 -.0021148
yrsed | .0404459 .0022919 17.65 0.000 .0359539 .0449379
_cons | -5.698349 .0557695 -102.18 0.000 -5.807655 -5.589043
------------------------------------------------------------------------------
. *calculating the LRT between the models:
. display 16260.80-15950.22
310.58
* The chisquare stat is 310.58 on 1 df. And the probability of this is:
. display chi2tail(1,310.58)
1.633e-69
. *calculating the BIC between the models. First calculate the BIC.
. display -310.58+(1*ln(99215))
-299.07496
. * BIC test strongly also prefers the second model with the extra term because BIC <-10.
. *Bayes factor of M3 compared to M2:
. display exp(-(-299.07)/2)
8.754e+64
. * To generate a BIC P value of the kind we are used to, in this case would be P value of M2 compared to M3:
. display 1/(8.754e+64+1)
1.142e-65
. clear all
. use "C:\Users\mexmi\Documents\current class files\intro soc methods\GSS_subset_200610_panel.dta"
* A quick look at the GSS panel data for HW4:
. tabulate year marhomo_approve, row col
+-------------------+
| Key |
|-------------------|
| frequency |
| row percentage |
| column percentage |
+-------------------+
year_1: |
gss year |
for this | homosexuals should have the right to marry
respondent | strongly disagree neither a agree strongly | Total
-----------+-------------------------------------------------------+----------
2006 | 478 222 180 259 208 | 1,347
| 35.49 16.48 13.36 19.23 15.44 | 100.00
| 44.42 42.05 40.54 39.24 39.54 | 41.65
-----------+-------------------------------------------------------+----------
2008 | 336 168 153 207 169 | 1,033
| 32.53 16.26 14.81 20.04 16.36 | 100.00
| 31.23 31.82 34.46 31.36 32.13 | 31.94
-----------+-------------------------------------------------------+----------
2010 | 262 138 111 194 149 | 854
| 30.68 16.16 13.00 22.72 17.45 | 100.00
| 24.35 26.14 25.00 29.39 28.33 | 26.41
-----------+-------------------------------------------------------+----------
Total | 1,076 528 444 660 526 | 3,234
| 33.27 16.33 13.73 20.41 16.26 | 100.00
| 100.00 100.00 100.00 100.00 100.00 | 100.00
* To download the medeff package which is required for one part of HW4 Q3, type this and then click on the top link and then the link to install:
search medeff
. log close
name: <unnamed>
log: C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\fall_2021_logs\class13.log
log type: text
closed on: 1 Nov 2021, 13:57:58
---------------------------------------------------------------------------------------------------------------------------