\documentclass[11pt]{amsart}

\usepackage{fPaper}






%%% Change the following as needed
\author{Ole J. Forsberg}
\title{A Statistical Investigation into the Asuna-Kirito Test}
\date{May 23, 2021}









\begin{document}
\begin{spacing}{1.25}
\maketitle
%%% Add nothing before this






\section{Introduction}
Note that this example helps you better see how all the parts fit together in an appropriate statistics paper. This is the first paragraph of the introduction. Note that this paragraph needs to briefly introduce the topic. Why is it important to test Normality? Which Normality test are you using? Is it better than or worse than the Shapiro-Wilk test?

This is the second paragraph of the introduction. This paragraph provides an overview of your argument. Remember that the purpose of your paper is to prove your thesis statement true. It is not a discussion or a narrative. It is a lean argument. Every sentence needs to dedicated to proving your thesis. In this second paragraph, it is quite acceptable to start with the following. ``To prove this, I will make the following argument.''









\section{Test Overview}
What are the tests you are investigating?

\subsection{Shapiro-Wilk Test}
How does this test work? How is the test statistic calculated? What is the distribution of the test statistic. You will definitely draw on the original source.\cite{shapiro-wilk-1965}


\subsection{Asuna-Kirito Test}
How does this test work? How is the test statistic calculated? What is the distribution of the test statistic. You will definitely draw on the original source.\cite{asuna-kirito-2022}












\section{Experimental Methods}


\subsection{Estimating the Type I Error Rate}
How are you obtaining your results? How are you testing the Type I error rate? Which distribution are you using? What sample sizes? You need to include enough information so that the reader can replicate your experiment.\cite{das-imon-2016}


\subsection{Estimating the Power}
How are you obtaining your results? How are you estimating the power? Which distributions are you using? What sample sizes? You need to include enough information so that the reader can replicate your experiment. \cite{das-imon-2016,textbook}





\section{Results}
This is the longest section.

\subsection{Type I Error Rate}
What were the results? You will want to reference your graphics here (see Figure~\ref{fig:mccain}). If you reference/discuss a graphic, you need to include it in the Graphics Appendix. If you do not reference/discuss a graphic, it should \emph{not} be included in the appendix.


\subsection{Power}
What were the results? You will want to reference your graphics here (see Figure~\ref{fig:mccain}). If you reference/discuss a graphic, you need to include it in the Graphics Appendix. If you do not reference/discuss a graphic, it should \emph{not} be included in the appendix.\cite{textbook}

You may want to provide a table of the results. As expected, you need to discuss the results, not just give them (see Table~\ref{tab:power}).














\section{Conclusion}
This is a summary of your purpose, experiment, and results. This should be the penultimate part written. It should be a couple paragraphs and no more. You are not arguing anything here. You are only retelling your story.












\clearpage
\section*{Appendix 1: Graphics}
%%% Add your figures and tables in this section. Each should be on its own
%%% page with a caption. Only include graphics if you refer to them in your
%%% paper.

%%% Make sure you upload your figures to the project folder

\begin{figure}[h!]\centering
 \includegraphics[width=0.8\textwidth]{mccainBYlogitnormal}
 \caption{Posterior distribution of the log-likelihood for the 2008 US Presidential election in Colorado.}
 \label{fig:mccain}
\end{figure}









\clearpage  %%% To ensure a new page


\begin{table}\centering
\begin{tabular}{l|ccc}
\toprule
$n$ & Exponential & Gamma & Weibull \\
\midrule
10  & $0.201$ & $0.139$ & $0.255$ \\
50  & $0.462$ & $0.395$ & $0.668$ \\
100 & $0.698$ & $0.651$ & $0.876$ \\
500 & $0.998$ & $0.851$ & $0.976$ \\
\bottomrule
\end{tabular}
 \caption{Power estimates for the three distributions discussed in the text for the four sample sizes.}
 \label{tab:power}
\end{table}




%%%%%%%%%%%%%
\end{spacing} %%% <-- Leave this here before the code listing
\clearpage
\section*{Appendix 2: \R\ Code}
%%% Add your code here, between the codein limits
\begin{codein}
##### Normality Testing
#####
##### Asuna-Kirito Test
#####

