R Under development (unstable) (2024-08-15 r87022 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> test_check("msm")
Loading required package: msm
Error in stat(res) : Error
Error in stat(res) : Error
Error in stat(res) : Error
Error in stat(res) : Error

Call:
msm(formula = state ~ years, subject = PTNUM, data = cav, qmatrix = twoway4.q,     deathexact = TRUE, fixedpars = TRUE, method = "BFGS", control = list(trace = 5,         REPORT = 1))


-2 * log-likelihood:  4908.817 

Call:
msm(formula = state ~ years, subject = PTNUM, data = cav, qmatrix = twoway4.q,     deathexact = TRUE, fixedpars = TRUE, method = "BFGS", control = list(trace = 5,         REPORT = 1))

-2 * log-likelihood:  4908.817 

Call:
msm(formula = state ~ months, subject = ptnum, data = psor, qmatrix = psor.q,     covariates = ~ollwsdrt + hieffusn, constraint = list(hieffusn = c(1,         1, 1), ollwsdrt = c(1, 1, 2)), control = list(fnscale = 1))

Maximum likelihood estimates
Baselines are with covariates set to their means

Transition intensities with hazard ratios for each covariate
                  Baseline                   ollwsdrt             
State 1 - State 1 -0.09594 (-0.1216,-0.0757)                      
State 1 - State 2  0.09594 ( 0.0757, 0.1216) 0.5652 (0.3853,0.829)
State 2 - State 2 -0.16431 (-0.2076,-0.1300)                      
State 2 - State 3  0.16431 ( 0.1300, 0.2076) 0.5652 (0.3853,0.829)
State 3 - State 3 -0.25438 (-0.3396,-0.1905)                      
State 3 - State 4  0.25438 ( 0.1905, 0.3396) 1.6408 (0.8154,3.302)
                  hieffusn           
State 1 - State 1                    
State 1 - State 2 1.646 (1.148,2.359)
State 2 - State 2                    
State 2 - State 3 1.646 (1.148,2.359)
State 3 - State 3                    
State 3 - State 4 1.646 (1.148,2.359)

-2 * log-likelihood:  1114.899 

Call:
msm(formula = state ~ months, subject = ptnum, data = psor, qmatrix = psor.q,     covariates = ~ollwsdrt + hieffusn, constraint = list(hieffusn = c(1,         1, 1), ollwsdrt = c(1, 1, 2)), control = list(fnscale = 1))

Maximum likelihood estimates: 
Transition intensity matrix with covariates set to their means 
 
        State 1                    State 2                   
State 1 -0.09594 (-0.1216,-0.0757)  0.09594 ( 0.0757, 0.1216)
State 2 0                          -0.16431 (-0.2076,-0.1300)
State 3 0                          0                         
State 4 0                          0                         
        State 3                    State 4                   
State 1 0                          0                         
State 2  0.16431 ( 0.1300, 0.2076) 0                         
State 3 -0.25438 (-0.3396,-0.1905)  0.25438 ( 0.1905, 0.3396)
State 4 0                          0                         

Log-linear effects of ollwsdrt 
 
        State 1 State 2                   State 3                  
State 1 0       -0.5706 (-0.9536,-0.1876) 0                        
State 2 0       0                         -0.5706 (-0.9536,-0.1876)
State 3 0       0                         0                        
State 4 0       0                         0                        
        State 4                  
State 1 0                        
State 2 0                        
State 3  0.4952 (-0.2041, 1.1944)
State 4 0                        

Log-linear effects of hieffusn 
 
        State 1 State 2                State 3               
State 1 0       0.4983 (0.1383,0.8584) 0                     
State 2 0       0                      0.4983 (0.1383,0.8584)
State 3 0       0                      0                     
State 4 0       0                      0                     
        State 4               
State 1 0                     
State 2 0                     
State 3 0.4983 (0.1383,0.8584)
State 4 0                     

-2 * log-likelihood:  1114.899 
        State 1                    State 2                   
State 1 -0.09594 (-0.1216,-0.0757)  0.09594 ( 0.0757, 0.1216)
State 2 0                          -0.16431 (-0.2076,-0.1300)
State 3 0                          0                         
State 4 0                          0                         
        State 3                    State 4                   
State 1 0                          0                         
State 2  0.16431 ( 0.1300, 0.2076) 0                         
State 3 -0.25438 (-0.3396,-0.1905)  0.25438 ( 0.1905, 0.3396)
State 4 0                          0                         

Call:
msm(formula = fev ~ days, subject = ptnum, data = fev[1:500,     ], qmatrix = three.q, hmodel = hmodel1, hcovariates = list(~acute,     ~acute, NULL), hcovinits = list(-8, -8, NULL), hconstraint = list(acute = c(1,     1)), death = 3, center = FALSE)

Maximum likelihood estimates
Baselines are with covariates set to 0

Transition intensities
                  Baseline                          
State 1 - State 1 -6.381e-04 (-1.276e-03,-3.192e-04)
State 1 - State 2  6.373e-04 ( 3.183e-04, 1.276e-03)
State 1 - State 3  8.440e-07 ( 3.375e-21, 2.111e+08)
State 2 - State 2 -8.299e-04 (-1.749e-03,-3.938e-04)
State 2 - State 3  8.299e-04 ( 3.938e-04, 1.749e-03)

Hidden Markov model, 3 states
State 1 - normal distribution
Parameters: 
        Estimate       LCL        UCL
mean  106.234293 103.83878 108.629802
sd     17.066749  15.54712  18.734914
acute  -6.993605 -10.10295  -3.884258

State 2 - normal distribution
Parameters: 
       Estimate       LCL       UCL
mean  63.790749  61.40091 66.180592
sd    14.166004  12.98525 15.454123
acute -6.993605 -10.10295 -3.884258

State 3 - identity distribution
Parameters: 
      Estimate LCL UCL
which      999  NA  NA


-2 * log-likelihood:  4269.772 
Hidden Markov model binomial distribution

Parameters:  size = 40, prob = 0.2
Multivariate hidden Markov model with 2 outcomes:
Hidden Markov model binomial distribution

Parameters:  size = 40, prob = 0.3
Hidden Markov model binomial distribution

Parameters:  size = 40, prob = 0.3

Call:
msm(formula = state ~ years, subject = PTNUM, data = cav, qmatrix = oneway4.q,     ematrix = ematrix, deathexact = 4, fixedpars = TRUE)


-2 * log-likelihood:  4296.916 

Call:
msm(formula = state ~ years, subject = PTNUM, data = cav, qmatrix = oneway4.q,     ematrix = ematrix, initprobs = c(0.8, 0.1, 0.1, 0), est.initprobs = TRUE,     deathexact = 4, fixedpars = 1:9, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))

