2
$\begingroup$

This may be very simple. Consider the following figure, minus the robot. How can I model the standard deviation of Speed as a function of Rep http://cdn.sstatic.net/Sites/stats/img/captcha.png

I can chop the rep up into arbitrary pieces (e.g. 2000 Rep's), calculate the sd, and then draw a regression line between de standard deviations, I also thought about moving window but that doesn't seem right. Is there a better, more continuous way, irrespective of arbitrary binning, to model standard deviation as a function of x?

$\endgroup$
0

2 Answers 2

1
$\begingroup$

It's pretty obvious what is going on - variability is increasing with rep. It's your job to quantify this, and both your suggestions are appropriate. Arbitrary binning will work; in this case the more the N's in each bin are similar the better. A sliding window might be better yet, but you're likely to see very similar trends.

Side note: keep in mind that sd often scales with the mean, which is why coefficient of variation is a popular metric.

$\endgroup$
6
  • $\begingroup$ What if the data is more sparse than in the picture. Isn't there a linear regression kind of way to model the sd so that it will take all points into account, not just those in the arbitrary choice of bins or windows ? $\endgroup$ Dec 13, 2016 at 23:52
  • $\begingroup$ Sure, any GLM using a conditional distribution $y|x$ where the variance $\sigma_{y|x}^2$ depends on the mean $\langle{y|x}\rangle$ will do this. For example lognormal distribution, equivalent to doing standard linear regression on $\log[y]$ vs. $x$. You can first do some binning (or 2D KDE) to get an idea of what distribution may be appropriate. $\endgroup$
    – GeoMatt22
    Dec 14, 2016 at 1:07
  • $\begingroup$ Forgot to mention, you may also consider logging the predictor $x$, for either regression or binning/KDE. (From the looks of the plot, this would help to make the distribution more uniform, i.e. a uniform $\log[x]$ grid may have more similar $N$'s in each bin.) $\endgroup$
    – GeoMatt22
    Dec 14, 2016 at 1:20
  • $\begingroup$ Thanks, this sounds exactly what I was looking for. May I ask how a GLM model with a variance that depends on the mean would look like in R? In my data, I expect that the Standard deviation will be related to Rep in an exponential manner (sd ~ rep + rep^2 ), it would be great if I could estimate the coefficients of rep and rep^2. The relationship of Mean~rep will be 0 as I calculated residuals earlier $\endgroup$ Dec 15, 2016 at 1:01
  • $\begingroup$ You would need to estimate the standard deviation and the mean together in general (and certainly for GLM). If your error variance changes with $x$, but you estimate the mean $\langle{y}\mid{x}\rangle$ ignoring this, then your baseline regression curve will be biased. $\endgroup$
    – GeoMatt22
    Dec 15, 2016 at 1:47
0
$\begingroup$

This looks like a textbook case of heteroscedasticity for which the quantile regression might work well. The predicted lines for, say, 0.05 and 0.95 would trace out the upper and lower part of the distribution quite well, I would guess.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.