# Estimate the error variance and weights

I have been given an assignment to:

Write R code to estimate of the error variance at each of the four possible air velocity/voltage combinations.Does it seem that the constant variance assumption is violated? &

Write R code to add a column weight to the dataset, which gives the weight for each observation.

I have currently written the code using lm to build the linear model. But for the question do i just find the residuals of the lm? or do I find the square of the sigma not sure about the other two questions.

Thanks!

This is the code i have used to find the variance of errors.

e_lm<-lm(E~x1+x2, data ="e_1") (summary(e_lm)\$sigma)**2

The data is below, apologies wasn't sure how to paste the data

Velocity 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120

Voltage 50 50 50 50 50 50 50 50 50 50 70 70 70 70 70 70 70 70 70 70 50 50 50 50 50 50 50 50 50 50 70 70 70 70 70 70 70 70 70 70

Efficiency 87.5 88.1 89.5 86.2 90 88.2 87.3 89.2 85.9 87 77.4 70.7 67 71.7 79.2 68.1 65.3 61 81.7 60.3 82.5 81.6 77.4 81.5 79.7 81.3 80.7 79.3 82 79.2 61.2 67.2 55.9 52 63.5 50.7 52.3 68.6 69.5 70.1