USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

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

USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

researcher
Sorry for clunky subject title I am having a problem computing group means and wanting to exclude certain values e.g . assume I have 10 scale variables all aspects of satisfaction with something SATIS 1 through to SATIS 10 The values are 1 (ext. dissatisfied) to 5 (ext. satisfied) The fly in the ointment is that there is a 0.00 for 'don't know'. which I don't want in the mean Easy to set 0.00 as missing value for SATIS 1 to SATIS 10 but when computing a new variable (AVERAGE SATIS) which is the mean of SATIS 1 to 10 then 0.00 still gets included! Whether doing compute variable by menu or by syntax. I can use a select cases filter (select cases if SATIS 1 etc >0) before computing mean but I have a lot of these to do so that will be painful. Is there any syntax (other than a filter) to tell SPSS to compute a variable which is the mean of some other variable but to leave out a specified value from those other variables (zero in this case)? Any thoughts much appreciated

Sent from the SPSSX Discussion mailing list archive at Nabble.com.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Jon Peck
I don't think so.  If 0 is declared as a missing value it will be excluded in procedures or transformations unless, which is possible in a few cases, you declare MISSING=INCLUDE.  If you are using the MEAN function over variables, missing values will also be excluded there.

Note that if the value might be slightly different from 0, it might still display as 0 but not match the missing value code.

On Tue, Nov 24, 2020 at 12:27 PM researcher <[hidden email]> wrote:
Sorry for clunky subject title I am having a problem computing group means and wanting to exclude certain values e.g . assume I have 10 scale variables all aspects of satisfaction with something SATIS 1 through to SATIS 10 The values are 1 (ext. dissatisfied) to 5 (ext. satisfied) The fly in the ointment is that there is a 0.00 for 'don't know'. which I don't want in the mean Easy to set 0.00 as missing value for SATIS 1 to SATIS 10 but when computing a new variable (AVERAGE SATIS) which is the mean of SATIS 1 to 10 then 0.00 still gets included! Whether doing compute variable by menu or by syntax. I can use a select cases filter (select cases if SATIS 1 etc >0) before computing mean but I have a lot of these to do so that will be painful. Is there any syntax (other than a filter) to tell SPSS to compute a variable which is the mean of some other variable but to leave out a specified value from those other variables (zero in this case)? Any thoughts much appreciated

Sent from the SPSSX Discussion mailing list archive at Nabble.com.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Art Kendall
In reading between the lines of your post, one possible reading is that you
are trying to creates a summative scale score for each person.

Try this syntax snippet.  If it is not what you are asking, please add a new
variable called "want". and re-post a new snippet.
* assuming want average of non-missing variables as a score.
* so 5 5 5 5 5   means the same as 5 5 0 0 0
data list list/ id (f2) group(f1) Satis1 to Satis5 (5f1).
begin data
    1 1 1 2 3 4 5
    2 1 1 2 3 0 5
    3 1 0 4 4 4 4
    4 2 5 5 5 3 3
    5 2 2 2 2 2 0
    6 2 0 0 0 5 5
    7 3 5 5 5 5 5
    8 3 5 5 0 0 0
end data.
missing values satis1 to satis4 (0).
compute Satis.score = mean.2(satis1 to satis5).
formats Satis.score (f4.2).
list.




-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

researcher
Thanks Jon nd Art . Given your expertise then I can only assume I am not explaining it properly I want to create a mean for a group of variables (e.g. Satis 1 to Satis 10) The scale run 1 to 5 and zero for don't know I don't want to include zero in the means In variable view, 0 is defined as missing for each variable Yes when I run compute variable e.g. Compute OVERALLSATIS = mean (satis 1 to satis 10) the zeros ARE being included I can deal with the problem by defining a filter (select cases if Satis 1 >0 and satis 2 >0 etc) and then compute the mean but that is cumbersome as i have many of these two and the are not all continuous ranges of variables So I am looking for a simple way (if such exists) to compute mean for a group of variables while omitting and zeros in nay of the component variables

Sent from the SPSSX Discussion mailing list archive at Nabble.com.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Jon Peck
That can only mean that there is something wrong with the missing value definition.  If you want to send me the sav file ([hidden email]), I'll take a look.

On Tue, Nov 24, 2020 at 2:12 PM researcher <[hidden email]> wrote:
Thanks Jon nd Art . Given your expertise then I can only assume I am not explaining it properly I want to create a mean for a group of variables (e.g. Satis 1 to Satis 10) The scale run 1 to 5 and zero for don't know I don't want to include zero in the means In variable view, 0 is defined as missing for each variable Yes when I run compute variable e.g. Compute OVERALLSATIS = mean (satis 1 to satis 10) the zeros ARE being included I can deal with the problem by defining a filter (select cases if Satis 1 >0 and satis 2 >0 etc) and then compute the mean but that is cumbersome as i have many of these two and the are not all continuous ranges of variables So I am looking for a simple way (if such exists) to compute mean for a group of variables while omitting and zeros in nay of the component variables

