Open Jigyasa3 opened 4 years ago
Sorry I haven't been too responsive to github -- I'll try to look into this as soon as I can! It is definitely an issue with the nlsLM
function in the minpack.lm
R package, so I would try asking there as well.
However, I suspect that problem is arising from the fact that you only have 3 OTUs. If they are part of a larger dataset, I would recommend not being as stringent in your filtering.
thank you for replying! I will try with more/all OTUs too.
Hey @DanielSprockett
I have 3 OTUs as columns for 99 samples in rows. When I run the fit_sncm function as it is from github, I get the following error- "Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates"
Google search showed that my "start" and "m" values are not optimized for the model, so following advice from https://stats.stackexchange.com/questions/160552/why-is-nls-giving-me-singular-gradient-matrix-at-initial-parameter-estimates < c.0 <- min(df$column1) * 0.5 model.0 <- lm(log(column1 - c.0) ~ column2+column3, data=df) start <- list(a=exp(coef(model.0)[1]), b=coef(model.0)[2], c=c.0)
< head(start) $a (Intercept) 0.0004627316
$b column2 564.1193
$c [1] 0.0001078283
I changed the "m" in "start" parameter to 0.0001 or 0.0004. But I keep getting the same error.
Can you suggest how to optimize the value of "start" and "m" for a spare OTU matrix?