A R代碼,我試圖符合以下模型:錯誤執行非線性迴歸
> x<-c(8100,12900,13800,14250,14700,20700,23100,25200,27300,28560,29760,30060,39060,39660,42060,
42660,57720,57840,58200,59400,59700,60900,62100,65400,85200,88200,88800,98400,106800,114900)
> y<-c(1:30)
> df<-data.frame(x,y)
> fit <- nls(y ~ a*(1-exp(-x/b))^c, data=df, start=c(a=1,b=1,c=1),algorithm="plinear")
Error in qr.solve(QR.B, cc) : singular matrix 'a' in solve
> fit <- nls(y ~ a*(1-exp(-x/b))^c, data=df, start=c(a=1,b=1,c=1),algorithm="port")
Error in nlsModel(formula, mf, start, wts, upper) :
singular gradient matrix at initial parameter estimates
但你可以看到我關於奇異漸變矩陣的一個錯誤。我能做些什麼來避免這個錯誤?
可否請你說清楚你的問題是什麼? – jbaums
您正在處理迴歸中的奇異矩陣。看看這篇文章:http://stats.stackexchange.com/questions/70899/what-correlation-makes-a-matrix-singular-and-what-are-implications-of-singularit – Zbynek
請。這不是一個問題,而是一段代碼。 – jbaums