How to automatically erase ?

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

How to automatically erase ?

E. Bernardo
I will do some restructuring of my dataset, then recoding and,  subsequently, compute a variable using the following syntax (We will call this syntax A)
 

SORT CASES BY Target .

CASESTOVARS

 /ID = Target

                        /GROUPBY = VARIABLE.

                         EXECUTE.

RECODE ITEM1.1 to ITEM2.5 (MISSING=999).

MISSING VALUES ITEM1.1 to ITEM2.5 (999).

EXECUTE.

COMPUTE obs_var1 = var(item1.1,item1.2,item1.3,item1.4,item1.5) .

EXECUTE.

 

The main goal of doing above is to compute the following:

COMPUTE rwg1_un = 1-(obs_var1/2).

COMPUTE rwg1_ss = 1-(obs_var1/1.34).

EXECUTE .      

 

Now, I want that the outputs of Syntax A above will be disappeared automatically from the dataset after the outputs of syntax B  are printed. What to add in syntax A to remove its outputs and the original data set be retained.?

 

Thank you.

Eins


Reply | Threaded
Open this post in threaded view
|

Re: How to automatically erase ?

Richard Ristow
At 10:55 AM 8/25/2010, Eins Bernardo wrote:

I will do some restructuring of my dataset, then recoding and, subsequently, compute a variable using the following syntax (We will call this syntax A)
 
SORT CASES BY Target .
CASESTOVARS
   /ID = Target
   /GROUPBY = VARIABLE.

RECODE ITEM1.1 to ITEM2.5 (MISSING=999).
MISSING VALUES ITEM1.1 to ITEM2.5 (999).

COMPUTE obs_var1 = var(item1.1,item1.2,item1.3,item1.4,item1.5) .

It looks like you want the variances of variables ITEM1 and ITEM2 within each value of variable Target. Why not this (not tested)?

AGGREGATE OUTFILE=*
   /BREAK    =Target
   /obs_var1 =SD(item1)
   /obs_var2 =SD(item2).

COMPUTE obs_var1=obs_var1*obs_var1.
COMPUTE obs_var2=obs_var2*obs_var2.

Sorry about taking the standard deviation and then squaring, but AGGREGATE doesn't seem to have Variance as a summarizing function.
===================== 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: How to automatically erase ?

E. Bernardo
Let me rephrase my question:
 
Suppose the dataset is as follows:
 
Group    Item1       Item2       item3
1             1             4
1             2             5
1             3             6
2
2
2

--- On Wed, 8/25/10, Richard Ristow <[hidden email]> wrote:

From: Richard Ristow <[hidden email]>
Subject: Re: How to automatically erase ?
To: [hidden email]
Date: Wednesday, 25 August, 2010, 9:51 PM

At 10:55 AM 8/25/2010, Eins Bernardo wrote:

I will do some restructuring of my dataset, then recoding and, subsequently, compute a variable using the following syntax (We will call this syntax A)
 
SORT CASES BY Target .
CASESTOVARS
   /ID = Target
   /GROUPBY = VARIABLE.

RECODE ITEM1.1 to ITEM2.5 (MISSING=999).
MISSING VALUES ITEM1.1 to ITEM2.5 (999).

COMPUTE obs_var1 = var(item1.1,item1.2,item1.3,item1.4,item1.5) .

It looks like you want the variances of variables ITEM1 and ITEM2 within each value of variable Target. Why not this (not tested)?

AGGREGATE OUTFILE=*
   /BREAK    =Target
   /obs_var1 =SD(item1)
   /obs_var2 =SD(item2).

COMPUTE obs_var1=obs_var1*obs_var1.
COMPUTE obs_var2=obs_var2*obs_var2.

Sorry about taking the standard deviation and then squaring, but AGGREGATE doesn't seem to have Variance as a summarizing function.
===================== 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: How to automatically erase ?

E. Bernardo
In reply to this post by E. Bernardo
Let me rephrase my question:
 
