CRAN Package Check Results for Package surveillance

Last updated on 2024-10-04 02:49:28 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.23.1 48.61 453.80 502.41 OK
r-devel-linux-x86_64-debian-gcc 1.24.0 26.92 297.93 324.85 OK
r-devel-linux-x86_64-fedora-clang 1.24.0 698.51 NOTE
r-devel-linux-x86_64-fedora-gcc 1.24.0 694.27 ERROR
r-devel-windows-x86_64 1.24.0 44.00 279.00 323.00 NOTE --no-vignettes
r-patched-linux-x86_64 1.23.1 51.04 428.17 479.21 NOTE
r-release-linux-x86_64 1.24.0 37.82 420.82 458.64 NOTE
r-release-macos-arm64 1.24.0 229.00 NOTE
r-release-macos-x86_64 1.24.0 396.00 NOTE
r-release-windows-x86_64 1.24.0 50.00 256.00 306.00 NOTE --no-vignettes
r-oldrel-macos-arm64 1.24.0 223.00 NOTE
r-oldrel-macos-x86_64 1.24.0 411.00 NOTE
r-oldrel-windows-x86_64 1.24.0 54.00 294.00 348.00 NOTE --no-vignettes

Check Details

Version: 1.24.0
Check: installed package size
Result: NOTE installed size is 6.5Mb sub-directories of 1Mb or more: R 1.7Mb doc 2.3Mb Flavors: r-devel-linux-x86_64-fedora-clang, r-release-macos-arm64, r-release-macos-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64

