[rkward-cvs] rkward/rkward/plugins/uni1.2 code.php,1.3,1.4 description.xml,1.3,1.4

Thomas Friedrichsmeier tfry at users.sourceforge.net
Mon Mar 20 14:03:45 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/plugins/uni1.2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4705/rkward/plugins/uni1.2

Modified Files:
	code.php description.xml 
Log Message:
Ported old depends-statements

Index: description.xml
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/uni1.2/description.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** description.xml	11 Sep 2005 22:06:32 -0000	1.3
--- description.xml	20 Mar 2006 14:03:43 -0000	1.4
***************
*** 2,6 ****
  <!-- This is a simple example, of how a "plugin" might be configured. --><document>
  	<code file="code.php"/>
! 	
  	<dialog label="Basic statistics" >
  		<tabbook>
--- 2,22 ----
  <!-- This is a simple example, of how a "plugin" might be configured. --><document>
  	<code file="code.php"/>
! 	<logic>
! 		<connect client="constMad.enabled" governor="mad.state" />
! 		<connect client="pourcent.enabled" governor="trim.state" />
! 		<connect client="winsor.enabled" governor="huber.state" />
! 
! 		<connect client="customMu.enabled" governor="huber.state" />
! 		<convert id="mubox" mode="and" sources="customMu.state;customMu.enabled" />
! 		<connect client="mu.enabled" governor="mubox" />
! 
! 		<connect client="customS.enabled" governor="huber.state" />
! 		<convert id="sbox" mode="and" sources="customS.state;customS.enabled" />
! 		<connect client="s.enabled" governor="sbox" />
! 
! 		<connect client="tol.enabled" governor="huber.state" />
! 		<connect client="initmu.enabled" governor="huber.state" />
! 		<connect client="nom.enabled" governor="result.state" />
! 	</logic>
  	<dialog label="Basic statistics" >
  		<tabbook>
***************
*** 55,59 ****
  						<row>
  							<checkbox checked="false" value="1" id="mad" label="Median Absolute Deviation" />
! 							<input size="small" intial="1.4628" id="constMad" depend="mad" label="Constant" />
  						</row>
  					</frame>
--- 71,75 ----
  						<row>
  							<checkbox checked="false" value="1" id="mad" label="Median Absolute Deviation" />
! 							<input size="small" intial="1.4628" id="constMad" label="Constant" />
  						</row>
  					</frame>
***************
*** 61,65 ****
  						<row>
  							<checkbox checked="false" value="1" id="trim" label="Trimmed Mean" />
! 							<spinbox min="0" id="pourcent" initial="0.05" max="0.5" depend="trim" label="Percentage of trimmed values" />
  						</row>
  					</frame>
--- 77,81 ----
  						<row>
  							<checkbox checked="false" value="1" id="trim" label="Trimmed Mean" />
! 							<spinbox min="0" id="pourcent" initial="0.05" max="0.5" label="Percentage of trimmed values" />
  						</row>
  					</frame>
***************
*** 67,88 ****
  						<row>
  							<checkbox checked="false" value="1" id="huber" label="Huber -M estimator (Require MASS Library)" />
! 							<spinbox min="0" id="winsor" initial="1.5" max="10" depend="huber" label="Winsorize at 'k' sd" />
  						</row>
  						<row>
  							<column>
! 								<checkbox checked="false" value="1" id="customMu" depend="huber" label="Custom Mu value" />
! 								<input size="small" id="mu" depend="customMu" label="Enter your value" />
  							</column>
  							<column>
! 								<checkbox checked="false" value="1" id="customS" depend="huber" label="Custom s value" />
! 								<input size="small" id="s" depend="customS" label="S value" />
  							</column>
  						</row>
  						<row>
  							<column>
! 								<input size="small" intial="1e-6" id="tol" depend="huber" label="Tolerance" />
  							</column>
  							<column>
! 								<radio id="initmu" depend="huber" label="Initial value" >
  									<option value="median" label="Median" />
  									<option value="mean" label="Mean" />
--- 83,104 ----
  						<row>
  							<checkbox checked="false" value="1" id="huber" label="Huber -M estimator (Require MASS Library)" />