Suppose the dataset is as follows:
 
Group    Item1       Item2       item3
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60

My goal is to compute the variance of all set of values within each group. That is, I want to compute the variance for the following:
 
Variance within Group 1 = Variance of the set of values 1,2, 3, 4, 5,6,7,8 and 9.
 
Variance within Group 2 = variance of the set of values 55 56 57 58 59 and 60.
 
Please help me to create the syntax.
 
Thank you.


--- On Sun, 8/29/10, Eins Bernardo <[hidden email]> wrote:

From: Eins Bernardo <[hidden email]>
Subject: Re: How to automatically erase ?
To: [hidden email], "Richard Ristow" <[hidden email]>
Date: Sunday, 29 August, 2010, 3:48 PM

Let me rephrase my question:
 
Suppose the dataset is as follows:
 
Group    Item1       Item2       item3
1             1             4
1             2             5
1             3             6
2
2
2

--- On Wed, 8/25/10, Richard Ristow <[hidden email]> wrote:

From: Richard Ristow <[hidden email]>
Subject: Re: How to automatically erase ?
To: [hidden email]
Date: Wednesday, 25 August, 2010, 9:51 PM

At 10:55 AM 8/25/2010, Eins Bernardo wrote:

I will do some restructuring of my dataset, then recoding and, subsequently, compute a variable using the following syntax (We will call this syntax A)
 
SORT CASES BY Target .
CASESTOVARS
   /ID = Target
   /GROUPBY = VARIABLE.

RECODE ITEM1.1 to ITEM2.5 (MISSING=999).
MISSING VALUES ITEM1.1 to ITEM2.5 (999).

COMPUTE obs_var1 = var(item1.1,item1.2,item1.3,item1.4,item1.5) .

It looks like you want the variances of variables ITEM1 and ITEM2 within each value of variable Target. Why not this (not tested)?

AGGREGATE OUTFILE=*
   /BREAK    =Target
   /obs_var1 =SD(item1)
   /obs_var2 =SD(item2).

COMPUTE obs_var1=obs_var1*obs_var1.
COMPUTE obs_var2=obs_var2*obs_var2.

Sorry about taking the standard deviation and then squaring, but AGGREGATE doesn't seem to have Variance as a summarizing function.
===================== 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: How to automatically erase ?

J. R. Carroll
Eins,

Explicitly not inquiring/commenting on why you are trying to do this, if it is 'sound reasoning',  or even 'better ways' - I believe what you are trying to accomplish can be done by the "restructure" wizard (Data > Restructure). 

The Syntax below should generate what you are asking for (and then some)

DATA LIST LIST /GroupID Item1 Item2 Item3.
BEGIN DATA
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60
END DATA.


VARSTOCASES
  /MAKE CombineVars FROM Item1 Item2 Item3
  /INDEX=Index1(CombineVars)
  /KEEP=GroupID
  /NULL=KEEP.

DATASET ACTIVATE DataSet1.
EXAMINE VARIABLES=CombineVars BY GroupID
  /PLOT = NONE
  /COMPARE GROUP
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

There are a lot of many different ways to do this (in terms of customizing it to fit your needs), but hopefully this points you in the right direction. 

HTH,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Sun, Aug 29, 2010 at 8:59 AM, Eins Bernardo <[hidden email]> wrote:
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60

Reply | Threaded
Open this post in threaded view
|

Re: How to automatically erase ?

J. R. Carroll
My apologies - sent some sloppy Syntax (product of not sleeping for the last 24 hours).

DATA LIST LIST /GroupID Item1 Item2 Item3.
BEGIN DATA
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60
END DATA.

VARSTOCASES
  /MAKE CombineVars FROM Item1 Item2 Item3
  /INDEX=Index1(CombineVars)
  /KEEP=GroupID
  /NULL=KEEP.

EXAMINE VARIABLES=CombineVars BY GroupID
  /PLOT = NONE
  /COMPARE GROUP
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

