.Dow-Eff Functions - DEf

From InterSciWiki
Jump to: navigation, search

(Dow Eff functions

early versions of Dow-Eff Functions - DEf Wiki4R_Codebooks.htm -- New SCCS and EA codebooks and libraries 8/28/13 -- SCCCodes.htm - CCR -- Visual Manual - Climate Data - Climate methods - for all datasets
Contains updated SCCS and EA, some new functions and modifications to old ones. Biggest additions are a function to create scales and a logit function. The names of arguments for some functions have changed to make them more intuitive—you will probably have to look at the manual to find out how to make some of your old code run.

Nov 2013 Generation: DEf01d

  • http://capone.mtsu.edu/eaeff/Dow-Eff%20functions.html - the documentation *XXXXhttp://capone.mtsu.edu/eaeff/DEf01XC.htmlXXXX does not work
  • hcpval=heteroskedasticity consistent pvalue. Uses your 2nd cousin's robust covariance matrix. Bootstrapping is another way to get a robust pvalue, and nowadays it would be the preferred way. The null hypothesis for these pvalues is that the true value of the coefficient is zero.
  • Includes a 371-society dataset (all EA societies with representation in at least one of the other three datasets)
  • And a function for multinomial logit (for categorical dependent variables, with three or more categories

load(url("http://dl.dropbox.com/u/9256203/DEf01d.Rdata"),.GlobalEnv)

setDS("SCCS")
dx$iact<-dx$v236*dx$v237
evm<-c("v1127","iact","v64","v236","v237","v80")
smi<-doMI(evm,5,7)
a<-doOLS(smi,depvar="v1127",indpv=c("v64","v236","v237","v80","iact"))
names(a)
a[1:11]

Xiamen

Dd739 Marriage Arrangements wanyao-zhang 11-24-2013

Kin Term Systems

231. KIN TERMS FOR COUSINS

    14    . = Missing Data
    16    1 = Descriptive terms, e.g. 'mothers brothers son'
     1    2 = Sudanese: Siblings, cross and parallel cousins distinguished
               but not by descriptive terms
    45    3 = Iroquois: Cross cousins versus parallel are siblings
     4    4 = Mixed or deviant
    14    5 = Omaha: Generational merging; MoBrCh up; FaSCh down
    15    6 = Crow: Generational merging; MoBrCh down; FaSCh up
    23    7 = Eskimo: Cousins versus siblings
    54    8 = Hawaiian: Siblings plus cousins equated

Avoidances

Avoidance_Maps

Reincarnation

Later versions of DEf (DEf2, DEf01c)

Cross-cultural datasets with DEF R scripts

Using R scripts with the SCCS DEf01dSCCS or the earlier DEf01SCCS
Using R scripts with the LRB DEf01LRB Binford Foragers List of LRB variables
Using R scripts with the EA DEf01EA Ethnographic Atlas
Using R scripts with the WNAI DEf01WNAI Jorgensen Western North American Indians
1 DEF can load data from any of the 4 datasets (but no imputation across datasets).
2 DEF selection of covariates is much improved, so imputations should have less variance and we should get better model fits.
3 Two additional IV tests: Fstat for weak instrument > 10 and Sargan test of overidentification pvalue ~ 0.00 is random,  >10.00 is nonrandom.
  • Explanations are given on pp19-20, in Malcolm M. Dow. 2013. DowEff: An Approach to Comparative Method (c) MMDow 2013. Early draft of Wiley Press chapter, forthcoming 2015. Changes to selection of instrumental variables can make instruments stronger.
4 Data used are output (so Wyhat and Wy will be available).
5 Squared terms calculated for all variables with at least 3 discrete values and a maximum absolute value less than 300.
6 Using Visual Manual and http://SocSciCompute.ss.uci.edu/ squared terms calculated in Variable|Definition as prefix sq and variable name.
7 add after ski:   aa<-aggregate(smi[,sapply(smi,function(x) is.numeric(x))],list(smi$.id),mean) # lists imputed variables from evm
   note: smi function defaults nimp=10 imputed datasets, maxit=7 iterations used to estimate a single imputed dataset
8 Added oxog exogeneous variable which must be in evm and UiV but not in RiV or else can be oxog <- NULL to omit.
9 h[5] The pvalues are Hausman tests but "the weakidf should be larger than 10 and the p.Sargan should be greater than .05."
  Here the Fstat, df, pvalue, and star are also for the Hausman. The new version makes the Hausman tests an option.
9 h[5] Anthon: Shouldn't the p.Sargan test be pvalue < 0.10 i.e, exog variable correlated with the error test?
10 oxog and RiV are disjoint sets. Use as many as you want. But, to be honest, I've been playing with this and have not yet been able to get 
   a legitimate Hausman test (weak IV F>10; Sargan p>.1). So I don't want to encourage you too much--this procedure is apparently in deep beta.
11 Make sure to enter dlV name into evm.
12 h$OtherStats includes the weights on the distance and language W. Below, the Optimal weight matrix was W=.32*Wd+.68*Wl.
OtherStats d    i    e  Weak.Identification.Fstat	R2.final.model	R2.UR.model	nimp 	nobs	 BClambda
 Y1       0.32 0.68  0      86.8343  0.633788   0.63711    5    297   0.050054
13 The trick to save output is to add a left column to the  *.csv, fill it with xxx (no blank space), copy into WORD, replace xxx-->blank, copy it back to the wiki

SCCS Dow Eff Functions

Where noted for Ev models below, the corresponding VM1-VM2-VM3-VM4 links show model results also generated (with maps) from the online Visual Manual

USE THESE LATEST MODELS AS PART OF CHAPTER 5; IGNORE SECTIONS ON PARTIAL MODELS at SCCS2 Dow Eff Functions implemented by drw from an early-version http://capone.mtsu.edu/eaeff/Dow-Eff%20functions.html) http://eclectic.ss.uci.edu/~drwhite/courses/SCCCodes.htm
== List of High Gods and Sanderson Models
DEf01 AOK Ev2007Higod4- good match to Printable_Moral_Gods_Model_&_Data
DEf01AOK Ev2013 Sanderson Religion --A.F.C. Wallace -- similar to Ev2007Higod4 above and uses same DepVar name

List of Avoidance models

Ev676.2
simple+maps-> Ev676.3 successive trim of "SCCS Dow Eff Functions" matches results of VM DEF2a DEF2a if Gui parameters nimp=8 and maxit=9
simple+maps-> Ev676.4 incomplete VM2 Male Origins Symbolism bio.5,v149,v205,v21,v53,v665,v670,v7 = TempWarm; Writing&Records; Dependence on Fishing; Food Surplus; Father-Infancy; Male segregation; Male Dominance; Contribution of Fishing ONE VARIABLE DOESNT WORK in VM: replacement with 676 vars in "SCCS Dow Eff Functions"
complex+maps->Ev621 VM3 Hu-Wi Equality with a DataQuality variable malefieldyear time (bio.11,bio.5,) (cpxPop=)v1122*158.1,v53,v54,v626,v68,v817 Log Population; Father-Infancy; Father-Childhood; Female Equality; Form of Family; Impt. Hunting
Ev626 VM1 Female Equality Beliefs bio.11,v1122,v204,sq51 = TempColdQtr; Log Population; Dependence on Hunting; Husband helps wife with infant.
Ev51sq VM4 Husband helps wife with infant. v2001=1,v1257,v1258,v154,v369,v52,v626,v819,v921,v245,v207,v53,v153 Deep Islam; Filariae, Spirochetes; Mother-Childhood; Female Equality, Impt Trade, Agri Potential, Milking, Dep. Agric; Father-Infancy; Tech. Specialization
Ev51sq VM4 Husband helps wife with infant cpxPop,v626,v53,v149 -->v1122, v52,v53,v626,v819 ( v1122*158.1=cpxPop)
626 ----- bio.11,51s This Network of Variables structure noted in Chapter 5 may be suitable for path analysis: 10 pairs 4 variables, 10 + 4 -1 = 5 cycles.
676 ----- bio.5,53
621 ----- bio.11,bio.5,1122
51sq ---- 53,626,1122 (the sq means the square of variable 510
Ev221.1 Hot-Dry predictors of Largest Patrilineal Group VERSION DEf01 IS OBSOLETE BUT THIS IS AN EXACT DUPLICATE of the model below
Ev221.1 Hot-Dry predictors of Largest Patrilineal Group VERSION DEf01c [[Ev221.1] can do Mkmapping
Shaman dx$Shaman<-(sccsA$v2013==1)*1 Do in two steps? Or just one?

Access to DEF functions for non-SCCS datasets

LRB_Dow_Eff_Functions
EA Dow Eff Functions
WNAI Dow Eff Functions
The component weights: 
h$OtherStats[c("d","l","e")]  #Can be used in new 2nd stage regressions to do observed variables path analyses (David Garson & systemfit]
=== Notes ===
The OUTPUT from first stage 2SLS Wy is called Wy. The INPUT to the first stage 2SLS Wy is called TrueWy. They are in h$data. To get the mean of these (and other variables) do the following: 
z<-sapply(h$data, function(x) class(x)=="numeric")
ix<-aggregate(h$data[,z],list(h$data$.id),mean)
h$data
   .imp                          .id v426 v427 v438 v163.d6 v115 v189 v197 v202 v207 v294 v111.d2 v112.d2 v7 mht.name.d1 mht.name.d2 mht.name.d3
1      1                North Tlingit    2    2    2       1    3    1    4    2    2    3       0       0  5           0           0           0
2      1                South Tlingit    2    2    3       1    3    1    4    2    2    3       0       0  5           0           0           1
...
You can see what you have:
ix[1:2,]
 fix smi errors for DEf2: here alone
table(dx$reincarn) too few cases? 
 0  1  2  3  4 
33  3  6  1 16
 Ev1998 PRECLASSICAL Reincarnation Eleanor Wynn fix smi error for DEf2
 Ev1998.5 fix smi error for DEf2
The LRB exogenous variables selected for the Hausman tests
For any of the datasets, do the following to see what exogenous variables are available:
head(h$data)

EA Dow Eff Functions

Note: EA variable bio.4 is missing from setDS("EA") and if used will cause an error
EAv17 Large patrilineages - indep v1, bio.14
EAv17.1 vers. DEf01 -  EAv17.2 - vers. DEf01c just change library and 01-->01c (Ev221.1 is the SCCS version)
EAv1 v1. Gathering
SCCSEv221Largest Patriineage

LRB Dow Eff Functions

load("/Users/drwhite/Desktop/p.Rdata")
List of LRB variables in DEf01.Rdata
LRBpathogens - Tolga Oztan with map
LRBgath
LRBqtstor

WNAI Dow Eff Functions for 172 Society Jorgenson database

*Sample modeling options soon will be available)

XC Dow Eff Functions for ... Society combined database EA SCCS

Partial Models from DEf2

Dv1970 Witchcraft
Dv879 Shaman INSUFFICIENT CASES N=47
Dv2013 1:Shamans:Wallace 
Dv2013 2:Communal:Wallace
Dv2013 3:Polytheistic:Wallace
Dv2013 4:Monotheistic:Wallace

Models from R Scripts from Initial DEf Version

Wikipedia:Sargan_test
Yes, have in common +v921AgriPotential -v154Land Transport (+v158.1 Complex for Dv157Polit-Integ) Rural Complx AgricPotential

riv<-c("bio.13","matriR51sq","v1253","v1260","v149","v1915","v232","v815","v991")#v5remove

Data downloads

#load(url("http://dl.dropbox.com/u/9256203/DE6.Rdata"),.GlobalEnv) #2011
load(url("http://dl.dropbox.com/u/9256203/DE7.Rdata"),.GlobalEnv) #2012 scccsA dataset
load(url("http://dl.dropbox.com/u/9256203/DEf01.Rdata"), .GlobalEnv) #2013 four datasets: SCCS EA LRB WNAI
ls()  #-can see the objects contained in DEf01.Rdata

Lists of SCCS, EA, AWC, LRB, and WNAI: Variables, Societies

List of SCCS societies
List of AWC societies
List of EA societies
List of LRB societies
List of WNAI societies
List of SCCS variables
List of AWC variables
List of EA variables
List of LRB variables
List of WNAI variables

Other

  • smi <- doMI(evm, nimp = 4, maxit = 5) # must debug what is rii? Error in ri[[i]] : subscript out of bounds

Maps-1

Rworldmap module - SCCCodes TOTAL PATHOGEN STRESS (small nodes LOW) Galaxy Option DEF2a DEF2a LOCAL at http://socscicompute.ss.uci.edu To add variable names to output: After one runs this command:

setDS("SCCS") # creates objects: "cov" "dx"  "dxf" "key" "wdd" "wee" "wll"
one can use the metadata dataframe called “key” to get the descriptions. For example, if one wants the description for “v874”, do the following:
> key["v874","description"] #-Anthon
V203.png
- Cntl-minus to shrink to one panel of maps

Left

Maps-2

This shows the problem that requires rounding ____ LETS ROUND ALL ORDERED VALUE FOR MAPS to a maximum of 12. To add variable names to output: After one runs this command:
setDS("SCCS") # creates objects: "cov" "dx"  "dxf" "key" "wdd" "wee" "wll"
one can use the metadata dataframe called “key” to get the descriptions. For example, if one wants the description for “v874”, do the following:
> key["v874","description"] #-Anthon

Bio.5.png

Maps-3

Rworldmap module - SCCCodes v872 % Married Women Polygynously Married (small nodes LOW) Galaxy Option DEF2a DEF2a LOCAL at http://socscicompute.ss.uci.edu File:V872.png]] V157.png - SCCCodes v157 POLITICAL INTEGRATION (small nodes LOW) Galaxy Option DEF2a DEF2a

Key links

Using R scripts with the SCCS DEf01SCCS
Using R scripts with the LRB DEf01LRB Binford Foragers
Using R scripts with the EA DEf01EA Ethnographic Atlas
Using R scripts with the WNAI DEf01WNAI Jorgensen Western North American Indians
http://intersci.ss.uci.edu/wiki/htm/Wiki4R_Codebooks.htm
.Dow-Eff_Functions_-_DEf
List of SCCS variables - List of SCCS societies
List of LRB variables - List of LRB societies
List of EA variables - List of EA societies
List of WNAI variables - List of WNAI societies
  • The latest version of the Dow-Eff functions (Manual: pdf; html) can perform analyses on four different ethnological datasets.”

Currently: http://capone.mtsu.edu/eaeff/downloads/Manual_DEf1c.pdf Currently: http://capone.mtsu.edu/eaeff/downloads/Manual_DEf1c.htm