GithubHelp home page GithubHelp logo

Comments (9)

rbouckaert avatar rbouckaert commented on June 8, 2024 2

The way you have things set up looks OK to me, and indeed leaving at least one rate fixed (to 1) makes everything identifiable.

What I tried to point out is that in a rate matrix for N states, there are N*N entries in the rate matrix, but N+1 of them are not free: N on the diagonal and 1 because of the normalisation. So, for binary data, N=2, leaving just 1 degree of freedom. But since you have more sources of information for α and β this restriction does not apply in your case: α and β are identifiably for their individual sites, so having another rate matrix as function of α and β should not be a problem.

Anyway, let me know if you need any help implementing these substitution models or the constraints you want to put on parameters.

from beast2.

jjmccollum avatar jjmccollum commented on June 8, 2024 1

I may need your help in implementing these changes. I'm working with @rbturnbull on this, and he's more experienced in adding features to BEAST than I am, but it would also be a valuable skill for me to learn, so any help would be appreciated!

from beast2.

rbouckaert avatar rbouckaert commented on June 8, 2024

There is no convenient way to do this as far as I am aware off other than write a few classes and put them in a package. I am happy to assist if that seems too complicated.

One thing to be aware of in the example you gave is that there is only a single degree of freedom in the binary "general" substitution model: rates are normalised to give an expected rate of 1, so α and β are not identifiable and perhaps parameterising as

-α      α
1-α   -1+α

and restricting α to be in the range 0 to 0.5 could be an alternative to ensure the α<β.

from beast2.

jjmccollum avatar jjmccollum commented on June 8, 2024

@rbouckaert What I have in mind is that the rate parameters α, β, etc. would be common over all sites. (Ideally, we would have one copy of each such parameter per branch, as we do for branch length, but this may be too complex, so making the rate variables global over all sites and branches would also be acceptable.) In this case, if I have at least one site whose substitution matrix contains a 1, would this allow us to determine the rate parameters even at sites whose matrices contain only parameters?

For example, say at site 1 we have the matrix

-α    α
α+β -α-β

at site 2, we have

-α    α
 α   -α

and at site 3 we have

-β-1  β   1
 β   -2β  β
 1    β  -β-1

Since the values assigned to α and β are assumed to hold over all sites, will the first two substitution models work as they are, or will normalization still pose a problem?

from beast2.

rbturnbull avatar rbturnbull commented on June 8, 2024

Hi @jjmccollum and @rbouckaert - this all looks good to me. I'm happy to work with @jjmccollum on this and we'll see how we go. We might have questions in the future.

from beast2.

jjmccollum avatar jjmccollum commented on June 8, 2024

It looks like we might already be able to encode rate parameter combinations in substitution model matrices using RPNcalculator. For the matrix

                 -1                      1
        Clar_rate + Byz_rate  -Clar_rate - Byz_rate

the XML

<parameter spec="parameter.CompoundValuable" id="rates.character1" name="rates">
    <!-- Start rate vars -->
    <var idref="default_rate"/>
    <var spec="RPNcalculator" expression="Clar_rate Byz_rate +">
        <parameter idref="Clar_rate"/>
        <parameter idref="Byz_rate"/>
    </var>
    <!-- End rate vars -->
</parameter>

appears to work; at the very least, it is not raising any exceptions when I input the XML to BEAST.

from beast2.

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.