mirror of
https://github.com/vale981/TUD_MATH_BA
synced 2025-03-04 17:21:38 -05:00
Applied Statistics
Die einzige Vorlesung, die schön ist zu texen in meinem ERASMUS-Semester
This commit is contained in:
parent
ade636d1d7
commit
34a81f885f
17 changed files with 1951 additions and 0 deletions
0
Erasmus/Applied statistics/TeX_files/Bootstrapping.tex
Normal file
0
Erasmus/Applied statistics/TeX_files/Bootstrapping.tex
Normal file
|
@ -0,0 +1,94 @@
|
|||
In statistical analysis we want to estimate a population from a \begriff{random sample}. This is called \begriff{interference} about the parameter. Random samples are used to provide information about parameters in an underlying \begriff{population distribution}. Rather than estimating the full shape of the underlying distribution, we usually focus on one or two parameters.
|
||||
|
||||
We want the error distribution to be centered on zero. Such an estimator is called \begriff{unbiased}. An biased estimator tends to have negative/positive errors, i.e. it usually underestimates/overestimates the parameter that is being estimated.
|
||||
|
||||
We also want \begriff{error distribution} to be tightly concentrated on zero, i.e. to have a small spread.
|
||||
|
||||
A good estimator should have a small bias and small standard error. These two criteria can be combined with into single value called the estimator's \begriff{mean squared error}. Most estimators that we will consider are unbiased, the spread of the error distribution is most important.
|
||||
|
||||
\begin{definition}[Standard error]
|
||||
The \begriff{standard error} (SE) of an estimator $\hat{\theta}$ of a parameter $\theta$ is defined to be its standard deviation.
|
||||
\end{definition}
|
||||
|
||||
\begin{example}
|
||||
Standard error of the mean:
|
||||
\begin{itemize}
|
||||
\item Bias ($\mu$ error) = 0, i.e. $E(\hat{\theta})=\theta$
|
||||
\item When population standard deviation is known: $\text{SE} = \frac{\sigma}{\sqrt{n}}$
|
||||
\item When population standard deviation is unknown: $\text{SE} = \frac{s}{\sqrt{n}}$
|
||||
\end{itemize}
|
||||
\end{example}
|
||||
|
||||
Do not confuse SD (sample standard deviation) ($\to$ one sample) and SE (standard deviation of the sample mean $\bar{x}$) ($\to$ error from hypothetical samples)!
|
||||
|
||||
\begin{definition}[Confidence interval for $\mu$ with known $\sigma$]
|
||||
We can be $(1-\alpha)\cdot 100\%$ confident that the estimate for $\mu$ will be in the interval
|
||||
\begin{align}
|
||||
\bar{x} - z_{\nicefrac{\alpha}{2}}\frac{\sigma}{\sqrt{n}} < \mu < \bar{x} + z_{\nicefrac{\alpha}{2}}\frac{\sigma}{\sqrt{n}} \notag
|
||||
\end{align}
|
||||
|
||||
Common exact values of $z_{\nicefrac{\alpha}{2}}$ with critical values from normal distribution:
|
||||
\begin{center}
|
||||
\begin{tabular}{c|c}
|
||||
\textbf{confidence} & \textbf{value of $z_{\nicefrac{\alpha}{2}}$} \\
|
||||
\hline
|
||||
90\% & 1.645 \\
|
||||
95\% & 1.96 \\
|
||||
99\% & 2.575 \\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{definition}
|
||||
|
||||
\begin{definition}[Confidence interval for $\mu$ when $\sigma$ is unknown]
|
||||
If we simply replace $\sigma$ by its sample variance the confidence level will be lower than 95\%. When the sample size is large, the confidence level is close to 95\% but the confidence level can be much lower if the sample size is small.
|
||||
|
||||
Critical value comes from the \person{Students} t distribution. The value of $t_{\nicefrac{\alpha}{2}}$ depends on the sample size through the use of degrees of freedom. The confidence interval is
|
||||
\begin{align}
|
||||
\bar{x} - t_{\nicefrac{\alpha}{2}}\frac{s}{\sqrt{n}} < \mu < \bar{x} + t_{\nicefrac{\alpha}{2}}\frac{s}{\sqrt{n}} \notag
|
||||
\end{align}
|
||||
\end{definition}
|
||||
|
||||
Consider estimation of a population mean, $\mu$, from a random sample of size $n$. A confidence interval will be of the form $\bar{x}\pm t_{\nicefrac{\alpha}{2}}\frac{s}{\sqrt{n}}$. If we want our estimate to be within $k$ of $\mu$, then we need $n$ to be large enough so that $t_{\nicefrac{\alpha}{2}}\frac{s}{\sqrt{n}} < k$. For 95\% confidence interval if $n$ is reasonably large the t-value in the inequality will be approximately 1.96: $1.96\frac{s}{\sqrt{n}}<k$ that can be re-written as $n>\left(\frac{1.96s}{k}\right)^2$. In practice, it is best to increase $n$ a little over this value in case the sample deviation was wrongly guessed.
|
||||
|
||||
\begin{example}
|
||||
If we expect that a particular type of measurement will have a standard deviation of about 8, and we want to estimate its mean, $\mu$, to within 2 of its correct value with probability 0.95, the sample size should be:
|
||||
\begin{align}
|
||||
n>\left(\frac{1.96\cdot 8}{2}\right)^2 = 61.5\notag
|
||||
\end{align}
|
||||
This suggests a sample size of at least 62. The more accurate trial-and-error method using a t-value would give a sample size of 64.
|
||||
\end{example}
|
||||
|
||||
The sample proportion of successes is denoted by $\hat{p}$ and is an estimate of $p$. The estimation error is $\hat{p}-p$.
|
||||
\begin{align}
|
||||
\hat{p} = \frac{\text{number of successes in sample}}{\text{sample size}} \notag
|
||||
\end{align}
|
||||
A 95\% confidence interval is $\hat{p} \pm 2\cdot\sqrt{\frac{p(1-p)}{n}}$
|
||||
|
||||
\begin{example}
|
||||
In a random sample of $n=36$ values, there were $x=17$ successes. We estimate the population proportion $\hat{p}$ with $\hat{p}=\frac{17}{36}=0.472$. A 95\% confidence interval for $\hat{p}$ is $0.472\pm 0.166$. We are therefor 95\% confident that the population of successes is between 30.6\% and 63.8\%. A sample size of $n=36$ is clearly too small to give a very accurate estimate.
|
||||
|
||||
If the sample size $n$ is small or $\hat{p}$ is close to either 0 or 1, this normal approximation is inaccurate and the confidence level for the interval can be considerably less than 95\%. Classical theory recommends to use the confidence interval for $\hat{p}$ only when $n>30$, $n\hat{p}>5$ and $n(1-\hat{p})>5$.
|
||||
\end{example}
|
||||
|
||||
\begin{*anmerkung}[z-value or t-value?]
|
||||
\begin{itemize}
|
||||
\item If you know the variance of the population, then you should use the z-value from normal distribution.
|
||||
\item If you don't know the variance of the population or the population is non-normal, then you should formally always use the t-value.
|
||||
\item For most non-normal population distributions, the distribution of the sample mean becomes close to normal when the sample size increases (\begriff{Central Limit Theorem})
|
||||
\item Even for relatively small samples, the distributions are virtually the same. Therefore, it is common to approximate the t-distribution using normal distribution for sufficiently large samples (e.g. $n>30$).
|
||||
\end{itemize}
|
||||
\end{*anmerkung}
|
||||
|
||||
\begin{definition}[Tolerance interval]
|
||||
A $(1-\alpha)\cdot 100\%$ \begriff{tolerance interval} for $\gamma\cdot 100\%$ of the measurements in a normal population is given by $\bar{x}\pm Ks$ where $K$ is a tolerance factor. \begriff{Tolerance limits} are the endpoints of the tolerance interval.
|
||||
\end{definition}
|
||||
|
||||
Do not mix up with confidence intervals! We focus on $\gamma$ (a certain percentage of measurements) rather than on a population parameter.
|
||||
|
||||
If we knew $\mu$ and $\sigma$ then the tolerance factor $K$ is 1. Otherwise the tolerance factor depends on the level of confidence, $\gamma$ and the sample size $n$.
|
||||
|
||||
\begin{example}
|
||||
A corporation manufactures field rifles. To monitor the process, an inspector randomly selected 50 firing pins from the production line. The sample mean $\bar{x}$ for all observations is 0.9958 inch and standard deviation $s$ is 0.0333. Assume that the distribution of pin lengths is normal. Find a 95\% tolerance interval for 90\% of the firing pin lengths.
|
||||
|
||||
Given $n=50$, $\gamma=0.9$ and $\alpha=0.05$, work out $K$ (you can either use a special table or MATLAB function). $K=1.996$. The 95\% tolerance interval is (0.9293, 1.0623). Approximately 95 of 100 similarly constructed tolerance intervals will contain 90\% of the firing pin lengths in the population.
|
||||
\end{example}
|
168
Erasmus/Applied statistics/TeX_files/Estimating_parameters_2.tex
Normal file
168
Erasmus/Applied statistics/TeX_files/Estimating_parameters_2.tex
Normal file
|
@ -0,0 +1,168 @@
|
|||
\subsection{Maximum Likelihood Estimate}
|
||||
|
||||
\begin{definition}[likelihood function]
|
||||
If random variables have joint probability $p(x_1,...,x_n\vert \theta)$ then the function $L(\theta\vert x_1,...,x_n)=p(x_1,...,x_n\vert\theta)$ is called the \begriff{likelihood function} of $\theta$.
|
||||
\end{definition}
|
||||
|
||||
The likelihood function tells the probability of getting the data that were observed if the parameter value was really $\theta$.
|
||||
|
||||
\begin{definition}[maximum likelihood estimate]
|
||||
The \begriff{maximum likelihood estimate} of a parameter $\theta$ is the value that maximizes the likelihood function $L(\theta\vert x_1,...,x_n) = p(x_1,...,x_n\vert\theta)$.
|
||||
\end{definition}
|
||||
|
||||
In practice they maximize the logarithm of the likelihood function and solve the following equation:
|
||||
\begin{align}
|
||||
\frac{\mathrm{d}\log L(\theta\vert x_1,...,x_n)}{\mathrm{d}\theta}\notag
|
||||
\end{align}
|
||||
|
||||
The following formula can find an approximate numerical value for the standard error of almost any maximum likelihood estimator:
|
||||
\begin{align}
|
||||
\SE(\hat{\theta}) \approx\sqrt{-\frac{1}{l''(\hat{\theta})}}\notag
|
||||
\end{align}
|
||||
For the 95\% confidence interval we can write:
|
||||
\begin{align}
|
||||
\hat{\theta} - 1.96\cdot\SE(\hat{\theta}) < \theta < \hat{\theta} + 1.96\cdot\SE(\hat{\theta}) \notag
|
||||
\end{align}
|
||||
For the 90\% confidence interval we can write:
|
||||
\begin{align}
|
||||
\hat{\theta} - 1.645\cdot\SE(\hat{\theta}) < \theta < \hat{\theta} + 1.645\cdot\SE(\hat{\theta}) \notag
|
||||
\end{align}
|
||||
|
||||
\begin{example}
|
||||
The probability density function (PDF) of exponential distribution is
|
||||
\begin{align}
|
||||
\PDF = \begin{cases}
|
||||
\lambda e^{-\lambda x} & x\ge 0 \\ 0 & \text{otherwise}
|
||||
\end{cases}\notag
|
||||
\end{align}
|
||||
We want to estimate the parameter $\lambda$.
|
||||
\begin{center}
|
||||
\begin{tabular}{p{4cm}|p{7cm}}
|
||||
Likelihood function & $L(\lambda\vert x_1,...,x_n) = \lambda^n e^{-\lambda\sum x_i}$ \\
|
||||
\hline
|
||||
log-likelihood function & $l(\lambda\vert x_1,...,x_n) = n\log(n)-\lambda\sum x_i$ \\
|
||||
\hline
|
||||
MLE & $l'(\lambda\vert x_1,...,x_n) = \frac{n}{\lambda} - \sum x_i \overset{!}{=} 0\Rightarrow \hat{\lambda} = \frac{1}{\bar{x}}$ \\
|
||||
\hline
|
||||
Standard error & $\SE(\hat{\lambda}) = \sqrt{-\frac{1}{l''(\hat{\lambda})}} = \frac{\hat{\lambda}}{\sqrt{n}} = \frac{1}{\sqrt{n}\bar{x}}$ where $l''(\lambda) = -\frac{n}{\lambda^2}$ \\
|
||||
\hline
|
||||
95\% confidence interval & $\frac{1}{\bar{x}}\pm 1.96\cdot\frac{1}{\sqrt{n}\bar{x}}$
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Lets assume that the mean time between failures of 199 air-conditioners is $\bar{x} = 90.92$ hours. The MLE for the estimated failure rate $\lambda$ is $\frac{1}{\bar{x}} = 0.0110$ failure per hour. \\
|
||||
$\Rightarrow$ 95\% confidence interval for the failure rate:
|
||||
\begin{align}
|
||||
\frac{1}{\bar{x}} \pm 1.96\cdot\frac{1}{\sqrt{n}\bar{x}} \Rightarrow \lambda\in [0.00974,0.01253]\notag
|
||||
\end{align}
|
||||
\end{example}
|
||||
|
||||
Given a sample, we can estimate two unknown parameters in a probability distribution, for example, estimate parameters $\mu$ and $\sigma$ in a normal distribution.
|
||||
|
||||
\begin{definition}[likelihood function for two parameters]
|
||||
If random variables have joint probability $p(x_1,...,x_n\vert \theta,\phi)$ then the function $L(\theta,\phi\vert x_1,...,x_n)=p(x_1,...,x_n\vert\theta,\phi)$ is called the \begriff{likelihood function} of $\theta$ and $\phi$.
|
||||
\end{definition}
|
||||
|
||||
The likelihood function is maximised at a turning point of the likelihood function and could therefore be found by setting the partial derivatives of $L(\theta,\phi)$ with respect to $\theta$ and $\phi$ to zero.
|
||||
|
||||
There are two important properties of the maximum likelihood estimator $\hat{\theta}$ of a parameter $\theta$ based on a random sample of size $n$ from a distribution with a probability function $p(x_1,...,x_n\vert\theta)$:
|
||||
\begin{itemize}
|
||||
\item Asymptotically unbiased: $E(\hat{\theta})\to\theta$ when $n\to\infty$
|
||||
\item Asymptotically has a normal distribution: $\hat{\theta}\to$ normal distribution when $n\to\infty$ that can be used to generate confidence intervals.
|
||||
\item Maximum likelihood estimators have low mean squared error if the sample size is large enough. MLE can be heavily biased for small samples!
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Continuous distributions}
|
||||
|
||||
The \begriff{lognormal distribution} is used in situations where values are positively skewed, for example, for financial analysis of stock prices. Note that the uncertain variable can increase without limits but cannot take negative values.
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {1/(x*sqrt(2*pi))*exp(-0.5*(ln(x))^2)};
|
||||
\addlegendentry{$\mu=0$, $\sigma=1$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
In the \begriff{beta distribution} the uncertain variable is a random value between 0 and positive value. The distribution is frequently used for estimating the proportions and probabilities (i.e. values between 0 and 1). The shape of the distribution is specified by two positive parameters.
|
||||
|
||||
The \begriff{\person{Students} t distribution} is the most widely used distribution in confidence intervals and hypothesis testing. The distribution can be used to estimate the mean of a normally distributed population when the sample size is small. The t distribution comes to approximate the normal distribution as the degrees of freedom (or sample size) increases.
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=-3, xmax=3, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {(1)/(pi*(x^2+1))};
|
||||
\addlegendentry{1 degree of freedom}
|
||||
\addplot+[mark=none] {0.389108/((1+x^2/10)^5.5)};
|
||||
\addlegendentry{10 degrees of freedom}
|
||||
\addplot+[dashed,mark=none] {1/(sqrt(2*pi))*exp(-0.5*x^2)};
|
||||
\addlegendentry{normal distribution}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
The \begriff{chi-square distribution} is usually used for estimating the variance in a normal distribution.
|
||||
|
||||
In a homogeneous \person{Poisson} process with a rate $\lambda$ events per unit time, the time until the first event happens has a distribution called an \begriff{exponential distribution}. All exponential distributions have their highest probability density at $x=0$ and steadily decrease as $x$ increases.
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {exp(-x)};
|
||||
\addlegendentry{$\mu=1$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
The \begriff{\person{Weibull} distribution} can be used as a model for items that either deteriorate or improve over time. It's basic version has two parameters: shape and scale.
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {0.5*x^(-0.5)*exp(-x^0.5)};
|
||||
\addlegendentry{$scale=1$, $shape=0.5$}
|
||||
\addplot+[mark=none] {1/exp(x)};
|
||||
\addlegendentry{$scale=1$, $shape=1$}
|
||||
\addplot+[mark=none] {2*x^(1)*exp(-x^2)};
|
||||
\addlegendentry{$scale=1$, $shape=2$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
\begin{itemize}
|
||||
\item $shape>1$: the hazard function is increasing so the item becomes less reliable as it gets older.
|
||||
\item $shape<1$: the hazard function is decreasing so the item becomes more reliable as it gets older.
|
||||
\item $shape=1$: the hazard function is constant so the lifetime distribution becomes exponential.
|
||||
\end{itemize}
|
||||
|
||||
The \begriff{survival function} (probability of surviving until a particular time) is $R(t) = 1-F(t)$. The \begriff{hazard rate function} (failure rate) is worked out by the formula:
|
||||
\begin{align}
|
||||
h(t) &= \frac{f(t)}{1-F(t)} \notag \\
|
||||
&= \frac{f(t)}{R(t)} \notag
|
||||
\end{align}
|
||||
where $f(t)$ and $F(t)$ are PDF and CDF of the distribution.
|
||||
|
||||
The hazard function describes how an item ages where $t$ affects its risk of failure. This constant hazard function in the exponential distribution corresponds to the \person{Poisson} process without memory, i.e. the chance of failing does not depend on what happened before and how long the item has already survived.
|
218
Erasmus/Applied statistics/TeX_files/Hypothesis_testing_1.tex
Normal file
218
Erasmus/Applied statistics/TeX_files/Hypothesis_testing_1.tex
Normal file
|
@ -0,0 +1,218 @@
|
|||
There are two types of questions in statistical interference:
|
||||
\begin{itemize}
|
||||
\item \textbf{Parameter estimation:} What parameter values would be consistent with the sample data?
|
||||
\item \textbf{Hypothesis testing:} Are the sample data consistent with some statement about the parameters?
|
||||
\end{itemize}
|
||||
|
||||
The \begriff{Null Hypothesis} $H_0$ often specifies a single value for the unknown parameter such as "'$\alpha = \dots$"'. It is a default value that can be accepted as holding if there is no evidence against it. A researcher often collects data with the express hope of disapproving the null hypothesis.
|
||||
|
||||
If the null hypothesis is not true, we say that the \begriff{alternative hypothesis} $H_A$ holds. If the data are not consistent with the null hypothesis, then we can conclude that the alternative hypothesis must be true. Either the null hypothesis or the alternative hypothesis must be true.
|
||||
|
||||
\begin{example}
|
||||
The data show the number of operating hours between successive failures of air-conditioning equipment in ten aircrafts. The sample of 199 values is a \begriff{test statistic}. We can test the manufacturer's claim that the rate of failures is no more than one per 110 hours of use.
|
||||
\begin{align}
|
||||
H_0: \lambda &\le \frac{1}{100}\text{ (claim of a manufacturer)} \notag \\
|
||||
H_A: \lambda &> \frac{1}{100} \notag
|
||||
\end{align}
|
||||
This can be simplified: \\
|
||||
\begin{align}
|
||||
H_0: \lambda &= \frac{1}{100}\text{ (claim of a manufacturer)} \notag \\
|
||||
H_A: \lambda &> \frac{1}{100} \notag
|
||||
\end{align}
|
||||
\end{example}
|
||||
|
||||
\subsection{The P-value (Probability value)}
|
||||
|
||||
In an industrial process some measurement is normally distributed with standard deviation $\sigma = 10$ Its mean should be $\mu = 520$, but can differ a little bit. Samples of $n=10$ measurements are regularly collected as part of quality control. If a sample had $\bar{x}=529$, does the process need to be adjusted?
|
||||
|
||||
\input{./TeX_files/materials/samples_of_mean}
|
||||
|
||||
From the 200 simulated samples above (Monte Carlo simulation), it seems very unlikely that a sample mean of 529 would have been recorded if $\mu = 529$. There is strong evidence that the industrial process no longer has a mean of $\mu = 520$ and needs to be adjusted.
|
||||
|
||||
\begin{definition}[p-value]
|
||||
A \begriff{p-value} describes the \textbf{evidence against} $H_0$. A p-value is evaluated from a random sample so it has a distribution in the same way that a sample mean has a distribution.
|
||||
\end{definition}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{p{4cm}|p{7cm}}
|
||||
\textbf{p-value} & \textbf{Interpretation} \\
|
||||
\hline
|
||||
over 0.1 & no evidence that $H_0$ does not hold \\
|
||||
between 0.05 and 0.1 & very weak evidence that $H_0$ does not hold \\
|
||||
between 0.01 and 0.05 & moderately strong evidence that $H_0$ does not hold \\
|
||||
under 0.01 & strong evidence that $H_0$ does not hold
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\begin{example}[normal distribution with known $\sigma$, one-tailed test]
|
||||
We are given a random sample of $n=30$ with $\bar{x}=16.8$. Does the population have mean $\mu=18.3$ and standard deviation $\sigma=7.1$, or is the mean now lower than 18.3?
|
||||
\begin{align}
|
||||
H_0: \mu &= 18.3 \notag \\
|
||||
H_A: \mu &< 18.3 \notag
|
||||
\end{align}
|
||||
The p-value can be evaluated using the statistical distance of 16.8 from 18.3 (a z statistic).
|
||||
\begin{align}
|
||||
z = \frac{\bar{x} - 18.3}{\underbrace{\frac{7.1}{\sqrt{30}}}_{\text{standard error}}} = -1.155 \notag
|
||||
\end{align}
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=-3, xmax=3, xlabel=$z$,
|
||||
ymin=0, ymax=0.6,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot[name path=f,blue] {1/(sqrt(2*pi))*exp(-0.5*x^2)};
|
||||
\path[name path=axis] (axis cs:-3,0) -- (axis cs:-1.155,0);
|
||||
\addplot [thick,color=blue,fill=blue,fill opacity=0.3] fill between[of=f and axis,soft clip={domain=-3:-1.155},];
|
||||
\draw [dotted,] (axis cs:-1.155,0) -- (axis cs:-1.155,0.6);
|
||||
\node at (axis cs:-2.5,0.25) (node) {p-value};
|
||||
\draw (axis cs:-2.5,0.23) -- (axis cs:-1.5,0.08);
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
\begin{align}
|
||||
\text{p-value} = P(z \le -1.155) = 0.124 \notag
|
||||
\end{align}
|
||||
The p-value is reasonably large, meaning that a sample mean as low as 16.8 would not be unusual if $\mu=18.3$, so there is no evidence against $H_0$.
|
||||
\end{example}
|
||||
|
||||
\begin{example}[normal distribution with known $\sigma$, two-tailed test]
|
||||
Companies test their products to ensure that the amount of active ingredient is within some limits. However the chemical analysis is not precise and repeated measurements of the same specimen usually differ slightly. One type of analysis gives results that are normally distributed with a mean that depend on the actual product being tested and standard deviation 0.0068 grams per litre. A product is tested three times with the following concentrations of the active ingredient: 0.8403, 0.8363, 0.8447 grams per litre. are the data consistent with the target concentration of 0.85 grams per litre?
|
||||
\begin{center}
|
||||
\begin{tabular}{p{4cm}|p{7cm}}
|
||||
null hypothesis & $H_0$: $\mu=0.85$ \\
|
||||
\hline
|
||||
alternative hypothesis & $H_A$: $\mu\neq 0.85$ \\
|
||||
\hline
|
||||
test statistic & $\bar{x} = 0.8404$, $z=\frac{0.8404-0.85}{\frac{0.0068}{\sqrt{3}}} = -2.437$, $P(z\le -2.437) = 0.00741$ \\
|
||||
\hline
|
||||
p-value & $2\cdot 0.00741 = 0.0148$ \\
|
||||
\hline
|
||||
p-value interpretation & There is moderately strong evidence that the true concentration is not 0.85.
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{example}
|
||||
|
||||
\begin{example}[normal distribution with unknown $\sigma$, one-tailed test]
|
||||
Both cholesterol and saturated fats are often avoided by people who are trying to lose weight or reduce their blood cholesterol level. Cooking oil made from soybeans has little cholesterol and has been claimed to have only 15\% saturated fat. A clinician believes that the saturated fat content is greater than 15\% and randomly samples 13 bottles of soybean cooking oil for testing with the following percentage saturated fat: 15.2, 12.4, 15.4, 13.5, 15.9, 17.1, 16.9, 14.3, 19.1, 18.2, 15.5, 16.3, 20.0.
|
||||
\begin{center}
|
||||
\begin{tabular}{p{4cm}|p{7cm}}
|
||||
null hypothesis & $H_0$: $\mu=15$ \\
|
||||
\hline
|
||||
alternative hypothesis & $H_A$: $\mu > 15$ \\
|
||||
\hline
|
||||
T-test for $\mu$ & $\bar{x} = 16.138$, $z=\frac{16.138-15}{\frac{2.154}{\sqrt{13}}} = 1.906$, $P(t\ge 1.906) = 0.040$ (t-distribution with 12 degrees of freedom) \\
|
||||
\hline
|
||||
p-value interpretation & Since this is below 0.05, we conclude that there is moderately strong evidence that the mean saturated fat content of the oils is higher than the claimed 15\%.
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{example}
|
||||
|
||||
A hypothesis test is based on two competing hypotheses about the value of a parameter $\theta$. \\
|
||||
Null hypothesis $H_0$: $\theta = \theta_0$ \\
|
||||
Alternative hypothesis (one-tailed test) $H_A$: $\theta > \theta_0$
|
||||
|
||||
The hypothesis test is based on a test statistic that is some function of the data values:
|
||||
\begin{align}
|
||||
Q = g(x_1,...,x_n\vert\theta_0) \notag
|
||||
\end{align}
|
||||
whose distribution is fully known when $H_0$ is true (i.e. when $\theta_0$ is the true parameter value). We evaluate the test statistic to assess whether it is unusual enough to throw doubt on the null hypothesis.
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=4,
|
||||
ymin=0, ymax=1,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot[name path=f,blue] {1/(x*sqrt(2*pi))*exp(-0.5*(ln(x))^2)};
|
||||
\path[name path=axis] (axis cs:2,0) -- (axis cs:4,0);
|
||||
\addplot [thick,color=blue,fill=blue,fill opacity=0.3] fill between[of=f and axis,soft clip={domain=2:4}];
|
||||
\draw [dotted] (axis cs:2,0) -- (axis cs:2,0.55);
|
||||
\node at (axis cs:3,0.5) (1) {observed value of $Q$};
|
||||
\node at (axis cs:1.7,0.75) (2) {distribution of $Q$ when $H_0$ is true};
|
||||
\node at (axis cs:3,0.3) (3) {p-value};
|
||||
\draw (axis cs:3,0.25) -- (axis cs:2.5,0.05);
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
\begin{theorem}
|
||||
P-values close to zero throw doubt on the null hypothesis.
|
||||
\end{theorem}
|
||||
|
||||
\subsection{The significance level}
|
||||
|
||||
\begin{definition}[significance level]
|
||||
The \begriff{significance level} is the probability of wrongly concluding that $H_0$ does not hold when it actually does.
|
||||
\end{definition}
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{One-tailed test:} For example, it may be acceptable to have a 5\% chance of concluding that $\theta<\theta_0$ when actually $\theta=\theta_0$. This means a significance level (tail area of the test statistic's distribution) of this test is $\alpha=0.05$.
|
||||
\item \textbf{Two-tailed test:} Values at both tails of the distribution of the test statistic result in rejection of $H_0$, so the corresponding tail areas should each have area $\frac{\alpha}{2}$ for a test with significance level $\alpha$.
|
||||
\end{itemize}
|
||||
|
||||
\begin{example}
|
||||
Cooking oil made from soybeans has little cholesterol and has been claimed to have only 15\% saturated fat. A clinician believes that the saturated fat content is greater than 15\% and randomly samples 13 bottles of soybean cooking oil for testing: 15.2, 12.4, 15.4, 13.5, 15.9, 17.1, 16.9, 14.3, 19.1, 18.2, 15.5, 16.3, 20.0.
|
||||
\begin{center}
|
||||
\begin{tabular}{p{4cm}|p{7cm}}
|
||||
Null hypothesis & $H_0$: $\mu=15$ \\
|
||||
\hline
|
||||
Alternative hypothesis & $H_A$: $\mu > 15$ \\
|
||||
\hline
|
||||
\multicolumn{2}{p{11cm}}{A significance level of $\alpha=0.05$ means that the clinician is willing to wrongly conclude that the saturated fat content is over 15\% when it really is 15\% with probability 0.05.} \\
|
||||
\hline
|
||||
t-statistic & $t=\frac{\bar{x}-15}{\frac{s}{\sqrt{13}}} = 1.906$ \\
|
||||
\hline
|
||||
rejection region & $P(T>1.782) = 0.05$ \\
|
||||
\hline
|
||||
Conclusion & $H_0$ is rejected at the 5\% significance level.
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{example}
|
||||
|
||||
\begin{definition}[Type 1 + 2 error]
|
||||
The \begriff{Type 1 error} is the significance level of the test. The decision rule is usually defined to make the significance level 5\% or 1\%.
|
||||
|
||||
The \begriff{Type 2 error} is wrongly accepting $H_0$ when it is false.
|
||||
\end{definition}
|
||||
|
||||
Instead of the probability of a Type 2 error, it is common to use the \begriff{power} of a test, defined as one minus the probability of a Type 2 error. The power of a test is the probability of correctly rejecting $H_0$ when it is false.
|
||||
\begin{center}
|
||||
\begin{tabular}{p{2cm}p{2cm}|p{3cm}|p{3cm}}
|
||||
& & \multicolumn{2}{|c}{Decision} \\
|
||||
\cline{3-4}
|
||||
& & accept $H_0$ & reject $H_0$ \\
|
||||
\hline
|
||||
\multirow{3}{*}{Truth} & \multicolumn{1}{|l|}{$H_0$ is true} & \cellcolor{green} & \cellcolor{red}significance level = P(Type 1 error) \\
|
||||
\cline{2-4}
|
||||
& \multicolumn{1}{|l|}{$H_0$ is false} & \cellcolor{red}$P(\text{Type 2 error})$ & \cellcolor{green}Power = 1 - P(Type 2 error) \\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Computer software can provide the p-value for a hypothesis test at 5\% or 1\% significance level (Type 1 error).
|
||||
|
||||
It is clearly desirable to use a test whose power is as close to 1 as possible. There are three different ways to increase the power:
|
||||
\begin{itemize}
|
||||
\item \textbf{Increase the significance level:} If the critical value for the test is adjusted, increasing the probability of a Type 1 error decreases the probability of a Type 2 error and therefore increase the power.
|
||||
\item \textbf{Use a different decision rule:} For example, in a test about the mean of a normal population, a decision rule based on the sample median has lower power than a decision rule based on the sample mean.
|
||||
\item \textbf{Increase the sample size:} By increasing the amount of data on which we base our decision about whether to accept or reject $H_0$, the probabilities of making errors can be reduced.
|
||||
\end{itemize}
|
||||
|
||||
When the significance level is fixed, increasing the sample size is therefore usually the only way to improve the power.
|
||||
|
||||
Ideally there should be a trade-off between low significance level (Type 1 error) and high power. The desired power of the test is usually 0.8. The power of a test is not a single value since the alternative hypothesis allows for a range of different parameter values. It is represented by a power function that can be graphed against the possible parameter values. MATLAB \texttt{sampsizepwr} can compute the sample size to obtain a particular power for a hypothesis test, given the parameter value of the alternative hypothesis.
|
||||
|
||||
\input{./TeX_files/materials/power_vs_sample_size}
|
||||
|
||||
There are a many number of statistical tests for assessing normality: \person{Shapiro-Wilk} test, \person{Kolmogorov-Smirnov} test, \person{Jacque-Bera} test, etc. The \person{Shapiro-Wilk} test ($n<50$) can be used to verify whether data come from a normal distribution: \\
|
||||
$H_0$: sample data are not significantly different than a normal population. \\
|
||||
$H_A$: sample data are significantly different than a normal population. \\
|
||||
P-value $>0.05$ mean the data are normal \\
|
||||
P-value $<0.05$ mean the data are not normal \\
|
||||
\person{Monte Carlo} simulations proved the efficiency of \person{Shapiro-Wilk} test. It s preferable that normality is assessed visually as well! The \person{Kolmogorov-Smirnov} non-parametric test ($n>50$) examines if scores are likely to follow some distribution in some population (not necessarily normal).
|
0
Erasmus/Applied statistics/TeX_files/Model_building.tex
Normal file
0
Erasmus/Applied statistics/TeX_files/Model_building.tex
Normal file
155
Erasmus/Applied statistics/TeX_files/Weibulls_Distribution.tex
Normal file
155
Erasmus/Applied statistics/TeX_files/Weibulls_Distribution.tex
Normal file
|
@ -0,0 +1,155 @@
|
|||
\subsection{\person{Weibulls} Distribution - Graphs}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{p{5cm}|p{5cm}|p{5cm}}
|
||||
$shape = 0.5$ & $shape = 1$ & $shape = 2$ \\
|
||||
\hline
|
||||
\multicolumn{3}{c}{\cellcolor{gray!50}\textbf{Weibull PDF} ($scale = 1$)} \\
|
||||
\hline
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {0.5*x^(-0.5)*exp(-x^0.5)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {1/exp(x)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {2*x^(1)*exp(-x^2)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} \\
|
||||
\hline
|
||||
\multicolumn{3}{c}{\cellcolor{gray!50}\textbf{Weibull CDF} ($scale = 1$)} \\
|
||||
\hline
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {1-exp(-x^0.5)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {1-1/exp(x)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {1-exp(-x^2)};
|
||||
\end{axis}
|
||||
\end{tikzpicture} \\
|
||||
\hline
|
||||
\multicolumn{3}{c}{\cellcolor{gray!50}\textbf{Hazard function} $\left(h = \frac{\text{PDF}}{1-\text{CDF}}\right)$} \\
|
||||
\hline
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {(0.5*x^(-0.5)*exp(-x^0.5))/(1-(1-exp(-x^0.5)))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {(1/exp(x))/(1-(1-1/exp(x)))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {(2*x^(1)*exp(-x^2))/(1-(1-exp(-x^2)))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} \\
|
||||
\hline
|
||||
\multicolumn{3}{c}{\cellcolor{gray!50}\textbf{Survival function} ($R = 1-\text{CDF}$)} \\
|
||||
\hline
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {1-(1-exp(-x^0.5))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot+[mark=none] {1-(1-1/exp(x))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} &
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=2, xlabel=$x$,
|
||||
ymin=0, ymax=1, ylabel=$y$,
|
||||
samples=400,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
]
|
||||
\addplot+[mark=none] {1-(1-exp(-x^2))};
|
||||
\end{axis}
|
||||
\end{tikzpicture} \\
|
||||
\end{tabular}
|
||||
\end{center}
|
|
@ -0,0 +1,114 @@
|
|||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
xmin=0, xmax=100, xlabel=sample size,
|
||||
ymin=0, ymax=1, ylabel=power,
|
||||
samples=401,
|
||||
axis y line=middle,
|
||||
axis x line=middle,
|
||||
restrict y to domain=0:1,
|
||||
]
|
||||
\addplot[mark=x, blue] coordinates {
|
||||
( 2,0.06)
|
||||
( 3,0.07)
|
||||
( 4,0.09)
|
||||
( 5,0.11)
|
||||
( 6,0.13)
|
||||
( 7,0.15)
|
||||
( 8,0.17)
|
||||
( 9,0.19)
|
||||
( 10,0.21)
|
||||
( 11,0.22)
|
||||
( 12,0.24)
|
||||
( 13,0.26)
|
||||
( 14,0.28)
|
||||
( 15,0.30)
|
||||
( 16,0.32)
|
||||
( 17,0.34)
|
||||
( 18,0.36)
|
||||
( 19,0.38)
|
||||
( 20,0.40)
|
||||
( 21,0.42)
|
||||
( 22,0.43)
|
||||
( 23,0.45)
|
||||
( 24,0.47)
|
||||
( 25,0.48)
|
||||
( 26,0.50)
|
||||
( 27,0.52)
|
||||
( 28,0.53)
|
||||
( 29,0.55)
|
||||
( 30,0.56)
|
||||
( 31,0.58)
|
||||
( 32,0.59)
|
||||
( 33,0.61)
|
||||
( 34,0.62)
|
||||
( 35,0.63)
|
||||
( 36,0.65)
|
||||
( 37,0.66)
|
||||
( 38,0.67)
|
||||
( 39,0.68)
|
||||
( 40,0.69)
|
||||
( 41,0.71)
|
||||
( 42,0.72)
|
||||
( 43,0.73)
|
||||
( 44,0.74)
|
||||
( 45,0.75)
|
||||
( 46,0.76)
|
||||
( 47,0.77)
|
||||
( 48,0.77)
|
||||
( 49,0.78)
|
||||
( 50,0.79)
|
||||
( 51,0.80)
|
||||
( 52,0.81)
|
||||
( 53,0.82)
|
||||
( 54,0.82)
|
||||
( 55,0.83)
|
||||
( 56,0.84)
|
||||
( 57,0.84)
|
||||
( 58,0.85)
|
||||
( 59,0.86)
|
||||
( 60,0.86)
|
||||
( 61,0.87)
|
||||
( 62,0.87)
|
||||
( 63,0.88)
|
||||
( 64,0.88)
|
||||
( 65,0.89)
|
||||
( 66,0.89)
|
||||
( 67,0.90)
|
||||
( 68,0.90)
|
||||
( 69,0.91)
|
||||
( 70,0.91)
|
||||
( 71,0.91)
|
||||
( 72,0.92)
|
||||
( 73,0.92)
|
||||
( 74,0.92)
|
||||
( 75,0.93)
|
||||
( 76,0.93)
|
||||
( 77,0.93)
|
||||
( 78,0.94)
|
||||
( 79,0.94)
|
||||
( 80,0.94)
|
||||
( 81,0.94)
|
||||
( 82,0.95)
|
||||
( 83,0.95)
|
||||
( 84,0.95)
|
||||
( 85,0.95)
|
||||
( 86,0.96)
|
||||
( 87,0.96)
|
||||
( 88,0.96)
|
||||
( 89,0.96)
|
||||
( 90,0.96)
|
||||
( 91,0.97)
|
||||
( 92,0.97)
|
||||
( 93,0.97)
|
||||
( 94,0.97)
|
||||
( 95,0.97)
|
||||
( 96,0.97)
|
||||
( 97,0.97)
|
||||
( 98,0.98)
|
||||
( 99,0.98)
|
||||
(100,0.98)
|
||||
};
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
|
@ -0,0 +1,222 @@
|
|||
\begin{center}
|
||||
\begin{tikzpicture}[scale=0.6]
|
||||
\node at (525.23,0.09) (1) {$\times$};
|
||||
\node at (521.10,0.67) (2) {$\times$};
|
||||
\node at (519.55,1.00) (3) {$\times$};
|
||||
\node at (518.37,0.28) (4) {$\times$};
|
||||
\node at (522.27,0.13) (5) {$\times$};
|
||||
\node at (522.26,0.55) (6) {$\times$};
|
||||
\node at (509.43,0.93) (7) {$\times$};
|
||||
\node at (518.28,0.02) (8) {$\times$};
|
||||
\node at (522.19,0.74) (9) {$\times$};
|
||||
\node at (520.17,0.75) (10) {$\times$};
|
||||
\node at (520.22,0.13) (11) {$\times$};
|
||||
\node at (519.52,0.37) (12) {$\times$};
|
||||
\node at (519.65,0.88) (13) {$\times$};
|
||||
\node at (519.50,0.98) (14) {$\times$};
|
||||
\node at (515.93,0.28) (15) {$\times$};
|
||||
\node at (517.45,0.18) (16) {$\times$};
|
||||
\node at (524.65,0.49) (17) {$\times$};
|
||||
\node at (520.52,0.54) (18) {$\times$};
|
||||
\node at (517.60,0.85) (19) {$\times$};
|
||||
\node at (524.15,0.30) (20) {$\times$};
|
||||
\node at (521.90,0.73) (21) {$\times$};
|
||||
\node at (520.34,0.99) (22) {$\times$};
|
||||
\node at (521.04,0.82) (23) {$\times$};
|
||||
\node at (525.24,0.06) (24) {$\times$};
|
||||
\node at (513.66,0.70) (25) {$\times$};
|
||||
\node at (518.39,0.02) (26) {$\times$};
|
||||
\node at (520.46,0.76) (27) {$\times$};
|
||||
\node at (515.86,0.82) (28) {$\times$};
|
||||
\node at (515.90,0.32) (29) {$\times$};
|
||||
\node at (519.11,0.31) (30) {$\times$};
|
||||
\node at (518.38,0.54) (31) {$\times$};
|
||||
\node at (514.55,0.65) (32) {$\times$};
|
||||
\node at (524.35,0.63) (33) {$\times$};
|
||||
\node at (520.66,0.26) (34) {$\times$};
|
||||
\node at (522.26,0.72) (35) {$\times$};
|
||||
\node at (519.90,0.94) (36) {$\times$};
|
||||
\node at (521.55,0.99) (37) {$\times$};
|
||||
\node at (524.03,0.25) (38) {$\times$};
|
||||
\node at (521.99,0.07) (39) {$\times$};
|
||||
\node at (513.94,0.18) (40) {$\times$};
|
||||
\node at (521.20,0.28) (41) {$\times$};
|
||||
\node at (524.44,0.97) (42) {$\times$};
|
||||
\node at (518.39,0.22) (43) {$\times$};
|
||||
\node at (518.56,0.89) (44) {$\times$};
|
||||
\node at (518.95,0.69) (45) {$\times$};
|
||||
\node at (522.26,0.71) (46) {$\times$};
|
||||
\node at (530.34,0.84) (47) {$\times$};
|
||||
\node at (516.74,0.13) (48) {$\times$};
|
||||
\node at (520.68,0.54) (49) {$\times$};
|
||||
\node at (521.57,0.33) (50) {$\times$};
|
||||
\node at (523.36,0.93) (51) {$\times$};
|
||||
\node at (518.58,0.86) (52) {$\times$};
|
||||
\node at (519.83,0.28) (53) {$\times$};
|
||||
\node at (519.77,0.45) (54) {$\times$};
|
||||
\node at (517.39,0.67) (55) {$\times$};
|
||||
\node at (521.89,0.97) (56) {$\times$};
|
||||
\node at (514.41,0.56) (57) {$\times$};
|
||||
\node at (525.90,0.97) (58) {$\times$};
|
||||
\node at (521.62,0.59) (59) {$\times$};
|
||||
\node at (523.65,0.93) (60) {$\times$};
|
||||
\node at (521.68,0.33) (61) {$\times$};
|
||||
\node at (522.09,0.41) (62) {$\times$};
|
||||
\node at (519.02,0.88) (63) {$\times$};
|
||||
\node at (521.95,0.50) (64) {$\times$};
|
||||
\node at (514.71,0.88) (65) {$\times$};
|
||||
\node at (521.41,0.79) (66) {$\times$};
|
||||
\node at (523.43,0.37) (67) {$\times$};
|
||||
\node at (521.81,0.53) (68) {$\times$};
|
||||
\node at (521.29,0.34) (69) {$\times$};
|
||||
\node at (523.50,0.03) (70) {$\times$};
|
||||
\node at (520.85,0.76) (71) {$\times$};
|
||||
\node at (522.87,0.82) (72) {$\times$};
|
||||
\node at (522.07,0.86) (73) {$\times$};
|
||||
\node at (521.25,0.48) (74) {$\times$};
|
||||
\node at (521.78,0.28) (75) {$\times$};
|
||||
\node at (519.72,0.42) (76) {$\times$};
|
||||
\node at (522.24,0.22) (77) {$\times$};
|
||||
\node at (515.84,0.61) (78) {$\times$};
|
||||
\node at (522.90,0.17) (79) {$\times$};
|
||||
\node at (515.03,0.03) (80) {$\times$};
|
||||
\node at (520.84,0.59) (81) {$\times$};
|
||||
\node at (523.55,0.63) (82) {$\times$};
|
||||
\node at (517.79,0.24) (83) {$\times$};
|
||||
\node at (520.65,0.54) (84) {$\times$};
|
||||
\node at (518.35,0.22) (85) {$\times$};
|
||||
\node at (522.88,0.22) (86) {$\times$};
|
||||
\node at (514.12,0.65) (87) {$\times$};
|
||||
\node at (517.22,0.96) (88) {$\times$};
|
||||
\node at (515.34,0.88) (89) {$\times$};
|
||||
\node at (511.53,0.42) (90) {$\times$};
|
||||
\node at (518.22,0.28) (91) {$\times$};
|
||||
\node at (519.59,0.71) (92) {$\times$};
|
||||
\node at (522.17,0.31) (93) {$\times$};
|
||||
\node at (524.46,0.87) (94) {$\times$};
|
||||
\node at (520.20,0.60) (95) {$\times$};
|
||||
\node at (518.04,0.86) (96) {$\times$};
|
||||
\node at (525.25,0.18) (97) {$\times$};
|
||||
\node at (518.30,0.90) (98) {$\times$};
|
||||
\node at (517.44,0.16) (99) {$\times$};
|
||||
\node at (518.04,0.82) (100) {$\times$};
|
||||
\node at (516.83,0.81) (101) {$\times$};
|
||||
\node at (522.26,0.70) (102) {$\times$};
|
||||
\node at (520.81,0.65) (103) {$\times$};
|
||||
\node at (520.61,0.85) (104) {$\times$};
|
||||
\node at (522.54,0.95) (105) {$\times$};
|
||||
\node at (522.07,0.05) (106) {$\times$};
|
||||
\node at (515.14,0.28) (107) {$\times$};
|
||||
\node at (521.14,0.04) (108) {$\times$};
|
||||
\node at (516.08,0.61) (109) {$\times$};
|
||||
\node at (516.57,0.10) (110) {$\times$};
|
||||
\node at (525.45,0.59) (111) {$\times$};
|
||||
\node at (521.47,0.68) (112) {$\times$};
|
||||
\node at (516.13,0.21) (113) {$\times$};
|
||||
\node at (518.00,0.16) (114) {$\times$};
|
||||
\node at (524.16,0.84) (115) {$\times$};
|
||||
\node at (518.87,0.34) (116) {$\times$};
|
||||
\node at (515.00,0.88) (117) {$\times$};
|
||||
\node at (519.75,0.81) (118) {$\times$};
|
||||
\node at (520.41,0.80) (119) {$\times$};
|
||||
\node at (522.23,0.39) (120) {$\times$};
|
||||
\node at (523.63,0.61) (121) {$\times$};
|
||||
\node at (526.56,0.94) (122) {$\times$};
|
||||
\node at (521.32,0.58) (123) {$\times$};
|
||||
\node at (526.08,0.43) (124) {$\times$};
|
||||
\node at (513.60,0.42) (125) {$\times$};
|
||||
\node at (520.35,0.19) (126) {$\times$};
|
||||
\node at (517.73,0.75) (127) {$\times$};
|
||||
\node at (517.23,0.29) (128) {$\times$};
|
||||
\node at (517.98,0.38) (129) {$\times$};
|
||||
\node at (515.38,0.08) (130) {$\times$};
|
||||
\node at (516.11,0.61) (131) {$\times$};
|
||||
\node at (513.18,0.06) (132) {$\times$};
|
||||
\node at (519.81,0.87) (133) {$\times$};
|
||||
\node at (517.20,0.24) (134) {$\times$};
|
||||
\node at (520.76,0.62) (135) {$\times$};
|
||||
\node at (516.53,0.50) (136) {$\times$};
|
||||
\node at (514.76,0.03) (137) {$\times$};
|
||||
\node at (513.52,0.68) (138) {$\times$};
|
||||
\node at (521.10,0.29) (139) {$\times$};
|
||||
\node at (511.91,0.05) (140) {$\times$};
|
||||
\node at (519.47,0.18) (141) {$\times$};
|
||||
\node at (522.84,0.43) (142) {$\times$};
|
||||
\node at (527.22,0.61) (143) {$\times$};
|
||||
\node at (525.62,0.44) (144) {$\times$};
|
||||
\node at (514.56,0.79) (145) {$\times$};
|
||||
\node at (515.91,0.13) (146) {$\times$};
|
||||
\node at (521.01,0.26) (147) {$\times$};
|
||||
\node at (523.44,0.20) (148) {$\times$};
|
||||
\node at (517.98,0.32) (149) {$\times$};
|
||||
\node at (515.70,0.45) (150) {$\times$};
|
||||
\node at (524.60,0.39) (151) {$\times$};
|
||||
\node at (518.86,0.16) (152) {$\times$};
|
||||
\node at (518.55,0.09) (153) {$\times$};
|
||||
\node at (521.11,0.97) (154) {$\times$};
|
||||
\node at (518.76,0.24) (155) {$\times$};
|
||||
\node at (519.29,0.70) (156) {$\times$};
|
||||
\node at (518.37,0.98) (157) {$\times$};
|
||||
\node at (519.79,0.24) (158) {$\times$};
|
||||
\node at (520.72,0.65) (159) {$\times$};
|
||||
\node at (520.76,0.60) (160) {$\times$};
|
||||
\node at (523.01,0.13) (161) {$\times$};
|
||||
\node at (523.41,0.12) (162) {$\times$};
|
||||
\node at (524.07,0.01) (163) {$\times$};
|
||||
\node at (522.68,0.15) (164) {$\times$};
|
||||
\node at (521.71,0.15) (165) {$\times$};
|
||||
\node at (516.41,0.22) (166) {$\times$};
|
||||
\node at (523.11,0.88) (167) {$\times$};
|
||||
\node at (523.43,0.18) (168) {$\times$};
|
||||
\node at (525.66,0.25) (169) {$\times$};
|
||||
\node at (522.78,0.97) (170) {$\times$};
|
||||
\node at (513.52,0.37) (171) {$\times$};
|
||||
\node at (519.57,0.75) (172) {$\times$};
|
||||
\node at (522.67,0.13) (173) {$\times$};
|
||||
\node at (520.85,0.69) (174) {$\times$};
|
||||
\node at (523.93,0.07) (175) {$\times$};
|
||||
\node at (519.32,0.55) (176) {$\times$};
|
||||
\node at (520.67,0.29) (177) {$\times$};
|
||||
\node at (515.65,0.93) (178) {$\times$};
|
||||
\node at (522.89,0.03) (179) {$\times$};
|
||||
\node at (519.17,0.96) (180) {$\times$};
|
||||
\node at (518.00,0.58) (181) {$\times$};
|
||||
\node at (517.23,0.18) (182) {$\times$};
|
||||
\node at (526.78,0.05) (183) {$\times$};
|
||||
\node at (518.66,0.18) (184) {$\times$};
|
||||
\node at (520.97,0.80) (185) {$\times$};
|
||||
\node at (516.08,0.67) (186) {$\times$};
|
||||
\node at (516.97,0.25) (187) {$\times$};
|
||||
\node at (520.35,0.12) (188) {$\times$};
|
||||
\node at (516.30,0.90) (189) {$\times$};
|
||||
\node at (514.98,0.99) (190) {$\times$};
|
||||
\node at (524.01,0.05) (191) {$\times$};
|
||||
\node at (517.33,0.60) (192) {$\times$};
|
||||
\node at (519.02,0.93) (193) {$\times$};
|
||||
\node at (516.61,0.27) (194) {$\times$};
|
||||
\node at (525.17,0.87) (195) {$\times$};
|
||||
\node at (516.32,0.91) (196) {$\times$};
|
||||
\node at (525.43,0.24) (197) {$\times$};
|
||||
\node at (522.81,0.33) (198) {$\times$};
|
||||
\node at (519.42,0.50) (199) {$\times$};
|
||||
\node at (521.66,0.51) (200) {$\times$};
|
||||
|
||||
\draw (508,-0.2) -- (532,-0.2);
|
||||
\draw (510,-0.1) -- (510,-0.3);
|
||||
\node at (510,-0.6) (510) {510};
|
||||
\draw (515,-0.1) -- (515,-0.3);
|
||||
\node at (515,-0.6) (515) {515};
|
||||
\draw (520,-0.1) -- (520,-0.3);
|
||||
\node at (520,-0.6) (520) {520};
|
||||
\draw (525,-0.1) -- (525,-0.3);
|
||||
\node at (525,-0.6) (525) {525};
|
||||
\draw (530,-0.1) -- (530,-0.3);
|
||||
\node at (530,-0.6) (530) {530};
|
||||
|
||||
\draw[red,dotted] (511,1.2) -- (511,-0.2);
|
||||
\draw[red,dotted] (529,1.2) -- (529,-0.2);
|
||||
|
||||
\node at (530,-1.2) (axis) {Means of sample};
|
||||
\node at (520,2) (top) {\large Means of samples of $n=10$ values from normal ($\mu=520$, $\sigma=10$)};
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
BIN
Erasmus/Applied statistics/main.pdf
Normal file
BIN
Erasmus/Applied statistics/main.pdf
Normal file
Binary file not shown.
58
Erasmus/Applied statistics/main.tex
Normal file
58
Erasmus/Applied statistics/main.tex
Normal file
|
@ -0,0 +1,58 @@
|
|||
\documentclass[british,a4paper,order=firstname]{mathscript}
|
||||
\usepackage{mathoperators}
|
||||
|
||||
\title{\textbf{Applied statistics (spring term 2019)}}
|
||||
\author{readers: \person{Nikolai Bode} and \person{Ksenia Shalonova}}
|
||||
|
||||
\begin{document}
|
||||
\pagenumbering{roman}
|
||||
\pagestyle{plain}
|
||||
|
||||
\maketitle
|
||||
|
||||
\hypertarget{tocpage}{}
|
||||
\tableofcontents
|
||||
\bookmark[dest=tocpage,level=1]{Table of contents}
|
||||
|
||||
\pagebreak
|
||||
\pagenumbering{arabic}
|
||||
\pagestyle{fancy}
|
||||
|
||||
\section{Estimating parameters}
|
||||
\input{./TeX_files/Estimating_parameters_1}
|
||||
\input{./TeX_files/Estimating_parameters_2}
|
||||
\pagebreak
|
||||
\section{Hypothesis testing}
|
||||
\input{./TeX_files/Hypothesis_testing_1}
|
||||
\input{./TeX_files/Hypothesis_testing_2}
|
||||
\pagebreak
|
||||
\section{Bootstrapping}
|
||||
\input{./TeX_files/Bootstrapping}
|
||||
\pagebreak
|
||||
\section{Linear models (Simple linear regression)}
|
||||
\input{./TeX_files/Linear_models_SLR}
|
||||
\pagebreak
|
||||
\section{Linear models (Multiple linear regression)}
|
||||
\input{./TeX_files/Linear_models_MLR}
|
||||
\pagebreak
|
||||
\section{Model building}
|
||||
\input{./TeX_files/Model_building}
|
||||
\pagebreak
|
||||
\section{Experimental design and ANOVA}
|
||||
\input{./TeX_files/Experimental_design_and_ANOVA}
|
||||
\pagebreak
|
||||
\section{Generalised linear models}
|
||||
\input{./TeX_files/Generalised_linear_models}
|
||||
|
||||
\pagebreak
|
||||
|
||||
\section{Appendix}
|
||||
\input{./TeX_files/Weibulls_Distribution}
|
||||
%\addcontentsline{toc}{part}{Appendix}
|
||||
%\appendix
|
||||
|
||||
%\printglossary[type=\acronymtype]
|
||||
|
||||
\printindex
|
||||
|
||||
\end{document}
|
193
Erasmus/Applied statistics/mathoperators.sty
Normal file
193
Erasmus/Applied statistics/mathoperators.sty
Normal file
|
@ -0,0 +1,193 @@
|
|||
\ProvidesPackage{mathoperators}
|
||||
|
||||
\RequirePackage{xparse}
|
||||
\RequirePackage{xkeyval}
|
||||
\RequirePackage{xstring}
|
||||
|
||||
%\OptFractionAppearence - differenciate between multiple appearences of fraction
|
||||
% - 0: simple slash: a/b (option slash)(default)
|
||||
% - 1: fraction by slash, raised nominator, lowered denominator (option lowerraise)
|
||||
\let\OptFractionAppearence\z@
|
||||
\DeclareOptionX{fractionappearence}{%
|
||||
\IfStrEq{#1}{slash}{}{%
|
||||
\IfStrEq{#1}{lowerraise}{%
|
||||
\let\OptFractionAppearence\@ne
|
||||
}{}%further options can be inserted here
|
||||
}
|
||||
}
|
||||
|
||||
\DeclareOptionX*{\PackageWarning{mathoperator}{Unknown option >\CurrentOption<}}
|
||||
\ProcessOptionsX
|
||||
|
||||
%Provides some common math related commands and operators
|
||||
\RequirePackage{amsmath}
|
||||
\RequirePackage{amssymb}
|
||||
\RequirePackage{amsfonts}
|
||||
\RequirePackage{scalerel,stackengine}
|
||||
\RequirePackage{calc}
|
||||
|
||||
%transpose
|
||||
\newcommand\transpose[1]{\ensuremath{#1^\mathsf{T}}}
|
||||
%new macro for "equals" ^=
|
||||
\newcommand\equalhat{\mathrel{\stackon[1.5pt]{=}{\stretchto{%
|
||||
\scalerel*[\widthof{=}]{\wedge}{\rule{1ex}{3ex}}}{0.5ex}}}}
|
||||
|
||||
%fraction with backslash
|
||||
\newcommand\bsfrac[2]{%
|
||||
\scalebox{-1}[1]{\nicefrac{\scalebox{-1}[1]{$#1$}}{\scalebox{-1}[1]{$#2$}}}%
|
||||
}
|
||||
|
||||
\DeclareRobustCommand{\properideal}{\mathrel{\text{$\m@th\proper@ideal$}}}
|
||||
\newcommand{\proper@ideal}{%
|
||||
\ooalign{$\lneq$\cr\raise.22ex\hbox{$\lhd$}\cr}%
|
||||
}
|
||||
|
||||
\DeclareRobustCommand{\properidealright}{\mathrel{\text{$\m@th\proper@idealright$}}}
|
||||
\newcommand{\proper@idealright}{%
|
||||
\ooalign{$\gneq$\cr\raise.22ex\hbox{$\rhd$}\cr}%
|
||||
}
|
||||
|
||||
%General newcommands!
|
||||
\newcommand{\comp}{\mathbb{C}} % complex set C
|
||||
\newcommand{\real}{\mathbb{R}} % real set R
|
||||
\newcommand{\whole}{\mathbb{Z}} % whole number Symbol
|
||||
\newcommand{\natur}{\mathbb{N}} % natural number Symbol
|
||||
\newcommand{\ratio}{\mathbb{Q}} % rational number symbol
|
||||
\newcommand{\field}{\mathbb{K}} % general field for the others above!
|
||||
\newcommand{\diff}{\mathrm{d}} % differential d
|
||||
\newcommand{\s}{\,\,} % space after the function in the intergral
|
||||
\newcommand{\cont}{\mathcal{C}} % Contour C
|
||||
\newcommand{\fuk}{f(z) \s\diff z} % f(z) dz
|
||||
\newcommand{\diffz}{\s\diff z}
|
||||
\newcommand{\subint}{\int\limits} % lower boundaries for the integral
|
||||
\newcommand{\poly}{\mathcal{P}} % special P - polygon
|
||||
\newcommand{\defi}{\mathcal{D}} % D for the domain of a function
|
||||
\newcommand{\cover}{\mathcal{U}} % cover for a set
|
||||
\newcommand{\setsys}{\mathcal{M}} % set system M
|
||||
\newcommand{\setnys}{\mathcal{N}} % set system N
|
||||
\newcommand{\zetafunk}{f(\zeta)\s\diff \zeta} %f(zeta) d zeta
|
||||
\newcommand{\ztfunk}{f(\zeta)} % f(zeta)
|
||||
\newcommand{\bocirc}{S_r(z)}
|
||||
\newcommand{\prop}{\,|\,}
|
||||
\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}} %tombstone
|
||||
\newcommand{\emptybra}{\{\varnothing\}} % empty set with set-bracket
|
||||
\newcommand{\realpos}{\real_{>0}}
|
||||
\newcommand{\realposr}{\real_{\geq0}}
|
||||
\newcommand{\naturpos}{\natur_{>0}}
|
||||
\newcommand{\Imag}{\operatorname{Im}} % Imaginary symbol
|
||||
\newcommand{\Realz}{\operatorname{Re}} % Real symbol
|
||||
\newcommand{\norm}{\Vert \cdot \Vert}
|
||||
\newcommand{\metric}{\vert \cdot \vert}
|
||||
\newcommand{\foralln}{\forall n} %all n
|
||||
\newcommand{\forallnset}{\forall n \in \natur} %all n € |N
|
||||
\newcommand{\forallnz}{\forall n \geq _0} % all n >= n_0
|
||||
\newcommand{\conjz}{\overline{z}} % conjugated z
|
||||
\newcommand{\tildz}{\tilde{z}} % different z
|
||||
\newcommand{\lproofar}{"`$ \Leftarrow $"'} % "`<="'
|
||||
\newcommand{\rproofar}{"`$ \Rightarrow $"'} % "`=>"'
|
||||
\newcommand{\beha}{\Rightarrow \text{ Behauptung}}
|
||||
\newcommand{\powerset}{\mathcal{P}}
|
||||
\newcommand{\person}[1]{\textsc{#1}}
|
||||
\newcommand{\highlight}[1]{\emph{#1}}
|
||||
\newcommand{\realz}{\mathfrak{Re}}
|
||||
\newcommand{\imagz}{\mathfrak{Im}}
|
||||
\renewcommand{\epsilon}{\varepsilon}
|
||||
\renewcommand{\phi}{\varphi}
|
||||
\newcommand{\lebesque}{\textsc{Lebesgue}}
|
||||
\renewcommand{\Re}{\mathfrak{Re}}
|
||||
\renewcommand{\Im}{\mathfrak{Im}}
|
||||
\renewcommand*{\arraystretch}{1.4}
|
||||
\newcommand{\bigcupdot}{\bigcup \hspace{-0.35cm} \cdot}
|
||||
\newcommand{\BIGboxplus}{\mathop{\mathchoice{\raise-0.35em\hbox{\huge $\boxplus$}}{\raise-0.15em\hbox{\Large $\boxplus$}}{\hbox{\large $\boxplus$}}{\boxplus}}}
|
||||
\newcommand{\eps}{\textit{eps }}
|
||||
|
||||
\newcommand{\skalar}[2]{\left\langle #1,#2\right\rangle}
|
||||
\newcommand{\qraum}[2]{\sfrac{#1}{#2}}
|
||||
\newcommand{\lnkset}[2]{%Menge der Linksnebenklassen
|
||||
\ifcase\OptFractionAppearence\relax%
|
||||
\ifmmode%
|
||||
#1\slash #2%
|
||||
\else%
|
||||
$#1\slash #2$%
|
||||
\fi%
|
||||
\or%
|
||||
\nicefrac{#1}{#2}%
|
||||
\else%
|
||||
\PackageWarning{mathoperator}{Unkown value for option >fractionAppearence<: \meaning\OptFractionAppearence}%
|
||||
\fi%
|
||||
}
|
||||
\newcommand{\rnkset}[2]{%
|
||||
\ifcase\OptFractionAppearence\relax%
|
||||
\ifmmode%
|
||||
#1\backslash#2%
|
||||
\else%
|
||||
$#1\backslash#2$%
|
||||
\fi%
|
||||
\or%
|
||||
\bsfrac{#1}{#2}% Menge der Rechtsnebenklassen
|
||||
\else%
|
||||
\PackageWarning{mathoperator}{Unkown value for option >fractionAppearence<: \meaning\OptFractionAppearence}%
|
||||
\fi%
|
||||
}
|
||||
|
||||
% Math Operators
|
||||
\DeclareMathOperator{\inn}{int} % Set of inner points
|
||||
\DeclareMathOperator{\ext}{ext} % Set of outer points
|
||||
\DeclareMathOperator{\cl}{cl} % Closure
|
||||
\DeclareMathOperator{\grad}{grad}
|
||||
\DeclareMathOperator{\D}{d}
|
||||
\DeclareMathOperator{\id}{id}
|
||||
\DeclareMathOperator{\graph}{graph}
|
||||
\DeclareMathOperator{\Int}{int}
|
||||
\DeclareMathOperator{\Ext}{ext}
|
||||
\DeclareMathOperator{\diam}{diam}
|
||||
\DeclareMathOperator{\supp}{supp}
|
||||
\DeclareMathOperator{\cond}{cond}
|
||||
\DeclareMathOperator{\rd}{rd}
|
||||
\undef\div
|
||||
\DeclareMathOperator{\div}{div}
|
||||
\DeclareMathOperator{\rot}{rot}
|
||||
|
||||
\DeclareMathOperator{\End}{End}
|
||||
\DeclareMathOperator{\Aff}{Aff}
|
||||
\DeclareMathOperator{\Aut}{Aut}
|
||||
\DeclareMathOperator{\Hom}{Hom}
|
||||
\DeclareMathOperator{\Abb}{Abb}
|
||||
\DeclareMathOperator{\Bil}{Bil}
|
||||
\DeclareMathOperator{\Eig}{Eig}
|
||||
\DeclareMathOperator{\Mat}{Mat}
|
||||
\DeclareMathOperator{\Ker}{Ker}
|
||||
\DeclareMathOperator{\diag}{diag}
|
||||
\DeclareMathOperator{\GL}{GL}
|
||||
\DeclareMathOperator{\tr}{tr}
|
||||
\DeclareMathOperator{\rk}{rk}
|
||||
\DeclareMathOperator{\ZR}{ZR}
|
||||
\DeclareMathOperator{\SR}{SR}
|
||||
\DeclareMathOperator{\sgn}{sgn}
|
||||
\DeclareMathOperator{\Span}{span}
|
||||
\DeclareMathOperator{\Image}{Im}
|
||||
\DeclareMathOperator{\Sym}{Sym}
|
||||
\DeclareMathOperator{\Hau}{Hau}
|
||||
\DeclareMathOperator{\pr}{pr}
|
||||
\DeclareMathOperator{\Orth}{O}
|
||||
\DeclareMathOperator{\SO}{SO}
|
||||
\DeclareMathOperator{\Uni}{U}
|
||||
\DeclareMathOperator{\SU}{SU}
|
||||
\DeclareMathOperator{\SL}{SL}
|
||||
\DeclareMathOperator{\ggT}{ggT}
|
||||
\DeclareMathOperator{\kgV}{kgV}
|
||||
\DeclareMathOperator{\rang}{rang}
|
||||
\DeclareMathOperator{\ord}{ord}
|
||||
\DeclareMathOperator{\Inn}{Inn}
|
||||
\DeclareMathOperator{\Z}{Z}
|
||||
\DeclareMathOperator{\UG}{UG}
|
||||
\DeclareMathOperator{\Fix}{Fix}
|
||||
\DeclareMathOperator{\Stab}{Stab}
|
||||
\DeclareMathOperator{\Syl}{Syl}
|
||||
\DeclareMathOperator{\Typ}{Typ}
|
||||
\DeclareMathOperator{\LC}{LC}
|
||||
\DeclareMathOperator{\Quot}{Quot}
|
||||
\DeclareMathOperator{\SE}{SE}
|
||||
\DeclareMathOperator{\PDF}{PDF}
|
||||
|
||||
\endinput
|
729
Erasmus/Applied statistics/mathscript.cls
Normal file
729
Erasmus/Applied statistics/mathscript.cls
Normal file
|
@ -0,0 +1,729 @@
|
|||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesClass{mathscript}[2018/08/05 mathscript]
|
||||
|
||||
%programming related packages
|
||||
\RequirePackage{zref-base}
|
||||
\RequirePackage{etoolbox}
|
||||
\RequirePackage{xparse}%better macros
|
||||
\RequirePackage{calc}
|
||||
\RequirePackage{xstring}
|
||||
\RequirePackage{xkeyval}
|
||||
|
||||
%possible values: firstnumber, firstname
|
||||
\def\theoremheader@order@val{firstnumber}
|
||||
\DeclareOptionX{order}{%
|
||||
%sets accordingly the required ntheoremoptions
|
||||
\let\tempa\@empty
|
||||
\IfEq{#1}{firstnumber}{\def\tempa{changebreak}}{%
|
||||
\IfEq{#1}{firstname}{\def\tempa{break}}{%
|
||||
\PackageWarning{mathscript}{Unknown Value for key `order'}
|
||||
}
|
||||
}
|
||||
\edef\theoremheader@order@val{\tempa}
|
||||
}
|
||||
|
||||
%possible values: all you can imagine.
|
||||
%usefull values: theorem-names defined in this class, new theorems defined by \newmdtheoremenv
|
||||
\listadd{\theorem@disable}{\@empty}
|
||||
\DeclareOptionX{disable}{%
|
||||
\listadd{\theorem@disable}{#1}
|
||||
}
|
||||
|
||||
\newif\ifreset@section@after@chapter
|
||||
\reset@section@after@chaptertrue
|
||||
\DeclareOptionX{sectionreset}{%
|
||||
\reset@section@after@chapterfalse
|
||||
}
|
||||
|
||||
\DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{report}}
|
||||
\ProcessOptionsX
|
||||
\LoadClass[ngerman,a4paper]{article}
|
||||
|
||||
\RequirePackage{ifpdf,ifluatex}
|
||||
|
||||
%decent space; change explicitly the space between header and content and footer and content
|
||||
\RequirePackage[left=2.1cm,right=3.1cm,bottom=3cm,footskip=0.75cm,headsep=0.5cm]{geometry}
|
||||
\RequirePackage{babel}
|
||||
|
||||
|
||||
\ifpdf
|
||||
\ifluatex
|
||||
%new lualatex needs explicit fontspec to draw properly e.g. german umlauts
|
||||
\RequirePackage{fontspec}
|
||||
%\RequirePackage{lua-visual-debug} %for debugging
|
||||
\else
|
||||
%old pdflatex needs explicitly utf-8-support
|
||||
\RequirePackage[utf8]{inputenc}
|
||||
\RequirePackage{chngcntr}
|
||||
\RequirePackage{eufrak}
|
||||
\fi
|
||||
\fi
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Layout related packages
|
||||
\RequirePackage{parskip} %split paragraphs by vspace instead of intendations
|
||||
\RequirePackage{fancyhdr} %customize header / footer
|
||||
\RequirePackage{titlesec} %customize titles
|
||||
\RequirePackage{tocloft} %customize toc
|
||||
|
||||
%tabulars
|
||||
\RequirePackage{tabularx} %tabularx-environment (explicitly set width of columns)
|
||||
\RequirePackage{longtable} %Tabellen mit Seitenumbrüchen
|
||||
\RequirePackage{multirow}
|
||||
\RequirePackage{booktabs} %improved rules
|
||||
\usepackage{colortbl} %einfärben von Spalten, Zeilen und Zellen
|
||||
|
||||
\RequirePackage[title,titletoc]{appendix}
|
||||
|
||||
\RequirePackage{environ}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Math related packages
|
||||
%basic ams-math and enhancments
|
||||
\RequirePackage{amsmath,amssymb,amsfonts,mathtools}
|
||||
\RequirePackage{blkarray}
|
||||
|
||||
%add some font-related stuff
|
||||
\RequirePackage{latexsym}
|
||||
\RequirePackage{marvosym} %lightning (contradiction)
|
||||
\RequirePackage{stmaryrd} %Lightning symbol
|
||||
\RequirePackage{bbm} %unitary matrix
|
||||
\RequirePackage{wasysym} %add some symbols
|
||||
\RequirePackage[bb=boondox]{mathalfa} %special zero using \mathbb{0}
|
||||
\RequirePackage{systeme}
|
||||
\usepackage{upgreek} %griechische Buchstaben, für mehr Auswahl bei phi's
|
||||
|
||||
%further support for different equation setting
|
||||
\RequirePackage{cancel}
|
||||
\RequirePackage{xfrac} %sfrac -> fractions e.g. 3/4
|
||||
\RequirePackage{nicefrac}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Graphics-related packages
|
||||
\RequirePackage[table,dvipsnames]{xcolor}
|
||||
\RequirePackage{graphicx}
|
||||
\RequirePackage{tcolorbox}
|
||||
|
||||
\RequirePackage{pgfplots}
|
||||
\pgfplotsset{compat=1.13}
|
||||
\usepgfplotslibrary{fillbetween}
|
||||
\RequirePackage{pgf}
|
||||
\RequirePackage{tikz}
|
||||
\usetikzlibrary{patterns,arrows,calc,decorations.pathmorphing,backgrounds, positioning,fit,petri,decorations.fractals}
|
||||
\usetikzlibrary{matrix}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Text-related packages
|
||||
%increase line spacing
|
||||
\RequirePackage[onehalfspacing]{setspace} %increase row-space
|
||||
\RequirePackage{ulem} %better underlines
|
||||
\RequirePackage{marginnote} %notes at the edge
|
||||
|
||||
%enumeration
|
||||
\RequirePackage{enumerate}
|
||||
\RequirePackage[inline]{enumitem} %customize label
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Pakete für Programmierung
|
||||
|
||||
\RequirePackage{lmodern}
|
||||
\RequirePackage{listings}
|
||||
|
||||
%Konfiguration dazu
|
||||
\definecolor{lightlightgray}{rgb}{0.95,0.95,0.95}
|
||||
\definecolor{lila}{rgb}{0.8,0,0.8}
|
||||
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
|
||||
\definecolor{mygreen}{rgb}{0,0.8,0.26}
|
||||
|
||||
\lstset{language=[95]Fortran,
|
||||
basicstyle=\ttfamily,
|
||||
keywordstyle=\color{lila},
|
||||
commentstyle=\color{lightgray},
|
||||
morecomment=[l]{!\ },% Comment only with space after !
|
||||
morekeywords={compute, solve, choose, break, switch},
|
||||
stringstyle=\color{mygreen}\ttfamily,
|
||||
backgroundcolor=\color{white},
|
||||
showstringspaces=false,
|
||||
numbers=left,
|
||||
numbersep=10pt,
|
||||
numberstyle=\color{mygray}\ttfamily,
|
||||
identifierstyle=\color{blue},
|
||||
xleftmargin=.2\textwidth,
|
||||
xrightmargin=.2\textwidth,
|
||||
escapechar=\%
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Index related packages
|
||||
\RequirePackage[texindy]{imakeidx}
|
||||
\indexsetup{
|
||||
level=\section*
|
||||
}
|
||||
\makeindex[intoc]
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Theorem-related packages
|
||||
\RequirePackage[amsmath,amsthm,thmmarks,hyperref]{ntheorem}
|
||||
\RequirePackage[ntheorem,framemethod=TikZ]{mdframed}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\RequirePackage[unicode,bookmarks=true]{hyperref}
|
||||
\hypersetup{
|
||||
colorlinks,
|
||||
citecolor=green,
|
||||
filecolor=green,
|
||||
linkcolor=blue,
|
||||
urlcolor=blue
|
||||
}
|
||||
\RequirePackage{cleveref}
|
||||
\RequirePackage{bookmark} %pdf-bookmarks
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% End Packages %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%tweak \newmdtheoremenv to create an empty environment if this very enviroment is disabled
|
||||
\RenewDocumentCommand{\newmdtheoremenv}{O{} m o m o}{%
|
||||
\ifinlist{#2}{\theorem@disable}{%
|
||||
\IfStrEq{#2}{theorem}{\newtheorem{#2}{}[section]}{\newtheorem{#2}{}[theorem]}
|
||||
\RenewEnviron{#2}{\stepcounter{theorem}}{}
|
||||
}{%
|
||||
%from mdframed.sty, definition of \newmdtheoremenv
|
||||
\ifboolexpr{ test {\IfNoValueTF {#3}} and test {\IfNoValueTF {#5}} }%
|
||||
{\newtheorem{#2}{#4}}{%
|
||||
\IfValueTF{#3}{\newtheorem{#2}[#3]{#4}}{}%
|
||||
\IfValueTF{#5}{\newtheorem{#2}{#4}[#5]}{}%
|
||||
}%
|
||||
\BeforeBeginEnvironment{#2}{%
|
||||
\begin{mdframed}[#1]}%
|
||||
\AfterEndEnvironment{#2}{%
|
||||
\end{mdframed}%
|
||||
}%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Setup theorem environments
|
||||
|
||||
%triangle symbol + length
|
||||
\newlength{\blacktrianglewidth}
|
||||
\settowidth{\blacktrianglewidth}{$\blacktriangleright$}
|
||||
|
||||
%colors
|
||||
\definecolor{lightgrey}{gray}{0.91}
|
||||
\definecolor{lightred}{rgb}{1,0.6,0.6}
|
||||
\definecolor{darkgrey}{gray}{0.6}
|
||||
\definecolor{darkgreen}{rgb}{0,0.6,0}
|
||||
|
||||
\mdfdefinestyle{boxedtheorem}{%
|
||||
outerlinewidth=3pt,%
|
||||
skipabove=5pt,%
|
||||
skipbelow=10pt,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
nobreak,%enforce no pagebrakes in the whole frame
|
||||
}
|
||||
|
||||
%numbered environments
|
||||
\theoremstyle{\theoremheader@order@val} %set by pacakge options above
|
||||
\theorembodyfont{}
|
||||
|
||||
%including background
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
innertopmargin=\topskip,%
|
||||
innerbottommargin=\topskip,%
|
||||
linecolor=darkgrey,%
|
||||
backgroundcolor=lightgrey,%
|
||||
]{theorem}{Theorem}[section]
|
||||
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
linecolor=darkgrey,%
|
||||
topline=false,%
|
||||
rightline=false,%
|
||||
bottomline=false,%
|
||||
innertopmargin=\topskip,%
|
||||
innerbottommargin=\topskip,%
|
||||
backgroundcolor=lightgrey,%
|
||||
]{proposition}[theorem]{Proposition}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
linecolor=darkgrey,%
|
||||
topline=false,%
|
||||
rightline=false,%
|
||||
bottomline=false,%
|
||||
backgroundcolor=lightgrey,%
|
||||
innertopmargin=\topskip,%
|
||||
innerbottommargin=\topskip,%
|
||||
]{lemma}[theorem]{Lemma}
|
||||
|
||||
%excluding background
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
linecolor=red,%
|
||||
topline=false,%
|
||||
rightline=false,%
|
||||
bottomline=false,%
|
||||
innertopmargin=0,%
|
||||
innerbottommargin=-3pt,%
|
||||
]{definition}[theorem]{Definition}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
outerlinewidth=3pt,%
|
||||
linecolor=black,%
|
||||
topline=false,%
|
||||
rightline=false,%
|
||||
bottomline=false,%
|
||||
innertopmargin=0pt,%
|
||||
innerbottommargin=-0pt,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
skipabove=5pt,%
|
||||
skipbelow=10pt,%
|
||||
]{conclusion}[theorem]{Conclusion}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
innerleftmargin=0pt,%
|
||||
skipabove=5pt,%
|
||||
innerleftmargin=10pt,%
|
||||
]{remark}[theorem]{\hspace*{-10pt}$\blacktriangleright$\hspace*{\dimexpr 10pt - \blacktrianglewidth\relax}Remark}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
innerleftmargin=0pt,%
|
||||
skipabove=5pt,%
|
||||
innerleftmargin=10pt,%
|
||||
]{erinnerung}[theorem]{\hspace*{-10pt}$\blacktriangleright$\hspace*{\dimexpr 10pt - \blacktrianglewidth\relax}Reminder}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
innerleftmargin=10pt,%
|
||||
skipabove=5pt,%
|
||||
]{example}[theorem]{\hspace*{-10pt}\rule{5pt}{5pt}\hspace*{5pt}Example}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
innerleftmargin=10pt,%
|
||||
skipabove=5pt,%
|
||||
]{algorithm}[theorem]{\hspace*{-10pt}\rule{5pt}{5pt}\hspace*{5pt}Algorithm}
|
||||
|
||||
%unnumbered theorems
|
||||
\theoremstyle{nonumberbreak}
|
||||
\theoremindent0cm
|
||||
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
linecolor=red,%
|
||||
topline=false,%
|
||||
rightline=false,%
|
||||
bottomline=false,%
|
||||
innertopmargin=1pt,%
|
||||
innerbottommargin=1pt,%
|
||||
]{*definition}{Definition}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
frametitlefont=\normalfont\bfseries\color{black},%
|
||||
skipabove=5pt,%
|
||||
innerleftmargin=10pt,%
|
||||
]{*remark}{\hspace*{-10pt}$\blacktriangleright$\hspace*{\dimexpr 10pt - \blacktrianglewidth\relax}Remark}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=10pt,%
|
||||
]{*example}{\hspace*{-10pt}\rule{5pt}{5pt}\hspace*{5pt}Example}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
hidealllines=true,%
|
||||
innertopmargin=\topskip,%
|
||||
innerbottommargin=\topskip,%
|
||||
backgroundcolor=lightgrey,%
|
||||
]{*anmerkung}{Annotation}
|
||||
|
||||
\newmdtheoremenv[%
|
||||
style=boxedtheorem,%
|
||||
hidealllines=true,%
|
||||
innertopmargin=\topskip,%
|
||||
innerbottommargin=\topskip,%
|
||||
backgroundcolor=lightgrey,%
|
||||
]{mathematica}{Mathematica/WolframAlpha-Befehle}
|
||||
|
||||
\newtheorem{overview}[theorem]{Overview}
|
||||
|
||||
\newmdtheoremenv[
|
||||
outerlinewidth=0.1pt,
|
||||
]{repetition}{Wiederholung}
|
||||
|
||||
%various unnumbered thereoms and environment (usually included in theorems like above)
|
||||
%To get rid of the parentheses, a new theorem style is neccessary (definition of nonumberbreak from ntheorem.sty)
|
||||
%to achieve the underlining, this needed to put in the theoremstyle definition
|
||||
\theoremheaderfont{\mdseries}
|
||||
\theoremseparator{:}
|
||||
\theorempostskip{0pt}
|
||||
|
||||
%define new theorem-styles
|
||||
\newtheoremstyle{noparentheses}%
|
||||
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
|
||||
\underline{##1}\theorem@separator}\hbox{\strut}}}]}%
|
||||
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
|
||||
\underline{##1\ ##3\theorem@separator}}\hbox{\strut}}}]}
|
||||
|
||||
\newtheoremstyle{underlinedPlain}%
|
||||
{\item[\hskip\labelsep \uline{\theorem@headerfont ##1\theorem@separator}]}%
|
||||
{\item[\hskip\labelsep \uline{\theorem@headerfont ##1\ \theorem@headerfont(##3)\theorem@separator}]}
|
||||
|
||||
\newtheoremstyle{plainEnvironment}{}%
|
||||
{\item[\hskip\labelsep {##1\theorem@headerfont ##3\theorem@separator}]}
|
||||
|
||||
\newtheoremstyle{underlinedEnvironment}{}%
|
||||
{\item[\hskip\labelsep \uline{##1\theorem@headerfont ##3\theorem@separator}]}
|
||||
|
||||
\newtheoremstyle{boldEnvironment}{}%
|
||||
{\item[\hskip\labelsep \textbf{##1\theorem@headerfont ##3\theorem@separator}]}
|
||||
|
||||
%theorems
|
||||
\theoremstyle{noparentheses}
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=1em,%
|
||||
innerbottommargin=0pt,%
|
||||
innerrightmargin=0,%
|
||||
skipbelow=0pt,%
|
||||
]{interpretation}{\hspace*{\dimexpr - \mdflength{innerleftmargin}\relax}Interpretation}
|
||||
|
||||
\theoremstyle{underlinedPlain}
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=1em,%
|
||||
innerrightmargin=0,%
|
||||
skipbelow=0pt,%
|
||||
]{hint}{\hspace*{\dimexpr - \mdflength{innerleftmargin}\relax}Hinweis}
|
||||
|
||||
\theoremstyle{plainEnvironment}
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=1em,%
|
||||
innerbottommargin=0pt,%
|
||||
innerrightmargin=0,%
|
||||
skipbelow=0pt,%
|
||||
]{plainenvironment}{\hspace*{\dimexpr -\mdflength{innerleftmargin}\relax}}
|
||||
|
||||
\theoremstyle{underlinedEnvironment}
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=1em,%
|
||||
innerrightmargin=0,%
|
||||
skipbelow=0pt,%
|
||||
]{underlinedenvironment}{\hspace*{\dimexpr -\mdflength{innerleftmargin}\relax}}
|
||||
|
||||
\theoremheaderfont{\bfseries}
|
||||
\theoremstyle{boldEnvironment}
|
||||
\newmdtheoremenv[%
|
||||
hidealllines=true,%
|
||||
innerleftmargin=1em,%
|
||||
innerrightmargin=0,%
|
||||
skipbelow=0pt,%
|
||||
]{boldenvironment}{\hspace*{\dimexpr -\mdflength{innerleftmargin}\relax}}
|
||||
|
||||
%proofs
|
||||
\newtheoremstyle{proofstyle}%
|
||||
{\item[\hskip\labelsep {\theorem@headerfont ##1}\theorem@separator]}%
|
||||
{\item[\hskip\labelsep {\theorem@headerfont ##1}\ (##3)\theorem@separator]}
|
||||
|
||||
\theoremstyle{proofstyle}
|
||||
\theoremheaderfont{\normalfont\normalsize\itshape}
|
||||
\theorembodyfont{\normalfont\small}
|
||||
\theoremseparator{.}
|
||||
\theorempreskip{5pt}
|
||||
\theorempostskip{5pt}
|
||||
\theoremsymbol{$\square$}
|
||||
|
||||
\ifinlist{proof}{\theorem@disable}{\RenewEnviron{proof}{}{}}{\renewtheorem{proof}{Proof}}
|
||||
|
||||
%cref: print correct translation
|
||||
\crefname{theorem}{Theorem}{Theorems}
|
||||
\crefname{proposition}{Proposition}{Propositions}
|
||||
\crefname{lemma}{Lemma}{Lemmas}
|
||||
\crefname{conclusion}{Conclusion}{Conclusions}
|
||||
\crefname{definition}{Definition}{Definitions}
|
||||
\crefname{remark}{Remark}{Remarks}
|
||||
\crefname{example}{Example}{Examples}
|
||||
\crefname{erinnerung}{Reminder}{Reminders}
|
||||
\crefname{algorithm}{Algorithm}{Algorithms}
|
||||
\crefname{*definition}{Definition}{Definitions}
|
||||
\crefname{*remark}{Remark}{Remarks}
|
||||
\crefname{*example}{Example}{Examples}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%Additional features
|
||||
|
||||
%some minor commands
|
||||
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@} %print integer in capital roman letters
|
||||
\newcommand{\leqnos}{\tagsleft@true\let\veqno\@@leqno} %set equation numbering left / right
|
||||
\newcommand{\reqnos}{\tagsleft@false\let\veqno\@@eqno}
|
||||
|
||||
%declare a new label; store current chapter number
|
||||
\newcommand*{\proplbl}[1]{%
|
||||
\@bsphack
|
||||
\begingroup
|
||||
\label{#1}%
|
||||
\zref@setcurrent{default}{\arabic{chapter}}%
|
||||
\zref@wrapper@immediate{%
|
||||
\zref@labelbyprops{#1@chapter}{default}%
|
||||
}
|
||||
\endgroup
|
||||
\@esphack
|
||||
}
|
||||
|
||||
%refer to a label set by proplbl.
|
||||
%If the label is not defined (yet), question marks are output at the calling position. If the label is defined, the chapter number is prepended to the link output by \cref if the current chapter number and the one set when calling \proplbl differ.
|
||||
%the macro handels both text and math mode. mbox is needed due to a feature concerning ulem / cleveref
|
||||
\newcommand*{\propref}[1]{%
|
||||
\ifcsdef{r@#1}%in first compilation the label may not be defined yet
|
||||
{%
|
||||
\zref@refused{#1@chapter}%
|
||||
\cref@gettype{#1}{\propositionref@current@type}%get the environment's name
|
||||
\ifnumcomp{\c@chapter}{=}{\zref@extractdefault{#1@chapter}{default}{\z@}}%
|
||||
{%same chapter
|
||||
\ifmmode
|
||||
\ref{#1}%
|
||||
\else
|
||||
\mbox{\cref{#1}}%
|
||||
\fi
|
||||
}%
|
||||
{%otherwise
|
||||
%example for following line:
|
||||
%\crefformat{truetheorem}{\cref@truetheorem@name~##2\rom{\zref@extractdefault{#1}{#1chapter}{1}}.##1##3}
|
||||
%this changes the format used by \cref to <environtment name> <chapter-number>.<section-number>.<theorem number>
|
||||
\crefformat{\propositionref@current@type}{%
|
||||
\csname cref@\propositionref@current@type @name\endcsname ~##2\rom{\zref@extractdefault{#1@chapter}{default}{\@ne}}.##1##3%
|
||||
}%
|
||||
\ifmmode
|
||||
\ref{#1}%
|
||||
\else
|
||||
\mbox{\cref{#1}}%
|
||||
\fi
|
||||
\crefformat{\propositionref@current@type}{%
|
||||
\csname cref@\propositionref@current@type @name\endcsname~##2##1##3%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
{\begingroup\ifmmode\else\bfseries\fi ???\endgroup}%similar to \ref\cref: question marks in case of undefined labels
|
||||
}
|
||||
|
||||
%declare new term to the index, output if no star is given to call position
|
||||
\NewDocumentCommand{\begriff}{s O{} m O{}}{%
|
||||
\index{#2#3#4}%
|
||||
\IfBooleanTF{#1}{}{\uline{#3}}%
|
||||
}
|
||||
|
||||
%append a new mathsymbol to the index, output if no star is given at the call position
|
||||
\NewDocumentCommand{\mathsymbol}{s O{} m m O{}}{%
|
||||
\IfBooleanTF{#1}%
|
||||
{\index[symbols]{#2#3@\detokenize{#4}#5}}%
|
||||
{#4\index[symbols]{#2#3@\detokenize{#4}#5}}%
|
||||
}
|
||||
|
||||
%remove skip before / after amsmath-environments: default to 0pt. 1star: just before the environment, 2stars: just after the environment, no star: both
|
||||
\NewDocumentCommand{\zeroAmsmathAlignVSpaces}{s s O{0 pt} O{0 pt}}{%
|
||||
\IfBooleanTF{#1}%
|
||||
{%
|
||||
\IfBooleanTF{#2}%
|
||||
{\setlength{\belowdisplayskip}{#4}}%
|
||||
{\setlength{\abovedisplayskip}{#3}}%
|
||||
}%
|
||||
{%
|
||||
\setlength{\abovedisplayskip}{#3}%
|
||||
\setlength{\belowdisplayskip}{#4}%
|
||||
}%
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\itemEq}{s m}{%
|
||||
\begingroup%
|
||||
\setlength{\abovedisplayskip}{\dimexpr -\parskip + 1pt\relax}%
|
||||
\setlength{\belowdisplayskip}{0pt}%
|
||||
\IfBooleanTF{#1}%
|
||||
{\parbox[c]{\linewidth}{\begin{flalign*}#2&&\end{flalign*}}}%}
|
||||
{\parbox[c]{\linewidth}{\begin{flalign}#2&&\end{flalign}}}%}
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
%macro that defines the spacing between bracket and content of a matrix
|
||||
\NewDocumentCommand{\matrixBracketSpacing}{}{\mspace{4.0mu plus 3.0mu minus 1.0mu}}
|
||||
%macro width customized spacing between bracktes / content, lineheight and columnwidth
|
||||
\newenvironment{henrysmatrix}{%
|
||||
\renewcommand*{\arraystretch}{1.2}
|
||||
\setlength\arraycolsep{5pt}
|
||||
\left(\matrixBracketSpacing
|
||||
\begin{matrix}
|
||||
}{%
|
||||
\end{matrix}
|
||||
\matrixBracketSpacing\right)
|
||||
}
|
||||
|
||||
%redefine \overline to customize the space between text / line (currently 0.4mm + height of the content)
|
||||
%ATTENTION: when changing the 0.4mm unfortunately, in \kringel the 0.4mm need to be changed accordingly
|
||||
\let\@old@overline\overline
|
||||
\renewcommand*{\overline}[1]{%
|
||||
\ifmmode
|
||||
\@old@overline{\raisebox{0pt}[\dimexpr\height+0.4mm\relax]{$#1$}}%
|
||||
\else
|
||||
\bar{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
%encircle some content. Arguments: border color (optional), background color (mandatory), content (mandatory)
|
||||
%two lengths to get width / height of content (important for width / height of the circle)
|
||||
\newlength{\@kringel@contentheight}
|
||||
\newlength{\@kringel@contentwidth}
|
||||
\newlength{\@kringel@depth}
|
||||
\NewDocumentCommand{\kringel}{O{blue} m m}{%
|
||||
%as the macro should work for both text and math mode, add some macros for later use to distinguish
|
||||
%in text mode, nothing happens (except discarding the 1st argument for the raisebox, that is permantently given), in math mode, the content needs to be enbraced by \ensuremath, the tcolorbox-environment by a raisebox
|
||||
%ATTENTION: when changing the height-factor of tcolorbox, the depth correction needs to be changed as well
|
||||
\let\@kringel@inner\relax
|
||||
\let\@kringel@outer\@secondoftwo
|
||||
\ifmmode
|
||||
\let\@kringel@inner\ensuremath
|
||||
\let\@kringel@outer\raisebox
|
||||
\fi
|
||||
%set the width and height
|
||||
\settoheight{\@kringel@contentheight}{\hbox{\@kringel@inner{#3}}}
|
||||
\settowidth{\@kringel@contentwidth}{\@kringel@inner{#3}}
|
||||
\settodepth{\@kringel@depth}{\@kringel@inner{#3}}
|
||||
%change the depth correction dependend whethere there is a depth (e.g. y) or not (e.g. a)
|
||||
\ifdim \@kringel@depth > 0pt%
|
||||
\setlength{\@kringel@depth}{\dimexpr\@kringel@depth+0.5mm\relax}
|
||||
\else
|
||||
\settodepth{\@kringel@depth}{y}
|
||||
\setlength{\@kringel@depth}{\dimexpr\@kringel@depth+0.3mm\relax}
|
||||
\fi
|
||||
%output the colorbox width given parameter: frame color, background color, computed width and height, and escaped content depending on math / text mode
|
||||
\@kringel@outer{\dimexpr-\@kringel@contentheight/2-\@kringel@depth\relax}{\begin{tcolorbox}[colframe=#1,halign=center,=center,width=\dimexpr1.5\@kringel@contentwidth+1mm\relax,height=2.5\@kringel@contentheight,left=0pt,right=0pt,bottom=0pt,top=0pt,boxrule=0.8pt,colback=#2,boxsep=0pt,bean arc]
|
||||
\@kringel@inner{#3}
|
||||
\end{tcolorbox}}
|
||||
}
|
||||
|
||||
%update ntheorem macro to provide space between theorem numbers and any optional comment, adds in upper roman letters the chapter number. removes any numbering for theorem environments with just one counter
|
||||
\renewcommand{\thm@@thmline@name}[5]{%-
|
||||
\def\thm@@thmline@name@tmp{%
|
||||
\if\relax\detokenize{#3}\relax\else%
|
||||
{\hspace*{2.2ex}#3}%
|
||||
\fi%
|
||||
}
|
||||
\let\thm@@thmline@name@numbering\relax
|
||||
\StrCount{#5}{.}[\thm@@thmline@name@dot@number]
|
||||
\ifnum\thm@@thmline@name@dot@number < 3%
|
||||
\def\thm@@thmline@name@tmp{\hspace*{-1em}#3}
|
||||
\else%
|
||||
\StrBetween[1,2]{#5}{.}{.}[\thm@@thmline@name@chap@num]%get the chapter number for roman transliteration
|
||||
\def\thm@@thmline@name@numbering{\rom{\thm@@thmline@name@chap@num}.#2}
|
||||
\fi
|
||||
\ifx\\#5\\%
|
||||
\@dottedtocline{-2}{0em}{4.4em}%
|
||||
{#1 \protect\numberline{\thm@@thmline@name@numbering:}{}}%
|
||||
{#4}
|
||||
\else
|
||||
\ifHy@linktocpage\relax\relax
|
||||
\@dottedtocline{-2}{0em}{1.3em}%
|
||||
{#1 \protect\numberline{\thm@@thmline@name@numbering:}\thm@@thmline@name@tmp}%
|
||||
{\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
|
||||
\else
|
||||
\@dottedtocline{-2}{0em}{4.em}%
|
||||
{#1 \protect\numberline{\thm@@thmline@name@numbering:}\thm@@thmline@name@tmp}%
|
||||
{\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
|
||||
%Settings
|
||||
|
||||
%disable brackets left for linear systems by systeme-package
|
||||
\sysdelim..
|
||||
|
||||
\pdfstringdefDisableCommands{%
|
||||
\def\\{}%
|
||||
\def\texttt#1{<#1>}%
|
||||
\def\mathbb#1{<#1>}%
|
||||
}
|
||||
\reqnos
|
||||
|
||||
%Headings
|
||||
%\titlelabel{\thetitle.\quad}%. behind section/sub... (3. instead of 3)
|
||||
%\counterwithout{section}{chapter}
|
||||
%\renewcommand{\thechapter}{\Roman{chapter}}
|
||||
%\renewcommand{\thepart}{\Alph{part}}
|
||||
%italic chapters (due to titlesec package some more stuff)
|
||||
%\titleformat{command}[shape]{format}{label}{sep}{before-code}[after-code]
|
||||
%\titleformat{\chapter}[display]{\bfseries}{\Large\chaptername\;\thechapter}{-5pt}{\huge\bfseries\itshape}
|
||||
%\titlespacing{\chapter}{0pt}{0pt}{10pt}
|
||||
%\titleformat{\section}[hang]{\bfseries\Large}{\thesection.}{8pt}{\Large\bfseries}
|
||||
%\titlespacing{command}{left}{before-sep}{after-sep}
|
||||
%\titlespacing{\subsection}{0pt}{0pt}{5pt}
|
||||
|
||||
%change appearence of heading of toc: 0 space above, bold, italic huge toc-heading
|
||||
%\renewcommand{\cftbeforetoctitleskip}{0pt}
|
||||
%\renewcommand{\cfttoctitlefont}{\itshape\Huge\bfseries}
|
||||
%change indentations due to width of capital roman numbers
|
||||
%\renewcommand{\cftchapnumwidth}{2.5em}
|
||||
%\renewcommand{\cftsecindent}{2.5em}
|
||||
%\renewcommand{\cftsubsecindent}{4.8em}
|
||||
|
||||
% Add new page-style (just footer), patch \chapter command to use this page style
|
||||
\fancypagestyle{plainChapter}{%
|
||||
\fancyhf{}%
|
||||
\fancyfoot[C]{\thepage}%
|
||||
\renewcommand{\headrulewidth}{0pt}% Line at the header invisible
|
||||
\renewcommand{\footrulewidth}{0.4pt}% Line at the footer visible
|
||||
}
|
||||
%changes pagestyle; instead of empty page the normal footer is printed
|
||||
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{plainChapter}}{}{}
|
||||
%usually, after a new chapter the section counter needs to be reset manually. Instead, automatic reset
|
||||
\ifreset@section@after@chapter
|
||||
\pretocmd{\chapter}{\setcounter{section}{0}}{}{}
|
||||
\fi
|
||||
|
||||
\pagestyle{fancy}
|
||||
\pagenumbering{arabic}
|
||||
%remember chapter-title in \leftmark and \rightmark
|
||||
\renewcommand{\chaptermark}[1]{%
|
||||
\markboth{\chaptername
|
||||
\ \thechapter:\ #1}{}}
|
||||
%remember section title in \leftmark
|
||||
\renewcommand{\sectionmark}[1]{%
|
||||
\markright{\thesection.\ #1}{}}
|
||||
|
||||
%remove page number from part{}-pages
|
||||
\let\sv@endpart\@endpart
|
||||
\def\@endpart{\thispagestyle{empty}\sv@endpart}
|
||||
|
||||
%change header:
|
||||
\renewcommand{\headrulewidth}{0.75pt}
|
||||
\renewcommand{\footrulewidth}{0.3pt}
|
||||
\lhead{\rightmark}%left: section-number. section-title
|
||||
\rhead{\leftmark}%right: chapter chapternumber: chapter-title
|
||||
|
||||
%change numbering of equations to be section by section
|
||||
\counterwithout{equation}{section}
|
||||
\pretocmd{\section}{\setcounter{equation}{0}}{}{}
|
||||
|
||||
%appendix:
|
||||
\let\old@appendix\appendix
|
||||
\def\appendix{%
|
||||
\old@appendix%
|
||||
\patchcmd{\chapter}{\thispagestyle{plainChapter}}{\thispagestyle{fancy}}{}{}%
|
||||
\renewcommand{\chaptername}{Anhang}%
|
||||
\renewcommand{\thesection}{\Alph{chapter}.\arabic{section}}%
|
||||
\titleformat{\chapter}[hang]{\bfseries}{\LARGE\chaptername\ \thechapter:}{0.5em}{\LARGE\bfseries}%
|
||||
\titlespacing{\chapter}{0pt}{-0.75cm}{0pt}%
|
||||
}
|
||||
|
||||
\endinput
|
Loading…
Add table
Reference in a new issue