The latest version of the Dow-Eff functions (Manual: pdf; html) can perform analyses on five different ethnological datasets:
abbreviation | dataset | codebook |
---|---|---|
WNAI | Western North American Indians | codebook |
SCCS | Standard Cross-Cultural Sample | codebook |
EA | Ethnographic Atlas | codebook |
LRB | Lewis R. Binford’s forager data | codebook |
XC | Merged 371 society data | codebook |
The code below outlines the workflow for estimating a multinomial logit model using data from the XC.
You will need a number of R packages to run the Dow-Eff functions. These are loaded using the “library” command. If a package is “not found”, it should be first installed. The following command will initiate the installation of the package named “mice”, for example:
install.packages("mice")
#--set working directory and load needed libraries--
options('width'=150)
# setwd("/home/yagmur/Dropbox/functions")
setwd("e:/Dropbox/functions/")
library(Hmisc)
library(mice)
library(foreign)
library(stringr)
library(AER)
library(spdep)
library(psych)
library(geosphere)
library(relaimpo)
library(linprog)
library(dismo)
library(forward)
library(pastecs)
library(classInt)
library(maps)
library(dismo)
library(plyr)
library(aod)
library(reshape)
library(RColorBrewer)
library(XML)
library(tm)
library(mlogit)
The Dow-Eff functions, as well as the five ethnological datasets, are contained in an R-workspace, located in the cloud.
load(url("http://capone.mtsu.edu/eaeff/downloads/DEf01f.Rdata"))
#-show the objects contained in DEf01f.Rdata
data.frame(type=sapply(ls(),function(x) class(get(x))))
## type
## addesc function
## capwrd function
## chK function
## CSVwrite function
## doLogit function
## doMI function
## doMNLogit function
## doOLS function
## EA data.frame
## EAcov list
## EAfact data.frame
## EAkey data.frame
## fv4scale function
## GISaux character
## gSimpStat function
## kln function
## llm matrix
## LRB data.frame
## LRBcov list
## LRBfact data.frame
## LRBkey data.frame
## MEplots function
## metadata list
## mkcatmappng function
## mkdummy function
## mkmappng function
## mknwlag function
## mkscale function
## mkSq function
## mmgg function
## plotSq function
## quickdesc function
## resc function
## rmcs function
## rnkd function
## SCCS data.frame
## SCCScov list
## SCCSfact data.frame
## SCCSkey data.frame
## setDS function
## showlevs function
## spmang function
## widen function
## WNAI data.frame
## WNAIcov list
## WNAIfact data.frame
## WNAIkey data.frame
## XC data.frame
## XCcov list
## XCfact data.frame
## XCkey data.frame
The setDS( xx ) command sets one of the four ethnological datasets as the source for the subsequent analysis. The five valid options for xx are: “XC”, “LRB”, “EA”, “SCCS”, and “WNAI”. The setDS() command creates objects:
object name | description |
---|---|
cov | Names of covariates to use during imputation step |
dx | The selected ethnological dataset is now called dx |
dxf | The factor version of dx |
key | A metadata file for dx |
wdd | A geographic proximity weight matrix for the societies in dx |
wee | An ecological similarity weight matrix for the societies in dx |
wll | A linguistic proximity weight matrix for the societies in dx |
setDS("XC")
The next step in the workflow is to create any new variables and add them to the dataset dx. New variables can be created directly, as in the following example. When created in this way, one should also record a description of the new variable, using the command addesc(). The syntax takes first the name of the new variable, and then the description.
dx$nomadic<-(dx$EA.v30<3)*1
addesc("nomadic","the society is nomadic or semi-nomadic")
table(dxf$EA.v30,dx$nomadic,useNA="ifany")
##
## 0 1 <NA>
## Compact and relatively permanent 102 0 0
## Compact but impermenant settlements 3 0 0
## Complex settlements 7 0 0
## Neighborhoods of dispersed family homesteads 24 0 0
## Nomadic or fully migratory 0 53 0
## Seminomadic 0 116 0
## Semisedentary 46 0 0
## Separated hamlets, forming a single community 17 0 0
## <NA> 0 0 3
Dummy variables (variables taking on the values zero or one) should be added using the command mkdummy(). This command will, in most cases, automatically record a variable description. Dummy variables are appropriate for categorical variables. The syntax of mkdummy() takes first the categorical variable name, and then the category number (these can be found in the codebook for each ethnological dataset). Note that the resulting dummy variable will be called variable name+“.d”+category number.
mkdummy("SCCS.v2012",1)
## [1] "This dummy variable is named SCCS.v2012.d1"
## [1] "The variable description is: 'Hunters and Gatherers == Simple hunters (and getherers): Nomadic and egalitarian, lack ranked social hierarchies and well-defined positions of leadership and authority'"
mkdummy("EA.v67",9)
## [1] "This dummy variable is named EA.v67.d9"
## [1] "The variable description is: 'Class Stratification, Secondary Features == no secondary type'"
mkdummy("SCCS.v91",4)
## [1] "This dummy variable is named SCCS.v91.d4"
## [1] "The variable description is: 'Administrative Hierarchy == Heads of decentralized territorial divisions'"
mkdummy("EA.v68",2)
## [1] "This dummy variable is named EA.v68.d2"
## [1] "The variable description is: 'Class Stratification (Endogamy) == despised occupational groups'"
We will also make scales for level of technology, beneficent environment, female economic contribution, and degree of social hierarchy. We collect those variables into character strings.
tchx<-paste("v",c(2126:2175),sep="");length(tchx)
## [1] 50
tchx<-setdiff(tchx,c("v2137","v2148","v2152"));length(tchx)
## [1] 47
tchx<-paste("SCCS",tchx,sep=".")
tchx<-intersect(tchx,names(dx))
enviro<-c("bio.7", "bio.4", "SCCS.v855", "SCCS.v1267",
"SCCS.v1268", "SCCS.v1265", "SCCS.v1263", "SCCS.v1269",
"SCCS.v1685", "SCCS.v1683", "SCCS.v929", "bio.6", "bio.16")
femecon<-c("LRB.mdivlab", "SCCS.v585",
"SCCS.v886", "SCCS.v885", "SCCS.v887", "SCCS.v890", "SCCS.v889")
hierar<-c("SCCS.v2012.d1", "EA.v67.d9", "SCCS.v91.d4",
"EA.v68.d2", "EA.v32", "SCCS.v1740", "SCCS.v158", "SCCS.v237",
"EA.v33")
After making any new variables, list the variables you intend to use in your analysis in the following form.
evm<-c("nomadic","EA.v80",tchx,enviro,femecon,hierar)
Missing values of these variables are then imputed, using the command doMI(). Below, the number of imputed datasets is 5, and 12 iterations are used to estimate each imputed value (nimp=10 and maxit=7 are the defaults). The stacked imputed datasets are collected into a single dataframe which here is called smi.
This new dataframe smi will contain not only the variables in evm, but also a set of normalized (mean=0, sd=1) variables related to climate, location, and ecology (these are used in the OLS analysis to address problems of endogeneity). In addition, squared values are calculated automatically for variables with at least three discrete values and maximum absolute values no more than 300. These squared variables are given names in the format variable name+“Sq”.
Finally, smi contains a variable called “.imp”, which identifies the imputed dataset, and a variable called “.id” which gives the society name.
smi<-doMI(evm,nimp=5,maxit=12)
## [1] "--create variables to use as covariates--"
## [1] "--finding covariates for nomadic --"
## [1] "nomadic"
## [1] "EA.v80"
## [1] "SCCS.v2126"
## [1] "SCCS.v2127"
## [1] "SCCS.v2128"
## [1] "SCCS.v2129"
## [1] "SCCS.v2130"
## [1] "SCCS.v2131"
## [1] "SCCS.v2132"
## [1] "SCCS.v2133"
## [1] "SCCS.v2134"
## [1] "SCCS.v2135"
## [1] "SCCS.v2136"
## [1] "SCCS.v2138"
## [1] "SCCS.v2139"
## [1] "SCCS.v2140"
## [1] "SCCS.v2141"
## [1] "SCCS.v2142"
## [1] "SCCS.v2143"
## [1] "SCCS.v2144"
## [1] "SCCS.v2145"
## [1] "SCCS.v2146"
## [1] "SCCS.v2147"
## [1] "SCCS.v2149"
## [1] "SCCS.v2150"
## [1] "SCCS.v2151"
## [1] "SCCS.v2153"
## [1] "SCCS.v2154"
## [1] "SCCS.v2155"
## [1] "SCCS.v2156"
## [1] "SCCS.v2157"
## [1] "SCCS.v2158"
## [1] "SCCS.v2159"
## [1] "SCCS.v2160"
## [1] "SCCS.v2161"
## [1] "SCCS.v2162"
## [1] "SCCS.v2163"
## [1] "SCCS.v2164"
## [1] "SCCS.v2165"
## [1] "SCCS.v2166"
## [1] "SCCS.v2167"
## [1] "SCCS.v2168"
## [1] "SCCS.v2169"
## [1] "SCCS.v2170"
## [1] "SCCS.v2171"
## [1] "SCCS.v2172"
## [1] "SCCS.v2173"
## [1] "SCCS.v2174"
## [1] "SCCS.v2175"
## [1] "SCCS.v855"
## [1] "SCCS.v1267"
## [1] "SCCS.v1268"
## [1] "SCCS.v1265"
## [1] "SCCS.v1263"
## [1] "SCCS.v1269"
## [1] "SCCS.v1685"
## [1] "SCCS.v1683"
## [1] "SCCS.v929"
## [1] "LRB.mdivlab"
## [1] "SCCS.v585"
## [1] "SCCS.v886"
## [1] "SCCS.v885"
## [1] "SCCS.v887"
## [1] "SCCS.v890"
## [1] "SCCS.v889"
## [1] "SCCS.v2012.d1"
## [1] "EA.v67.d9"
## [1] "SCCS.v91.d4"
## [1] "EA.v68.d2"
## [1] "EA.v32"
## [1] "SCCS.v1740"
## [1] "SCCS.v158"
## [1] "SCCS.v237"
## [1] "EA.v33"
## [1] "WARNING: variable may not be ordinal--EA.v80" "WARNING: variable may not be ordinal--society" "WARNING: variable may not be ordinal--dxid"
## Time difference of 1.232 mins
dim(smi) # dimensions of new dataframe smi
## [1] 1855 163
smi[1,] # first row of new dataframe smi
## .imp .id nomadic EA.v80 SCCS.v2126 SCCS.v2127 SCCS.v2128 SCCS.v2129 SCCS.v2130 SCCS.v2131 SCCS.v2132 SCCS.v2133 SCCS.v2134 SCCS.v2135
## 1 1 Tlingit 0 1 1 1 1 0 1 1 1 1 1 0
## SCCS.v2136 SCCS.v2138 SCCS.v2139 SCCS.v2140 SCCS.v2141 SCCS.v2142 SCCS.v2143 SCCS.v2144 SCCS.v2145 SCCS.v2146 SCCS.v2147 SCCS.v2149 SCCS.v2150
## 1 0 0 0 1 0 0 1 1 1 1 0 1 1
## SCCS.v2151 SCCS.v2153 SCCS.v2154 SCCS.v2155 SCCS.v2156 SCCS.v2157 SCCS.v2158 SCCS.v2159 SCCS.v2160 SCCS.v2161 SCCS.v2162 SCCS.v2163 SCCS.v2164
## 1 1 1 1 0 0 0 1 1 1 1 1 0 1
## SCCS.v2165 SCCS.v2166 SCCS.v2167 SCCS.v2168 SCCS.v2169 SCCS.v2170 SCCS.v2171 SCCS.v2172 SCCS.v2173 SCCS.v2174 SCCS.v2175 SCCS.v855 SCCS.v1267
## 1 1 1 0 1 1 1 1 0 1 1 1 2 3
## SCCS.v1268 SCCS.v1265 SCCS.v1263 SCCS.v1269 SCCS.v1685 SCCS.v1683 SCCS.v929 LRB.mdivlab SCCS.v585 SCCS.v886 SCCS.v885 SCCS.v887 SCCS.v890 SCCS.v889
## 1 1 4 3 2 1 1 8 78 5 20 15 30 0 12
## SCCS.v2012.d1 EA.v67.d9 SCCS.v91.d4 EA.v68.d2 EA.v32 SCCS.v1740 SCCS.v158 SCCS.v237 EA.v33 x y x2 y2 xy
## 1 0 1 1 0 2 7 2 1 1 -0.9797 1.175 0.9598 1.381 -1.151
## mht.name.dDesertsandxericshrublands mht.name.dTemperateconiferousforests mht.name.dTropicalandsubtropicalgrasslandssavannasandshrublands
## 1 0 1 0
## mht.name.dTropicalandsubtropicalmoistbroadleafforests koeppengei.dAf koeppengei.dAw koeppengei.dCsb continent.dAfrica continent.dAsia
## 1 0 0 0 0 0 0
## continent.dNorthAmerica region.dNorthernAmerica bio.7 bio.4 bio.6 bio.16 bio.1 bio.2 bio.3 bio.5 bio.8 bio.9 bio.10 bio.11 bio.12
## 1 1 1 219 -0.045 -0.3824 1.195 -0.8402 -1.571 -1.049 -1.633 -0.9702 -0.2264 -1.282 -0.5713 1.394
## bio.13 bio.14 bio.15 bio.17 bio.18 bio.19 meanalt mnnpp sdalt society lati long dxid EA.v80Sq SCCS.v855Sq SCCS.v1267Sq SCCS.v1268Sq
## 1 1.503 1.596 -0.7174 1.575 0.6257 1.173 -0.73 -0.585 -0.1138 Tlingit 57 -133.6 1 1 4 9 1
## SCCS.v1265Sq SCCS.v1263Sq SCCS.v1269Sq SCCS.v1685Sq SCCS.v1683Sq SCCS.v929Sq LRB.mdivlabSq SCCS.v585Sq SCCS.v886Sq SCCS.v885Sq SCCS.v887Sq
## 1 16 9 4 1 1 64 6084 25 400 225 900
## SCCS.v890Sq SCCS.v889Sq EA.v32Sq SCCS.v1740Sq SCCS.v158Sq SCCS.v237Sq EA.v33Sq bio.4Sq bio.6Sq bio.16Sq bio.1Sq bio.2Sq bio.3Sq bio.5Sq bio.8Sq
## 1 0 144 4 49 4 1 1 0.002025 0.1462 1.428 0.706 2.469 1.1 2.668 0.9413
## bio.9Sq bio.10Sq bio.11Sq bio.12Sq bio.13Sq bio.14Sq bio.15Sq bio.17Sq bio.18Sq bio.19Sq meanaltSq mnnppSq sdaltSq latiSq longSq
## 1 0.05125 1.644 0.3264 1.942 2.259 2.547 0.5146 2.482 0.3915 1.377 0.5329 0.3423 0.01296 3249 17846
Scales should be made after imputation. Below, scales are created for technological level.
is.na(smi$tech)<-TRUE
for (i in 1:max(smi$.imp)){
zh<-which(smi$.imp==i)
ddd<-as.matrix(smi[zh,tchx])
bb<-(t(ddd)%*%ddd)
bb<-bb/diag(bb) #Prob(column task present|row task present)
rs<-round(rowSums(bb-t(bb)),4)
smi[zh,"tech"]<-as.numeric(scale(ddd%*%as.matrix((rs)))*1.5+10)
}
Below, scales are made for beneficent environment, female economic contribution, and degree of social hierarchy. We use the function mkscale(), and choose to take the mean of the standardized component variables. The function allows one to select a component variable with which the final scale will covary positively. Output includes the Cronbach’s alpha, Pearson correlation coefficients of components on the final scale, and short descriptions of the component variables.
prp<-mkscale(compvarbs="enviro",impdata=smi,type="mean",add.descrip="Benficent environment",set.direction="bio.16",set.range=c(0,10))
## [1] "enviro.mean"
## c("bio.7", "bio.4", "SCCS.v855", "SCCS.v1267", "SCCS.v1685", "SCCS.v1265", "SCCS.v1269", "SCCS.v1268", "SCCS.v1263", "SCCS.v1683", "bio.6", "SCCS.v929", "bio.16")
print(prp$stats) # cronbach alpha
## std.alpha
## 1 0.8399
print(prp$corrs) # correlation of components with final scale
## cor.w.scale inv varb description
## bio.7 -0.798 -1 bio.7 BIOCLIM: Temperature Annual Range (bio_5-bio_6) (dgC*10)
## bio.4 -0.781 -1 bio.4 BIOCLIM: Temperature Seasonality (standard deviation *100)
## SCCS.v855 -0.714 -1 SCCS.v855 Niche Rainfall (Approximate) Adapted from William Goode, World Atlas
## SCCS.v1267 -0.564 -1 SCCS.v1267 Severity of Famine
## SCCS.v1685 -0.477 -1 SCCS.v1685 Chronic Resource Problems (Resolved Ratings)
## SCCS.v1265 -0.454 -1 SCCS.v1265 Occurrence of Famine
## SCCS.v1269 -0.453 -1 SCCS.v1269 Recurrence of Famine
## SCCS.v1268 -0.394 -1 SCCS.v1268 Persistence of Famine
## SCCS.v1263 -0.386 -1 SCCS.v1263 Occurrence of Seasonal Starvation
## SCCS.v1683 -0.372 -1 SCCS.v1683 Threat of Famine (Resolved Rating)
## bio.6 0.722 1 bio.6 BIOCLIM: Min Temperature of Coldest Month (dgC*10)
## SCCS.v929 0.726 1 SCCS.v929 Average Annual Rainfall
## bio.16 0.767 1 bio.16 BIOCLIM: Precipitation of Wettest Quarter (mm)
print(prp$varb.desc) # description of components
## [,1]
## [1,] "====== [ bio.7 ] BIOCLIM: Temperature Annual Range (bio_5-bio_6) (dgC*10) ========"
## [2,] "range: 57 to 622"
## [3,] "====== [ bio.4 ] BIOCLIM: Temperature Seasonality (standard deviation *100) ========"
## [4,] "range: 111 to 19190"
## [5,] "====== [ SCCS.v855 ] Niche Rainfall (Approximate) Adapted from William Goode, World Atlas ========"
## [6,] "[1]: Tropical rainforest |+| [7]: Desert"
## [7,] "====== [ SCCS.v1267 ] Severity of Famine ========"
## [8,] "[1]: Very Low |+| [4]: Very High"
## [9,] "====== [ SCCS.v1685 ] Chronic Resource Problems (Resolved Ratings) ========"
## [10,] "[1]: Low or rare (original code 1) |+| [5]: Most members of the population usually do not have enough to eat - i.e., th"
## [11,] "====== [ SCCS.v1265 ] Occurrence of Famine ========"
## [12,] "[1]: Very Low |+| [4]: Very High"
## [13,] "====== [ SCCS.v1269 ] Recurrence of Famine ========"
## [14,] "[1]: Low |+| [3]: High"
## [15,] "====== [ SCCS.v1268 ] Persistence of Famine ========"
## [16,] "[1]: Low |+| [3]: High"
## [17,] "====== [ SCCS.v1263 ] Occurrence of Seasonal Starvation ========"
## [18,] "[1]: Very Low |+| [5]: Very High"
## [19,] "====== [ SCCS.v1683 ] Threat of Famine (Resolved Rating) ========"
## [20,] "[1]: Low threat of famine in the 25-year time period - food is reported to be am |+| [6]: High - more than one famine occurred during the 25-year time period (origin"
## [21,] "====== [ bio.6 ] BIOCLIM: Min Temperature of Coldest Month (dgC*10) ========"
## [22,] "range: -413 to 251"
## [23,] "====== [ SCCS.v929 ] Average Annual Rainfall ========"
## [24,] "[0]: 0mm < rainfall < 20 mm |+| [8]: 1000mm < rainfall"
## [25,] "====== [ bio.16 ] BIOCLIM: Precipitation of Wettest Quarter (mm) ========"
## [26,] "range: 0 to 1830"
smi[,names(prp$scales)]<-prp$scales # adding scale and scale-squared to smi
prp<-mkscale(compvarbs="femecon",impdata=smi,type="mean",add.descrip="Female economic contribution",set.direction="SCCS.v889",set.range=c(0,10))
## [1] "femecon.mean"
## c("LRB.mdivlab", "SCCS.v585", "SCCS.v886", "SCCS.v885", "SCCS.v887", "SCCS.v890", "SCCS.v889")
smi[,names(prp$scales)]<-prp$scales
prp<-mkscale(compvarbs="hierar",impdata=smi,type="mean",add.descrip="Degree of social hierarchy",set.direction="EA.v32",set.range=c(0,10))
## [1] "hierar.mean"
## c("EA.v67.d9", "SCCS.v2012.d1", "SCCS.v91.d4", "EA.v32", "EA.v68.d2", "SCCS.v1740", "SCCS.v158", "SCCS.v237", "EA.v33")
smi[,names(prp$scales)]<-prp$scales
We will estimate a multinomial logit model with dwelling floor level as the dependent variable, so we create a factor for dwelling floor.
o<-(smi$EA.v80==1)*1+(smi$EA.v80==2)*2+(smi$EA.v80>=3)*3
smi$floor<-factor(o,levels=1:3,labels=c("blwground","ground","abvground"))
o<-(dx$EA.v80==1)*1+(dx$EA.v80==2)*2+(dx$EA.v80>=3)*3
dx$floor<-factor(o,levels=1:3,labels=c("blwground","ground","abvground"))
addesc("floor","dwelling floor relative to ground")
All of the variables selected to play a role in the model must be found in the new dataframe smi. Below, the variables are organized according to the role they will play.
# --dependent variable--
dpV<-"floor"
#--independent variables in UNrestricted model--
UiV<-c("enviro.mean","hierar.mean","femecon.mean","tech")
#--independent variables in restricted model (all must be in UiV above)--
RiV<-c("enviro.mean","hierar.mean","tech")
The command doMNLogit() performs multinomial logit estimation, where the dependent variable is a categorical variable, with three or more categories. The function estimates the model on each of the imputed datasets, collecting output from each estimation and processing them to obtain final results. To control for Galton’s Problem, a network lag model is used, based on the optimal combination of geographic proximity (dw) and linguistic proximity (lw) weight matrices.
h<-doMNLogit(smi,dpV,UiV,RiV,dw=TRUE,lw=TRUE,doboot=300,subgrps=NULL,full.set=FALSE)
## [1] "--finding optimal weight matrix---"
## [1] 1
## [1] 2
## [1] 3
## [1] 4
## [1] 5
## Time difference of 5.015 mins
The output from doMNLogit(), here called h, is a list containing 23 items.
name | description |
---|---|
DependVarb | Description of dependent variable |
URmeanME.MargEff | Mean marginal effects for unrestricted model, with Fst, df, and pvalue |
URmeanME.MEpval | Mean marginal effects for unrestricted model. Pvalues only. |
URmeanME.MEmean | Mean marginal effects for unrestricted model. Mean only. |
RmeanME.MargEff | Mean marginal effects for restricted model, with Fst, df, and pvalue |
RmeanME.MEpval | Mean marginal effects for restricted model. Pvalues only. |
RmeanME.MEmean | Mean marginal effects for restricted model. Mean only. |
URdifME | Differences in mean marginal effects across alternatives: unrestricted model. |
RdifME | Differences in mean marginal effects across alternatives: restricted model. |
URcoef | Coefficient estimates from the unrestricted model. |
Rcoef | Coefficient estimates from the restricted model. |
TestRestr | Two tests for model restrictions (H0: dropped variables don’t belong in the model). |
TestIIA | Tests for each alternative of Independence of Irrelevant Alternatives (H0: dropping alternative does not affect choice for other alternatives). |
URpredTable.predTable | Table comparing predicted choices with actual choices: unrestricted model. |
URpredTable.crlg | Ratio of number of correct choices over number in largest alternative: unrestricted model. |
RpredTable.predTable | Table comparing predicted choices with actual choices: restricted model. |
RpredTable.crlg | Ratio of number of correct choices over number in largest alternative: restricted model. |
OtherStats | Other statistics: Composite weight matrix weights; ratio of number of correct predictions over number in largest category; number of imputations; number of observations; number of bootstrap iterations. |
UsubgrpDiff | Comparing mean marginal effects across two subgroups indicated by 0,1 binary variable: mean of group 1 minus mean of group 0, with pvalue. Unrestricted model. |
RsubgrpDiff | Comparing mean marginal effects across two subgroups indicated by 0,1 binary variable: mean of group 1 minus mean of group 0, with pvalue. Restricted model. |
URmarEff | Society-level marginal effects calculated using final coefficient values and mean (across imputations) data values: unrestricted model. |
RmarEff | Society-level marginal effects calculated using final coefficient values and mean (across imputations) data values: restricted model. |
data | Mean (across imputations) data values for each society. |
Estimated coefficients are not interesting for multinomial logit. Instead, one usually examines the mean marginal effects. Below are the mean marginal effects for the unrestricted and restricted models.
h$URmeanME.MargEff
## varb altern margEff fst df pval star
## 1 cy abvground 1.206672 2.5713 678 1.093e-01
## 13 tech abvground 0.027640 3.7562 1504 5.280e-02 *
## 4 enviro.mean abvground 0.034549 26.8752 312 3.908e-07 ***
## 10 hierar.mean abvground 0.014001 2.5205 4072 1.125e-01
## 7 femecon.mean abvground 0.013627 2.3230 28065 1.275e-01
## 2 cy blwground -0.184097 2.6362 110 1.073e-01
## 14 tech blwground -0.084437 8.1257 26 8.433e-03 ***
## 5 enviro.mean blwground -0.006626 0.2616 199 6.096e-01
## 11 hierar.mean blwground -0.005942 0.0712 20 7.923e-01
## 8 femecon.mean blwground -0.020181 1.4649 287 2.272e-01
## 3 cy ground 0.597792 17.4575 174 4.642e-05 ***
## 15 tech ground 0.056797 2.7940 45 1.016e-01
## 6 enviro.mean ground -0.027923 3.8456 273 5.089e-02 *
## 12 hierar.mean ground -0.008059 0.1205 30 7.309e-01
## 9 femecon.mean ground 0.006554 0.1211 524 7.280e-01
h$RmeanME.MargEff
## varb altern margEff fst df pval star
## 1 cy abvground 1.330553 3.04512 463 8.164e-02 *
## 10 tech abvground 0.027742 3.69750 850 5.483e-02 *
## 4 enviro.mean abvground 0.037234 31.47815 216 6.141e-08 ***
## 7 hierar.mean abvground 0.013097 2.11358 1380 1.462e-01
## 2 cy blwground -0.153387 1.88600 172 1.714e-01
## 11 tech blwground -0.083511 8.61580 39 5.562e-03 ***
## 5 enviro.mean blwground -0.008456 0.46004 197 4.984e-01
## 8 hierar.mean blwground -0.004693 0.05046 28 8.239e-01
## 3 cy ground 0.601485 20.18853 166 1.310e-05 ***
## 12 tech ground 0.055770 2.92319 69 9.181e-02 *
## 6 enviro.mean ground -0.028778 4.62298 398 3.215e-02 **
## 9 hierar.mean ground -0.008404 0.15324 47 6.972e-01
h$TestRestr
## Dm pvald star
## LRtestR 2.316 0.1284
## waldtestR 1.750 0.1863
h$OtherStats
## wtl wtd UpT.crlg RpT.crlg nimp nobs doboot
## 1 0.79 0.21 1.008 1.004 5 355 300
One can write the list h to a csv format file that can be opened as a spreadsheet. Below, h is written to a file in the working directory called “MNLresults.csv”.
CSVwrite(h,"MNLresults",FALSE)
The function MEplots() will plot marginal effects, for each category/variable combination.
MEplots(h,mod="UR",setylim=UiV)