This code is just for visualizing the findings rather than running model.

Load packages

Load Data

load("dat_all3.RData")

Visualize vermont causal flows

gn_vm

Visualize Seattle causal flows

gn_sea

Transfer Entropy comparison

ted
## Warning: The dot-dot notation (`..density..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(density)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Indegree, Outdegree, Netdegree, and Betweenness in Vermont

plot_net_prop2(df_vm,te_vm,pval_vm,neighbor_vm,VT_acs_2019)

Indegree, Outdegree, Netdegree, and Betweenness in Seattle

plot_net_prop2(df_sea,te_sea,pval_sea,neighbor_sea,seattle_tracts2)

NEIGHBORHOOD SPILLOVER - Within tract spillover

Used mutual information:

\(MI[X_t;X_{t+1}] = \sum q(x_t, x_{t_1}) \cdot log \left(\frac{q(x_t, x_{t_1})}{q(x_t) q(x_{t_1})} \right)\)

Logistic regression for mutual information in Vermont

stargazer::stargazer(
    m0_vm,m4_vm,m5_vm,m6_vm,m1_vm,m2_vm,m3_vm,
    type = "text", digits = 2
)
## 
## ==================================================================================
##                                         Dependent variable:                       
##                   ----------------------------------------------------------------
##                                               Mutinfo                             
##                     (1)      (2)      (3)      (4)       (5)       (6)      (7)   
## ----------------------------------------------------------------------------------
## logpop                                                 2.19***   1.92***  1.56*** 
##                                                        (0.35)    (0.36)    (0.38) 
##                                                                                   
## SingleFamily               -3.54*    -2.55    -2.83     -2.43     -2.00    -2.15  
##                            (2.10)    (2.21)   (2.34)   (2.62)    (2.65)    (2.67) 
##                                                                                   
## Edu                         1.94      2.01     1.54    4.06**     3.73*     2.97  
##                            (1.58)    (1.73)   (1.89)   (1.93)    (1.98)    (2.04) 
##                                                                                   
## HomeOwn                   -8.42***  -6.34*** -5.06**    1.68      1.81      1.46  
##                            (1.97)    (2.07)   (2.18)   (2.76)    (2.79)    (2.87) 
##                                                                                   
## Income                    0.0001*** 0.0000*   0.0000   0.0000*   0.0000    0.0000 
##                           (0.0000)  (0.0000) (0.0000) (0.0000)  (0.0000)  (0.0000)
##                                                                                   
## White                       5.34      4.52     4.82     8.15      7.68      7.26  
##                            (5.11)    (5.69)   (6.51)   (6.60)    (6.92)    (7.46) 
##                                                                                   
## Ininfo                              12.55***                     6.66**           
##                                      (2.72)                      (2.84)           
##                                                                                   
## Totinfo                                      12.08***                     7.92*** 
##                                               (2.07)                       (2.13) 
##                                                                                   
## Constant          -0.23*    -1.26    -1.20    -2.23   -27.42*** -24.58*** -21.00**
##                   (0.13)   (4.88)    (5.44)   (6.19)   (7.40)    (7.77)    (8.32) 
##                                                                                   
## ----------------------------------------------------------------------------------
## Observations        248      246      246      246       246       246      246   
## Log Likelihood    -170.32  -134.56  -118.78  -102.48   -101.76   -98.48    -91.86 
## Akaike Inf. Crit. 342.63   281.12    251.56   218.96   217.52    212.96    199.72 
## ==================================================================================
## Note:                                                  *p<0.1; **p<0.05; ***p<0.01

Dependent variable: Mutual information is significant or not (binary), in other words, neighborhood PV adoption diffusion exists or not.

Indep. variable:

logpop - logged population (not density but in numbers)
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
Ininfoc - the number of incoming causal flows
Totinfoc - the number of both incoming and outgoing causal flows

Logistic regression for mutual information in Seattle

