This is good point given, that we think about the proportions based rather the amounts.

with R code:

approx(diamond, sleep, xout = 140)$y

and with the proportion between sleep and diamond (sleep/diamond):

140*approx(diamond, sleep/diamond, xout = 140)$y

the result is 26,6.

What if the jeweler and lodge owner does not agree on linearity of the price, but have some variations (let’s assume on the day of the week). Or assume that I put the interpolated result (26,6) into the dataset and calculate the slope and intercept again (intercept=5, slope = 0,15). When adding:

diamond <- c(100, 200, 140)

sleep 26.6

diamond <- c(100, 200, 140)

sleep <- c(20, 35, 26.6)

glm.1 26

diamond <- c(100, 200, 140)

sleep <- c(20, 35, 26)

glm.2 glm.1$residuals

1 2 3

-0.2368421 -0.1578947 0.3947368

> glm.2$residuals

1 2 3

0.000000e+00 7.105427e-15 0.000000e+00

Second residual from glm.2 is practically 0 (7.105e-15), where any given point from glm.1 have some residuals.

LikeLike

]]>There are also other possible assumptions for interpolation, as well. We might think that the proportion paid rather than the amount paid should be linearly interpolated based on `x`, i.e. `140 * approx(x, y/x, xout = 140)$y` which equals 26.6.

LikeLike

]]>LikeLike

]]>LikeLike

]]>Best, Tomaž

LikeLike

]]>LikeLike

]]>thank you very much for the suggestion. I will give upvote to that idea or create a new suggestion.

Best, Tomaž

LikeLike

]]>LikeLike

]]>LikeLike

]]>LikeLike

]]>