File: deriv-debug.R

package info (click to toggle)
r-cran-msm 1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,740 kB
  • sloc: ansic: 2,700; makefile: 14
file content (11 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
### Derivatives at MLE for CAV model

## derivsimple sums over fromstate/tostate/timelag/obstype combinations. 1190 of these in cav.msm
if (0){ 
cav.msm <- msm( state ~ years, subject=PTNUM, data = cav, qmatrix = twoway4.q, death = TRUE, fixedpars=FALSE, method="BFGS" )
q.mle <- cav.msm$estimates
cav.msm$minus2loglik
likderiv.msm(q.mle, deriv=0, cav.msm$data, cav.msm$qmodel, cav.msm$qcmodel, cav.msm$cmodel, cav.msm$hmodel, cav.msm$paramdata)
likderiv.msm(q.mle, deriv=1, cav.msm$data, cav.msm$qmodel, cav.msm$qcmodel, cav.msm$cmodel, cav.msm$hmodel, cav.msm$paramdata)
colSums(likderiv.msm(q.mle, deriv=3, cav.msm$data, cav.msm$qmodel, cav.msm$qcmodel, cav.msm$cmodel, cav.msm$hmodel, cav.msm$paramdata)) # should be about 0 
}