! 							<spinbox min="0" id="winsor" initial="1.5" max="10" label="Winsorize at 'k' sd" />
  						</row>
  						<row>
  							<column>
! 								<checkbox checked="false" value="1" id="customMu" label="Custom Mu value" />
! 								<input size="small" id="mu" label="Enter your value" />
  							</column>
  							<column>
! 								<checkbox checked="false" value="1" id="customS" label="Custom s value" />
! 								<input size="small" id="s" label="S value" />
  							</column>
  						</row>
  						<row>
  							<column>
! 								<input size="small" intial="1e-6" id="tol" label="Tolerance" />
  							</column>
  							<column>
! 								<radio id="initmu" label="Initial value" >
  									<option value="median" label="Median" />
  									<option value="mean" label="Mean" />
***************
*** 97,101 ****
  				<checkbox checked="false" value="1" id="option" label="Print options in output" />
  				<checkbox checked="false" value="1" id="result" label="Get the result in the console" />
! 				<input size="medium" intial="rk.univariate" id="nom" label="Name of the result" depend="result" />
  			</tab>
  		</tabbook>
--- 113,117 ----
  				<checkbox checked="false" value="1" id="option" label="Print options in output" />
  				<checkbox checked="false" value="1" id="result" label="Get the result in the console" />
! 				<input size="medium" intial="rk.univariate" id="nom" label="Name of the result" />
  			</tab>
  		</tabbook>

Index: code.php
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/uni1.2/code.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** code.php	23 Oct 2005 14:32:33 -0000	1.3
--- code.php	20 Mar 2006 14:03:43 -0000	1.4
***************
*** 12,57 ****
  	k <-  rk.get.description(rk.temp.var) 
  	rk.temp.var <- eval(rk.temp.var)
