[Depmix-commits] r618 - in tags/release-1.3-2: . R man tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Feb 4 14:50:44 CET 2014
Author: ingmarvisser
Date: 2014-02-04 14:50:43 +0100 (Tue, 04 Feb 2014)
New Revision: 618
Modified:
tags/release-1.3-2/DESCRIPTION
tags/release-1.3-2/NAMESPACE
tags/release-1.3-2/NEWS
tags/release-1.3-2/R/EM.R
tags/release-1.3-2/R/allGenerics.R
tags/release-1.3-2/R/depmix-class.R
tags/release-1.3-2/R/depmix.R
tags/release-1.3-2/R/depmixfit-class.R
tags/release-1.3-2/R/depmixfit.R
tags/release-1.3-2/R/depmixsim-class.R
tags/release-1.3-2/R/fb.R
tags/release-1.3-2/R/forwardbackward.R
tags/release-1.3-2/R/freepars.R
tags/release-1.3-2/R/getpars.R
tags/release-1.3-2/R/llratio.R
tags/release-1.3-2/R/logLik.R
tags/release-1.3-2/R/lystig.R
tags/release-1.3-2/R/makeDepmix.R
tags/release-1.3-2/R/makePriorModel.R
tags/release-1.3-2/R/makeResponseModels.R
tags/release-1.3-2/R/makeTransModels.R
tags/release-1.3-2/R/mlogit.R
tags/release-1.3-2/R/multinomial.R
tags/release-1.3-2/R/nobs.R
tags/release-1.3-2/R/pa2conr.R
tags/release-1.3-2/R/response-class.R
tags/release-1.3-2/R/responseGLM.R
tags/release-1.3-2/R/responseGLMBINOM.R
tags/release-1.3-2/R/responseGLMGAMMA.R
tags/release-1.3-2/R/responseGLMMULTINOM.R
tags/release-1.3-2/R/responseGLMPOISSON.R
tags/release-1.3-2/R/responseMVN.R
tags/release-1.3-2/R/responseNORM.R
tags/release-1.3-2/R/setpars.R
tags/release-1.3-2/R/transInit.R
tags/release-1.3-2/R/viterbi.R
tags/release-1.3-2/README
tags/release-1.3-2/man/balance.Rd
tags/release-1.3-2/man/depmix-class.Rd
tags/release-1.3-2/man/depmix-internal.Rd
tags/release-1.3-2/man/depmix-methods.Rd
tags/release-1.3-2/man/depmix.Rd
tags/release-1.3-2/man/depmix.fit.Rd
tags/release-1.3-2/man/depmix.fitted-class.Rd
tags/release-1.3-2/man/depmix.sim-class.Rd
tags/release-1.3-2/man/depmixS4-package.Rd
tags/release-1.3-2/man/forwardbackward.Rd
tags/release-1.3-2/man/llratio.Rd
tags/release-1.3-2/man/makeDepmix.Rd
tags/release-1.3-2/man/mix-class.Rd
tags/release-1.3-2/man/mix.Rd
tags/release-1.3-2/man/mix.fitted-class.Rd
tags/release-1.3-2/man/mix.sim-class.Rd
tags/release-1.3-2/man/posterior.Rd
tags/release-1.3-2/man/response-class.Rd
tags/release-1.3-2/man/response-classes.Rd
tags/release-1.3-2/man/responses.Rd
tags/release-1.3-2/man/simulate.Rd
tags/release-1.3-2/man/sp500.Rd
tags/release-1.3-2/man/speed.Rd
tags/release-1.3-2/tests/test1speed.R
tags/release-1.3-2/tests/test1speed.Rout.save
tags/release-1.3-2/tests/test2getsetpars.R
tags/release-1.3-2/tests/test2getsetpars.Rout.save
tags/release-1.3-2/tests/test3responses.R
Log:
Add tag directory for 1.3-2
Modified: tags/release-1.3-2/DESCRIPTION
===================================================================
--- tags/release-1.3-2/DESCRIPTION 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/DESCRIPTION 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,13 +1,13 @@
-Package: depmixS4
-Version: 1.3-2
-Date: 2014-02-04
-Title: Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
-Author: Ingmar Visser <i.visser at uva.nl>, Maarten Speekenbrink <m.speekenbrink at ucl.ac.uk>
-Maintainer: Ingmar Visser <i.visser at uva.nl>
-Depends: R (>= 3.0.1), nnet, MASS, Rsolnp
-Imports: stats, stats4, methods
-Suggests: gamlss, gamlss.dist
-Description: Fit latent (hidden) Markov models on mixed categorical and continuous (time series)
- data, otherwise known as dependent mixture models
-License: GPL (>=2)
-URL: http://depmix.r-forge.r-project.org/
+Package: depmixS4
+Version: 1.3-2
+Date: 2014-02-04
+Title: Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
+Author: Ingmar Visser <i.visser at uva.nl>, Maarten Speekenbrink <m.speekenbrink at ucl.ac.uk>
+Maintainer: Ingmar Visser <i.visser at uva.nl>
+Depends: R (>= 3.0.1), nnet, MASS, Rsolnp
+Imports: stats, stats4, methods
+Suggests: gamlss, gamlss.dist
+Description: Fit latent (hidden) Markov models on mixed categorical and continuous (time series)
+ data, otherwise known as dependent mixture models
+License: GPL (>=2)
+URL: http://depmix.r-forge.r-project.org/
Property changes on: tags/release-1.3-2/DESCRIPTION
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: tags/release-1.3-2/NAMESPACE
===================================================================
--- tags/release-1.3-2/NAMESPACE 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/NAMESPACE 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,62 +1,62 @@
-import(methods, MASS, nnet, Rsolnp)
-
-importFrom(stats, predict, simulate)
-
-importFrom(stats4, AIC, BIC, logLik, nobs, summary)
-
-export(
- makeDepmix,
- makeMix,
- lystig,
- fb,
- forwardbackward,
- MVNresponse,
- llratio,
- multinomial,
- em,
- em.control,
- viterbi,
- mlogit,
- logLik
-)
-
-exportClasses(
- depmix,
- depmix.sim,
- mix,
- mix.sim,
- depmix.fitted,
- mix.fitted,
- response,
- GLMresponse,
- MVNresponse,
- transInit
-)
-
-exportMethods(
- fit,
- getConstraints,
- npar,
- freepars,
- nlin,
- getdf,
- nobs,
- nresp,
- ntimes,
- nstates,
- depmix,
- mix,
- posterior,
- GLMresponse,
- MVNresponse,
- transInit,
- setpars,
- getpars,
- predict,
- dens,
- show,
- simulate,
- summary,
- logLik,
- getmodel
-)
+import(methods, MASS, nnet, Rsolnp)
+
+importFrom(stats, predict, simulate)
+
+importFrom(stats4, AIC, BIC, logLik, nobs, summary)
+
+export(
+ makeDepmix,
+ makeMix,
+ lystig,
+ fb,
+ forwardbackward,
+ MVNresponse,
+ llratio,
+ multinomial,
+ em,
+ em.control,
+ viterbi,
+ mlogit,
+ logLik
+)
+
+exportClasses(
+ depmix,
+ depmix.sim,
+ mix,
+ mix.sim,
+ depmix.fitted,
+ mix.fitted,
+ response,
+ GLMresponse,
+ MVNresponse,
+ transInit
+)
+
+exportMethods(
+ fit,
+ getConstraints,
+ npar,
+ freepars,
+ nlin,
+ getdf,
+ nobs,
+ nresp,
+ ntimes,
+ nstates,
+ depmix,
+ mix,
+ posterior,
+ GLMresponse,
+ MVNresponse,
+ transInit,
+ setpars,
+ getpars,
+ predict,
+ dens,
+ show,
+ simulate,
+ summary,
+ logLik,
+ getmodel
+)
Property changes on: tags/release-1.3-2/NAMESPACE
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/NEWS
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/EM.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/allGenerics.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/depmix-class.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/depmix.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/depmixfit-class.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/depmixfit.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/depmixsim-class.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/fb.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/forwardbackward.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/freepars.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/getpars.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/llratio.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/logLik.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/lystig.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/makeDepmix.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/makePriorModel.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/makeResponseModels.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/makeTransModels.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/mlogit.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/multinomial.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/nobs.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/pa2conr.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/response-class.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseGLM.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseGLMBINOM.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseGLMGAMMA.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseGLMMULTINOM.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseGLMPOISSON.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseMVN.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/responseNORM.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/setpars.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/transInit.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/R/viterbi.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/README
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/balance.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix-internal.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix-methods.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix.fit.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix.fitted-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmix.sim-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/depmixS4-package.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/forwardbackward.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/llratio.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/makeDepmix.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/mix-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/mix.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/mix.fitted-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/mix.sim-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/posterior.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/response-class.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/response-classes.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/man/responses.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: tags/release-1.3-2/man/simulate.Rd
===================================================================
--- tags/release-1.3-2/man/simulate.Rd 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/man/simulate.Rd 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,101 +1,101 @@
-\name{simulate}
-
-\alias{simulate}
-
-\alias{simulate,response-method}
-\alias{simulate,mix-method}
-\alias{simulate,depmix-method}
-\alias{simulate,GLMresponse-method}
-\alias{simulate,transInit-method}
-
-\alias{simulate,BINOMresponse-method}
-\alias{simulate,GAMMAresponse-method}
-\alias{simulate,MULTINOMresponse-method}
-\alias{simulate,MVNresponse-method}
-\alias{simulate,NORMresponse-method}
-\alias{simulate,POISSONresponse-method}
-
-\title{Methods to simulate from (dep-)mix models}
-
-\description{
-
- Random draws from \code{(dep-)mix} objects.
-
-}
-
-\usage{
-
- \S4method{simulate}{depmix}(object, nsim=1, seed=NULL, ...)
-
- \S4method{simulate}{mix}(object, nsim=1, seed=NULL, ...)
-
- \S4method{simulate}{response}(object, nsim=1, seed=NULL, times, ...)
-
- \S4method{simulate}{GLMresponse}(object, nsim=1, seed=NULL, times, ...)
-
- \S4method{simulate}{transInit}(object, nsim=1, seed=NULL, times, is.prior=FALSE, ...)
-}
-
-\arguments{
-
- \item{object}{Object to generate random draws. An object of class
- \code{mix}, \code{depmix}, \code{response} or \code{transInit}}
-
- \item{nsim}{The number of draws (one draw simulates a data set of the
- size that is defined by ntimes); defaults to 1.}
-
- \item{seed}{Set the seed.}
-
- \item{times}{(optional) An indicator vector indicating for which times in the
- complete series to generate the data. For internal use.}
-
- \item{is.prior}{For \code{transInit} objects, indicates whether it is a prior
- (init) model, or not (i.e., it is a transition model)}
-
- \item{...}{Not used currently.}
-}
-
-\details{
-
- For a \code{depmix} model, simulate generates \code{nsim} random state
- sequences, each of the same length as the observation sequence in the
- \code{depmix} model (i.e., \code{sum(ntimes(object))}. The state
- sequences are then used to generate \code{nsim} observation sequences
- of thee same length.
-
- For a \code{mix} model, simulate generates \code{nsim} random class
- assignments for each case. Those assigments are then used to generate
- observation/response values from the appropriate distributions.
-
- Setting the \code{times} option selects the time points in the total
- state/observation sequence (i.e., counting is continued over ntimes).
- Direct calls of simulate with the \code{times} option are not recommended.
-
-}
-
-\value{
-
- For a \code{depmix} object, a new object of class \code{depmix.sim}.
-
- For a \code{transInit} object, a state sequence.
-
- For a \code{response} object, an observation sequence.
-
-}
-
-\examples{
-
-y <- rnorm(1000)
-respst <- c(0,1,2,1)
-trst <- c(0.9,0.1,0.1,0.9)
-
-df <- data.frame(y=y)
-
-mod <- depmix(y~1,data=df,respst=respst,trst=trst,inst=c(0.5,0.5),nti=1000,nst=2)
-
-mod <- simulate(mod)
-
-}
-\author{Maarten Speekenbrink}
-
-\keyword{methods}
+\name{simulate}
+
+\alias{simulate}
+
+\alias{simulate,response-method}
+\alias{simulate,mix-method}
+\alias{simulate,depmix-method}
+\alias{simulate,GLMresponse-method}
+\alias{simulate,transInit-method}
+
+\alias{simulate,BINOMresponse-method}
+\alias{simulate,GAMMAresponse-method}
+\alias{simulate,MULTINOMresponse-method}
+\alias{simulate,MVNresponse-method}
+\alias{simulate,NORMresponse-method}
+\alias{simulate,POISSONresponse-method}
+
+\title{Methods to simulate from (dep-)mix models}
+
+\description{
+
+ Random draws from \code{(dep-)mix} objects.
+
+}
+
+\usage{
+
+ \S4method{simulate}{depmix}(object, nsim=1, seed=NULL, ...)
+
+ \S4method{simulate}{mix}(object, nsim=1, seed=NULL, ...)
+
+ \S4method{simulate}{response}(object, nsim=1, seed=NULL, times, ...)
+
+ \S4method{simulate}{GLMresponse}(object, nsim=1, seed=NULL, times, ...)
+
+ \S4method{simulate}{transInit}(object, nsim=1, seed=NULL, times, is.prior=FALSE, ...)
+}
+
+\arguments{
+
+ \item{object}{Object to generate random draws. An object of class
+ \code{mix}, \code{depmix}, \code{response} or \code{transInit}}
+
+ \item{nsim}{The number of draws (one draw simulates a data set of the
+ size that is defined by ntimes); defaults to 1.}
+
+ \item{seed}{Set the seed.}
+
+ \item{times}{(optional) An indicator vector indicating for which times in the
+ complete series to generate the data. For internal use.}
+
+ \item{is.prior}{For \code{transInit} objects, indicates whether it is a prior
+ (init) model, or not (i.e., it is a transition model)}
+
+ \item{...}{Not used currently.}
+}
+
+\details{
+
+ For a \code{depmix} model, simulate generates \code{nsim} random state
+ sequences, each of the same length as the observation sequence in the
+ \code{depmix} model (i.e., \code{sum(ntimes(object))}. The state
+ sequences are then used to generate \code{nsim} observation sequences
+ of thee same length.
+
+ For a \code{mix} model, simulate generates \code{nsim} random class
+ assignments for each case. Those assigments are then used to generate
+ observation/response values from the appropriate distributions.
+
+ Setting the \code{times} option selects the time points in the total
+ state/observation sequence (i.e., counting is continued over ntimes).
+ Direct calls of simulate with the \code{times} option are not recommended.
+
+}
+
+\value{
+
+ For a \code{depmix} object, a new object of class \code{depmix.sim}.
+
+ For a \code{transInit} object, a state sequence.
+
+ For a \code{response} object, an observation sequence.
+
+}
+
+\examples{
+
+y <- rnorm(1000)
+respst <- c(0,1,2,1)
+trst <- c(0.9,0.1,0.1,0.9)
+
+df <- data.frame(y=y)
+
+mod <- depmix(y~1,data=df,respst=respst,trst=trst,inst=c(0.5,0.5),nti=1000,nst=2)
+
+mod <- simulate(mod)
+
+}
+\author{Maarten Speekenbrink}
+
+\keyword{methods}
Property changes on: tags/release-1.3-2/man/simulate.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: tags/release-1.3-2/man/sp500.Rd
===================================================================
--- tags/release-1.3-2/man/sp500.Rd 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/man/sp500.Rd 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,61 +1,61 @@
-\name{sp500}
-
-\docType{data}
-
-\alias{sp500}
-
-\title{Standard & Poor's 500 index}
-
-\description{
-
- This data set consists of (monthly) values of the S&P 500 stock exchange
- index. The variable of interest is the logarithm of the return values, i.e.,
- the logarithm of the ratio of indices, in this case the closing index is
- used.
-
-}
-
-\usage{data(speed)}
-
-\format{
- A data frame with 744 observations and 6 variables.
- \describe{
- \item{\code{Open}}{Index at the start of trading.}
- \item{\code{High}}{Highest index.}
- \item{\code{Low}}{Lowest index.}
- \item{\code{Close}}{Index at the close of trading.}
- \item{\code{Volume}}{The volume of trading.}
- \item{\code{logret}}{The log return of the closing index.}
- }
-}
-
-\source{
-
- Yahoo Data.
-}
-
-\examples{
-
-data(sp500)
-
-# the data can be made with the following code (eg to include a longer or
-# shorter time span)
-
-\dontrun{
-
-require(TTR)
-
-# load SP500 returns
-Sys.setenv(tz='UTC')
-
-sp500 <- getYahooData('^GSPC',start=19500101,end=20120228,freq='daily')
-ep <- endpoints(sp500, on="months", k=1)
-sp500 <- sp500[ep[2:(length(ep)-1)]]
-sp500$sp500_ret <- log(sp500$Close) - lag(log(sp500$Close))
-sp500 <- na.exclude(sp500)
-
-}
-
-}
-
-\keyword{datasets}
+\name{sp500}
+
+\docType{data}
+
+\alias{sp500}
+
+\title{Standard & Poor's 500 index}
+
+\description{
+
+ This data set consists of (monthly) values of the S&P 500 stock exchange
+ index. The variable of interest is the logarithm of the return values, i.e.,
+ the logarithm of the ratio of indices, in this case the closing index is
+ used.
+
+}
+
+\usage{data(speed)}
+
+\format{
+ A data frame with 744 observations and 6 variables.
+ \describe{
+ \item{\code{Open}}{Index at the start of trading.}
+ \item{\code{High}}{Highest index.}
+ \item{\code{Low}}{Lowest index.}
+ \item{\code{Close}}{Index at the close of trading.}
+ \item{\code{Volume}}{The volume of trading.}
+ \item{\code{logret}}{The log return of the closing index.}
+ }
+}
+
+\source{
+
+ Yahoo Data.
+}
+
+\examples{
+
+data(sp500)
+
+# the data can be made with the following code (eg to include a longer or
+# shorter time span)
+
+\dontrun{
+
+require(TTR)
+
+# load SP500 returns
+Sys.setenv(tz='UTC')
+
+sp500 <- getYahooData('^GSPC',start=19500101,end=20120228,freq='daily')
+ep <- endpoints(sp500, on="months", k=1)
+sp500 <- sp500[ep[2:(length(ep)-1)]]
+sp500$sp500_ret <- log(sp500$Close) - lag(log(sp500$Close))
+sp500 <- na.exclude(sp500)
+
+}
+
+}
+
+\keyword{datasets}
Property changes on: tags/release-1.3-2/man/sp500.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: tags/release-1.3-2/man/speed.Rd
===================================================================
--- tags/release-1.3-2/man/speed.Rd 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/man/speed.Rd 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,52 +1,52 @@
-\name{speed}
-
-\docType{data}
-
-\alias{speed}
-
-\title{Speed Accuracy Switching Data}
-
-\description{
-
- This data set is a bivariate series of response times and accuracy
- scores of a single participant switching between slow/accurate
- responding and fast guessing on a lexical decision task. The slow and
- accurate responding, and the fast guessing can be modelled using two
- states, with a switching regime between them. The dataset further
- contains a third variable called Pacc, representing the relative
- pay-off for accurate responding, which is on a scale of zero to one.
- The value of Pacc was varied during the experiment to induce the
- switching. This data set is a from participant A in experiment
- 1a from Dutilh et al (2011).
-
-}
-
-\usage{data(speed)}
-
-\format{
- A data frame with 439 observations on the following 4 variables.
- \describe{
- \item{\code{rt}}{a numeric vector of response times (log ms)}
- \item{\code{corr}}{a numeric vector of accuracy scores (0/1)}
- \item{\code{Pacc}}{a numeric vector of the pay-off for accuracy}
- \item{\code{prev}}{a numeric vector of accuracy scores (0/1)
- on the previous trial}
- }
-}
-
-\source{
-
- Gilles Dutilh, Eric-Jan Wagenmakers, Ingmar Visser, & Han L. J. van der Maas (2011).
- A phase transition model for the speed-accuracy trade-off in response time experiments.
- \emph{Cognitive Science}, 35:211-250.
-
- Corresponding author: g.dutilh at uva.nl
-
-}
-
-\examples{
-data(speed)
-## maybe str(speed) ; plot(speed) ...
-}
-
-\keyword{datasets}
+\name{speed}
+
+\docType{data}
+
+\alias{speed}
+
+\title{Speed Accuracy Switching Data}
+
+\description{
+
+ This data set is a bivariate series of response times and accuracy
+ scores of a single participant switching between slow/accurate
+ responding and fast guessing on a lexical decision task. The slow and
+ accurate responding, and the fast guessing can be modelled using two
+ states, with a switching regime between them. The dataset further
+ contains a third variable called Pacc, representing the relative
+ pay-off for accurate responding, which is on a scale of zero to one.
+ The value of Pacc was varied during the experiment to induce the
+ switching. This data set is a from participant A in experiment
+ 1a from Dutilh et al (2011).
+
+}
+
+\usage{data(speed)}
+
+\format{
+ A data frame with 439 observations on the following 4 variables.
+ \describe{
+ \item{\code{rt}}{a numeric vector of response times (log ms)}
+ \item{\code{corr}}{a numeric vector of accuracy scores (0/1)}
+ \item{\code{Pacc}}{a numeric vector of the pay-off for accuracy}
+ \item{\code{prev}}{a numeric vector of accuracy scores (0/1)
+ on the previous trial}
+ }
+}
+
+\source{
+
+ Gilles Dutilh, Eric-Jan Wagenmakers, Ingmar Visser, & Han L. J. van der Maas (2011).
+ A phase transition model for the speed-accuracy trade-off in response time experiments.
+ \emph{Cognitive Science}, 35:211-250.
+
+ Corresponding author: g.dutilh at uva.nl
+
+}
+
+\examples{
+data(speed)
+## maybe str(speed) ; plot(speed) ...
+}
+
+\keyword{datasets}
Property changes on: tags/release-1.3-2/man/speed.Rd
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: tags/release-1.3-2/tests/test1speed.R
===================================================================
--- tags/release-1.3-2/tests/test1speed.R 2014-02-04 13:42:19 UTC (rev 617)
+++ tags/release-1.3-2/tests/test1speed.R 2014-02-04 13:50:43 UTC (rev 618)
@@ -1,135 +1,135 @@
-#
-# TEST 1: speed data model with optimal parameters, compute the likelihood
-#
-
-require(depmixS4)
-
-data(speed)
-
-pars <- c(1,0.916,0.084,0.101,0.899,6.39,0.24,0.098,0.902,5.52,0.202,0.472,0.528,1,0)
-
-rModels <- list(
- list(
- GLMresponse(formula=rt~1,data=speed,family=gaussian(),pstart=c(5.52,.202)),
- GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(0.472,0.528))
- ),
- list(
- GLMresponse(formula=rt~1,data=speed,family=gaussian(),pstart=c(6.39,.24)),
- GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(.098,.902))
- )
-)
-
-trstart=c(0.899,0.101,0.084,0.916)
-
-transition <- list()
-transition[[1]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[1:2]))
-transition[[2]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[3:4]))
-
-instart=c(0,1)
-inMod <- transInit(~1,ns=2,ps=instart,data=data.frame(rep(1,3)))
-
-mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137))
-
-ll <- logLik(mod)
-ll.fb <- logLik(mod,method="fb")
-
-logl <- -296.115107102 # see above
-
-cat("Test 1: ", all.equal(c(ll),logl,check.att=FALSE), "(loglike of speed data) \n")
-
-
-#
-# model specification made easy
-#
-
-library(depmixS4)
-
-resp <- c(5.52,0.202,0.472,0.528,6.39,0.24,0.098,0.902)
-trstart=c(0.899,0.101,0.084,0.916)
-instart=c(0,1)
-mod <- depmix(list(rt~1,corr~1),data=speed,nstates=2,family=list(gaussian(),multinomial()),respstart=resp,trstart=trstart,instart=instart,prob=T,ntimes=c(168,134,137))
-
-ll2 <- logLik(mod)
-
-cat("Test 1b: ", all.equal(c(ll),c(ll2),check.att=FALSE), "(loglike of speed data) \n")
-
-#
-# TEST 2
-#
-# To check the density function for the multinomial responses with a covariate
-# test a model with a single state, which should be identical to a glm
-# first fit a model without covariate
-#
-
-invlogit <- function(lp) {exp(lp)/(1+exp(lp))}
-
-acc <- glm(corr~1,data=speed,family=binomial)
-
-p1 <- invlogit(coef(acc)[1])
-p0 <- 1-p1
-
-mod <- depmix(corr~1,data=speed,nst=1,family=multinomial(),trstart=1,instart=c(1),respstart=c(p0,p1),ntimes=c(168,134,137))
-
-ll <- logLik(mod)
-
-dev <- -2*ll
-
-cat("Test 2: ", all.equal(c(dev),acc$deviance),"(loglike of 1-comp glm on acc data) \n")
-
-
-#
-# TEST 3
-#
-# now add the covariate and compute the loglikelihood
-#
-
-acc <- glm(corr~Pacc,data=speed,family=binomial)
-
-p1 <- invlogit(coef(acc)[1])
-p0 <- 1-p1
-
-pstart=c(p0,p1,0,coef(acc)[2])
-
-mod <- depmix(corr~Pacc,data=speed,family=multinomial(),trstart=1,instart=1,respst=pstart,nstate=1,ntimes=c(168,134,137))
-
-ll <- logLik(mod)
-dev <- -2*ll
-
-cat("Test 3: ", all.equal(c(dev),acc$deviance),"(same but now with covariate) \n")
-
-#
-# TEST 4: 2-state model with covariate
-#
-
-trstart=c(0.896,0.104,0.084,0.916)
-trstart=c(trstart[1:2],0,0.01,trstart[3:4],0,0.01)
-instart=c(0,1)
-resp <- c(5.52,0.202,0.472,0.528,6.39,0.24,0.098,0.902)
-
-mod <- depmix(list(rt~1,corr~1),data=speed,family=list(gaussian(),multinomial()),transition=~Pacc,trstart=trstart,instart=instart,respst=resp,nst=2,ntimes=c(168,134,137))
-ll <- logLik(mod)
-
-cat("Test 4: ll is now larger than speedll, ie ll is better due to introduction of a covariate \n")
-cat("Test 4: ", ll,"\t", logl, "\n")
-cat("Test 4: ", ll > logl, "\n")
-
-
-#
-# TEST 5: use em to optimize the model
-#
-
-data(speed)
-
-# 2-state model on rt and corr from speed data set
-# with Pacc as covariate on the transition matrix
-# ntimes is used to specify the lengths of 3 separate series
-mod1 <- depmix(list(rt~1,corr~1),data=speed,transition=~Pacc,nstates=2,
- family=list(gaussian(),multinomial("identity")),ntimes=c(168,134,137))
-# fit the model
-set.seed(3)
-fmod1 <- fit(mod1, verbose=FALSE)
-
-llEM <- logLik(fmod1)
-lltest <- -248.972219
-
-cat("Test 5: ", all.equal(c(lltest),c(llEM),check.att=FALSE), "(loglike EM optimized model for speed data) \n")
+#
+# TEST 1: speed data model with optimal parameters, compute the likelihood
+#
+
+require(depmixS4)
+
+data(speed)
+
+pars <- c(1,0.916,0.084,0.101,0.899,6.39,0.24,0.098,0.902,5.52,0.202,0.472,0.528,1,0)
+
+rModels <- list(
+ list(
+ GLMresponse(formula=rt~1,data=speed,family=gaussian(),pstart=c(5.52,.202)),
+ GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(0.472,0.528))
+ ),
+ list(
+ GLMresponse(formula=rt~1,data=speed,family=gaussian(),pstart=c(6.39,.24)),
+ GLMresponse(formula=corr~1,data=speed,family=multinomial(),pstart=c(.098,.902))
+ )
+)
+
+trstart=c(0.899,0.101,0.084,0.916)
+
+transition <- list()
+transition[[1]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[1:2]))
+transition[[2]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[3:4]))
+
+instart=c(0,1)
+inMod <- transInit(~1,ns=2,ps=instart,data=data.frame(rep(1,3)))
+
+mod <- makeDepmix(response=rModels,transition=transition,prior=inMod,ntimes=c(168,134,137))
+
+ll <- logLik(mod)
+ll.fb <- logLik(mod,method="fb")
+
+logl <- -296.115107102 # see above
+
+cat("Test 1: ", all.equal(c(ll),logl,check.att=FALSE), "(loglike of speed data) \n")
+
+
+#
+# model specification made easy
+#
+
+library(depmixS4)
+
+resp <- c(5.52,0.202,0.472,0.528,6.39,0.24,0.098,0.902)
+trstart=c(0.899,0.101,0.084,0.916)
+instart=c(0,1)
+mod <- depmix(list(rt~1,corr~1),data=speed,nstates=2,family=list(gaussian(),multinomial()),respstart=resp,trstart=trstart,instart=instart,prob=T,ntimes=c(168,134,137))
+
+ll2 <- logLik(mod)
+
+cat("Test 1b: ", all.equal(c(ll),c(ll2),check.att=FALSE), "(loglike of speed data) \n")
+
+#
+# TEST 2
+#
+# To check the density function for the multinomial responses with a covariate
+# test a model with a single state, which should be identical to a glm
+# first fit a model without covariate
+#
+
+invlogit <- function(lp) {exp(lp)/(1+exp(lp))}
+
+acc <- glm(corr~1,data=speed,family=binomial)
+
+p1 <- invlogit(coef(acc)[1])
+p0 <- 1-p1
+
+mod <- depmix(corr~1,data=speed,nst=1,family=multinomial(),trstart=1,instart=c(1),respstart=c(p0,p1),ntimes=c(168,134,137))
+
+ll <- logLik(mod)
+
+dev <- -2*ll
+
+cat("Test 2: ", all.equal(c(dev),acc$deviance),"(loglike of 1-comp glm on acc data) \n")
+
+
+#
+# TEST 3
+#
+# now add the covariate and compute the loglikelihood
+#
+
+acc <- glm(corr~Pacc,data=speed,family=binomial)
+
+p1 <- invlogit(coef(acc)[1])
+p0 <- 1-p1
+
+pstart=c(p0,p1,0,coef(acc)[2])
+
+mod <- depmix(corr~Pacc,data=speed,family=multinomial(),trstart=1,instart=1,respst=pstart,nstate=1,ntimes=c(168,134,137))
+
+ll <- logLik(mod)
+dev <- -2*ll
+
+cat("Test 3: ", all.equal(c(dev),acc$deviance),"(same but now with covariate) \n")
+
+#
+# TEST 4: 2-state model with covariate
+#
+
+trstart=c(0.896,0.104,0.084,0.916)
+trstart=c(trstart[1:2],0,0.01,trstart[3:4],0,0.01)
+instart=c(0,1)
+resp <- c(5.52,0.202,0.472,0.528,6.39,0.24,0.098,0.902)
+
+mod <- depmix(list(rt~1,corr~1),data=speed,family=list(gaussian(),multinomial()),transition=~Pacc,trstart=trstart,instart=instart,respst=resp,nst=2,ntimes=c(168,134,137))
+ll <- logLik(mod)
+
+cat("Test 4: ll is now larger than speedll, ie ll is better due to introduction of a covariate \n")
+cat("Test 4: ", ll,"\t", logl, "\n")
+cat("Test 4: ", ll > logl, "\n")
+
+
+#
+# TEST 5: use em to optimize the model
+#
+
+data(speed)
+
+# 2-state model on rt and corr from speed data set
+# with Pacc as covariate on the transition matrix
+# ntimes is used to specify the lengths of 3 separate series
+mod1 <- depmix(list(rt~1,corr~1),data=speed,transition=~Pacc,nstates=2,
+ family=list(gaussian(),multinomial("identity")),ntimes=c(168,134,137))
+# fit the model
+set.seed(3)
+fmod1 <- fit(mod1, verbose=FALSE)
+
+llEM <- logLik(fmod1)
+lltest <- -248.972219
+
+cat("Test 5: ", all.equal(c(lltest),c(llEM),check.att=FALSE), "(loglike EM optimized model for speed data) \n")
Property changes on: tags/release-1.3-2/tests/test1speed.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/tests/test1speed.Rout.save
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/tests/test2getsetpars.R
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/tests/test2getsetpars.Rout.save
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: tags/release-1.3-2/tests/test3responses.R
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the depmix-commits
mailing list