@Ksharp @PaigeMiller @Kurt_Bremser @Shmuel @Tom
Thank you all so much for your reply. I very much appreciate your time!
My condition is like this, I have a test contains 150 items, each of the item will be dichotomously coded as 0, 1, that is, if examinee get one item correct, then the examinee get 1 point, otherwise, the examinee get 0 point, so the raw score range is [0, 150] for this whole test. Before this test is being administered, I need to calculate the examinee estimated ability corresponding to each raw score. Higher raw score means examinee has higher ability, lower raw score means examinee has lower ability.
To get what I wanted, I need to calculate the probability of examinee correctly answering an item given a certain ability level. Corresponding to 150 items, there will be 150 probabilities. The summation of all those 150 probabilities is called “TCC”. I have a criteria delta=0.000001, when the difference between TCC and raw score is close to this criteria delta, the iteration will stop.
All the information I have is item difficulty parameter (please see the attached "ITRDATA.csv") and the following SPSS syntax. I need to get a raw to theta conversion table (please see the “raw to theta conversion.csv”) using SAS. In case my explanation is confusing, I think it’s better to post the whole SPSS syntax here. I am sorry for this long syntax. Since there are some common grounds between codes, I am sure your SAS experts would have a rough idea of what do these codes mean. Again very much appreciate your help!
/*the following is the SPSS syntax*/
Define !theta_raw2019 (infilenam=!TOKENS(1)/outfilenam=!TOKENS(1)/outexcel=!TOKENS(1)/ntot=!TOKENS(1)/formname=!TOKENS(1)/thetacut=!TOKENS(1))
new file.
SET MXLOOP=100000.
MATRIX.
GET IRTDATA
/FILE=!infilenam
/VARIABLES=iname bpar
/NAMES=VARNAMES /MISSING=ACCEPT /SYSMIS=0.
COMPUTE NITEM=NROW(IRTDATA).
COMPUTE CONVERT=MAKE(!ntot,4,0.00000).
LOOP K = 1 TO !ntot.
COMPUTE theta_lo={-20}. /* initial low value of theta before iteration*/
COMPUTE theta_hi={20}. /* initial high value of theta before iteration*/
COMPUTE delta={.000001}. /*criteria of terminating iteration, It is the difference between TCC and the corresponding raw score. */
COMPUTE cut={K}.
COMPUTE theta={0}.
COMPUTE low={theta_lo}.
COMPUTE hi={theta_hi}.
COMPUTE IPROB=MAKE(NITEM,1,0).
COMPUTE IINFO=MAKE(NITEM,1,0).
LOOP.
LOOP J=1 TO NITEM.
COMPUTE IPROB(J)=(exp(theta-IRTDATA(J,2))/(1+exp(theta-IRTDATA(J,2))))).
COMPUTE IINFO(J)=IPROB(J)*(1-IPROB(J)).
END LOOP.
COMPUTE TCC=CSUM(IPROB).
DO IF (tcc-cut>delta).
COMPUTE hi = theta.
COMPUTE theta=theta-ABS((theta-low))/2.
END IF.
DO IF (tcc-cut< (-1*delta)).
COMPUTE low=theta.
COMPUTE theta=theta+ABS((hi-theta))/2.
END IF.
END LOOP IF (abs(tcc-cut)<=delta).
COMPUTE INFO=CSUM(IINFO).
COMPUTE SE=sqrt(1/INFO).
COMPUTE CONVERT(K,:)={CUT,THETA,INFO,SE}.
END LOOP.
SAVE CONVERT
/OUTFILE=!outfilenam.
END MATRIX.
get file=!outfilenam.
string form (A6).
compute form=!formname.
rename variables (col1=raw) (col2=theta) (col3=info) (col4=stderror).
compute probpass=(1-cdf.normal(!thetacut,theta,stderror)).
execute.
save outfile=!outfilenam
/compressed
SAVE TRANSLATE OUTFILE=!outexcel
/KEEP=raw theta probpass info stderror form
/TYPE=XLS /VERSION=2 /MAP /REPLACE /FIELDNAMES .
!enddefine.
!theta_raw2019 infilenam='….. \ABC59.sav'
outfilenam='…. \form ABC059 raw to theta.sav'
outexcel='….\form ABC059 raw to theta.xls'
ntot=149
formname='ABC59'
thetacut=0.8554.
... View more