# Loading datasets
data(simple)
head(simple)
################################################
# Time delay estimation via profile likelihood #
################################################
###### The entire profile likelihood values on the grid of values of the time delay.
theta.ini = c(0, 0.03, 100)
c.ini <- mean(simple[, 4]) - mean(simple[, 2])
delta.uniform.range <- c(0, 100)
grid <- seq(40, 60, by = 4)
# grid interval "by = 0.1" is recommended.
### Running the following codes takes more time than CRAN policy
### Please type the following lines without "#" to run the function and to see the results
# logprof <- entirelogprofilelikelihood(data = simple, grid = grid,
# initial = c(theta.ini, c.ini), data.flux = FALSE,
# delta.uniform.range = delta.uniform.range)
# plot(grid, logprof, type = "l",
# xlab = expression(bold(Delta)),
# ylab = expression(bold(paste("log L"[prof], "(", Delta, ")"))))
# prof <- exp(logprof - max(logprof)) # normalization
# plot(grid, prof, type = "l",
# xlab = expression(bold(Delta)),
# ylab = expression(bold(paste("L"[prof], "(", Delta, ")"))))Run the code above in your browser using DataLab