Working *Rccs* models

From InterSciWiki
Revision as of 13:34, 30 September 2010 by Ahwalker (talk | contribs) (Codebook to choose your topic (dependent) variable and Place to put your TOPIC)
Jump to: navigation, search

WARNING: Your list of indep_vars must have at least one additional variable compared to restrict_vars

Codebook to choose your topic (dependent) variable and Place to put your TOPIC

your topics

References:

Broude, Gwen, and Sarah J. Greene. 1976. Cross-Cultural Codes on Twenty Sexual Attitudes and Practices. ETHNOLOGY. 15:409-429. http://www.jstor.org/stable/3773308
H Barry III, A Schlegel. 1984. Measurements of Adolescent Sexual Behavior in the Standard Sample of Societies. ETHNOLOGY. 24:315-329. http://www.jstor.org/pss/3773508

Reference: Journal of Marriage and Family Vol. 62, No. 2 (May, 2000), pp. 298-320 Published by: National Council on Family Relations http://www.jstor.org/stable/1566741

Current Anthropology Vol. 23, No. 1 (Feb., 1982), pp. 1-12 ublished by: The University of Chicago Press on behalf of Wenner-Gren Foundation for Anthropological Research http://www.jstor.org/stable/2742548 Stephen K. Sanderson Explaining Monogamy and Polygyny in Human Societies, https://vpn.nacs.uci.edu/+CSCO+ch756767633A2F2F7A6866722E7775682E727168++/journals/social_forces/v080/80.1sanderson.html

Co-Wife Conflict and Co-operation William Jankowiak, Monika Sudakov, Benjamin C. Wilreker Ethnology Vol. 44, No. 1 (Winter, 2005), pp. 81-98 Published by: University of Pittsburgh- Of the Commonwealth System of Higher Education Stable URL: http://www.jstor.org/stable/3773961

How to do your CreateModel....R program

New Method

  • Stage 1 Choose a working "prototype", e.g, one of these:
CreateModelDRWpolygyny.R
CreateModelValueSDWchildren.R

Press edit, copy, and paste to your own wiki page as follows, with XYZ = YOUR THREE INITIALS, Your dependent variable e.g., v242

  • Toward the bottom of the program change
name<-"how society values children"
alias<-"DRWchildren"
to:
name<-"Your topic phrase"
alias<-"XYZtopic"
  • Stage 2 Modifications to your own "CreateModelXYZv242.R" wiki page, with a copy of the contents of your "prototype"
  • Stage 3 Change the dependent variables, see if the program works
  • Stage 4 Change the independent variable

Stage 2 Modifications to your own prototype wiki page, e.g., "CreateModelXYZv242.R"

  1. You've made your own "CreateModelXYZv242.R" wiki page
  2. In your page, copy and paste: [[User:Your user name]]
  3. Above where you've copied contents of your prototype program
  4. Create a heading in your wiki page ==A Program CreateModelXYZv242.R== for your program
  5. In edit mode, copy contents of your page
  6. Use the slider on the wiki page, right side, to go to the bottom of the wiki page, and SAVE.
  7. Open R.
  8. Paste your program into into R.
  9. Report whether your program runs

Stage 3 Change the dependent variables and do test runs

  1. If your program didn't run, notify the instructor if you are in class or email him the address of your user page.
  2. If your program did run, you are ready to begin to change your program:
    1. First, change the dependent variable by substituting your variable number, e.g., v242, and remove any independent_variable that has that variable number, e.g., v242.
    2. Rerun your program. If it runs do item 1 in this stage 3. Once your program runs correctly, KEEP any independent_variables with pvalue <.15 and DROP any with pvalue equal or >.15. Rerun your program. If it runs do item 1 in this stage. Repeat. Now, in Stage 4 you can add independent_variables if needed.

Stage 4

  1. Add an independent_variable as needed ONE AT A TIME, Repeating Stage 3.2.1 and 3.2.2. Continue if you have low R2.

Stage 5

  • When you have a successful model, add an entry for it on this wiki page with the name of your Model in double square brackets.
  • If you need help from the instructor, add an entry for it on the Nonworking *Rccs* models wiki page and I will look at it

and help debug the errors that keep it from running.

Old method

If you've started the code for your project and it isn't working --> to get help

Copy the page with your code and your user name to Nonworking *Rccs* models

General polygyny with more variables DRW

User:Doug White==
setwd("C:/My Documents/sccs")
library(sccs)
data(sccs)
source("examples/src/createmodelDRWpolygyny2.R") #define model, e.g., CreateModelDRWpolygyny2.R 
source("examples/src/CreateModelDRWpolygyny.R") #define model, e.g., CreateModelDRWpolygyny.R - CreateModelDRWpolygyny2.R" 
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

Value of children

Eff, E. Anthon, and Malcolm Dow. 2009. How to Deal with Missing Data and Galton's Problem in Cross-Cultural Survey Research: A Primer for R

setwd("C:/My Documents/sccs")
library(sccs)
data(sccs)
source("examples/src/CreateModelValueSDWchildren.R") #define model CreateModelValueSDWchildren.R
source("examples/src/run_model.R") #for model currently defined, does multiple imputation, 
*calls two stage ols and saves to file to the working directory.
ols_stats$restrict_stats
ols_stats$r2
ols_stats$restrict_diagnostics


General polygyny with few variables DRW

User:Doug White==
setwd("C:/My Documents/sccs")
library(sccs)
data(sccs)
source("examples/src/poly.R") 
source("examples/src/create_model_DRWpolygyny.R") #define model create_model_DRWpolygyny.R
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

Notes

WARNING: run_model.R will not work when you have a *.csv file open to check the last results but you dont need to do this because the output is printed to the screen by the ols_stats commands.
You will change the name of the .R file in the first line of the program and edit its contents
source("examples/src/create_model_XYZv242.R") #defines the model  
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 #these three commands print the output to the screen
ols_stats$r2
ols_stats$restrict_diagnostics
after source("examples/src/create_model_XYZv242.R") #defines the model  
source("sccs/R/two_stage_ols.R") #loads the new code into R but doesn't run anything yet until called by "run_model.R")