Yeah haha I guess thats pretty trivial. I had one more R command question (for now anyway), I ran a linear regression in R and got the estimated intercept and slope. I know how to get their CI in R but I was wondering if there was a way to get CI for a specified X value. thanks

Use the "predict" function setting the "interval" parameter to "confidence". You can also get prediction intervals by setting interval to "prediction" instead.

You have to specify the new data you want to predict by the "newdata" argument (see help file for details). Just remember, it needs to be a dataframe of the same variable. So if you have, for instance, Y ~ X, then you want to issue a command like

Also, with respect to the sum of squared deviations mentioned earlier (and sxx is the notation), there are a number of matrix ways to get it. For instance, consider a Y vector of response values. You can get \(\sum Y^2\) with

Code:

t(Y) %*% as.matrix(Y)

I don't have my book handy (just moved), but there are similar matrix methods to get the various sum of squares and squared deviations (from the mean) in a nice matrix form. You should be able to find it in any statistics book on regressions. It goes along with solving the normal equations.