From: <den...@us...> - 2009-05-03 21:46:37
|
Revision: 204 http://rmol.svn.sourceforge.net/rmol/?rev=204&view=rev Author: denis_arnaud Date: 2009-05-03 21:46:25 +0000 (Sun, 03 May 2009) Log Message: ----------- 1. Moved the samples directory in a dedicated, installable, directory. 2. Added the R-msm package. Modified Paths: -------------- trunk/rmol/Makefile.am trunk/rmol/configure.ac trunk/rmol/samples/Makefile.am trunk/rmol/samples/sources.mk trunk/rmol/test/Makefile.am Added Paths: ----------- trunk/rmol/R/R-RM2.spec trunk/rmol/R/R-msm.spec trunk/rmol/R/msm/ trunk/rmol/R/msm/ChangeLog trunk/rmol/R/msm/DESCRIPTION trunk/rmol/R/msm/NAMESPACE trunk/rmol/R/msm/R/ trunk/rmol/R/msm/R/boot.R trunk/rmol/R/msm/R/constants.R trunk/rmol/R/msm/R/hmm-dists.R trunk/rmol/R/msm/R/hmm.R trunk/rmol/R/msm/R/msm.R trunk/rmol/R/msm/R/outputs.R trunk/rmol/R/msm/R/pearson.R trunk/rmol/R/msm/R/simul.R trunk/rmol/R/msm/R/utils.R trunk/rmol/R/msm/data/ trunk/rmol/R/msm/data/aneur.txt trunk/rmol/R/msm/data/bos.txt trunk/rmol/R/msm/data/cav.txt trunk/rmol/R/msm/data/fev.txt trunk/rmol/R/msm/data/psor.txt trunk/rmol/R/msm/inst/ trunk/rmol/R/msm/inst/NEWS trunk/rmol/R/msm/inst/doc/ trunk/rmol/R/msm/inst/doc/Rplots.pdf trunk/rmol/R/msm/inst/doc/msm-manual.pdf trunk/rmol/R/msm/man/ trunk/rmol/R/msm/man/MatrixExp.Rd trunk/rmol/R/msm/man/aneur.Rd trunk/rmol/R/msm/man/boot.msm.Rd trunk/rmol/R/msm/man/bos.Rd trunk/rmol/R/msm/man/cav.Rd trunk/rmol/R/msm/man/coef.msm.Rd trunk/rmol/R/msm/man/crudeinits.msm.Rd trunk/rmol/R/msm/man/deltamethod.Rd trunk/rmol/R/msm/man/ematrix.msm.Rd trunk/rmol/R/msm/man/fev.Rd trunk/rmol/R/msm/man/hazard.msm.Rd trunk/rmol/R/msm/man/hmm-dists.Rd trunk/rmol/R/msm/man/logLik.msm.Rd trunk/rmol/R/msm/man/lrtest.msm.Rd trunk/rmol/R/msm/man/medists.Rd trunk/rmol/R/msm/man/msm.Rd trunk/rmol/R/msm/man/odds.msm.Rd trunk/rmol/R/msm/man/pearson.msm.Rd trunk/rmol/R/msm/man/pexp.Rd trunk/rmol/R/msm/man/plot.msm.Rd trunk/rmol/R/msm/man/plot.prevalence.msm.Rd trunk/rmol/R/msm/man/plot.survfit.msm.Rd trunk/rmol/R/msm/man/plotprog.msm.Rd trunk/rmol/R/msm/man/pmatrix.msm.Rd trunk/rmol/R/msm/man/pmatrix.piecewise.msm.Rd trunk/rmol/R/msm/man/prevalence.msm.Rd trunk/rmol/R/msm/man/psor.Rd trunk/rmol/R/msm/man/qmatrix.msm.Rd trunk/rmol/R/msm/man/qratio.msm.Rd trunk/rmol/R/msm/man/scoreresid.msm.Rd trunk/rmol/R/msm/man/sim.msm.Rd trunk/rmol/R/msm/man/simmulti.msm.Rd trunk/rmol/R/msm/man/sojourn.msm.Rd trunk/rmol/R/msm/man/statetable.msm.Rd trunk/rmol/R/msm/man/summary.msm.Rd trunk/rmol/R/msm/man/surface.msm.Rd trunk/rmol/R/msm/man/tnorm.Rd trunk/rmol/R/msm/man/totlos.msm.Rd trunk/rmol/R/msm/man/transient.msm.Rd trunk/rmol/R/msm/man/viterbi.msm.Rd trunk/rmol/R/msm/src/ trunk/rmol/R/msm/src/Makevars trunk/rmol/R/msm/src/analyticp.c trunk/rmol/R/msm/src/doc/ trunk/rmol/R/msm/src/doc/Makefile trunk/rmol/R/msm/src/doc/Sweave-local.sty trunk/rmol/R/msm/src/doc/figures/ trunk/rmol/R/msm/src/doc/figures/general.pdf trunk/rmol/R/msm/src/doc/figures/hidden.pdf trunk/rmol/R/msm/src/doc/figures/illdeath.pdf trunk/rmol/R/msm/src/doc/figures/multistate.pdf trunk/rmol/R/msm/src/doc/figures/p2q1.pdf trunk/rmol/R/msm/src/doc/figures/p2q12.pdf trunk/rmol/R/msm/src/doc/figures/p3q12.pdf trunk/rmol/R/msm/src/doc/figures/p3q124.pdf trunk/rmol/R/msm/src/doc/figures/p3q1246.pdf trunk/rmol/R/msm/src/doc/figures/p3q135.pdf trunk/rmol/R/msm/src/doc/figures/p3q14.pdf trunk/rmol/R/msm/src/doc/figures/p3q16.pdf trunk/rmol/R/msm/src/doc/figures/p4q13569.pdf trunk/rmol/R/msm/src/doc/figures/p4q159.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_4_6_8_11_12_16.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_6_11_16.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_6_7_11_12.pdf trunk/rmol/R/msm/src/doc/figures/sampling.pdf trunk/rmol/R/msm/src/doc/msm-manual.Rnw trunk/rmol/R/msm/src/doc/msm.bib trunk/rmol/R/msm/src/hmm.c trunk/rmol/R/msm/src/hmm.h trunk/rmol/R/msm/src/lik.c trunk/rmol/R/msm/src/msm.h trunk/rmol/R/msm/src/pijt.c trunk/rmol/R/msm/tests/ trunk/rmol/R/msm/tests/analyticp.R trunk/rmol/R/msm/tests/boot.R trunk/rmol/R/msm/tests/debug.dat trunk/rmol/R/msm/tests/deriv-test.R trunk/rmol/R/msm/tests/deriv.R trunk/rmol/R/msm/tests/errors.R trunk/rmol/R/msm/tests/fev.R trunk/rmol/R/msm/tests/herrors.R trunk/rmol/R/msm/tests/hsim.R trunk/rmol/R/msm/tests/local.R trunk/rmol/R/msm/tests/misc.R trunk/rmol/R/msm/tests/miscnew.R trunk/rmol/R/msm/tests/pci.R trunk/rmol/R/msm/tests/pearson.R trunk/rmol/R/msm/tests/sim.R trunk/rmol/R/msm/tests/simple.R trunk/rmol/R/msm/tests/utils.R trunk/rmol/samples/ trunk/rmol/samples/sample1.csv trunk/rmol/samples/sample2.csv trunk/rmol/samples/sample3.csv trunk/rmol/samples/sample4.csv Removed Paths: ------------- trunk/rmol/samples/sample1.csv trunk/rmol/samples/sample2.csv trunk/rmol/samples/sample3.csv trunk/rmol/samples/sample4.csv trunk/rmol/test/samples/ Modified: trunk/rmol/Makefile.am =================================================================== --- trunk/rmol/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) +++ trunk/rmol/Makefile.am 2009-05-03 21:46:25 UTC (rev 204) @@ -25,7 +25,7 @@ EXTRA_DIST = # Build in these directories: -SUBDIRS = rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) $(TEST_DIR) +SUBDIRS = rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) samples $(TEST_DIR) # Configuration helpers Added: trunk/rmol/R/R-RM2.spec =================================================================== --- trunk/rmol/R/R-RM2.spec (rev 0) +++ trunk/rmol/R/R-RM2.spec 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,66 @@ +%global packname RM2 +%global packrel 1 + +Name: R-%{packname} +Version: 0.0 +Release: 1%{?dist} +Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}.tar.gz +License: GPL +URL: http://cran.r-project.org/src/contrib +Group: Applications/Engineering +Summary: Revenue Management and Pricing for R +BuildRequires: R-devel, tetex-latex +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +Requires(post): R +Requires(postun): R +Requires: R + +%description +RM2 is a simple package that implements functions +used in revenue management and pricing environments. + +%prep +%setup -q -c -n %{packname} + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library +%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname} +test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) +rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css + +%check +%{_bindir}/R CMD check %{packname} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%{_R_make_search_index} + +%postun +%{_R_make_search_index} + +%files +%defattr(-, root, root, -) +%dir %{_datadir}/R/library/%{packname} +#%%doc %{_datadir}/R/library/%{packname}/latex +#%%doc %{_datadir}/R/library/%{packname}/doc +#%%doc %{_datadir}/R/library/%{packname}/html +%doc %{_datadir}/R/library/%{packname}/man +%doc %{_datadir}/R/library/%{packname}/DESCRIPTION +#%%doc %{_datadir}/R/library/%{packname}/NEWS +#%%{_datadir}/R/library/%{packname}/CONTENTS +#%%{_datadir}/R/library/%{packname}/INDEX +%{_datadir}/R/library/%{packname}/NAMESPACE +#%%{_datadir}/R/library/%{packname}/Meta +%{_datadir}/R/library/%{packname}/R +#%%{_datadir}/R/library/%{packname}/R-ex +#%%{_datadir}/R/library/%{packname}/help + +%changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 +- Initial package creation Added: trunk/rmol/R/R-msm.spec =================================================================== --- trunk/rmol/R/R-msm.spec (rev 0) +++ trunk/rmol/R/R-msm.spec 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,70 @@ +%global packname msm +%global packrel 1 + +Name: R-%{packname} +Version: 0.8.2 +Release: 1%{?dist} +Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}.tar.gz +License: GPLv2 +URL: http://cran.r-project.org/src/contrib +Group: Applications/Engineering +Summary: Multi-state Markov and hidden Markov models in continuous time +BuildRequires: R-devel, tetex-latex, R-mvtnorm +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +Requires(post): R +Requires(postun): R +Requires: R + +%description +Functions for fitting general continuous-time Markov and hidden Markov +multi-state models to longitudinal data. Both Markov transition rates +and the hidden Markov output process can be modelled in terms of +covariates. A variety of observation schemes are supported, including +processes observed at arbitrary times, completely-observed processes, +and censored states. + +%prep +%setup -q -c -n %{packname} + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library +%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname} +test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) +rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css + +%check +%{_bindir}/R CMD check %{packname} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%{_R_make_search_index} + +%postun +%{_R_make_search_index} + +%files +%defattr(-, root, root, -) +%dir %{_datadir}/R/library/%{packname} +#%%doc %{_datadir}/R/library/%{packname}/latex +#%%doc %{_datadir}/R/library/%{packname}/doc +#%%doc %{_datadir}/R/library/%{packname}/html +%doc %{_datadir}/R/library/%{packname}/man +%doc %{_datadir}/R/library/%{packname}/DESCRIPTION +#%%doc %{_datadir}/R/library/%{packname}/NEWS +#%%{_datadir}/R/library/%{packname}/CONTENTS +#%%{_datadir}/R/library/%{packname}/INDEX +%{_datadir}/R/library/%{packname}/NAMESPACE +#%%{_datadir}/R/library/%{packname}/Meta +%{_datadir}/R/library/%{packname}/R +#%%{_datadir}/R/library/%{packname}/R-ex +#%%{_datadir}/R/library/%{packname}/help + +%changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 +- Initial package creation Added: trunk/rmol/R/msm/ChangeLog =================================================================== --- trunk/rmol/R/msm/ChangeLog (rev 0) +++ trunk/rmol/R/msm/ChangeLog 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,1095 @@ +2009-04-08 Chris Jackson <chr...@mr...> + + * man/msm.Rd: Documentation for qconstraint clarified. + + * R/outputs.R: Bug fix - interactions now expanded properly when + calling extractor functions for models with interactions between + covariates. + + * R/msm.R: Bug fix which affected bootstrap refitting in + pearson.msm, giving "Error in `$<-.data.frame`(`*tmp*`, + "pci.imp"..." + + * DESCRIPTION: Version 0.8.2 released. + +2009-04-03 Chris Jackson <chr...@mr...> + + * LaTeX sources for PDF manual included in src/doc to enable + msm to be approved as a Debian package. + +2008-07-25 Chris Jackson <chr...@mr...> + + * R/pearson.R: Bug fix, maxtimes was producing negative censoring + times. + + * DESCRIPTION: Version 0.8.1 released. + +2008-07-23 Chris Jackson <chr...@mr...> + + * R/msm.R: New option "pci" to msm, which automatically constructs + a model with piecewise-constant transition intensities which + change at the supplied times. + + * R/boot.R: Give an informative error in normal theory CIs when + SEs not available from fitted model. + +2008-07-22 Chris Jackson <chr...@mr...> + + * src/lik.c (GetOutcomeProb): HMM now applies to censored + outcomes, unless obstrue = 1. Thanks to Norm Good for the + suggestion. + +2008-04-15 Chris Jackson <chr...@mr...> + + * R/msm.R: deriv.test argument to msm removed. + + * src/lik.c: Bug fix in liksimple/derivsimple - the P matrix was + not being recalculated when the obstype changed between 1 and 2. + Thanks to Peter Jepsen for uncovering this. + +2008-03-31 Chris Jackson <chr...@mr...> + + * R/outputs.R: totlos.msm now computes total length of stay for + all states, not just transient states. New argument "end" added. + + * R/outputs.R: xlim argument added to plotprog.msm. + + * R/outputs.R: legend added to plot.prevalence.msm. + +2008-03-28 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.8 released. + +2008-03-18 Chris Jackson <chr...@mr...> + + * R/pearson.R: New file for the Pearson-type goodness-of-fit test. + + * data/heart.txt: Data "heart" renamed to "cav". + + * R/simul.R: any() bugs in simmisc.msm for simulating + misclassification models fixed + +2008-03-11 Chris Jackson <chr...@mr...> + + * R/outputs.R: logLik.msm degrees of freedom corrected for models + with parameter constraints. + + * R/outputs.R: New function "plot.survfit.msm" to plot + Kaplan-Meier estimate of survival probabilty compared with the + fitted survival probability from a model. + + * R/outputs.R: Allow customisable axis titles and line widths in + all plot functions. + +2008-03-03 Chris Jackson <chr...@mr...> + + * R/outputs.R: New function "plotprog.msm" to plot Kaplan-Meier + estimates of time to first occurrence of each state. Added + "survfit" and "Surv" imports from the "survival" package. + + * R/outputs.R: New likelihood ratio test function + "lrtest.msm". + +2008-03-03 Chris Jackson <chr...@mr...> + + * R/outputs.R: logLik method returns the log-likelihood, not the + minus log-likelihood. Thanks to Jay Rotella for the report. + +2008-02-27 Chris Jackson <chr...@mr...> + + * R/utils.R: Transformation bug fixed which caused rtnorm to hang + for extreme means. Thanks to Bj\xF6rn Bornkamp. + +2008-02-18 Chris Jackson <chr...@mr...> + + * R/boot.R: Simulate normal CIs using unreplicated parameters, so + that they work with the new release of mvtnorm. Thanks to Peter + Jepsen for the report. + +2007-12-12 Chris Jackson <chr...@mr...> + + * R/msm.R,src/lik.c: Score residuals implemented. + +2007-12-10 Chris Jackson <chr...@mr...> + + * R/utils.R: Quantile functions: uniroot() convergence tolerance + tightened to solve problems with obtaining quantiles for small + arguments. Thanks to Barbara Bredner for the report. + + * DESCRIPTION: Version 0.7.6 released. + +2007-11-21 Chris Jackson <chr...@mr...> + + * R/simul.R: Bug fix, "cur.t not found" error. + + * R/simul.R: Allow covariates on misclassification probabilities + in simulations + +2007-11-20 Chris Jackson <chr...@mr...> + + * R/msm.R: Don't give no-SEs warning when hessian=FALSE + + * R/simul.R: Handle only one observation per subject. + + * R/outputs.R: New internal function intervaltrans.msm to + determine set of allowed transitions in an interval. + + * DESCRIPTION: Version 0.7.5 released. + +2007-11-08 Chris Jackson <chr...@mr...> + + * R/outputs.R(qratio.se.msm): Bug fix for factor + covariates. Thanks to Peter Jepsen. + +2007-11-05 Chris Jackson <chr...@mr...> + + * R/boot.R (bootdata.trans.msm,bootdata.subject.msm), R/msm.R + (msm.form.data,msm.form.covdata): Handle factor covariates + properly when bootstrap refitting, by retaining the original + covariates (not the numeric contrasts) in the data. Thanks to + Peter Jepsen. + + * R/outputs.R: qmatrix.msm, ematrix.msm, sojourn.msm and + qratio.msm can now be called with ci="none", returning just the + matrix of estimates, with no CI. + +2007-11-02 Chris Jackson <chr...@mr...> + + * R/utils.R: MatrixExp now accepts a vector of t, in which case it + only needs to calculate the eigensystem once. + +2007-10-30 Chris Jackson <chr...@mr...> + + * R/utils.R: Bug fix in ppexp. Thanks to Mike Murphy. + + * msm-manual: More explanation of censored states versus censored + event times. + +2007-10-25 Chris Jackson <chr...@mr...> + + * src/hmm.c: New beta HMM outcome distribution. + + * src/lik.c: Ignore initprobs in HMMs if the true state is known + at the initial observation. + +2007-10-24 Chris Jackson <chr...@mr...> + + * src/lik.c: Handle censoring properly in Viterbi algorithm. + +2007-10-22 Chris Jackson <chr...@mr...> + + * R/boot.R(bootdata.subject.msm): Bug fix, wrong covariate matrix + was being read. Thanks to Peter Jepsen for the report. + + * msm-manual.pdf: Correction of algebraic typos in Viterbi + algorithm. + + * src/lik.c: Account for obstrue in Viterbi algorithm. + + * R/outputs.R: Allow Viterbi algorithm to be used to impute + censored states in data with censored states but no HMM. + +2007-10-18 Chris Jackson <chr...@mr...> + + * R/outputs.R(prevalence.msm,plot.prevalence.msm): Account for + arguments supplied to prevalence.msm when doing the plot. Thanks + to Peter Jepsen for the report. + +2007-10-01 Chris Jackson <chr...@mr...> + + * src/Makevars: CR endings removed to satisfy R CMD CHECK in R 2.6.0 + + * R/outputs.R(print.msm.est): test for CI using is.list(), since $ + on an atomic object fails in R 2.7.0 instead of returning NULL. + + * DESCRIPTION: Version 0.7.4 released. Use standardised license string. + +2007-08-15 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.7.3 released. + +2007-08-14 Chris Jackson <chr...@mr...> + + * R/boot.R: Handle obstype and obsmisc in bootstrap refitting, and + handle refitting of msm models where obstype, obsmisc and subject + vectors are calculated within the argument to msm. Thanks to + Peter Jepsen for the report. + + * R/boot.R, R/outputs.R: Add bootstrap handlers (both + nonparametric and normal-theory) for qmatrix.msm, ematrix.msm, + sojourn.msm, qratio.msm, pmatrix.piecewise.msm, totlos.msm, + prevalence.msm. + +2007-07-27 Chris Jackson <chr...@mr...> + + * src/analyticp.c: Bug fix: exponential of certain degenerate 5 + state intensity matrices was not being calculated properly. Thanks + to Ross Boylan for the report. + + * man/msm.Rd: Make clear that the initial values for constrained + parameters are taken from the first of the multiple initial values + supplied. Thanks to Ross Boylan. + +2007-06-30 Chris Jackson <chr...@mr...> + + * R/outputs.R(surface.msm): Bug fix: don't include auxiliary + parameters in HMMs. Thanks to Michael Sweeting. + +2007-06-29 Chris Jackson <chr...@mr...> + + * R/utils.R(MatrixExp), src/pijt.c(MatrixExp): Bug fix. When there + are complex eigenvalues, don't use the eigensystem method of + calculating the matrix exponential. Thanks to V\xE9ronique Bouchard. + +2007-06-05 Chris Jackson <chr...@mr...> + + * R/outputs.R(expected.msm): Bug fix, wrong risk set was being + calculated for user-specified "times". + + * R/outputs.R(observed.msm): Allow interpolation of observed + states using the midpoint of an interval. + + * R/outputs.R(pmatrix.msm), R/boot.R: Confidence intervals for P + matrix can now be calculated by simulating from multivariate + normal distribution of MLEs. + + * R/outputs.R(plot.prevalence.msm),man/plot.prevalence.msm.Rd: new + function for prevalence plots. + + * man/pmatrix.piecewise.msm.Rd: Example corrected to use four sets + of covariates. Thanks to Qing Wang. + + * DESCRIPTION,NAMESPACE: Added rmvnorm import from "mvtnorm" package. + +2007-05-31 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.7.2 released. + +2007-05-29 Chris Jackson <chr...@mr...> + + * R/outputs.R: Functions to calculate SEs and CIs for ematrix.msm + adapted to deal with multinomial logistic regression. CIs for + probabilities are calculated using delta method approximation to + variance of logit p, instead of log p as previously. + +2007-05-26 Chris Jackson <chr...@mr...> + + * R/utils.R: Truncated normal random sampling algorithm + improved to use the rejection method by Christian Robert. + Thanks to Vivek Roy for the suggestion. + +2007-05-25 Chris Jackson <chr...@mr...> + + * R/msm.R: Constraints on intensity covariate effects that some + effects are equal to other effects multiplied by -1 are now + allowed. + + * R/msm.R: Structural zeroes are allowed for initial state + occupancy probabilities. + + * inst/doc/msm-manual.pdf: Misclassification examples on heart + data changed so that individuals' first observations are not + misclassified. + +2007-05-21 Chris Jackson <chr...@mr...> + + * R/lik.c: Serious bug fix. Effects of covariates on outcome + probabilities in misclassification models (categorical HMMs) are + now estimated using multinomial logistic regressions, instead of + (incorrectly) independent univariate logistic regressions for each + probability. + + * R/msm.R, R/lik.c: Effects of covariates on initial state + probabilities in HMMs can now be estimated through multinomial + logistic regression. + +2007-05-13 Chris Jackson <chr...@mr...> + + * R/outputs.R, R/boot.R: New option "ci.boot" to prevalence.msm, a + helper to calculate bootstrap confidence limits for the expected + prevalences using "boot.msm". + + * R/msm.R, src/lik.c: New argument "obstrue" to msm, to allow some + observations to be observed without error in misclassification models. + +2007-05-11 Chris Jackson <chr...@mr...> + + * R/msm.R: Return derivatives in $deriv component of the msm + object after optimisation. Thanks to Ole Rummel. + +2007-04-18 Chris Jackson <chr...@mr...> + + * R/msm.R: Don't drop covariates on transition process which are + missing at the last observation for a patient, because they are + not used in the analysis. This has the consequences that output + from prevalence.msm may be different from earlier versions (0.7 or + earlier) if there are missing values in the data. Users are + advised to drop missing values from their data (if statistically + appropriate!) before using msm. + + * DESCRIPTION: Maintainer email address changed. + + * DESCRIPTION: Version 0.7.1 released. + +2007-04-05 Chris Jackson <chr...@im...> + + * R/outputs.R(viterbi.msm): Bug fix for models with + covariates. Thanks to Hongjie Wang. + + * R/outputs.R(prevalence.msm): Can now calculate expected + prevalences for models with piecewise-constant intensities, in the + same manner as pmatrix.piecewise.msm. + +2007-04-04 Chris Jackson <chr...@im...> + + * R/outputs.R(prevalence.msm): Bug fix, initstates was being + ignored. Thanks to Peter Jensen. + + * R/msm.R: Give a warning when the standard errors cannot be + calculated. + + * R/msm.R(msm.form.houtput): Bug fix for initprobs display with + only two states. + +2007-03-02 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm, qematrix.msm): Bug fix: When + center=FALSE, reported baseline intensity matrix should be + labelled as with covariates set to zero, not at their means. + Thanks to Ross Boylan. + +2007-02-09 Chris Jackson <chr...@im...> + + * src/lik.c: Return likelihood of zero for individuals with only + one observation in censoring and hidden models. Thanks to Jonathan + Williams for discovering the bug. + + * data/heart.txt: Age at transplant date corrected. Thanks to + Jonathan Williams. + +2006-11-21 Chris Jackson <chr...@im...> + + * R/msm.R: Initial state occupancy probabilities can now be + estimated. See new argument "est.initprobs" to msm. + + * DESCRIPTION: Version 0.7 released. + +2006-11-20 Chris Jackson <chr...@im...> + + * R/simul.R(sim.msm): Transpose error in bug fix from 0.6.4 + corrected. + + * R/outputs.R: Values of factor covariates are now supplied to + extractor functions in a sensible way, at last. Reordering bug + fixed with named covariate lists. + +2006-11-19 Chris Jackson <chr...@im...> + + * R/boot.R: New file. Implements bootstrap resampling for fitted + msm models. + + * R/outputs.R: Bootstrap confidence intervals available for + pmatrix.msm and totlos.msm. + + * R/outputs.R: pmatrix.msm now defaults to one time unit, instead + of forcing time unit to be explicitly given. + + * R/outputs.R: observed.msm function rewritten. Fixes bug in + calculating observed prevalence for state at maximum observed + time, reported by Jeremy Penn. It is also now much faster. + + * R/outputs.R: prevalence.msm is also adapted sensibly to handle + data where not all individuals start at a common time. + +2006-09-29 Chris Jackson <chr...@im...> + + * man/deltamethod.Rd: Example fixed to use correct covariance + matrix. Thanks to Andreas Beyerlein. + +2006-09-21 Chris Jackson <chr...@im...> + + * src/Makevars: PKG_LIBS fix to pass R CMD CHECK in R 2.4.0 + + * DESCRIPTION: Version 0.6.4 released. + +2006-09-12 Chris Jackson <chr...@im...> + + * R/simul.R(sim.msm) Bug fix: multiply covariates by baseline + intensities in the correct order. Also convert vector beta to + matrix. Thanks to Stephan Lenz for the report. + +2006-09-08 Chris Jackson <chr...@im...> + + * R/utils.R(rtnorm) Bug fix: use the correct components of + parameters which are vectors. Thanks to Jean-Baptiste Denis + for the report. + +2006-07-16 Chris Jackson <chr...@im...> + + * Rd/msm.Rd, inst/doc/msm-manual.pdf: Documentation correction - + the initial values of the qmatrix are with covariates at their + means in the data, not with the covariates at zero. This bug + has existed since version 0.5. + +2006-07-16 Chris Jackson <chr...@im...> + + * R/msm.R: Row and column names of crudeinits output retained from + qmatrix input. + +2006-06-29 Chris Jackson <chr...@im...> + + * Definition of initprobs corrected on manual p31. + +2006-06-28 Chris Jackson <chr...@im...> + + * References reinstated in the PDF manual. + + * DESCRIPTION: Version 0.6.3 released. + +2006-06-23 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.6.2 released. + +2006-06-21 Chris Jackson <chr...@im...> + + * msm.obs.to.fromto,msm.check.times: Support character subject + variables. Thanks to Danstan Bagenda for the report. + +2006-06-21 Chris Jackson <chr...@im...> + + * Analytically-calculated transition probability matrices + implemented for selected 3, 4 and 5 state models. These are + calculated in new file src/analyticp.c. New option "analyticp" in + msm() to revert to the old matrix exponential method. + Update to msm-manual.pdf describing this method. + +2006-06-20 Chris Jackson <chr...@im...> + + * R/simul.R(getobs.msm): Bug fix - Keep only one observation in + the absorbing state when absorbing state is not the highest state. + +2006-05-29 Chris Jackson <chr...@im...> + + * man/logLik.Rd: help page fixed to explain that this returns the + minus log likelihood. Thanks to Ole Rummel. + + * msm.R (likderiv.msm): bug fix - transformation of the + derivatives when all parameters are fixed was returning all NAs. + +2006-03-26 Chris Jackson <chr...@im...> + + * lik.c(Viterbi): Bug fix - don't ignore initprobs. Thanks to + Melanie Wall for reporting this. + + * DESCRIPTION: Version 0.6.1 released. + +2006-03-15 Chris Jackson <chr...@im...> + + * NAMESPACE: Import persp, plot and contour in from graphics. + + * msm.R (msm.check.times): Bug fix for factor subjects with empty + levels. Thanks to Jacques Gautrais. + +2006-01-04 Chris Jackson <chr...@im...> + + * msm.R (msm.form.data): use match(, unique()) to convert subject + to ordinal, not factor. Also do msm.check.times after dropping + missing data. Plus fix for missing obstime. + +2005-11-25 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.6 released. + +2005-11-17 Chris Jackson <chr...@im...> + + * R/outputs.R: New function surface.msm for surface plots of + likelihoods. + +2005-11-16 Chris Jackson <chr...@im...> + + * lik.c,pijt.c, etc.: Analytic derivatives of the likelihood + implemented for all models, apart from hidden Markov models or + models with censoring. New argument "use.deriv" to tell msm to + use these where appropriate. Thanks to Andrew Titman for the + debugging help. + + * The Dennis and Schnabel algorithm in the R function "nlm" can + now also be used to maximise the likelihood, as an alternative to + the algorithms in "optim". + +2005-11-11 Chris Jackson <chr...@im...> + + * msm-manual.pdf: definition of initial state probability f + corrected in hidden likelihood, equation 13. Thanks to Andrew + Titman. + +2005-11-08 Chris Jackson <chr...@im...> + + * man/deltamethod.Rd: Documentation of deltamethod clarified to + explain how to use user-defined variables within the formula. + +2005-10-11 Chris Jackson <chr...@im...> + + * Negative binomial hidden Markov model output distribution added. + + * DESCRIPTION: Version 0.5.2 released. + +2005-10-10 Chris Jackson <chr...@im...> + + * lik.c(Viterbi): Bug fix, wasn't handling Markov chains with + progressive and regressive states properly. Thanks to Rochelle + Watkins. + + * msm.R(msm.form.covdata): further fix for missing data. + +2005-10-1 Chris Jackson <chr...@im...> + + * msm.form.qmodel: Bug fix with gen.inits==TRUE and + censoring. Thanks to Jacques Gautrais. + +2005-07-27 Chris Jackson <chr...@im...> + + * sim.msm: collapse.covs fixed to handle covariate matrices with + one observation time. + + * msm.R(msm.form.covdata): bug fix for covariates in global + environment, not a data frame. This bug produced the error "Error + in 1:n : NA/NaN argument". + +2005-05-27 Chris Jackson <chr...@im...> + + * sim.msm: sample replaced by resample as in ?sample, to fix + simulations with small models. + + * msm.R: Fix for one-parameter models. (drop=FALSE in subsetting covmat) + +2005-05-25 Chris Jackson <chr...@im...> + + * utils.R: New functions (dpqr)pexp for the exponential + distribution with piecewise-constant rate. + + * utils.R: Bug fix: arguments lower.tail and log.p implemented for + truncated normal and measurement error distributions. + + * DESCRIPTION: Version 0.5.1 released. + +2005-05-23 Chris Jackson <chr...@im...> + + * tests/*: Tests are now fully automated. Outputs are compared + against known results using stopifnot(). + + * outputs.R(hazard.msm, odds.msm) Names "L95", "U95" changed to + "L","U" for generality. + +2005-05-20 Chris Jackson <chr...@im...> + + * msm.R: Data reorganised so that covariates are stored in a + matrix throughout. These are available from the model output as + cov for one per observation time, and covmat for one per time + difference. This fixes a bug which prevented covariates with + names such as "state", "time", "subject", among others, from being + used. + +2005-05-16 Chris Jackson <chr...@im...> + + * simul.R(sim.msm) Re-written. Fixes a bug in simulating from + models with time-dependent covariates, where not every covariate + change was accounted for. Uses new function rpexp to simulate + from the exponential distribution with piecewise-constant rate. + Thanks to Mike Sweeting for the bug report. + + * simul.R(sim.msm) Simulations now contain a censoring time at + maxtime, instead of the future absorption time. + + * simul.R(getobs.msm) Re-written, replacing ugly loops with + vectorised code. + +2005-04-11 Chris Jackson <chr...@im...> + + * man/simul.Rd: clarified that qmatrix is with covariates set to + zero. Thanks to Anne Presanis. + +2005-04-11 Chris Jackson <chr...@im...> + + * outputs.R(pmatrix.piecewise.msm): Bug fix for times of length 1. + Thanks to Anne Presanis. + +2005-03-09 Chris Jackson <chr...@im...> + + * pijt.c(Pmat): Don't recalculate pii within j loop. + +2005-03-08 Chris Jackson <chr...@im...> + + * pijt.c: New function Eigen. MatrixExp merged into one function. + +2005-03-07 Chris Jackson <chr...@im...> + + * msm.R(msm): Argument "hessian" added to msm. Covariance matrix + is set to NULL instead of a string when SEs not available. + + * msm.R(msm): Confidence limits of fixed parameters set to NA, not + zero width. + +2005-03-06 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.5 released. This is a major re-write, so + instead of a detailed change log, the NEWS entry is reproduced + below. + +Version 0.5 (2005-03-06) +----------- + +* Major update. Much of the internal R and C code has been re-written. + +* General continuous-time hidden Markov models can now be fitted with + msm, as well as misclassification models. Allowed response + distributions conditionally on the hidden state include categorical, + normal, Poisson, exponential and others. See the new "hmodel" + argument. Misclassification models can either be fitted in the old + style using an ematrix, or using a general HMM with a categorical + response distribution. Covariates can be fitted to many of the new + hidden response processes via generalized regressions. See + "hcovariates", "hcovinits" arguments. + +* Per-observation observation schemes, generalising the "exacttimes" + and "death" concepts. An optional new variable in the data can + specify whether each observation is a snapshot of the process, an + exactly-observed transition time, or a death state. Observations + are allowed to be at identical times, for example, a snapshot + followed instantly by an exact transition time. + +* Various syntax changes for cleaner moder specification. + + - Instead of 0/1 indicators, qmatrix and ematrix should contain the + initial values for the transition intensity / misclassification + matrix. These matrices can be named with names for the states of + the Markov chain. + + - The inits argument is abolished. Initial values are estimated + automatically if the new argument to msm "gen.inits = TRUE" is + supplied. This uses the initial values calculated by + crudeinits.msm. + + - misc no longer needs to be specified if an ematrix is supplied. + + - fixedpars=TRUE fixes all parameters, or specific parameters can + be fixed as before. + + - crudeinits.msm takes a state ~ time formula instead of two + separate state, time arguments, for consistency with the msm + function. + + - Initial values for covariate effects on transition rates / + misclassification probabilities are assumed to be zero unless + otherwise specified by the new "covinits" / "misccovinits" argument. + +* Support for 'from-to' style data has been withdrawn. Storing data in + this format is inadvisable as it destroys the longitudinal nature of + the data. + +* Speed improvements. The algorithm for calculating the likelihood + for non-hidden multi-state models has changed so that the matrix + exponential of the Q matrix is only calculated once for each time + difference / covariate combination. Therefore, users should see + speed improvements for data where the same from-state, to-state, + time difference, covariates combination appears many times. + +* Confidence intervals are now presented instead of standard errors + for uncertainty in parameter estimates. + +* New method of calculating matrix exponentials when the eigenvector + matrix is not invertible. It now uses the more robust method of + Pade approximants with scaling and squaring, instead of power + series. Faster LAPACK routines are now used for matrix inversion. + +* covmatch argument to msm has been abolished. To take a + time-dependent covariate value from the end of the relevant + transition instead of the default start, users are expected to + manipulate their data accordingly before calling msm, shifting the + positions of the covariate back by one within each subject. + +* Syntax changes for simmulti.msm. + +Bug fixes +--------- + +* The likelihood is now calculated correctly for individuals with + censored intermediate states, as well as censored initial and final states. + Thanks to Michael Sweeting for reporting this. + +* hazard.scale and odds.scale were interpreted wrongly in hazard.msm + and odds.msm respectively. + +* time-dependent covariate values now taken from the start instead of + end of the transition under hidden Markov models. + + +2005-01-28 Chris Jackson <chr...@im...> + + * src/lik.c (GetCensoredPObsTrue): Censored outcomes are now + assumed to be not misclassified. + + * msm.R(msm.form.censor): Bug fix - transient states were detected + incorrectly. + + * src/pijt.c: Bug fix. P matrix calculation for misclassification + models was ignoring exacttimes. + + * src/lik.c: Bug fix. Ignore death when exacttimes = TRUE. + + * DESCRIPTION: Version 0.4.1 released. + +2005-01-07 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.4 released. + +2005-01-06 Chris Jackson <chr...@im...> + + * msm/R/msm.process.covs: Bug fix - covariates were not being + centered. Thanks to Andrew Titman. + +2004-12-29 Chris Jackson <chr...@im...> + + Support added for censored observations. + + * src/lik.c: Bug fix. Don't ignore exacttimes for + misclassification models. + + Fixes in documentation. Thanks to Ross Boylan. + +2004-09-18 Chris Jackson <chr...@im...> + + * man: Rd syntax errors fixed to pass R CMD CHECK under 2.0.0 * + + * msm-manual: Reference to the PDF manual for msm made more + prominent. + + * DESCRIPTION: Version 0.3.3 released. + +2004-06-23 Chris Jackson <chr...@im...> + + * msm.R(msm.process.covs): Bug fix, constraints were not being + calculated properly when some covariates were constrained and some + were not. Thanks to Mike Sweeting. + +2004-06-01 Chris Jackson <chr...@im...> + + * msm-manual: Correction - heartmiscsex.msm is actually run using + default Nelder-Mead optimization, not BFGS. + +2004-05-13 Chris Jackson <chr...@im...> + + * R/outputs.R: plot.msm now plots survival curves in different + colours as well as different line types. + +2004-05-11 Chris Jackson <chr...@im...> + + * R/simul.R: simmulti.msm now returns a data frame, as it should + do. + +2004-04-23 Chris Jackson <chr...@im...> + + * New argument "start" in simmulti.msm to give the starting state + for each individual. Thanks to Stephan Lenz for the suggestion. + + +2004-03-25 Chris Jackson <chr...@im...> + + * NEWS file moved to inst directory, so that it ends up in the + root directory of binary installs. Leave ChangeLog in the source + package. + + * DESCRIPTION: Version 0.3.2 released. + +2004-03-24 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm): Bug fix - only say "covariates set to + their means" in the output if there actually are any covariates. + + * msm-manual.pdf: Hidden Markov model theory moved to straight + after general model theory, general cleanups. + +2004-03-23 Chris Jackson <chr...@im...> + + * msm-manual.pdf: R code examples rewritten using Sweave. + Examples run again with different death assumption, most estimates + are negligibly different. Misclassification model examples + corrected to include death. Example of plot.msm added. This is + not distributed as a vignette, as the msm model examples take a + long time to fit. + +2004-03-22 Chris Jackson <chr...@im...> + + * R/simul.R(simmulti.msm, getobs.msm): tunit argument abolished + and death times assumed to be known exactly. + + * src/lik.c(fillparvec): Bug fix. Bounds checking on vector of + indices of fixed parameters. Thanks to Ross Boylan. + +2004-03-21 Chris Jackson <chr...@im...> + + * R/msm.R, src/lik.c: tunit argument is now abolished (with + warning given). Death states are assumed to have exact entry + times, not within one day. This is cleaner and more logical, as + in longitudinal studies all observations are usually accurate to + one basic time unit, not just deaths. + + * R/msm.R, src/lik.c: More than one death state is now supported. + A death state has exact entry time, with an unknown transient + state at the previous instant. Thanks to Jean-Luc Bulliard for + suggesting this. + + * R/msm.R(msm.check.times): Just give a warning if a subject only + has one observation, no need to die. + + * R/msm.R(lik.msm): Bug fix. set diagonal to 0 when calculating + number of misclassified states nms, in case user has given non + zero diagonal entries in ematrix. + + * (various) Changes made so that R CMD CHECK passes with R 1.9.0 + alpha: codoc mismatches and PACKAGE argument in .C() + +2003-10-14 Chris Jackson <chr...@im...> + + * src/pijt.c(MatrixExpSeries): Bug fix. Don't overwrite the matrix + A, as it is needed after the function exits. This had led to wrong + results when exacttimes = TRUE and the intensity matrix had + repeated eigenvalues. + + * src/lik.c(liksimple, liksimple_fromto, UpdateLik): Don't ignore + death argument when exacttimes = TRUE. + + * R/msm.R(msm.check.times): Use table instead of tapply to count + the number of observations per subject. Fixes further problems + with running out of memory. + + * DESCRIPTION: Version 0.3.1 released. + +2003-09-29 Chris Jackson <chr...@im...> + + * R/outputs.R: Debugging print statements removed from + pmatrix.piecewise.msm + + * msm-manual.pdf: Version number added. + + * DESCRIPTION: Version 0.3 released. + +2003-09-26 Chris Jackson <chr...@im...> + + * src/lik.c, src/pijt.c: Allocate memory using S_alloc, not + Calloc. Solves the problem of running out of memory for large + datasets. + + * R/outputs.R(observed.msm): Fixed a bug with looping over a + factor patient ID, which caused prevalence.msm to fail. + +2003-09-25 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm) Don't draw ASCII underlines under + "Multi-state Markov models" banner - looks ugly in proportional + font. + + * R/msm.R: nmiscs model attribute (number of misclassification + probabilities) changed to nmisc for compatibility with C code. + + * src/lik.c(liksimple, liksimple_fromto): Bug fixed in the + likelhood calculation for non-misclassified reversible models with + death time known within one day. The error assumed the unobserved + states on the day before death could only be states greater or + equal than the previously observed state. This is not true for + reversible models. + + * man/summary.msm.Rd: usage and argument lists made consistent, + satisfying new R CMD CHECK. + +2003-09-24 Chris Jackson <chr...@im...> + + * R/msm.R, R/outputs.R, src/lik.c: A new argument "qconstraint" to + msm now allow equality constraints between baseline transition + intensities. A similar argument "econstraint" allows equality + constraints between misclassification probabilities. Thanks to + Mike Sweeting and Ross Boylan for suggesting this. + +2003-09-23 Chris Jackson <chr...@im...> + + * src/pijt.c(pijt): Bug fixed in the likelihood calculation for + exact transition times with reversible models. The error assumed + Prr(t) was always equal to exp(-qrr t), when this is only + satisfied for a state r which is only visited once. + +2003-06-30 Chris Jackson <chr...@im...> + + * R/outputs.R(qematrix.msm): Didn't work when the baseline rates + or probabilities were fixed to zero, bug fixed (now uses + x$model$qvector to test whether a transition is allowed, not + x$Qmatrices$logbaseline). + + * R/outputs.R: New function - pmatrix.piecewise.msm, for + calculating P-matrices for processes with non-homogeneous but + piecewise-constant intensities. Thanks to Mike Sweeting for + suggesting this. + + * DESCRIPTION: Version 0.2.2 released + +2003-06-25 Chris Jackson <chr...@im...> + + * R/msm.R (msm.check.model): Bug fix - was reporting the wrong + subject numbers when there were disallowed transitions in the + data. Thanks to Stephan Lenz for spotting this. + +2003-06-20 Chris Jackson <chr...@im...> + + * R/outputs.R: Covariates argument is now checked that it is a + list, to avoid ugly warnings in R 1.7.0 + +2003-06-16 Chris Jackson <chr...@im...> + + * R/msm.R (msm.form.output): Died when only one parameter in the + model, fixed by coercing covmat to matrix. + +2003-06-03 Chris Jackson <chr...@im...> + + * inst/doc/msm-manual.pdf: Edits to manual, e.g. correction of + covariates formulae to include baseline intensity, lots of typos + corrected. + + * DESCRIPTION: Version 0.2.1 released + +2003-04-29 Chris Jackson <chr...@im...> + + * R/simul.R: Bug fix in simmulti.msm: didn't work for one + covariate. Thanks to Mike Sweeting for spotting this. + + * R/msm.R: Subject identification variable is now allowed to be + factor or character. Thanks to Pablo Emilio Verde for the + suggestion. + + * R/msm.R: msm.check.times also checks whether all the + observations on a subject are adjacent in the data set. + +2003-03-20 Chris Jackson <chr...@im...> + + * R/R: Bug fix in msm.check.times. Thanks to Pablo Emilio Verde + for helping to find this. + +2003-02-20 Chris Jackson <chr...@im...> + + * R/simul.R: Bug fix in getobs.msm: exact death times were + ignored. (obstimes[i] replaced by sim$times[j+1]). + +2003-01-05 Chris Jackson <chr...@ic...> + + * DESCRIPTION: Version 0.2 released. + + * inst/doc/msm-manual.pdf: PDF manual completed. + +2003-01-03 Chris Jackson <chr...@ic...> + + * man: Heart transplant data added as an example data set + + * man: Aesthetic cleanups of all help pages + + * R/msm.R: New function crudeinits.msm to estimate a set of + initial values for transition rates by assuming data represent + the only transition times. + + * R/msm.R: New function statetable.msm to calculate frequencies of + successive state pairs in data. + + * R/outputs.R: Methodology changed for prevalencemisc.msm to make + it more similar to prevalence.msm, avoiding confusion. Observed + counts now common to both, and separated out into a new function + observed.msm. Then prevalencemisc.msm (and the internal C onestep) + was removed and prevalence.msm was made general to both + misclassification and non-misclassification models. + +2002-12-18 Chris Jackson <chr...@ic...> + + * src/lik.c: Bugfix. nms changed to nst in likelihood-calculating + functions. Fixes failure to calculate the likelihood where some + states where some states are observed without error, but are not + death states (Thanks to Martyn Plummer). + + * R/simul.R: Bugfix in getobs.msm, which led to the entrance to + not being observed for models with absorbing states. + +2002-12-09 Chris Jackson <chr...@ic...> + + * R/outputs.R: new function odds.msm to calculate odds ratios for + misclassification probabilities. + + * R/outputs.R: new function ematrix.msm. Calls new internal + functions, including qematrix.msm. + +2002-12-03 Chris Jackson <chr...@ic...> + + * R/outputs.R: new function qratio.msm for estimating ratios of + intensities and (via new function qratio.se.msm) their standard + errors. Documentation in man/qratio.msm.Rd. + +2002-12-02 Chris Jackson <chr...@ic...> + + * R/outputs.R: new internal function qmatrix.diagse.msm + + * R/msm.R Null components of msm objects removed, e.g. + misclassification parameters for non-misclassification models. + +2002-11-27 Chris Jackson <chr...@ic...> + + * R: File msm.R split into msm.R, outputs.R and utils.R. + + * R/msm.R. New functions absorbing.msm and transient.msm which + give the indices of the absorbing or transient states of the model. + + * R/msm.R. (plot.msm) Now accepts a "covariates" argument for + covariates at which to evaluate the survival probabilities. + + * R/msm.R. Functions which operate on msm objects now have the + msm object argument named "x", instead of "msm", for consistency. + + * man/qmatrix.msm.Rd, man/pmatrix.msm.Rd, man/sojourn.msm.Rd. Updated + documentation. + + * R/msm.R (msm). The contents of msm objects has been + reorganised. The first component of Qmatrices is now called + "logbaseline" and gives the estimates of the log intensites as + returned from the optimisation. Components "qcenter" and + "ecenter" are removed, as they were named confusingly. The + component 'Pmatrix' is also removed, as it is obsoleted by the + function 'pmatrix.msm'. New component 'foundse' is a logical + indicating whether the Hessian is positive definite, i.e. whether + standard errors are available. + + * R/msm.R (sojourn.msm) Function rewritten to allow a given set of + covariate values, using the new qmatrix.msm. Now takes a fitted + msm model as its argument, and the component "mean" in the return + is changed to "estimate". + + * R/msm.R (qmatrix.msm). New function to compute transition + intensity matrix at given covariate values. + + * R/msm.R (pmatrix.msm). New function to compute transition + probability matrix at given covariate values. + + * R/simul.R (simmulti.msm): Check for ordered patient IDs, and + sort input data if not ordered. Also check for duplicated + observation times and remove them. Default for 'death' argument + changed to FALSE for consistency with msm(). Give column names to + the simulated data. + +2002-11-13 Chris Jackson <chr...@ic...> + + * R/msm.R: New function msm.check.qmatrix to test for consistency + of Markov chain intensity matrices. + + * R/msm.R, man/totlos.Rd: New function totlos.msm to estimate total length of stay in a + state, with documentation. + + * src/lik.c, src/pijt.c: Unused and uninitialised variables fixed so the library builds + cleanly with -Wall. + +2002-11-08 Chris Jackson <chr...@ic...> + + * src/lik.c: Debugging print statements removed from onestep + + * msm_0.1.tar.gz: First release Added: trunk/rmol/R/msm/DESCRIPTION =================================================================== --- trunk/rmol/R/msm/DESCRIPTION (rev 0) +++ trunk/rmol/R/msm/DESCRIPTION 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,18 @@ +Package: msm +Version: 0.8.2 +Date: 2009-04-08 +Title: Multi-state Markov and hidden Markov models in continuous time +Author: Christopher Jackson <chr...@mr...> +Maintainer: Christopher Jackson <chr...@mr...> +Description: Functions for fitting general continuous-time Markov and + hidden Markov multi-state models to longitudinal data. Both + Markov transition rates and the hidden Markov output process + can be modelled in terms of covariates. A variety of + observation schemes are supported, including processes observed + at arbitrary times, completely-observed processes, and censored + states. +License: GPL-2 +Imports: survival,mvtnorm +Packaged: 2009-04-08 19:03:15 UTC; chris +Repository: CRAN +Date/Publication: 2009-04-14 17:32:26 Added: trunk/rmol/R/msm/NAMESPACE =================================================================== --- trunk/rmol/R/msm/NAMESPACE (rev 0) +++ trunk/rmol/R/msm/NAMESPACE 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,92 @@ +useDynLib(msm) + +export( +absorbing.msm, +boot.msm, +coef.msm, +contour.msm, +crudeinits.msm, +deltamethod, +ematrix.msm, +hazard.msm, +image.msm, +MatrixExp, +msm, +logLik.msm, +lrtest.msm, +odds.msm, +pearson.msm, +persp.msm, +plot.msm, +plotprog.msm, +plot.prevalence.msm, +plot.survfit.msm, +pmatrix.msm, +pmatrix.piecewise.msm, +prevalence.msm, +qmatrix.msm, +qratio.msm, +scoreresid.msm, +sim.msm, +simmulti.msm, +sojourn.msm, +statetable.msm, +summary.msm, +surface.msm, +totlos.msm, +transient.msm, +viterbi.msm, +hmmCat, +hmmIdent, +hmmUnif, +hmmNorm, +hmmLNorm, +hmmExp, +hmmGamma, +hmmWeibull, +hmmPois, +hmmBinom, +hmmTNorm, +hmmMETNorm, +hmmMEUnif, +hmmNBinom, +hmmBeta, +dtnorm, +ptnorm, +qtnorm, +rtnorm, +dmenorm, +pmenorm, +qmenorm, +rmenorm, +dmeunif, +pmeunif, +qmeunif, +rmeunif, +dpexp, +ppexp, +qpexp, +rpexp +) + +importFrom(graphics, plot) +importFrom(graphics, persp) +importFrom(graphics, contour) +importFrom(graphics, image) +importFrom(stats, coef) +importFrom(mvtnorm, rmvnorm) +importFrom(survival, Surv) +importFrom(survival, survfit) + +S3method(print, msm) +S3method(summary, msm) +S3method(plot, msm) +S3method(contour, msm) +S3method(persp, msm) +S3method(image, msm) +S3method(coef, msm) +S3method(logLik, msm) +S3method(print, hmodel) +S3method(print, hmmdist) +S3method(print, msm.est) +S3method(print, pearson.msm) Added: trunk/rmol/R/msm/R/boot.R =================================================================== --- trunk/rmol/R/msm/R/boot.R (rev 0) +++ trunk/rmol/R/msm/R/boot.R 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,247 @@ +### Take a bootstrap sample from the data contained in a fitted msm +### model. Sample pairs of consecutive observations, i.e. independent +### transitions. Not applicable if model is hidden or some states are +### censored. + +bootdata.trans.msm <- function(x) { + dat <- if (!is.null(x$data.orig)) x$data.orig else x$data + subj.num <- match(dat$subject, unique(dat$subject)) + nextsubj <- c(subj.num[2:length(subj.num)], Inf) + lastsubj <- subj.num != nextsubj + inds <- sample(which(!lastsubj), replace=TRUE) + data.boot <- as.data.frame(matrix(nrow=length(inds)*2, ncol=length(dat$covlabels.orig) + 4)) + state.name <- deparse(as.list(x$call$formula)[[2]]) + time.name <- deparse(as.list(x$call$formula)[[3]]) + colnames(data.boot) <- c("subject.name", time.name, state.name, "obstype.name", dat$covlabels.orig) + data.boot[,state.name] <- as.vector(rbind(dat$state[inds], dat$state[inds+1])) + # in the bootstrap data, label each transition as being from a different subject + data.boot[,"subject.name"] <- rep(seq(along=inds), each=2) + data.boot[,time.name] <- as.vector(rbind(dat$time[inds], dat$time[inds+1])) + data.boot[,"obstype.name"] <- as.vector(rbind(dat$obstype.obs[inds], dat$obstype.obs[inds+1])) + for (j in dat$covlabels.orig) { + frominds <- seq(1, 2*length(inds)-1, 2) + data.boot[frominds, j] <- data.boot[frominds+1,j] <- dat$cov.orig[inds, j] + if (dat$covdata$covfactor[j]) + data.boot[,j] <- factor(data.boot[,j], labels=levels(dat$cov.orig[,j])) + } + colnames(data.boot) <- gsub("factor\\((.+)\\)", "\\1", colnames(data.boot)) + data.boot +} + +### Take a bootstrap sample from the data contained in a fitted msm +### model. Sample subjects. Used for hidden models or models with +### censoring, in which the transitions within a subject are not +### independent. + +bootdata.subject.msm <- function(x) { + dat <- if (!is.null(x$data.orig)) x$data.orig else x$data + subj.num <- match(dat$subject, unique(dat$subject)) + subjs <- sample(unique(subj.num), replace=TRUE) + inds <- new.subj <- NULL + for (i in seq(along=subjs)) { + subj.inds <- which(subj.num == subjs[i]) + inds <- c(inds, subj.inds) + new.subj <- c(new.subj, rep(i, length(subj.inds))) + } + data.boot <- as.data.frame(matrix(nrow=length(inds), ncol=length(dat$covlabels.orig) + 5)) + state.name <- deparse(as.list(x$call$formula)[[2]]) + time.name <- deparse(as.list(x$call$formula)[[3]]) + colnames(data.boot) <- c("subject.name", time.name, state.name, "obstype.name", "obstrue.name", dat$covlabels.orig) + data.boot[,"subject.name"] <- new.subj + data.boot[,time.name] <- dat$time[inds] + data.boot[,state.name] <- dat$state[inds] + data.boot[,"obstype.name"] <- dat$obstype[inds] + data.boot[,"obstrue.name"] <- dat$obstrue[inds] + for (j in dat$covlabels.orig) { + data.boot[, j] <- dat$cov.orig[inds, j] + if (dat$covdata$covfactor[j]){ + data.boot[,j] <- factor(data.boot[,j], labels=levels(dat$cov.orig[,j])) + } + } + colnames(data.boot) <- gsub("factor\\((.+)\\)", "\\1", colnames(data.boot)) + data.boot +} + +### Given a fitted msm model, draw a bootstrap dataset, refit the +### model, and optionally compute a statistic on the refitted model. +### Repeat B times, store the results in a list. +### msm objects tend to be large, so it is advised to compute a statistic on them by specifying "stat", instead +### of using this function to return a list of refitted msm objects. +### To compute more than one statistic, specify, e.g. stat=function(x)list(stat1(x),stat2(x)) + +### Some of the arguments to the msm call might be user-defined objects. +### e.g. qmatrix, ematrix, hmodel, ... +### Put in help file that these must be in the working environment. + +### a) if call supplied as factor(), strip factor() from name. + +boot.msm <- function(x, stat=pmatrix.msm, B=1000, file=NULL){ + boot.list <- vector(B, mode="list") + if (!is.null(x$call$subject)) x$call$subject <- substitute(subject.name) + if (!is.null(x$call$obstype)) x$call$obstype <- substitute(obstype.name) + if (!is.null(x$call$obstrue)) x$call$obstrue <- substitute(obstrue.name) + for (i in 1:B) { + boot.data <- if (x$hmodel$hidden || x$cmodel$ncens) bootdata.subject.msm(x) else bootdata.trans.msm(x) + x$call$data <- substitute(boot.data) + boot.list[[i]] <- try(eval(x$call)) + if (!is.null(stat)) + boot.list[[i]] <- stat(boot.list[[i]]) + if (!is.null(file)) save(boot.list, file=file) + } + boot.list +} + +### Utilities for calculating bootstrap CIs for particular statistics + +qematrix.ci.msm <- function(x, covariates="mean", intmisc="intens", sojourn=FALSE, cl=0.95, B=1000) { + q.list <- boot.msm(x, function(x)qematrix.msm(x=x, covariates=covariates, intmisc=intmisc)$estimates, B) + q.array <- array(unlist(q.list), dim=c(dim(q.list[[1]]), length(q.list))) + q.ci <- apply(q.array, c(1,2), function(x)(c(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)), sd(x)))) + q.ci <- aperm(q.ci, c(2,3,1)) + if (sojourn) { + soj.array <- apply(q.array, 3, function(x) -1/diag(x)) + soj.ci <- apply(soj.array, 1, function(x)(c(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)), sd(x)))) + list(q=q.ci, soj=soj.ci) + } + else q.ci +} + +qratio.ci.msm <- function(x, ind1, ind2, covariates="mean", cl=0.95, B=1000) { + q.list <- boot.msm(x, function(x)qratio.msm(x=x, ind1=ind1, ind2=ind2, covariates=covariates)["estimate"], B) + q.vec <- unlist(q.list) + c(quantile(q.vec, c(0.5 - cl/2, 0.5 + cl/2)), sd(q.vec)) +} + +pmatrix.ci.msm <- function(x, t, covariates="mean", cl=0.95, B=1000) { + p.list <- boot.msm(x, function(x)pmatrix.msm(x=x, t=t, covariates=covariates,ci="none"), B) + p.array <- array(unlist(p.list), dim=c(dim(p.list[[1]]), length(p.list))) + p.ci <- apply(p.array, c(1,2), function(x)(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)))) + aperm(p.ci, c(2,3,1)) +} + +pmatrix.piecewise.ci.msm <- function(x, t1, t2, times, covariates="mean", cl=0.95, B=1000) { + p.list <- boot.msm(x, function(x)pmatrix.piecewise.msm(x=x, t1=t1, t2=t2, times=times, covariates=covariates,ci="none"), B) + p.array <- array(unlist(p.list), dim=c(dim(p.list[[1]]), length(p.list))) + p.ci <- apply(p.array, c(... [truncated message content] |