Dow and Eff Simple Functions

From InterSciWiki
Jump to: navigation, search
A drw variant of DEf  LRB05drw.R, e.g., aa for sccs  is a variant of Dow and Eff DEf.  -- Dow-Eff References
Dow Eff functions

"there are two different versions of the restricted model ("Rmodel" and "RmodelRobust"), the first is the restricted model since the second should be used when the errors are heteroskedastic." -- original EAF1 and DRW2 are ok - this message goes at top of each model. Heteroskedastic Breusch-Pagan test. H0: residuals homoskedastic

New Builds of the R library for Dow and Eff Simple Functions
  • DON'T USE ANY MODELS BELOW HERE FOR FUTURE MODELING EFFORTS - THE ONES ABOVE ARE CONGRUENT WITH CoSSci and DEf to date Doug (talk) 12:19, 16 February 2013 (PST)

Scott Coltrane -- Dow & Eff Functions 2 - Sanday - V676 Gender Origin Symbolism #Dec 19, 2012 Runs: Dec 31, 2012 - SCCScodes - Scott Coltrane

DEz2example.R

Dow & Eff Functions 2 - Sanday - V676 Gender Origin Symbolism #Dec 19, 2012 Runs: Dec 31, 2012 - SCCScodes - Scott Coltrane

Dow & Eff Functions 1
Sccs Rdata variable names
Dow and Eff Simple Functions Vers 0
Dow and Eff Simple Functions Vers 0 CoSsci
Dow and Eff Simple Functions Vers 1
Dow and Eff Simple Functions Vers 2 FROM SEPTEMBER DE.Rdata not the last, should be DE7.Rdata
Dow and Eff Simple Functions Vers 3 NOT WORKING - TWO UNDEFINED INDEPVARS
Dow and Eff Simple Functions Vers 4 WORKING - REMOVED TWO UNDEFINED INDEPVARS
Dow and Eff Simple Functions Vers 5 Oct 2, 2012
Dow & Eff Functions1 Model DRW2 is DRW's version DRW2 of a Brown-Eff Model? Its the one at the Gateway
Dow & Eff Functions1 Model DRW2MystRet no effect of v652 Mystical Retribution
Dow and Eff Simple Functions Moral Gods
Dow and Eff Simple Functions Moral Gods 1
Dow and Eff Simple Functions Moral Gods 2 USES comb.Rdata and gets wages right
Dow and Eff Simple Functions Moral Gods 3 WORKS BUT NOT EFF'S LATEST SCRIPT: USES comb.Rdata and gets wages right
Dow and Eff Simple Functions Moral Gods 4 EFF 4 - WORKING: CHANGED DEPVAR to HiGod AFTER REMOVING TWO UNDEFINED INDEPVARS
Dow and Eff Simple Functions Moral Gods 5 MODIFY Moral Gods 4 - ADD NEW INDEPVARS
Dow and Eff Simple Functions Moral Gods 6 Works HiGod, wages
Dow and Eff Simple Functions Moral Gods 7 
Dow and Eff Simple Functions Moral Gods 8 Two HiGod models, FxCmntyWages > Writing
Dow and Eff Simple Functions Moral Gods 9 Add bio data
Dow and Eff Simple Functions Moral Gods 10 Bio.5 and No_rain_Dry do not work together as princomp(too orthogonal)       "wages" twice in evm list above below, removed but not tested
Dow and Eff Simple Functions Moral Gods 11
Dow and Eff Simple Functions Moral Gods 11A Recode CONTINENT EFFECT Model 9 with ramp-up of MI parameters and a test for FxCmtyWages that fails
Dow and Eff Simple Functions Moral Gods 12 Model 9 with ramp-up of MI parameters, no Missions no FxCmtyWages
Dow and Eff Simple Functions Moral Gods 13 Model 9 with ramp-up of MI parameters,     Missions but no FxCmtyWages     "wages" twice in evm list above, removed and tested below
Dow and Eff Simple Functions Moral Gods 14 Model 9 with ramp-up of MI parameters,     Missions but no FxCmtyWages  Individualism
Dow and Eff Simple Functions Moral Gods 15 Model 15 DELETE NO_RAIN AND V740 
Dow and Eff Simple Functions Moral Gods 16 Model 15 DELETE NO_RAIN AND V740 AND (RECODE v200) as an effect: Eurasia to Oceanea
Dow and Eff Simple Functions Moral Gods 17 Model 15 + bio.5 <------- take your choice
Dow and Eff Simple Functions Moral Gods 18 Model 15 + No_rain_Dry <- take your choice
Dow and Eff Simple Functions Moral Gods 18MystRet no effect of v652 Mystical Retribution
Dow and Eff Simple Functions Moral Gods 19 COMBINING No_rain_Dry and bio5 DOES NOT WORK
Dow and Eff Simple Functions Moral Gods 20 Model 19 No_rain_Dry and bio5 DOES NOT WORK without  Eurasia to Oceanea. ATTEMPED FACTOR ROTATION OF the two variables COULDNT MAKE IT WORK
#--Dow & Eff simple functions Oct 1 2012 Works-- Anthon Version
#Install packages listed below
setwd("e:/Dropbox/Abhradeep")  # change working directory to your own
setwd("/Users/drwhite/Documents/3sls/sccs")
setwd("/Users/douglaswhite/Documents/3sls/sccs") #Mac 10.7.5 is R version 2.16.1 (2012-06-22) (didn't work)
setwd("/Users/douglaswhite/Documents/3sls/sccs")
setwd("/Users/douglaswhite")
setwd("/Users/drwhite/Documents/3sls/sccs") #MidMac 10.6.8 R version 2.12.2 (2011-02-25) GUI 1.36 Leopard build 64-bit (5691) (worked)
setwd("/Users/drwhite/Documents/3sls/sccs") #OldMac 10.6.8 R version 2.15.0 Patched 2012-04-20) (worked)
rm(list=ls(all=TRUE))
options(echo=TRUE)
library(mice)
library(foreign)
library(stringr)
library(psych)
library(AER)
sessionInfo()

