mean

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mean

ranjan vaidya
i need assistance in adding the cases:
is it not possible to compute the sum of the cases of a variable and
have the result in the same file....
i want to find the difference of the means for two varible i.e. the
mean of one minus the mean of other...and i have some 158 varibles how
to do that????


--
Ranjan Vaidya
K 404 Shalimar Township
AB Road Indore MP
452010 INDIA
Reply | Threaded
Open this post in threaded view
|

Re: mean

Hector Maletta
Ranjan,
You can do it easily as shown below. But before you must also understand
that your data file is a matrix giving you the value of each variable for
each unit of analysis. The mean is a summary value which does not belong
with any of the individual cases, but with the ensemble of them all. You
can, of course, add a "variable" showing the mean value of another variable;
this new variable will have the same value for all the individual cases,
which is somewhat redundant.
Also, you may want to think whether you want only the general means (that is
the mean value of a variable in ALL your cases) or subgroup means (e.g. the
mean for males and the mean for females).
Now, assuming you need the overall mean for all cases for your 158
variables, the easiest way to obtain them as a statistical result in your
output window is:
DESCRIPTIVES ALL /STAT MEAN.
Alternatively:
MEANS ALL/CELLS MEAN.
This refers to ALL your variables, for simplicity, although you may not want
the mean of ALL of them if they include sex, place or residence or other
variables for which the mean does not make sense. Also, if some variables
are non-numeric strings SPSS may not understand what you mean and refuse to
proceed. You may simply state the specific variable list you need, such as:
DESCRIPTIVES VAR001 TO VAR158/STAT MEAN.
(assuming the 158 variables are consecutively situated in the data file).
The DESCRIPTIVES procedure produces summary statistics for all your cases.
The syntax above asks only for the mean, since you do not need other summary
measures (minimum and maximum values, median, mode, etc.). In case you need
them, simply write /STAT ALL instead of /STAT MEAN to have the full
complement of summary descriptive statistics for all your variables.
The MEANS procedure produces the mean and other summary statistics for
subgroups of cases. In the syntax above no subgroups are specified, so only
the overall mean is produced. But you could specify breakdown variables, as
follows:

MEANS ALL BY SEX BY AGEGROUP/cell mean.
This produces the mean value of each variable for each sex- age group
combination. Omitting the second BY produces two tables, one giving the mean
for both sexes irrespective of age and the other giving the mean for all age
groups irrespective of sex.

If you want to add the means to your file, for instance in order to compare
each individual case to the overall mean, you can do it with AGGREGATE.

COMPUTE X=1.
AGGREGATE OUTFILE * MODE ADDVARIABLES /BREAK X
/MEAN001 TO MEAN158 = MEAN(VAR001 TO VAR158).

Hope this helps.
Hector

-----Mensaje original-----
De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de
ranjan vaidya
Enviado el: Monday, July 17, 2006 2:35 PM
Para: [hidden email]
Asunto: mean

i need assistance in adding the cases:
is it not possible to compute the sum of the cases of a variable and
have the result in the same file....
i want to find the difference of the means for two varible i.e. the
mean of one minus the mean of other...and i have some 158 varibles how
to do that????


--
Ranjan Vaidya
K 404 Shalimar Township
AB Road Indore MP
452010 INDIA
Reply | Threaded
Open this post in threaded view
|

Re: mean

Maguin, Eugene
In reply to this post by ranjan vaidya
Ranjan,

There are several ways, I believe, to go at this. Let va1 and vb1 be two
variables from your list of 158. There are two cases to consider. 1) a case
that is missing for va1 is also missing for vb1 and vice versa. 2) case 1 is
not true.

If case 1 is true, then you can use Aggregate (which you should read about
in the documentation).

Compute tag=1. /*  this is the trick.

Aggregate /outfile=*/break=tag/va1 vb1=mean(va1 vb1).

Do repeat x=va1/y=vb1/z=diff1.
+  compute z=x-y.
End repeat.


If case 2 is true (i.e., case 1 is not true), then, depending on the
following choice, you may have a more difficult job. If va1 is missing for
some cases but vb1 is not, you can either make the missing value status of
va1 and vb1 consistent on a case-by-case basis or ignore that inconsistency.
Making the missing value status consistent means modifying the dataset so
that case 1 is true.

To do that (enforce consistency), insert this code before the 'trick'
statement above.

Do repeat x=va1/y=vb1.
+  if (sysmis(va1)) vb1=$sysmis.
+  if (sysmis(vb1)) va1=$sysmis.
End repeat.

If case 1 is true or missing value status consistency doesn't matter, then
another way might be to use the OMS commands to export the output of a
descriptives command and then operate on that new dataset. However, I have
not done this. Someone else can comment.

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Longitudinal ogistic regression

Maguin, Eugene
In reply to this post by ranjan vaidya
All,

I am analyzing some longitudinal data with dichotomous or ordinal variables.
I had thought to say

LOGISTIC REGRESSION T2 WITH G T1/ENTER G T1/ENTER G BY T1.

Or, for ordinal variables.

PLUM T2 BY G WITH T1/LOCATION INTERCEPT G T1
   G BY T1/PRINT FIT PARAMETER TPARALLEL.

However, somebody here has commented that such analyses are incorrect but,
off the top of his head, couldn't recall the cite. Can anyone comment and,
if possible, give a cite. If this setup is incorrect, what are the
alternatives?

Thanks, Gene Maguin