Changes made in revision 8 of KalmanEM.r

--- /tmp/cvx_dvVhFw	2012-02-07 19:38:37.000000000 -0800
+++ /tmp/cvx_8cJxau	2012-02-07 19:38:37.000000000 -0800
@@ -222,11 +222,12 @@
 }
 
 drawProgressBar = FALSE #If the time library is not installed, no prog bar
+if("time" %in% installed.packages()[,1]){ #then try to install time
 if(require(time)==TRUE & MonteCarloInit == TRUE & !silent) { #then we can draw a progress bar
     cat("\n"); cat("> Starting Monte Carlo Initializations\n")
     prev = progressBar()
     drawProgressBar = TRUE
-}
+} }
 # The first numInits iterations of this loop represent the MCinitialization phase (if MCInit=T),
 # the last iteration is the final estimation (if MCInit=F, then goes straight to the last)
 bestLL = -1.0e10 #this is only used if MonteCarloInit == TRUE
@@ -965,10 +966,11 @@
   logL.thetaStar=0; logL.Hessian.AICb=0; logL.Param.AICb=0; logL.Nonparam.AICb=0; logL.AICi=0; logL2.AICi=0;  
   Hessian.AICb=NA; Param.AICb=NA; Nonparam.AICb=NA; AICi=NA; eqn8=NA; AICi.approx=NA;  #so R knows about these
   drawProgressBar = FALSE #If the time library is not installed, no prog bar
-  if(require(time)==TRUE) { #then we can draw a progress bar
+  if("time" %in% installed.packages()[,1]){ #then try to install time
+  if(require(time)==TRUE & !silent) { #then we can draw a progress bar
     prev = progressBar()
     drawProgressBar = TRUE
-    }
+    }   }
     
   for(i in 1:nBoot) {
     if( ("MLests" %in% output) | ("Param.AICb" %in% output & parametric==TRUE) | ("Nonparam.AICb" %in% output & parametric==FALSE) | "bootdata" %in% output)

Sculpin 0.2 | xhtml | problems or comments? | report bugs