[rkward-cvs] SF.net SVN: rkward-code:[4840] trunk/rkward/rkward/plugins/analysis/ regression

tfry at users.sf.net tfry at users.sf.net
Sat Sep 20 15:42:40 UTC 2014


Revision: 4840
          http://sourceforge.net/p/rkward/code/4840
Author:   tfry
Date:     2014-09-20 15:42:39 +0000 (Sat, 20 Sep 2014)
Log Message:
-----------
Ok, also offer to save full lm-object.

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/regression/linear_regression.js
    trunk/rkward/rkward/plugins/analysis/regression/linear_regression.rkh
    trunk/rkward/rkward/plugins/analysis/regression/linear_regression.xml

Modified: trunk/rkward/rkward/plugins/analysis/regression/linear_regression.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/regression/linear_regression.js	2014-09-20 10:15:07 UTC (rev 4839)
+++ trunk/rkward/rkward/plugins/analysis/regression/linear_regression.js	2014-09-20 15:42:39 UTC (rev 4840)
@@ -3,9 +3,10 @@
 	var intercept = "";
 	if (!getBoolean ("intercept")) intercept = "0 + ";
 
+	var savemodel = getBoolean ("savemodel.active");
 	var savefitted = getBoolean ("savefitted.active");
 	var saveresiduals = getBoolean ("saveresiduals.active");
-	var simple_mode = !(savefitted || saveresiduals);
+	var simple_mode = !(savefitted || saveresiduals || savemodel);
 
 	model = 'lm (' + getValue ("y") + ' ~ ' + intercept + vars;
 	if (!simple_mode) model += ', na.action=na.exclude';	// default action of na.omit is a nuisance for fitted values
@@ -15,9 +16,10 @@
 		echo ('results <- summary.lm (' + model + ')\n');
 	} else {
 		echo ('model <- ' + model + '\n');
+		if (savemodel) echo ('.GlobalEnv$' + getString ('savemodel') + ' <- model\n');
 		if (savefitted) echo ('.GlobalEnv$' + getString ('savefitted') + ' <- fitted (model)\n');
 		if (saveresiduals) echo ('.GlobalEnv$' + getString ('saveresiduals') + ' <- residuals (model)\n');
-		echo ('results <- summary.lm (model)\n');
+		echo ('results <- summary (model)\n');
 	}
 }
 
@@ -25,4 +27,3 @@
 	echo ('rk.header ("Linear Regression")\n');
 	echo ('rk.print(results)\n');
 }
-

Modified: trunk/rkward/rkward/plugins/analysis/regression/linear_regression.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/regression/linear_regression.rkh	2014-09-20 10:15:07 UTC (rev 4839)
+++ trunk/rkward/rkward/plugins/analysis/regression/linear_regression.rkh	2014-09-20 15:42:39 UTC (rev 4840)
@@ -9,15 +9,19 @@
 	</usage>
 
 	<settings>
+		<caption id="tab_model"/>
 		<setting id="y">The dependent variable. This must be numeric.</setting>
 		<setting id="x">One or more independent variables, each of the same length as the dependent. Note that factor variables are treated as categorial predictors, while numeric variables are treated as continuous predictors, automatically.</setting>
 		<setting id="intercept">Should an intercept term be included in the model?</setting>
+		<caption id="tab_save"/>
+		<setting id="savemodel">Save the full fitted model.</setting>
 		<setting id="savefitted">Extract and save predicted values from the model.</setting>
 		<setting id="saveresiduals">Extract and save residuals from the model.</setting>
 	</settings>
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/lm"/></li>
+			<li><link href="rkward://rhelp/summary.lm"/></li>
 		</ul>
 	</related>
 </document>

Modified: trunk/rkward/rkward/plugins/analysis/regression/linear_regression.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/regression/linear_regression.xml	2014-09-20 10:15:07 UTC (rev 4839)
+++ trunk/rkward/rkward/plugins/analysis/regression/linear_regression.xml	2014-09-20 15:42:39 UTC (rev 4840)
@@ -3,18 +3,29 @@
 	<code file="linear_regression.js"/>
 	<help file="linear_regression.rkh"/>
 
-	<dialog label="Fitting Linear Models">
-		<row>
-			<varselector id="vars"/>
-			<column>
-				<varslot type="numeric" id="y" source="vars" required="true" label="dependent variable"/>
-				<varslot type="numeric" id="x" source="vars" required="true" multi="true" label="independent variables"/>
-				<checkbox id="intercept" label="include intercept" checked="true"/>
-				<stretch/>
-				<saveobject id="savefitted" label="Save fitted values" initial="lm_fitted" checkable="true"/>
-				<saveobject id="saveresiduals" label="Save residuals" initial="lm_residuals" checkable="true"/>
-			</column>
-		</row>
-	</dialog>
-	
+	<dialog label="Fitting Linear Models"><tabbook>
+		<tab id="tab_model" label="Model">
+			<row>
+				<varselector id="vars"/>
+				<column>
+					<varslot type="numeric" id="y" source="vars" required="true" label="dependent variable"/>
+					<varslot type="numeric" id="x" source="vars" required="true" multi="true" label="independent variables"/>
+					<checkbox id="intercept" label="include intercept" checked="true"/>
+					<stretch/>
+				</column>
+			</row>
+		</tab>
+		<tab id="tab_save" label="Save">
+			<row>
+				<column>
+					<saveobject id="savemodel" label="Save full fitted model" initial="lm_full" checkable="true"/>
+					<stretch/>
+				</column>
+				<column>
+					<saveobject id="savefitted" label="Save fitted values" initial="lm_fitted" checkable="true"/>
+					<saveobject id="saveresiduals" label="Save residuals" initial="lm_residuals" checkable="true"/>
+				</column>
+			</row>
+		</tab>
+	</tabbook></dialog>
 </document>





More information about the rkward-tracker mailing list