stargazer::stargazer(
    m0_sea,m4_sea,m5_sea,m6_sea,m1_sea,m2_sea,m3_sea,
    type = "text", digits = 2
)
## 
## ===================================================================================
##                                          Dependent variable:                       
##                   -----------------------------------------------------------------
##                                                Mutinfo                             
##                     (1)      (2)      (3)      (4)       (5)       (6)       (7)   
## -----------------------------------------------------------------------------------
## logpop                                                 2.70***   2.52***   2.16*** 
##                                                        (0.78)    (0.79)    (0.83)  
##                                                                                    
## SingleFamily                 4.22     3.93     3.85     5.51*     4.98      4.27   
##                             (2.83)   (2.96)   (3.47)   (3.21)    (3.29)    (3.71)  
##                                                                                    
## Edu                         -3.70    -4.94   -7.26**    -3.20     -3.98     -6.25  
##                             (3.05)   (3.20)   (3.59)   (3.37)    (3.46)    (3.80)  
##                                                                                    
## HomeOwn                     -0.16    -0.25    -0.81     1.75      1.84      1.28   
##                             (3.02)   (3.04)   (3.39)   (3.34)    (3.36)    (3.63)  
##                                                                                    
## Income                      3.31**   3.58**   4.12**    2.71      2.75      3.25   
##                             (1.66)   (1.74)   (1.99)   (1.79)    (1.83)    (2.06)  
##                                                                                    
## White                       -0.21     0.65     1.99     -0.04     0.71      2.09   
##                             (2.00)   (2.09)   (2.26)   (2.23)    (2.34)    (2.51)  
##                                                                                    
## Ininfo                              10.97**                       7.24             
##                                      (5.51)                      (5.68)            
##                                                                                    
## Totinfo                                      16.87***                     14.61*** 
##                                               (4.46)                       (4.54)  
##                                                                                    
## Constant          -0.63*** -4.03*** -4.33*** -4.91*** -41.29*** -38.95*** -34.38***
##                    (0.18)   (1.17)   (1.22)   (1.36)   (11.05)   (11.11)   (11.60) 
##                                                                                    
## -----------------------------------------------------------------------------------
## Observations        132      132      132      132       132       132       132   
## Log Likelihood     -85.34   -63.89   -61.84   -53.78   -56.58    -55.74    -49.88  
## Akaike Inf. Crit.  172.68   139.77   137.67   121.56   127.15    127.49    115.76  
## ===================================================================================
## Note:                                                   *p<0.1; **p<0.05; ***p<0.01

Dependent variable: Mutual information is significant or not (binary), in other words, neighborhood PV adoption diffusion exists or not.

Indep. variable:

logpop - logged population (not density but in numbers)
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
Ininfoc - the number of incoming causal flows
Totinfoc - the number of both incoming and outgoing causal flows

TRACT-TRACT SPILLOVER

Transfer entropy is calculated to capture tract-tract diffusion

\(TE[X;Y] = \sum q(x_t, x_{t_1}, y_t) \cdot log \left(\frac{q(x_{t+1} |x_t, y_t)}{q(x_{t+1}|x_t)} \right)\)

Exponential Random Graph Model for receiving tract-tract diffusion in Vermont

summary(in_vm2)
## Call:
## ergm(formula = net_vm ~ edges + nodeicov("HomeOwn") + nodeicov("SingleFamily") + 
##     nodeicov("Edu") + nodeicov("White") + nodeicov("Income") + 
##     nodeifactor("RiskRate") + nodeifactor("Mutinfo"))
## 
## Maximum Likelihood Results:
## 
##                          Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                  -6.838e+00  1.475e+00      0  -4.637   <1e-04 ***
## nodeicov.HomeOwn       -8.930e-01  6.218e-01      0  -1.436   0.1509    
## nodeicov.SingleFamily  -1.065e+00  6.847e-01      0  -1.555   0.1199    
## nodeicov.Edu           -4.162e-01  4.990e-01      0  -0.834   0.4043    
## nodeicov.White          1.648e+00  1.602e+00      0   1.028   0.3039    
## nodeicov.Income         2.718e-05  4.704e-06      0   5.778   <1e-04 ***
## nodeifactor.RiskRate.3 -1.675e-01  1.244e-01      0  -1.347   0.1780    
## nodeifactor.RiskRate.4 -3.227e-01  1.700e-01      0  -1.898   0.0577 .  
## nodeifactor.RiskRate.5 -1.637e-01  3.088e-01      0  -0.530   0.5960    
## nodeifactor.Mutinfo.1   6.616e-01  1.141e-01      0   5.801   <1e-04 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 83552  on 60270  degrees of freedom
##  Residual Deviance:  5158  on 60260  degrees of freedom
##  
## AIC: 5178  BIC: 5268  (Smaller is better. MC Std. Err. = 0)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "nodeicov" means that the attribute is for tracts of incoming causal 
    flows, e.g., nodeicov.Income = income values at the tracts where causal
    flows set as destinations (recepter of PV adoption diffusion)
