First Start by using the set.seed function to create repeatable results.
set.seed(728)
Create the number of repetitions.
n <- 100
Gather all whole values between 1 and the number of repetitions.
x <- 1:n
Create a vector to store the slow consistent decent.
decent <- (-0.5 * x) + 100
Using the rnorm function of r to then vary each point by a set value, in this case 10.
noise <- rnorm(n, mean = 0, sd = 10)
By combining the decent and noise we now have a scatter plot in which the trend needs to be found.
y <- decent + noise
Finally putting both the vector x and y to a dataframe to create a workable base.
df <- data.frame(Time = x, Value = y)