[rkward-cvs] SF.net SVN: rkward: [1131] trunk/rkward/rkward/plugins/plots
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Fri Jan 12 12:31:31 UTC 2007
Revision: 1131
http://svn.sourceforge.net/rkward/?rev=1131&view=rev
Author: tfry
Date: 2007-01-12 04:31:31 -0800 (Fri, 12 Jan 2007)
Log Message:
-----------
Update of correlation matrix plot (I. Soumpasis) (NOT for 0.4.5)
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/cor_graph.php
trunk/rkward/rkward/plugins/plots/cor_graph.xml
Modified: trunk/rkward/rkward/plugins/plots/cor_graph.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.php 2007-01-12 11:00:04 UTC (rev 1130)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.php 2007-01-12 12:31:31 UTC (rev 1131)
@@ -1,49 +1,57 @@
<?
- function preprocess () {
- }
+ function preprocess () { ?>
+ rk.temp.cor.graph <- function(x) {
+ panel.cor <- function(x, y, digits=<? getRK ("digits"); ?>, cex.cor) {
+ usr <- par("usr"); on.exit(par(usr))
+ par(usr = c(0, 1, 0, 1))
+ r <- abs(cor(x, y, use="<? getRK ("use"); ?>", method="<? getRK ("method"); ?>"))
+ txt <- format(c(r, 0.123456789), digits=digits)[1]
+ txt <- paste(txt, sep="")
+ if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
+
+ test <- cor.test(x,y, use="<? getRK ("use"); ?>", method="<? getRK ("method"); ?>")
+ Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
+ cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
+ symbols = c("***", "**", "*", ".", " "))
+
+ if("<? getRK ("scale"); ?>"=="yes") text(0.5, 0.5, txt, cex = cex * r)
+ if("<? getRK ("scale"); ?>"=="no") text(0.5, 0.5, txt, cex = cex)
+ text(.8, .8, Signif, cex=cex, col=2)
+ }
+ pairs(x,
+ lower.panel=panel.smooth, upper.panel=panel.cor)
+ }
+ <? }
function calculate () {
}
-
+
function printout () {
$vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
?>
-rk.temp.cor.graph <- function(x){
-panel.cor <- function(x, y, digits=2, prefix="", cex.cor)
-{
- usr <- par("usr"); on.exit(par(usr))
- par(usr = c(0, 1, 0, 1))
- r <- abs(cor(x, y))
- txt <- format(c(r, 0.123456789), digits=digits)[1]
- txt <- paste(prefix, txt, sep="")
- if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
-
- test <- cor.test(x,y)
- # borrowed from printCoefmat
- Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
- cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
- symbols = c("***", "**", "*", ".", " "))
-
- text(0.5, 0.5, txt, cex = cex * r)
- text(.8, .8, Signif, cex=cex, col=2)
-}
-pairs(x,
- lower.panel=panel.smooth, upper.panel=panel.cor)
-}
-rk.temp.x<- data.frame (<? echo ($vars); ?>)
-rk.header ("Correlation Matrix Plot")
-rk.graph.on ()
-rk.temp.cor.graph(rk.temp.x)
+ rk.temp.x<- data.frame (<? echo ($vars); ?>)
-rk.graph.off ()
+ rk.header ("Correlation Matrix Plot")
-rm(rk.temp.cor.graph,rk.temp.x)
+ rk.graph.on ()
+
+ try ({
+ rk.temp.cor.graph (rk.temp.x)
+ })
+
+ rk.graph.off ()
+
+ print("Signif. codes: 0 '***', 0.001 '**', 0.01 '*', 0.05 '.'', 0.1 ' ', 1")
+
<?
}
function cleanup () {
+ ?>
+ rm(rk.temp.cor.graph,rk.temp.x)
+ <?
}
?>
Modified: trunk/rkward/rkward/plugins/plots/cor_graph.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.xml 2007-01-12 11:00:04 UTC (rev 1130)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.xml 2007-01-12 12:31:31 UTC (rev 1131)
@@ -2,11 +2,35 @@
<document>
<code file="cor_graph.php" />
- <dialog label="Correlation Matrix Graph" >
+ <dialog label="Correlation Matrix Plot" >
+ <tabbook>
+ <tab label="variables">
<row>
<varselector id="vars"/>
<varslot type="numeric" min_vars="1" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
- </row>
+ </row>
+ </tab>
+ <tab label="options">
+ <radio id="method" label="Method">
+ <option value="pearson" label="Pearson"/>
+ <option value="kendall" label="Kendall"/>
+ <option value="spearman" label="Spearman"/>
+ </radio>
+ <radio id="use" label="Exclude missing values">
+ <option value="complete.obs" label="whole cases"/>
+ <option value="pairwise.complete.obs" label="pairwise" checked="true"/>
+ </radio>
+ <radio id="digits" label="Precision">
+ <option value="1" label="1"/>
+ <option value="2" label="2"/>
+ <option value="3" label="3" checked="true"/>
+ </radio>
+ <radio id="scale" label="Scale text">
+ <option value="yes" label="Yes" checked="true"/>
+ <option value="no" label="No"/>
+ </radio>
+ </tab>
+ </tabbook>
</dialog>
</document>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list