R编程nls():具有错误奇异梯度的confint()
以下显示代码和输出: libraryminpack.lm Levenberg-Marquardt非线性最小二乘算法,支持上下参数界R编程nls():具有错误奇异梯度的confint(),r,csv,nls,levenberg-marquardt,R,Csv,Nls,Levenberg Marquardt,以下显示代码和输出: libraryminpack.lm Levenberg-Marquardt非线性最小二乘算法,支持上下参数界 library(ggplot2) #Sophisticated combination of base and lattice graphics DRP <-read.csv(file="NormalizedDRP.csv", header=TRUE) attach(DRP) > # Lysis: 1% Lysed Algae + Seed
library(ggplot2) #Sophisticated combination of base and lattice graphics
DRP <-read.csv(file="NormalizedDRP.csv", header=TRUE)
attach(DRP)
> # Lysis: 1% Lysed Algae + Seed #
> LAS1 <-subset(DRP, RunM=="1% LAS ", select=DayM: NormalizedM)
> LAS1
DayM NormalizedM
1 0 3.7
2 4 3.0
3 10 8.0
4 21 8.3
5 39 8.7
> fmLAS1 <-nlsLM(NormalizedM~A*(1-exp(-k*DayM)), data=LAS1, start=list(A=8, k=0))
> fmLAS1
Nonlinear regression model
model: NormalizedM ~ A * (1 - exp(-k * DayM))
data: LAS1
A k
8.9060 0.1496
residual sum-of-squares: 15.98
Number of iterations to convergence: 8
Achieved convergence tolerance: 1.49e-08
> coef(fmLAS1)
A k
8.9060252 0.1495719
> confint(fmLAS1)
Waiting for profiling to be done...
Error in prof$getProfile() : singular gradient
> deviance(fmLAS1)
[1] 15.97858
Data Set: I grabbed only a subset of the data for the variables Run M and DayM set to 1%LAS; which stands for 1% Lysed autoclaved Seed in anaerobic digestion
如果confint尝试计算NormalizedM>A的值,则函数NormalizedM~A*1-exp-k*DayM将生成负数错误日志 你可以试着计算一个人的对数
log_NormalizedM <- log(NormalizedM)
然后用一个线性模型来拟合
fit <- lm(log_NormalizedM ~ DayM)
您应该发布一份包含完整错误信息的成绩单,因为根本不清楚错误是否来自confint调用。即使这样也可能不够,因为错误表明数据集中存在病理学,仅仅看到一个子集可能无法给出明智的答案。