[R-sig-dyn-mod] How to change a parameter after steady?
Jinsong Zhao
jszhao at yeah.net
Sun Apr 27 08:13:47 CEST 2014
On 2014/4/26 3:25, Thomas Petzoldt wrote:
> Hi,
>
> there are several methods to implement this, so it would help us if you
> could provide a *minimal* reproducible example.
>
> Thomas
>
Can the following example be used here? Assumed the model reached steady
when times >= 100. Then I hope to change r to 0.12, or K to 15. How to?
May forcings in the previous post work? Any other solution?
Thanks again.
Best,
Jinsong
library(deSolve)
model <- function (time, y, parms) {
with(as.list(c(y, parms)), {
dN <- r * N * (1 - N / K)
list(dN)
})
}
y <- c(N = 0.1)
parms <- c(r = 0.1, K = 10)
times <- seq(0, 100, 1)
out <- ode(y, times, model, parms)
plot(out)
> On 4/25/2014 9:37 PM, Jinsong Zhao wrote:
>> Hi there,
>>
>> I have established a model. I set the times to a enough long period,
>> so that the model runs into steady state. After the model reaching
>> steady, I hope to change a or several parameters and run the model
>> for a fixed periods. I expect to see some changes of state variables
>> or auxiliary variables.
>>
>> How to implement it? Thanks a lot!
>>
>> Best wishes, Jinsong
More information about the R-sig-dynamic-models
mailing list