### Preamble
source("http://rfs.kvasaheim.com/stat200.R")
library(nortest)


### Set parameters
n = 10
B = 1e6


##### Type I Error rates
pv = numeric()

for(i in 1:B) {
  x = rnorm(n,m=0,s=1)
  pv[i] = ak.test(x)$p.value
}


# Graphics and analysis

histogram(pv,xaxt="n",col="#660066",xlim=c(0,1),breaks=0:20/20); abline(h=1); axis(1,at=0:20/20, cex.axis=0.7)
ks.test(pv, "punif")
binom.test(x=sum(pv<0.05), n=length(pv), p=0.05)




##### Type II Error rates

### Symmetric sequence
n = 30

# Asuna-Kirito test
pwrAK = numeric()
for(i in 1:20) {
  pv = numeric()
  for(j in 1:B) {
    x = rt(n, df=i)
    pv[j] = ak.test(x)$p.value
  }
pwrAK[i] = mean(pv<0.05)
}

# Shapiro-Wilk test
pwrSW = numeric()
for(i in 1:20) {
  pv = numeric()
  for(j in 1:B) {
    x = rt(n, df=i)
    pv[j] = shapiro.test(x)$p.value
  }
pwrSW[i] = mean(pv<0.05)
}


### The Graphic

par( las=1, family="serif")
par( xaxs="i",yaxs="i")
par( cex.lab=1.2, font.lab=2, font.sub=3)
par( mar=c(4,4,0,0)+0.5)

plot.new()
plot.window( xlim=c(0,21), ylim=c(0,1.05) )

title(xlab="Degrees of Freedom", line=2.5)
title(sub="[n=30]", line=3.5)
title(ylab="Power", line=2.5)
axis(1)
axis(2)
abline(h=0.05, col="grey", lty="dotted")
abline(h=0.80, col="grey", lty="dotted")
axis(side=2, at=0.05, label=expression(alpha) )

points(1:20, pwrAD, pch=21, bg="red")
points(1:20, pwrSW, pch=21, bg="dodgerblue")

legend("topright", bty="n", pt.bg=c("red","dodgerblue"), pch=21,
	legend=c("Asuna-Kirito test","Shapiro-Wilk test")
	)






##### Skew sequence
n = 100

# Asuna-Kirito test
pwrAK = numeric()
for(i in 1:20) {
  pv = numeric()
  for(j in 1:B) {
    x = rgamma(n, shape=i, rate=5)
    pv[j] = ak.test(x)$p.value
  }
pwrAK[i] = mean(pv<0.05)
}

# Shapiro-Wilk test
pwrSW = numeric()
for(i in 1:20) {
  pv = numeric()
  for(j in 1:B) {
    x = rgamma(n, shape=i, rate=5)
    pv[j] = shapiro.test(x)$p.value
  }
pwrSW[i] = mean(pv<0.05)
}





### The Graphic

par( las=1, family="serif")
par( xaxs="i",yaxs="i")
par( cex.lab=1.2, font.lab=2)
par( mar=c(4,4,0,0)+0.5)

plot.new()
plot.window( xlim=c(0,21), ylim=c(0,1.05) )

title(xlab="Shape Parameter, k", line=2.5)
title(sub="[n=100]", line=3.5)
title(ylab="Power", line=2.5)
axis(1)
axis(2)
abline(h=0.05, col="grey", lty="dotted")
abline(h=0.80, col="grey", lty="dotted")
axis(side=2, at=0.05, label=expression(alpha) )

points(1:20, pwrAD, pch=21, bg="red")
points(1:20, pwrSW, pch=21, bg="dodgerblue")

legend("topright", bty="n", pt.bg=c("red","dodgerblue"), pch=21,
	legend=c("Asuna-Kirito test","Shapiro-Wilk test")
	)
\end{codein}













%%% Add nothing beyond this






% The bibliography
\clearpage
\begin{flushleft}
\bibliographystyle{alpha}
\bibliography{references}
\end{flushleft}




\end{document}