Maximum likelihood estimates

Transition intensities
                Baseline               
Well - Well     -0.1651                
Well - Mild      0.1480                
Well - Death     0.0171                
Mild - Mild     -0.2830                
Mild - Severe    0.2020                
Mild - Death     0.0810                
Severe - Severe -0.1260 (-0.126,-0.126)
Severe - Death   0.1260                

Misclassification probabilities
                    Baseline     
Obs Well | Well     0.9 (0.9,0.9)
Obs Mild | Well     0.1          
Obs Well | Mild     0.1          
Obs Mild | Mild     0.8          
Obs Severe | Mild   0.1          
Obs Mild | Severe   0.1          
Obs Severe | Severe 0.9 (0.9,0.9)

Initial state occupancy probabilities
            Estimate          LCL        UCL
State 1 0.9995418040 8.909618e-01 0.99998008
State 2 0.0001849772 4.097924e-07 0.07835928
State 3 0.0002732188 2.500377e-06 0.03221842
State 4 0.0000000000 0.000000e+00 0.00000000

-2 * log-likelihood:  4297.466 

Observed numbers of individuals occupying states at each time

                 State 1 State 2 State 3 State 4 Total
0                    622       0       0       0   622
1.94602739726027     537       4       5      54   600
3.89205479452054     356      35      24      87   502
5.83808219178081     208      41      28     127   404
7.78410958904108     122      44      27     158   351
9.73013698630135      71      25      22     187   305
11.6761643835616      31      11      13     218   273
13.6221917808219      12       6       5     236   259
15.5682191780822       5       1       3     244   253
17.5142465753424       1       0       2     249   252
19.4602739726027       0       0       0     251   251

Expected numbers of individuals occupying states at each time

                       Well      Mild   Severe     Death Total
0                454.060000 105.74000 62.20000   0.00000   622
1.94602739726027 325.710210 142.31588 85.87563  46.09828   600
3.89205479452054 201.519656 121.76444 94.55263  84.16327   502
5.83808219178081 119.419915  89.03744 88.74180 106.80084   404
7.78410958904108  76.147715  66.14910 82.14786 126.55532   351
9.73013698630135  48.439143  47.43163 71.31882 137.81040   305
11.6761643835616  31.676873  34.25326 60.87352 146.19635   273
13.6221917808219  21.922294  25.83213 53.18927 158.05631   259
15.5682191780822  15.602058  19.85855 46.59544 170.94396   253
17.5142465753424  11.311456  15.46051 40.76362 184.46441   252
19.4602739726027   8.194417  11.98037 35.07316 195.75205   251

Observed prevalences of states (percentages of population at risk)

                     State 1    State 2   State 3   State 4
0                100.0000000  0.0000000 0.0000000   0.00000
1.94602739726027  89.5000000  0.6666667 0.8333333   9.00000
3.89205479452054  70.9163347  6.9721116 4.7808765  17.33068
5.83808219178081  51.4851485 10.1485149 6.9306931  31.43564
7.78410958904108  34.7578348 12.5356125 7.6923077  45.01425
9.73013698630135  23.2786885  8.1967213 7.2131148  61.31148
11.6761643835616  11.3553114  4.0293040 4.7619048  79.85348
13.6221917808219   4.6332046  2.3166023 1.9305019  91.11969
15.5682191780822   1.9762846  0.3952569 1.1857708  96.44269
17.5142465753424   0.3968254  0.0000000 0.7936508  98.80952
19.4602739726027   0.0000000  0.0000000 0.0000000 100.00000

Expected prevalences of states (percentages of population at risk)

                      Well      Mild   Severe     Death
0                73.000000 17.000000 10.00000  0.000000
1.94602739726027 54.285035 23.719313 14.31260  7.683047
3.89205479452054 40.143358 24.255864 18.83519 16.765592
5.83808219178081 29.559385 22.038971 21.96579 26.435852
7.78410958904108 21.694506 18.845898 23.40395 36.055648
9.73013698630135 15.881686 15.551355 23.38322 45.183739
11.6761643835616 11.603250 12.546980 22.29799 53.551777
13.6221917808219  8.464206  9.973795 20.53640 61.025602
15.5682191780822  6.166821  7.849229 18.41717 67.566782
17.5142465753424  4.488673  6.135124 16.17604 73.200163
19.4602739726027  3.264708  4.773057 13.97337 77.988863
Imputing sampling times after deaths...
Calculating replicates of test statistics for imputations...
[ FAIL 0 | WARN 0 | SKIP 7 | PASS 597 ]

══ Skipped tests (7) ═══════════════════════════════════════════════════════════
• On CRAN (7): 'test_draic.r:25:3', 'test_models.r:780:3',
  'test_models_hmm.r:186:3', 'test_pearson.R:24:3', 'test_phase.R:9:3',
  'test_simul.R:2:3', 'test_weights.R:42:3'

[ FAIL 0 | WARN 0 | SKIP 7 | PASS 597 ]
> 
> proc.time()
   user  system elapsed 
  71.95    9.54   81.54