# Notes on now to use the free statistical package R. #I will show how to load data into it and run regressions. # The hash market means this is a comment line. # February 11, 2010. # Professor Eric Rasmusen, erasmuse@Indiana.edu. # To download R go to: The Comprehensive R Archive Network # at http://cran.case.edu/ #Download it and install it on your computer, which is easy to do. #First we read in a dataset. #The data file is just plain text. The format is like this: # price Floor area Rooms Age Cent.heat #01 52.00 111.0 830 5 6.2 no # 02 54.75 128.0 710 5 7.5 no #03 57.50 101.0 1000 5 4.2 no #04 57.50 131.0 690 6 8.8 no #05 59.75 93.0 900 5 1.9 yes #Notice the lack of an observation number on the first line. # Capitalization matters. price and Price could be different #variables. #Spacing and tab symbols don't matter, but linebreaks do, I #think. #Notice how binary yes/no variable values are easily #accommodated. #The first read-in command creates an object called "data2": data2 <- read.table("D:\\_Take-to-office\\r-data.txt") #Notice how slashes need to be doubled for R to read them. #The second read-in command reads that object into the current #memory: data2 #We can get some summary statistics: summary(data2) #To do a regression, create a regression output object called "output4": output4 = lm(price~ Floor +area+ Cent.heat, data=data2 ) #Then display the output: summary(output4)