Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
535 B
1
Indexable
Never
# 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
Leave a Comment