3

for some hours I'm struggling with the following problem: I'm trying to get a function that will fit my measured data. However, I need to reason why I choose a particular function. After carefully reading some literature regarding calcite nucleation and growth, we think that the function, which describes the nucleation time of calcium carbonate, must have the following form:

time(s) = (I^a)(pH^b)((stoichiometry (r_aq))^c)*((omega-1)^d)

where, I - ionic strength, omega = saturation degree and a, b, c, d are several parameters. (d for example is the type of crystal growth).

First I want to check the c parameter value by assuming a constant pH, saturation degree and ionic strength (I have experimental data for this). Ultimately I'm trying to get all the parameter values by the nls function, so someone could tell the range of nucleation time under several geochemical conditions.

However, I have 2 problems concerning this goal:

1) The function seems not to be working properly. It gives me errors on recursive default argument reference / earlier problems and arguments missing, which I could not fix (I think its something easy to fix)

2) The nls function itself gives me an error about singular gradient matrix at initial parameter estimates.

I have tried to google my errors, but unfortunately I was not able to fix them by myself. The code concerning the function part is the following

# function
I <- 0.20
pH <- 11
r_aq70_fit <- seq(0.01, 100, 0.01)
t70_fit <- seq(1, 10000, 1)
omega <- 70

a <- 1
b <- 1
d <-1

funct70 <- function(I=I, pH, r_aq70_fit, omega=omega, a, b, c, d) {
           (I^a)*(pH^b)*((r_aq70_fit)^c)*((omega-1)^d)
           }

fit70 <- nls(t70_fit ~ funct70(I, pH, r_aq70_fit, omega, a, b, c, d), 
         data = data.frame(r_aq70_fit, t70_fit), 
         start = list(a=a, b=b, c=0.5, d=d))

The plotted data from my measurements: Measurements1

(Im not sure if it can be opened)

0 Answers0