using python extensions

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

using python extensions

Art Kendall
If I use something like this  syntax to generate correlations,
how do I use the modify_tables extension command to do as many of these things as possible globally.
1) round the coefficient to 2 decimal places.
2) remove the N line.
3) Footnote correlations whose absolute value exceeds some number, e.g., .25.
4) insert a new line labeled R squared that has the squares of the correlation coefficient. (not in example below.)
5) add another footer "N = 1700" .(not in example below.)

very much like this but with
columns aligned
the the footnote of .25 as subscript
without the blank line after the first footer line.

 

Correlations

 

score

item1

item2

item3

DV

Pearson Correlation

.26**,b

.17**

.15**

.12**

Sig. (2-tailed)

.000

.000

.000

.000

**. Correlation is significant at the 0.01 level (2-tailed).

 

Coefficient exceeds .25.

b.  Footnote

new file.
set seed = 20110113.
input program.
loop id = 1 to 1700.
compute item1 =rnd(rv.uniform(.5,5.5)).
compute item2 =rnd(rv.uniform(.5,5.5)).
compute item3 =rnd(rv.uniform(.5,5.5)).
compute score = mean(item1 to item3).
compute DV = rnd(score +rv.normal(0,3.3)).
end case.
end loop.
end file.
end input program.
formats Id(f4) item1 to item3 DV score (f5.2).
frequencies variables =DV score item1 to item3.
Correlations  variables = DV with  Score   item1 to item3/print=noSIG.




Art Kendall
Social Research Consultants






===================== 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: using python extensions

Jon K Peck
There is a package called FormatCorrelations available from the SPSS Community in the Utilities collection that can do much of this.
It can remove the N line, suppress the upper triangle, suppress nonsignificant correlations, and highlight large correlations.  It has a dialog box interface that generates syntax for the SPSSINC MODIFY TABLES command using a custom plugin function.

It does not include rounding, or an N footnote.  Those would be good additions to that utility (what do you do when N varies because of missing data?), but they could be done with MODIFY TABLES.  Adding extra lines to a table, unfortunately is not possible as there is no api for adding rows or columns (something I have been lobbying for for years).  The closest you could come would be stacking the values the way that the SPSSINC MERGE TABLES command does.

FormatCorrelations works best with V19.0.1.  Some features do not work with older versions of Statistics.

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Art Kendall <[hidden email]>
To:        [hidden email]
Date:        01/13/2011 09:29 AM
Subject:        [SPSSX-L] using python extensions
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




If I use something like this  syntax to generate correlations,
how do I use the modify_tables extension command to do as many of these things as possible globally.
1) round the coefficient to 2 decimal places.
2) remove the N line.
3) Footnote correlations whose absolute value exceeds some number, e.g., .25.
4) insert a new line labeled R squared that has the squares of the correlation coefficient. (not in example below.)
5) add another footer "N = 1700" .(not in example below.)

very much like this but with
columns aligned
the the footnote of .25 as subscript
without the blank line after the first footer line.

 

Correlations
 
score
item1
item2
item3
DV Pearson Correlation
.26**,b
.17**
.15**
.12**
Sig. (2-tailed)
.000
.000
.000
.000
**. Correlation is significant at the 0.01 level (2-tailed).
 
Coefficient exceeds .25.
b.  Footnote

new file.
set seed = 20110113.
input program.
loop id = 1 to 1700.
compute item1 =rnd(rv.uniform(.5,5.5)).
compute item2 =rnd(rv.uniform(.5,5.5)).
compute item3 =rnd(rv.uniform(.5,5.5)).
compute score = mean(item1 to item3).
compute DV = rnd(score +rv.normal(0,3.3)).
end case.
end loop.
end file.
end input program.
formats Id(f4) item1 to item3 DV score (f5.2).
frequencies variables =DV score item1 to item3.
Correlations  variables = DV with  Score   item1 to item3/print=noSIG.




Art Kendall
Social Research Consultants






===================== 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: using python extensions

Art Kendall
Jon
did you mean 19.0.0.1?

Art

On 1/13/2011 1:04 PM, Jon K Peck wrote:
There is a package called FormatCorrelations available from the SPSS Community in the Utilities collection that can do much of this.
It can remove the N line, suppress the upper triangle, suppress nonsignificant correlations, and highlight large correlations.  It has a dialog box interface that generates syntax for the SPSSINC MODIFY TABLES command using a custom plugin function.

It does not include rounding, or an N footnote.  Those would be good additions to that utility (what do you do when N varies because of missing data?), but they could be done with MODIFY TABLES.  Adding extra lines to a table, unfortunately is not possible as there is no api for adding rows or columns (something I have been lobbying for for years).  The closest you could come would be stacking the values the way that the SPSSINC MERGE TABLES command does.

FormatCorrelations works best with V19.0.1.  Some features do not work with older versions of Statistics.

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Art Kendall [hidden email]
To:        [hidden email]
Date:        01/13/2011 09:29 AM
Subject:        [SPSSX-L] using python extensions
Sent by:        "SPSSX(r) Discussion" [hidden email]




If I use something like this  syntax to generate correlations,
how do I use the modify_tables extension command to do as many of these things as possible globally.
1) round the coefficient to 2 decimal places.
2) remove the N line.
3) Footnote correlations whose absolute value exceeds some number, e.g., .25.
4) insert a new line labeled R squared that has the squares of the correlation coefficient. (not in example below.)
5) add another footer "N = 1700" .(not in example below.)

very much like this but with
columns aligned
the the footnote of .25 as subscript
without the blank line after the first footer line.

 

Correlations
 
score
item1
item2
item3
DV Pearson Correlation
.26**,b
.17**
.15**
.12**
Sig. (2-tailed)
.000
.000
.000
.000
**. Correlation is significant at the 0.01 level (2-tailed).
 
Coefficient exceeds .25.
b.  Footnote

new file.
set seed = 20110113.
input program.
loop id = 1 to 1700.
compute item1 =rnd(rv.uniform(.5,5.5)).
compute item2 =rnd(rv.uniform(.5,5.5)).
compute item3 =rnd(rv.uniform(.5,5.5)).
compute score = mean(item1 to item3).
compute DV = rnd(score +rv.normal(0,3.3)).
end case.
end loop.
end file.
end input program.
formats Id(f4) item1 to item3 DV score (f5.2).
frequencies variables =DV score item1 to item3.
Correlations  variables = DV with  Score   item1 to item3/print=noSIG.




Art Kendall
Social Research Consultants






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