[R] singular gradient error in nls

Bert Gunter
Tue, 11 Oct 2011 19:38:00 -0000

Katie:

I would say that this is not an R question, so I would suggest that either

a) You ask it on a statistics help website like stats.stackexchange.com  or
b) You consult with someone locally who knows about nonlinear regression
(possibly a statistician, but not necessarily so).

-- Bert


On Tue, Oct 11, 2011 at 11:34 AM, Katie Tully
<katherinetully@gmail.com>wrote:

> I am trying to fit a nonlinear regression to infiltration data in order to
> determine saturated hydraulic conductivity and matric pressure.  The
> original equation can be found in Bagarello et al. 2004 SSSAJ (green-ampt
> equation for falling head including gravity).  I am also VERY new to R and
> to nonlinear regressions. I have searched the posts, but am still unable to
> determine why my data come up with the "singular gradient" error.
>
> Here are the data:
> time <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
> 19)
> #time in minutes
> cumul <-c(2, 5, 7, 9.5, 11, 13, 14, 15, 16, 18.5, 21, 23, 24.5, 26.5,
28,
> 29.5, 31, 31.5, 32.5) #cumulative infiltration in cm per min
> df <- data.frame(time, cumul)
> df$cumul.m <- df$cumul/100/60 #convert to meters per second
> df$time.s <- df$time*60 #convert to seconds
> b2 <- 1-(0.196/(0.06/0.01131)) #relationship between soil moisture and
the
> size of the ring infiltrometer (6 cm radius by 113.1 cm2 cross sectional
> area)
> theta <- 0.196 #difference in residual soil water and field capacity
>
> Here is the formula:
> #Where a = K_fs and b=psi_f
> nlsfit <-
>
>
nls(time.s~(theta/a*b2)*((cumul.m/theta)-(((0.16-b)/b2)*log(1+((cumul.m*b2)/(theta*(0.16-b)))))),
> data = df, start=list (a=1, b=0.5), trace=TRUE)
>
> -----
> I am likely "over parameterizing", but I must admit, that I am
not entirely
> sure what that means.  Any help offered would be greatly appreciated.  I am
> sorry if I sound naive, but I am an ecologist, not a hydrologist.
>
> Kate
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]