Incorrect scale by using compute command obtained

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

Incorrect scale by using compute command obtained

sabahat
This post was updated on .
check1.sav

check_1_syntax.sps

Hi,

I am having trouble with computing scale in SPSS 17 by using following compute command

COMPUTE check1=RND(MEAN.3(S1,S2,S3,S4, S5) * 5) .
EXECUTE .
Here is a sample copy of the data set I am using. It consist of only 5 variables and six respondents. The obtained after using the above mentioned compute command are also presented. (original SPSS sample file and syntax are also attached with the message.


S1     S2    S3    S4    S5    Check1
0.00 99.00 2.00 2.00 2.00     8.00            
2.00  2.00 0.00 1.00 1.00       6.00
99.00 0.00 1.00 2.00 2.00       6.00
1.00  2.00 99.00 2.00 2.00       9.00
0.00  1.00 99.00 1.00 1.00       4.00
1.00  2.00 99.00 1.00 1.00       6.00

 Here 0=no, 1=yes, 2= yes twice, 99=missing

If you see the first row in check 1 column the answer is written 8 although it should have been 6. The anomaly between manually calculations and calculations done by using above compute command only occurs when there is a missing value in the data. I have 100% sure I have correctly specified user missing values (99) in variable data view and other things. I have even tried recording user missing value as system missing values.
I have been burning my brain over it but cannot figure it out. please guide.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect scale by using compute command obtained

David Marso
Administrator
Why do you think it should be 6 rather than 8?
My math results in 8!
6/4=1.5
1.5 * 5=7.5
Rnd(7.5)=8!!!

sabahat wrote
check1.sav

check_1_syntax.sps

Hi,

I am having trouble with computing scale in SPSS 17 by using following compute command

COMPUTE check1=RND(MEAN.3(S1,S2,S3,S4, S5) * 5) .
EXECUTE .
Here is a sample copy of the data set I am using. It consist of only 5 variables and six respondents. The obtained after using the above mentioned compute command are also presented. (original SPSS sample file and syntax are also attached with the message.


S1     S2    S3    S4    S5    Check1
0.00 99.00 2.00 2.00 2.00     8.00            
2.00  2.00 0.00 1.00 1.00       6.00
99.00 0.00 1.00 2.00 2.00       6.00
1.00  2.00 99.00 2.00 2.00       9.00
0.00  1.00 99.00 1.00 1.00       4.00
1.00  2.00 99.00 1.00 1.00       6.00

 Here 0=no, 1=yes, 2= yes twice, 99=missing

If you see the first row in check 1 column the answer is written 8 although it should have been 6. The anomaly between manually calculations and calculations done by using above compute command only occurs when there is a missing value in the data. I have 100% sure I have correctly specified user missing values (99) in variable data view and other things. I have even tried recording user missing value as system missing values.
I have been burning my brain over it but cannot figure it out. please guide.

Thanks.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect scale by using compute command obtained

Art Kendall
In reply to this post by sabahat
this syntax

data list list /
S1     S2    S3    S4    S5    Check1.
begin data.
0.00     99.00 2.00     2.00    2.00       8.00
2.00      2.00  0.00    1.00    1.00           6.00
99.00    0.00    1.00    2.00    2.00          6.00
1.00      2.00   99.00   2.00    2.00          9.00
0.00      1.00   99.00   1.00    1.00          4.00
1.00      2.00   99.00   1.00    1.00          6.00
1 1 1 99 99
1 1 1 1 1
2 2 2 99 99
2 2 2 2 2
3 3 3 99 99
3 3 3 3 3
end data.
missing values s1 to s5 (99).

count n_ok = s1 to s5 (0,1,2).
count n_m = s1 to s5(missing).
compute raw_sum = sum.3(s1 to s5).
compute raw_mean = MEAN.3(S1,S2,S3,S4, S5).
compute raw_score = raw_sum + (n_m * raw_mean).
formats raw_mean raw_score (f7.4).
compute rnd_score = rnd(raw_score).
compute check=RND((MEAN.3(S1,S2,S3,S4, S5) * 5)).
list.
 .

produced

    S1     S2     S3     S4     S5 Check1   n_ok    n_m raw_sum raw_mean raw_score rnd_score  check

     0     99      2      2      2      8      4      1       6   1.5000   7.5000         8       8
     2      2      0      1      1      6      5      0       6   1.2000   6.0000         6       6
    99      0      1      2      2      6      4      1       5   1.2500   6.2500         6       6
     1      2     99      2      2      9      4      1       7   1.7500   8.7500         9       9
     0      1     99      1      1      4      4      1       3    .7500   3.7500         4       4
     1      2     99      1      1      6      4      1       5   1.2500   6.2500         6       6
     1      1      1     99     99      .      3      2       3   1.0000   5.0000         5       5
     1      1      1      1      1      .      5      0       5   1.0000   5.0000         5       5
     2      2      2     99     99      .      3      2       6   2.0000  10.0000        10      10
     2      2      2      2      2      .      5      0      10   2.0000  10.0000        10      10
     3      3      3     99     99      .      0      2       9   3.0000  15.0000        15      15
     3      3      3      3      3      .      0      0      15   3.0000  15.0000        15      15


Number of cases read:  12    Number of cases listed:  12

Art Kendall
Social Research Consultants

On 6/7/2012 5:51 AM, sabahat wrote:
COMPUTE check1=RND(MEAN.3(S1,S2,S3,S4, S5) * 5) .
===================== 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: Incorrect scale by using compute command obtained

Art Kendall
In reply to this post by sabahat
here is a demo that what you are doing is substituting means for missing data.
You might not want to round the plugged score.
this syntax.
data list list /
S1     S2    S3    S4    S5    Check1.
begin data.
0.00     99.00 2.00     2.00    2.00       8.00
2.00      2.00  0.00    1.00    1.00           6.00
99.00    0.00    1.00    2.00    2.00          6.00
1.00      2.00   99.00   2.00    2.00          9.00
0.00      1.00   99.00   1.00    1.00          4.00
1.00      2.00   99.00   1.00    1.00          6.00
1 1 1 99 99
1 1 1 1 1
2 2 2 99 99
2 2 2 2 2
3 3 3 99 99
3 3 3 3 3
end data.
missing values s1 to s5 (99).
list.
compute check2=RND((MEAN.3(S1,S2,S3,S4, S5) * 5)).
compute raw_mean = MEAN.3(S1,S2,S3,S4, S5).
formats raw_mean (5.3).
*although it is usually bad practice to overwrite data I do it here
* only to demo that the process is equivalent to mean substitution.
do repeat s = s1 to s5.
if missing(s) s = raw_mean.
end repeat.
compute plugged_score = sum(s1 to s5).
formats s1 to s5 plugged_score(f5.2).
list.

produces this output.




   S1    S2    S3    S4    S5 Check1 check2 raw_mean plugged_score

  .00  1.50  2.00  2.00  2.00      8      8     1.50      7.50
 2.00  2.00   .00  1.00  1.00      6      6     1.20      6.00
 1.25   .00  1.00  2.00  2.00      6      6     1.25      6.25
 1.00  2.00  1.75  2.00  2.00      9      9     1.75      8.75
  .00  1.00   .75  1.00  1.00      4      4      .75      3.75
 1.00  2.00  1.25  1.00  1.00      6      6     1.25      6.25
 1.00  1.00  1.00  1.00  1.00      .      5     1.00      5.00
 1.00  1.00  1.00  1.00  1.00      .      5     1.00      5.00
 2.00  2.00  2.00  2.00  2.00      .     10     2.00     10.00
 2.00  2.00  2.00  2.00  2.00      .     10     2.00     10.00
 3.00  3.00  3.00  3.00  3.00      .     15     3.00     15.00
 3.00  3.00  3.00  3.00  3.00      .     15     3.00     15.00



Number of cases read:  12    Number of cases listed:  12

Art Kendall
Social Research Consultants

On 6/7/2012 5:51 AM, sabahat wrote:
Hi,

I am having trouble with computing scale in SPSS by using following compute
command

COMPUTE check1=RND(MEAN.3(S1,S2,S3,S4, S5) * 5) .
EXECUTE .
Here is a sample copy of the data set I am using. It consist of only 5
variables and six respondents. The obtained after using the above mentioned
compute command are also presented. (original SPSS sample file and syntax
are also attached with the message.


S1     S2    S3    S4    S5    Check1
0.00     99.00 2.00     2.00    2.00       8.00
2.00      2.00  0.00    1.00    1.00           6.00
99.00    0.00    1.00    2.00    2.00          6.00
1.00      2.00   99.00   2.00    2.00          9.00
0.00      1.00   99.00   1.00    1.00          4.00
1.00      2.00   99.00   1.00    1.00          6.00

 Here 0=no, 1=yes, 2= yes twice, 99=missing

If you see the first row in check 1 column the answer is written 8 although
it should have been 6. The anomaly between manually calculations and
calculations done by using above compute command only occurs when there is a
missing value in the data. I have 100% sure I have correctly specified user
missing values (99) in variable data view and other things. I have even
tried recording user missing value as system missing values.
I have been burning my brain over it but cannot figure it out. please guide.

Thanks.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Incorrect-scale-by-using-compute-command-obtained-tp5713553.html
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

===================== 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