公卫百科  > 所属分类  >  Stata   
[1] 评论[0] 编辑

sf12v2

Below it the do-file to replicate Dr. Hays' SAS output and the Stata program 公卫家园

sf12v2

公卫家园

Hope this helps, 公卫百科

Scott 公卫百科

----------do-file----------
clear
input I1-I12
1 1 1 1 1 1 1 1 1 1 1 1 
1 1 3 3 3 3 3 3 3 3 3 3 
1 1 . 3 3 3 3 3 3 3 3 3 
5 5 1 1 1 . . . . . . . 
end

// Rename variables
local i = 1
foreach l in I1   I2A  I2B  I3A  I3B  I4A  I4B  I5   I6A  I6B  I6C  I7 {
	capture: rename I`i' `l'
	local ++i
	}
l
sf12v2

----------sf12v2-------------

program sf12v2
	version 9.1
	qui {
	
	// Code out-of-range values to missing
	foreach l in I1 I3A I3B I4A I4B I5 I6A I6B I6C I7 {
		replace `l' = . if `l' != 1 & `l' != 2 &`l' != 3 &`l' != 4
&`l' != 5
	}
		
	foreach l in I2A I2B {
		replace `l' =.  if `l' != 1 & `l' != 2 &`l' != 3
	}
		
	// When necessary, reverse code items so a higher score means better
health
	replace I1 = cond(I1 == 1, 5, ///
		cond(I1 == 2, 4.4, ///
		cond(I1 == 3, 3.4, ///
		cond(I1 == 4, 2, ///
		cond(I1 == 5, 1,.)))))
		
	replace I5 = 6-I5
	replace I6A = 6-I6A
	replace I6B = 6-I6B
	
	//Create Scales
	
	generate PF=I2A+I2B
	generate RP=I3A+I3B
	generate BP=I5
	generate GH=I1
	generate VT=I6B
	generate SF=I7
	generate RE=I4A+I4B
	generate MH=I6A+I6C
	
	replace PF=100*(PF-2)/4
	replace RP=100*(RP-2)/8
	replace BP=100*(BP-1)/4
	replace GH=100*(GH-1)/4
	replace VT=100*(VT-1)/4
	replace SF=100*(SF-1)/4
	replace RE=100*(RE-2)/8
	replace MH=100*(MH-2)/8
	
	// 1) Transform scores to Z-scores
	//    US general population means and sd are used here 
	//    (not age/gender based) 
              
   	generate PF_Z = (PF - 81.18122) / 29.10588 
   	generate RP_Z = (RP - 80.52856) / 27.13526 
   	generate BP_Z = (BP - 81.74015) / 24.53019 
   	generate GH_Z = (GH - 72.19795) / 23.19041 
   	generate VT_Z = (VT - 55.59090) / 24.84380 
   	generate SF_Z = (SF - 83.73973) / 24.75775 
   	generate RE_Z = (RE - 86.41051) / 22.35543 
   	generate MH_Z = (MH - 70.18217) / 20.50597 
   	
   	// 2) Create physical and mental health composite scores: 
	//    multiply z-scores by varimax-rotated factor scoring 
	//    coefficients and sum the products 
	
	generate AGG_PHYS = (PF_Z * 0.42402) + ///
	              (RP_Z * 0.35119) + ///
	              (BP_Z * 0.31754) + ///
	              (GH_Z * 0.24954) + ///
	              (VT_Z * 0.02877) + ///
	              (SF_Z * -.00753) + ///
	              (RE_Z * -.19206) + /// 
	              (MH_Z * -.22069) 
	              
	              
	generate AGG_MENT = (PF_Z * -.22999) + /// 
	              (RP_Z * -.12329) + ///
	              (BP_Z * -.09731) + ///
	              (GH_Z * -.01571) + ///
	              (VT_Z * 0.23534) + ///
	              (SF_Z * 0.26876) + ///
	              (RE_Z * 0.43407) + ///
	              (MH_Z * 0.48581) 
	
	
	// 3) Transform composite and scale scores to t-scores
	
	replace AGG_PHYS = 50 + (AGG_PHYS * 10)
	replace AGG_MENT = 50 + (AGG_MENT * 10)
	
	label var  AGG_PHYS "NEMC Physical Health T-Score - SF12"
	label var AGG_MENT "NEMC Mental Health T-Sscore - SF12"
	
	generate PF_T = 50 + (PF_Z * 10) 
	generate RP_T = 50 + (RP_Z * 10) 
	generate BP_T = 50 + (BP_Z * 10) 
	generate GH_T = 50 + (GH_Z * 10) 
	generate VT_T = 50 + (VT_Z * 10) 
	generate RE_T = 50 + (RE_Z * 10) 
	generate SF_T = 50 + (SF_Z * 10) 
	generate MH_T = 50 + (MH_Z * 10) 
	
	label var PF_T "NEMC Physical Functioning T-Score"
	label var RP_T "NEMC Role Limitation Physical T-Score"
	label var BP_T "NEMC Pain T-Score"
	label var GH_T "NEMC General Health T-Score"
	label var VT_T "NEMC Vitality T-Score"
	label var RE_T "NEMC Role Limitation Emotional T-Score"
	label var SF_T "NEMC Social Functioning T-Score"
	label var MH_T "NEMC Mental Health T-Score"

	local names "PF PF_T RP RP_T  BP BP_T GH GH_T VT VT_T SF SF_T RE
RE_T MH MH_T AGG_PHYS AGG_MENT"
	}
	tabstat `names', stat(N mean sd min max) c(s) 
end  
公卫考场

公卫考场

附件列表


1

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

如果您认为本词条还有待完善,请 编辑

上一篇 sf12    下一篇 步世忠

标签

暂无标签

参考资料

[1].  Scoring the SF-12v2   http://www.stata.com/statalist/archive/2006-02/msg00313.html

同义词

暂无同义词