[Calibayesr-commits] r10 - pkg/demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 25 15:58:07 CET 2010


Author: csgillespie
Date: 2010-03-25 15:58:07 +0100 (Thu, 25 Mar 2010)
New Revision: 10

Modified:
   pkg/demo/YeastGrowthDemo.R
Log:
Updating Yeast demo


Modified: pkg/demo/YeastGrowthDemo.R
===================================================================
--- pkg/demo/YeastGrowthDemo.R	2010-03-25 14:49:46 UTC (rev 9)
+++ pkg/demo/YeastGrowthDemo.R	2010-03-25 14:58:07 UTC (rev 10)
@@ -1,16 +1,18 @@
 #Demo for YeastGrowthDemo
 library(calibayesR)
-
 library(SBMLModels)
 data(LogisticModel)
 
-#Create settings file
+#Which simulators are available
 wsdl = "http://calibayes1.ncl.ac.uk:81/CaliBayesService_v2.wsdl"
-settings = createSettings(wsdl, burn=10000, thin=2)
+listSimulatorMethods(wsdl)
 
-#Just use the first experiment
-yeast_data = YeastGrowth[[1]]
+#Create settings file
+settings = createCaliBayesSettings(wsdl, burn=10, thin=2, simulator="copasi-deterministic")
 
+#Just use the first experiment and a copy of points for illustration
+yeast_data = YeastGrowth[[1]][1:3,]
+
 #Plot of the experiment data for the simple decay model
 plot(yeast_data$time, yeast_data$value, xlab="Time", ylab="Population level")
 
@@ -19,30 +21,36 @@
 
 #The number of particles
 #n increases with the number of parameters
-n = 500
+n = 100
 
 #Create prior for the initial species level
 species=data.frame(S=rlnorm(n,3,sqrt(0.02)))
 
 #Create prior distribution for the measurement error structure
 distributions = c('Gaussian')
-errors = data.frame(S.tau=rlnorm(n,-11, 1))
+errors = data.frame(S.tau=rlnorm(n,- 11, 1))
 
 #Create priors for the parameters
 parameters = data.frame(K=rlnorm(n,9,0.2), r=rlnorm(n,1,0.6))
 
-#Create a prior object
-prior = createCalibayes(parameters, species, distributions, errors, yeast_data)
+#Create a distribution object that contains our prior
+prior = createCaliBayesDistribution(parameters, species, distributions, errors, FALSE)
+plot(prior)
 
-sid = calibrate(wsdl, LogisticModel, settings, prior, asText=TRUE)
+#Create a Experiment object
+experiments = createCaliBayesExperiment(yeast_data, species)
 
-cat("Check calibayes every thirty seconds\n")
-isCaliBayesFinished(wsdl, sid, 20 , 10)
+sid = calibrate(wsdl, LogisticModel, settings, experiments, prior, asText=TRUE)
 
+isCaliBayesReady(wsdl, sid)
+isCaliBayesFinished(wsdl, sid, 10, 10)
 
+#Retrieve the posterior from CaliBayes
 posterior = getPosterior(wsdl, sid)
 
+#Check the output
 plot(posterior)
-summary(posterior)
 
+#Compare the posterior to the prior
 compareDistributions(prior, posterior)
+



More information about the Calibayesr-commits mailing list