[Depmix-commits] r601 - pkg/depmixS4/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 17 14:18:33 CEST 2013


Author: ingmarvisser
Date: 2013-09-17 14:18:33 +0200 (Tue, 17 Sep 2013)
New Revision: 601

Modified:
   pkg/depmixS4/man/depmix.Rd
Log:
Reduced time of examples running by using dontrun on the ?depmix help page

Modified: pkg/depmixS4/man/depmix.Rd
===================================================================
--- pkg/depmixS4/man/depmix.Rd	2013-09-17 09:58:56 UTC (rev 600)
+++ pkg/depmixS4/man/depmix.Rd	2013-09-17 12:18:33 UTC (rev 601)
@@ -200,6 +200,23 @@
 # fit the model by calling fit
 fm <- fit(mod)
 
+# Volatility of S & P 500 returns
+# (thanks to Chen Haibo for providing this example)
+
+data(sp500)
+
+# fit some models
+msp <- depmix(logret~1,nstates=2,data=sp500)
+set.seed(1)
+fmsp <- fit(msp)	
+
+# plot posterior state sequence for the 2-state model
+plot(ts(posterior(fmsp)[,2], start=c(1950,2),deltat=1/12),ylab="probability",
+main="Posterior probability of state 1 (volatile, negative markets).",
+frame=FALSE)
+
+\dontrun{
+
 # this creates data with a single change point with Poisson data
 set.seed(3)
 y1 <- rpois(50,1)
@@ -220,6 +237,9 @@
 # plot the BICs to select the proper model
 plot(1:3,c(BIC(fm1),BIC(fm2),BIC(fm3)),ty="b")
 
+}
+
+\dontrun{
 # similar to the binomial model, data may also be entered in 
 # multi-column format where the n for each row can be different
 dt <- data.frame(y1=c(0,1,1,2,4,5),y2=c(1,0,1,0,1,0),y3=c(4,4,3,2,1,1))
@@ -231,22 +251,10 @@
 dm2 <- depmix(cbind(y1,y2,y3)~1,data=dt,ns=2,family=multinomial("identity"))
 set.seed(1)
 fdm2 <- fit(dm2)
+}
 
 
-# Volatility of S & P 500 returns
-# (thanks to Chen Haibo for providing this example)
 
-data(sp500)
-
-# fit some models
-mod <- depmix(logret~1,nstates=2,data=sp500)
-set.seed(1)
-fm2 <- fit(mod)	
-
-# plot posterior state sequence for the 2-state model
-plot(as.ts(posterior(fm2)[,2]),ylab="probability",
-main="Posterior probability of state 1 (volatile, negative markets).")
-
 }
 
 \keyword{methods}



More information about the depmix-commits mailing list