# ================================
# --bring in functions and data--
# ================================
load(url("http://dl.dropbox.com/u/9256203/DE.Rdata"),.GlobalEnv)
ls() #-can see the objects contained in DE.Rdata

sccsA$valchild=(sccsA$v473+sccsA$v474+sccsA$v475+sccsA$v476)
mkdummy("v233",4)
mkdummy("v233",5)
mkdummy("v244",2)
mkdummy("v244",7)
mkdummy("v245",2)
mkdummy("v899",1)

evm<-c("socname","v203","v204","v1685","v156","v72","v234","v236","v238","v1648",
       "v155","v233d4","v233d5","v244d2","v244d7","v245d2","v899d1","valchild")

a<-sccsAkey[evm,];a[grep("catego",a$varbtype),] #make sure variables are ordinal


# ================================
# --make imputed data--
# ================================
smi<-doimp(sccsA[,evm],nimp=2,maxit=3);dim(smi)
smi[1:2,]

# ================================
# --identify variables for model--
# ================================
# --dependent variable--
dv<-"valchild"
#-independent variables in UNrestricted model--
iv<-c("v203","v204","v1685","v156","v72","v234","v236","v238","v1648",
         "v155","v233d4","v233d5","v244d2","v244d7","v245d2","v899d1")
#--additional exogenous variables (use in Hausman tests)--
#--independent variables in restricted model--
riv<-c("v155","v233d4","v233d5","v244d2","v244d7","v245d2","v899d1")
oexog<-c(paste("bio.",c(1:6,8:19),sep=""),"meanalt","mnnpp")


# ================================
# --estimate regression model-----
# ================================
h<-miolsest(smi,depvar=dv,indpv=iv,rindpv=riv,othexog=oexog)
print(h)
# ================================
# --print output to csv file--
# ================================
 CSVwrite(names(h),"z",FALSE)
sapply(1:length(h),function(x) CSVwrite(hx,"z",TRUE))


#CSVwrite(names(h),"z",FALSE)

 CSVwrite(h[[x]],"z",TRUE) 
 
sapply(1:length(h),function(x)