Code:
list yBestPred 1. 1 2. 0 3. 1 4. 1 5. 1 6. 0 7. 0 8. 0 9. 0 10. 0 list sp 1. 1 2. 2 3. 1 4. 1 5. 1 6. 2 7. 2 8. 2 9. 1 10. 2 list compliance 1. 1 2. 0 3. 1 4. 1 5. 1 6. 0 7. 0 8. 0 9. 1 10. 0
1. Take only the observations that have "sp" = 2 (which in our case we have 5 observations)
2. take "compliance" values of those observations that we obtained from 1 (take the compliance values of the 5 observations).
3. calculate accuracy score by comparing the compliance values obtained in 2. with the value of "yBestPred" for the first 5 observations, and store it under a local macro.
( if we took compliance values of 'n' observations in step 2, then I would instead calculate the accuracy score by comparing the compliance values obtained in 2. with the value of "yBestPred" for the first 'n' observations)
The 'accuracy score' is defined as:
[number of observations of matching values (either 0 or 1) between two record] / [total number of observations considered (for this case, the number of observations with sp == 2)]
As a Stata novice, I am just completely lost on how to do this task on Stata.
Thank you...
0 Response to Computing accuracy score on Stata
Post a Comment