plotting basically done
BIN
statistics/figs/badbarleft.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
statistics/figs/badbarright.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
statistics/figs/badscatterleft.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
statistics/figs/badscatterright.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
statistics/figs/barplots.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
statistics/figs/boxplot.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
statistics/figs/factorplot.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
statistics/figs/paireddata.png
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
statistics/figs/violinplots.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
statistics/figs/yaxisscalingleft.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
statistics/figs/yaxisscalingright.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
@ -42,7 +42,7 @@
|
|||||||
Bernstein Center T\"ubingen}
|
Bernstein Center T\"ubingen}
|
||||||
|
|
||||||
\institute[Scientific Computing]{}
|
\institute[Scientific Computing]{}
|
||||||
\date{11/27/2013}
|
\date{10/20/2014}
|
||||||
%\logo{\pgfuseimage{logo}}
|
%\logo{\pgfuseimage{logo}}
|
||||||
|
|
||||||
\subject{Lectures}
|
\subject{Lectures}
|
||||||
@ -359,9 +359,7 @@ correlation coefficient does not have that property.
|
|||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\section{description of data and plotting}
|
\section{description of data and plotting}
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
\subsection{what makes a good plot}
|
||||||
\subsection{nominal scale}
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{}
|
\frametitle{}
|
||||||
@ -470,6 +468,8 @@ correlation coefficient does not have that property.
|
|||||||
\end{itemize}
|
\end{itemize}
|
||||||
\mycite{Allen et al. 2012, Neuron}
|
\mycite{Allen et al. 2012, Neuron}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
\subsection{bad examples}
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{suboptimal example}
|
\frametitle{suboptimal example}
|
||||||
@ -481,17 +481,50 @@ correlation coefficient does not have that property.
|
|||||||
|
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{different axes}
|
\frametitle{suboptimal example}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.5\linewidth]{figs/badbarright.png}
|
||||||
|
\end{center}
|
||||||
|
\source{http://en.wikipedia.org/wiki/Misleading\_graph}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{suboptimal example}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.4\linewidth]{figs/yaxisscalingleft.png}
|
||||||
|
\hspace{.5cm}
|
||||||
|
\includegraphics[width=.4\linewidth]{figs/yaxisscalingright.png}
|
||||||
|
\end{center}
|
||||||
|
\source{http://en.wikipedia.org/wiki/Misleading\_graph}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{suboptimal example}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.4\linewidth]{figs/badscatterleft.png}
|
||||||
|
\hspace{.5cm}
|
||||||
|
\includegraphics[width=.4\linewidth]{figs/badscatterright.png}
|
||||||
|
\end{center}
|
||||||
|
\source{http://en.wikipedia.org/wiki/Misleading\_graph}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
|
|
||||||
\begin{frame}
|
\begin{frame}
|
||||||
\frametitle{Bad bar plot}
|
\frametitle{suboptimal example}
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=.8\linewidth]{figs/badbarplot}
|
\includegraphics[width=.8\linewidth]{figs/badbarplot}
|
||||||
\end{center}
|
\end{center}
|
||||||
\source{www.enfovis.com}
|
\source{www.enfovis.com}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\subsection{nominal scale}
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{plotting nominal data}
|
\frametitle{plotting nominal data}
|
||||||
@ -536,7 +569,7 @@ set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
|||||||
\end{frame}
|
\end{frame}
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{Darstellung nominaler Daten}
|
\frametitle{plotting nominal data}
|
||||||
\framesubtitle{exercise}
|
\framesubtitle{exercise}
|
||||||
\begin{task}{pie chart}
|
\begin{task}{pie chart}
|
||||||
Plot the same data ($n_{py}=50$, $n_{in}=90$) as a pie chart in Matlab.
|
Plot the same data ($n_{py}=50$, $n_{in}=90$) as a pie chart in Matlab.
|
||||||
@ -544,7 +577,7 @@ set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
|||||||
\end{frame}
|
\end{frame}
|
||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{Darstellung nominaler Daten}
|
\frametitle{plotting nominal data}
|
||||||
\framesubtitle{pie chart for relative frequency}
|
\framesubtitle{pie chart for relative frequency}
|
||||||
\scriptsize
|
\scriptsize
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
@ -614,18 +647,152 @@ ylabel('Count')
|
|||||||
%-------------------------------------------------------------
|
%-------------------------------------------------------------
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
\frametitle{plotting interval/ratio/absolute data}
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
\framesubtitle{other ways}
|
\framesubtitle{bar plot}
|
||||||
There are other ways to plot a sample $x_1, ..., x_n$ of
|
There are several ways to plot a sample $x_1, ..., x_n$ of interval/ratio/absolute
|
||||||
interval/ratio/absolute scale data. E.g.
|
scale with a bar plot
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.6\linewidth]{figs/barplots.png}
|
||||||
|
\end{center}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile,fragile]
|
||||||
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
|
\framesubtitle{bar plot}
|
||||||
|
\scriptsize
|
||||||
|
\begin{lstlisting}
|
||||||
|
% bar plot
|
||||||
|
x = rand(10,1);
|
||||||
|
gray = [.5,.5,.5];
|
||||||
|
|
||||||
|
bar(1, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
hold on
|
||||||
|
|
||||||
|
bar(2, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
plot(0*x + 2, x, 'ok');
|
||||||
|
|
||||||
|
bar(3, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
errorbar(3, mean(x), std(x), 'ok');
|
||||||
|
|
||||||
|
bar(4, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
errorbar(4, mean(x), std(x)/sqrt(length(x)), 'ok');
|
||||||
|
set(gca, 'xtick',[])
|
||||||
|
ylabel('uniformly distributed random data in [0,1]')
|
||||||
|
box('off')
|
||||||
|
title('different forms of bar plots')
|
||||||
|
hold off
|
||||||
|
\end{lstlisting}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile,fragile]
|
||||||
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
|
\framesubtitle{bar plot and measure of central tendency and spread}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item box plot
|
\item A bar plot collapses real data onto a single number and some
|
||||||
\item bar plot
|
measure of spread. This number is usually a {\em measure of central
|
||||||
\item smoothed histogram
|
tendency}, i.e. a typical/central value for the probability
|
||||||
\item ...
|
distribution of the data.\pause
|
||||||
|
\item What measures of central tendency can you think of?\pause
|
||||||
|
\begin{itemize}
|
||||||
|
\item mean
|
||||||
|
\item median
|
||||||
|
\item geometric mean (the nth root of the product of the data values)
|
||||||
|
\item weighted mean
|
||||||
|
\item midrange (mean of the maximum and minimum values of a data set)
|
||||||
|
\end{itemize}\pause
|
||||||
|
\item Additionally, the bar plot is equipped with a measure of {\em
|
||||||
|
spread} or {\em dispersion}. What measure of spread can you think of?\pause
|
||||||
|
\begin{itemize}
|
||||||
|
\item standard deviation
|
||||||
|
\item range (maximum minus minimum of a dataset)
|
||||||
|
\item inter-quartile range
|
||||||
|
\end{itemize}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
We will look at them while plotting mixed data in the following.
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile,fragile]
|
||||||
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
|
\framesubtitle{measure of central tendency and spread}
|
||||||
|
\Large
|
||||||
|
\begin{center}
|
||||||
|
\bf The part of statistics that summarizes data in a small number
|
||||||
|
of values is called {\em descriptive statistics}.
|
||||||
|
\end{center}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
|
\framesubtitle{boxplot}
|
||||||
|
\begin{minipage}{1.0\linewidth}
|
||||||
|
\begin{minipage}{0.5\linewidth}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\linewidth]{figs/boxplot.png}
|
||||||
|
\end{center}
|
||||||
|
\end{minipage}
|
||||||
|
\begin{minipage}{0.5\linewidth}
|
||||||
|
Who knows what the elements mean?\pause
|
||||||
|
\begin{itemize}
|
||||||
|
\item the box depicts the inter-quartile range
|
||||||
|
\item the line denotes the median
|
||||||
|
\item the whiskers denote the extreme value of the data not
|
||||||
|
considered outliers
|
||||||
|
\item outliers are plotted separately
|
||||||
|
\end{itemize}
|
||||||
|
\begin{task}{Outliers}
|
||||||
|
\begin{itemize}
|
||||||
|
\item Find out how an outlier is defined in a matlab boxplot.
|
||||||
|
\item Can you remove an outlier from the dataset?
|
||||||
|
\end{itemize}
|
||||||
|
\end{task}
|
||||||
|
\end{minipage}
|
||||||
|
\end{minipage}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{plotting interval/ratio/absolute data}
|
||||||
|
\framesubtitle{violinplot}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.8\linewidth]{figs/violinplots.png}
|
||||||
|
\end{center}
|
||||||
|
\begin{itemize}
|
||||||
|
\item Violinplots depict the distribution of the data by a
|
||||||
|
smoothed histogram.
|
||||||
|
\item Additional information (data points, median,
|
||||||
|
inter-quartile range) are plotted inside.
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{plotting combinations of scales}
|
||||||
|
What could we use for a combination of categorial/nominal and
|
||||||
|
interval/ratio/absolute?
|
||||||
|
\pause
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.5\linewidth]{figs/factorplot.png}
|
||||||
|
\end{center}
|
||||||
|
Each category is a single bar.
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
%-------------------------------------------------------------
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{plotting combinations of scales}
|
||||||
|
What could we use for a combination of interval/ratio/absolute and
|
||||||
|
interval/ratio/absolute, e.g. $(x_1, y_1), ..., (x_n,y_n)$? \pause
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.8\linewidth]{figs/paireddata.png}
|
||||||
|
\end{center}
|
||||||
|
Scatter plot or paired bar chart. Scatter plot can also be used for
|
||||||
|
ordinal vs. ordinal data (why not the bar chart?).
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
||||||
|
@ -14,3 +14,42 @@ ylabel('Count')
|
|||||||
set(gcf, 'PaperUnits', 'centimeters');
|
set(gcf, 'PaperUnits', 'centimeters');
|
||||||
set(gcf, 'PaperSize', [11.7 9.0]);
|
set(gcf, 'PaperSize', [11.7 9.0]);
|
||||||
set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
||||||
|
|
||||||
|
% bar plot
|
||||||
|
figure
|
||||||
|
x = rand(10,1);
|
||||||
|
gray = [.5,.5,.5];
|
||||||
|
|
||||||
|
bar(1, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
hold on
|
||||||
|
|
||||||
|
bar(2, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
plot(0*x + 2, x, 'ok');
|
||||||
|
|
||||||
|
bar(3, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
errorbar(3, mean(x), std(x), 'ok');
|
||||||
|
|
||||||
|
bar(4, mean(x), 'EdgeColor','w','FaceColor', gray);
|
||||||
|
errorbar(4, mean(x), std(x)/sqrt(length(x)), 'ok');
|
||||||
|
set(gca, 'xtick',[])
|
||||||
|
ylabel('uniformly distributed random data in [0,1]')
|
||||||
|
box('off')
|
||||||
|
title('different forms of bar plots')
|
||||||
|
set(gcf, 'PaperUnits', 'centimeters');
|
||||||
|
set(gcf, 'PaperSize', [11.7 9.0]);
|
||||||
|
set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
||||||
|
hold off
|
||||||
|
|
||||||
|
% box plot
|
||||||
|
figure
|
||||||
|
x = rand(10,1);
|
||||||
|
x(10) = 3;
|
||||||
|
boxplot(x)
|
||||||
|
set(gca, 'xtick',[])
|
||||||
|
ylabel('data')
|
||||||
|
box('off')
|
||||||
|
title('box plot')
|
||||||
|
set(gcf, 'PaperUnits', 'centimeters');
|
||||||
|
set(gcf, 'PaperSize', [11.7 9.0]);
|
||||||
|
set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0]);
|
||||||
|
hold off
|
||||||
|