Message-ID: <tencent_FCB793E36DB1BF6BFA40875366F3FC39D008@qq.com>
Date: 2024-06-23T14:19:39Z
From: ya
Subject: [R-sig-dyn-mod] two questions in a simulation
Dear list,
I am trying a system dynamics simulation with the deSolve package. The model describes the following content:
The knowledge hiding makes people anxious,the anxiety makes people go knowledge seeking, the knowledge seeking behavior increases the obtained knowledge that was hidden, which reduces the anxiety. The problem I encountered are:
The knowledge seeking behavior increased the knowledge people obtained from 0 to 100% of the knowledge, thus, the anxiety reduced to 0. When people obtained 100% of the knowledge, they stop knowledge seeking. However, the knowledge in the background would be updated with some rate, for instance, 1% every 10 time units (days), which makes people have chance to do knowledge hiding again, which further makes the victims of knowledge hiding anxious again. What structure do I need to express this logic?
What is the correct way of getting the interactive effect? Do I just fix the interactive variable to a certain value and run the model again and again to get the results for this value like what we do in sensitivity test? or is there a way to get the interactive effect in a single run of simulation?
Please find the replicable code below:
library(deSolve)
library(ggplot2)
time=seq(0,100,1)
stock=c(sKnowledgeObtained=0) aux=c(aHideFraction=0.9,aRelevance=0.5,aResource=0.5,aSeekFraction=0.8)
model=function(time,stock,aux){
??????with(as.list(c(stock,aux)),{
????????????aAvailability=1-sKnowledgeObtained/1
????????????fHide=1*aHideFraction*aAvailability
????????????aFear=fHide*aRelevance
????????????fSeek=aFear*aResource
????????????sKnowledgeObtained=fSeek*aSeekFraction
????????????net=fHide-fSeek
????????????return(list(c(net),
??????????????????hide=fHide,seek=fSeek,available=aAvailability,fear=aFear,net=net))
})
}
out=data.frame(ode(times=time,y=stock,parms=aux,func=model,method='euler'))
out
ggplot()+
??????geom_line(data=out,aes(time,sKnowledgeObtained),colour="blue")+
??????geom_line(data=out,aes(time,net),colour="red")+
??????geom_line(data=out,aes(time,available),colour="green")+
??????geom_line(data=out,aes(time,fear),colour="yellow")+
??????#geom_point(data=out,aes(time,sPopulation),colour="blue")+
??????ylab("trend")+
??????xlab("Year")
I hope I have described my problem clearly. This is my first system dynamics simulation in R. Please give me some suggestions. Thank you very much.
Best regards,
YA
[[alternative HTML version deleted]]