[R] fitting a hyperbola to data points

PIKAL Petr petr.pikal at precheza.cz
Mon Apr 8 10:46:14 CEST 2013


Hi

without data we can provide just basic help.

fit<-lm(Time~I(1/Requests))

shall give you hyperbolic fit.

You can test if your data follow this assumption by

plot(1/Requests, Time)

which shall for straight line.

anyway, when you want to provide data use 

dput(your.data) and copy console output directly to your mail.

Petr


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Manoj Srivastava
> Sent: Monday, April 08, 2013 4:08 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] fitting a hyperbola to data points
> 
> Hi,
> 
>         I am new to R, and I suspect I am missing something simple.
> 
>         I have a data set that  performance data that correlates
> request  rate to response times
>         http://pastebin.com/Xhg0RaUp
>  There is some jitter in the data, but mostly it looks like a hockey
> puck curve. It does not get converted into a straight line when I tried
> log conversions, so it does not seem to be a power series relationship.
> 
>         My expectation is that the data will fit a curve that is a
> hyperbola, but I don't know how to formulate that regression. How does
> one fit data to a general function
>    AX^2 + Bxy + Cy^2 +D = 0
> 
>         I have tried polynomial functions and inverse functions
>  lm2 = lm(Time ~ Requests + I(Requests^2) +  I(Requests^3))  but that
> does not appear to be close.
> 
>         Any pointers appreciated.
> 
>         manoj
> 
> dat <- read.csv("perf.csv",header=TRUE)
> plot (Time ~ Requests)
> plot (Time ~ Requests, log="y")
> plot (Time ~ Requests, log="x")
> plot (Time ~ Requests, log="xy")
> 
> 
> --
> To be intoxicated is to feel sophisticated, but not be able to say it.
> George Carlin Manoj Srivastava <srivasta at acm.org> <http://www.golden-
> gryphon.com/> 4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20  05B6 CF48 9438
> C577 9A1C



More information about the R-help mailing list