数据分析notes
stratified sampling可以在excel里面做。每个年级选两个班,可以用randbetween(a,b)生成随机数,然后随便选几组不重复的即可。每班选20人,可以先用rand()生成随机数,然后按随机数排列大小,选前20人,然后再按学号重新排列即可。
SPSS里有sampling wizard可以建立一个csaplan file. 按Analyze-complex sample-prepare for analysis-create a file
整理变量时,有些题目需要重新赋值用transform-recode to same/different variable 事先将需要处理的数据记下来,变的时候得小心检查。e.g. Recode emotion(MISSING=SYSMIS) (lowest through 3=0)(4=1)(5 through highest=2) INTO emotion-diag /VARIABLE LABEL /VALUE LABELS. Recode可以分情况讨论,用if和end if。
data-restructure 横向标题一般为variable,纵向为cases。如果有好几组数测的不是不同变量而是同一个变量的话,需要用variables to cases (VARSTOCASES)功能。如果好几个cases测的都是同一个个体的话,则使用cases to variables。比如self-report, teacher form, parent form用CASESTOVARS. 然后 /MAKE A from B /INDEX=index(要变成cases的variables的数量)/KEEP 不需要变的变量 (keep and treat as fixed variables) /NULL=KEEP.
两个file合并,可以使用KEEP和DROP variables or cases.
虽然syntax有很多好处,merge files的时候用下拉菜单操作然后paste syntax比较好。(http://growingupinscotland.org.uk/wp-content/uploads/2013/05/HandoutCreateMergeData.pdf)