--------------------------------------------------------------------------------------------
log: C:\AAA Miker
Files\newer web pages\soc_388_notes\soc_388_2003\class 8.log
log type: text
opened
on:
. use "C:\AAA Miker
Files\newer web pages\soc_388_notes\70-80-90 MR updated cl7.dta", clear
. keep
meth feth mgen fgen year count
. describe
Contains data from C:\AAA Miker Files\newer web
pages\soc_388_notes\70-80-90 MR updated cl
> 7.dta
obs: 225
vars: 6
size: 6,300 (99.9% of memory free)
-------------------------------------------------------------------------------
storage display value
variable name type
format label variable label
-------------------------------------------------------------------------------
meth str8 %9s
feth str9 %9s
mgen byte
%8.0g
fgen byte %8.0g
year byte %8.0g
count long %12.0g Frequency
-------------------------------------------------------------------------------
Sorted by: year mgen fgen
Note: dataset has changed since last saved
. tabulate meth
meth | Freq. Percent Cum.
------------+-----------------------------------
Blk_NH | 45 20.00
20.00
Mex_Am | 45 20.00 40.00
Oth_H | 45 20.00 60.00
Oth_NH | 45 20.00 80.00
Wht_NH | 45 20.00 100.00
------------+-----------------------------------
Total | 225
100.00
. desmat: poisson count meth feth mgen fgen year
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations: 225
Initial log
likelihood:
-2252613.647
Log
likelihood:
-253644.595
LR chi square:
3997938.105
Model degrees of
freedom:
12
Pseudo
R-squared:
0.887
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect
Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am
-0.591** 0.008
2 Oth_H -1.370** 0.010
3 Oth_NH
-1.730** 0.012
4 Wht_NH
2.505** 0.005
feth
5 Mex_Am
-0.571** 0.008
6 Oth_H
-1.330** 0.010
7 Oth_NH
-1.464** 0.011
8 Wht_NH
2.552** 0.005
mgen
9 2
3.428** 0.007
fgen
10 2 3.462** 0.007
year
11 80
1.680** 0.004
12 90
1.294** 0.004
13 _cons
-1.226** 0.013
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. poisgof
Goodness-of-fit chi2
= 505957.2
Prob > chi2(212) = 0.0000
. *This is the "everything is independent from everything model"
* Note the number of degrees of freedom as (5-1)+(5-1) +(2-1)+(2-1)+(3-1) +1
. predict P_1
(option n assumed; predicted
number of events)
. table meth, contents (sum
count)
----------------------
meth | sum(count)
----------+-----------
Blk_NH | 45681
Mex_Am | 25294
Oth_H | 11609
Oth_NH | 8100
Wht_NH | 559137
----------------------
. table meth, contents (sum P_1)
----------------------
meth | sum(P_1)
----------+-----------
Blk_NH | 45681
Mex_Am | 25294
Oth_H | 11609
Oth_NH | 8100
Wht_NH | 559137
----------------------
. table meth year, contents (sum
count) row col
------------------------------------------
| year
meth | 70 80
90 Total
----------+-------------------------------
Blk_NH | 4759
26972 13950 45681
Mex_Am | 1239
13236 10819 25294
Oth_H | 1445
5459 4705
11609
Oth_NH | 463
4097 3540 8100
Wht_NH | 56997 298483
203657 559137
|
Total | 64903 348247
236671 649821
------------------------------------------
. table meth year, contents (sum
P_1) row col
--------------------------------------------------
| year
meth | 70 80 90
Total
----------+---------------------------------------
Blk_NH | 4562.539 24481.01 16637.46
45681
Mex_Am | 2526.321 13555.36 9212.316
25294
Oth_H | 1159.487 6221.405 4228.108
11609
Oth_NH | 809.014 4340.889
2950.097 8100
Wht_NH | 55845.64 299648.3 203643
559137
|
Total | 64903
348247 236671
649821
--------------------------------------------------
. desmat: poisson count
meth*feth
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log
likelihood:
-676246.840
LR chi
square:
3152733.615
Model degrees of
freedom:
24
Pseudo
R-squared: 0.700
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am
-6.114** 0.103
2 Oth_H
-4.921** 0.057
3 Oth_NH
-6.043** 0.100
4 Wht_NH
-4.236** 0.041
feth
5 Mex_Am
-4.984** 0.059
6 Oth_H
-4.637** 0.050
7 Oth_NH -4.684** 0.051
8 Wht_NH
-3.025** 0.023
meth.feth
9
Mex_Am.Mex_Am
10.244** 0.119
10 Mex_Am.Oth_H
6.510** 0.121
11
Mex_Am.Oth_NH
6.211** 0.125
12
Mex_Am.Wht_NH
7.193** 0.106
13
Oth_H.Mex_Am
5.698** 0.091
14
Oth_H.Oth_H
7.583** 0.076
15
Oth_H.Oth_NH
4.500** 0.098
16
Oth_H.Wht_NH
5.702** 0.063
17
Oth_NH.Mex_Am
6.128** 0.129
18
Oth_NH.Oth_H 5.388** 0.130
19
Oth_NH.Oth_NH
8.232** 0.113
20
Oth_NH.Wht_NH
6.694** 0.103
21
Wht_NH.Mex_Am 7.145** 0.073
22
Wht_NH.Oth_H
6.605** 0.066
23
Wht_NH.Oth_NH
6.876** 0.066
24
Wht_NH.Wht_NH 9.809** 0.046
25 _cons
8.461** 0.005
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. poisgof
Goodness-of-fit chi2
= 1351162
Prob > chi2(200) = 0.0000
*Note in the above model the number of degrees of freedom is 5*5=25. For saturated models,
you just need to know what sized table it fits exactly, and that's how many cells it has.
. desmat meth*feth
Desmat generated the following design matrix:
nr Variables Term Parameterization
First Last
1 _x_1
_x_4 meth
2 _x_5
_x_8 feth
3 _x_9
_x_24 meth.feth
. gen ethintdum=0
. replace ethnintdum=1 if meth==feth
variable ethnintdum not found
r(111);
. replace ethintdum=1 if meth==feth
(45 real changes made)
. desmat: poisson count
meth*mgen*year feth*fgen*year ethintdum
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization: ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log likelihood:
-14085.822
LR chi
square:
4477055.651
Model degrees of
freedom:
57
Pseudo
R-squared:
0.994
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect
Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am 2.065** 0.203
2 Oth_H
1.780** 0.206
3 Oth_NH
1.173** 0.242
4 Wht_NH 2.070** 0.184
mgen
5 2
5.017** 0.180
meth.mgen
6
Mex_Am.2 -2.942** 0.203
7 Oth_H.2
-2.561** 0.206
8
Oth_NH.2
-2.815** 0.245
9
Wht_NH.2
-0.787** 0.184
year
10 80
4.180** 0.330
11 90
4.502** 0.332
meth.year
12
Mex_Am.80
-0.153 0.210
13
Mex_Am.90
-0.212 0.210
14
Oth_H.80
0.304 0.213
15
Oth_H.90
0.066 0.214
16
Oth_NH.80
-0.172 0.250
17
Oth_NH.90 -0.296 0.251
18
Wht_NH.80
-0.833** 0.191
19
Wht_NH.90
-1.138** 0.192
mgen.year
20 2.80 -0.946** 0.186
21 2.90
-1.514** 0.187
meth.mgen.year
22
Mex_Am.2.80
0.430* 0.210
23
Mex_Am.2.90
0.625** 0.211
24
Oth_H.2.80
-0.900** 0.214
25
Oth_H.2.90 -0.431* 0.215
26
Oth_NH.2.80
0.235 0.254
27
Oth_NH.2.90
0.619* 0.254
28
Wht_NH.2.80
0.719** 0.190
29
Wht_NH.2.90
1.184** 0.191
feth
30 Mex_Am
2.788** 0.284
31 Oth_H 2.470** 0.288
32 Oth_NH
3.204** 0.284
33 Wht_NH
3.243** 0.270
fgen
34 2
5.802** 0.268
feth.fgen
35
Mex_Am.2
-3.691** 0.285
36 Oth_H.2 -3.195** 0.288
37
Oth_NH.2
-4.590** 0.287
38
Wht_NH.2
-1.902** 0.269
feth.year
39 Mex_Am.80
-1.089** 0.291
40
Mex_Am.90
-0.940** 0.292
41
Oth_H.80
-0.250 0.295
42
Oth_H.90
-0.182 0.296
43
Oth_NH.80
-0.672* 0.291
44
Oth_NH.90
-0.770** 0.292
45
Wht_NH.80
-1.539** 0.276
46
Wht_NH.90
-1.801** 0.277
fgen.year
47 2.80 -1.541** 0.273
48 2.90
-2.023** 0.274
feth.fgen.year
49
Mex_Am.2.80
1.530** 0.291
50
Mex_Am.2.90
1.717** 0.292
51
Oth_H.2.80
-0.158 0.295
52
Oth_H.2.90
0.120 0.297
53
Oth_NH.2.80
1.057** 0.294
54
Oth_NH.2.90
1.473** 0.295
55
Wht_NH.2.80 1.611** 0.275
56
Wht_NH.2.90
2.055** 0.277
ethintdum
57 1
3.218** 0.006
58 _cons -5.767** 0.322
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. poisgof
Goodness-of-fit chi2
= 26839.64
Prob > chi2(167) = 0.0000
. desmat: poisson count
meth*mgen*year feth*fgen*year ethintdum*year
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log
likelihood:
-13301.451
LR chi
square:
4478624.393
Model degrees of
freedom:
59
Pseudo
R-squared:
0.994
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect
Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am
2.135** 0.206
2 Oth_H 1.810** 0.209
3 Oth_NH
1.191** 0.245
4 Wht_NH
2.009** 0.186
mgen
5 2
5.020** 0.180
meth.mgen
6
Mex_Am.2
-2.958** 0.203
7 Oth_H.2 -2.570** 0.206
8
Oth_NH.2
-2.866** 0.245
9
Wht_NH.2
-0.790** 0.184
year
10 80 4.682** 0.331
11 90
5.259** 0.333
meth.year
12
Mex_Am.80
-0.221 0.212
13
Mex_Am.90
-0.273 0.213
14
Oth_H.80
0.287 0.216
15
Oth_H.90
0.017 0.217
16
Oth_NH.80
-0.195 0.253
17
Oth_NH.90
-0.304 0.254
18
Wht_NH.80
-0.787** 0.193
19
Wht_NH.90
-1.032** 0.194
mgen.year
20 2.80
-0.948** 0.186
21 2.90 -1.518** 0.187
meth.mgen.year
22
Mex_Am.2.80
0.444* 0.210
23
Mex_Am.2.90
0.648** 0.211
24
Oth_H.2.80
-0.901** 0.214
25
Oth_H.2.90
-0.393 0.215
26
Oth_NH.2.80
0.275 0.254
27
Oth_NH.2.90
0.701** 0.255
28
Wht_NH.2.80
0.721** 0.190
29
Wht_NH.2.90 1.187** 0.191
feth
30 Mex_Am
2.846** 0.286
31 Oth_H
2.541** 0.290
32 Oth_NH
3.451** 0.287
33 Wht_NH
3.234** 0.271
fgen
34 2
5.804** 0.268
feth.fgen
35
Mex_Am.2
-3.708** 0.285
36 Oth_H.2
-3.205** 0.288
37
Oth_NH.2 -4.608** 0.287
38
Wht_NH.2
-1.904** 0.269
feth.year
39
Mex_Am.80
-1.137** 0.293
40
Mex_Am.90
-1.034** 0.294
41
Oth_H.80
-0.294 0.297
42
Oth_H.90
-0.326 0.298
43
Oth_NH.80
-0.877** 0.293
44
Oth_NH.90
-1.115** 0.295
45
Wht_NH.80 -1.526** 0.277
46
Wht_NH.90
-1.793** 0.278
fgen.year
47 2.80
-1.542** 0.273
48 2.90 -2.028** 0.274
feth.fgen.year
49
Mex_Am.2.80
1.543** 0.291
50
Mex_Am.2.90
1.747** 0.292
51
Oth_H.2.80
-0.160 0.295
52
Oth_H.2.90
0.164 0.297
53
Oth_NH.2.80 1.070** 0.294
54
Oth_NH.2.90
1.506** 0.295
55
Wht_NH.2.80
1.612** 0.275
56
Wht_NH.2.90
2.057** 0.277
ethintdum
57 1
3.874** 0.025
ethintdum.year
58 1.80
-0.568** 0.026
59 1.90
-0.884** 0.026
60 _cons
-6.344** 0.323
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. poisgof
Goodness-of-fit chi2
= 25270.9
Prob > chi2(165) = 0.0000
. *
. *That previous model treats year as a nominal
categorical variable everywhere
. *Now let's treat year as a continuous variable for the
purposes of interaction with ethnic intermarriage
. desmat: poisson count
meth*mgen*year feth*fgen*year ethintdum*@year
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log
likelihood: -13334.989
LR chi
square:
4478557.317
Model degrees of
freedom:
58
Pseudo R-squared:
0.994
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect
Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am 2.121** 0.205
2 Oth_H
1.807** 0.208
3 Oth_NH
1.201** 0.244
4 Wht_NH 2.023** 0.185
mgen
5 2
5.019** 0.180
meth.mgen
6
Mex_Am.2
-2.955** 0.203
7 Oth_H.2
-2.568** 0.206
8
Oth_NH.2
-2.855** 0.245
9
Wht_NH.2 -0.789** 0.184
year
10 80
1.942** 0.181
meth.year
11
Mex_Am.80
-0.206 0.212
12 Mex_Am.90
-0.258 0.212
13
Oth_H.80
0.295 0.215
14
Oth_H.90
0.018 0.216
15
Oth_NH.80
-0.208 0.252
16
Oth_NH.90
-0.314 0.253
17
Wht_NH.80
-0.808** 0.192
18
Wht_NH.90
-1.042** 0.193
mgen.year
19 2.80
-0.948** 0.186
20 2.90 -1.518** 0.187
meth.mgen.year
21
Mex_Am.2.80
0.440* 0.210
22
Mex_Am.2.90
0.645** 0.211
23
Oth_H.2.80
-0.907** 0.214
24
Oth_H.2.90
-0.392 0.215
25
Oth_NH.2.80
0.259 0.254
26
Oth_NH.2.90
0.693** 0.255
27
Wht_NH.2.80
0.720** 0.190
28
Wht_NH.2.90 1.187** 0.191
feth
29 Mex_Am
2.836** 0.286
30 Oth_H
2.526** 0.290
31 Oth_NH 3.389** 0.286
32 Wht_NH
3.232** 0.271
fgen
33 2
5.804** 0.268
feth.fgen
34
Mex_Am.2
-3.704** 0.285
35 Oth_H.2
-3.203** 0.288
36
Oth_NH.2 -4.604** 0.287
37
Wht_NH.2
-1.903** 0.269
feth.year
38
Mex_Am.80
-1.123** 0.292
39
Mex_Am.90 -1.027** 0.293
40
Oth_H.80
-0.267 0.296
41
Oth_H.90
-0.317 0.297
42 Oth_NH.80
-0.798** 0.292
43
Oth_NH.90
-1.062** 0.294
44
Wht_NH.80
-1.523** 0.276
45
Wht_NH.90
-1.792** 0.278
fgen.year
46 2.80
-1.541** 0.273
47 2.90 -2.027** 0.274
feth.fgen.year
48
Mex_Am.2.80
1.538** 0.291
49
Mex_Am.2.90
1.745** 0.292
50 Oth_H.2.80
-0.167 0.295
51
Oth_H.2.90
0.165 0.297
52
Oth_NH.2.80
1.064** 0.294
53
Oth_NH.2.90
1.504** 0.295
54
Wht_NH.2.80
1.611** 0.275
55
Wht_NH.2.90
2.057** 0.277
ethintdum
56 1
6.337** 0.082
57 year
0.257** 0.017
ethintdum.year
58
1.year -0.037** 0.001
59 _cons
-24.166** 1.478
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. *That's the version that uses a continuous variable
year to interract with ethnic intermarriage.
. poisgof
Goodness-of-fit chi2
= 25337.98
Prob > chi2(166) = 0.0000
. *the change over time per year, -0.037 is roughly
equivalent to 1/10 of the 1980 change
. *or 1/20 of the 1990 change from 1970
that we got in the previous model.
. *The baseline value of ethnintdum is larger because
it's figured at year=0, in this case
>
1900
. *In other words, the model extrapolates back to 1900
and gives a very high ethnic endoga
> my for that year
.
. desmat: poisson meth*mgen
, invalid name
r(198);
. desmat: poisson count
meth*mgen
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log
likelihood:
-1375789.526
LR chi
square:
1753648.242
Model degrees of
freedom: 9
Pseudo
R-squared:
0.389
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect
Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am 1.654** 0.037
2 Oth_H
1.316** 0.038
3 Oth_NH
0.354** 0.044
4 Wht_NH
2.448** 0.035
mgen
5 2
3.256** 0.034
meth.mgen
6
Mex_Am.2
-2.423** 0.038
7 Oth_H.2
-2.992** 0.040
8
Oth_NH.2
-2.230** 0.046
9
Wht_NH.2 0.058 0.036
10 _cons
4.054** 0.034
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. *10 terms for a saturated meth*mgen, which is just 5*2
. desmat: poisson count
meth*mgen feth*fgen
------------------------------------------------------------------------------------------
Poisson
regression
------------------------------------------------------------------------------------------
Dependent
variable
count
Optimization:
ml
Number of
observations:
225
Initial log
likelihood:
-2252613.647
Log
likelihood:
-338721.041
LR chi
square:
3827785.214
Model degrees of
freedom:
18
Pseudo
R-squared: 0.850
Prob:
0.000
------------------------------------------------------------------------------------------
nr Effect Coeff s.e.
------------------------------------------------------------------------------------------
count
meth
1 Mex_Am
1.654** 0.037
2 Oth_H
1.316** 0.038
3 Oth_NH
0.354** 0.044
4 Wht_NH
2.448** 0.035
mgen
5 2
3.918** 0.034
meth.mgen
6
Mex_Am.2
-2.423** 0.038
7 Oth_H.2 -2.992** 0.040
8
Oth_NH.2
-2.230** 0.046
9
Wht_NH.2
0.058 0.036
feth
10 Mex_Am
1.386** 0.044
11 Oth_H
1.393** 0.044
12 Oth_NH
1.530** 0.043
13 Wht_NH
2.777** 0.041
fgen
14 2
4.168** 0.040
feth.fgen
15
Mex_Am.2 -2.052** 0.045
16 Oth_H.2
-2.963** 0.046
17
Oth_NH.2
-3.329** 0.045
18
Wht_NH.2 -0.229** 0.041
19 _cons
-1.190** 0.052
------------------------------------------------------------------------------------------
*
p < .05
** p < .01
. *19 terms here because the second 5*2 table has one
redundant piece of information, the
> total count
. log close
log: C:\AAA Miker
Files\newer web pages\soc_388_notes\soc_388_2003\class 8.log
log type: text
closed
on:
------------------------------------------------------------------------------------------