### General Code for calculating confidence interval of slope in R ### import the data datum=read.csv(file.choose()) #imports data # Note that the data file must be saved as a csv file # The imported data object will be called 'datum' ### Make sure the data imported correctly head(datum) #displays the column headings of data plus first 6 rows ### Run regression analysis results=lm(Y~X,data=datum) #runs a regression # Note that R won't seem to do anything, instead it is creating a new # object called 'results' that contains the important information # 'Y' is the response in your excel file. BE SURE TO CHANGE THE NAME # 'X' is the x-variable in your excel file. BE SURE TO CHANGE THE NAME ### Get the information from the 'results' object summary(results) # gives output. ### Calculate the confidence interval of the slope confint(results)