** "nodeifactor" is for categorical variables
*** From now on, given that causal flow "tract A -> tract B", I will call
    tract A as a diffuser and tract B as a recepter. Happy to change terms
    later on.
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
            1 - Very low
            2 - Relatively low
            3 - Relatively moderate
            4 - Relatively high
            5 - Very high
Mutinfo.1 - Existence of mutual information (neighborhood diffusion) in the 
            sending/receiving tracts.

Exponential Random Graph Model for sending tract-tract diffusion in Vermont

summary(out_vm2)
## Call:
## ergm(formula = net_vm ~ edges + nodeocov("HomeOwn") + nodeocov("SingleFamily") + 
##     nodeocov("Edu") + nodeocov("White") + nodeocov("Income") + 
##     nodeofactor("RiskRate") + nodeofactor("Mutinfo"))
## 
## Maximum Likelihood Results:
## 
##                          Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                  -4.676e+00  1.370e+00      0  -3.414 0.000640 ***
## nodeocov.HomeOwn       -9.030e-01  6.180e-01      0  -1.461 0.143976    
## nodeocov.SingleFamily  -3.049e-01  6.977e-01      0  -0.437 0.662085    
## nodeocov.Edu           -2.404e-01  4.938e-01      0  -0.487 0.626352    
## nodeocov.White         -1.057e+00  1.522e+00      0  -0.694 0.487386    
## nodeocov.Income         1.801e-05  4.682e-06      0   3.847 0.000119 ***
## nodeofactor.RiskRate.3 -9.060e-02  1.287e-01      0  -0.704 0.481558    
## nodeofactor.RiskRate.4 -1.793e-01  1.685e-01      0  -1.064 0.287440    
## nodeofactor.RiskRate.5 -6.776e-01  3.944e-01      0  -1.718 0.085790 .  
## nodeofactor.Mutinfo.1   1.202e+00  1.239e-01      0   9.698  < 1e-04 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 83552  on 60270  degrees of freedom
##  Residual Deviance:  5075  on 60260  degrees of freedom
##  
## AIC: 5095  BIC: 5185  (Smaller is better. MC Std. Err. = 0)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "nodeocov" means that the attribute is for tracts of outgoing causal 
    flows, e.g., nodeocov.Income = income values at the tracts where causal
    flows set as origin/source (diffuser of PV adoption diffusion)
** "nodeofactor" is for categorical variables
*** From now on, given that causal flow "tract A -> tract B", I will call
    tract A as a diffuser and tract B as a recepter. Happy to change terms
    later on.
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
            1 - Very low
            2 - Relatively low
            3 - Relatively moderate
            4 - Relatively high
            5 - Very high
Mutinfo.1 - Existence of mutual information (neighborhood diffusion) in the 
            sending/receiving tracts.

Exponential Random Graph Model for receiving tract-tract diffusion in Seattle

summary(in_sea2)
## Call:
## ergm(formula = net_sea ~ edges + nodeicov("HomeOwn") + nodeicov("SingleFamily") + 
##     nodeicov("Edu") + nodeicov("White") + nodeicov("Income") + 
##     nodeifactor("RiskRate") + nodeifactor("Mutinfo"))
## 
## Maximum Likelihood Results:
## 
##                        Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                   -6.3920     0.6462      0  -9.892  < 1e-04 ***
## nodeicov.HomeOwn        -0.5493     1.2229      0  -0.449  0.65332    
## nodeicov.SingleFamily    3.0592     1.0614      0   2.882  0.00395 ** 
## nodeicov.Edu             1.7477     1.2309      0   1.420  0.15564    
## nodeicov.White          -1.9276     0.8124      0  -2.373  0.01765 *  
## nodeicov.Income         -0.3224     0.5806      0  -0.555  0.57869    
## nodeifactor.RiskRate.3   0.5355     0.2473      0   2.165  0.03036 *  
## nodeifactor.RiskRate.4   0.2834     0.3803      0   0.745  0.45621    
## nodeifactor.RiskRate.5  -0.2330     1.0632      0  -0.219  0.82652    
## nodeifactor.Mutinfo.1    0.2627     0.2005      0   1.310  0.19010    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 23972  on 17292  degrees of freedom
##  Residual Deviance:  1552  on 17282  degrees of freedom
##  
## AIC: 1572  BIC: 1650  (Smaller is better. MC Std. Err. = 0)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "nodeicov" means that the attribute is for tracts of incoming causal 
    flows, e.g., nodeicov.Income = income values at the tracts where causal
    flows set as destinations (recepter of PV adoption diffusion)
** "nodeifactor" is for categorical variables
*** From now on, given that causal flow "tract A -> tract B", I will call
    tract A as a diffuser and tract B as a recepter. Happy to change terms
    later on.
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
            1 - Very low
            2 - Relatively low
            3 - Relatively moderate
            4 - Relatively high
            5 - Very high
Mutinfo.1 - Existence of mutual information (neighborhood diffusion) in the 
            sending/receiving tracts.

Exponential Random Graph Model for sending tract-tract diffusion in Seattle

summary(out_sea2)
## Call:
## ergm(formula = net_sea ~ edges + nodeocov("HomeOwn") + nodeocov("SingleFamily") + 
##     nodeocov("Edu") + nodeocov("White") + nodeocov("Income") + 
##     nodeofactor("RiskRate") + nodeofactor("Mutinfo"))
## 
## Maximum Likelihood Results:
## 
##                        Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                  -5.95612    0.65711      0  -9.064   <1e-04 ***
## nodeocov.HomeOwn        0.16776    1.22408      0   0.137   0.8910    
## nodeocov.SingleFamily   1.48957    1.08566      0   1.372   0.1701    
## nodeocov.Edu            1.84880    1.28854      0   1.435   0.1513    
## nodeocov.White         -1.69725    0.82527      0  -2.057   0.0397 *  
## nodeocov.Income        -0.34259    0.57373      0  -0.597   0.5504    
## nodeofactor.RiskRate.3 -0.02336    0.22452      0  -0.104   0.9171    
## nodeofactor.RiskRate.4 -0.17029    0.35360      0  -0.482   0.6301    
## nodeofactor.RiskRate.5 -0.60766    1.06175      0  -0.572   0.5671    
## nodeofactor.Mutinfo.1   0.97835    0.21017      0   4.655   <1e-04 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 23972  on 17292  degrees of freedom
##  Residual Deviance:  1532  on 17282  degrees of freedom
##  
## AIC: 1552  BIC: 1630  (Smaller is better. MC Std. Err. = 0)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "nodeocov" means that the attribute is for tracts of outgoing causal 
    flows, e.g., nodeocov.Income = income values at the tracts where causal
    flows set as origin/source (diffuser of PV adoption diffusion)
** "nodeofactor" is for categorical variables
*** From now on, given that causal flow "tract A -> tract B", I will call
    tract A as a diffuser and tract B as a recepter. Happy to change terms
    later on.
RiskRate - National Risk Index -> high value means that the tract is at risk
            for 18 natural hazards
            1 - Very low
            2 - Relatively low
            3 - Relatively moderate
            4 - Relatively high
            5 - Very high
Mutinfo.1 - Existence of mutual information (neighborhood diffusion) in the 
            sending/receiving tracts.

