Hi everyone,
=====================
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
What syntax can I use to generate a scatterplot with a particular R squared, without having access to the raw data? Is there an easier way to do this than in SPSS? Monique -------------------------------------------------------------- Associate Professor at Morgan State University Teacher Education and Professional Development 1700 E. Cold Spring Lane Banneker Hall 211D Baltimore, Maryland 21251 Telephone: 443-885-1985 Fax: 443-885-8243 ------------------------------------------------------------ |
Administrator
|
There have been many threads on how to generate data with a given correlation
structure. You can find them by searching the archives for <generate data correlation> and similar terms. Here is a solution based on an approach from Marta GG in one of those old threads. http://spssx-discussion.1045642.n5.nabble.com/Generating-Samples-of-Variables-Having-a-Specified-r-Value-td1078142.html DEFINE TWOCORRDATA(r=!TOKENS(1) /n=!TOKENS(1)). INPUT PROGRAM. LOOP id = 1 to !n. . COMPUTE r1 = NORMAL(1). . COMPUTE r2 = NORMAL(1). . END CASE. END LOOP. END FILE. END INPUT PROGRAM. PRESERVE. SET ERRORS=NONE RESULTS=NONE. FACTOR /VARIABLES r1 r2 /CRITERIA FACTORS(2) /EXTRACTION PC /ROTATION NOROTATE /SAVE REG(ALL orth) . RESTORE. COMPUTE y1 = orth1. COMPUTE y2 = !r*orth1 + SQRT(1-!r**2)*orth2. EXE. DELETE VARIABLES id r1 r2 orth1 orth2. !ENDDEFINE. NEW FILE. DATASET CLOSE ALL. * Suppose I want r = 0.7, and r^2 = 0.49. * MACRO call (with n=10 & r=0.7) *. TWOCORRDATA r=0.7 n=10. CORRELATIONS y1 with y2. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=y1 y2 MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE /FITLINE TOTAL=YES. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: y1=col(source(s), name("y1")) DATA: y2=col(source(s), name("y2")) GUIDE: axis(dim(1), label("y1")) GUIDE: axis(dim(2), label("y2")) GUIDE: text.title(label("Simple Scatter with Fit Line of y2 by y1")) ELEMENT: point(position(y1*y2)) END GPL. It may be that there is an extension command to generate simulated data too. I just took a quick look via the Extension Hub, but couldn't find it. Perhaps Jon can help. [hidden email] wrote > Hi everyone, > What syntax can I use to generate a scatterplot with a particular R > squared, without having access to the raw data? Is there an easier way to > do this than in SPSS? > > Monique > -------------------------------------------------------------- > Marciea *Monique *McMillian, Ph.D. > <http://mcmillian.socialpsychology.org/> > Associate Professor at Morgan State University > Teacher Education and Professional Development > 1700 E. Cold Spring Lane > Banneker Hall 211D > Baltimore, Maryland 21251 > Telephone: 443-885-1985 > Fax: 443-885-8243 > marciea.mcmillian@ > ------------------------------------------------------------ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- 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
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Thank you so much. On Fri, Sep 20, 2019 at 11:30 AM Bruce Weaver <[hidden email]> wrote: There have been many threads on how to generate data with a given correlation Sent from Gmail Mobile
=====================
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
|
There isn't a full fledged extension command for this, but there is a custom dialog box, makedata.zip, posted to the old SPSS site There is a readme file in the zip that explains how to install it. Once installed, the dialog appears as File > New > Data with cases. You can specify the probability distribution - there are many choices - and the correlation structure. There are several other options. On Fri, Sep 20, 2019 at 9:37 AM Marciea McMillian <[hidden email]> wrote:
|
Here's a streamlined version David Marso offered to the same thread. It uses single value transformation. I added Bruce's Chart Builder section.
* Encoding: UTF-8.
/* This syntax was posted by David Marso, Jan. 17, 2011. The macro will generate any number of correlations simply by adding additional BIV N=... lines with a different R, e.g., BIV N=1000 R=.3. It makes use of single value transformation. */
DEFINE BIV (N !TOKENS(1) / R !TOKENS(1) ).
INPUT PROGRAM.
LOOP #=1 to !N.
COMPUTE X1=Normal(1).
COMPUTE X2=Normal(1).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
DESC X1 X2 / SAVE.
MATRIX.
GET Z / FILE * / VARIABLES ZX1 ZX2.
CALL SVD(T(Z)*Z/(NROW(Z)-1) ,V,D,U).
SAVE (Z * T(V) *SQRT(D) *CHOL({1,!R; !R, 1})) /OUTFILE *.
END MATRIX.
CORR COL1 COL2 / STAT=DESC.
!ENDDEFINE .
BIV N=1000 R=.7 .
* Chart Builder.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=col1 col2 MISSING=LISTWISE
REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE
/FITLINE TOTAL=YES.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: col1=col(source(s), name("col1"))
DATA: col2=col(source(s), name("col2"))
GUIDE: axis(dim(1), label("col1"))
GUIDE: axis(dim(2), label("col2"))
GUIDE: text.title(label("Simple Scatter with Fit Line of col2 by col1"))
ELEMENT: point(position(col1*col2))
END GPL.Brian Dates
From: SPSSX(r) Discussion <[hidden email]> on behalf of Jon Peck <[hidden email]>
Sent: Friday, September 20, 2019 12:51 PM To: [hidden email] <[hidden email]> Subject: Re: Create a scatterplot with a particular R squared (fake-data generator)? There isn't a full fledged extension command for this, but there is a custom dialog box, makedata.zip, posted to the old SPSS site
There is a readme file in the zip that explains how to install it. Once installed, the dialog appears as File > New > Data with cases. You can specify the probability distribution - there are many choices
- and the correlation structure. There are several other options.
On Fri, Sep 20, 2019 at 9:37 AM Marciea McMillian <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |