Login  Register

Re: Simulation with SPSS

Posted by Ryan on Feb 21, 2012; 11:10pm
URL: http://spssx-discussion.165.s1.nabble.com/Simulation-with-SPSS-tp2856363p5503673.html

Humphrey,

The following syntax will generate data which meets your specification of a non-significant paired t-test. Write back if you have any questions about the syntax.

HTH, 

Ryan
--

*Generate data for a pair t-test.
set seed 65923454.

new file.
inp pro.

 compute subject=-99.
 compute time = -99.
 compute x1 = -99.
 compute x2 = -99.
 compute e1 = -99.
 compute e2 = -99.
 compute sigma = 1.
 compute rho = 0.50.
 compute a11 = 1.
 compute a21 = rho.
 compute a22 = sqrt(1 - rho**2).

 leave subject to a22.

  loop subject= 1 to 500.

  compute x1 = rv.normal(0,1).
  compute x2 = rv.normal(0,1).

  compute e1 = sigma * a11*x1.
  compute e2 = sigma * (a21*x1 + a22*x2).

 loop time = 1 to 2.

 compute y = 1.5 + 0.0*(time=1) + e1*(time=1) + e2*(time=2).
 end case.
 end loop.
end loop.
end file.
end inp pro.
exe.

delete variables x1 x2 sigma rho a11 a21 a22 e1 e2.

*Restrcture dataset from long to wide.
SORT CASES BY subject time.
CASESTOVARS
  /ID=subject
  /INDEX=time
  /GROUPBY=VARIABLE.

*Run paired t-test.
T-TEST PAIRS=y.1.00 WITH y.2.00 (PAIRED)
  /CRITERIA=CI(.9500)
  /MISSING=ANALYSIS.

On Tue, Sep 28, 2010 at 3:58 AM, Humphrey Paulie <[hidden email]> wrote:
Dear colleagues,
I want to simulate data with SPSS. I want to have a dataset on a test (pre-test and post-test) in such a way that the means of the tests are not significant. I don't know the exactly where and which icons are for simulation in SPSS. Do I need syntax for this? I'd be thankful if you give me the syntax if syntax is required.
Regards
Humphrey

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