# Create a very large vector of random values
a <- rnorm(1000000)
# Copy this vector but add 150 0s in front (shift)
b <- c(rep(0,150),a)
# Estimate the overlap scores for shifting values between 50 and 200
shiftEstimate <- seq(50,200,by=10)
overlapScores <- elongationEstimation(a,b,shiftEstimate)
# Show the scores evolution
plot(shiftEstimate, overlapScores)
# Show the max value (150)
abline(v=shiftEstimate[which.max(overlapScores)], col='red')
Run the code above in your browser using DataLab