Slice_Run: Slice_Run

View source: R/Slice_Run.R

Slice_RunR Documentation

Slice_Run

Description

function determining the slice and the new point x1

Usage

Slice_Run(x0, foo_x, foo_y, hist_y, w = 40, m = 10, Rmx = m * w)

Arguments

x0

numeric (required) the current point

foo_x

a function y(x)

foo_y

a function p(y)

hist_y

a histogram of y density

w

numeric (required) estimate of the typical size of a slice

m

numeric (required) integer limiting the size of a slice to mw

Rmx

numeric (with default) bound value to limit edge effects (added)

Value

a list with the following elements

Element Type Description
⁠$x1⁠ numeric the new point
⁠$L⁠ numeric the new left boundary of the slice
⁠$R⁠ numeric the new right boundary of the slice
⁠$y0⁠ numeric the vertical level defining the slice

Examples

#TL example from RLumModel
require(RLumModel)
data("ExampleData.ModelOutput", envir = environment())
TL_curve <- get_RLum(model.output, recordType = "TL$", drop = FALSE)
x<-TL_curve$data[,1]
y<-TL_curve$data[,2]
dev.off()
run0<-Slice_Init(x,y)
Slice_Run(run0$x0,run0$foo_x,run0$foo_y,run0$hist_y,Rmx=max(x))

#multiples TL calculées avec RLumModel##########
#call function "model_LuminescenceSignals", model = "Bailey2001"
# the irradiation dose is varied and then compared.
irradiation_dose <- seq(from = 0,to = 100,by = 20)
model.output <- lapply(irradiation_dose,
      function(x){
           sequence <- list(IRR = c(20, x, 1),
              #PH = c(220, 10, 5),
              TL=c(20,400,5))
           data <- model_LuminescenceSignals(
              sequence = sequence,
              model = "Bailey2001",
              plot = FALSE,
              verbose = FALSE)
           return(get_RLum(data, recordType = "TL$", drop = FALSE))
})
##combine output curves
TL_curve.merged <- merge_RLum(model.output)
##plot
plot_RLum(
 object = TL_curve.merged,
 xlab = "Temperature [°C]",
 ylab = "TL signal [a.u.]",
 main = "TL signal with various dose",
 legend.text = paste("dose", irradiation_dose, "Gy"),
 combine = TRUE)
##
n.pt<-length(TL_curve.merged[1]$data[,1])
n.irr<-length(irradiation_dose)
y<-x<-array(dim=c(n.pt,n.irr))
for (i in 1:n.irr){
 x[,i]<-TL_curve.merged[i]$data[,1]
 y[,i]<-TL_curve.merged[i]$data[,2]
}

run0<-Slice_Init(x[,1],y[,1])
Slice_Run(run0$x0,run0$foo_x,run0$foo_y,run0$hist_y,Rmx=max(x))


Zink-Antoine/Slice_sampler documentation built on Feb. 27, 2025, 9:23 p.m.