Both versions of the syntax work, but the first one was generating some errors regarding the "active dataset" and there was an extra "empty line" at the beginning of the data generation.  Again - same results, near identical output, this is just cleaner (I felt "obligated" to not be a progenitor of sloppy codding!)


J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Sun, Aug 29, 2010 at 9:59 AM, Justin Carroll <[hidden email]> wrote:
Eins,

Explicitly not inquiring/commenting on why you are trying to do this, if it is 'sound reasoning',  or even 'better ways' - I believe what you are trying to accomplish can be done by the "restructure" wizard (Data > Restructure). 

The Syntax below should generate what you are asking for (and then some)

DATA LIST LIST /GroupID Item1 Item2 Item3.
BEGIN DATA

1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60
END DATA.


VARSTOCASES
  /MAKE CombineVars FROM Item1 Item2 Item3
  /INDEX=Index1(CombineVars)
  /KEEP=GroupID
  /NULL=KEEP.

DATASET ACTIVATE DataSet1.
EXAMINE VARIABLES=CombineVars BY GroupID
  /PLOT = NONE
  /COMPARE GROUP
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

There are a lot of many different ways to do this (in terms of customizing it to fit your needs), but hopefully this points you in the right direction. 

HTH,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204



On Sun, Aug 29, 2010 at 8:59 AM, Eins Bernardo <[hidden email]> wrote:
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60


Reply | Threaded
Open this post in threaded view
|

Re: How to automatically erase ?

Maguin, Eugene
In reply to this post by E. Bernardo
Eins,

Perhaps I not understanding something important but why not do a casetovars
command to give one record to each value of group and then use either the
var.n or sd.n function. (Note. I don't recall whether spss has a var.n and a
sd.n function or just one or the other. The help system has an uncorrected
error in it that has been there since 16 or 17.) You'll have t check the
variable count after the casestovars to get the correct variable range. I
don't know how to incorporate that level of sophistication.

Gene Maguin




Let me rephrase my question:

Suppose the dataset is as follows:

Group    Item1       Item2       item3
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60

My goal is to compute the variance of all set of values within each group.
That is, I want to compute the variance for the following:

Variance within Group 1 = Variance of the set of values 1,2, 3, 4, 5,6,7,8
and 9.

Variance within Group 2 = variance of the set of values 55 56 57 58 59 and
60.

Please help me to create the syntax.

Thank you.


--- On Sun, 8/29/10, Eins Bernardo <[hidden email]> wrote:



        From: Eins Bernardo <[hidden email]>
        Subject: Re: How to automatically erase ?
        To: [hidden email], "Richard Ristow"
<[hidden email]>
        Date: Sunday, 29 August, 2010, 3:48 PM


                Let me rephrase my question:

        Suppose the dataset is as follows:

        Group    Item1       Item2       item3
        1             1             4
        1             2             5
        1             3             6
        2
        2
        2

        --- On Wed, 8/25/10, Richard Ristow <[hidden email]> wrote:



                From: Richard Ristow <[hidden email]>
                Subject: Re: How to automatically erase ?
                To: [hidden email]
                Date: Wednesday, 25 August, 2010, 9:51 PM


                At 10:55 AM 8/25/2010, Eins Bernardo wrote:



                        I will do some restructuring of my dataset, then
recoding and, subsequently, compute a variable using the following syntax
(We will call this syntax A)

                        SORT CASES BY Target .
                        CASESTOVARS
                           /ID = Target
                           /GROUPBY = VARIABLE.

                        RECODE ITEM1.1 to ITEM2.5 (MISSING=999).
                        MISSING VALUES ITEM1.1 to ITEM2.5 (999).

                        COMPUTE obs_var1 =
var(item1.1,item1.2,item1.3,item1.4,item1.5) .


                It looks like you want the variances of variables ITEM1 and
