[rkward-cvs] SF.net SVN: rkward:[2723] trunk/rkward/rkward/plugins
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Dec 7 10:46:08 UTC 2009
Revision: 2723
http://rkward.svn.sourceforge.net/rkward/?rev=2723&view=rev
Author: tfry
Date: 2009-12-07 10:46:07 +0000 (Mon, 07 Dec 2009)
Log Message:
-----------
Add auto-converted .js-files.
All of these will have to be checked by hand. After that, the corresponding .xml should be changed to point to the .js file, instead of .php file.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/php2js.js
Added Paths:
-----------
trunk/rkward/rkward/plugins/00saveload/import/import_csv.js
trunk/rkward/rkward/plugins/00saveload/import/import_spss.js
trunk/rkward/rkward/plugins/00saveload/import/import_stata.js
trunk/rkward/rkward/plugins/00saveload/import/load_data.js
trunk/rkward/rkward/plugins/00saveload/import/source.js
trunk/rkward/rkward/plugins/00saveload/save/save/code.js
trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js
trunk/rkward/rkward/plugins/00saveload/save/write.js
trunk/rkward/rkward/plugins/00saveload/save/write_table.js
trunk/rkward/rkward/plugins/00saveload/setworkdir.js
trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js
trunk/rkward/rkward/plugins/analysis/TESTS/mood_test.js
trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.js
trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.js
trunk/rkward/rkward/plugins/analysis/corr_matrix.js
trunk/rkward/rkward/plugins/analysis/crosstab.js
trunk/rkward/rkward/plugins/analysis/crosstab_multi.js
trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_2pl.js
trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_3pl.js
trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_lltm.js
trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_rasch.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_gpcm.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_grm.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lpcm.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lrsm.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_pcm.js
trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_rsm.js
trunk/rkward/rkward/plugins/analysis/irt/tests/eRm_waldtest.js
trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_cronbach_alpha.js
trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_gof_rasch.js
trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_item_fit.js
trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_person_fit.js
trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_unidimensional.js
trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js
trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js
trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js
trunk/rkward/rkward/plugins/analysis/moments/moment.js
trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js
trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js
trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js
trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js
trunk/rkward/rkward/plugins/analysis/outliers/outlier.js
trunk/rkward/rkward/plugins/analysis/regression/linear_regression.js
trunk/rkward/rkward/plugins/analysis/t_test_two_vars.js
trunk/rkward/rkward/plugins/analysis/time_series/Box_test.js
trunk/rkward/rkward/plugins/analysis/time_series/hp_filter.js
trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.js
trunk/rkward/rkward/plugins/analysis/variances/F_test.js
trunk/rkward/rkward/plugins/analysis/variances/bartlett_test.js
trunk/rkward/rkward/plugins/analysis/variances/fligner_test.js
trunk/rkward/rkward/plugins/analysis/variances/levene_test.js
trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.js
trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.js
trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.js
trunk/rkward/rkward/plugins/distributions/beta_probabilities.js
trunk/rkward/rkward/plugins/distributions/beta_quantiles.js
trunk/rkward/rkward/plugins/distributions/binomial_quantiles.js
trunk/rkward/rkward/plugins/distributions/binomial_tail_probabilities.js
trunk/rkward/rkward/plugins/distributions/cauchy_probabilities.js
trunk/rkward/rkward/plugins/distributions/cauchy_quantiles.js
trunk/rkward/rkward/plugins/distributions/chi_squared_probabilities.js
trunk/rkward/rkward/plugins/distributions/chi_squared_quantiles.js
trunk/rkward/rkward/plugins/distributions/clt/plot_beta_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_chi_squared_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_clt_common.js
trunk/rkward/rkward/plugins/distributions/clt/plot_exponential_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_f_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_gamma_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_geometric_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_hypergeometric_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_logistic_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_lognormal_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_negbinomial_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_normal_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_poisson_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_t_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_uniform_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_weibull_clt.js
trunk/rkward/rkward/plugins/distributions/clt/plot_wilcoxon_clt.js
trunk/rkward/rkward/plugins/distributions/exponential_probabilities.js
trunk/rkward/rkward/plugins/distributions/exponential_quantiles.js
trunk/rkward/rkward/plugins/distributions/f_probabilities.js
trunk/rkward/rkward/plugins/distributions/f_quantiles.js
trunk/rkward/rkward/plugins/distributions/gamma_probabilities.js
trunk/rkward/rkward/plugins/distributions/gamma_quantiles.js
trunk/rkward/rkward/plugins/distributions/geom_probabilities.js
trunk/rkward/rkward/plugins/distributions/geom_quantiles.js
trunk/rkward/rkward/plugins/distributions/gumbel_probabilities.js
trunk/rkward/rkward/plugins/distributions/gumbel_quantiles.js
trunk/rkward/rkward/plugins/distributions/hypergeometric_probabilities.js
trunk/rkward/rkward/plugins/distributions/hypergeometric_quantiles.js
trunk/rkward/rkward/plugins/distributions/log_normal_probabilities.js
trunk/rkward/rkward/plugins/distributions/log_normal_quantiles.js
trunk/rkward/rkward/plugins/distributions/logistic_probabilities.js
trunk/rkward/rkward/plugins/distributions/logistic_quantiles.js
trunk/rkward/rkward/plugins/distributions/negative_binomial_probabilities.js
trunk/rkward/rkward/plugins/distributions/negative_binomial_quantiles.js
trunk/rkward/rkward/plugins/distributions/normal_probabilities.js
trunk/rkward/rkward/plugins/distributions/normal_quantiles.js
trunk/rkward/rkward/plugins/distributions/plot_beta_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_cauchy_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_dist_common.js
trunk/rkward/rkward/plugins/distributions/plot_exponential_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_f_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_t_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.js
trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.js
trunk/rkward/rkward/plugins/distributions/poisson_probabilities.js
trunk/rkward/rkward/plugins/distributions/poisson_quantiles.js
trunk/rkward/rkward/plugins/distributions/t_probabilities.js
trunk/rkward/rkward/plugins/distributions/t_quantiles.js
trunk/rkward/rkward/plugins/distributions/tests/ad_test.js
trunk/rkward/rkward/plugins/distributions/tests/cvm_test.js
trunk/rkward/rkward/plugins/distributions/tests/jb_test.js
trunk/rkward/rkward/plugins/distributions/tests/lillie_test.js
trunk/rkward/rkward/plugins/distributions/tests/pearson_test.js
trunk/rkward/rkward/plugins/distributions/tests/sf_test.js
trunk/rkward/rkward/plugins/distributions/tests/shapiro_test.js
trunk/rkward/rkward/plugins/distributions/tukey_probabilities.js
trunk/rkward/rkward/plugins/distributions/tukey_quantiles.js
trunk/rkward/rkward/plugins/distributions/uniform_probabilities.js
trunk/rkward/rkward/plugins/distributions/uniform_quantiles.js
trunk/rkward/rkward/plugins/distributions/weibull_probabilities.js
trunk/rkward/rkward/plugins/distributions/weibull_quantiles.js
trunk/rkward/rkward/plugins/distributions/wilcoxon_probabilities.js
trunk/rkward/rkward/plugins/distributions/wilcoxon_quantiles.js
trunk/rkward/rkward/plugins/plots/barplot.js
trunk/rkward/rkward/plugins/plots/barplot_embed.js
trunk/rkward/rkward/plugins/plots/box_plot.js
trunk/rkward/rkward/plugins/plots/color_chooser.js
trunk/rkward/rkward/plugins/plots/cor_graph.js
trunk/rkward/rkward/plugins/plots/density_plot.js
trunk/rkward/rkward/plugins/plots/dotchart.js
trunk/rkward/rkward/plugins/plots/ecdf_plot.js
trunk/rkward/rkward/plugins/plots/histogram.js
trunk/rkward/rkward/plugins/plots/histogram_options.js
trunk/rkward/rkward/plugins/plots/irt/dichotomous/plot_ltm.js
trunk/rkward/rkward/plugins/plots/irt/dichotomous/plot_rasch.js
trunk/rkward/rkward/plugins/plots/irt/dichotomous/plot_tpm.js
trunk/rkward/rkward/plugins/plots/irt/polytomous/plot_grm.js
trunk/rkward/rkward/plugins/plots/irt/polytomous/plot_pcm.js
trunk/rkward/rkward/plugins/plots/irt/polytomous/plot_rsm.js
trunk/rkward/rkward/plugins/plots/irt/tests/eRm_plotLR.js
trunk/rkward/rkward/plugins/plots/pareto.js
trunk/rkward/rkward/plugins/plots/piechart.js
trunk/rkward/rkward/plugins/plots/plot.js
trunk/rkward/rkward/plugins/plots/plot_options.js
trunk/rkward/rkward/plugins/plots/plot_stepfun_options.js
trunk/rkward/rkward/plugins/plots/scatterplot.js
trunk/rkward/rkward/plugins/plots/scatterplot_matrix.js
trunk/rkward/rkward/plugins/plots/sieve_plot.js
trunk/rkward/rkward/plugins/plots/stem.js
trunk/rkward/rkward/plugins/plots/stripchart_plot.js
trunk/rkward/rkward/plugins/simple_anova/code.js
trunk/rkward/rkward/plugins/uni1.2/code.js
trunk/rkward/rkward/plugins/x11device/export.js
trunk/rkward/rkward/plugins/x11device/grid.js
Copied: trunk/rkward/rkward/plugins/00saveload/import/import_csv.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/import/import_csv.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,81 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Found string 'strtr'. Please check whether conversion is needed (use varname.replace(...)).
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+// internal helper function
+function quoteString (string) {
+ return ('"' + strtr (string, new Array('"', '\\"')) + '"');
+}
+
+
+function calculate () {
+ var quick = "";
+ var dec = "";
+ var sep = "";
+ var quote = "";
+ var header = "";
+ var fill = "";
+ var comchar = "";
+ var tableOptions = "";
+ quick = getValue ("quick");
+ if (quick == "table") {
+ dec = getValue ("dec");
+ if (dec == "other") dec = quoteString (getValue ("custom_dec"));
+ sep = getValue ("sep");
+ if (sep == "other") sep = quoteString (getValue ("custom_sep"));
+ quote = getValue ("quote");
+ if (quote == "other") quote = quoteString (getValue ("custom_quote"));
+ header = getValue ("header");
+ fill = getValue ("fill");
+ comchar = quoteString (getValue ("commentchar"));
+ tableOptions = ", header={$header}, sep={$sep}, quote={$quote}, dec={$dec}, fill={$fill}, comment.char={$comchar}";
+ } else {
+ tableOptions = "";
+ }
+// Other method is to use read.table and show all the options - more transparent
+ echo ('imported <<- read.' + quick + ' (file="' + getValue("file") + '"' + tableOptions + ', '); // doing row names (what a pity...)
+ if (getValue("rowname")!="NULL") {
+ echo ("row.names = ");
+ if (getValue("rowname")=="rowcol") echo (echo (getValue("nomrow")) + ",");
+ else echo (getValue("rownames") + ",");
+ }
+ // doing col names (what a pity...)
+ if (getValue("colname") == "custoCol") echo ( "col.names = " + getValue ("colnames") + ",");
+ // doing col class (what a pity...)
+ if (getValue("colclass") == "custoClass") echo( "colClasses = " + getValue ("custoClasses") + ",");
+ //doing what is left
+ echo (' na.strings = "' + getValue("na")) echo ('", nrows = ' + getValue("nrows") + ', skip = ' + getValue("skip") + ', check.names = ' + getValue("checkname") + ', strip.white = ' + getValue("stripwhite") + ', blank.lines.skip = ' + getValue("blanklinesskip") + getValue("allow_escapes") + getValue("flush") + getValue("strings_as_factors") + ')\n');
+ echo ('\n');
+ echo ('# copy from the local environment to globalenv()\n');
+ echo ('assign("' + getValue("name") + '", imported, envir=globalenv())\n');
+ if (getValue ("doedit")) {
+ echo ('\n');
+ echo ('rk.edit (' + getValue ("name") + ')\n');
+ }
+}
+
+function printout () {
+ makeHeaderCode ("Import text / csv data", new Array("File" , getValue ("file"), "Import as" , getValue ("name")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/import/import_spss.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/import/import_spss.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,85 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require (foreign)\n');
+ if (getValue ("do_locale_conversion")) {
+ echo ('\n');
+ echo ('# helper function to convert all strings to the current encoding\n');
+ echo ('iconv.recursive <- function (x, from) {\n');
+ echo (' attribs <- attributes (x);\n');
+ echo (' if (is.character (x)) {\n');
+ echo (' x <- iconv (x, from=from, to="", sub="")\n');
+ echo (' } else if (is.list (x)) {\n');
+ echo (' x <- lapply (x, function (sub) iconv.recursive (sub, from))\n');
+ echo (' }\n');
+ echo (' # convert factor levels and all other attributes\n');
+ echo (' attributes (x) <- lapply (attribs, function (sub) iconv.recursive (sub, from))\n');
+ echo (' x\n');
+ echo ('}\n');
+ }
+}
+
+function calculate () {
+ var data_frame = "";
+ var data_frame_opt = "";
+ var labels_opt = "";
+ var object = "";
+ var from_locale = "";
+ if (getValue ("data_frame")) {
+ data_frame = true;
+ data_frame_opt = ", to.data.frame=TRUE";
+ }
+
+ if (getValue ("use_labels")) {
+ labels_opt += ", max.value.labels=" + getValue ("labels_limit");
+ if (getValue ("trim_labels")) labels_opt += ", trim.factor.names=TRUE";
+ } else {
+ labels_opt = ", use.value.labels=FALSE";
+ }
+
+ object = getValue ("saveto");
+
+ echo ('data <- read.spss ("' + getValue ("file") + '"' + data_frame_opt + labels_opt + ')\n');
+ if (getValue ("do_locale_conversion")) {
+ from_locale = getValue ("encoding");
+ if (from_locale == "other") {
+ from_locale = getValue ("user_encoding");
+ }
+ echo ('\n');
+ echo ('# convert all strings to the current encoding\n');
+ echo ('data <- iconv.recursive (data, from="' + from_locale + '")\n');
+ }
+ if (getValue ("convert_var_labels")) {
+ echo ('\n');
+ echo ('# set variable labels for use in RKWard\n');
+ echo ('labels <- attr (data, "variable.labels");\n');
+ echo ('if (!is.null (labels)) {\n');
+ echo (' for (i in 1:length (labels)) {\n');
+ echo (' col <- make.names (names (labels[i]))\n');
+ echo (' if (!is.null (col)) {\n');
+ echo (' rk.set.label (data[[col]], labels[i])\n');
+ echo (' }\n');
+ echo (' }\n');
+ echo ('}\n');
+ }
+ echo ('\n');
+ echo (object + ' <<- data # assign to globalenv()\n');
+ if (getValue ("doedit") && data_frame) {
+ echo ('rk.edit (' + object + ')\n');
+ }
+}
+
+function printout () {
+ makeHeaderCode ("Import SPSS data", new Array("File" , getValue ("file"), "Import as" , getValue ("saveto")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/import/import_stata.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/import/import_stata.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_stata.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_stata.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,69 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require (foreign)\n');
+}
+
+function calculate () {
+ var options = "";
+ var object = "";
+ options = "";
+
+ if (getValue ("convert_dates")) {
+ options += ", convert.dates=TRUE" ;
+ } else {
+ options += ", convert.dates=FALSE" ;
+ }
+
+ if (getValue ("convert_factors")) {
+ options += ", convert.factors=TRUE" ;
+ } else {
+ options += ", convert.factors=FALSE" ;
+ }
+
+ if (getValue ("missing_type")) {
+ options += ", missing.type=TRUE" ;
+ } else {
+ options += ", missing.type=FALSE" ;
+ }
+
+ if (getValue ("convert_underscore")) {
+ options += ", convert.underscore=TRUE" ;
+ } else {
+ options += ", convert.underscore=FALSE" ;
+ }
+
+ object = getValue ("saveto");
+
+ echo ('data <- read.dta ("' + getValue ("file") + '"' + options + ')\n');
+ echo ('\n');
+ echo ('# set variable labels for use in RKWard\n');
+ echo ('labels <- attr (data, "var.labels")\n');
+ echo ('if (!is.null (labels)) {\n');
+ echo (' for (i in 1:length (labels)) {\n');
+ echo (' col <- make.names (attr (data, "names")[i] )\n');
+ echo (' if (!is.null (col)) {\n');
+ echo (' rk.set.label (data[[col]], labels[i])\n');
+ echo (' }\n');
+ echo (' }\n');
+ echo ('}\n');
+ echo ('\n');
+ echo (object + ' <<- data # assign to globalenv()\n');
+ if (getValue ("doedit") ) {
+ echo ('rk.edit (' + object + ')\n');
+ }
+}
+
+function printout () {
+ makeHeaderCode ("Import Stata File", new Array("File" , getValue ("file"), "Imported to" , getValue ("saveto")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/import/load_data.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/import/load_data.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,33 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+
+---------------------------- */
+
+// globals
+var envir;
+var undefined;
+
+
+function calculate () {
+ var other_env = "";
+ if (getValue ("other_env")) {
+ other_env = true;
+ envir = getValue ("envir");
+ } else {
+ envir = "globalenv()";
+ }
+
+ if (other_env) {
+ echo ('assign ("' + envir + ', new.env (parent=globalenv()), envir=globalenv())\n');
+ }
+ echo ('load (file="' + getValue("file") + '", envir=' + envir + ')\n');
+}
+
+function printout () {
+ makeHeaderCode ("Load data", new Array("File" , getValue ("file"), "Import to environment" , envir));
+}
+
+
Copied: trunk/rkward/rkward/plugins/00saveload/import/source.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/import/source.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,37 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var options = "";
+ var prompt = "";
+ // most options should only be shown, if they differ from the default.
+ options = "";
+ if (getValue ("echo")) {
+ options += ", echo=TRUE";
+ prompt = getValue ("promptecho");
+ if (!empty (prompt)) {
+ options += ", prompt.echo=\"" + prompt + "\"";
+ }
+ options += ", max.deparse.length=" + getValue ("maxdeparselength");
+ options += ", verbose=" + getValue ("verbose");
+ } else {
+ options += ", verbose=FALSE";
+ }
+ options += ", print.eval=" + getValue ("printeval");
+
+ echo ('source (file="' + getValue("file") + '", local=' + getValue("local") + options + ', chdir=' + getValue("chdir") + ')\n');
+}
+
+function printout () {
+ makeHeadercode ("Source R file", new Array("File" , getValue ("file")));
+}
+
+
Copied: trunk/rkward/rkward/plugins/00saveload/save/save/code.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/save/save/code.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/save/code.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/save/code.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,23 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+
+---------------------------- */
+
+// globals
+var vars;
+var undefined;
+
+
+function calculate () {
+ vars = str_replace ("\n", ",", trim (getValue ("data")));
+
+ echo ('save (' + vars + ', file="' + getValue("file") + '", ascii=' + getValue("ascii") + ', compress=' + getValue("compress") + ')\n');
+}
+
+function printout () {
+ makeHeaderCode ("Save R objects", new Array("File" , getValue ("file"), "Variables" , vars));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,23 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var vars = "";
+ vars = str_replace ("\n", "','", trim (getValue ("data"))) ;
+
+ echo ('package.skeleton(name="' + getValue("name") + '", list=c(\'' + vars + '\'), path="' + getValue("path") + '", force= ' + getValue("force") + ')\n');
+}
+
+function printout () {
+ makeHeaderCode ("Create package skeleton", new Array("Name" , getValue ("name"), "Directory" , getValue ("path")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/save/write.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/save/write.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,28 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var sep = "";
+ sep = getValue ("sep");
+ if (sep == "other") sep = getValue ("custom_sep");
+ if (sep == " ") sep = "";
+ else sep = ", sep=" + quote (sep);
+
+ echo ('write (x=' + getValue("data") + ', file="' + getValue("file") + '", ncolumns=' + getValue("ncolumns") + ', append=' + getValue("append") + sep + ')\n');
+}
+
+function printout () {
+ makeHeaderCode ("Write Variables", new Array("File" , getValue ("file"), "Data" , getValue ("data")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/save/write_table.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/save/write_table.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write_table.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/write_table.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,26 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Warning: please check correctness of conversion of '=>' in arrays by hand
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ echo ('write.table ( x = ' + getValue("data") + ' , file = "' + getValue("file") + '" , append = ' + getValue("append") + ' ,quote = ' + getValue("quote")) echo (' , sep = ' + getValue("sep")) echo (' , eol = "' + getValue("eol")) echo ('" , na = "' + getValue("na")) echo ('" , dec = ' + getValue("dec")) echo (' , row.names = ');
+ if (getValue("rows") == "custoRow") echo (getValue("rownames")) ;
+ else echo (getValue("rows") + ' , col.names = ');
+ if (getValue("columns") == "custoCol") echo (getValue("colnames")) ;
+ else echo (getValue("columns") + ' , qmethod= ' + getValue("qmethod") + ' ) \n');
+}
+
+function printout () {
+ makeHeaderCode ("Write as table", new Array("File" , getValue ("file"), "Data" , getValue ("data")));
+}
+
Copied: trunk/rkward/rkward/plugins/00saveload/setworkdir.js (from rev 2722, trunk/rkward/rkward/plugins/00saveload/setworkdir.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/setworkdir.js (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/setworkdir.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,17 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var dir = "";
+ dir = getValue ("dir");
+
+ echo ('setwd("' + dir + '")\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,44 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+
+
+ echo ('objects <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (objects)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
+ echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ if (getValue ("length")) {
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ echo ('\n');
+ }
+ if (getValue ("narm")) {
+ echo (' var <- var[!is.na (var)] # remove NAs\n');
+ }
+ echo (' try ({\n');
+ echo (' test <- PP.test (var, lshort = ' + getValue ("lshort") + ')\n');
+ echo (' results[i, \'Dickey-Fuller\'] <- test$statistic\n');
+ echo (' results[i, \'Truncation lag parameter\'] <- test$parameter\n');
+ echo (' results[i, \'p-value\'] <- test$p.value\n');
+ echo (' })\n');
+ echo ('}\n');
+}
+
+function printout () {
+ echo ('rk.header ("Phillips-Perron Test for Unit Roots",\n');
+ echo (' parameters=list ("Truncation lag parameter short (\'TRUE\') or long (\'FALSE\')", "' + getValue ("lshort") + '"))\n');
+ echo ('\n');
+ echo ('rk.results (results)\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/TESTS/mood_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/TESTS/mood_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/mood_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/mood_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,26 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ echo ('result <- mood.test (' + getValue ("x") + ', ' + getValue ("y") + ', alternative = "' + getValue ("alternative") + '")\n');
+}
+
+function printout () {
+ echo ('names <- rk.get.description (' + getValue ("x") + ', ' + getValue ("y") + ')\n');
+ echo ('\n');
+ echo ('rk.header (result$method,\n');
+ echo (' parameters=list ("Alternative Hypothesis", rk.describe.alternative (result)))\n');
+ echo ('\n');
+ echo ('rk.results (list (\n');
+ echo (' \'Variables\'=names,\n');
+ echo (' \'Z\'=result$statistic,\n');
+ echo (' \'p-value\'=result$p.value))\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,60 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(exactRankTests)\n');
+ echo ('\n');
+ echo ('names <- rk.get.description (' + getValue ("x") + ', ' + getValue ("y") + ')\n');
+}
+
+function calculate () {
+ var exact_setting = "";
+ var exact_opt = "";
+ var conflevel = "";
+ var conflevel_opt = "";
+ exact_setting = getValue ("exact");
+ if (exact_setting == "yes") {
+ exact_opt = ", exact=TRUE";
+ } else if (exact_setting == "no") {
+ exact_opt = ", exact=FALSE";
+ }
+ if (getValue ("confint") == "TRUE") {
+ if ((conflevel = getValue("conflevel")) != "0.95") conflevel_opt = ", conf.level=" + conflevel;
+ }
+
+ echo ('result <- ansari.exact (' + getValue ("x") + ', ' + getValue ("y") + ', alternative = "' + getValue ("alternative") + '"' + exact_opt + ', conf.int = ' + getValue ("confint") + conflevel_opt + ')\n');
+ echo ('\n');
+}
+
+function printout () {
+ echo ('rk.header (result$method,\n');
+ echo (' parameters=list ("Comparing", paste (names[1], "against", names[2]),\n');
+ echo (' \'H1\', rk.describe.alternative (result),\n');
+ echo (' "Compute exact p-value", "' + getValue ("exact") + '"');
+ if (getValue ("confint")== "TRUE") {
+ echo (',\n');
+ echo (' "Confidence Level", "' + getValue ("conflevel") + '" ');
+ }
+ echo ('))\n');
+ echo ('\n');
+ echo ('rk.results (list (\n');
+ echo (' \'Variable Names\'=names,\n');
+ echo (' \'statistic\'=result$statistic,\n');
+ echo (' \'null.value\'=result$null.value,\n');
+ echo (' p=result$p.value');
+ if (getValue ("confint")== "TRUE") {
+ echo (',\n');
+ echo (' \'confidence interval percent\'=(100 * attr(result$conf.int, "conf.level")),\n');
+ echo (' \'confidence interval of difference\'=result$conf.int,\n');
+ echo (' \'estimate of the ratio of scales\'=result$estimate');
+ }
+ echo ('))\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,59 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('names <- rk.get.description (' + getValue ("x") + ', ' + getValue ("y") + ')\n');
+}
+
+function calculate () {
+ var exact_setting = "";
+ var exact_opt = "";
+ var conflevel = "";
+ var conflevel_opt = "";
+ exact_setting = getValue ("exact");
+ if (exact_setting == "yes") {
+ exact_opt = ", exact=TRUE";
+ } else if (exact_setting == "no") {
+ exact_opt = ", exact=FALSE";
+ }
+ if (getValue ("confint") == "TRUE") {
+ if ((conflevel = getValue("conflevel")) != "0.95") conflevel_opt = ", conf.level=" + conflevel;
+ }
+
+ echo ('result <- ansari.test (' + getValue ("x") + ', ' + getValue ("y") + ', alternative = "' + getValue ("alternative") + '"' + exact_opt + ', conf.int = ' + getValue ("confint") + conflevel_opt + ')\n');
+ echo ('\n');
+}
+
+function printout () {
+ echo ('rk.header (result$method,\n');
+ echo (' parameters=list (\n');
+ echo (' "Comparing", paste (names[1], "against", names[2]),\n');
+ echo (' "Alternative Hypothesis", rk.describe.alternative(result),\n');
+ echo (' "Compute exact p-value", "' + getValue ("exact") + '"');
+ if (getValue ("confint")== "TRUE") {
+ echo (',\n');
+ echo (' "Confidence Level", "' + getValue ("conflevel") + '" ');
+ }
+ echo ('))\n');
+ echo ('\n');
+ echo ('rk.results (list (\n');
+ echo (' \'Variable Names\'=names,\n');
+ echo (' \'statistic\'=result$statistic,\n');
+ echo (' \'null.value\'=result$null.value,\n');
+ echo (' p=result$p.value');
+ if (getValue ("confint")== "TRUE") {
+ echo (',\n');
+ echo (' \'confidence interval percent\'=(100 * attr(result$conf.int, "conf.level")),\n');
+ echo (' \'confidence interval of difference\'=result$conf.int,\n');
+ echo (' \'estimate of the ratio of scales\'=result$estimate');
+ }
+ echo ('))\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/corr_matrix.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/corr_matrix.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,70 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var use;
+var method;
+var do_p;
+var undefined;
+
+
+function calculate () {
+ var vars = "";
+ var exclude_whole = "";
+ do_p = getValue ("do_p");
+
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ use = getValue ("use");
+ if (use == "pairwise") {
+ exclude_whole = false;
+ use = "\"pairwise.complete.obs\"";
+ } else {
+ exclude_whole = true;
+ use = "\"complete.obs\"";
+ }
+ method = "\"" + getValue ("method") + "\"";
+
+ echo ('objects <- list (' + vars + ')\n');
+ echo ('\n');
+ echo ('# cor requires all objects to be inside the same data.frame.\n');
+ echo ('# Here we construct such a temporary frame from the input variables\n');
+ echo ('data <- data.frame (lapply (objects, function (x) eval (x, envir=globalenv ())))\n');
+ echo ('\n');
+ echo ('# calculate correlation matrix\n');
+ echo ('result <- cor (data, use=' + use + ', method=' + method + ')\n');
+ if (do_p) {
+ echo ('# calculate matrix of probabilities\n');
+ echo ('result.p <- matrix (nrow = length (data), ncol = length (data))\n');
+ if (exclude_whole) {
+ echo ('# as we need to do pairwise comparisons for technical reasons,\n');
+ echo ('# we need to exclude incomplete cases first to match the use="complete.obs" parameter to cor()\n');
+ echo ('data <- data[complete.cases (data),]\n');
+ }
+ echo ('for (i in 1:length (data)) {\n');
+ echo (' for (j in i:length (data)) {\n');
+ echo (' if (i != j) {\n');
+ echo (' t <- cor.test (data[[i]], data[[j]], method=' + method + ')\n');
+ echo (' result.p[i, j] <- t$p.value\n');
+ echo (' result.p[j, i] <- sum (complete.cases (data[[i]], data[[j]]))\n');
+ echo (' }\n');
+ echo (' }\n');
+ echo ('}\n');
+ }
+}
+
+function printout () {
+ echo ('rk.header ("Correlation Matrix", parameters=list ("Method", ' + method + ', "Exclusion", ' + use + '))\n');
+ echo ('\n');
+ echo ('result <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result))\n');
+ echo ('rk.results (result, titles=c (\'Coefficient\', sapply (objects, rk.get.short.name)))\n');
+ echo ('\n');
+ if (do_p) {
+ echo ('result.p <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result.p))\n');
+ echo ('rk.results (result.p, titles=c (\'n \\\\ p\', sapply (objects, rk.get.short.name)))\n');
+ }
+}
+
+
Copied: trunk/rkward/rkward/plugins/analysis/crosstab.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/crosstab.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/crosstab.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/crosstab.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,85 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+
+function calculate () {
+ var x = "";
+ var y = "";
+ x = getValue ("x") ;
+ y = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("y"))) + ")";
+
+ echo ('x <- ' + x + "\n");
+ echo ('yvars <- list (' + y + ')\n');
+ echo ('results <- list()\n');
+ echo ('descriptions <- list ()\n');
+ echo ('\n');
+ echo ('# calculate crosstabs\n');
+ echo ('for (i in 1:length (yvars)) {\n');
+ echo (' yvar <- eval (yvars[[i]], envir=globalenv ())\n');
+ echo (' results[[i]] <- table(x, yvar)\n');
+ echo ('\n');
+ echo (' descriptions[[i]] <- list (\'Dependent\'=rk.get.description (' + x + '), \'Independent\'=rk.get.description (yvars[[i]], is.substitute=TRUE))\n');
+ echo ('}\n');
+ if (getValue ("chisq") == "TRUE") {
+ echo ('\n');
+ echo ('# calculate chisquares\n');
+ echo ('chisquares <- list ()\n');
+ echo ('for (i in 1:length (results)) {\n');
+ echo (' chisquares[[i]] <- chisq.test (results[[i]], simulate.p.value = ' + getValue ("simpv"));
+ if (getValue ("simpv") == "TRUE") {
+ echo (',B=(');
+ echo (getValue ("B"));
+ echo (') ');
+ }
+ echo (')\n');
+ echo ('}\n');
+ }
+
+}
+
+function printout () {
+ doPrintout (true);
+}
+
+function preview () {
+ preprocess ();
+ calculate ();
+ doPrintout (false);
+}
+
+function doPrintout (final) {
+ if (final) {
+ echo ('rk.header ("Crosstabs (n to 1)", level=1)\n');
+ echo ('for (i in 1:length (results)) {\n');
+ echo (' rk.header ("Crosstabs (n to 1)", parameters=list ("Dependent", descriptions[[i]][[\'Dependent\']], "Independent", descriptions[[i]][[\'Independent\']]), level=2)\n');
+ echo (' rk.results (results[[i]], titles=c(descriptions[[i]][[\'Dependent\']], descriptions[[i]][[\'Independent\']]))\n');
+ if (getValue ("chisq") == "TRUE") {
+ echo ('\n');
+ echo (' rk.header ("Pearson\'s Chi Square Test for Crosstabs", list ("Dependent", descriptions[[i]][[\'Dependent\']], "Independent", descriptions[[i]][[\'Independent\']], "Method", chisquares[[i]][["method"]]), level=2)\n');
+ echo (' rk.results (list (\'Statistic\'=chisquares[[i]][[\'statistic\']], \'df\'=chisquares[[i]][[\'parameter\']], \'p\'=chisquares[[i]][[\'p.value\']]))\n');
+ }
+
+ if (getValue ("barplot") == "TRUE") {
+ echo ('\n');
+ echo (' rk.header ("Barplot for Crosstabs", list ("Dependent", descriptions[[i]][[\'Dependent\']], "Independent", descriptions[[i]][[\'Independent\']]' + getValue ('barplot_embed.code.preprocess') + '), level=2)\n');
+ echo (' rk.graph.on ()\n');
+ echo (' try ({\n');
+ printIndented ("\t\t", getValue ('barplot_embed.code.printout'));
+ echo (' })\n');
+ echo (' rk.graph.off ()\n');
+ }
+ echo ('}\n');
+ } else {
+ // produce a single barplot of the first result ?>
+ i <- 1
+ <? echo (getValue ('barplot_embed.code.printout'));
+ }
+
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/crosstab_multi.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/crosstab_multi.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/crosstab_multi.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/crosstab_multi.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,30 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ var vars = "";
+ vars = str_replace ("\n", ",", trim (getValue ("x"))) ;
+
+ echo ('data <- data.frame (' + vars + ', check.names=FALSE)\n');
+ echo ('datadescription <- paste (rk.get.description (' + vars + '), collapse=", ");\n');
+}
+
+function calculate () {
+ echo ('result <- ftable (data');
+ if (!getValue ("exclude_nas.state")) echo (", exclude=NULL");
+ echo (');\n');
+}
+
+function printout () {
+ echo ('rk.header ("Crosstabs (n to n)", parameters=list ("Variables"=datadescription))\n');
+ echo ('\n');
+ echo ('rk.print (result)\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_2pl.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_2pl.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_2pl.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_2pl.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,95 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var constraint = "";
+ var startval = "";
+ var startval_mtx = "";
+ var naaction = "";
+ var irtparam = "";
+ var optimeth = "";
+ var verbose = "";
+ var ghk_2pl = "";
+ var iterem = "";
+ var iterqn_2pl = "";
+ var interact = "";
+ var control = "";
+ // let's read all values into php variables for the sake of readable code
+ constraint = getValue("constraint");
+ startval = getValue("startval");
+ startval_mtx = getValue("startval_mtx");
+ naaction = getValue("naaction");
+ irtparam = getValue("irtparam");
+ optimeth = getValue("optimeth");
+ verbose = getValue("verbose");
+ // these are 2pl specific
+ ghk_2pl = getValue("ghk_2pl");
+ iterem = getValue("iterem");
+ iterqn_2pl = getValue("iterqn_2pl");
+ interact = getValue("interact");
+
+ ///////////////////////////////////
+ // check for selected advanced control options
+ control = new Array) ;
+ if (iterem != "40")
+ control[] = "iter.em="+iterem ;
+ if (iterqn_2pl != "150")
+ control[] = "iter.qN="+iterqn_2pl ;
+ if (ghk_2pl != "15")
+ control[] = "GHk="+ghk_2pl ;
+ if (optimeth != "BFGS")
+ control[] = "method=\""+optimeth+"\"" ;
+ if (verbose == "TRUE")
+ control[] ="verbose=TRUE" ;
+
+ echo ('estimates.2pl <- ltm(' + getValue("x") + ' ~ z1');
+ // any additional options?
+ if (interact == "TRUE") echo(" * z2");
+ if (constraint) echo(", constraint="+constraint);
+ if (irtparam != "TRUE") echo(", IRT.param=FALSE");
+ if (startval == "random") echo(", start.val=\"random\"");
+ if (startval == "matrix") echo(", start.val="+startval_mtx);
+ if (naaction) echo(", na.action="+naaction);
+ // finally check if any advanced control options must be inserted
+ if (control) echo(", control=list("+join(", ", control)+")");
+ echo (')\n');
+ }
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("2PL parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.2pl$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print (coef(estimates.2pl))\n');
+ echo ('rk.print (paste("Log-likelihood value at convergence:",round(estimates.2pl$log.Lik, digits=1)))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.2pl\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_3pl.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_3pl.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_3pl.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_3pl.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,104 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var constraint = "";
+ var startval = "";
+ var startval_mtx = "";
+ var naaction = "";
+ var irtparam = "";
+ var optimeth = "";
+ var verbose = "";
+ var ghk_3pl = "";
+ var iterqn_3pl = "";
+ var type = "";
+ var maxguess = "";
+ var optimizer = "";
+ var epshess = "";
+ var control = "";
+ // let's read all values into php variables for the sake of readable code
+ constraint = getValue("constraint");
+ startval = getValue("startval");
+ startval_mtx = getValue("startval_mtx");
+ naaction = getValue("naaction");
+ irtparam = getValue("irtparam");
+ optimeth = getValue("optimeth");
+ verbose = getValue("verbose");
+ // these are 3pl specific
+ ghk_3pl = getValue("ghk_3pl");
+ iterqn_3pl = getValue("iterqn_3pl");
+ type = getValue("type");
+ maxguess = getValue("maxguess");
+ optimizer = getValue("optimizer");
+ epshess = getValue("epshess");
+ // $parscale = getRK_val("parscale"); not implemented yet...
+
+ ///////////////////////////////////
+ // check for selected advanced control options
+ control = new Array) ;
+ if (optimizer != "optim")
+ control[] = "optimizer=\"nlminb\"" ;
+ if (iterqn_3pl != "1000")
+ control[] = "iter.qN="+iterqn_3pl ;
+ if (ghk_3pl != "21")
+ control[] = "GHk="+ghk_3pl ;
+ if (optimizer == "optim" && optimeth != "BFGS")
+ control[] = "method=\""+optimeth+"\"" ;
+ if (verbose == "TRUE")
+ control[] = "verbose=TRUE" ;
+ if (epshess != "1e-03")
+ control[] = "eps.hessian="+epshess ;
+
+ echo ('estimates.3pl <- tpm(' + getValue("x"));
+ // any additional options?
+ if (type == "rasch") echo(", type=\"rasch\"");
+ if (constraint) echo(", constraint="+constraint);
+ if (maxguess != "1") echo(", max.guessing="+maxguess);
+ if (irtparam != "TRUE") echo(", IRT.param=FALSE");
+ if (startval == "random") echo(", start.val=\"random\"");
+ if (startval == "matrix") echo(", start.val="+startval_mtx);
+ if (naaction) echo(", na.action="+naaction);
+ // finally check if any advanced control options must be inserted
+ if (control) echo(", control=list("+join(", ", control)+")");
+ echo (')\n');
+ }
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("3PL parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.3pl$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print (coef(estimates.3pl))\n');
+ echo ('rk.print (paste("Log-likelihood value at convergence:",round(estimates.3pl$log.Lik, digits=1)))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.3pl\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_lltm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_lltm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_lltm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_lltm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,73 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var mpoints = "";
+ var groups = "";
+ var group_vec = "";
+ var design = "";
+ var design_mtx = "";
+ var etastart = "";
+ var etastart_vec = "";
+ var stderr = "";
+ var sumnull = "";
+ // let's read all values into php variables for the sake of readable code
+ mpoints = getValue("mpoints");
+ groups = getValue("groups");
+ group_vec = getValue("group_vec");
+ design = getValue("design");
+ design_mtx = getValue("design_mtx");
+ etastart = getValue("etastart");
+ etastart_vec = getValue("etastart_vec");
+ stderr = getValue("stderr");
+ sumnull = getValue("sumnull");
+
+ echo ('estimates.lltm <- LLTM(' + getValue("x"));
+ // any additional options?
+ if (design == "matrix") echo(", W="+design_mtx);
+ if (mpoints > 1) echo(", mpoints="+mpoints);
+ if (groups == "contrasts") echo(", groupvec="+group_vec);
+ if (stderr != "se") echo(", se=FALSE");
+ if (sumnull != "sum0") echo(", sum0=FALSE");
+ if (etastart == "startval") echo(", etaStart="+etastart_vec);
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("LLTM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.lltm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print(t(rbind(Eta=estimates.lltm$etapar,StdErr=estimates.lltm$se.eta)))\n');
+ echo ('rk.print (paste("Conditional log-likelihood:",round(estimates.lltm$loglik, digits=1),\n');
+ echo ('"<br />Number of iterations:",estimates.lltm$iter,"<br />Number of parameters:",estimates.lltm$npar))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.lltm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_rasch.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_rasch.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_rasch.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/dichotomous/par_est_rasch.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,89 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var constraint = "";
+ var startval = "";
+ var startval_mtx = "";
+ var naaction = "";
+ var irtparam = "";
+ var optimeth = "";
+ var verbose = "";
+ var ghk_rasch = "";
+ var iterqn_rasch = "";
+ var control = "";
+ // let's read all values into php variables for the sake of readable code
+ constraint = getValue("constraint");
+ startval = getValue("startval");
+ startval_mtx = getValue("startval_mtx");
+ naaction = getValue("naaction");
+ irtparam = getValue("irtparam");
+ optimeth = getValue("optimeth");
+ verbose = getValue("verbose");
+ // these are rasch specific
+ ghk_rasch = getValue("ghk_rasch");
+ iterqn_rasch = getValue("iterqn_rasch");
+
+ ///////////////////////////////////
+ // check for selected advanced control options
+ control = new Array) ;
+ if (iterqn_rasch != "150")
+ control[] = "iter.qN="+iterqn_rasch ;
+ if (ghk_rasch != "21")
+ control[] = "GHk="+ghk_rasch ;
+ if (optimeth != "BFGS")
+ control[] = "method=\""+optimeth+"\"" ;
+ if (verbose == "TRUE")
+ control[] = "verbose=TRUE" ;
+
+ echo ('estimates.rasch <- rasch(' + getValue("x"));
+ // any additional options?
+ if (constraint) echo(", constraint="+constraint);
+ if (irtparam != "TRUE") echo(", IRT.param=FALSE");
+ if (startval == "random") echo(", start.val=\"random\"");
+ if (startval == "matrix") echo(", start.val="+startval_mtx);
+ if (naaction) echo(", na.action="+naaction);
+ // finally check if any advanced control options must be inserted
+ if (control) echo(", control=list("+join(", ", control)+")");
+ echo (')\n');
+ }
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ var irtparam = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+ irtparam = getValue("irtparam");
+
+ echo ('rk.header ("Rasch parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.rasch$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print (coef(estimates.rasch))\n');
+ echo ('rk.print (paste("Log-likelihood value at convergence:",round(estimates.rasch$log.Lik, digits=1)))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.rasch\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_gpcm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_gpcm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_gpcm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_gpcm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,115 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var data = "";
+ var chk_select = "";
+ var inp_items = "";
+ var constraint = "";
+ var startval = "";
+ var startval_lst = "";
+ var naaction = "";
+ var irtparam = "";
+ var optimeth = "";
+ var verbose = "";
+ var ghk_gpcm = "";
+ var iterqn_gpcm = "";
+ var optimizer = "";
+ var numrderiv = "";
+ var epshess = "";
+ var control = "";
+ // let's read all values into php variables for the sake of readable code
+ data = getValue("x");
+ chk_select = getValue("chk_select");
+ inp_items = getValue("inp_items");
+ // reformat $inp_items
+ if (inp_items)
+ inp_items = str_replace("\n", ", ", preg_replace("/(.+)\[\[(.+)\]\]/", "$2", inp_items));
+
+ constraint = getValue("constraint");
+ startval = getValue("startval");
+ startval_lst = getValue("startval_lst");
+ naaction = getValue("naaction");
+ irtparam = getValue("irtparam");
+ optimeth = getValue("optimeth");
+ verbose = getValue("verbose");
+ // these are gpcm specific
+ ghk_gpcm = getValue("ghk_gpcm");
+ iterqn_gpcm = getValue("iterqn_gpcm");
+ optimizer = getValue("optimizer");
+ numrderiv = getValue("numrderiv");
+ epshess = getValue("epshess");
+ // $parscale = getRK_val("parscale"); not implemented yet...
+
+ ///////////////////////////////////
+ // check for selected advanced control options
+ control = new Array) ;
+ if (iterqn_gpcm != "150")
+ control[] = "iter.qN="+iterqn_gpcm ;
+ if (ghk_gpcm != "21")
+ control[] = "GHk="+ghk_gpcm ;
+ if (optimizer != "optim")
+ control[] = "optimizer=\"nlminb\"" ;
+ if (optimizer == "optim" && optimeth != "BFGS")
+ control[] = "optimMethod=\""+optimeth+"\"" ;
+ if (numrderiv != "fd")
+ control[] = "numrDeriv=\"cd\"" ;
+ if (epshess != "1e-06")
+ control[] = "epsHes="+epshess ;
+ if (verbose == "TRUE")
+ control[] = "verbose=TRUE" ;
+
+ echo ('estimates.gpcm <- gpcm(');
+ if (data && chk_select && inp_items)
+ echo ("subset("+data+", select=c("+inp_items+"))");
+ else
+ echo (data);
+ // any additional options?
+ if (constraint != "gpcm") echo(", constraint=\""+constraint+"\"");
+ if (irtparam != "TRUE") echo(", IRT.param=FALSE");
+ if (startval == "list" && startval_lst) echo(", start.val="+startval_lst);
+ if (startval == "random") echo(", start.val=\"random\"");
+ if (naaction) echo(", na.action="+naaction);
+ // finally check if any advanced control options must be inserted
+ if (control) echo(", control=list("+join(", ", control)+")");
+ echo (')\n');
+ }
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("GPCM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.gpcm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print (coef(estimates.gpcm))\n');
+ echo ('rk.print (paste("Log-likelihood value at convergence:",round(estimates.gpcm$log.Lik, digits=1)))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.gpcm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_grm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_grm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_grm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_grm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,95 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var constraint = "";
+ var startval = "";
+ var startval_lst = "";
+ var hessian = "";
+ var naaction = "";
+ var irtparam = "";
+ var optimeth = "";
+ var verbose = "";
+ var ghk_grm = "";
+ var iterqn_grm = "";
+ var dig_abbrv = "";
+ var control = "";
+ // let's read all values into php variables for the sake of readable code
+ constraint = getValue("constraint");
+ startval = getValue("startval");
+ startval_lst = getValue("startval_lst");
+ hessian = getValue("hessian");
+ naaction = getValue("naaction");
+ irtparam = getValue("irtparam");
+ optimeth = getValue("optimeth");
+ verbose = getValue("verbose");
+ // these are grm specific
+ ghk_grm = getValue("ghk_grm");
+ iterqn_grm = getValue("iterqn_grm");
+ dig_abbrv = getValue("dig_abbrv");
+
+ ///////////////////////////////////
+ // check for selected advanced control options
+ control = new Array) ;
+ if (iterqn_grm != "150")
+ control[] = "iter.qN="+iterqn_grm ;
+ if (ghk_grm != "21")
+ control[] = "GHk="+ghk_grm ;
+ if (optimeth != "BFGS")
+ control[] = "method=\""+optimeth+"\"" ;
+ if (verbose == "TRUE")
+ control[] = "verbose=TRUE" ;
+ if (dig_abbrv != "6")
+ control[] = "digits.abbrv="+dig_abbrv ;
+
+ echo ('estimates.grm <- grm(' + getValue("x"));
+ // any additional options?
+ if (constraint == "const_discr") echo(", constrained=TRUE");
+ if (irtparam != "TRUE") echo(", IRT.param=FALSE");
+ if (hessian == "hessian") echo(", Hessian=TRUE");
+ if (startval == "random") echo(", start.val=\"random\"");
+ if (startval == "list") echo(", start.val="+startval_lst);
+ if (naaction) echo(", na.action="+naaction);
+ // finally check if any advanced control options must be inserted
+ if (control) echo(", control=list("+join(", ", control)+")");
+ echo (')\n');
+ }
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("GRM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.grm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print (coef(estimates.grm))\n');
+ echo ('rk.print (paste("Log-likelihood value at convergence:",round(estimates.grm$log.Lik, digits=1)))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.grm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lpcm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lpcm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lpcm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lpcm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,73 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var mpoints = "";
+ var groups = "";
+ var group_vec = "";
+ var design = "";
+ var design_mtx = "";
+ var etastart = "";
+ var etastart_vec = "";
+ var stderr = "";
+ var sumnull = "";
+ // let's read all values into php variables for the sake of readable code
+ mpoints = getValue("mpoints");
+ groups = getValue("groups");
+ group_vec = getValue("group_vec");
+ design = getValue("design");
+ design_mtx = getValue("design_mtx");
+ etastart = getValue("etastart");
+ etastart_vec = getValue("etastart_vec");
+ stderr = getValue("stderr");
+ sumnull = getValue("sumnull");
+
+ echo ('estimates.lpcm <- LPCM(' + getValue("x"));
+ // any additional options?
+ if (design == "matrix") echo(", W="+design_mtx);
+ if (mpoints > 1) echo(", mpoints="+mpoints);
+ if (groups == "contrasts") echo(", groupvec="+group_vec);
+ if (stderr != "se") echo(", se=FALSE");
+ if (sumnull != "sum0") echo(", sum0=FALSE");
+ if (etastart == "startval") echo(", etaStart="+etastart_vec);
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("LPCM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.lpcm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print(t(rbind(Eta=estimates.lpcm$etapar,StdErr=estimates.lpcm$se.eta)))\n');
+ echo ('rk.print (paste("Conditional log-likelihood:",round(estimates.lpcm$loglik, digits=1),\n');
+ echo ('"<br />Number of iterations:",estimates.lpcm$iter,"<br />Number of parameters:",estimates.lpcm$npar))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.lpcm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lrsm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lrsm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lrsm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_lrsm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,73 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var mpoints = "";
+ var groups = "";
+ var group_vec = "";
+ var design = "";
+ var design_mtx = "";
+ var etastart = "";
+ var etastart_vec = "";
+ var stderr = "";
+ var sumnull = "";
+ // let's read all values into php variables for the sake of readable code
+ mpoints = getValue("mpoints");
+ groups = getValue("groups");
+ group_vec = getValue("group_vec");
+ design = getValue("design");
+ design_mtx = getValue("design_mtx");
+ etastart = getValue("etastart");
+ etastart_vec = getValue("etastart_vec");
+ stderr = getValue("stderr");
+ sumnull = getValue("sumnull");
+
+ echo ('estimates.lrsm <- LRSM(' + getValue("x"));
+ // any additional options?
+ if (design == "matrix") echo(", W="+design_mtx);
+ if (mpoints > 1) echo(", mpoints="+mpoints);
+ if (groups == "contrasts") echo(", groupvec="+group_vec);
+ if (stderr != "se") echo(", se=FALSE");
+ if (sumnull != "sum0") echo(", sum0=FALSE");
+ if (etastart == "startval") echo(", etaStart="+etastart_vec);
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("LRSM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.lrsm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print(t(rbind(Eta=estimates.lrsm$etapar,StdErr=estimates.lrsm$se.eta)))\n');
+ echo ('rk.print (paste("Conditional log-likelihood:",round(estimates.lrsm$loglik, digits=1),\n');
+ echo ('"<br />Number of iterations:",estimates.lrsm$iter,"<br />Number of parameters:",estimates.lrsm$npar))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.lrsm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_pcm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_pcm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_pcm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_pcm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,63 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var design = "";
+ var design_mtx = "";
+ var etastart = "";
+ var etastart_vec = "";
+ var stderr = "";
+ var sumnull = "";
+ // let's read all values into php variables for the sake of readable code
+ design = getValue("design");
+ design_mtx = getValue("design_mtx");
+ etastart = getValue("etastart");
+ etastart_vec = getValue("etastart_vec");
+ stderr = getValue("stderr");
+ sumnull = getValue("sumnull");
+
+ echo ('estimates.pcm <- PCM(' + getValue("x"));
+ // any additional options?
+ if (design == "matrix") echo(", W="+design_mtx);
+ if (stderr != "se") echo(", se=FALSE");
+ if (sumnull != "sum0") echo(", sum0=FALSE");
+ if (etastart == "startval") echo(", etaStart="+etastart_vec);
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("PCM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.pcm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print(t(rbind(Eta=estimates.pcm$etapar,StdErr=estimates.pcm$se.eta)))\n');
+ echo ('rk.print (paste("Conditional log-likelihood:",round(estimates.pcm$loglik, digits=1),\n');
+ echo ('"<br />Number of iterations:",estimates.pcm$iter,"<br />Number of parameters:",estimates.pcm$npar))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.pcm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_rsm.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_rsm.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_rsm.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/polytomous/par_est_rsm.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,63 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var design = "";
+ var design_mtx = "";
+ var etastart = "";
+ var etastart_vec = "";
+ var stderr = "";
+ var sumnull = "";
+ // let's read all values into php variables for the sake of readable code
+ design = getValue("design");
+ design_mtx = getValue("design_mtx");
+ etastart = getValue("etastart");
+ etastart_vec = getValue("etastart_vec");
+ stderr = getValue("stderr");
+ sumnull = getValue("sumnull");
+
+ echo ('estimates.rsm <- RSM(' + getValue("x"));
+ // any additional options?
+ if (design == "matrix") echo(", W="+design_mtx);
+ if (stderr != "se") echo(", se=FALSE");
+ if (sumnull != "sum0") echo(", sum0=FALSE");
+ if (etastart == "startval") echo(", etaStart="+etastart_vec);
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ // check whether parameter estimations should be kept in the global enviroment
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("RSM parameter estimation")\n');
+ echo ('rk.print (paste("Call: <code>",deparse(estimates.rsm$call, width.cutoff=500),"</code>"))\n');
+ echo ('rk.print ("<h4>Coefficients:</h4>")\n');
+ echo ('rk.print(t(rbind(Eta=estimates.rsm$etapar,StdErr=estimates.rsm$se.eta)))\n');
+ echo ('rk.print (paste("Conditional log-likelihood:",round(estimates.rsm$loglik, digits=1),\n');
+ echo ('"<br />Number of iterations:",estimates.rsm$iter,"<br />Number of parameters:",estimates.rsm$npar))\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- estimates.rsm\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/eRm_waldtest.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/eRm_waldtest.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/eRm_waldtest.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/eRm_waldtest.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,35 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+
+ echo (' require(eRm)\n');
+}
+
+function calculate () {
+ var rad_splitcr = "";
+ var splitvector = "";
+ // let's read all values into php variables for the sake of readable code
+ rad_splitcr = getValue("rad_splitcr");
+ splitvector = getValue("splitvector");
+
+ echo ('waldtest.res <- Waldtest(' + getValue("x"));
+ // check if any advanced control options must be inserted
+ if (rad_splitcr == "mean") echo(", splitcr=\"mean\"") ;
+ if (rad_splitcr == "vector") echo(", splitcr="+splitvector) ;
+ echo (')\n');
+}
+
+function printout () {
+ echo ('rk.header ("Wald test (' + getValue("x") + ')")\n');
+ echo ('rk.print (waldtest.res)\n');
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_cronbach_alpha.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_cronbach_alpha.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_cronbach_alpha.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_cronbach_alpha.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,116 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Note: Control statement without braces. This is bad style.
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var data = "";
+ var chk_select = "";
+ var inp_items = "";
+ var spin_samples = "";
+ var chk_standard = "";
+ var chk_na = "";
+ var chk_bsci = "";
+ var spin_ci = "";
+ var options = "";
+ var cilo = "";
+ var cihi = "";
+ // let's read all values into php variables for the sake of readable code
+ data = getValue("x");
+ chk_select = getValue("chk_select");
+ inp_items = getValue("inp_items");
+ spin_samples = getValue("spin_samples");
+ chk_standard = getValue("chk_standard");
+ chk_na = getValue("chk_na");
+ chk_bsci = getValue("chk_bsci");
+ spin_ci = getValue("spin_ci");
+
+ // reformat $inp_items
+ if (inp_items)
+ inp_items = str_replace("\n", ", ", preg_replace("/(.+)\[\[(.+)\]\]/", "$2", inp_items));
+
+ ///////////////////////////////////
+ // check for selected options
+ options = new Array) ;
+ if (chk_standard == "standard")
+ options[] = "standardized=TRUE" ;
+ if (chk_bsci == "bsci")
+ options[] = "CI=TRUE" ;
+ if (spin_ci != ".95") {
+ cilo = (1-spin_ci)/2 ;
+ cihi = 1-cilo ;
+ options[] = "probs=c($cilo, $cihi)" ;
+ }
+ if (spin_samples != "1000")
+ options[] = "B=$spin_samples" ;
+ if (chk_na == "rm")
+ options[] = "na.rm=TRUE" ;
+
+
+ echo ('cronalpha.res <- cronbach.alpha(');
+ if (data && chk_select && inp_items)
+ echo ("subset("+data+", select=c("+inp_items+"))");
+ else
+ echo (data);
+ // check if any advanced control options must be inserted
+ if (options) echo(", "+join(", ", options));
+ echo (')\n');
+ echo ('descript.res <- descript(');
+ if (data && chk_select && inp_items)
+ echo ("subset("+data+", select=c("+inp_items+"))");
+ else
+ echo (data);
+ echo (', chi.squared=FALSE, B=' + spin_samples + ')\n');
+ }
+
+function printout () {
+ var chk_select = "";
+ var spin_samples = "";
+ var chk_standard = "";
+ var chk_na = "";
+ var chk_bsci = "";
+ var spin_ci = "";
+ var inp_items = "";
+ chk_select = getValue("chk_select");
+ spin_samples = getValue("spin_samples");
+ chk_standard = getValue("chk_standard");
+ chk_na = getValue("chk_na");
+ chk_bsci = getValue("chk_bsci");
+ spin_ci = getValue("spin_ci");
+ inp_items = getValue("inp_items");
+ // reformat $inp_items
+ if (inp_items)
+ inp_items = str_replace("\n", ", ", preg_replace("/(.+)\[\[\"(.+)\"\]\]/", "$2", inp_items));
+
+ echo ('rk.header ("Cronbach\'s alpha")\n');
+ echo ('rk.print("for the \'' + getValue("x") + '\' data-set');
+ if (chk_select && inp_items)
+ echo (" (subset: "+inp_items+")");
+ echo ('")\n');
+ echo ('rk.print(paste("Items:",cronalpha.res$p,"<br />Sample units:",cronalpha.res$n,"<br /><strong>alpha:",round(cronalpha.res$alpha, digits=2),"</strong>');
+ if (chk_standard) echo(" (standardized)");
+ echo ('"))\n');
+ echo ('rk.print("Effects on alpha if items are removed:")\n');
+ echo ('rk.print(descript.res$alpha)\n');
+ if (chk_bsci) {
+ echo ('rk.print("' + (spin_ci * 100)+"%" + ' Confidence interval:")\n');
+ echo ('rk.print(cronalpha.res$ci)\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_gof_rasch.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_gof_rasch.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_gof_rasch.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_gof_rasch.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,31 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var spin_samples = "";
+ // let's read all values into php variables for the sake of readable code
+ spin_samples = getValue("spin_samples");
+
+ echo ('GoFRasch.res <- GoF.rasch(' + getValue("x"));
+ // check if any advanced control options must be inserted
+ if (spin_samples != "49") echo(", B="+spin_samples);
+ echo (')\n');
+}
+
+function printout () {
+ echo ('rk.header ("Goodness of Fit for Rasch Models (' + getValue("x") + ')")\n');
+ echo ('rk.print (GoFRasch.res)\n');
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_item_fit.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_item_fit.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_item_fit.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_item_fit.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,54 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var spin_groups = "";
+ var drop_sumgroups = "";
+ var rad_pvalue = "";
+ var spin_mc = "";
+ var options = "";
+ // let's read all values into php variables for the sake of readable code
+ spin_groups = getValue("spin_groups");
+ drop_sumgroups = getValue("drop_sumgroups");
+ rad_pvalue = getValue("rad_pvalue");
+ spin_mc = getValue("spin_mc");
+
+ ///////////////////////////////////
+ // check for selected options
+ options = new Array) ;
+ if (spin_groups != "10")
+ options[] = "G=$spin_groups" ;
+ if (drop_sumgroups != "median")
+ options[] = "FUN=$drop_sumgroups" ;
+ if (rad_pvalue == "montecarlo")
+ options[] = "simulate.p.value=TRUE" ;
+ if (rad_pvalue == "montecarlo" && spin_mc != "100" )
+ options[] = "B=$spin_mc" ;
+
+
+ echo ('itemfit.res <- item.fit(' + getValue("x"));
+ // check if any advanced control options must be inserted
+ if (options) echo(", "+join(", ", options));
+ echo (')\n');
+ }
+
+function printout () {
+ echo ('rk.header ("Item-fit statistics (' + getValue("x") + ')")\n');
+ echo ('rk.print (itemfit.res)\n');
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_person_fit.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_person_fit.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_person_fit.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_person_fit.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,56 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var rad_hypot = "";
+ var rad_resppat = "";
+ var mtx_resppat = "";
+ var rad_pvalue = "";
+ var spin_mc = "";
+ var options = "";
+ // let's read all values into php variables for the sake of readable code
+ rad_hypot = getValue("rad_hypot");
+ rad_resppat = getValue("rad_resppat");
+ mtx_resppat = getValue("mtx_resppat");
+ rad_pvalue = getValue("rad_pvalue");
+ spin_mc = getValue("spin_mc");
+
+ ///////////////////////////////////
+ // check for selected options
+ options = new Array) ;
+ if (rad_hypot == "greater" || rad_hypot == "two.sided")
+ options[] = "alternative=\"$rad_hypot\"" ;
+ if (rad_resppat == "resp_matrix" && mtx_resppat)
+ options[] = "resp.patterns=$mtx_resppat" ;
+ if (rad_pvalue == "montecarlo")
+ options[] = "simulate.p.value=TRUE" ;
+ if (rad_pvalue == "montecarlo" && spin_mc != "1000" )
+ options[] = "B=$spin_mc" ;
+
+
+ echo ('personfit.res <- person.fit(' + getValue("x"));
+ // check if any advanced control options must be inserted
+ if (options) echo(", "+join(", ", options));
+ echo (')\n');
+ }
+
+function printout () {
+ echo ('rk.header ("Person-fit statistics (' + getValue("x") + ')")\n');
+ echo ('rk.print (personfit.res)\n');
+}
Copied: trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_unidimensional.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_unidimensional.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_unidimensional.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/irt/tests/ltm_unidimensional.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,43 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ // we'll need the ltm package, so in case it's not loaded...
+
+ echo (' require(ltm)\n');
+}
+
+function calculate () {
+ var spin_samples = "";
+ // let's read all values into php variables for the sake of readable code
+ spin_samples = getValue("spin_samples");
+
+ echo ('unidim.res <- unidimTest(' + getValue("x"));
+ // check if any options must be inserted
+ if (spin_samples != "100") echo(", B=$spin_samples") ;
+ echo (')\n');
+}
+
+function printout () {
+ var save = "";
+ var save_name = "";
+ save = getValue("chk_save");
+ save_name = getValue("save_name");
+
+ echo ('rk.header ("Unidimensionality check (' + getValue("x") + ')")\n');
+ echo ('rk.print (unidim.res)\n');
+// check if results are to be saved:
+ if (save && save_name) {
+
+ echo ('# keep results in current workspace\n');
+ echo (save_name + ' <<- unidim.res\n');
+ }
+}
Copied: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,52 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var alternative;
+var undefined;
+
+function preprocess () {
+ echo ('require(moments)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ alternative = getValue ("alternative");
+
+ echo ('\n');
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' # This is the core of the calculation\n');
+ echo (' t <- agostino.test (var, alternative = "' + alternative + '")\n');
+ echo (' results[i, \'skewness estimator (skew)\'] <- t$statistic["skew"]\n');
+ echo (' results[i, \'transformation (z)\'] <- t$statistic["z"]\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ if (getValue ("show_alternative")) {
+ echo (' results[i, \'Alternative Hypothesis\'] <- rk.describe.alternative (t)\n');
+ }
+ echo (' NA # no error\n');
+ echo (' }, error=function (e) e$message) # catch any errors\n');
+ if (getValue ("length")) {
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ }
+ echo ('}\n');
+ echo ('if (all (is.na (results$\'Error\'))) results$\'Error\' <- NULL\n');
+}
+
+function printout () {
+ echo ('rk.header ("D\'Agostino test of skewness",\n');
+ echo (' parameters=list ("Alternative Hypothesis", "' + alternative + '"))\n');
+ echo ('rk.results (results)\n');
+}
+
+
Copied: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,49 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var alternative;
+var undefined;
+
+function preprocess () {
+ echo ('require(moments)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ alternative = getValue ("alternative");
+
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' t <- anscombe.test (var, alternative = "' + alternative + '")\n');
+ echo (' results[i, \'Kurtosis estimator (tau)\'] <- t$statistic["kurt"]\n');
+ echo (' results[i, \'Transformation (z)\'] <- t$statistic["z"]\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ if (getValue ("show_alternative")) {
+ echo (' results[i, \'Alternative Hypothesis\'] <- rk.describe.alternative (t)\n');
+ }
+ echo (' NA # no error\n');
+ echo (' }, error=function (e) e$message) # catch any errors\n');
+ if (getValue ("length")) {
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ }
+ echo ('}\n');
+ echo ('if (all (is.na (results$\'Error\'))) results$\'Error\' <- NULL\n');
+}
+
+function printout () {
+ echo ('rk.header ("Anscombe-Glynn test of kurtosis",\n');
+ echo (' parameters=list ("Alternative Hypothesis", "' + alternative + '"))\n');
+ echo ('rk.results (results)\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,49 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var alternative;
+var undefined;
+
+function preprocess () {
+ echo ('require(moments)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ alternative = getValue ("alternative");
+
+ echo ('\n');
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' t <- bonett.test (var, alternative = "' + alternative + '")\n');
+ echo (' results[i, \'Kurtosis estimator (tau)\'] <- t$statistic["tau"]\n');
+ echo (' results[i, \'Transformation (z)\'] <- t$statistic["z"]\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ if (getValue ("show_alternative")) {
+ echo (' results[i, \'Alternative Hypothesis\'] <- rk.describe.alternative (t)\n');
+ }
+ echo (' NA # no error\n');
+ echo (' }, error=function (e) e$message) # catch any errors\n');
+ if (getValue ("length")) {
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- length (which(is.na(var)))\n');
+ }
+ echo ('}\n');
+ echo ('if (all (is.na (results$\'Error\'))) results$\'Error\' <- NULL\n');
+}
+
+function printout () {
+ echo ('rk.header ("Bonett-Seier test of Geary\'s kurtosis",\n');
+ echo (' parameters=list ("Alternative Hypothesis", "' + alternative + '"))\n');
+ echo ('rk.results (results)\n');
+}
Copied: trunk/rkward/rkward/plugins/analysis/moments/moment.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/moments/moment.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/moment.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/moments/moment.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,40 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(moments)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+
+
+ echo ('\n');
+ echo ('objects <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (objects)) {\n');
+ echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
+ echo ('\n');
+ echo (' try (results[i, \'Moment\'] <- moment (var, order = ' + getValue ("order") + ', central = ' + getValue ("central") + ', absolute = ' + getValue ("absolute") + ', na.rm = ' + getValue ("narm") + '))\n');
+ if (getValue ("length")) {
+ echo ('\n');
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ }
+ echo ('}\n');
+}
+
+function printout () {
+ echo ('rk.header ("Statistical Moment",\n');
+ echo (' parameters=list ("Order", "' + getValue ("order") + '", "Compute central moments", "' + getValue ("central") + '", "Compute absolute moments", "' + getValue ("absolute") + '", "Remove missing values", "' + getValue ("narm") + '"))\n');
+ echo ('rk.results (results)\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,52 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+Note: Control statement without braces. This is bad style.
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(moments)\n');
+}
+
+function calculate () {
+ var vars = "";
+ var narm = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ if (getValue ("narm")) narm = ", na.rm=TRUE";
+ else narm = ", na.rm=FALSE"
+
+
+ echo ('objects <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (objects)) {\n');
+ echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
+ echo ('\n');
+ echo (' try ({\n');
+ if (getValue ("skewness")) {
+ echo (' results[i, \'Skewness\'] <- skewness (var' + narm + ')\n');
+ }
+ if (getValue ("kurtosis")) {
+ echo (' results[i, \'Kurtosis\'] <- kurtosis (var' + narm + ')\n');
+ echo (' results[i, \'Excess Kurtosis\'] <- results[i, \'Kurtosis\'] - 3\n');
+ }
+ if (getValue ("geary")) {
+ echo (' results[i, \'Geary Kurtosis\'] <- geary (var' + narm + ')\n');
+ }
+ echo (' })\n');
+ if (getValue ("length")) {
+ echo ('\n');
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ }
+ echo ('}\n');
+}
+function printout () {
+ echo ('rk.header ("Skewness and Kurtosis")\n');
+ echo ('rk.results (results)\n');
+}
+
Copied: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,60 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(outliers)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+
+ echo ('\n');
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ if (getValue ("length")) {
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('\n');
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ echo ('\n');
+ echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
+ } else {
+ echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ }
+ echo ('\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' # This is the core of the calculation\n');
+ echo (' t <- chisq.out.test (var, opposite = ' + getValue ("opposite") + ')\n');
+ echo (' results[i, \'X-squared\'] <- t$statistic\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ echo (' results[i, \'Alternative Hypothesis\']<- rk.describe.alternative (t)\n');
+ echo (' results[i, \'Variance\'] <- var (var)\n');
+ if (getValue ("descriptives")) {
+ echo (' results[i, \'Mean\'] <- mean (var)\n');
+ echo (' results[i, \'Standard Deviation\'] <- sd (var)\n');
+ echo (' results[i, \'Median\'] <- median (var)\n');
+ echo (' results[i, \'Minimum\'] <- min (var)\n');
+ echo (' results[i, \'Maximum\'] <- max (var)\n');
+ }
+ echo (' NA # no error\n');
+ echo (' }, error=function (e) e$message) # catch any errors\n');
+ echo ('}\n');
+ echo ('if (all (is.na (results$\'Error\'))) results$\'Error\' <- NULL\n');
+}
+
+function printout () {
+ echo ('rk.header ("Chi-squared test for outlier",\n');
+ echo (' parameters=list ("Opposite", "' + getValue ("opposite") + '"))\n');
+ echo ('rk.results (results)\n');
+}
+
+
Copied: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,59 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(outliers)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+
+ echo ('\n');
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ if (getValue ("length")) {
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('\n');
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ echo ('\n');
+ echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
+ } else {
+ echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ }
+ echo ('\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' # This is the core of the calculation\n');
+ echo (' t <- dixon.test (var, type = ' + getValue ("type") + ', opposite = ' + getValue ("opposite") + ', two.sided = ' + getValue ("two_sided") + ')\n');
+ echo (' results[i, \'Dixon Q-statistic\'] <- t$statistic["Q"]\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ echo (' results[i, \'Alternative Hypothesis\']<- rk.describe.alternative (t)\n');
+ if (getValue ("descriptives")) {
+ echo (' results[i, \'Mean\'] <- mean (var)\n');
+ echo (' results[i, \'Standard Deviation\'] <- sd (var)\n');
+ echo (' results[i, \'Median\'] <- median (var)\n');
+ echo (' results[i, \'Minimum\'] <- min (var)\n');
+ echo (' results[i, \'Maximum\'] <- max (var)\n');
+ }
+ echo (' NA # no error\n');
+ echo (' }, error=function (e) e$message) # catch any errors\n');
+ echo ('}\n');
+ echo ('if (all (is.na (results$\'Error\'))) results$\'Error\' <- NULL\n');
+}
+
+function printout () {
+ echo ('rk.header ("Dixon test for outlier",\n');
+ echo (' parameters=list ("Type", "' + getValue ("type") + '", "Opposite", "' + getValue ("opposite") + '", "two-sided", "' + getValue ("two_sided") + '"))\n');
+ echo ('rk.results (results)\n');
+}
+
+
Copied: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js (from rev 2722, trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php)
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js 2009-12-07 10:46:07 UTC (rev 2723)
@@ -0,0 +1,60 @@
+/* ------- This file generated by php2js from PHP code. --------
+Please check this file by hand, and remove this notice, afterwards.
+Messages:
+
+---------------------------- */
+
+// globals
+var undefined;
+
+function preprocess () {
+ echo ('require(outliers)\n');
+}
+
+function calculate () {
+ var vars = "";
+ vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+
+ echo ('\n');
+ echo ('vars <- list (' + vars + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length(vars)) {\n');
+ echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ if (getValue ("length")) {
+ echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('\n');
+ echo (' results[i, \'Length\'] <- length (var)\n');
+ echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
+ echo ('\n');
+ echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
+ } else {
+ echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ }
+ echo ('\n');
+ echo (' results[i, \'Error\'] <- tryCatch ({\n');
+ echo (' # This is the core of the calculation\n');
+ echo (' t <- grubbs.test (var, type = ' + getValue ("type") + ', opposite = ' + getValue ("opposite") + ', two.sided = ' + getValue ("two_sided") + ')\n');
+ echo (' results[i, \'G\'] <- t$statistic["G"]\n');
+ echo (' results[i, \'U\'] <- t$statistic["U"]\n');
+ echo (' results[i, \'p-value\'] <- t$p.value\n');
+ echo (' results[i, \'Alternative Hypothesis\']<- rk.describe.alternative (t)\n');
+ if (getValue ("descriptives")) {
+ echo (' results[i, \'Mean\'] <- mean (var)\n');
@@ Diff output truncated at 100000 characters. @@
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