[rkward-cvs] SF.net SVN: rkward:[4349] branches/external_plugins/rk.FactorAnalysis
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Sat Oct 6 15:48:48 UTC 2012
Revision: 4349
http://rkward.svn.sourceforge.net/rkward/?rev=4349&view=rev
Author: m-eik
Date: 2012-10-06 15:48:48 +0000 (Sat, 06 Oct 2012)
Log Message:
-----------
rk.FactorAnalysis: added a VSS/MAP dialog
Modified Paths:
--------------
branches/external_plugins/rk.FactorAnalysis/ChangeLog
branches/external_plugins/rk.FactorAnalysis/DESCRIPTION
branches/external_plugins/rk.FactorAnalysis/inst/rkward/rk.FactorAnalysis.pluginmap
branches/external_plugins/rk.FactorAnalysis/inst/rkward/rkwarddev_plugin_script_FA.R
Added Paths:
-----------
branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.js
branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.xml
Modified: branches/external_plugins/rk.FactorAnalysis/ChangeLog
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/ChangeLog 2012-10-04 16:26:27 UTC (rev 4348)
+++ branches/external_plugins/rk.FactorAnalysis/ChangeLog 2012-10-06 15:48:48 UTC (rev 4349)
@@ -1,5 +1,11 @@
ChangeLog for package rk.FactorAnalysis
+changes in version 0.01-9 (2012-10-06)
+added:
+ - added VSS/MAP dialog
+changed:
+ - moved parallel analysis and scree plot from "plots" to "analysis"
+
changes in version 0.01-8 (2012-09-29)
fixed:
- added generic pre/post plot options
Modified: branches/external_plugins/rk.FactorAnalysis/DESCRIPTION
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/DESCRIPTION 2012-10-04 16:26:27 UTC (rev 4348)
+++ branches/external_plugins/rk.FactorAnalysis/DESCRIPTION 2012-10-06 15:48:48 UTC (rev 4349)
@@ -1,22 +1,18 @@
Package: rk.FactorAnalysis
Type: Package
Title: RKWard GUI to conduct principal component and factor analysis
-Version: 0.01-8
-Date: 2012-09-29
+Version: 0.01-9
+Date: 2012-10-06
Author: Meik Michalke <meik.michalke at hhu.de>
Maintainer: Meik Michalke <meik.michalke at hhu.de>
-Depends:
- rkward (>= 0.5.6)
-Suggests:
- psych (>= 1.1.10)
+Depends: rkward (>= 0.5.6)
+Suggests: psych (>= 1.1.10)
Enhances: rkward
-Description: RKWard GUI to conduct principal component and factor analysis
- (using the psych package). Also includes dialogs for scree plots,
- correlation plots, and parallel analysis.
+Description: RKWard GUI to conduct principal component and factor
+ analysis (using the psych package). Also includes dialogs for
+ scree plots, correlation plots, VSS/MAP and parallel analysis.
License: GPL (>= 3)
LazyLoad: yes
URL: http://rkward.sf.net
Authors at R: person(given="Meik", family="Michalke",
- email="meik.michalke at hhu.de", role=c("aut", "cre"))
-Collate:
- 'rk.FactorAnalysis-package.R'
+ email="meik.michalke at hhu.de", role=c("aut", "cre"))
Added: branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.js
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.js (rev 0)
+++ branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.js 2012-10-06 15:48:48 UTC (rev 4349)
@@ -0,0 +1,116 @@
+// this code was generated using the rkwarddev package.
+//perhaps don't make changes here, but in the rkwarddev script instead!
+
+
+
+function preprocess(){
+ // add requirements etc. here
+ echo("require(psych)\n");
+}
+
+function calculate(){
+ // read in variables from dialog
+ var vrslData = getValue("vrsl_Data");
+ var drpVssFactmeth = getValue("drp_vss_factmeth");
+ var drpVssRotate = getValue("drp_vss_rotate");
+ var spnNmbrfbs0 = getValue("spn_Nmbrfbs0");
+ var chcFtthdgnl = getValue("chc_Ftthdgnl");
+ var inpMaintitl = getValue("inp_Maintitl");
+ var chcCnnctdff = getValue("chc_Cnnctdff");
+ var svbSvdttwrk = getValue("svb_Svdttwrk");
+ var frmPltrsltsChecked = getValue("frm_Pltrslts.checked");
+
+ // the R code to be evaluated
+ echo("\t\tVSS.data <- VSS(");
+ if(vrslData) {
+ echo("\n\t\t\t" + vrslData);
+ }
+ if(spnNmbrfbs0 != 0) {
+ echo(",\n\t\t\tn.obs=" + spnNmbrfbs0);
+ }
+ if(drpVssFactmeth != "minres") {
+ echo(",\n\t\t\tfm=\"" + drpVssFactmeth + "\"");
+ }
+ if(drpVssRotate != "varimax") {
+ echo(",\n\t\t\trotate=\"" + drpVssRotate + "\"");
+ }
+ if(chcFtthdgnl) {
+ echo(",\n\t\t\tdiagonal=TRUE");
+ }
+ echo(",\n\t\t\tplot=FALSE)\n");
+ echo("\n\t\tvss.stat.vars <- c(\"dof\",\"chisq\",\"prob\",\"sqresid\",\"fit\",\"cfit.1\",\"cfit.2\")\n" + "\n\t\tvss.stat.results <- as.data.frame(cbind(Factors=1:length(VSS.data[[\"map\"]]), MAP=VSS.data[[\"map\"]], VSS.data[[\"vss.stats\"]][,vss.stat.vars]))\n" + "\t\tcolnames(vss.stat.results)[3:9] <- paste(\"VSS\", vss.stat.vars, sep=\".\")\n\n" + "\t\tmin.MAP <- which.min(VSS.data[[\"map\"]])\n" + "\t\tmin.VSS1 <- which.min(VSS.data[[\"cfit.1\"]])\n" + "\t\tmin.VSS2 <- which.min(VSS.data[[\"cfit.2\"]])\n\n");
+}
+
+function printout(){
+ // all the real work is moved to a custom defined function doPrintout() below
+ // true in this case means: We want all the headers that should be printed in the output:
+ doPrintout(true);
+}
+
+function preview(){
+ preprocess();
+ calculate();
+ doPrintout(false);
+}
+
+function doPrintout(full){
+ // read in variables from dialog
+ var vrslData = getValue("vrsl_Data");
+ var drpVssFactmeth = getValue("drp_vss_factmeth");
+ var drpVssRotate = getValue("drp_vss_rotate");
+ var spnNmbrfbs0 = getValue("spn_Nmbrfbs0");
+ var chcFtthdgnl = getValue("chc_Ftthdgnl");
+ var inpMaintitl = getValue("inp_Maintitl");
+ var chcCnnctdff = getValue("chc_Cnnctdff");
+ var svbSvdttwrk = getValue("svb_Svdttwrk");
+ var frmPltrsltsChecked = getValue("frm_Pltrslts.checked");
+
+ // create the plot
+ if(full) {
+ echo("rk.header(\"Very Simple Structure/Minimum Average Partial results\")\n");
+ }
+
+ var frmPltrsltsChecked = getValue("frm_Pltrslts.checked");
+ if(frmPltrsltsChecked) {
+
+
+ if(full) {
+ echo("rk.graph.on()\n");
+ }
+ echo("\ttry({\n");
+
+
+
+ // the actual plot:
+ echo("\t\tVSS.plot(VSS.data");
+ if(inpMaintitl != "Very Simple Structure") {
+ echo(",\n\t\t\ttitle=\"" + inpMaintitl + "\"");
+ }
+ if(chcCnnctdff) {
+ echo(",\n\t\t\tline=TRUE");
+ }
+ echo(")");
+
+
+
+ echo("\n\t})\n");
+ if(full) {
+ echo("rk.graph.off()\n");
+ }
+ }
+ echo("rk.header(\"Very Simple Structure\", level=4)\n" + "rk.print(paste(\"VSS complexity 1 achieves a maximimum of \", round(VSS.data[[\"cfit.1\"]][min.VSS1], digits=3), \" with \", min.VSS1, \" factors.\", sep=\"\"))\n" + "rk.print(paste(\"VSS complexity 2 achieves a maximimum of \", round(VSS.data[[\"cfit.2\"]][min.VSS2], digits=3), \" with \", min.VSS2, \" factors.\", sep=\"\"))\n" + "rk.header(\"Minimum Average Partial\", level=4)\n" + "rk.print(paste(\"The Velicer MAP criterion achieves a minimum of \", round(VSS.data[[\"map\"]][min.MAP], digits=3), \" with \", min.MAP, \" factors.\", sep=\"\"))\n" + "rk.header(\"Statistics\", level=4)\n" + "rk.results(vss.stat.results)\n\n");
+
+ // left over from the printout function
+
+ //// save result object
+ // read in saveobject variables
+ var svbSvdttwrk = getValue("svb_Svdttwrk");
+ var svbSvdttwrkActive = getValue("svb_Svdttwrk.active");
+ var svbSvdttwrkParent = getValue("svb_Svdttwrk.parent");
+ // assign object to chosen environment
+ if(svbSvdttwrkActive) {
+ echo(".GlobalEnv$" + svbSvdttwrk + " <- VSS.data\n");
+ }
+
+
+}
\ No newline at end of file
Added: branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.xml
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.xml (rev 0)
+++ branches/external_plugins/rk.FactorAnalysis/inst/rkward/plugins/VerySimpleStructureMinimumAveragePartial.xml 2012-10-06 15:48:48 UTC (rev 4349)
@@ -0,0 +1,40 @@
+<!DOCTYPE rkplugin>
+<document>
+ <!-- this code was generated using the rkwarddev package.
+ perhaps don't make changes here, but in the rkwarddev script instead! -->
+ <code file="VerySimpleStructureMinimumAveragePartial.js" />
+ <help file="VerySimpleStructureMinimumAveragePartial.rkh" />
+ <logic>
+ <!-- <convert id="!edit!" sources="!edit!" mode="equals" standard="!edit!" /> -->
+ <!-- <connect governor="!edit!" client="!edit!.enabled" /> -->
+ </logic>
+ <dialog label="VSS/MAP">
+ <row id="row_vSSDDSFMUL">
+ <varselector id="vrs_Slctdtfr" label="Select data.frame/matrix" />
+ <column id="clm_vDDSFMULSP">
+ <varslot id="vrsl_Data" label="Data" source="vrs_Slctdtfr" required="true" />
+ <dropdown id="drp_vss_factmeth" label="Factoring method">
+ <option label="Minimum residual (ULS)" value="minres" checked="true" />
+ <option label="Principal Components" value="pc" />
+ <option label="Principal axis" value="pa" />
+ <option label="Maximum likelihood" value="ml" />
+ </dropdown>
+ <dropdown id="drp_vss_rotate" label="Rotation method">
+ <option label="None" value="none" />
+ <option label="Varimax (orthogonal)" value="varimax" checked="true" />
+ <option label="Promax" value="promax" />
+ <option label="Oblimin" value="oblimin" />
+ </dropdown>
+ <spinbox label="Number of observations (0 implies raw data)" id="spn_Nmbrfbs0" min="0" type="integer" />
+ <checkbox id="chc_Ftthdgnl" label="Fit the diagonal as well" value="true" />
+ <stretch />
+ <frame label="Plot results" checkable="true" id="frm_Pltrslts">
+ <input label="Main title" id="inp_Maintitl" initial="Very Simple Structure" />
+ <checkbox id="chc_Cnnctdff" label="Connect different complexities" value="true" />
+ <preview />
+ </frame>
+ <saveobject label="Save data to workspace" checkable="true" initial="VSS.data" id="svb_Svdttwrk" />
+ </column>
+ </row>
+ </dialog>
+</document>
Modified: branches/external_plugins/rk.FactorAnalysis/inst/rkward/rk.FactorAnalysis.pluginmap
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/inst/rkward/rk.FactorAnalysis.pluginmap 2012-10-04 16:26:27 UTC (rev 4348)
+++ branches/external_plugins/rk.FactorAnalysis/inst/rkward/rk.FactorAnalysis.pluginmap 2012-10-06 15:48:48 UTC (rev 4349)
@@ -10,9 +10,9 @@
<about
name="rk.FactorAnalysis"
shortinfo="RKWard GUI to conduct principal component and factor analysis"
- longinfo="RKWard GUI to conduct principal component and factor analysis (using the psych package). Also includes dialogs for scree plots, correlation plots, and parallel analysis."
- version="0.01-8"
- releasedate="2012-09-29"
+ longinfo="RKWard GUI to conduct principal component and factor analysis (using the psych package). Also includes dialogs for scree plots, correlation plots, VSS/MAP and parallel analysis."
+ version="0.01-9"
+ releasedate="2012-10-06"
url="http://rkward.sf.net"
license="GPL (>= 3)"
>
@@ -58,6 +58,12 @@
file="plugins/ParallelanalysisHorn.xml"
/>
<component
+ id="cmp_FctrnlyssVrySmplStrctrMAP"
+ label="Very Simple Structure/Minimum Average Partial"
+ type="standard"
+ file="plugins/VerySimpleStructureMinimumAveragePartial.xml"
+ />
+ <component
id="cmp_FactoranalysisFactornlyss"
label="Factor analysis"
type="standard"
@@ -66,14 +72,19 @@
</components>
<hierarchy>
<menu
- id="plots"
- label.plots="Plots"
+ id="analysis"
+ label.analysis="Analysis"
>
<menu
id="Factoranalysis"
label="Factor analysis"
>
- <entry component="cmp_FactoranalysisScreeplot" />
+ <menu
+ id="Numberoffactors"
+ label="Number of factors"
+ >
+ <entry component="cmp_FactoranalysisScreeplot" />
+ </menu>
</menu>
</menu>
<menu
@@ -88,14 +99,19 @@
</menu>
</menu>
<menu
- id="plots"
- label.plots="Plots"
+ id="analysis"
+ label.analysis="Analysis"
>
<menu
id="Factoranalysis"
label="Factor analysis"
>
- <entry component="cmp_FactoranlyssPrlllnlyssHrn" />
+ <menu
+ id="Numberoffactors"
+ label="Number of factors"
+ >
+ <entry component="cmp_FactoranlyssPrlllnlyssHrn" />
+ </menu>
</menu>
</menu>
<menu
@@ -106,6 +122,22 @@
id="Factoranalysis"
label="Factor analysis"
>
+ <menu
+ id="Numberoffactors"
+ label="Number of factors"
+ >
+ <entry component="cmp_FctrnlyssVrySmplStrctrMAP" />
+ </menu>
+ </menu>
+ </menu>
+ <menu
+ id="analysis"
+ label.analysis="Analysis"
+ >
+ <menu
+ id="Factoranalysis"
+ label="Factor analysis"
+ >
<entry component="cmp_FactoranalysisFactornlyss" />
</menu>
</menu>
Modified: branches/external_plugins/rk.FactorAnalysis/inst/rkward/rkwarddev_plugin_script_FA.R
===================================================================
--- branches/external_plugins/rk.FactorAnalysis/inst/rkward/rkwarddev_plugin_script_FA.R 2012-10-04 16:26:27 UTC (rev 4348)
+++ branches/external_plugins/rk.FactorAnalysis/inst/rkward/rkwarddev_plugin_script_FA.R 2012-10-06 15:48:48 UTC (rev 4349)
@@ -5,7 +5,7 @@
local({
# set the output directory to overwrite the actual plugin
-output.dir <- "/home/m/daten/R/rkward_plugins"#tempdir()
+output.dir <- tempdir()
overwrite <- TRUE
require(rkwarddev)
@@ -16,7 +16,7 @@
person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut","cre"))),
about=list(desc="RKWard GUI to conduct principal component and factor analysis",
- version="0.01-8", url="http://rkward.sf.net", long.desc="RKWard GUI to conduct principal component and factor analysis (using the psych package). Also includes dialogs for scree plots, correlation plots, and parallel analysis."),
+ version="0.01-9", url="http://rkward.sf.net", long.desc="RKWard GUI to conduct principal component and factor analysis (using the psych package). Also includes dialogs for scree plots, correlation plots, VSS/MAP and parallel analysis."),
dependencies=list(rkward.min="0.5.6"),
package=list(c(name="psych", min="1.1.10"))
)
@@ -390,8 +390,8 @@
dialog=scree.full.dialog),
js=list(
require="psych",
- doPrintout=scree.js.print),
- hierarchy=list("plots", "Factor analysis"),
+ doPrintout=scree.js.print),
+ hierarchy=list("analysis", "Factor analysis","Number of factors"),
create=c("xml", "js"))
@@ -477,11 +477,114 @@
dialog=prll.full.dialog),
js=list(
require="psych",
- doPrintout=prll.js.print),
- hierarchy=list("plots", "Factor analysis"),
+ doPrintout=prll.js.print),
+ hierarchy=list("analysis", "Factor analysis","Number of factors"),
create=c("xml", "js"))
+############
+## VSS & MAP
+############
+# vss(x, n = 8, rotate = "varimax", diagonal = FALSE, fm = "minres", n.obs=NULL,plot=TRUE,title="Very Simple Structure",...)
+vss.var.select <- rk.XML.varselector(label="Select data.frame/matrix")
+vss.var.data <- rk.XML.varslot(label="Data", source=vss.var.select, required=TRUE)
+
+# minres, ml, uls, wls, gls, pa
+vss.factmeth <- rk.XML.dropdown("Factoring method", options=list(
+ "Minimum residual (ULS)"=c(val="minres", chk=TRUE),
+ "Principal Components"=c(val="pc"),
+ "Principal axis"=c(val="pa"),
+ "Maximum likelihood"=c(val="ml")
+ ), id.name="drp_vss_factmeth")
+
+vss.drp.rotation <- rk.XML.dropdown("Rotation method", options=list(
+ "None"=c(val="none"),
+ "Varimax (orthogonal)"=c(val="varimax", chk=TRUE),
+ "Promax"=c(val="promax"),
+ "Oblimin"=c(val="oblimin")
+ ), id.name="drp_vss_rotate")
+
+vss.spin.nfactors <- rk.XML.spinbox("Number of factors to extract", min=1, initial=8, real=FALSE)
+
+vss.main <- rk.XML.input(label="Main title", initial="Very Simple Structure")
+
+vss.spin.nobs <- rk.XML.spinbox("Number of observations (0 implies raw data)", min=0, initial=0, real=FALSE)
+
+vss.cbox.diag <- rk.XML.cbox("Fit the diagonal as well")
+
+# plot options
+vss.cbox.line <- rk.XML.cbox("Connect different complexities")
+vss.preview <- rk.XML.preview()
+vss.frame.plot <- rk.XML.frame(
+ vss.main,
+ vss.cbox.line,
+ vss.preview, label="Plot results", checkable=TRUE)
+
+vss.save.results <- rk.XML.saveobj("Save data to workspace", initial="VSS.data")
+
+vss.full.dialog <- rk.XML.dialog(
+ rk.XML.row(
+ vss.var.select,
+ rk.XML.col(
+ vss.var.data,
+ vss.factmeth,
+ vss.drp.rotation,
+ vss.spin.nobs,
+ vss.cbox.diag,
+ rk.XML.stretch(),
+ vss.frame.plot,
+ vss.save.results
+ )
+ )
+, label="VSS/MAP")
+
+## JavaScript
+vss.js.calc <- rk.paste.JS(
+ echo("\t\tVSS.data <- VSS("),
+ ite(vss.var.data, echo("\n\t\t\t", vss.var.data)),
+ ite(id(vss.spin.nobs, " != 0"), echo(",\n\t\t\tn.obs=", vss.spin.nobs)), # NULL
+ ite(id(vss.factmeth, " != \"minres\""), echo(",\n\t\t\tfm=\"", vss.factmeth, "\"")),
+ ite(id(vss.drp.rotation, " != \"varimax\""), echo(",\n\t\t\trotate=\"", vss.drp.rotation, "\"")),
+ tf(vss.cbox.diag, opt="diagonal", level=4), # FALSE
+ echo(",\n\t\t\tplot=FALSE)\n"),
+ echo("\n\t\tvss.stat.vars <- c(\"dof\",\"chisq\",\"prob\",\"sqresid\",\"fit\",\"cfit.1\",\"cfit.2\")\n",
+ "\n\t\tvss.stat.results <- as.data.frame(cbind(Factors=1:length(VSS.data[[\"map\"]]), MAP=VSS.data[[\"map\"]], VSS.data[[\"vss.stats\"]][,vss.stat.vars]))\n",
+ "\t\tcolnames(vss.stat.results)[3:9] <- paste(\"VSS\", vss.stat.vars, sep=\".\")\n\n",
+ "\t\tmin.MAP <- which.min(VSS.data[[\"map\"]])\n",
+ "\t\tmin.VSS1 <- which.min(VSS.data[[\"cfit.1\"]])\n",
+ "\t\tmin.VSS2 <- which.min(VSS.data[[\"cfit.2\"]])\n\n")
+)
+
+vss.js.print <- rk.paste.JS(
+ vss.js.frame.plot <- rk.JS.vars(vss.frame.plot, modifiers="checked"),
+# echo("rk.print(VSS.data[[\"call\"]])\n"),
+ ite(vss.js.frame.plot, rk.paste.JS.graph(
+ echo("\t\tVSS.plot(VSS.data"),
+ ite(id(vss.main, " != \"Very Simple Structure\""), echo(",\n\t\t\ttitle=\"", vss.main, "\"")),
+ tf(vss.cbox.line, opt="line", level=4),
+ echo(")")
+ )),
+ echo("rk.header(\"Very Simple Structure\", level=4)\n",
+ "rk.print(paste(\"VSS complexity 1 achieves a maximimum of \", round(VSS.data[[\"cfit.1\"]][min.VSS1], digits=3), \" with \", min.VSS1, \" factors.\", sep=\"\"))\n",
+ "rk.print(paste(\"VSS complexity 2 achieves a maximimum of \", round(VSS.data[[\"cfit.2\"]][min.VSS2], digits=3), \" with \", min.VSS2, \" factors.\", sep=\"\"))\n",
+ "rk.header(\"Minimum Average Partial\", level=4)\n",
+ "rk.print(paste(\"The Velicer MAP criterion achieves a minimum of \", round(VSS.data[[\"map\"]][min.MAP], digits=3), \" with \", min.MAP, \" factors.\", sep=\"\"))\n",
+ "rk.header(\"Statistics\", level=4)\n",
+ "rk.results(vss.stat.results)\n\n")
+)
+
+## make a whole component
+vss.component <- rk.plugin.component("Very Simple Structure/Minimum Average Partial",
+ xml=list(
+ dialog=vss.full.dialog),
+ js=list(
+ require="psych",
+ calculate=vss.js.calc,
+ doPrintout=vss.js.print),
+ hierarchy=list("analysis", "Factor analysis","Number of factors"),
+ create=c("xml", "js"))
+
+
############
## correlation plot
############
@@ -573,7 +676,11 @@
calculate=js.calc,
printout=js.print),
pluginmap=list(name="Factor analysis", hierarchy=list("analysis", "Factor analysis")),
- components=list(scree.component, crplt.component, prll.component),
+ components=list(
+ scree.component,
+ crplt.component,
+ prll.component,
+ vss.component),
create=c("pmap", "xml", "js", "desc"),
overwrite=overwrite,
tests=FALSE,
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