! 	rk.temp.res [[ k ]] <- list()
! 	<? if (getRK_val ("nombre")) echo "rk.temp.res [[ k ]][['Number of obs']] <- length(rk.temp.var)" ;  ?> 
! 	<? if (getRK_val ("nbna")) echo "rk.temp.res [[ k ]][['Number of missing values']] <- length(which(is.na(rk.temp.var)))" ;  ?> 
! 	<? if (getRK_val ("moyenne")) echo "rk.temp.res [[ k ]][['Mean']] <- mean(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?> 
! 	<? if (getRK_val ("vari")) echo "rk.temp.res [[ k ]][['Variance']] <- var(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?> 
! 	<? if (getRK_val ("ecartt")) echo "rk.temp.res [[ k ]][['Sd']] <- sd(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?> 
! 	<? if (getRK_val ("minimum")) echo "rk.temp.res [[ k ]][['Minimum']] <- min(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?>  
! 	<? if (getRK_val ("maximum")) echo "rk.temp.res [[ k ]][['Maximum']] <- max(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?> 
! 	<? if (($nmin = getRK_val ("nbminimum")) != "0") echo (" if ( length(rk.temp.var) >= " . $nmin .") {
  		rk.temp.res [[ k ]][['Minimum values']] <- list()
  		rk.temp.res [[ k ]][['Minimum values']][[1]] <- c(1:" . $nmin . ")
  		rk.temp.res [[ k ]][['Minimum values']][[2]] <- sort(rk.temp.var, decreasing=FALSE,na.last=TRUE) [1:" . $nmin  .   "]
! 		}"  ) ; ?> 
! 	<? if (($nmax = getRK_val ("nbmaximum")) != "0") echo (" if ( length(rk.temp.var) >= " . $nmax .") 
  		rk.temp.res [[ k ]][['Maximum values']] <- list()
  		rk.temp.res [[ k ]][['Maximum values']][[1]] <- c(1:" . $nmax . ")
! 		rk.temp.res [[ k ]][['Maximum values']][[2]] <- sort(rk.temp.var, decreasing=TRUE,na.last=TRUE) [1:" . $nmax  .   "]"  ) ; ?>  
! 	<? if (getRK_val ("mediane")) echo "rk.temp.res [[ k ]][['Median']] <- median(rk.temp.var,na.rm=".getRK_val("NA").")" ;  ?> 
! 	<? if (getRK_val ("irq")) echo "rk.temp.res [[ k ]][['Inter Quartile Range']] <- IQR(rk.temp.var,na.rm=".getRK_val("NA").")"; ?> 
! 	<? if (getRK_val ("quartile")) echo 
  		"rk.temp.res [[ k ]] [['Quartiles']]  <- list()
  		rk.temp.res [[ k ]] [['Quartiles']] [[2]]  <- quantile(rk.temp.var,na.rm=".getRK_val("NA").")
! 		rk.temp.res [[ k ]] [['Quartiles']] [[1]]  <- names(quantile(rk.temp.var,na.rm=".getRK_val("NA")."))"  ;  ?> 
! 	<? if (($nautre = getRK_val ("autre")) != "0") echo (" if ( length(rk.temp.var) >= " . $nautre .") {
  		rk.temp.res [[ k ]][['Other']] <- list()
  		rk.temp.res [[ k ]][['Other']][[1]] <- paste(seq(0,100,le=" . $nautre . "),'%')
  		rk.temp.res [[ k ]] [['Other']] [[2]]  <- quantile(rk.temp.var,probs=seq(0,1,le=" . $nautre . "), na.rm=".getRK_val("NA").")
! 		}"  ) ; ?> 
  	
  	#robust statistics
! 	<?  if (getRK_val ("trim") == "1") echo ("rk.temp.res [[ k ]][['Trimmed Mean']] <- mean(rk.temp.var,trim= ". getRK_val("pourcent") . " ,na.rm=".getRK_val("NA").")" ) ;?> 
! 	<?  if (getRK_val ("mad") == "1") echo ("rk.temp.res [[ k ]][['Median Absolute Deviation']] <-  mad(rk.temp.var, constant = ". getRK_val("constMad") . " ,na.rm=".getRK_val("NA").")" ) ;?> 
! 	<?  if (getRK_val ("huber") == "1") 
! 	echo ("
! 	require ("MASS")
! 	rk.temp.res [[ k ]][['Huber M-Estimator']] <- list()
! 	rk.temp.res [[ k ]][['Huber M-Estimator']] [[1]] <- c('Location Estimate','Mad scale estimate')
! 	rk.temp.res [[ k ]][['Huber M-Estimator']] [[2]] <- c(NA,NA)
! 	try(rk.temp.res [[ k ]][['Huber M-Estimator']] [[2]] <- hubers (rk.temp.var, k = " . getRK_val("winsor") . ",tol=".getRK_val("tol") );
  	if (getRK_val(customMu)=="1") echo (",mu=".getRK_val("mu")) ; 
  	if (getRK_val(customS)=="1") echo (",s=".getRK_val("s")) ;
! 	if (getRK_val ("huber") == "1") echo(",initmu =".getRK_val("initmu")."(rk.temp.var)))")
  	?>	
  	rm(k)
--- 12,67 ----
  	k <-  rk.get.description(rk.temp.var) 
  	rk.temp.var <- eval(rk.temp.var)
! 	rk.temp.res [[ k ]] <- list() 
! 	<? if (getRK_val ("nombre")) 
! 		echo "rk.temp.res [[ k ]][['Number of obs']] <- length(rk.temp.var)\n";
! 	if (getRK_val ("nbna")) 
! 		echo "rk.temp.res [[ k ]][['Number of missing values']] <- length(which(is.na(rk.temp.var)))\n" ;
! 	if (getRK_val ("moyenne")) 
! 		echo "rk.temp.res [[ k ]][['Mean']] <- mean(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (getRK_val ("vari")) 
! 		echo "rk.temp.res [[ k ]][['Variance']] <- var(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (getRK_val ("ecartt")) 
! 		echo "rk.temp.res [[ k ]][['Sd']] <- sd(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (getRK_val ("minimum")) 
! 		echo "rk.temp.res [[ k ]][['Minimum']] <- min(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (getRK_val ("maximum")) 
! 		echo "rk.temp.res [[ k ]][['Maximum']] <- max(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (($nmin = getRK_val ("nbminimum")) != "0") 
! 		echo (" if ( length(rk.temp.var) >= " . $nmin .") {
  		rk.temp.res [[ k ]][['Minimum values']] <- list()
  		rk.temp.res [[ k ]][['Minimum values']][[1]] <- c(1:" . $nmin . ")
  		rk.temp.res [[ k ]][['Minimum values']][[2]] <- sort(rk.temp.var, decreasing=FALSE,na.last=TRUE) [1:" . $nmin  .   "]
! 		}\n"  ) ;
! 	if (($nmax = getRK_val ("nbmaximum")) != "0") 
! 		echo (" if ( length(rk.temp.var) >= " . $nmax .") 
  		rk.temp.res [[ k ]][['Maximum values']] <- list()
  		rk.temp.res [[ k ]][['Maximum values']][[1]] <- c(1:" . $nmax . ")
! 		rk.temp.res [[ k ]][['Maximum values']][[2]] <- sort(rk.temp.var, decreasing=TRUE,na.last=TRUE) [1:" . $nmax  .   "]\n"  ) ;
! 	if (getRK_val ("mediane")) echo "rk.temp.res [[ k ]][['Median']] <- median(rk.temp.var,na.rm=".getRK_val("NA").")\n" ;
! 	if (getRK_val ("irq")) echo "rk.temp.res [[ k ]][['Inter Quartile Range']] <- IQR(rk.temp.var,na.rm=".getRK_val("NA").")\n";
! 	if (getRK_val ("quartile")) echo 
  		"rk.temp.res [[ k ]] [['Quartiles']]  <- list()
  		rk.temp.res [[ k ]] [['Quartiles']] [[2]]  <- quantile(rk.temp.var,na.rm=".getRK_val("NA").")
! 		rk.temp.res [[ k ]] [['Quartiles']] [[1]]  <- names(quantile(rk.temp.var,na.rm=".getRK_val("NA")."))\n"  ;
! 	if (($nautre = getRK_val ("autre")) != "0") echo (" if ( length(rk.temp.var) >= " . $nautre .") {
  		rk.temp.res [[ k ]][['Other']] <- list()
  		rk.temp.res [[ k ]][['Other']][[1]] <- paste(seq(0,100,le=" . $nautre . "),'%')
  		rk.temp.res [[ k ]] [['Other']] [[2]]  <- quantile(rk.temp.var,probs=seq(0,1,le=" . $nautre . "), na.rm=".getRK_val("NA").")
! 		}\n"  ) ; ?> 
  	
  	#robust statistics
! 	<?  if (getRK_val ("trim") == "1") 
! 		echo ("rk.temp.res [[ k ]][['Trimmed Mean']] <- mean(rk.temp.var,trim= ". getRK_val("pourcent") . " ,na.rm=".getRK_val("NA").")\n" ) ;
! 	if (getRK_val ("mad") == "1") 
! 		echo ("rk.temp.res [[ k ]][['Median Absolute Deviation']] <-  mad(rk.temp.var, constant = ". getRK_val("constMad") . " ,na.rm=".getRK_val("NA").")\n" ) ; 
! 	if (getRK_val ("huber") == "1") echo ("
! 		require (\"MASS\")
! 		rk.temp.res [[ k ]][['Huber M-Estimator']] <- list()
! 		rk.temp.res [[ k ]][['Huber M-Estimator']] [[1]] <- c('Location Estimate','Mad scale estimate')
! 		rk.temp.res [[ k ]][['Huber M-Estimator']] [[2]] <- c(NA,NA)
! 		try(rk.temp.res [[ k ]][['Huber M-Estimator']] [[2]] <- hubers (rk.temp.var, k = " . getRK_val("winsor") . ",tol=".getRK_val("tol")." )\n");
  	if (getRK_val(customMu)=="1") echo (",mu=".getRK_val("mu")) ; 
  	if (getRK_val(customS)=="1") echo (",s=".getRK_val("s")) ;
! 	if (getRK_val ("huber") == "1") echo (",initmu =".getRK_val("initmu")."(rk.temp.var)))")
  	?>	
  	rm(k)





More information about the rkward-tracker mailing list