Syntax for Generating values

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

Syntax for Generating values

stace swayne
Dear list,

  I would like to generate responses  with 3 time points and I would like to know if anyone has a syntax script that they could share or a resource they could suggest for me figuring out how to do this.

  I have one actual time point with 1800 women, responding to a QOL scale with values that range from 1 to 4.

  I would like to write a script that would generate responses for  two additional time points.

  All suggestions are welcomed.

  Best wishes,

  Stace


---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.
Reply | Threaded
Open this post in threaded view
|

Re: Syntax for Generating values

Richard Ristow
At 10:15 AM 4/17/2007, stace swayne wrote:

>   I would like to generate responses  with 3 time points and I would
> like to know if anyone has a syntax script that they could share or a
> resource they could suggest for me figuring out how to do this.
>
>   I have one actual time point with 1800 women, responding to a QOL
> scale with values that range from 1 to 4.

If you mean generating random data, it's quite easy; but of course, you
need to know what variables, what cases, and what random distribution
to draw from.

Is that what you mean, or what else?

-Best wishes,
  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Syntax for Generating values

Richard Ristow
At 12:50 PM 4/18/2007, stace swayne wrote:

>Yes, what I would like to do is generate random data, with 24
>variables and 1800 cases.
>
>[They should have] a normal distribution, but the data must be in
>whole numbers between 1 & 4. SPSS asked for the mean & stdv, and I
>wasn't sure what number I should put in or where I should get this
>number from.
>
>So then I thought maybe I should use a uniform distribution which only
>asked for the minimum number you want and the maximum number you want
>in the distribution.

I'd suggest a uniform distribution, unless there's some large contrary
reason. A distribution with only 4 points will be represent a normal
distribution only very crudely at best.

>  I was not sure about using a uniform distribution because I thought
> that wouldn't give me any variation...(please correct me if I'm wrong).

There's still variation. A variable taking on values 1 through 4 with
equal probability has mean 2.5; standard deviation - let's see:

Variance is mean square minus square of the mean -
(1^2 + 2^2 + 3^3 + 4^2)/4 - 2.5^2=5.75

Standard deviation is square root of variance -
SQRT(5.75)=2.4

The following is SPSS 15 draft output (WRR-not saved separately).
Notice that to get integers 1-4 you use
TRUNC(RV.UNIFORM(1,5))
That is NOT a typo.

*  Generate #Ncase cases, each with #NVar data variables, .
*  the variables randomly generated, with integer values  .
*  1-4 equally probable.                                  .

*  In the example, #NVar = 5, #NCase = 10.                .
NEW FILE.
INPUT PROGRAM.
.  COMPUTE #NCase = 10.
.  COMPUTE #NVar  =  5.
.  NUMERIC CaseID (N4).
*  The following declaration of the output variables must .
*  be hard coded; or, generated with a macro or Python.   .
.  NUMERIC DtaVar01 TO DtaVar05 (F2).

.  VECTOR Value=DtaVar01 TO DtaVar05.
.  LOOP   CaseID = 1 TO #NCase.
.     LOOP #Idx  = 1 TO #NVar.
.        COMPUTE Value(#Idx) = TRUNC(RV.UNIFORM(1,5)).
.     END LOOP.
.     END CASE.
.  END LOOP.
END FILE.
END INPUT PROGRAM.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |18-APR-2007 14:27:11       |
|-----------------------------|---------------------------|
CaseID DtaVar01 DtaVar02 DtaVar03 DtaVar04 DtaVar05

  0001      2        1        1       1        3
  0002      4        3        3       4        3
  0003      4        1        3        2        1
  0004      3        3       3        3       4
  0005      3        3       2        2       3
  0006      4        4       3        4        3
  0007      2        3        2        2       3
  0008      3        1        4        4       1
  0009      2        1        3        1        1
  0010      3        2        4        2        4

Number of cases read:  10    Number of cases listed:  10