Exponential Random Graph Model for homophily in Vermont

summary(homo_vm)
## Call:
## ergm(formula = net_vm ~ edges + mutual + gwesp(decay = 0.01, 
##     fixed = TRUE, type = "OTP") + absdiff("HomeOwn") + absdiff("SingleFamily") + 
##     absdiff("Edu") + absdiff("White") + absdiff("Income"))
## 
## Monte Carlo Maximum Likelihood Results:
## 
##                        Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                -5.537e+00  1.048e-01      0 -52.848   <1e-04 ***
## mutual                4.510e+00  2.066e-01      0  21.830   <1e-04 ***
## gwesp.OTP.fixed.0.01  1.582e+00  8.754e-02      0  18.069   <1e-04 ***
## absdiff.HomeOwn       3.966e-01  3.743e-01      0   1.060   0.2893    
## absdiff.SingleFamily -3.046e-01  4.344e-01      0  -0.701   0.4832    
## absdiff.Edu          -1.709e+00  3.948e-01      0  -4.328   <1e-04 ***
## absdiff.White        -1.678e+00  1.069e+00      0  -1.570   0.1165    
## absdiff.Income       -8.174e-06  3.505e-06      0  -2.332   0.0197 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 83552  on 60270  degrees of freedom
##  Residual Deviance:  3790  on 60262  degrees of freedom
##  
## AIC: 3806  BIC: 3878  (Smaller is better. MC Std. Err. = 1.747)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "mutual" means that a causal flow has reciprocity (A <-> B)
** "gwesp.OTP.fixed.0.01" is that if there is A -> B causal flow, it is
    likely to have multiple transitting tracts indirectly shaping A -> B,
    e.g., A -> C -> B & A -> D -> B if A -> B exists.
*** "absdiff" calculates absolute difference of an attribute in the causally
    affecting and affected tracts in the homophily context. If the coeff. is
    negative, tracts with similar attribute values tend to be causally 
    linked.
    

Exponential Random Graph Model for homophily in Seattle

summary(homo_sea)
## Call:
## ergm(formula = net_sea ~ edges + mutual + gwesp(decay = 0.01, 
##     fixed = TRUE, type = "OTP") + absdiff("HomeOwn") + absdiff("SingleFamily") + 
##     absdiff("Edu") + absdiff("White") + absdiff("Income"))
## 
## Monte Carlo Maximum Likelihood Results:
## 
##                      Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                 -3.4007     0.1899      0 -17.907  < 1e-04 ***
## mutual                 2.7113     0.3591      0   7.550  < 1e-04 ***
## gwesp.OTP.fixed.0.01   0.9709     0.1619      0   5.996  < 1e-04 ***
## absdiff.HomeOwn       -1.6744     0.7935      0  -2.110  0.03484 *  
## absdiff.SingleFamily  -2.0675     0.7632      0  -2.709  0.00675 ** 
## absdiff.Edu           -7.0657     1.2122      0  -5.829  < 1e-04 ***
## absdiff.White         -2.6549     0.9536      0  -2.784  0.00537 ** 
## absdiff.Income         0.6398     0.3575      0   1.789  0.07356 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 23972  on 17292  degrees of freedom
##  Residual Deviance:  1322  on 17284  degrees of freedom
##  
## AIC: 1338  BIC: 1400  (Smaller is better. MC Std. Err. = 0.2814)

Dependent variable: Transfer entropy is significant or not (binary), in other words, tract-tract PV adoption causal flow exists or not (with directionality).

Indep. variable:

* "mutual" means that a causal flow has reciprocity (A <-> B)
** "gwesp.OTP.fixed.0.01" is that if there is A -> B causal flow, it is
    likely to have multiple transitting tracts indirectly shaping A -> B,
    e.g., A -> C -> B & A -> D -> B if A -> B exists.
*** "absdiff" calculates absolute difference of an attribute in the causally
    affecting and affected tracts in the homophily context. If the coeff. is
    negative, tracts with similar attribute values tend to be causally 
    linked.