lbw <- read.table("Oct.dat") ; attach(lbw) iqfull <- V1; rcomp <- V4; rrate <- V5 ; racc <- V6 bw <- V8 ; rbw <- V9; ga <- V10; sex <- V11 pdf("LbwR.pdf") split.screen(c(2,2)) screen(1) plot(bw,rrate, xlab="Birth weight (kg)", ylab="Reading rate") # main="Plot of Reading rate against birth weight") screen(2) plot(rbw,rrate, xlab="Expected birth weight", ylab="Reading rate") # main="Plot of Reading rate against expected birth weight for gestational age") screen(3) plot(iqfull,rrate, xlab="IQ score", ylab="Reading rate") # main="Plot of Reading rate against Reading comprehension") screen(4) plot(ga,rrate, xlab="Gestational age (weeks) ", ylab="Reading rate") # main="Plot of Reading rate against gestational age ") dev.off() rlm <- lm(rrate ~ iqfull) ; rrbw <- lm(rrate ~ rbw) rsex <- lm(rrate ~ sex ) ; rga <- lm(rrate ~ ga) summary(rlm); summary(rrbw); summary(rsex); summary(rga); riqsex <- lm(rrate ~ iqfull + sex) ; summary(riqsex) riqsexbw <- lm(rrate ~ iqfull + sex + rbw); summary(riqsexbw) riqsexga <- lm(rrate ~ iqfull + sex + ga ); summary(riqsexga) riqsex2 <- lm(rrate ~ iqfull*sex) ; summary(riqsex2) rr mrc <- lm(iqfull ~ rcomp ) ; mrbw <- lm(iqfull ~ rbw) msex <- lm(iqfull ~ sex ) ; mga <- lm(iqfull ~ ga) summary(mrc); summary(mrbw); summary(msex); summary(mga); mrc2 <- lm(iqfull ~ rcomp+rbw); mrc3 <- lm(iqfull ~ rcomp+rbw+sex)