Sent from the SPSSX Discussion mailing list archive at Nabble.com.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Art Kendall
In reply to this post by researcher
did you run the snippet of syntax I posted?

did you try MEAN.n   like the MEAN.2 in in the snippet?



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

researcher
In reply to this post by Jon Peck
Hi Jon and Art

Thanks so much for that.

First I did make a mistake (quell surprise) the zeros are being excluded.

It is a missing data issue indeed..

It comes down to this, I have realised in computing my means

newvar = mean (X1 , X2 , X3)

DOES NOT EQUAL  

newvar = (X1 +X2 +X3)/3

in terms of how missing data is handled

What I want is the second option

But I don't want to have to specify it so cumbersomely in syntax

e.g. some of the variables I want to do group means of are in sequence in
the file (so one could say 'x1 to x3' and some in that group are not in the
series  e.g. x 13 then x17).


So I don't want to have to write newvar = (X1 , X2, X3, X13, X17) / 5

(this involves  a manual count for each expression to establish how many
variables to divide by)

I think Art's answer may be what I needed - and I need to specify that no
vars in the group may be missing

newvar =mean.5  (X1 , X2, X3, X13, X17)

But I still have to count my vars in the group to determine that there are 5
and so mean.5

Is there a command for 'must be no missing data in the mean' but without
having to count..

OK I not longer know if I am making sense ! Will return to this tommorrow

Thanks for your patience







--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Jon Peck
From the CSR for the MEAN function:

MEAN(numexpr,numexpr[,..]). Numeric. Returns the arithmetic mean of its arguments that have
valid, nonmissing values. This function requires two or more arguments, which must be numeric. You can
specify a minimum number of valid arguments for this function to be evaluated.

On Tue, Nov 24, 2020 at 3:22 PM researcher <[hidden email]> wrote:
Hi Jon and Art

Thanks so much for that.

First I did make a mistake (quell surprise) the zeros are being excluded.

It is a missing data issue indeed..

It comes down to this, I have realised in computing my means

newvar = mean (X1 , X2 , X3)

DOES NOT EQUAL 

newvar = (X1 +X2 +X3)/3

in terms of how missing data is handled

What I want is the second option

But I don't want to have to specify it so cumbersomely in syntax

e.g. some of the variables I want to do group means of are in sequence in
the file (so one could say 'x1 to x3' and some in that group are not in the
series  e.g. x 13 then x17).


So I don't want to have to write newvar = (X1 , X2, X3, X13, X17) / 5

(this involves  a manual count for each expression to establish how many
variables to divide by)

I think Art's answer may be what I needed - and I need to specify that no
vars in the group may be missing

newvar =mean.5  (X1 , X2, X3, X13, X17)

But I still have to count my vars in the group to determine that there are 5
and so mean.5

Is there a command for 'must be no missing data in the mean' but without
having to count..

OK I not longer know if I am making sense ! Will return to this tommorrow

Thanks for your patience







--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: USER MISSING VALUES WHEN COMPUTING GROUP MEANS THROUGH SYNTAX

Art Kendall
try this demo snippet.

* assuming want average of non-missing variables as a score.
* so 5 5 5 5 5   means the same as 5 5 0 0 0.
data list list/ id (f2) group(f1) satis1 to satis5 (5f1).
begin data
    1 1 1 2 3 4 5
    2 1 1 2 3 0 5
    3 1 0 4 4 4 4
    4 2 5 5 5 3 3
    5 2 2 2 2 2 0
    6 2 0 0 0 5 5
    7 3 5 5 5 5 5
    8 3 5 5 0 0 0
    9 3 0 0 0 0 0
   10 4 1 1 0 0 0
   11 4 1 1 1 0 0
   12 4 1 1 1 1 0
   13 4 1 1 1 1 1
end data.
missing values satis1 to satis5 (0).
compute score.2 = mean.2(satis1 to satis5).
compute score.3 = mean.3(satis1 to satis5).
compute score.all = mean.5(satis1 to satis5).
compute score.nospec = mean(satis1 to satis5).

formats score.2 to score.nospec(f4.2).
*recoding variable into itself okey here beccause this is a demo.
recode score.2 to score.nospec (sysmis = -1) (else=copy).
Missing values score.2 to score.nospec (-1).
value labels score.2 to score.nospec -1 'did not have enough valid items'.
var labels
Score.2 'Satisfaction score when spec at least 2 items are valid'
Score.3 'Satisfaction score when spec at least 3 items are valid'
Score.5 'Satisfaction score when spec is same as # items all items are
valid'.
Score.nospec 'Satisfaction score when  # items to validate compute is not
specified'.
list.




-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants