Giter Site home page Giter Site logo

Comments (5)

sophiakrix avatar sophiakrix commented on August 18, 2024

Here is the code with a sample file that I used:

github_issue_file.txt
sample_df.csv

from msm.

chjackson avatar chjackson commented on August 18, 2024

Looking at that qmatrix and ematrix, that model will not be identifiable from the data. You are allowing misclassification between all states, and instantaneous transitions between all states. There will be no way to tell from the data which combinations of parameter values are more plausible. The likelihood will be a flat function of the parameters, so that the optimum doesn't exist.

I'd advise to consider the structure of the process that you are modelling, and choose the allowed transitions and misclassifications more carefully. These are continuous-time Markov models - so even a transition between a pair of states can happen over an interval, it may not be possible in continuous time - see the course notes. Also make sure the observation scheme is set appropriately (through the obstype or exacttimes arguments) - do you know when the transitions happen in continuous time?

Don't give up with using fixed parameter values - e.g. if you must model misclassification, then this may only be possible with fixed misclassification probabilities.

from msm.

sophiakrix avatar sophiakrix commented on August 18, 2024

Dear Prof. Jackson,

Thanks so much for your suggestions, it really seems like I might have allowed too many possibilities for the model.

Could you explain and give me an example of how to specify fixedpars for the misclassification probabilities? In the documentation it says:

" These are given in the order: transition intensities
(reading across rows of the transition matrix), covariates on intensities (ordered
by intensities within covariates), hidden Markov model parameters, including
misclassification probabilities or parameters of HMM outcome distributions (ordered by parameters within states), hidden Markov model covariate parameters
(ordered by covariates within parameters within states), initial state occupancy
probabilities (excluding the first probability, which is fixed at one minus the sum
of the others)."

If I have 4 possible states, how should the misclassification probabilities be specified such that not the transition intensities are fixed instead? And do they change in case I use covariates?

Thanks a lot in advance!

from msm.

chjackson avatar chjackson commented on August 18, 2024

Can I explain in the simplest case with a 2-state model? If you have, say qmatrix = rbind(c(0, 0.01), c(1, 0.02)), and ematrix = rbind(c(0, 0.2), c(0.1, 0)), there are 4 parameters in the model. These parameters are given labels of 1, 2, 3, 4 to refer to them in fixedpars.

So to fix both misclassification probabilities, but not the intensities, specify fixedpars = c(3, 4). Or to fix the first misclassification probability at 0.2, but estimate the second one (starting from an initial value of 0.1), it will be just fixedpars=3.

Does the general idea behind the text in the help file make more sense now? This text explains the order that the parameters are in when referring to them as 1,2,3,4,...

from msm.

sophiakrix avatar sophiakrix commented on August 18, 2024

Thank you for your explanation, that helped a lot. I was able - after a bit of trial and error - to set the parameters accordingly (fixing two of the misclassification parameters) such that the models converged. I also restricted my initial qmatrix with the allowed transitions a bit more, as well as the misclassification matrix. All together helped, so thanks a lot!

For anyone else reading this post: I want to give you an example for the fixedpars arguments to showcase how it would work with covariates - as far as I understood it. Please correct me if I am wrong!

qmatrix <- rbind(
  c(0, 0.1, 0, 0), 
  c(0.1, 0, 0.1, 0),
  c(0.1, 0.1, 0, 0.1),
  c(0.1, 0.1, 0, 0)
)
  • qmatrix (4x4) with 8 parameters --> indices 1:8 for fixedpars would fix these qmatrix entries
covariates <- "~age + sex + bmi"
  • 3 covariates, on 8 parameters from the qmatrix (3*8)--> indices 9:32 for fixedpars would fix the covariates on the intensities
    ematrix <- rbind(
        c(0, 0.1, 0, 0), 
        c(0.1, 0, 0.1, 0.1),
        c(0, 0.1, 0, 0.1),
        c(0, 0, 0, 0)
    ) 
  • misclassification matrix (4x4) with 6 parameters --> indices 33:38 would fix the misclassification rates

Cheers!

from msm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.