rm(list=ls()) # remove variables from previous session rm(list=ls()) # read file dfr <- read.csv(file="FCAT_Mult_grade3.csv",head=TRUE,sep=",") #ssrss03 = FCAT Reading Score #Orfwrcf = Oral Reading Fluency – FCAT Passages print(dfr$ssrss03) print(dfr$Orfwrcf) regr = lm(ssrss03 ~ Orfwrcf, data=dfr) plot(dfr$ssrss03, dfr$Orfwrcf) #create artificial data # objective: the line y = .4 x + 2 nb.pts = 50 x = sample(seq(-5,5,.01), nb.pts) y = .4*x + 2 #--------------------------------- par(mfrow=c(2,2)) fluct = c(.05,.25,.5,2.5) y1 = y+rnorm(nb.pts, sd=fluct[1]) y2 = y+rnorm(nb.pts, sd=fluct[2]) y3 = y+rnorm(nb.pts, sd=fluct[3]) y4 = y+rnorm(nb.pts, sd=fluct[4]) c1 = cor(x,y1); c1 = paste(c("cor= ", c1)) c2 = cor(x,y2); c2 = paste(c("cor= ", c2)) c3 = cor(x,y3); c3 = paste(c("cor= ", c3)) c4 = cor(x,y4); c4 = paste(c("cor= ", c4)) plot(x,y1,main=c1); plot(x,y2,main=c2) plot(x,y3,main=c3); plot(x,y4,main=c4) #---------------------------------- par(mfrow=c(1,1))