Cross tab

From InterSciWiki
Jump to: navigation, search
The question is whether, given a combined W matrix for a specific model and dataset: can we get a world map like that on p15 Figure 3, "General," to be included in the Map output. [x] Moran ::With node sizes proportional to 1+units of .10 Instructions

Cross-Tab Moran's test library(spdep) contained in DEf

Moran's test with W matrix for CoSSci

http://cran.r-project.org/web/packages/spdep/index.html
http://www.inside-r.org/packages/cran/spdep/docs/moran.test
data(h14) #get a Moran test for the imputed variables
#CoSSci [x] Moran tests

Cross tab: This is compatible with Eff and Dow

dbl_std_sex=SCCS$v596
hus_wife_deference=SCCS$v615
v1<-dbl_std_sex
v2<-hus_wife_deference
table(v1,v2)                           # unlabeled 
  v2
v1  1  2  3  4  5  6
 1  9  4  9  6  4  0
 2 15  7  7  2  3  1

Durban-Watson Not good - is serial dependence

R library(lmtest)
Durbin-Watson test R library(lmtest)
table(dbl_std_sex,hus_wife_deference) # labeled 
          hus_wife_deference
dbl_std_sex  1  2  3  4  5  6
          1  9  4  9  6  4  0
          2 15  7  7  2  3  1
    1. Perform Breusch-Godfrey test for first-order serial correlation:
        bgtest(y1 ~ x)
        ## or for fourth-order serial correlation
        bgtest(y1 ~ x, order = 4)
        ## Compare with Durbin-Watson test results:
        dwtest(y1 ~ x)
        y2 <- filter(y1, 0.5, method = "recursive")
        bgtest(y2 ~ x)
        bg4 <- bgtest(y2 ~ x, order = 4)
        bg4
        coeftest(bg4)