Screenshot of a plot digitiser digitising the outline of a photo of Hallgrimskirkja.
laplace <- function(mu, b) { force(mu) force(b) function(x) { l <- 1/(2 * b) * exp(-abs(x - mu)/b) l/max(l) } } hallgrimskirkja <- "~/Downloads/hallgrimskirkja.csv" |> read.csv() lap_error <- function(b) { mean(laplace(0, b)(hallgrimskirkja$x) - hallgrimskirkja$y)^2 } op <- optimise(lap_error, interval = c(1/10, 1)) fit <- laplace(0, op$minimum) library(ggplot2) g <- jpeg::readJPEG("~/Downloads/hallgrimskirkja.jpg") |> grid::rasterGrob(interpolate=TRUE, width = 1.32, height = 0.95) hallgrimskirkja |> rbind(transform(hallgrimskirkja, x = -x)) |> ggplot(aes(x, y)) + annotation_custom(g, xmin=-0.8, xmax=0.8, ymin=-0.1, ymax=1.08) + geom_line(aes(color = "Kirkja")) + stat_function(fun = fit, aes(color = "Laplacian fit")) + theme(legend.position = "bottom")
Plot with Hallgrimskirkja in the background and two lines showing the outline and the Laplace distribution fit. The fit is not great. It's too steep and the tails too short.
More than one reply suggesting Laplace distribution. I digitised the church's outline and then tried to fit a Laplace distribution. Here's the fit.
#RStast #Iceland