User:Ahwalker

From InterSciWiki
Revision as of 13:39, 30 September 2010 by Ahwalker (talk | contribs)
Jump to: navigation, search

1009. Labor

    134     . = Missing data
    13    1 = No wage or coerced labor
     3    2 = Coerced labor - internal ([large scale] slavery, vassals,
         corvee)
     2    3 = Coerced labor - external
    10    4 = Labor hired - local service occupations
    12    5 = Migrant wage labor (cash) -
     9    6 = Local wage labor (cash/kind) - partial (incl. crafts, traps)
     3    7 = Market for all types of labor

setwd("C:/My Documents/sccs") library(sccs) data(sccs)

my_sccs<-data.frame( dep_var=sccs$v860, socname=sccs$socname,socID=sccs$"sccs#", fratgrpstr=sccs$v570, plow=(sccs$v243>1)*1, fem_agri=log(1+sccs$v821), pre_mar_sex=sccs$v167 )

indep_vars<-c("fratgrpstr","plow","fem_agri","pre_mar_sex")

  1. restrictvars must drop one or more indepvars - in this case, dropping "pre_mar_sex"

restrict_vars=c("fratgrpstr","plow","fem_agri")

library(foreign)

  1. --Read in two weight matrices--

Wll<-as.matrix(read.dta("./examples/data/langwm.dta")[,-1]) Wdd<-as.matrix(read.dta("./examples/data/dist25wm.dta")[,c(-1,-2,-189)])

load("./examples/data/vaux.Rdata",.GlobalEnv) my_aux = vaux row.names(my_aux)<-NULL

  1. --remove the society name field--

my_aux<-my_aux[,-28]

name<-"Migrant Labor" alias<-"AHWlabor"

model=list(name=name,

          alias=alias,
          data=my_sccs,
          aux_data=my_aux,
          prox_list=list(language=Wll,distance=Wdd),
          dep_var="dep_var",
          indep_vars=indep_vars,
          restrict_vars=restrict_vars)

save(model,file=paste(alias,".Rdata",sep=""))

source("examples/src/run_model.R") #for model currently defined, does multiple imputation,

  • calls two stage ols and saves results to file to the working directory.

ols_stats$restrict_stats ols_stats$r2 ols_stats$restrict_diagnostics