Untitled

 avatar
unknown
plain_text
a year ago
535 B
5
Indexable
# Regression
production = read.table("production.txt",header=TRUE)
production

attach(production)
plot(RunTime~RunSize,
     xlab = "Run Size",
     ylab = "Run-Time",
     main = "Run Time and Run size",
     col = 'blue')

x = RunSize
y = RunTime
n = length(x)

b = cor(x,y)*sd(y)/sd(x)
b

# Or

b = cov(x,y) / var(x)
b

a = mean(y) - b*mean(x)
a

# Making prediction
y.hat = a+b*x
y

# Residual
e = y - y.hat
e
sum(e) 

# Sum of squared residuals
ssr = sum(e^2)
ssr


# standard error of estimate
sy = sqrt(1 - cor(x,y)^2)*sd(y)
sy
Editor is loading...
Leave a Comment