Version: 1.24.0
Check: examples
Result: ERROR Running examples in ‘surveillance-Ex.R’ failed The error most likely occurred in: > ### Name: algo.hmm > ### Title: Hidden Markov Model (HMM) method > ### Aliases: algo.hmm > ### Keywords: classif > > ### ** Examples > > #Simulate outbreak data from HMM > set.seed(123) > counts <- sim.pointSource(p = 0.98, r = 0.8, length = 3*52, + A = 1, alpha = 1, beta = 0, phi = 0, + frequency = 1, state = NULL, K = 1.5) > > ## Not run: > ##D #Do surveillance using a two state HMM without trend component and > ##D #the effect of the harmonics being the same in both states. A sliding > ##D #window of two years is used to fit the HMM > ##D surv <- algo.hmm(counts, control=list(range=(2*52):length(counts$observed), > ##D Mtilde=2*52,noStates=2,trend=FALSE, > ##D covEffectsEqual=TRUE,extraMSMargs=list())) > ##D plot(surv,legend.opts=list(x="topright")) > ## End(Not run) > > if (require("msm")) { + #Retrospective use of the function, i.e. monitor only the last time point + #but use option saveHMMs to store the output of the HMM fitting + surv <- algo.hmm(counts,control=list(range=length(counts$observed),Mtilde=-1,noStates=2, + trend=FALSE,covEffectsEqual=TRUE, saveHMMs=TRUE)) + + #Compute most probable state using the viterbi algorithm - 1 is "normal", 2 is "outbreak". + viterbi.msm(surv$control$hmms[[1]])$fitted + + #How often correct? + tab <- cbind(truth=counts$state + 1 , + hmm=viterbi.msm(surv$control$hmm[[1]])$fitted) + table(tab[,1],tab[,2]) + } Loading required package: msm i=1 (out of 1) *** caught segfault *** address 0x1, cause 'memory not mapped' Traceback: 1: Ccall.msm(params, do.what = "lik", ...) 2: fn(par, ...) 3: (function (par) fn(par, ...))(c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0)) 4: optim(method = "BFGS", control = list(), par = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0), fn = function (params, ...) { assign("nliks", get("nliks", msm.globals) + 1, envir = msm.globals) args <- list(...) w <- args$msmdata$subject.weights if (!is.null(w)) { lik <- Ccall.msm(params, do.what = "lik.subj", ...) sum(w * lik) } else Ccall.msm(params, do.what = "lik", ...)}, hessian = TRUE, gr = function (params, ...) { w <- list(...)$msmdata$subject.weights if (!is.null(w)) { deriv <- Ccall.msm(params, do.what = "deriv.subj", ...) apply(w * deriv, 2, sum) } else Ccall.msm(params, do.what = "deriv", ...)}, msmdata = list(mf = list(cos1t = c(1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -1.60812264967664e-16, -0.120536680255323, -0.239315664287557, -0.354604887042535, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240795, -0.568064746731156, -0.464723172043769, -0.354604887042536, -0.239315664287558, -0.120536680255324, -1.83697019872103e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043768, 0.354604887042536, 0.239315664287558, 0.120536680255324, 3.06161699786838e-16, -0.120536680255323, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731155, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731157, -0.46472317204377, -0.354604887042538, -0.239315664287557, -0.120536680255323, -4.28626379701574e-16, 0.120536680255322, 0.239315664287556, 0.354604887042535, 0.464723172043768, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893657, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287557, 0.120536680255323, 5.51091059616309e-16, -0.120536680255322, -0.239315664287556, -0.354604887042534, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240795, -0.568064746731157, -0.464723172043769, -0.354604887042538, -0.239315664287559, -0.120536680255323, 1.10280109986921e-15, 0.120536680255322, 0.239315664287558, 0.354604887042533, 0.464723172043768, 0.568064746731156, 0.663122658240794, 0.7485107481711, 0.822983865893657, 0.885456025653209, 0.935016242685415, 0.970941817426052, 0.992708874098054), sin1t = c(0, 0.120536680255323, 0.239315664287558, 0.354604887042536, 0.464723172043769, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -3.21624529935327e-16, -0.120536680255323, -0.239315664287557, -0.354604887042536, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240796, -0.568064746731156, -0.464723172043768, -0.354604887042536, -0.239315664287558, -0.120536680255324, 6.43249059870655e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255323, 3.67394039744206e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.885456025653209, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731155, -0.464723172043769, -0.354604887042536, -0.239315664287559, -0.120536680255325, 1.28649811974131e-15, 0.120536680255324, 0.239315664287558, 0.354604887042535, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685416, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255325, 6.12323399573677e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043769, -0.568064746731154, -0.663122658240795, -0.748510748171102, -0.822983865893656, -0.88545602565321, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685416, -0.88545602565321, -0.822983865893656, -0.748510748171103, -0.663122658240796, -0.568064746731156, -0.46472317204377, -0.354604887042536, -0.239315664287557, -0.120536680255325), `(state)` = c(2L, 4L, 2L, 4L, 3L, 5L, 5L, 7L, 6L, 6L, 7L, 9L, 5L, 7L, 5L, 8L, 4L, 9L, 7L, 6L, 5L, 3L, 4L, 6L, 14L, 10L, 11L, 8L, 9L, 12L, 10L, 1L, 1L, 4L, 1L, 3L, 1L, 1L, 1L, 0L, 1L, 0L, 3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 5L, 1L, 6L, 4L, 5L, 8L, 10L, 5L, 12L, 9L, 9L, 3L, 6L, 7L, 7L, 7L, 9L, 6L, 4L, 4L, 1L, 2L, 2L, 1L, 4L, 1L, 3L, 2L, 2L, 0L, 2L, 1L, 2L, 4L, 3L, 3L, 1L, 0L, 0L, 1L, 0L, 1L, 2L, 0L, 1L,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, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 44L, 82L, 46L, 47L, 83L, 84L, 50L, 85L, 86L, 87L, 88L, 3L, 89L, 55L, 56L, 7L, 57L, 58L, 10L, 11L, 90L, 13L, 91L, 92L, 93L, 94L, 18L, 19L, 20L, 65L, 66L, 23L, 24L, 67L, 95L, 96L, 69L, 70L, 71L, 97L, 98L, 33L, 99L, 73L, 36L, 75L, 100L, 77L, 101L, 79L, 102L, 103L, 44L, 82L, 104L, 105L, 106L, 107L, 50L, 108L)), mf.agg = NULL, mm.cov = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), mm.cov.agg = NULL, mm.mcov = NULL, mm.hcov = list(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622073, 0.574469320112434, 0.471127745425046, 0.361009460423813, 0.245720237668836, 0.126941253636601, 0.00640457338127765, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349878, -0.458318598662491, -0.348200313661258, -0.23291109090628, -0.114132106874046, 0.00640457338127763, 0.126941253636601, 0.245720237668835, 0.361009460423813, 0.471127745425046, 0.574469320112433, 0.669527231622073, 0.754915321552379, 0.829388439274934, 0.891860599034488, 0.941420816066693, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668836, 0.126941253636601, 0.00640457338127812, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.45831859866249, -0.561660173349877, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512378, -0.742106174789823, -0.656718084859518, -0.561660173349879, -0.458318598662492, -0.34820031366126, -0.232911090906279, -0.114132106874045, 0.00640457338127739, 0.1269412536366, 0.245720237668834, 0.361009460423813, 0.471127745425046, 0.574469320112434, 0.669527231622073, 0.754915321552379, 0.829388439274935, 0.891860599034488, 0.941420816066692, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274935, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668835, 0.126941253636601, 0.00640457338127837, -0.114132106874044, -0.232911090906278, -0.348200313661256, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349879, -0.458318598662491, -0.34820031366126, -0.232911090906281, -0.114132106874045, 0.00640457338127892, 0.1269412536366, 0.245720237668836, 0.361009460423811, 0.471127745425045, 0.574469320112434, 0.669527231622071, 0.754915321552378, 0.829388439274934, 0.891860599034487, 0.941420816066692, 0.97734639080733, 0.999113447479332, -0.000777656001647262, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729509, 0.662345002239148, 0.747733092169454, 0.822206209892009, 0.884678369651563, 0.934238586683768, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.822206209892009, 0.747733092169454, 0.662345002239148, 0.567287090729509, 0.463945516042122, 0.353827231040889, 0.23853800828591, 0.119759024253676, -0.000777656001647583, -0.12131433625697, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895304, -0.886233681654857, -0.935793898687062, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687062, -0.886233681654857, -0.823761521895304, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289205, -0.121314336256971, -0.000777656001646619, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729508, 0.662345002239148, 0.747733092169453, 0.822206209892009, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.82220620989201, 0.747733092169454, 0.662345002239148, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253676, -0.000777656001646894, -0.121314336256971, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895303, -0.886233681654856, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.9717194734277, -0.935793898687062, -0.886233681654857, -0.823761521895303, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289206, -0.121314336256972, -0.000777656001645975, 0.119759024253677, 0.238538008285911, 0.353827231040888, 0.46394551604212, 0.567287090729507, 0.662345002239148, 0.747733092169453, 0.822206209892008, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651562, 0.822206209892009, 0.747733092169454, 0.662345002239149, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253678, -0.000777656001646649, -0.121314336256971, -0.240093320289205, -0.355382543044182, -0.465500828045416, -0.568842402732802, -0.663900314242442, -0.749288404172749, -0.823761521895303, -0.886233681654857, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687063, -0.886233681654858, -0.823761521895304, -0.74928840417275, -0.663900314242443, -0.568842402732803, -0.465500828045418, -0.355382543044184, -0.240093320289205, -0.121314336256972), c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622073, 0.574469320112434, 0.471127745425046, 0.361009460423813, 0.245720237668836, 0.126941253636601, 0.00640457338127765, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349878, -0.458318598662491, -0.348200313661258, -0.23291109090628, -0.114132106874046, 0.00640457338127763, 0.126941253636601, 0.245720237668835, 0.361009460423813, 0.471127745425046, 0.574469320112433, 0.669527231622073, 0.754915321552379, 0.829388439274934, 0.891860599034488, 0.941420816066693, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668836, 0.126941253636601, 0.00640457338127812, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.45831859866249, -0.561660173349877, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512378, -0.742106174789823, -0.656718084859518, -0.561660173349879, -0.458318598662492, -0.34820031366126, -0.232911090906279, -0.114132106874045, 0.00640457338127739, 0.1269412536366, 0.245720237668834, 0.361009460423813, 0.471127745425046, 0.574469320112434, 0.669527231622073, 0.754915321552379, 0.829388439274935, 0.891860599034488, 0.941420816066692, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274935, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668835, 0.126941253636601, 0.00640457338127837, -0.114132106874044, -0.232911090906278, -0.348200313661256, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349879, -0.458318598662491, -0.34820031366126, -0.232911090906281, -0.114132106874045, 0.00640457338127892, 0.1269412536366, 0.245720237668836, 0.361009460423811, 0.471127745425045, 0.574469320112434, 0.669527231622071, 0.754915321552378, 0.829388439274934, 0.891860599034487, 0.941420816066692, 0.97734639080733, 0.999113447479332, -0.000777656001647262, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729509, 0.662345002239148, 0.747733092169454, 0.822206209892009, 0.884678369651563, 0.934238586683768, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.822206209892009, 0.747733092169454, 0.662345002239148, 0.567287090729509, 0.463945516042122, 0.353827231040889, 0.23853800828591, 0.119759024253676, -0.000777656001647583, -0.12131433625697, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895304, -0.886233681654857, -0.935793898687062, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687062, -0.886233681654857, -0.823761521895304, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289205, -0.121314336256971, -0.000777656001646619, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729508, 0.662345002239148, 0.747733092169453, 0.822206209892009, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.82220620989201, 0.747733092169454, 0.662345002239148, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253676, -0.000777656001646894, -0.121314336256971, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895303, -0.886233681654856, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.9717194734277, -0.935793898687062, -0.886233681654857, -0.823761521895303, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289206, -0.121314336256972, -0.000777656001645975, 0.119759024253677, 0.238538008285911, 0.353827231040888, 0.46394551604212, 0.567287090729507, 0.662345002239148, 0.747733092169453, 0.822206209892008, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651562, 0.822206209892009, 0.747733092169454, 0.662345002239149, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253678, -0.000777656001646649, -0.121314336256971, -0.240093320289205, -0.355382543044182, -0.465500828045416, -0.568842402732802, -0.663900314242442, -0.749288404172749, -0.823761521895303, -0.886233681654857, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687063, -0.886233681654858, -0.823761521895304, -0.74928840417275, -0.663900314242443, -0.568842402732803, -0.465500828045418, -0.355382543044184, -0.240093320289205, -0.121314336256972)), mm.icov = 1, subject.weights = NULL), qmodel = list(nstates = 2L, iso = 2, perm = c(1, 2), qperm = 1:2, npars = 2, imatrix = c(0, 1, 1, 0), qmatrix = c(-0.5, 0.5, 0.5, -0.5), inits = c(0.5, 0.5), constr = 1:2, ndpars = 2L, expm = 1), qcmodel = list(npars = 0, ncovs = 0, ndpars = 0), cmodel = list(ncens = 0, censor = NULL, states = NULL, states_list = NULL, index = NULL), hmodel = list(hidden = TRUE, nstates = 2L, fitted = FALSE, nipars = 0, initprobs = c(1, 0), est.initprobs = FALSE, ematrix = FALSE, models = c(9L, 9L), labels = c("poisson", "poisson"), npars = c(1L, 1L), nout = c(1, 1), mv = FALSE, parout = c(1, 1), totpars = 2L, pars = c(rate = 1.51764705882353, rate = 7.1830985915493), plabs = c(state.1 = "rate", state.2 = "rate"), parstate = 1:2, firstpar = c(0, 1), locpars = 1:2, ncovs = c(2, 2), coveffect = c(cos1t = 0, sin1t = 0, cos1t = 0, sin1t = 0), covlabels = c("cos1t", "sin1t", "cos1t", "sin1t"), coveffstate = c(1L, 1L, 2L, 2L), ncoveffs = 4L, nicovs = 0, nicoveffs = 0, cri = NULL, constr = 1:2, covconstr = 1:4, ranges = c(0, 0, -Inf, -Inf, -Inf, -Inf, Inf, Inf, Inf, Inf, Inf, Inf)), paramdata = list( inits = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0), plabs = c("qbase", "qbase", "rate", "rate", "hcov", "hcov", "hcov", "hcov"), allinits = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0), hmmpars = 3:4, fixed = FALSE, fixedpars = integer(0), optpars = 1:8, auxpars = integer(0), constr = c(1, 2, 3, 4, 5, 6, 7, 8), npars = 8, duppars = integer(0), nfix = 0L, nopt = 8L, ndup = 0L, ranges = c(0, 0, 0, 0, -Inf, -Inf, -Inf, -Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf), params = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0))) 5: do.call("optim", optim.args) 6: msm.optim.optim(p = list(inits = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0), plabs = c("qbase", "qbase", "rate", "rate", "hcov", "hcov", "hcov", "hcov"), allinits = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0), hmmpars = 3:4, fixed = FALSE, fixedpars = integer(0), optpars = 1:8, auxpars = integer(0), constr = c(1, 2, 3, 4, 5, 6, 7, 8), npars = 8, duppars = integer(0), nfix = 0L, nopt = 8L, ndup = 0L, ranges = c(0, 0, 0, 0, -Inf, -Inf, -Inf, -Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf), params = c(qbase = -0.693147180559945, qbase = -0.693147180559945, rate = 0.417161147871356, rate = 1.97173084867706, hcov = 0, hcov = 0, hcov = 0, hcov = 0)), gr = function (params, ...) { w <- list(...)$msmdata$subject.weights if (!is.null(w)) { deriv <- Ccall.msm(params, do.what = "deriv.subj", ...) apply(w * deriv, 2, sum) } else Ccall.msm(params, do.what = "deriv", ...)}, hessian = TRUE, msmdata = list(mf = list(cos1t = c(1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -1.60812264967664e-16, -0.120536680255323, -0.239315664287557, -0.354604887042535, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240795, -0.568064746731156, -0.464723172043769, -0.354604887042536, -0.239315664287558, -0.120536680255324, -1.83697019872103e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043768, 0.354604887042536, 0.239315664287558, 0.120536680255324, 3.06161699786838e-16, -0.120536680255323, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731155, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731157, -0.46472317204377, -0.354604887042538, -0.239315664287557, -0.120536680255323, -4.28626379701574e-16, 0.120536680255322, 0.239315664287556, 0.354604887042535, 0.464723172043768, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893657, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287557, 0.120536680255323, 5.51091059616309e-16, -0.120536680255322, -0.239315664287556, -0.354604887042534, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240795, -0.568064746731157, -0.464723172043769, -0.354604887042538, -0.239315664287559, -0.120536680255323, 1.10280109986921e-15, 0.120536680255322, 0.239315664287558, 0.354604887042533, 0.464723172043768, 0.568064746731156, 0.663122658240794, 0.7485107481711, 0.822983865893657, 0.885456025653209, 0.935016242685415, 0.970941817426052, 0.992708874098054), sin1t = c(0, 0.120536680255323, 0.239315664287558, 0.354604887042536, 0.464723172043769, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -3.21624529935327e-16, -0.120536680255323, -0.239315664287557, -0.354604887042536, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240796, -0.568064746731156, -0.464723172043768, -0.354604887042536, -0.239315664287558, -0.120536680255324, 6.43249059870655e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255323, 3.67394039744206e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.885456025653209, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731155, -0.464723172043769, -0.354604887042536, -0.239315664287559, -0.120536680255325, 1.28649811974131e-15, 0.120536680255324, 0.239315664287558, 0.354604887042535, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685416, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255325, 6.12323399573677e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043769, -0.568064746731154, -0.663122658240795, -0.748510748171102, -0.822983865893656, -0.88545602565321, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685416, -0.88545602565321, -0.822983865893656, -0.748510748171103, -0.663122658240796, -0.568064746731156, -0.46472317204377, -0.354604887042536, -0.239315664287557, -0.120536680255325), `(state)` = c(2L, 4L, 2L, 4L, 3L, 5L, 5L, 7L, 6L, 6L, 7L, 9L, 5L, 7L, 5L, 8L, 4L, 9L, 7L, 6L, 5L, 3L, 4L, 6L, 14L, 10L, 11L, 8L, 9L, 12L, 10L, 1L, 1L, 4L, 1L, 3L, 1L, 1L, 1L, 0L, 1L, 0L, 3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 5L, 1L, 6L, 4L, 5L, 8L, 10L, 5L, 12L, 9L, 9L, 3L, 6L, 7L, 7L, 7L, 9L, 6L, 4L, 4L, 1L, 2L, 2L, 1L, 4L, 1L, 3L, 2L, 2L, 0L, 2L, 1L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L, 24L, 67L, 26L, 68L, 69L, 70L, 71L, 31L, 32L, 33L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 44L, 82L, 46L, 47L, 83L, 84L, 50L, 85L, 86L, 87L, 88L, 3L, 89L, 55L, 56L, 7L, 57L, 58L, 10L, 11L, 90L, 13L, 91L, 92L, 93L, 94L, 18L, 19L, 20L, 65L, 66L, 23L, 24L, 67L, 95L, 96L, 69L, 70L, 71L, 97L, 98L, 33L, 99L, 73L, 36L, 75L, 100L, 77L, 101L, 79L, 102L, 103L, 44L, 82L, 104L, 105L, 106L, 107L, 50L, 108L)), mf.agg = NULL, mm.cov = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), mm.cov.agg = NULL, mm.mcov = NULL, mm.hcov = list(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622073, 0.574469320112434, 0.471127745425046, 0.361009460423813, 0.245720237668836, 0.126941253636601, 0.00640457338127765, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349878, -0.458318598662491, -0.348200313661258, -0.23291109090628, -0.114132106874046, 0.00640457338127763, 0.126941253636601, 0.245720237668835, 0.361009460423813, 0.471127745425046, 0.574469320112433, 0.669527231622073, 0.754915321552379, 0.829388439274934, 0.891860599034488, 0.941420816066693, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668836, 0.126941253636601, 0.00640457338127812, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.45831859866249, -0.561660173349877, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512378, -0.742106174789823, -0.656718084859518, -0.561660173349879, -0.458318598662492, -0.34820031366126, -0.232911090906279, -0.114132106874045, 0.00640457338127739, 0.1269412536366, 0.245720237668834, 0.361009460423813, 0.471127745425046, 0.574469320112434, 0.669527231622073, 0.754915321552379, 0.829388439274935, 0.891860599034488, 0.941420816066692, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274935, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668835, 0.126941253636601, 0.00640457338127837, -0.114132106874044, -0.232911090906278, -0.348200313661256, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349879, -0.458318598662491, -0.34820031366126, -0.232911090906281, -0.114132106874045, 0.00640457338127892, 0.1269412536366, 0.245720237668836, 0.361009460423811, 0.471127745425045, 0.574469320112434, 0.669527231622071, 0.754915321552378, 0.829388439274934, 0.891860599034487, 0.941420816066692, 0.97734639080733, 0.999113447479332, -0.000777656001647262, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729509, 0.662345002239148, 0.747733092169454, 0.822206209892009, 0.884678369651563, 0.934238586683768, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.822206209892009, 0.747733092169454, 0.662345002239148, 0.567287090729509, 0.463945516042122, 0.353827231040889, 0.23853800828591, 0.119759024253676, -0.000777656001647583, -0.12131433625697, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895304, -0.886233681654857, -0.935793898687062, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687062, -0.886233681654857, -0.823761521895304, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289205, -0.121314336256971, -0.000777656001646619, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729508, 0.662345002239148, 0.747733092169453, 0.822206209892009, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.82220620989201, 0.747733092169454, 0.662345002239148, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253676, -0.000777656001646894, -0.121314336256971, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895303, -0.886233681654856, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.9717194734277, -0.935793898687062, -0.886233681654857, -0.823761521895303, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289206, -0.121314336256972, -0.000777656001645975, 0.119759024253677, 0.238538008285911, 0.353827231040888, 0.46394551604212, 0.567287090729507, 0.662345002239148, 0.747733092169453, 0.822206209892008, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651562, 0.822206209892009, 0.747733092169454, 0.662345002239149, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253678, -0.000777656001646649, -0.121314336256971, -0.240093320289205, -0.355382543044182, -0.465500828045416, -0.568842402732802, -0.663900314242442, -0.749288404172749, -0.823761521895303, -0.886233681654857, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687063, -0.886233681654858, -0.823761521895304, -0.74928840417275, -0.663900314242443, -0.568842402732803, -0.465500828045418, -0.355382543044184, -0.240093320289205, -0.121314336256972), c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622073, 0.574469320112434, 0.471127745425046, 0.361009460423813, 0.245720237668836, 0.126941253636601, 0.00640457338127765, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349878, -0.458318598662491, -0.348200313661258, -0.23291109090628, -0.114132106874046, 0.00640457338127763, 0.126941253636601, 0.245720237668835, 0.361009460423813, 0.471127745425046, 0.574469320112433, 0.669527231622073, 0.754915321552379, 0.829388439274934, 0.891860599034488, 0.941420816066693, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274934, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668836, 0.126941253636601, 0.00640457338127812, -0.114132106874045, -0.23291109090628, -0.348200313661258, -0.45831859866249, -0.561660173349877, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512378, -0.742106174789823, -0.656718084859518, -0.561660173349879, -0.458318598662492, -0.34820031366126, -0.232911090906279, -0.114132106874045, 0.00640457338127739, 0.1269412536366, 0.245720237668834, 0.361009460423813, 0.471127745425046, 0.574469320112434, 0.669527231622073, 0.754915321552379, 0.829388439274935, 0.891860599034488, 0.941420816066692, 0.97734639080733, 0.999113447479332, 1.00640457338128, 0.999113447479332, 0.97734639080733, 0.941420816066693, 0.891860599034488, 0.829388439274935, 0.754915321552379, 0.669527231622074, 0.574469320112435, 0.471127745425046, 0.361009460423814, 0.245720237668835, 0.126941253636601, 0.00640457338127837, -0.114132106874044, -0.232911090906278, -0.348200313661256, -0.458318598662491, -0.561660173349878, -0.656718084859517, -0.742106174789823, -0.816579292512378, -0.879051452271932, -0.928611669304137, -0.964537244044774, -0.986304300716776, -0.993595426618722, -0.986304300716776, -0.964537244044774, -0.928611669304137, -0.879051452271932, -0.816579292512379, -0.742106174789823, -0.656718084859517, -0.561660173349879, -0.458318598662491, -0.34820031366126, -0.232911090906281, -0.114132106874045, 0.00640457338127892, 0.1269412536366, 0.245720237668836, 0.361009460423811, 0.471127745425045, 0.574469320112434, 0.669527231622071, 0.754915321552378, 0.829388439274934, 0.891860599034487, 0.941420816066692, 0.97734639080733, 0.999113447479332, -0.000777656001647262, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729509, 0.662345002239148, 0.747733092169454, 0.822206209892009, 0.884678369651563, 0.934238586683768, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.822206209892009, 0.747733092169454, 0.662345002239148, 0.567287090729509, 0.463945516042122, 0.353827231040889, 0.23853800828591, 0.119759024253676, -0.000777656001647583, -0.12131433625697, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895304, -0.886233681654857, -0.935793898687062, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687062, -0.886233681654857, -0.823761521895304, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289205, -0.121314336256971, -0.000777656001646619, 0.119759024253676, 0.23853800828591, 0.353827231040888, 0.463945516042121, 0.567287090729508, 0.662345002239148, 0.747733092169453, 0.822206209892009, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651563, 0.82220620989201, 0.747733092169454, 0.662345002239148, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253676, -0.000777656001646894, -0.121314336256971, -0.240093320289205, -0.355382543044183, -0.465500828045415, -0.568842402732803, -0.663900314242442, -0.749288404172748, -0.823761521895303, -0.886233681654856, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.9717194734277, -0.935793898687062, -0.886233681654857, -0.823761521895303, -0.749288404172748, -0.663900314242443, -0.568842402732803, -0.465500828045416, -0.355382543044183, -0.240093320289206, -0.121314336256972, -0.000777656001645975, 0.119759024253677, 0.238538008285911, 0.353827231040888, 0.46394551604212, 0.567287090729507, 0.662345002239148, 0.747733092169453, 0.822206209892008, 0.884678369651563, 0.934238586683767, 0.970164161424405, 0.991931218096407, 0.999222343998353, 0.991931218096407, 0.970164161424405, 0.934238586683768, 0.884678369651562, 0.822206209892009, 0.747733092169454, 0.662345002239149, 0.56728709072951, 0.463945516042121, 0.353827231040889, 0.238538008285912, 0.119759024253678, -0.000777656001646649, -0.121314336256971, -0.240093320289205, -0.355382543044182, -0.465500828045416, -0.568842402732802, -0.663900314242442, -0.749288404172749, -0.823761521895303, -0.886233681654857, -0.935793898687061, -0.971719473427699, -0.993486530099701, -1.00077765600165, -0.993486530099701, -0.971719473427699, -0.935793898687063, -0.886233681654858, -0.823761521895304, -0.74928840417275, -0.663900314242443, -0.568842402732803, -0.465500828045418, -0.355382543044184, -0.240093320289205, -0.121314336256972)), mm.icov = 1, subject.weights = NULL), qmodel = list(nstates = 2L, iso = 2, perm = c(1, 2), qperm = 1:2, npars = 2, imatrix = c(0, 1, 1, 0), qmatrix = c(-0.5, 0.5, 0.5, -0.5), inits = c(0.5, 0.5), constr = 1:2, ndpars = 2L, expm = 1), qcmodel = list(npars = 0, ncovs = 0, ndpars = 0), cmodel = list(ncens = 0, censor = NULL, states = NULL, states_list = NULL, index = NULL), hmodel = list(hidden = TRUE, nstates = 2L, fitted = FALSE, nipars = 0, initprobs = c(1, 0), est.initprobs = FALSE, ematrix = FALSE, models = c(9L, 9L), labels = c("poisson", "poisson"), npars = c(1L, 1L), nout = c(1, 1), mv = FALSE, parout = c(1, 1), totpars = 2L, pars = c(rate = 1.51764705882353, rate = 7.1830985915493), plabs = c(state.1 = "rate", state.2 = "rate"), parstate = 1:2, firstpar = c(0, 1), locpars = 1:2, ncovs = c(2, 2), coveffect = c(cos1t = 0, sin1t = 0, cos1t = 0, sin1t = 0), covlabels = c("cos1t", "sin1t", "cos1t", "sin1t"), coveffstate = c(1L, 1L, 2L, 2L), ncoveffs = 4L, nicovs = 0, nicoveffs = 0, cri = NULL, constr = 1:2, covconstr = 1:4, ranges = c(0, 0, -Inf, -Inf, -Inf, -Inf, Inf, Inf, Inf, Inf, Inf, Inf))) 7: do.call(optfn, args) 8: msm.optim(opt.method, p, hessian, use.deriv, msmdata, qmodel, qcmodel, cmodel, hmodel, ...) 9: (function (formula, subject = NULL, data = list(), qmatrix, gen.inits = FALSE, ematrix = NULL, hmodel = NULL, obstype = NULL, obstrue = NULL, covariates = NULL, covinits = NULL, constraint = NULL, misccovariates = NULL, misccovinits = NULL, miscconstraint = NULL, hcovariates = NULL, hcovinits = NULL, hconstraint = NULL, hranges = NULL, qconstraint = NULL, econstraint = NULL, initprobs = NULL, est.initprobs = FALSE, initcovariates = NULL, initcovinits = NULL, deathexact = NULL, death = NULL, exacttimes = FALSE, censor = NULL, censor.states = NULL, pci = NULL, phase.states = NULL, phase.inits = NULL, subject.weights = NULL, cl = 0.95, fixedpars = NULL, center = TRUE, opt.method = "optim", hessian = NULL, use.deriv = TRUE, use.expm = TRUE, analyticp = TRUE, na.action = na.omit, ...) { call <- match.call() if (missing(formula)) stop("state ~ time formula not given") if (missing(data)) data <- environment(formula) if (gen.inits) { if (is.null(hmodel) && is.null(ematrix)) { subj <- eval(substitute(subject), data, parent.frame()) qmatrix <- crudeinits.msm(formula, subj, qmatrix, data, censor, censor.states) } else warning("gen.inits not supported for hidden Markov models, ignoring") } qmodel <- qmodel.orig <- msm.form.qmodel(qmatrix, qconstraint, analyticp, use.expm, phase.states) if (!is.null(phase.states)) { qmodel <- msm.phase2qmodel(qmodel, phase.states, phase.inits, qconstraint, analyticp, use.expm) } if (!is.null(ematrix)) { msm.check.ematrix(ematrix, qmodel.orig$nstates) if (!is.null(phase.states)) { stop("phase-type models with additional misclassification must be specified through \"hmodel\" with hmmCat() or hmmIdent() constructors, or as HMMs by hand") } emodel <- msm.form.emodel(ematrix, econstraint, initprobs, est.initprobs, qmodel) } else emodel <- list(misc = FALSE, npars = 0, ndpars = 0) if (!is.null(hmodel)) { msm.check.hmodel(hmodel, qmodel.orig$nstates) if (!is.null(phase.states)) { hmodel.orig <- hmodel hmodel <- rep(hmodel, qmodel$phase.reps) } hmodel <- msm.form.hmodel(hmodel, hconstraint, initprobs, est.initprobs) } else { if (!is.null(hcovariates)) stop("hcovariates have been specified, but no hmodel") if (!is.null(phase.states)) { hmodel <- msm.phase2hmodel(qmodel, hmodel) } else hmodel <- list(hidden = FALSE, models = rep(0, qmodel$nstates), nipars = 0, nicoveffs = 0, totpars = 0, ncoveffs = 0) } if (emodel$misc) { hmodel <- msm.emodel2hmodel(emodel, qmodel) } else { emodel <- list(misc = FALSE, npars = 0, ndpars = 0, nipars = 0, nicoveffs = 0) hmodel$ematrix <- FALSE } if (!is.null(deathexact)) death <- deathexact dmodel <- msm.form.dmodel(death, qmodel, hmodel) if (dmodel$ndeath > 0 && exacttimes) warning("Ignoring death argument, as all states have exact entry times") cmodel <- msm.form.cmodel(censor, censor.states, qmodel$qmatrix, hmodel) if (!inherits(formula, "formula")) stop("formula is not a formula") if (!is.null(covariates) && (!(is.list(covariates) || inherits(covariates, "formula")))) stop(deparse(substitute(covariates)), " should be a formula or list of formulae") if (!is.null(misccovariates) && (!inherits(misccovariates, "formula"))) stop(deparse(substitute(misccovariates)), " should be a formula") if (is.list(covariates)) { covlist <- covariates msm.check.covlist(covlist, qmodel) ter <- lapply(covlist, function(x) attr(terms(x), "term.labels")) covariates <- reformulate(unique(unlist(ter))) } else covlist <- NULL if (is.null(covariates)) covariates <- ~1 if (emodel$misc && is.null(misccovariates)) misccovariates <- ~1 if (hmodel$hidden && !is.null(hcovariates)) msm.check.hcovariates(hcovariates, qmodel) indx <- match(c("data", "subject", "subject.weights", "obstrue"), names(call), nomatch = 0) temp <- call[c(1, indx)] temp[[1]] <- as.name("model.frame") temp[["state"]] <- as.name(all.vars(formula[[2]])) temp[["time"]] <- as.name(all.vars(formula[[3]])) varnames <- function(x) { if (is.null(x)) NULL else attr(terms(x), "term.labels") } forms <- c(covariates, misccovariates, hcovariates, initcovariates) covnames <- unique(unlist(lapply(forms, varnames))) temp[["formula"]] <- if (length(covnames) > 0) reformulate(covnames) else ~1 temp[["na.action"]] <- na.pass temp[["data"]] <- data mf <- eval(temp, parent.frame()) usernames <- c(state = all.vars(formula[[2]]), time = all.vars(formula[[3]]), subject = as.character(temp$subject), subject.weights = as.character(temp$subject.weights), obstype = as.character(substitute(obstype)), obstrue = as.character(temp$obstrue)) attr(mf, "usernames") <- usernames indx <- match(c("formula", "data"), names(call), nomatch = 0) temp <- call[c(1, indx)] temp[[1]] <- as.name("model.frame") temp$na.action <- na.pass mfst <- eval(temp, parent.frame()) if (is.matrix(mfst[[1]]) && !is.matrix(mf$"(state)")) mf$"(state)" <- mfst[[1]] if (is.factor(mf$"(state)")) { if (!all(grepl("^[[:digit:]]+$", as.character(mf$"(state)")))) stop("state variable should be numeric or a factor with ordinal numbers as levels") else mf$"(state)" <- as.numeric(as.character(mf$"(state)")) } else if (is.character(mf$"(state)")) stop("state variable is character, should be numeric") msm.check.state(qmodel$nstates, mf$"(state)", cmodel$censor, hmodel) if (is.null(mf$"(subject)")) mf$"(subject)" <- rep(1, nrow(mf)) msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)", hmodel$hidden) obstype <- if (missing(obstype)) NULL else eval(substitute(obstype), data, parent.frame()) mf$"(obstype)" <- msm.form.obstype(mf, obstype, dmodel, exacttimes) mf$"(obstrue)" <- msm.form.obstrue(mf, hmodel, cmodel) mf$"(obs)" <- seq_len(nrow(mf)) basenames <- c("(state)", "(time)", "(subject)", "(obstype)", "(obstrue)", "(obs)", "(subject.weights)") attr(mf, "covnames") <- setdiff(names(mf), basenames) attr(mf, "covnames.q") <- rownames(attr(terms(covariates), "factors")) if (emodel$misc) attr(mf, "covnames.e") <- rownames(attr(terms(misccovariates), "factors")) attr(mf, "ncovs") <- length(attr(mf, "covnames")) ic <- all.vars(initcovariates) others <- c(covariates, misccovariates, hcovariates) oic <- ic[!ic %in% unlist(lapply(others, all.vars))] attr(mf, "icovi") <- match(oic, colnames(mf)) if (missing(na.action) || identical(na.action, na.omit) || (identical(na.action, "na.omit"))) mf <- na.omit.msmdata(mf, hidden = hmodel$hidden, misc = emodel$misc) else if (identical(na.action, na.fail) || (identical(na.action, "na.fail"))) mf <- na.fail.msmdata(mf, hidden = hmodel$hidden, misc = emodel$misc) else stop("na.action should be \"na.omit\" or \"na.fail\"") attr(mf, "npts") <- length(unique(mf$"(subject)")) attr(mf, "ntrans") <- nrow(mf) - attr(mf, "npts") if (!is.null(pci)) { if (isTRUE(hmodel$mv)) stop("`pci` not supported for multivariate hidden Markov models. As an approximation, create a variable in your data representing the time period, and treat it as a covariate") tdmodel <- msm.pci(pci, mf, qmodel, cmodel, covariates) if (!is.null(tdmodel)) { mf <- tdmodel$mf covariates <- tdmodel$covariates cmodel <- tdmodel$cmodel pci <- tdmodel$tcut } else { pci <- NULL mf$"(pci.imp)" <- 0 } } else tdmodel <- NULL forms <- c(covariates, misccovariates, hcovariates, initcovariates) covnames <- unique(unlist(lapply(forms, varnames))) if (length(covnames) > 0) { mm.mean <- model.matrix(reformulate(covnames), mf) cm <- colMeans(mm.mean[duplicated(mf$"(subject)", fromLast = TRUE), , drop = FALSE]) cm["(Intercept)"] <- 0 } else cm <- NULL attr(mf, "covmeans") <- cm mf.agg <- msm.form.mf.agg(list(data = list(mf = mf), qmodel = qmodel, hmodel = hmodel, cmodel = cmodel)) mf$"(pcomb)" <- msm.form.hmm.agg(mf) if (inherits(misccovariates, "formula")) { if (!emodel$misc) stop("misccovariates supplied but no ematrix") hcovariates <- lapply(ifelse(rowSums(emodel$imatrix) > 0, deparse(misccovariates), deparse(~1)), as.formula) } mm.cov <- msm.form.mm.cov(list(data = list(mf = mf), covariates = covariates, center = center)) mm.cov.agg <- msm.form.mm.cov.agg(list(data = list(mf.agg = mf.agg), covariates = covariates, hmodel = hmodel, cmodel = cmodel, center = center)) mm.mcov <- msm.form.mm.mcov(list(data = list(mf = mf), misccovariates = misccovariates, emodel = emodel, center = center)) mm.hcov <- msm.form.mm.hcov(list(data = list(mf = mf), hcovariates = hcovariates, qmodel = qmodel, hmodel = hmodel, center = center)) mm.icov <- msm.form.mm.icov(list(data = list(mf = mf), initcovariates = initcovariates, hmodel = hmodel, center = center)) if (!is.null(covlist)) { cri <- msm.form.cri(covlist, qmodel, mf, mm.cov, tdmodel) } else cri <- NULL qcmodel <- if (ncol(mm.cov) > 1) msm.form.covmodel(mf, mm.cov, constraint, covinits, cm, qmodel$npars, cri) else { if (!is.null(constraint)) warning("constraint specified but no covariates") list(npars = 0, ncovs = 0, ndpars = 0) } if (!emodel$misc || is.null(misccovariates)) ecmodel <- list(npars = 0, ncovs = 0) if (!is.null(misccovariates)) { if (!emodel$misc) { warning("misccovariates have been specified, but misc is FALSE. Ignoring misccovariates.") } else { ecmodel <- msm.form.covmodel(mf, mm.mcov, miscconstraint, misccovinits, cm, emodel$npars, cri = NULL) hcovariates <- msm.misccov2hcov(misccovariates, emodel) hcovinits <- msm.misccovinits2hcovinits(misccovinits, hcovariates, emodel, ecmodel) } } if (!is.null(hcovariates)) { if (hmodel$mv) stop("hcovariates not supported for multivariate hidden Markov models") hmodel <- msm.form.hcmodel(hmodel, mm.hcov, hcovinits, hconstraint) if (emodel$misc) hmodel$covconstr <- msm.form.hcovconstraint(miscconstraint, hmodel) } else if (hmodel$hidden) { npars <- if (hmodel$mv) colSums(hmodel$npars) else hmodel$npars hmodel <- c(hmodel, list(ncovs = rep(rep(0, hmodel$nstates), npars), ncoveffs = 0)) class(hmodel) <- "hmodel" } if (!is.null(initcovariates)) { if (hmodel$hidden) hmodel <- msm.form.icmodel(hmodel, mm.icov, initcovinits) else warning("initprobs and initcovariates ignored for non-hidden Markov models") } else if (hmodel$hidden) { hmodel <- c(hmodel, list(nicovs = rep(0, hmodel$nstates - 1), nicoveffs = 0, cri = ecmodel$cri)) class(hmodel) <- "hmodel" } if (hmodel$hidden && !emodel$misc) { hmodel$constr <- msm.form.hconstraint(hconstraint, hmodel) hmodel$covconstr <- msm.form.hcovconstraint(hconstraint, hmodel) } if (hmodel$hidden) hmodel$ranges <- msm.form.hranges(hranges, hmodel) if (hmodel$hidden) hmodel <- msm.form.initprobs(hmodel, initprobs, mf) p <- msm.form.params(qmodel, qcmodel, emodel, hmodel, fixedpars) subject.weights <- msm.form.subject.weights(mf) msmdata <- list(mf = mf, mf.agg = mf.agg, mm.cov = mm.cov, mm.cov.agg = mm.cov.agg, mm.mcov = mm.mcov, mm.hcov = mm.hcov, mm.icov = mm.icov, subject.weights = subject.weights) if (p$fixed) opt.method <- "fixed" if (is.null(hessian)) hessian <- !p$fixed p <- msm.optim(opt.method, p, hessian, use.deriv, msmdata, qmodel, qcmodel, cmodel, hmodel, ...) if (p$fixed) { p$foundse <- FALSE p$covmat <- NULL } else { p$params <- msm.rep.constraints(p$params, p, hmodel) hess <- if (hessian) p$opt$hessian else p$information if (!is.null(hess) && all(!is.na(hess)) && all(!is.nan(hess)) && all(is.finite(hess)) && all(eigen(hess)$values > 0)) { p$foundse <- TRUE p$covmat <- matrix(0, nrow = p$npars, ncol = p$npars) p$covmat[p$optpars, p$optpars] <- solve(0.5 * hess) p$covmat <- p$covmat[!duplicated(abs(p$constr)), !duplicated(abs(p$constr)), drop = FALSE][abs(p$constr), abs(p$constr), drop = FALSE] p$ci <- cbind(p$params - qnorm(1 - 0.5 * (1 - cl)) * sqrt(diag(p$covmat)), p$params + qnorm(1 - 0.5 * (1 - cl)) * sqrt(diag(p$covmat))) p$ci[p$fixedpars, ] <- NA for (i in 1:2) p$ci[, i] <- gexpit(p$ci[, i], p$ranges[, "lower", drop = FALSE], p$ranges[, "upper", drop = FALSE]) } else { p$foundse <- FALSE p$covmat <- p$ci <- NULL if (!is.null(hess)) warning("Optimisation has probably not converged to the maximum likelihood - Hessian is not positive definite.") } } p$estimates.t <- p$params p$estimates.t <- msm.inv.transform(p$params, hmodel, p$ranges) if (any(p$plabs == "p") && p$foundse) { p.se <- p.se.msm(x = list(data = msmdata, qmodel = qmodel, emodel = emodel, hmodel = hmodel, qcmodel = qcmodel, ecmodel = ecmodel, paramdata = p, center = center), covariates = if (center) "mean" else 0) p$ci[p$plabs %in% c("p", "pbase"), ] <- as.numeric(unlist(p.se[, c("LCL", "UCL")])) } if (p$foundse && any(p$plabs == "initp")) p <- initp.ci.msm(p, cl) msmobject <- list(call = match.call(), minus2loglik = p$lik, deriv = p$deriv, estimates = p$params, estimates.t = p$estimates.t, fixedpars = p$fixedpars, center = center, covmat = p$covmat, ci = p$ci, opt = p$opt, foundse = p$foundse, data = msmdata, qmodel = qmodel, emodel = emodel, qcmodel = qcmodel, ecmodel = ecmodel, hmodel = hmodel, cmodel = cmodel, pci = pci, paramdata = p, cl = cl, covariates = covariates, misccovariates = misccovariates, hcovariates = hcovariates, initcovariates = initcovariates) attr(msmobject, "fixed") <- p$fixed class(msmobject) <- "msm" msmobject <- msm.form.output(msmobject, "intens") q <- qmatrix.msm(msmobject, covariates = (if (center) "mean" else 0)) msmobject$Qmatrices$baseline <- q$estimates msmobject$QmatricesSE$baseline <- q$SE msmobject$QmatricesL$baseline <- q$L msmobject$QmatricesU$baseline <- q$U if (hmodel$hidden) { msmobject$hmodel <- msm.form.houtput(hmodel, p, msmdata, cmodel) } if (emodel$misc) { msmobject <- msm.form.output(msmobject, "misc") e <- ematrix.msm(msmobject, covariates = (if (center) "mean" else 0)) msmobject$Ematrices$baseline <- e$estimates msmobject$EmatricesSE$baseline <- e$SE msmobject$EmatricesL$baseline <- e$L msmobject$EmatricesU$baseline <- e$U } msmobject$msmdata[!names(msmobject$msmdata) == "mf"] <- NULL msmobject$sojourn <- sojourn.msm(msmobject, covariates = (if (center) "mean" else 0)) msmobject})(formula = observed ~ t, data = list(observed = c(2L, 4L, 2L, 4L, 3L, 5L, 5L, 7L, 6L, 6L, 7L, 9L, 5L, 7L, 5L, 8L, 4L, 9L, 7L, 6L, 5L, 3L, 4L, 6L, 14L, 10L, 11L, 8L, 9L, 12L, 10L, 1L, 1L, 4L, 1L, 3L, 1L, 1L, 1L, 0L, 1L, 0L, 3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 5L, 1L, 6L, 4L, 5L, 8L, 10L, 5L, 12L, 9L, 9L, 3L, 6L, 7L, 7L, 7L, 9L, 6L, 4L, 4L, 1L, 2L, 2L, 1L, 4L, 1L, 3L, 2L, 2L, 0L, 2L, 1L, 2L, 4L, 3L, 3L, 1L, 0L, 0L, 1L, 0L, 1L, 2L, 0L, 1L, 1L, 3L, 4L, 4L, 3L, 6L, 3L, 4L, 3L, 4L, 1L, 6L, 9L, 1L, 3L, 5L, 9L, 9L, 13L, 7L, 3L, 7L, 8L, 3L, 5L, 3L, 1L, 16L, 12L, 11L, 16L, 13L, 6L, 0L, 3L, 2L, 0L, 2L, 2L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 2L, 0L, 1L, 2L, 3L, 1L, 1L, 4L, 4L, 2L), t = 1:156, cos1t = c(1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -1.60812264967664e-16, -0.120536680255323, -0.239315664287557, -0.354604887042535, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240795, -0.568064746731156, -0.464723172043769, -0.354604887042536, -0.239315664287558, -0.120536680255324, -1.83697019872103e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043768, 0.354604887042536, 0.239315664287558, 0.120536680255324, 3.06161699786838e-16, -0.120536680255323, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731155, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731157, -0.46472317204377, -0.354604887042538, -0.239315664287557, -0.120536680255323, -4.28626379701574e-16, 0.120536680255322, 0.239315664287556, 0.354604887042535, 0.464723172043768, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893657, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287557, 0.120536680255323, 5.51091059616309e-16, -0.120536680255322, -0.239315664287556, -0.354604887042534, -0.464723172043769, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240795, -0.568064746731157, -0.464723172043769, -0.354604887042538, -0.239315664287559, -0.120536680255323, 1.10280109986921e-15, 0.120536680255322, 0.239315664287558, 0.354604887042533, 0.464723172043768, 0.568064746731156, 0.663122658240794, 0.7485107481711, 0.822983865893657, 0.885456025653209, 0.935016242685415, 0.970941817426052, 0.992708874098054), sin1t = c(0, 0.120536680255323, 0.239315664287558, 0.354604887042536, 0.464723172043769, 0.568064746731156, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240795, 0.568064746731156, 0.464723172043769, 0.354604887042536, 0.239315664287558, 0.120536680255323, -3.21624529935327e-16, -0.120536680255323, -0.239315664287557, -0.354604887042536, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.88545602565321, -0.935016242685415, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893657, -0.748510748171101, -0.663122658240796, -0.568064746731156, -0.464723172043768, -0.354604887042536, -0.239315664287558, -0.120536680255324, 6.43249059870655e-16, 0.120536680255323, 0.239315664287557, 0.354604887042536, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685415, 0.88545602565321, 0.822983865893657, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255323, 3.67394039744206e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043768, -0.568064746731156, -0.663122658240795, -0.748510748171101, -0.822983865893656, -0.885456025653209, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685415, -0.88545602565321, -0.822983865893656, -0.748510748171101, -0.663122658240796, -0.568064746731155, -0.464723172043769, -0.354604887042536, -0.239315664287559, -0.120536680255325, 1.28649811974131e-15, 0.120536680255324, 0.239315664287558, 0.354604887042535, 0.464723172043768, 0.568064746731155, 0.663122658240795, 0.748510748171101, 0.822983865893656, 0.88545602565321, 0.935016242685415, 0.970941817426052, 0.992708874098054, 1, 0.992708874098054, 0.970941817426052, 0.935016242685416, 0.88545602565321, 0.822983865893656, 0.748510748171101, 0.663122658240796, 0.568064746731157, 0.464723172043769, 0.354604887042536, 0.239315664287559, 0.120536680255325, 6.12323399573677e-16, -0.120536680255324, -0.239315664287558, -0.354604887042535, -0.464723172043769, -0.568064746731154, -0.663122658240795, -0.748510748171102, -0.822983865893656, -0.88545602565321, -0.935016242685414, -0.970941817426052, -0.992708874098054, -1, -0.992708874098054, -0.970941817426052, -0.935016242685416, -0.88545602565321, -0.822983865893656, -0.748510748171103, -0.663122658240796, -0.568064746731156, -0.46472317204377, -0.354604887042536, -0.239315664287557, -0.120536680255325)), qmatrix = c(0.5, 0.5, 0.5, 0.5), hmodel = list(list(label = "poisson", pars = c(rate = 1.51764705882353), link = "log", r = function (n, rrate = rate) rpois(n, rrate)), list(label = "poisson", pars = c(rate = 7.1830985915493), link = "log", r = function (n, rrate = rate) rpois(n, rrate))), hcovariates = list(~1 + cos1t + sin1t, ~1 + cos1t + sin1t), hconstraint = list()) 10: do.call(what = msm::msm, args = msm.args) 11: algo.hmm(counts, control = list(range = length(counts$observed), Mtilde = -1, noStates = 2, trend = FALSE, covEffectsEqual = TRUE, saveHMMs = TRUE)) An irrecoverable exception occurred. R is aborting now ... Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 1.24.0
Flags: --no-vignettes
Check: installed package size
Result: NOTE installed size is 6.5Mb sub-directories of 1Mb or more: R 1.7Mb doc 2.3Mb Flavors: r-devel-windows-x86_64, r-release-windows-x86_64, r-oldrel-windows-x86_64

Version: 1.23.1
Check: package dependencies
Result: NOTE Package suggested but not available for checking: ‘INLA’ Flavor: r-patched-linux-x86_64

Version: 1.24.0
Check: package dependencies
Result: NOTE Package suggested but not available for checking: ‘INLA’ Flavors: r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64

Version: 1.24.0
Flags: --no-vignettes
Check: package dependencies
Result: NOTE Package suggested but not available for checking: 'INLA' Flavor: r-oldrel-windows-x86_64