[Depmix-commits] r54 - / trunk
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Mar 6 16:44:05 CET 2008
Author: ingmarvisser
Date: 2008-03-06 16:44:05 +0100 (Thu, 06 Mar 2008)
New Revision: 54
Modified:
todo
trunk/depmix-test2.R
trunk/depmix-test3EM2.R
trunk/fb.R
trunk/hmModel.R
Log:
Minor changes
Modified: todo
===================================================================
--- todo 2008-03-06 15:15:41 UTC (rev 53)
+++ todo 2008-03-06 15:44:05 UTC (rev 54)
@@ -9,11 +9,9 @@
3) depmix.fit.Rd: help on fitting models: Ingmar
Other methods for depmix.fitted objects include:
a) posterior: get posterior state sequence: we still need the code for this!
-
b) logLik: done!!!
c) AIC, BIC: done!!!
- d) getpars, setpars
-
+ d) getpars, setpars: done!!!!
e) llratio: done!!!!!
4) responses.Rd: detailed description on constructing response models
@@ -32,9 +30,10 @@
- viterbi algorithm to get posterior probabilities as part of depmix.fitted
-- general documentation: depmix-introduction needs updating
+- general documentation: depmix-introduction.pdf needs updating
+- generate initial values?!?!?
Modified: trunk/depmix-test2.R
===================================================================
--- trunk/depmix-test2.R 2008-03-06 15:15:41 UTC (rev 53)
+++ trunk/depmix-test2.R 2008-03-06 15:44:05 UTC (rev 54)
@@ -16,7 +16,7 @@
# Test optimization using Rdonlp2
#
-setwd("/Users/ivisser/Documents/projects/depmixProject/depmixNew/code/depmix/trunk/")
+setwd("/Users/ivisser/Documents/projects/depmixProject/depmixNew/rforge/depmix/trunk/")
source("depmixS4.r")
source("classes.r")
@@ -26,23 +26,27 @@
source("lystig.R")
source("fb.R")
-load("speed.Rda")
+load("data/speed.Rda")
rModels <- list(
list(
- rModel(formula=rt~1,data=speed,family=gaussian(),pstart=c(5.52,.2)),
+ rModel(formula=rt~1,data=speed,family=gaussian()),#,pstart=c(5.52,.2)
rModel(formula=corr~1,data=speed,family=multinomial())),
list(
- rModel(formula=rt~1,data=speed,family=gaussian(),pstart=c(6.39,.24)),
- rModel(formula=corr~1,data=speed,family=multinomial(),pstart=c(.098,.902)))
+ rModel(formula=rt~1,data=speed,family=gaussian()),#,pstart=c(6.39,.24)
+ rModel(formula=corr~1,data=speed,family=multinomial()))#,pstart=c(.098,.902)
)
-instart=c(0.45,.55)
-trstart=c(0.896,0.104,0.084,0.916)
-trstart=c(trstart[1:2],0,0.01,trstart[3:4],0,0)
+instart=c(0.5,.5)
+trstart1=c(0.896,0.104,0.084,0.916)
+trstart2=c(trstart[1:2],0,0.01,trstart[3:4],0,0)
-mod <- depmix(rModels=rModels,data=speed,transition=~Pacc,trstart=trstart,instart=instart)
+mod <- depmix(rModels=rModels,data=speed,transition=~1,trstart=trstart1,instart=instart)
+logLik(mod)
+
+fmod <- em(mod,ver=T)
+
# fit the model
mod1 <- fit(mod)
ll <- logLik(mod1)
Modified: trunk/depmix-test3EM2.R
===================================================================
--- trunk/depmix-test3EM2.R 2008-03-06 15:15:41 UTC (rev 53)
+++ trunk/depmix-test3EM2.R 2008-03-06 15:44:05 UTC (rev 54)
@@ -18,19 +18,21 @@
rModels <- list(
list(
- rModel(formula=rt~1,data=speed,family=gaussian(),pstart=c(5.5,.2))),
+ rModel(formula=rt~1,data=speed,family=gaussian())),#,pstart=c(5.5,.2)
list(
- rModel(formula=rt~1,data=speed,family=gaussian(),pstart=c(6.3,.2)))
+ rModel(formula=rt~1,data=speed,family=gaussian()))#,pstart=c(6.3,.2)
)
-trstart=c(0.8,0.2,0.1,0.9)
+trstart=runif(4)
instart=c(0,1)
-
mod <- depmix(rModels=rModels,data=speed,transition=~1,trstart=trstart,instart=instart)
logLik(mod)
source("EM.R")
+
+mod
+
fmod <- em(mod,verbose=T)
#
Modified: trunk/fb.R
===================================================================
--- trunk/fb.R 2008-03-06 15:15:41 UTC (rev 53)
+++ trunk/fb.R 2008-03-06 15:44:05 UTC (rev 54)
@@ -19,7 +19,6 @@
nt <- nrow(B)
ns <- ncol(init)
-
alpha <- matrix(ncol=ns,nrow=nt)
beta <- matrix(ncol=ns,nrow=nt)
sca <- vector(length=nt)
Modified: trunk/hmModel.R
===================================================================
--- trunk/hmModel.R 2008-03-06 15:15:41 UTC (rev 53)
+++ trunk/hmModel.R 2008-03-06 15:44:05 UTC (rev 54)
@@ -60,7 +60,7 @@
# make appropriate array for observation densities
dens <- array(,c(nt,nresp,nstates))
-
+
# compute observation and transition densities
for(i in 1:nstates) {
for(j in 1:nresp) {
More information about the depmix-commits
mailing list