O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – the resistant line as a first regression model

We use the rline function from the LearnEDA package for fitting the resistant line on a dataset.

  1. Load the LearnEDA package: library(LearnEDA).
  2. Understand the default example with example(rline).
  3. Load the dataset data(IO_Time).
  4. Create the IO_rline resistant line for CPU_Time as the output and No_of_IO as the input with IO_rline <- rline(IO_Time$No_of_IO, IO_Time$CPU_Time,iter=10) for 10 iterations.
  5. Find the slope and intercept with IO_rline$a and IO_rline$b. The output will then be:
    >IO_rline$a
    [1] 0.2707
    >IO_rline$b
    [1] 0.03913
  6. Obtain the scatter plot of CPU_Time against No_of_IO with plot(IO_Time$No_of_IO, IO_Time$CPU_Time).
  7. Add the resistant line on the generated scatter plot with abline(a= ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required