[simulations] improved univariate data exercise
This commit is contained in:
parent
f0f757edad
commit
5e5ea9965c
@ -1,10 +1,11 @@
|
|||||||
|
% getting familiar with the randn() function:
|
||||||
randn(1, 3)
|
randn(1, 3)
|
||||||
randn(3, 1)
|
randn(3, 1)
|
||||||
randn(2, 4)
|
randn(2, 4)
|
||||||
|
|
||||||
|
% simulate tiger weights:
|
||||||
mu = 220.0; % mean and ...
|
mu = 220.0; % mean and ...
|
||||||
sigma = 30.0; % ... standard deviation of the tigers in kg
|
sigma = 30.0; % ... standard deviation of the tigers in kg
|
||||||
|
|
||||||
for n = [100, 10000]
|
for n = [100, 10000]
|
||||||
fprintf('\nn=%d:\n', n)
|
fprintf('\nn=%d:\n', n)
|
||||||
for i = 1:5
|
for i = 1:5
|
||||||
@ -12,3 +13,8 @@ for n = [100, 10000]
|
|||||||
fprintf(' m=%3.0fkg, std=%3.0fkg\n', mean(x), std(x))
|
fprintf(' m=%3.0fkg, std=%3.0fkg\n', mean(x), std(x))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
% plot the data:
|
||||||
|
plot(x(1:1000), 'o')
|
||||||
|
xlabel('Index')
|
||||||
|
ylabel('Weight [kg]')
|
||||||
|
@ -29,8 +29,12 @@ simulates repeated measurements of some quantity (e.g., weight of
|
|||||||
tigers or firing rate of neurons). Doing so we must specify from which
|
tigers or firing rate of neurons). Doing so we must specify from which
|
||||||
probability distribution the data should originate from and what are
|
probability distribution the data should originate from and what are
|
||||||
the parameters (mean, standard deviation, shape parameters, etc.)
|
the parameters (mean, standard deviation, shape parameters, etc.)
|
||||||
that distribution.
|
that distribution. How to illuastrate and quantify univariate data, no
|
||||||
|
matter whether they have been actually measured or whether they are
|
||||||
|
simulated as described in the following, is described in
|
||||||
|
chapter~\ref{descriptivestatisticschapter}.
|
||||||
|
|
||||||
|
\subsection{Normally distributed data}
|
||||||
For drawing numbers $x_i$ from a normal distribution we use the
|
For drawing numbers $x_i$ from a normal distribution we use the
|
||||||
\code{randn()} function. This function returns normally distributed
|
\code{randn()} function. This function returns normally distributed
|
||||||
numbers $\xi_i$ with zero mean and unit standard deviation. For
|
numbers $\xi_i$ with zero mean and unit standard deviation. For
|
||||||
@ -44,28 +48,32 @@ numbers:
|
|||||||
|
|
||||||
\begin{exercise}{normaldata.m}{normaldata.out}
|
\begin{exercise}{normaldata.m}{normaldata.out}
|
||||||
First, read the documentation of the \varcode{randn()} function and
|
First, read the documentation of the \varcode{randn()} function and
|
||||||
check its output for a some (small) input arguments. Write a little
|
check its output for some (small) input arguments. Write a little
|
||||||
script that generates $n=100$ normally distributed data simulating
|
script that generates $n=100$ normally distributed data simulating
|
||||||
the weight of Bengal tiger males with mean 220\,kg and standard
|
the weight of Bengal tiger males with mean 220\,kg and standard
|
||||||
deviation 30\,kg. Check the actual mean and standard deviation of
|
deviation 30\,kg. Check the actual mean and standard deviation of
|
||||||
the generated data. Do this, let's say, five times using a
|
the generated data. Do this, let's say, five times using a
|
||||||
for-loop. Then increase $n$ to 10\,000 and run the code again. It is
|
for-loop. Then increase $n$ to 10\,000 and run the code again. It is
|
||||||
so simple to measure the weight of 10\,000 tigers for getting a
|
so simple to measure the weight of 10\,000 tigers for getting a
|
||||||
really good estimate of their mean weight, isn't it?
|
really good estimate of their mean weight, isn't it? Finally plot
|
||||||
|
from the last generated data set of tiger weights the first 1000
|
||||||
|
values as a function of their index.
|
||||||
\end{exercise}
|
\end{exercise}
|
||||||
|
|
||||||
Other pdfs (rand(), gamma).
|
\subsection{Uniformly distributed data}
|
||||||
|
\code{rand()}
|
||||||
|
|
||||||
randi()
|
\subsection{Other distributions}
|
||||||
|
|
||||||
plot random numbers
|
\subsection{Random integers}
|
||||||
|
\code{randi()}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\section{Static nonlinearities}
|
\section{Static nonlinearities}
|
||||||
|
|
||||||
Example: mechanotransduciton!
|
Example: mechanotransduciton!
|
||||||
|
|
||||||
draw (and plot) random functions
|
draw (and plot) random functions (in statistics chapter?)
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\section{Dynamical systems}
|
\section{Dynamical systems}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\chapter{Descriptive statistics}
|
\chapter{Descriptive statistics}
|
||||||
|
\label{descriptivestatisticschapter}
|
||||||
\exercisechapter{Descriptive statistics}
|
\exercisechapter{Descriptive statistics}
|
||||||
|
|
||||||
Descriptive statistics characterizes data sets by means of a few measures.
|
Descriptive statistics characterizes data sets by means of a few measures.
|
||||||
|
Reference in New Issue
Block a user