Skip to content

issues fitting a non-gaussian trait with fitmultiBM #167

@mluerig

Description

@mluerig

Hi Liam,

(we had a small chat at this year's Evolution Meeting about this)

I am trying to model the evolutionary rates of a few different traits with a hidden rate model, some of which have a non-gaussian distribution that ranges from 0 to 1 (see figure below). Before talking to you, I had scaled to a mean of zero and variance of 1, but you suggested to use the lims argument (which btw is not documented for this function at all). So this is what I tried:

hrm_fit <- fitmultiBM(tree, trait, ncat = 2, lims = c(0, 1), model.hrm = "ER", levs = 100, root = "nuisance")

It works for some of the ng traits, but then for some I keep getting this error:

Error in eigen(x, symmetric = isSym) : infinite or missing values in 'x'
In addition: Warning messages:
1: In log(pp) : NaNs produced
2: In log(pp) : NaNs produced
3: In log(pp) : NaNs produced
4: In log(pp) : NaNs produced
5: In log(pp) : NaNs produced
6: In log(pp) : NaNs produced

There are no NA/infinite/missing values in the trait. AI suggested that might be related to sparsity in the trait (i.e., right skew) that then affects matrix calculations, so I reduced the number of levels down to 50. However, I'm still getting the same error....do you have any suggestions? Is re-scaling the trait a no-go?

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions