Displaying 3 results from an estimated 3 matches for "maxima_index".
2017 Aug 26
0
Find maxima of a function
...:
>>
>> values <- rnorm(20, mean = c(2.15,2.0,2.9), sd = c(0.1,0.1,0.1))
>>
>> v_dens <- density(values)
>> v_dens_y <- v_dens$y
>>
>> r <- rle(v_dens_y)
>> # These functions ignore the extremes if they are the first or last point
>> maxima_index <- which(rep(x = diff(sign(diff(c(-Inf, r$values, -Inf))))
>> == -2, times = r$lengths))
>> minima_index <- which(rep(x = diff(sign(diff(c(-Inf, r$values, -Inf))))
>> == 2, times = r$lengths))
>>
>> plot(v_dens_y)
>>
>> HTH
>> Ulrik
>>
&...
2017 Aug 26
6
Find maxima of a function
I have a Gaussian mixture model with some parameters
mean=(506.8644,672.8448,829.902)
sigma=(61.02859,9.149168,74.84682)
c=(0.1241933, 0.6329082, 0.2428986)
And the plot look something like below.[image: enter image description here]
<https://i.stack.imgur.com/4uUQ9.png>
Also, if I change my parameters to
mean=(2.15,2.0,2.9)
sigma=(0.1,0.1,0.1)
c=(1/3,1/3,1/3)
Then plot would change
2017 Aug 26
1
Fwd: Find maxima of a function
...d = c(0.1,0.1,0.1))
> >>>
> >>> v_dens <- density(values)
> >>> v_dens_y <- v_dens$y
> >>>
> >>> r <- rle(v_dens_y)
> >>> # These functions ignore the extremes if they are the first or last
> point
> >>> maxima_index <- which(rep(x = diff(sign(diff(c(-Inf, r$values,
> -Inf))))
> >>> == -2, times = r$lengths))
> >>> minima_index <- which(rep(x = diff(sign(diff(c(-Inf, r$values,
> -Inf))))
> >>> == 2, times = r$lengths))
> >>>
> >>> plot(v_...