0

The following indicates the code and output:

library(minpack.lm) #Levenberg-Marquardt Nonlinear Least-Squares algorithm (with support for lower and upper parameter bounds)

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
  • 1
    You should post a transcript with the full error message, since it's not at all clear that the error is coming from the `confint` call. Even that might not be enough since the error suggests pathology in your dataset and just seeing a subset may not allow intelligent answers. – IRTFM Jan 28 '15 at 20:42

1 Answers1

0

Your function NormalizedM~A*(1-exp((-k)*DayM)) will generate a log of negative number error if confint attempts to calculate a value of NormalizedM > A.

You could try calculating the logarithm of NormalizedM

log_NormalizedM <- log(NormalizedM)

and fit a linear model to that.

fit <- lm(log_NormalizedM ~ DayM)
dww
  • 30,425
  • 5
  • 68
  • 111