plot.bremla: Plot bremla model

View source: R/plot.bremla.R

plot.bremlaR Documentation

Plot bremla model

Description

Plots results from bremla S3 class.

Usage

## S3 method for class 'bremla'
plot(
  x,
  plot.ls = list(fitted = TRUE, legend = NULL, residuals = TRUE, histogram = TRUE, qqplot
    = FALSE, acf = TRUE, xrev = FALSE, label.fit = NULL, label.res = NULL, label.hist =
    NULL, label.qq = NULL, label.acf = NULL, merge = TRUE),
  plot.inla.posterior = list(posteriors = TRUE, label = NULL),
  plot.inlasims = list(plotsims = 0, legend = NULL, xrev = FALSE, label = NULL),
  plot.syncsims = list(plotsims = 0, legend = NULL, xrev = FALSE, label = NULL),
  plot.tiepoints = list(col.hist = "orange", breaks.hist = 50, label.x = "Age (yb2k)",
    label.main = NULL),
  plot.bias = list(MCE = NULL, legend = NULL, xrev = FALSE, label = NULL),
  plot.linramp = list(depth.reference = NULL, show.t0 = TRUE, show.t1 = TRUE, xrev =
    TRUE, label = NULL),
  plot.event_depth = list(depth.reference = NULL, xrev = TRUE, label = NULL),
  plot.event_age = list(age.reference = NULL, xrev = TRUE, label = NULL),
  postscript = FALSE,
  pdf = FALSE,
  prefix = "bremla.plots/figure-",
  ...
)

Arguments

x

bremla S3 class. Output of bremla function

plot.ls

List specifying how the least square fit should be illustrated. fitted=TRUE plots the fitted values with label label.fit, legend specifies the legend, residuals=TRUE means the residuals are plotted with title label.res. if histogram=TRUE the residuals are represented in a histogram with label label.hist, if qqplot=TRUE a quantile-quantile plot of the residuals are plotted with title label.qq and if acf=TRUE the empirical autocorrelations are plotted with title label.acf.

plot.inla.posterior

list specifying how the results from the inla regression fit should be plotted. If posteriors=TRUE then the posterior marginal distributions of the hyperparameters are plotted with title label.

plot.inlasims

list specifying how the simulated chronologies from the INLA posterior should be plotted. plotsims gives how many simulated chronologies should be included in the plot (with title label), legend specifies the legend, if xrev=TRUE the x-axis is reversed to give a chronological ordering.

plot.syncsims

list specifying how the simulated synchronized chronologies from the INLA posterior should be plotted. plotsims gives how many simulated chronologies should be included in the plot (with title label), legend specifies the legend, if xrev=TRUE the x-axis is reversed to give a chronological ordering.

plot.tiepoints

list containing specifications for plotting histogram of sampled tie-points.

plot.bias

list specifying how the simulations under the assumptions of unknown counting bias should be represented. If MCE is given as a numeric vector it will be included in the plot (with title label). legend specifies the legend, if xrev=TRUE the x-axis is reversed to give a chronological ordering.

plot.linramp

list specifying how the linear ramp fit should be plotted. If depth.reference is given, it will be represented by a vertical dotted line. If show.t0=TRUE the posterior marginal distribution of the onset is included (non-normalized). If show.t1=TRUE the posterior marginal distribution of the end point of the transition is included (non-normalized). If xrev=TRUE the x-axis is reversed to give a chronological ordering. label gives the title of the plot.

plot.event_depth

list specifying how the posterior distribution of the onset depth should be plotted. If depth.reference is given, it will be represented by a vertical dotted line. If xrev=TRUE the x-axis is reversed to give a chronological ordering. label gives the title of the plot.

plot.event_age

list specifying how the histogram of the simulated onset ages should be plotted. If age.reference is given, it will be represented by a vertical dotted line. If xrev=TRUE the x-axis is reversed to give a chronological ordering. label gives the title of the plot.

postscript

Boolean variable indicating if postscript files should be produced instead.

pdf

Boolean variable indicating if pdf files should be produced instead.

prefix

The prefix for created files. Additional numbering is added.

...

Additional arguments to postscripts(), pdf() or dev.new().

Author(s)

Eirik Myrvoll-Nilsen, eirikmn91@gmail.com

See Also

bremla,bremla_chronology_simulation

Examples


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")
control.sim=list(synchronized=2,
                 summary=list(compute=TRUE))

object = bremla_prepare(formula,data,nsims=5000,reference.label="simulated timescale",
                        events = events,
                        control.fit=control.fit,
                        control.sim=control.sim)
object = bremla_modelfitter(object)
object = bremla_chronology_simulation(object, print.progress=TRUE)
summary(object)
plot(object)
}



eirikmn/bremla documentation built on Jan. 25, 2025, 4:41 a.m.