View source: R/bremla_synchronized_simulation.R
bremla_synchronized_simulation | R Documentation |
Produces simulations from the synchronized time scale given tie-point samples.
bremla_synchronized_simulation(object, control.sim, print.progress = FALSE)
object |
Output of function |
control.sim |
List containing specifications for the simulation procedure,
including the number of samples to be generated and whether or not the chronologies
should be synchronized (for this function this should be set to |
print.progress |
Boolean. If |
Returns the object
list from the input and appends a list which
includes all synchronized simulations, summary statistics and other information
computed or related to the simulation procedure in object\$simulation
.
Eirik Myrvoll-Nilsen, eirikmn91@gmail.com
bremla_chronology_simulation
bremla
if(inlaloader()){
require(stats)
set.seed(1)
n <- 1000
phi <- 0.8
sigma <- 1.2
a_lintrend <- 0.3; a_proxy = 0.8
dy_noise <- as.numeric(arima.sim(model=list(ar=c(phi)),n=n,sd=sqrt(1-phi^2)))
lintrend <- seq(from=10,to=15,length.out=n)
proxy <- as.numeric(arima.sim(model=list(ar=c(0.9)),n=n,sd=sqrt(1-0.9^2)))
dy <- a_lintrend*lintrend + a_proxy*proxy + sigma*dy_noise
y0 = 11700;z0=1200
age = y0+cumsum(dy)
depth = 1200 + 1:n*0.05
depth2 = depth^2/depth[1]^2 #normalize for stability
formula = dy~-1+depth2 + proxy
data = data.frame(age=age,dy=dy,proxy=proxy,depth=depth,depth2=depth2)
data = rbind(c(y0,NA,NA,z0,NA),data) #First row is only used to extract y0 and z0.
events=list(locations=c(1210,1220,1240))
control.fit = list(ncores=2,noise="ar1")
synchronization=list(locations=depth[c(100,400,700)],method="gauss",
params=list(mean=c(age[c(100,400,700)]+c(30,-100,50)),
sd=c(50,20,100)
)
)
control.sim=list(synchronized=TRUE,
summary=list(compute=TRUE))
object = bremla_prepare(formula,data,nsims=5000,reference.label="simulated timescale",
events = events,
synchronization=synchronization,
control.fit=control.fit,
control.sim=control.sim)
object = bremla_modelfitter(object)
object = tiepointsimmer(object)
object = bremla_synchronized_simulation(object, print.progress=TRUE)
summary(object)
plot(object)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.