%! program = Sweave + pdflatex
% R command: Sweave('/Users/henk/Sites/R/FractionRepresentation.Rnw')

\documentclass{/Users/henk/Papers/tamu}
\usepackage{geometry}
\geometry{letterpaper}

\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{apacite}
\usepackage{url}
\usepackage{setspace}
\usepackage{wrapfig}
\usepackage{endnotes}

%%% BEGIN DOCUMENT
\begin{document}

\title{Statistical Analysis of a Pre-service Teacher Module Efficiency Program}
\author{Salvatore Enrico Indiogine}
\TPJrevision{2008}{10}{28}
\TPJcopyright{Copyright \copyright{ 2008} Salvatore Enrico Indiogine}
\email{hindiogine@gmail.com}
\address{Texas A\&M University, College Station, Texas}

\abstract{This article is a term paper for EDCI-685 where I present and analyze data obtained from the Module Efficiency Program research project.  The Department of Teaching, Learning, and Culture has prepared mathematics teaching models for Texas A\&M pre-service students enrolled in the College of Education and Human Services.  This project was set up to study the effectiveness of these mathematics modules.  The data was analyzed using the R statistics program.}

% Initial R commands}
<<initial,echo=FALSE>>=
library(Hmisc)
library(e1071)
setwd('/Users/henk/Documents/EDCI-685')
frac.fall <- read.csv('Fall_2006_Fractions_Pre_Post.csv', header=TRUE, sep=',', row.name=1)
@

\maketitle
\tableofcontents

\section{Introduction}
The Department of Teaching, Learning, and Culture has prepared mathematics teaching models for Texas A\&M pre-service students enrolled in the College of Education and Human Services.  This project was set up to study the effectiveness of these mathematics modules.  The research methodology followed the popular quantitative psychology structure.  This entails a pre-tests followed by a treatment and concluded by a post-tests.

Here we present data and its analysis from fraction and place-value tests.  We used a popular open source statistical system called ``R''\footnote{\url{http://www.r-project.org}} \citeA{bk:rproject;bk:verzani-2005;bk:crawley-2005} to perform the data analysis and to generated the graphics.  The article itself was prepared using the open source typesetting program \LaTeX\footnote{\url{http://www.latex-project.org}} and the open source multi-purpose editor Emacs\footnote{\url{http://www.gnu.org/software/emacs}}.

\section{The Data}

The data was obtained by scoring the Fractions and Place Value Pre-tests and Post-tests taken before and after the training by all ALL students during Fall 2006.  Each test contains four problems on fractions.  Each of these problems has two or three sub-questions labeled a,b, c, as shown in table \ref{tbl:questions}.   We are at this point only utilizing the items scored as correct and we disregard incorrect entries.

\begin{table}[htdp]
\caption{Structure of the Questions}
\begin{center}
\begin{tabular}{cc}
\hline
PreTest & PostTest \\
\hline
Prob 1a01 - 1a20 & 1a01- 1a20  \\
Prob 1b01 - 1b11 & 1b01- 1b11  \\
Prob 1c01 - 1c15 & 1c01- 1c14  \\
Prob 2a01 - 2a48 & 2a01 - 2a48 \\
Prob 2b01 - 2b13 & 2b01 - 2b14 \\ 
Prob 3a01 - 3a10 & 3a01 - 3a12 \\ 
Prob 3b01 - 3b06 & 3b01 - 3b06 \\
Prob 3c01 - 3c09 & 3c01 - 3c09 \\
Prob 4a01 - 4a23 & 4a01 - 4a20 \\ 
Prob 4b01 - 4b10 & 4b01 - 4b10 \\
Prob 4c01 - 4c18 & 4c01 - 4c19 \\
\hline
\end{tabular}
\end{center}
\label{tbl:questions}
\end{table}

Notice that there is a different number of items scored between pre and posttest for the following sub-questions: 1c, 2b, 3a, 4a, 4c.

\subsection{Descriptives}
Description of the Data.  Sample size is \Sexpr{length(frac.fall$Section)}.  This set was obtained by finding all the students that took the pretest and the posttest.  Thus, we had to exclude students that did only one or the other. The box plots in figures \ref{fig:boxplot-pre} and \ref{fig:boxplot-post} show the values graphically.

\begin{figure}[h]
\begin{center}
\caption{Box plot of pretest scores, Fall 2006}
<<boxplot1,echo=FALSE,fig=TRUE>>=
boxplot(frac.fall$Q1.pre, frac.fall$Q2.pre, frac.fall$Q3.pre, frac.fall$Q4.pre, xlab='Question',ylab='Score',names=c('Q','Q2','Q3','Q4'),ylim=c(0,25))
@
\label{fig:boxplot-pre}
\end{center}
\end{figure}

\begin{figure}[h]
\begin{center}
\caption{Box plot of posttest scores, Fall 2006}
<<boxplot1,echo=FALSE,fig=TRUE>>=
boxplot(frac.fall$Q1.post, frac.fall$Q2.post, frac.fall$Q3.post, frac.fall$Q4.post, xlab='Question',ylab='Score',names=c('Q','Q2','Q3','Q4'),ylim=c(0,30))
@
\label{fig:boxplot-post}
\end{center}
\end{figure}

\section{Normality of the Scores}
We checked for normality using the 'quantile-quantile' plot and the Shapiro-Wilk test.  For the Shapiro-Wilk normality test we reject hypothesis of Normality for small values of W.

\subsection{Problem 1, Pretest}

Pretest Problem 1 in figure \ref{fig:qq-q1-pre}.

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile plot, Q1}
<<qq-q1-pre,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q1.pre)
qqline(frac.fall$Q1.pre,lty=2)
@
\label{fig:qq-q1-pre}
\end{center}
\end{figure}

<<shapiro-q1-pre,echo=FALSE>>=
shapiro.test(frac.fall$Q1.pre)
@

\subsection{Problem 2, Pretest}

Pretest problem 2 in figure \ref{fig:qq-q2-pre}.

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q2}
<<qq-q2-pre,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q2.pre)
qqline(frac.fall$Q2.pre,lty=2)
@
\label{fig:qq-q2-pre}
\end{center}
\end{figure}

<<shapiro-q2-pre,echo=FALSE>>=
shapiro.test(frac.fall$Q2.pre)
@

\subsection{Problem 3, Pretest}

Pretest problem 3 in figure \ref{fig:qq-q3-pre}.

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q3}
<<qq-q3-pre,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q3.pre)
qqline(frac.fall$Q3.pre,lty=2)
@
\label{fig:qq-q3-pre}
\end{center}
\end{figure}

<<shapiro-q3-pre,echo=TRUE>>=
shapiro.test(frac.fall$Q3.pre)
@

\subsection{Problem 4, Pretest}

Pretest problem 4 in figure \ref{fig:qq-q4-pre}

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q4}
<<qq-q4-pre,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q4.pre)
qqline(frac.fall$Q4.pre,lty=2)
@
\label{fig:qq-q4-pre}
\end{center}
\end{figure}

<<shapiro-q4-pre,echo=FALSE>>=
shapiro.test(frac.fall$Q4.pre)
@

\subsection{Problem 1, Posttest}

Posttest problem 1 in figure \ref{fig:qq-q1-post}

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q1, Posttest}
<<qq-q1-post,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q1.post)
qqline(frac.fall$Q1.post,lty=2)
@
\label{fig:qq-q1-post}
\end{center}
\end{figure}

<<shapiro-q4-pre,echo=FALSE>>=
shapiro.test(frac.fall$Q1.post)
@

\subsection{Problem 2, Posttest}

Posttest problem 2 in figure \ref{fig:qq-q2-post}

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q2, Posttest}
<<qq-q2-post,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q2.post)
qqline(frac.fall$Q2.post,lty=2)
@
\label{fig:qq-q2-post}
\end{center}
\end{figure}

<<shapiro-q2-post,echo=FALSE>>=
shapiro.test(frac.fall$Q2.post)
@

\subsection{Problem 3, Posttest}

Posttest problem 3 in figure \ref{fig:qq-q3-post}

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q1, Posttest}
<<qq-q3-post,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q3.post)
qqline(frac.fall$Q3.post,lty=2)
@
\label{fig:qq-q3-post}
\end{center}
\end{figure}

<<shapiro-q3-post,echo=FALSE>>=
shapiro.test(frac.fall$Q3.post)
@

\subsection{Problem 4, Posttest}

Posttest problem 4 in figure \ref{fig:qq-q4-post}

\begin{figure}[h]
\begin{center}
\caption{Quantile-Quantile Plot, Q4, Posttest}
<<qq-q4-post,echo=FALSE,fig=TRUE>>=
qqnorm(frac.fall$Q4.post)
qqline(frac.fall$Q4.post,lty=2)
@
\label{fig:qq-q4-post}
\end{center}
\end{figure}

