2

I want to fit a curve,the model is as the following picture.

enter image description here

In this model, there are four parameters(alpha,beta,gamma and Rd)to optimize,now the data of I and P(I) is already,and the function DEoptim() from DEoptim package in R is used,this is my code.

library(DEoptim)
I <-c(1.200,49.600,99.200,148.500,199.300,399.375,598.200,799.500,1099.600,1398.100,1698.600,1844.333)
pn <-c(-0.0495485,0.4166522,0.8954644,1.4592700,1.9931400,2.9114072,3.0808183,3.2427603,3.3916783,3.6078660,4.1020850,4.0947913)

fn.piao <- function(alpha,beta,gamma,Rd){
   pn <- (alpha-alpha*beta*par)/(1+gamma*par)-Rd      
}

lower <- c(0,0,0,0)
upper <- c(1,1,1,100)
DE.control <- list(itermax=500,NP=100)

DE.piao <- DEoptim(lower,upper,fn=fn.piao,par=par,control=DE.control)

but R shows error as follows

Error in DEoptim(lower, upper, fn = fn.piao, par = par, control = DE.control) : object is not a matrix

In the paper (K.M. Mullen2011), it says ith element of lower and upper applies to the ith parameter. so i set the vector lowerand upper to represent alpha, beta, gamma and Rd.i want to ask where is my fault and how to adjust?

Sathish
  • 12,453
  • 3
  • 41
  • 59
YQ.Zhi
  • 21
  • 2

0 Answers0