Thursday, October 11, 2007

Painful (Elementary Level) Debugging

OMG.... I can't believe I made so many mistakes in such a simple script....

I was running data analysis in the library this afternoon, and need the last 2 digits of my 9-digit item number to recode some information (not the smartest item number scheme, I must admit). After I recoded all the variables necessary for the bias analysis, I then aggregated the raw data so that I could restructure the data format by subject for spss to run repeated measures ANOVA. When I opened the aggregated file, I found that for some subjects some of the recoded variables were lacking. This was when I found out that my item number had been messed up before they were imported to spss. If everything had worked correctly, there should be 8 possible values of the last two digits, and there should be equal number of cases for each possible values. However that was only true for my list 1 subjects.

Then I went back to inspect the Matlab script I used to extract the azk file. I tried everything I could imagine to save the mistake. Just to make a long story short, the problem (I think) was that I scanned the item numbers in the wrong number format. I used f32 to scan the 3 columns in the azk output. However, whereas f32 is good for scanning RT and COT values, it's not ideal for scanning item numbers. This is because the item number is always an integer, scanning them as floating point numbers would waste the precision on the none existent decimals.

In the end I just changed one small thing and the problem was saved. I feel really dumb because I actually used the correct format to scan the data in an earlier version of the script, but somehow I changed the format for some unknown reason afterwards, and created all these troubles for myself. The only thing that's conforting is that, I have learned my lesson, and I can confidently say that I know a bit better today and yesterday. I guess that's the most important thing :)

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home