Error in solving ODE - need help

Hello,

I have to do a research project for my Systems Biology class and I am finding many difficulties in coding the system of ODEs that I have generated as I am really unexperienced in R.

Here is my code. When I compute it I get an

Error in eval(substitute(expr), data, enclos = parent.frame()) :
object 'rTr' not found

MergeModel <- function(Time, State, Pars) {
  with(as.list(c(State, Pars)), {
    
    # ------------------------------------------------
    # Treg equation (number 8)
    # ------------------------------------------------
    deathRate		<- rTr*Tr
    productionRate	<- lambdaTrI2*Tb*(I2/(KI2+I2))*(M/(M+KM))*(KTa/(Ta+KTa))
    GCRate		<- a*(1-e^(-g))*Tr

    dTrdt		<- productionRate + GCRate - deathRate
    
    return(list(c(dTrdt)))
    # ------------------------------------------------
  })
}
Pars	<- c(rTr = 1.97*10^(-1),
	lambdaTrI2 = 1.76*10^8,
	Tb = 1.55*10^(-7),
	KI2 = 5*10^(-7),
	I2 = 5.2*10^(-7),
	M = 10^(-3),
	KM = 3*10^(-3),
	KTa = 5*10^(-7),
	Ta = 1.56*10^(-7),
	a = 1.0483,
	g = 1 )

y0  <- c(Tr = 5.372*10^(-3))
timespan <- seq(0, 100, by = 1)
MergeModel.sol <- ode(y0, timespan, MergeModel, pars)
summary(MergeModel.sol)

I do not understand why the Pars function seems to not be working... My report is due tonight so if somebody could help me out I would greatly appreciate it.
For some background, I am modeling a glucocorticoid treatment of sarcoidosis disease (called Merge Model), the equation presented here corresponds to the effect of this drug in a specific cell population called Treg (Tr).

Thank you very much!

In your code, you define Pars but then pass pars, these are different variables. I guess you have an object called pars in your workspace that doesn't contain Tr.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.