Rforch22 - R Material for Chapter 22 > data.vscores

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
R Material for Chapter 22 > data.vscores <- read.table(file=" http://www.stat.ufl.edu/~rrandles/sta4211/Rclassnotes/data/verbalscores.txt ",col.names=c("gender","vscore","age")) > attach(data.vscores) > data.vscores ## Our data of verbal scores for delinquent boys and girls gender vscore age 1 1 16 17 2 1 24 10 3 1 21 12 4 1 19 14 5 1 17 13 6 1 22 10 7 2 24 12 8 2 20 16 9 2 18 19 10 2 23 14 11 2 17 19 12 2 21 13 > fgen <- factor(gender) > mage <- mean(age) ## average of the ages > mage [1] 14.08333 > cenage <- age – mage ## ages centered at the average age > cenage [1] 2.91666667 -4.08333333 -2.08333333 -0.08333333 -1.08333333 -4.08333333 [7] -2.08333333 1.91666667 4.91666667 -0.08333333 4.91666667 -1.08333333 - - - - - - - > model1 <- aov(vscore~fgen, data=data.vscores) > summary(model1) ## model gender only Df Sum Sq Mean Sq F value Pr(>F) fgen 1 1.333 1.3333 0.1581 0.6993 Residuals 10 84.333 8.4333 - - - - - - - > model2 <- aov(vscore~fgen + cenage, data=data.vscores) > summary(model2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Rforch22 - R Material for Chapter 22 &gt; data.vscores

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online