SPSS AnswerNet: Result
Solution ID: 100008793
Title:
Saving confidence interval for mean (within subgroups) into a data file
Description:
Q.
*I'd like to save a confidence interval for the mean of a continuous variable for each group in a categorical variable into a data file.
*The AGGREGATE procedure in SPSS doesn't seem to have a summary function which will return a confidence interval for a mean.
*Is there any way to do this in SPSS?
A.
/*The AGGREGATE procedure indeed does not have a confidence interval function, but you might use
the following approach to save confidence intervals into a data file.
First, create a new variable that has a constant value for all cases. Then split your data file by the categorical variable.
Finally run a linear regression with the continuous variable as the dependent variable, constant variable as the
independent variable, without intercept, and saving prediction interval of the mean predicated response.
You'll get three new variables in your working data file, one for the mean of the continuous variable, another
for the lower bound of confidence interval for mean, and another for the upper bound.
Using 1991 U.S. General Social Survey.sav data set as an example (a data set installed by SPSS for Windows 7.5
and later versions in SPSS directory), if AGE is the continuous variable, REGION is the independent variable,
the following commands illustrate the steps above: */.
COMPUTE const=1.
EXE.
SORT CASES BY region .
SPLIT FILE BY region.
REGRESSION
/ORIGIN
/DEPENDENT age
/METHOD=ENTER const
/SAVE PRED MCIN .