<<shapiro-q4-post,echo=FALSE>>=
shapiro.test(frac.fall$Q4.post)
@

Since, $W$ is not significant we can use parametric methods, such as Linear modeling, Linear regression, and ANOVA.  However, the data is clearly of type proportion.  Especially since 5 sub-questions do not have the same number of items between the pretest and posttest.  
	
We thus will use the analysis of Proportional Data: Binomial Logistic Regression, Binomial Analysis of Covariance, alongside the parametric analysis


\section{Scores as function of Course Section}

The students who took the tests were enrolled in two different sections of the course, 503 and 504.  We needed to find out whether there was an effect of the section on the scores.   We analyze the data using a two-sided Student-t test.  We have to notice that the t-test is unbalanced, since there are 27 students in section 503, but only 11 in section 504.

<<freq-sec,echo=FALSE>>=
table(factor(frac.fall$Section))
@

However, before being able to do so, we need to find out whether the variances are the same among the four answer scores.  We used the Fligner-Killeen (median) test.  In simulation studies this test was shown to be robust against departures from normality.

<<homog-var-pre,echo=FALSE>>=
fligner.test(list(frac.fall$Q1.pre,frac.fall$Q2.pre,frac.fall$Q3.pre,frac.fall$Q4.pre))
@

We failed to reject the hypothesis that the variances were homogeneous for the pretest questions.

<<homog-var-post,echo=FALSE>>=
fligner.test(list(frac.fall$Q1.post,frac.fall$Q2.post,frac.fall$Q3.post,frac.fall$Q4.post))
@

We rejected the hypothesis that the variances were equal for the posttest questions.

The model is:  score = $X_{ij} = \mu_{i} + \epsilon_{ij}$

\subsection{Mean Comparison Test for Q1, Pretest}

% can not use aov because it needs balanced factors.  There are 11 students in section 504 and 27 in section 503.
<<t-q1-pre,echo=FALSE>>=
t.test(frac.fall$Q1.pre ~ frac.fall$Section,var.equal=TRUE)
@

\subsection{Mean Comparison Test for Q2, Pretest}
<<t-q2-pre,echo=FALSE>>=
t.test(frac.fall$Q2.pre ~ frac.fall$Section,var.equal=TRUE)
@

\subsection{Mean Comparison Test for Q3, Pretest}
<<t-q3-pre,echo=FALSE>>=
t.test(frac.fall$Q3.pre ~ frac.fall$Section,var.equal=TRUE)
@

\subsection{Mean Comparison Test for Q4, Pretest}
<<t-q4-pre,echo=FALSE>>=
t.test(frac.fall$Q4.pre ~ frac.fall$Section,var.equal=TRUE)
@

\subsection{Mean Comparison Test for Q1, Posttest}
<<t-q1-post,echo=FALSE>>=
t.test(frac.fall$Q1.post ~ frac.fall$Section,var.equal=FALSE)
@

\subsection{Mean Comparison Test for Q2, Posttest}
<<t-q2-post,echo=FALSE>>=
t.test(frac.fall$Q2.post ~ frac.fall$Section,var.equal=FALSE)
@

\subsection{Mean Comparison Test for Q3, Posttest}
<<t-q3-post,echo=FALSE>>=
t.test(frac.fall$Q3.post ~ frac.fall$Section,var.equal=FALSE)
@

\subsection{Mean Comparison Test for Q4, Posttest}
<<t-q4-post,echo=FALSE>>=
t.test(frac.fall$Q4.post ~ frac.fall$Section,var.equal=FALSE)
@

We can see that only for pretest problem 1 there could be a difference between sections using parametric statistics.  However, if we assume that the scores are proportional data we need to to perform a $\chi^{2}$ goodness to fit test.

<<proportions,echo=FALSE>>=
pq1.pre = frac.fall$Q1.pre/frac.fall$T1.pre
pq2.pre = frac.fall$Q2.pre/frac.fall$T2.pre
pq3.pre = frac.fall$Q3.pre/frac.fall$T3.pre
pq4.pre = frac.fall$Q4.pre/frac.fall$T4.pre
pq1.post = frac.fall$Q1.post/frac.fall$T1.post
pq2.post = frac.fall$Q2.post/frac.fall$T2.post
pq3.post = frac.fall$Q3.post/frac.fall$T3.post
pq4.post = frac.fall$Q4.post/frac.fall$T4.post
@

\bibliographystyle{apacite}
\bibliography{/Users/henk/Papers/mathed}
\end{document}
