Displaying 2 results from an estimated 2 matches for "mid_y".
Did you mean:
id_y
2017 May 30
2
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
...ot.) {
points(m_x, m_y, cex=2, pch=3, col="red")
segments(m_x[1],m_y[1], m_x[3],m_y[3], col="red")
}
## Step 4
R <- if(n == 2) 2L else 3L
slope <- (m_y[[R]] - m_y[[1]]) / (m_x[[R]] - m_x[[1]])
intercept <- m_y[[1]] - slope * m_x[[1]]
## Step 5
mid_y <- intercept + slope * m_x[[2]]
intercept <- intercept + (m_y[[2]] - mid_y) / 3
if(plot.) abline(a = intercept, b = slope, col=adjustcolor("midnight blue", .5), lwd=2)
c(intercept = intercept, slope = slope)
}
## To test it, here's the second example from that page:
dfr...
2017 May 29
3
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
Here is an attached patch.
Best,
Serguei.
Le 29/05/2017 ? 12:21, Serguei Sokol a ?crit :
> The problem or actual R implementation relies on an assumption
> that median(x[i] | x[i] <= quantile(x, 1/3)) == quantile(x, 1/6)
> which reveals not to be true despite very trustful appearance.
>
> If we continue with the example of x=y=1:9
> then quantile(x, 1/6)=2.5 (here quantile()