# NOT RUN {
### Reconstruct deposition model based on condensation/dilution of a constant input
#assume a constant input of pollen (this is an arbitrary choice) into the sediment through time
#this is the observed stratigraphic pattern
my.xheight=seq(0,10,by=1)
my.yheight=seq(0,3,length.out=11)+rexp(11)
plot(my.xheight,my.yheight,xlab='Stratigraphic Height',ylab='Pollen Abundance',type='l',
ylim=c(0,max(my.yheight)),main='Stratigraphic Pattern')
#reconstruct deposition model based on the assumption of constant pollen input in time
my.agemodel=patterntodepositionmodel(xheight=my.xheight,yheight=my.yheight)
my.agemodel$report
agemodelage=my.agemodel$time
agemodelheight=my.agemodel$height
plot(agemodelage,agemodelheight,type='l',
lwd=6,main='Reconstructed Deposition Models as Age Model')
legend('topleft',legend='Age Model',lwd=6,col='black')
#approximate deposition rate (=derivative of the age model)
grad=diff(agemodelheight)/diff(agemodelage)
xbase=agemodelage[-1]
plot(xbase,grad,xlab='Time',ylab='Deposition Rate',
main='Reconstructed Deposition Model as Deposition Rate',type='l',lwd=6,ylim=c(0,max(grad)))
#now assume pollen input into the sediment is decreasing and lasts for 2 time units
my.xage=c(0,2)
my.yage=c(5,1)
plot(my.xage,my.yage,type='l',xlab='Time',ylab='Pollen Input',ylim=c(0,max(my.yage)),
lwd=6,main='Temporal Pattern')
#reconstruct age model based on these updated assumptions
my.agemodel2=patterntodepositionmodel(xheight=my.xheight,yheight=my.yheight,
xage=my.xage,yage=my.yage)
my.agemodel2$report
agemodelage2=my.agemodel2$time
agemodelheight2=my.agemodel2$height
plot(agemodelage2,agemodelheight2,type='l',lwd=6,
main='Reconstructed Deposition Model as Age Model')
legend('topleft',legend='Age Model',lwd=6,col='black')
#if a pattern is given as bins, use the option 'heightmode' or 'agemode'
#define stratigraphic pattern as binned function
my.xheight3=seq(0,10,length.out=11) #borders of the bins used to define the stratigraphic pattern
my.yheight3=seq(0,3,length.out=10)+rexp(10) #note that xheight has one element more than yheight
barplot(my.yheight3,width=diff(my.xheight3),ylab='Pollen Abundance',xlab='Stratigraphic Height',
space=0,main='Stratigraphic Pattern')
#reconstruct age model as in the first example, but with the binned pollen observation
# in stratigraphic height
#Note that pollen input in time is again assumed to be constant
#(default setting if no xage and yage given)
my.agemodel3=patterntodepositionmodel(xheight=my.xheight3,yheight=my.yheight3,heightmode='binned')
my.agemodel3$report
agemodelage3=my.agemodel3$time
agemodelheight3=my.agemodel3$height
plot(agemodelage3,agemodelheight3,type='l',lwd=6,
main='Reconstructed Deposition Model as Age Model')
legend('topleft',legend='Age Model',lwd=6,col='black')
#The same option is also available for the temporal pattern (no example given)
# }
Run the code above in your browser using DataLab