Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I have a SPSS data file, which i am trying to reduce. However the data which belongs together is spread within multiple columns. I.e. I have one row per subject, but each subject has done multiple different conditions as well as procedures. The conditions are in columns condition_1, condition_2 etc. The procedures are in rows procedure_1, procedure_2 etc. The values (reaction times) are in columns reaction_time_1, reaction_time_2. Now I want to compute the average of all reactions times for each person where the condition and procedure is the same. So if condition_x is the same as condition_y and procedure_x is the same as procedure_y I want to get the average over all of those items reaction_time_x and reaction_time_y.

How can I do this with SPSS? I easily know how to compute averages in general, but in this case I have to select only a subset of the rows based on the conditions, and I do not know how to do this.

share|improve this question
1  
Your explanation of the problem is not very clear. Please show the data themselves, maybe excerpt from the data. –  ttnphns Dec 21 '11 at 9:38
add comment

3 Answers

Given your explanation I think one easy solution (without resorting to making new variables) would be to use temporary and select if statements to produce summary statistics for the desired categories. For instance, the below statement would produce the mean for reaction_time_1 when the category_1 and the procedure_1 both equal 1 (and eliminate all other cases from the calculation which do not meet that criteria).

temporary.
select if category_1 = 1 and procedure_1 = 1.
freq var reaction_time_1 /statistics = mean.
execute.

Unless your procedures and categories are not mutually exclusive, there is surely a better way to organize your variables, but this will produce the requested output as is.

share|improve this answer
add comment

It appears to me that you want within-case means, so check out the mean transformation function. You will still have to apply appropriate IF or DO IF tests, though.

share|improve this answer
add comment

You could use a syntax of this sort for your scenario:

if (condition_x = condition_y & procedure_x = procedure_y) time_xy = mean (reaction_time_x, reaction_time_y) .
execute .

This would create a mean reaction time for conditions and procedures x and y when equal. Though it would only work if condition and procedure are variables (i.e. columns) in the datasets. If your data set is stacked, or shape in a person-period format (i.e. many rows per case) it won't work. For the cases in which procedure and condition are different, the created variable would be empty. Hope it works!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.