Hi all,
I'm trying to apply Dirichlet-multinomial mixture model
over some Bracken
(ayesian Reestimation of Abundance with KrakEN) specie abundance in two different condition: treated and not treated in two different data frames (rows as patient ID and cols as ssp).
What I did first is to remove those ssp in both data sets with no abundance (
df_treated<- df_t[!apply(df_t == 0, 2, all)]
df_notreated<- df_nt[!apply(df_nt == 0, 2, all)]
ncol(df_treated) # for the number of taxa 280
nrow(df_treated) # for the number of samples 140
ncol(df_notreated) # for the number of taxa 273
nrow(df_notreated) # for the number of samples 160
Then, I got the et a list of Dirichlet-multinomial parameters:
loglik (unique value) , gamma (one value per ssp), pi (one value per ssp) and theta (unique value).
fit_notreat <- DM.MoM(df_notreated)
fit_treat<- DM.MoM(df_treated)
Third, set up the number of Monte-Carlo experiments to 1000
numMC <- 1000
nrsGrp1 <- rep(1000, 10)
nrsGrp2 <- rep(1000, 10)
group_Nrs <- list(nrsGrp1, nrsGrp2)
alphap <- fit_vg$gamma
pval <- MC.Xdc.statistics(group_Nrs, numMC, alphap, "hnull")
And this gives me this error message
Error in stats::rmultinom(1, Nrs[i], dirmult::rdirichlet(1, shape)) :
NA in probability vector
Any idea about how to solve it? Thanks!