ITEM2 within each value of variable Target. Why not this (not tested)?

                AGGREGATE OUTFILE=*
                   /BREAK    =Target
                   /obs_var1 =SD(item1)
                   /obs_var2 =SD(item2).

                COMPUTE obs_var1=obs_var1*obs_var1.
                COMPUTE obs_var2=obs_var2*obs_var2.

                Sorry about taking the standard deviation and then squaring,
but AGGREGATE doesn't seem to have Variance as a summarizing function.
                ===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: How to automatically erase ?

Ryan
In reply to this post by E. Bernardo
Eins,
 
I'm sure there are many ways to achieve what you desire. The approach I propose below will provide you with several descriptive statistics for each of the groups, including the variances. Note that this approach restructures your data set employing VARSTOCASES, as suggested by another poster.
 
Ryan
 
--
 
data list list / Group Item1 Item2 Item3.
begin data
1  1   4   7
1  2   5   8
1  3   6   9
2 55 57 59
2 56 58 60
end data.

VARSTOCASES
  /ID=id
  /MAKE Item_Score FROM Item1 Item2 Item3
  /INDEX=Item_Indicator(3)
  /KEEP=Group
  /NULL=KEEP.

EXAMINE VARIABLES=Item_Score BY Group
  /PLOT NONE
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

On Sun, Aug 29, 2010 at 11:59 AM, Eins Bernardo <[hidden email]> wrote:

Let me rephrase my question:
 
Suppose the dataset is as follows:
 
Group    Item1       Item2       item3
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60

My goal is to compute the variance of all set of values within each group. That is, I want to compute the variance for the following:
 
Variance within Group 1 = Variance of the set of values 1,2, 3, 4, 5,6,7,8 and 9.
 
Variance within Group 2 = variance of the set of values 55 56 57 58 59 and 60.
 
Please help me to create the syntax.
 
Thank you.


--- On Sun, 8/29/10, Eins Bernardo <[hidden email]> wrote:

From: Eins Bernardo <[hidden email]>

Subject: Re: How to automatically erase ?
To: [hidden email], "Richard Ristow" <[hidden email]>
Date: Sunday, 29 August, 2010, 3:48 PM


Let me rephrase my question:
 
Suppose the dataset is as follows:
 
Group    Item1       Item2       item3
1             1             4
1             2             5
1             3             6
2
2
2

--- On Wed, 8/25/10, Richard Ristow <[hidden email]> wrote:

From: Richard Ristow <[hidden email]>
Subject: Re: How to automatically erase ?
To: [hidden email]
Date: Wednesday, 25 August, 2010, 9:51 PM

At 10:55 AM 8/25/2010, Eins Bernardo wrote:

I will do some restructuring of my dataset, then recoding and, subsequently, compute a variable using the following syntax (We will call this syntax A)
 
SORT CASES BY Target .
CASESTOVARS
   /ID = Target
   /GROUPBY = VARIABLE.

RECODE ITEM1.1 to ITEM2.5 (MISSING=999).
MISSING VALUES ITEM1.1 to ITEM2.5 (999).

COMPUTE obs_var1 = var(item1.1,item1.2,item1.3,item1.4,item1.5) .

It looks like you want the variances of variables ITEM1 and ITEM2 within each value of variable Target. Why not this (not tested)?

AGGREGATE OUTFILE=*
   /BREAK    =Target
   /obs_var1 =SD(item1)
   /obs_var2 =SD(item2).

COMPUTE obs_var1=obs_var1*obs_var1.
COMPUTE obs_var2=obs_var2*obs_var2.

Sorry about taking the standard deviation and then squaring, but AGGREGATE doesn't seem to have Variance as a summarizing function.
===================== 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: How to automatically erase ?

E. Bernardo
In reply to this post by J. R. Carroll
Thank you, Carroll,
 
I will use the variances to compute the r_wg coefficient.  My problem is that I have a number of r_wg coefficients to compute.  Subsequently,I will test if there is a significant difference on the r_wg between two independent groups. 
 
The r_wg as well as the F-test to test significant differences of r_wg among groups is discussed in the paper below.  Do you have alternative for r_wg?
 
Pasisz, D. J., & Hurtz, G. M. (2009). Testing for between-group differences in within-group interrater agreement. Organizational Research Methods,   
12, 590-613.         
 
Eins  

--- On Sun, 8/29/10, Justin Carroll <[hidden email]> wrote:

From: Justin Carroll <[hidden email]>
Subject: Re: How to automatically erase ?
To: "Eins Bernardo" <[hidden email]>
Cc: [hidden email]
Date: Sunday, 29 August, 2010, 5:31 PM

My apologies - sent some sloppy Syntax (product of not sleeping for the last 24 hours).

DATA LIST LIST /GroupID Item1 Item2 Item3.
BEGIN DATA
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60
END DATA.

VARSTOCASES
  /MAKE CombineVars FROM Item1 Item2 Item3
  /INDEX=Index1(CombineVars)
  /KEEP=GroupID
  /NULL=KEEP.

EXAMINE VARIABLES=CombineVars BY GroupID
  /PLOT = NONE
  /COMPARE GROUP
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

Both versions of the syntax work, but the first one was generating some errors regarding the "active dataset" and there was an extra "empty line" at the beginning of the data generation.  Again - same results, near identical output, this is just cleaner (I felt "obligated" to not be a progenitor of sloppy codding!)


J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  jrc.csus@...   -or-   jrcarroll@...
Phone:  (916) 628-4204


On Sun, Aug 29, 2010 at 9:59 AM, Justin Carroll <jrc.csus@...> wrote:
Eins,

Explicitly not inquiring/commenting on why you are trying to do this, if it is 'sound reasoning',  or even 'better ways' - I believe what you are trying to accomplish can be done by the "restructure" wizard (Data > Restructure). 

The Syntax below should generate what you are asking for (and then some)

DATA LIST LIST /GroupID Item1 Item2 Item3.
BEGIN DATA

1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60
END DATA.


VARSTOCASES
  /MAKE CombineVars FROM Item1 Item2 Item3
  /INDEX=Index1(CombineVars)
  /KEEP=GroupID
  /NULL=KEEP.

DATASET ACTIVATE DataSet1.
EXAMINE VARIABLES=CombineVars BY GroupID
  /PLOT = NONE
  /COMPARE GROUP
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /MISSING LISTWISE
  /NOTOTAL.

There are a lot of many different ways to do this (in terms of customizing it to fit your needs), but hopefully this points you in the right direction. 

HTH,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  jrc.csus@...   -or-   jrcarroll@...
Phone:  (916) 628-4204



On Sun, Aug 29, 2010 at 8:59 AM, Eins Bernardo <einsbernardo@...> wrote:
1             1             4              7
1             2             5              8
1             3             6              9
2             55           57            59
2             56           58            60



Reply | Threaded
Open this post in threaded view
|

Re: How to automatically erase ?

Richard Ristow
In reply to this post by Maguin, Eugene
At 01:38 PM 8/29/2010, Gene Maguin wrote:

>Why not do a casetovars command to give one record to each value of
>group and then use either the var.n or sd.n function. You'll have to
>check the variable count after the casestovars to get the correct
>variable range.

That's one problem: having to find the range of variable names before
using the statistical function. Another is erasing those variables
after computing the variance, as the original posting requested ("I
want that the outputs of Syntax A above will be disappeared
automatically from the dataset after the outputs of syntax B are
printed.", Wed, 25 Aug 2010 22:55:20).

Those are the reasons I recommend a 'long' solution, going to one
record per value rather than one record per group; and then using
AGGREGATE, or just a statistical reporting function, rather than a
within-record statistical function.

In the clarification, Eins Bernardo wrote that he wants the variance
over all values of a SET of variables. For that, I'd first use
VARSTOCASES to unroll that set of variables, as Justin Carroll recommended.

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