Skip to content

Instantly share code, notes, and snippets.

@bw4sz
Created November 14, 2017 19:12
Show Gist options
  • Save bw4sz/10bb5fa600119aa027343e3aace7a1a8 to your computer and use it in GitHub Desktop.
Save bw4sz/10bb5fa600119aa027343e3aace7a1a8 to your computer and use it in GitHub Desktop.
Seasonal dynamics in transition phase
x<-runif(1e4,0,24)
alpha=0.5
beta=0.5
beta2=0
k=0
timef<-function(x){
y<-alpha + beta* cos((2*pi*x)/(24+k)) + beta2 * sin((2*pi*x)/24+k)^2
return(data.frame(x,y))
}
y<-timef(x)
d<-data.frame(x,y)
d$Season<-"Summer"
ggplot(data=d,aes(x=x,y=y,col=Season)) + geom_point() + geom_line()
x<-runif(1e4,0,24)
alpha=0.5
beta=0.5
beta2=0
k=5
timef<-function(x){
y<-alpha + beta* cos((2*pi*x)/(24+k)) + beta2 * sin((2*pi*x)/24*k)^2
return(data.frame(x,y))
}
y<-timef(x)
d2<-data.frame(x,y)
d2$Season<-"Fall"
d3<-bind_rows(d,d2)
ggplot(data=d3,aes(x=x,y=y,col=Season)) + geom_point() + geom_line() + labs(x="Hour",y="P(Resting->Foraging)")
@bw4sz
Copy link
Author

bw4sz commented Nov 14, 2017

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment