Skip to content

Instantly share code, notes, and snippets.

@gentimouton
Created March 14, 2012 19:24
Show Gist options
  • Save gentimouton/2038838 to your computer and use it in GitHub Desktop.
Save gentimouton/2038838 to your computer and use it in GitHub Desktop.
R plot of frame duration against number of passive sockets
bots = c(0,20,40,60,80,100,120,140,160,180,200,250,300,350,400)
millis = c(0.08,0.19,0.45,0.55,0.68,0.79,0.95,1.05,1.24,1.22,1.38,1.7,1.8,2.2,2.4)
linfit = lm(millis ~ bots)
#attributes(linfit) # view the attrs of the fit
coeff = signif(linfit$coefficients[2], digits=3) # how many millis per bot
offset = signif(linfit$coefficients[1], digits=3)
rsquared = signif(summary(linfit)$r.squared, digits=3)
pval = signif(summary(linfit)$coefficients[2,4], digits=3)
txt = paste('frame duration =', coeff, '* bots +', offset, '\n R2 =', rsquared, ', p <', pval)
plot(bots, millis, xlab='number of bots', ylab='frame duration (ms)', pch=20, col="black", main=txt, font.main=1)
abline(linfit, col='red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment