Skip to content

The problem with the run.BMM #4

@sergeikharchenko

Description

@sergeikharchenko

Hi again!

Another one bug.

In run.BMM you have fingR::source.norm.distrib function.
If you have for any sediment source zero values of any markers (see example 1), you'll get Inf values after applying log.

Example 1:

  Sample_name Class_decontamination   Mn   Ca    Y   Rb Sulf  As
1          p6                 ist-2 2357 7273 25.0 87.2  966 6.5
2          p7                 ist-2 2401 8785 23.5 83.0 1611 4.4
3          p8                 ist-2  352 7459 27.6 84.7 2359 0.0
4          p9                 ist-2 1239 9026 26.3 87.7 1797 5.1
5         p10                 ist-2 1829 8405 23.5 79.5 2270 5.8
data %>% dplyr::filter(.data[[class]] == lvl) %>% 
        dplyr::select(-setdiff(colnames(data), tracers)) %>% 
        log()
1 7.765145 8.891924 3.218876 4.468204 6.873164 1.871802
2 7.783641 9.080801 3.157000 4.418841 7.384610 1.481605
3 5.863631 8.917177 3.317816 4.439116 7.765993     -Inf
4 7.122060 9.107865 3.269569 4.473922 7.493874 1.629241
5 7.511525 9.036582 3.157000 4.375757 7.727535 1.757858

And then you'll get such covariation matrix:

Mn    0.637151447  0.0248590004 -0.047949531 -0.0044157323 -0.175839871 NaN
Ca    0.024859000  0.0094514885 -0.002541869 -0.0008024629  0.011451322 NaN
Y    -0.047949531 -0.0025418685  0.004970515  0.0017603691  0.005096706 NaN
Rb   -0.004415732 -0.0008024629  0.001760369  0.0016012739 -0.007882461 NaN
Sulf -0.175839871  0.0114513215  0.005096706 -0.0078824606  0.128953348 NaN
As            NaN           NaN          NaN           NaN          NaN NaN

I guess the data.watcher handles with it on the preparation stage, but it doesn't work without uncertainties data. So anyone who try to use the fingR with zero values and without uncertainties (I know, it's not the true way :-)) will face with the error.

Best regards, Sergey Kharchenko

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