[R] nls picewise FvCB model

Andres Berger agb32 at cornell.edu
Mon Sep 19 16:30:51 CEST 2011


Greetings R users, maybe there is someone who can help me with this problem:

I'm trying to fit this discontinous model :

GE<-data.frame( Ci<-c(81,87,91,111,159,173,295,453,629,984),
A<-c(-0.9,1.2,3.5,8.3,13.1,14.4,22.9,27.3,29.6,32.6) )
rhs <- function(Ci, Vcmax, J, Rd) {
   R <-0.008314472
   Tleaf <-25
   Kc <-exp(38.05-79.43/(R*(Tleaf+273.15)))
   Ko <-exp(20.30-36.38/(R*(Tleaf+273.15)))
   Gstar <-exp(19.02-38.83/(R*(Tleaf+273.15)))
   O <-210
   ge<-min(  (Vcmax*(Ci-Gstar))/(Ci+(Kc*(1+(O/Ko))))
,(J*(Ci-Gstar))/((4*Ci)+(8*Gstar))  ) -Rd
   ge
   }

m<- nls(A ~ rhs(Ci, Vcmax, J, Rd), data=GE, start = list(Vcmax=50,
J=150, Rd=4), trace = T)

And get the following error:

Error in qr(.swts * attr(rhs, "gradient")) :
 dims [product 3] do not match the length of object [10]
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In .swts * attr(rhs, "gradient") :
 longer object length is not a multiple of shorter object length

Any clues on how can I solve the Inf issue and avoid the error?
Thanks,

Andre



More information about the R-help mailing list