Skip to content
Back to formatted view

Raw Message

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){ &nbsp;
??????with(as.list(c(stock,aux)),{ &nbsp; &nbsp;
????????????aAvailability=1-sKnowledgeObtained/1 &nbsp; &nbsp;
????????????fHide=1*aHideFraction*aAvailability &nbsp; &nbsp;
????????????aFear=fHide*aRelevance &nbsp; &nbsp;
????????????fSeek=aFear*aResource &nbsp; &nbsp;
????????????sKnowledgeObtained=fSeek*aSeekFraction &nbsp; &nbsp;
????????????net=fHide-fSeek &nbsp; &nbsp;
????????????return(list(c(net), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
??????????????????hide=fHide,seek=fSeek,available=aAvailability,fear=aFear,net=net)) &nbsp;
})
}


out=data.frame(ode(times=time,y=stock,parms=aux,func=model,method='euler'))
out


ggplot()+ &nbsp;
??????geom_line(data=out,aes(time,sKnowledgeObtained),colour="blue")+ &nbsp;
??????geom_line(data=out,aes(time,net),colour="red")+ &nbsp;
??????geom_line(data=out,aes(time,available),colour="green")+ &nbsp;
??????geom_line(data=out,aes(time,fear),colour="yellow")+ &nbsp;
??????#geom_point(data=out,aes(time,sPopulation),colour="blue")+ &nbsp;
??????ylab("trend")+ &nbsp;
??????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]]