1 What we did today

In this class we looked at the data set ARMath and extracted the numerical columns corresponding to initial ratings of math teachers’ instructional quality.

In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye.

We used the following commands to extract the data: In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye. In this document there are two sections. In Section 1 we do most of the work. In Section 2 we say goodbye.

> source("ARMath.S")
> grep("\\.I",names(ARMath))
 [1]  1  3  6  8  9 10 11 12 13 14 15 16 18 20
> ARInit _ARMath[,grep("\\.I",names(ARMath))]
> unlist(lapply(ARInit,mode))
      AR.I1     AR.I2C      AR.I3       AR.I3A       AR.I3B       AR.I3C       AR.I3D
 "numeric" "numeric" "numeric" "character" "character" "character" "character"
       AR.I3E      AR.I3ET      AR.I4        AR.I5      AR.I6      AR.I7      AR.I8
 "character" "character" "numeric" "character" "numeric" "numeric"
 "numeric"
> unlist(lapply(ARInit,mode))=="numeric"
 AR.I1 AR.I2C AR.I3 AR.I3A AR.I3B AR.I3C AR.I3D AR.I3E AR.I3ET AR.I4 AR.I5
      T       T      T       F       F       F       F       F        F      T      F
 AR.I6 AR.I7 AR.I8
      T      T      T
> ARInit _ARInit[,unlist(lapply(ARInit,mode))=="numeric"]

The data set has missing values, denoted by numbers in the 90’s:

> ARInit
   AR.I1 AR.I2C AR.I3 AR.I4 AR.I6 AR.I7 AR.I8

AR.I1 AR.I2C AR.I3 AR.I4 AR.I6 AR.I7 AR.I8
1  4  4  3  3  3  4  4
2  3  4  3  4  3  4  4
3  2  2  3  2  3  3  3
4  2  2  3  2  3  92  92
5  4  3  3  3  4  4  2
6  4  3  4  3  4  4  4
7  1  1  3  3  2  2  2
8  1  1  3  3  3  2  2
9  4  92  2  3  1  92  4
10  4  91  3  3  3  92  92

Table 1: Here is a table of data.

1      4       4      3      3      3      4      4
2      3       4      3      4      3      4      4
3      2       2      3      2      3      3      3
4      2       2      3      2      3     92     92
5      4       3      3      3      4      4      2
6      4       3      4      3      4      4      4
7      1       1      3      3      2      2      2
8      1       1      3      3      3      2      2
9      4      92      2      3      1     92      4
10      4      91      3      3      3     92     92

We can make a table of this data, see Table 1:

We converted the 90’s to NA’s, which Splus will ignore when making histograms, like this:

> ARInit[ARInit>10] _NA
> ARInit
  AR.I1 AR.I2C AR.I3 AR.I4 AR.I6 AR.I7 AR.I8
1      4       4      3      3      3      4      4
2      3       4      3      4      3      4      4
3      2       2      3      2      3      3      3
4      2       2      3      2      3     NA     NA
5      4       3      3      3      4      4      2
6      4       3      4      3      4      4      4
7      1       1      3      3      2      2      2
8      1       1      3      3      3      2      2
9      4      NA      2      3      1     NA      4
10      4      NA      3      3      3     NA     NA

And then we graphed the resulting variables like this:

> par(mfrow=c(3,3))
> dim(ARInit)
[1] 10  7
> for (i in 1:7) hist(ARInit[,i])
> dev.print(postscript,command="cat > bj.eps",onefile=F)

The graph looked like what is in Figure 1.

Figure 1: Here are a bunch of histograms.

\underline{Note:} Above we used the command

> ARInit[ARInit>10] _NA

A slower way to do this would be

N _dim(ARInit)[1]

J _dim(ARInit)[2]
for (i in 1:N) {
  for (j in 1:J) {
       if (ARInit[i,j]>10) {
         ARInit[i,j] <- NA
      }
  }
}

2 The end

Hope you liked it!