idx
int64 1
56k
| question
stringlengths 15
155
| answer
stringlengths 2
29.2k
⌀ | question_cut
stringlengths 15
100
| answer_cut
stringlengths 2
200
⌀ | conversation
stringlengths 47
29.3k
| conversation_cut
stringlengths 47
301
|
|---|---|---|---|---|---|---|
6,301
|
Feature map for the Gaussian kernel
|
You can obtain the explicit equation of $\phi$ for the Gaussian kernel via the Tailor series expansion of $e^x$. For notational simplicity, assume $x\in \mathbb{R}^1$:
$$\phi(x) = e^{-x^2/2\sigma^2} \Big[ 1, \sqrt{\frac{1}{1!\sigma^2}}x,\sqrt{\frac{1}{2!\sigma^4}}x^2,\sqrt{\frac{1}{3!\sigma^6}}x^3,\ldots\Big]^T$$
This is also discussed in more detail in these slides by Chih-Jen Lin of NTU (slide 11 specifically). Note that in the slides $\gamma=\frac{1}{2\sigma^2}$ is used as kernel parameter.
The equation in the OP only holds for the linear kernel.
|
Feature map for the Gaussian kernel
|
You can obtain the explicit equation of $\phi$ for the Gaussian kernel via the Tailor series expansion of $e^x$. For notational simplicity, assume $x\in \mathbb{R}^1$:
$$\phi(x) = e^{-x^2/2\sigma^2} \
|
Feature map for the Gaussian kernel
You can obtain the explicit equation of $\phi$ for the Gaussian kernel via the Tailor series expansion of $e^x$. For notational simplicity, assume $x\in \mathbb{R}^1$:
$$\phi(x) = e^{-x^2/2\sigma^2} \Big[ 1, \sqrt{\frac{1}{1!\sigma^2}}x,\sqrt{\frac{1}{2!\sigma^4}}x^2,\sqrt{\frac{1}{3!\sigma^6}}x^3,\ldots\Big]^T$$
This is also discussed in more detail in these slides by Chih-Jen Lin of NTU (slide 11 specifically). Note that in the slides $\gamma=\frac{1}{2\sigma^2}$ is used as kernel parameter.
The equation in the OP only holds for the linear kernel.
|
Feature map for the Gaussian kernel
You can obtain the explicit equation of $\phi$ for the Gaussian kernel via the Tailor series expansion of $e^x$. For notational simplicity, assume $x\in \mathbb{R}^1$:
$$\phi(x) = e^{-x^2/2\sigma^2} \
|
6,302
|
Feature map for the Gaussian kernel
|
For any valid psd kernel $k : \mathcal X \times \mathcal X \to \mathbb R$, there exists a feature map $\varphi : \mathcal X \to \mathcal H$ such that $k(x, y) = \langle \varphi(x), \varphi(y) \rangle_{\mathcal H}$. The space $\mathcal H$ and embedding $\varphi$ in fact need not be unique, but there is an important unique $\mathcal H$ known as the reproducing kernel Hilbert space (RKHS).
The RKHS is discussed by: Steinwart, Hush and Scovel, An Explicit Description of the Reproducing Kernel Hilbert Spaces of Gaussian RBF Kernels, IEEE Transactions on Information Theory 2006 (doi, free citeseer pdf).
It's somewhat complicated, and they need to analyze it via the extension of the Gaussian kernel to complex inputs and outputs, but it boils down to this: define $e_n : \mathbb R \to \mathbb R$ as
$$
e_n(x) := \sqrt{\frac{(2 \sigma^2)^n}{n!}} x^n e^{-\sigma^2 x^2}
$$
and, for a tuple $\nu = (\nu_1, \cdots, \nu_d) \in \mathbb N_0^d$, its tensor product $e_\nu : \mathbb R^d \to \mathbb R$ as
$$
e_\nu(x) = e_{\nu_1}(x_1) \cdots e_{\nu_d}(x_d)
.$$
Then their Proposition 3.6 says that any function $f \in \mathcal H_\sigma$, the RKHS for a Gaussian kernel of bandwidth $\sigma > 0$, can be written as
$$
f(x)
= \sum_{\nu \in \mathbb N_0^d} b_\nu e_\nu(x)
\qquad
\lVert f \rVert_{\mathcal H_\sigma(X)}^2
= \sum_{\nu \in \mathbb N_0^d} b_\nu^2
.$$
We can think of $\mathcal H_\sigma$ as being essentially the space of square-summable coefficients $(b_\nu)_{\nu \in \mathbb N_0^d}$.
The question remains, though: what is the the sequence $b_\nu$ for the function $\phi(x)$? The paper doesn't seem to directly answer this question (unless I'm missing it as an obvious implication somewhere).
The do also give a more straightforward embedding into $L_2(\mathbb R^d)$, the Hilbert space of square-integrable functions from $\mathbb R^d \to \mathbb R$:
$$
\Phi(x) = \frac{(2 \sigma)^{\frac{d}{2}}}{\pi^{\frac{d}{4}}} e^{- 2 \sigma^2 \lVert x - \cdot \rVert_2^2}
.$$
Note that $\Phi(x)$ is itself a function from $\mathbb R^d$ to $\mathbb R$.
It's basically the density of a $d$-dimensional Gaussian with mean $x$ and covariance $\frac{1}{4 \sigma^2} I$; only the normalizing constant is different.
Thus when we take
$$\langle \Phi(x), \Phi(y) \rangle_{L_2}
= \int [\Phi(x)](t) \; [\Phi(y)](t) \,\mathrm d t
,$$
we're taking the product of Gaussian density functions, which is itself a certain constant times a Gaussian density functions. When you do that integral by $t$, then, the constant that falls out ends up being exactly $k(x, y)$.
These are not the only embeddings that work.
Another is based on the Fourier transform, which the celebrated paper of Rahimi and Recht (Random Features for Large-Scale Kernel Machines, NIPS 2007) approximates to great effect.
You can also do it using Taylor series: effectively the infinite version of Cotter, Keshet, and Srebro, Explicit Approximations of the Gaussian Kernel, arXiv:1109.4603.
|
Feature map for the Gaussian kernel
|
For any valid psd kernel $k : \mathcal X \times \mathcal X \to \mathbb R$, there exists a feature map $\varphi : \mathcal X \to \mathcal H$ such that $k(x, y) = \langle \varphi(x), \varphi(y) \rangle_
|
Feature map for the Gaussian kernel
For any valid psd kernel $k : \mathcal X \times \mathcal X \to \mathbb R$, there exists a feature map $\varphi : \mathcal X \to \mathcal H$ such that $k(x, y) = \langle \varphi(x), \varphi(y) \rangle_{\mathcal H}$. The space $\mathcal H$ and embedding $\varphi$ in fact need not be unique, but there is an important unique $\mathcal H$ known as the reproducing kernel Hilbert space (RKHS).
The RKHS is discussed by: Steinwart, Hush and Scovel, An Explicit Description of the Reproducing Kernel Hilbert Spaces of Gaussian RBF Kernels, IEEE Transactions on Information Theory 2006 (doi, free citeseer pdf).
It's somewhat complicated, and they need to analyze it via the extension of the Gaussian kernel to complex inputs and outputs, but it boils down to this: define $e_n : \mathbb R \to \mathbb R$ as
$$
e_n(x) := \sqrt{\frac{(2 \sigma^2)^n}{n!}} x^n e^{-\sigma^2 x^2}
$$
and, for a tuple $\nu = (\nu_1, \cdots, \nu_d) \in \mathbb N_0^d$, its tensor product $e_\nu : \mathbb R^d \to \mathbb R$ as
$$
e_\nu(x) = e_{\nu_1}(x_1) \cdots e_{\nu_d}(x_d)
.$$
Then their Proposition 3.6 says that any function $f \in \mathcal H_\sigma$, the RKHS for a Gaussian kernel of bandwidth $\sigma > 0$, can be written as
$$
f(x)
= \sum_{\nu \in \mathbb N_0^d} b_\nu e_\nu(x)
\qquad
\lVert f \rVert_{\mathcal H_\sigma(X)}^2
= \sum_{\nu \in \mathbb N_0^d} b_\nu^2
.$$
We can think of $\mathcal H_\sigma$ as being essentially the space of square-summable coefficients $(b_\nu)_{\nu \in \mathbb N_0^d}$.
The question remains, though: what is the the sequence $b_\nu$ for the function $\phi(x)$? The paper doesn't seem to directly answer this question (unless I'm missing it as an obvious implication somewhere).
The do also give a more straightforward embedding into $L_2(\mathbb R^d)$, the Hilbert space of square-integrable functions from $\mathbb R^d \to \mathbb R$:
$$
\Phi(x) = \frac{(2 \sigma)^{\frac{d}{2}}}{\pi^{\frac{d}{4}}} e^{- 2 \sigma^2 \lVert x - \cdot \rVert_2^2}
.$$
Note that $\Phi(x)$ is itself a function from $\mathbb R^d$ to $\mathbb R$.
It's basically the density of a $d$-dimensional Gaussian with mean $x$ and covariance $\frac{1}{4 \sigma^2} I$; only the normalizing constant is different.
Thus when we take
$$\langle \Phi(x), \Phi(y) \rangle_{L_2}
= \int [\Phi(x)](t) \; [\Phi(y)](t) \,\mathrm d t
,$$
we're taking the product of Gaussian density functions, which is itself a certain constant times a Gaussian density functions. When you do that integral by $t$, then, the constant that falls out ends up being exactly $k(x, y)$.
These are not the only embeddings that work.
Another is based on the Fourier transform, which the celebrated paper of Rahimi and Recht (Random Features for Large-Scale Kernel Machines, NIPS 2007) approximates to great effect.
You can also do it using Taylor series: effectively the infinite version of Cotter, Keshet, and Srebro, Explicit Approximations of the Gaussian Kernel, arXiv:1109.4603.
|
Feature map for the Gaussian kernel
For any valid psd kernel $k : \mathcal X \times \mathcal X \to \mathbb R$, there exists a feature map $\varphi : \mathcal X \to \mathcal H$ such that $k(x, y) = \langle \varphi(x), \varphi(y) \rangle_
|
6,303
|
Feature map for the Gaussian kernel
|
It seems to me that your second equation will only be true if $\phi$ is a linear mapping (and hence $K$ is a linear kernel). As the Gaussian kernel is non-linear, the equality will not hold (except perhaps in the limit as $\sigma$ goes to zero).
|
Feature map for the Gaussian kernel
|
It seems to me that your second equation will only be true if $\phi$ is a linear mapping (and hence $K$ is a linear kernel). As the Gaussian kernel is non-linear, the equality will not hold (except p
|
Feature map for the Gaussian kernel
It seems to me that your second equation will only be true if $\phi$ is a linear mapping (and hence $K$ is a linear kernel). As the Gaussian kernel is non-linear, the equality will not hold (except perhaps in the limit as $\sigma$ goes to zero).
|
Feature map for the Gaussian kernel
It seems to me that your second equation will only be true if $\phi$ is a linear mapping (and hence $K$ is a linear kernel). As the Gaussian kernel is non-linear, the equality will not hold (except p
|
6,304
|
Feature map for the Gaussian kernel
|
EXPLICIT EXPRESSION AND DERIVATION VIA DIRECT PROOF
The explicit expression for $\phi$ you are asking for is the following:
Lemma:
Given the Gaussian RBF Kernel $K_\sigma$ between two $n$-dimensional vectors ($x$ and another), for each $j$ from 0 to infinity and for every combination of $n$ indices (labeled as $k$) that add up to $j$, the feature vector $\phi(x)$ has a feature that looks like this:
$$
\phi_{\sigma, j, k}(x) = c_{\sigma, j}(x) \cdot f_{j, k}(x)
$$
Where:
$$
\begin{aligned}
c_{\sigma, j}(x) &= \frac{K_\sigma(x, 0)}{\sigma^j \sqrt{j!}}\\
f_{j, k}(x) &= \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{x_d^{k_d}}
\end{aligned}
$$
This can be directly derived as follows:
Definitions:
Gaussian RBF: https://en.wikipedia.org/wiki/Radial_basis_function
Taylor expansion of the exponential function: https://en.wikipedia.org/wiki/Exponential_function
Multinomial theorem: https://en.wikipedia.org/wiki/Multinomial_theorem
$$
\begin{aligned}
K_\sigma(x, y) = &e^{-\frac{\|x-y\|_2^2}{2\sigma^2}}\\
\epsilon := &e^{\frac{1}{\sigma^2}}\\
\epsilon^x = &\sum_{j=0}^{\infty}\left\{ \frac{x^j}{\sigma^{2j} \cdot j!} \right\}\\
(x_1 + x_2 + \dots + x_n)^j = &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix} \prod_{d=1}^n{x_d^{k_d}} \right\}\\
\end{aligned}
$$
Direct Proof:
First, we decompose the squared euclidean distance into its components, and perform the Taylor expansion for the $xy$ component:
$$
\begin{aligned}
K(x,y)= &e^{-\frac{\|x-y\|_2^2}{2\sigma^2}} =\epsilon^{\langle x, y \rangle} \cdot\epsilon^{-\frac{\|x\|_2^2}{2}} \cdot \epsilon^{-\frac{\|y\|_2^2}{2}}\\
= &\sum_{j=0}^{\infty}\left\{ \frac{\langle x, y \rangle^j}{\sigma^{2j} \cdot j!} \right\} \cdot\epsilon^{-\frac{\|x\|_2^2}{2}} \cdot \epsilon^{-\frac{\|y\|_2^2}{2}}
\end{aligned}
$$
For further convenience, we refactor the expression (using $c$ for more compact notation):
$$
\begin{aligned}
K(x,y) = &\sum_{j=0}^{\infty}\left\{\frac{\epsilon^{-\frac{\|x\|_2^2}{2}}}{\sigma^j \cdot \sqrt{j!}} \cdot \frac{\epsilon^{-\frac{\|y\|_2^2}{2}}}{\sigma^j \cdot \sqrt{j!}} \cdot \langle x, y \rangle^j \right\}\\
= &\sum_{j=0}^{\infty}\left\{ c_{\sigma, j}(x) \cdot c_{\sigma, j}(y) \cdot \langle x, y \rangle^j \right\}\\
\end{aligned}
$$
And with help of the multinomial theorem, we can express the power of the dot product as follows (using $f$ for more compact notation):
$$
\begin{aligned}
\langle x, y \rangle^j = &\left(\sum_{d=1}^n x_d y_d \right)^j\\
= &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix} \prod_{d=1}^n{(x_dy_d)^{k_d}} \right\}\\
= &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,\dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{x_d^{k_d}} \cdot
\begin{pmatrix} j\\k_1, \dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{y_d^{k_d}} \right\}\\
=: &\sum_{k_1+k_2+\dots+k_n=j}\left\{f_{j,k}(x) \cdot f_{j, k}(y) \right\}\\
\end{aligned}
$$
Now replacing in $K$ will allow us to end the proof:
$$
\begin{aligned}
K(x,y) = &\sum_{j=0}^{\infty}\left\{ c_{\sigma, j}(x) \cdot c_{\sigma, j}(y) \cdot \sum_{k_1+k_2+\dots+k_n=j}\left\{f_{j,k}(x) \cdot f_{j, k}(y) \right\} \right\}\\
= &\sum_{j=0}^{\infty} \sum_{k_1+k_2+\dots+k_n=j}\left\{ c_{\sigma, j}(x) f_{j,k}(x) \cdot c_{\sigma, j}(y) f_{j, k}(y) \right\}\\
= &\langle \phi(x), \phi(y) \rangle\\
&\square
\end{aligned}
$$
Where each $\phi$ is a vector with one entry for every combination of $n$ indices (labeled as $k$) that add up to $j$, and this for each $j$ from 0 to infinity.
hope this helps! Cheers,
Andres
|
Feature map for the Gaussian kernel
|
EXPLICIT EXPRESSION AND DERIVATION VIA DIRECT PROOF
The explicit expression for $\phi$ you are asking for is the following:
Lemma:
Given the Gaussian RBF Kernel $K_\sigma$ between two $n$-dimensional
|
Feature map for the Gaussian kernel
EXPLICIT EXPRESSION AND DERIVATION VIA DIRECT PROOF
The explicit expression for $\phi$ you are asking for is the following:
Lemma:
Given the Gaussian RBF Kernel $K_\sigma$ between two $n$-dimensional vectors ($x$ and another), for each $j$ from 0 to infinity and for every combination of $n$ indices (labeled as $k$) that add up to $j$, the feature vector $\phi(x)$ has a feature that looks like this:
$$
\phi_{\sigma, j, k}(x) = c_{\sigma, j}(x) \cdot f_{j, k}(x)
$$
Where:
$$
\begin{aligned}
c_{\sigma, j}(x) &= \frac{K_\sigma(x, 0)}{\sigma^j \sqrt{j!}}\\
f_{j, k}(x) &= \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{x_d^{k_d}}
\end{aligned}
$$
This can be directly derived as follows:
Definitions:
Gaussian RBF: https://en.wikipedia.org/wiki/Radial_basis_function
Taylor expansion of the exponential function: https://en.wikipedia.org/wiki/Exponential_function
Multinomial theorem: https://en.wikipedia.org/wiki/Multinomial_theorem
$$
\begin{aligned}
K_\sigma(x, y) = &e^{-\frac{\|x-y\|_2^2}{2\sigma^2}}\\
\epsilon := &e^{\frac{1}{\sigma^2}}\\
\epsilon^x = &\sum_{j=0}^{\infty}\left\{ \frac{x^j}{\sigma^{2j} \cdot j!} \right\}\\
(x_1 + x_2 + \dots + x_n)^j = &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix} \prod_{d=1}^n{x_d^{k_d}} \right\}\\
\end{aligned}
$$
Direct Proof:
First, we decompose the squared euclidean distance into its components, and perform the Taylor expansion for the $xy$ component:
$$
\begin{aligned}
K(x,y)= &e^{-\frac{\|x-y\|_2^2}{2\sigma^2}} =\epsilon^{\langle x, y \rangle} \cdot\epsilon^{-\frac{\|x\|_2^2}{2}} \cdot \epsilon^{-\frac{\|y\|_2^2}{2}}\\
= &\sum_{j=0}^{\infty}\left\{ \frac{\langle x, y \rangle^j}{\sigma^{2j} \cdot j!} \right\} \cdot\epsilon^{-\frac{\|x\|_2^2}{2}} \cdot \epsilon^{-\frac{\|y\|_2^2}{2}}
\end{aligned}
$$
For further convenience, we refactor the expression (using $c$ for more compact notation):
$$
\begin{aligned}
K(x,y) = &\sum_{j=0}^{\infty}\left\{\frac{\epsilon^{-\frac{\|x\|_2^2}{2}}}{\sigma^j \cdot \sqrt{j!}} \cdot \frac{\epsilon^{-\frac{\|y\|_2^2}{2}}}{\sigma^j \cdot \sqrt{j!}} \cdot \langle x, y \rangle^j \right\}\\
= &\sum_{j=0}^{\infty}\left\{ c_{\sigma, j}(x) \cdot c_{\sigma, j}(y) \cdot \langle x, y \rangle^j \right\}\\
\end{aligned}
$$
And with help of the multinomial theorem, we can express the power of the dot product as follows (using $f$ for more compact notation):
$$
\begin{aligned}
\langle x, y \rangle^j = &\left(\sum_{d=1}^n x_d y_d \right)^j\\
= &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,k_2, \dots, k_n \end{pmatrix} \prod_{d=1}^n{(x_dy_d)^{k_d}} \right\}\\
= &\sum_{k_1+k_2+\dots+k_n=j}\left\{ \begin{pmatrix} j\\k_1,\dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{x_d^{k_d}} \cdot
\begin{pmatrix} j\\k_1, \dots, k_n \end{pmatrix}^{\frac{1}{2}} \prod_{d=1}^n{y_d^{k_d}} \right\}\\
=: &\sum_{k_1+k_2+\dots+k_n=j}\left\{f_{j,k}(x) \cdot f_{j, k}(y) \right\}\\
\end{aligned}
$$
Now replacing in $K$ will allow us to end the proof:
$$
\begin{aligned}
K(x,y) = &\sum_{j=0}^{\infty}\left\{ c_{\sigma, j}(x) \cdot c_{\sigma, j}(y) \cdot \sum_{k_1+k_2+\dots+k_n=j}\left\{f_{j,k}(x) \cdot f_{j, k}(y) \right\} \right\}\\
= &\sum_{j=0}^{\infty} \sum_{k_1+k_2+\dots+k_n=j}\left\{ c_{\sigma, j}(x) f_{j,k}(x) \cdot c_{\sigma, j}(y) f_{j, k}(y) \right\}\\
= &\langle \phi(x), \phi(y) \rangle\\
&\square
\end{aligned}
$$
Where each $\phi$ is a vector with one entry for every combination of $n$ indices (labeled as $k$) that add up to $j$, and this for each $j$ from 0 to infinity.
hope this helps! Cheers,
Andres
|
Feature map for the Gaussian kernel
EXPLICIT EXPRESSION AND DERIVATION VIA DIRECT PROOF
The explicit expression for $\phi$ you are asking for is the following:
Lemma:
Given the Gaussian RBF Kernel $K_\sigma$ between two $n$-dimensional
|
6,305
|
What exactly is the difference between a parametric and non-parametric model?
|
In a parametric model, the number of parameters is fixed with respect to the sample size. In a nonparametric model, the (effective) number of parameters can grow with the sample size.
In an OLS regression, the number of parameters will always be the length of $\beta$, plus one for the variance.
A neural net with fixed architecture and no weight decay would be a parametric model.
But if you have weight decay, then the value of the decay parameter selected by cross-validation will generally get smaller with more data. This can be interpreted as an increase in the effective number of parameters with increasing sample size.
|
What exactly is the difference between a parametric and non-parametric model?
|
In a parametric model, the number of parameters is fixed with respect to the sample size. In a nonparametric model, the (effective) number of parameters can grow with the sample size.
In an OLS reg
|
What exactly is the difference between a parametric and non-parametric model?
In a parametric model, the number of parameters is fixed with respect to the sample size. In a nonparametric model, the (effective) number of parameters can grow with the sample size.
In an OLS regression, the number of parameters will always be the length of $\beta$, plus one for the variance.
A neural net with fixed architecture and no weight decay would be a parametric model.
But if you have weight decay, then the value of the decay parameter selected by cross-validation will generally get smaller with more data. This can be interpreted as an increase in the effective number of parameters with increasing sample size.
|
What exactly is the difference between a parametric and non-parametric model?
In a parametric model, the number of parameters is fixed with respect to the sample size. In a nonparametric model, the (effective) number of parameters can grow with the sample size.
In an OLS reg
|
6,306
|
What exactly is the difference between a parametric and non-parametric model?
|
I think that the word "effective" in the accepted answer should be deleted. Because due to the different number of effective parameters, as Aksakal pointed out, the accepted answer implies that Ridge and Lasso are non-parametric, but it doesn't seem to be true. Effective parameters (effective degrees of freedom) are characteristics of a learning algorithm, but not a model itself.
In a machine learning problem we have three things:
Data generation model. It describes our assumptions about the probabilistic distribution that generated our data. From mathematical statistics we know that data generation model can be parametric or non-parametric. As Glen_b pointed out, in parametric data generation model this distribution is defined by a fixed number of parameters. In nonparametric data generation model we don't have a distribution with a fixed number of parameters, we have milder assumptions about it, like continuity or symmetry.
Algorithm (hypothesis). It is a function $h: \mathcal{X} \to \mathcal{Y}$ from some hypothesis space $\mathcal{H}$. This function tries to predict the true target value on any sample $x$. Hypothesis space (model) can be parametric or non-parametric.
In parametric hypothesis space (parametric model) every algorithm is uniquely defined by a fixed number of parameters (this number is the same for all algorithms from this space). Simple examples of parametric models are linear regression model: $\mathcal{H} = \{h(x;w,b) = \langle w, x \rangle + b \mid w \in \mathbb{R}^d, b \in \mathbb{R} \}$
and linear (binary) classification model: $\mathcal{H} = \{h(x; w,b) = \mathrm{sign}(\langle w, x \rangle + b) \mid w \in \mathbb{R}^d, b \in \mathbb{R}\}$.
In non-parametric models we can't describe every algorithm with the vector of parameters of the same constant size for all algorithms. Usually the number of parameters grows with the size of a training set. For example in the case of decision trees $\mathcal{H} = \{T(x; \Theta) \mid \Theta\}$, where $\Theta = \{J, \, \{R_j, \gamma_j\}_{j=1}^J\}$ is a vector of tree's parameters: $J$ is a number of terminal nodes in the tree, $R_j$ are subregions of the input space $\mathcal{X}$ corresponding to these nodes, and $\gamma_j$ are the predictions in these nodes. Trees can have different number of leaves and different number of internal nodes, so the space of decision trees is non-parametric (dimension of $\Theta$ will be different for different trees, if we train them on the datasets generated from the same distribution, that is, with the same number of features $d$, but with different number of observations in each dataset).
Method (learning algorithm). We can formalize it as a function $\mu: D \to \mathcal{H}$. It uses training set $D$ to fit some hypothesis $h \in \mathcal{H}$. If $\mathcal{H}$ is parametric we call $\mu$ parametric method. If $\mathcal{H}$ is non-parametric we call $\mu$ non-parametric method. For example, OLS, Ridge and Lasso are all parametric methods because they all use exactly the same parametric model $\mathcal{H} = \{h(x;w,b) = \langle w, x \rangle + b \mid w \in \mathbb{R}^d, b \in \mathbb{R} \}$ (as I said above, we call it "linear regression model"). Despite the fact that these methods have different number of effective parameters.
Keep in mind, that we can use parametric data generation model and non-parametric learning algorithm (or vice-versa). For example, we can have gaussian data generation model $Y = f(X) + \varepsilon$, where $\varepsilon \in \mathcal{N}(0, \sigma^2)$. Obviously, this is a parametric data generation model. But we can always fit non-parametric method (for example, kNN regression) on the training set $D$, generated by this model.
Similarly, we can fit parametric OLS method without any parametric assumptions about data generation process. In this case this method simply will not be equivalent to Maximum Likelihood Estimation.
There is a useful list of parametric and non-parametric methods from Murphy's MLaPP book:
Note that non-linear SVM (it is listed in the table) is a non-parametric method, whereas linear SVM (it is not listed in the table) is a parametric method because it fits linear classification model (linear classifier).
|
What exactly is the difference between a parametric and non-parametric model?
|
I think that the word "effective" in the accepted answer should be deleted. Because due to the different number of effective parameters, as Aksakal pointed out, the accepted answer implies that Ridge
|
What exactly is the difference between a parametric and non-parametric model?
I think that the word "effective" in the accepted answer should be deleted. Because due to the different number of effective parameters, as Aksakal pointed out, the accepted answer implies that Ridge and Lasso are non-parametric, but it doesn't seem to be true. Effective parameters (effective degrees of freedom) are characteristics of a learning algorithm, but not a model itself.
In a machine learning problem we have three things:
Data generation model. It describes our assumptions about the probabilistic distribution that generated our data. From mathematical statistics we know that data generation model can be parametric or non-parametric. As Glen_b pointed out, in parametric data generation model this distribution is defined by a fixed number of parameters. In nonparametric data generation model we don't have a distribution with a fixed number of parameters, we have milder assumptions about it, like continuity or symmetry.
Algorithm (hypothesis). It is a function $h: \mathcal{X} \to \mathcal{Y}$ from some hypothesis space $\mathcal{H}$. This function tries to predict the true target value on any sample $x$. Hypothesis space (model) can be parametric or non-parametric.
In parametric hypothesis space (parametric model) every algorithm is uniquely defined by a fixed number of parameters (this number is the same for all algorithms from this space). Simple examples of parametric models are linear regression model: $\mathcal{H} = \{h(x;w,b) = \langle w, x \rangle + b \mid w \in \mathbb{R}^d, b \in \mathbb{R} \}$
and linear (binary) classification model: $\mathcal{H} = \{h(x; w,b) = \mathrm{sign}(\langle w, x \rangle + b) \mid w \in \mathbb{R}^d, b \in \mathbb{R}\}$.
In non-parametric models we can't describe every algorithm with the vector of parameters of the same constant size for all algorithms. Usually the number of parameters grows with the size of a training set. For example in the case of decision trees $\mathcal{H} = \{T(x; \Theta) \mid \Theta\}$, where $\Theta = \{J, \, \{R_j, \gamma_j\}_{j=1}^J\}$ is a vector of tree's parameters: $J$ is a number of terminal nodes in the tree, $R_j$ are subregions of the input space $\mathcal{X}$ corresponding to these nodes, and $\gamma_j$ are the predictions in these nodes. Trees can have different number of leaves and different number of internal nodes, so the space of decision trees is non-parametric (dimension of $\Theta$ will be different for different trees, if we train them on the datasets generated from the same distribution, that is, with the same number of features $d$, but with different number of observations in each dataset).
Method (learning algorithm). We can formalize it as a function $\mu: D \to \mathcal{H}$. It uses training set $D$ to fit some hypothesis $h \in \mathcal{H}$. If $\mathcal{H}$ is parametric we call $\mu$ parametric method. If $\mathcal{H}$ is non-parametric we call $\mu$ non-parametric method. For example, OLS, Ridge and Lasso are all parametric methods because they all use exactly the same parametric model $\mathcal{H} = \{h(x;w,b) = \langle w, x \rangle + b \mid w \in \mathbb{R}^d, b \in \mathbb{R} \}$ (as I said above, we call it "linear regression model"). Despite the fact that these methods have different number of effective parameters.
Keep in mind, that we can use parametric data generation model and non-parametric learning algorithm (or vice-versa). For example, we can have gaussian data generation model $Y = f(X) + \varepsilon$, where $\varepsilon \in \mathcal{N}(0, \sigma^2)$. Obviously, this is a parametric data generation model. But we can always fit non-parametric method (for example, kNN regression) on the training set $D$, generated by this model.
Similarly, we can fit parametric OLS method without any parametric assumptions about data generation process. In this case this method simply will not be equivalent to Maximum Likelihood Estimation.
There is a useful list of parametric and non-parametric methods from Murphy's MLaPP book:
Note that non-linear SVM (it is listed in the table) is a non-parametric method, whereas linear SVM (it is not listed in the table) is a parametric method because it fits linear classification model (linear classifier).
|
What exactly is the difference between a parametric and non-parametric model?
I think that the word "effective" in the accepted answer should be deleted. Because due to the different number of effective parameters, as Aksakal pointed out, the accepted answer implies that Ridge
|
6,307
|
What exactly is the difference between a parametric and non-parametric model?
|
I think if the model is defined as a set of equations (can be a system of concurrent equations or a single one), and we learn its parameters, then is parametric. That includes differential equations, and even Navier-Stokes' equation. Models defined descriptively, regardless of how they are solved, fall into the category of nonparametric. Thus, OLS would be parametric, and even quantile regression, though belongs in the domain of nonparametric statistics, is a parametric model.
On the other hand, when we use SEM (structural equation modeling) to identify the model, it would be a nonparametric model - until we have solved the SEM. PCA would be parametric, because the equations are well defined, but CCA can be nonparametric, because we are looking for correlations across all variables, and if these are Spearman's correlations, we have a nonparametric model. With Pearson's correlations, we imply a parametric (linear) model. I think clustering algorithms would be nonparametric, unless we are looking for clusters of certain shape.
And then we have the nonparametric regression, which is nonparametric, and LOESS regression, which is parametric, but serves the same purpose: we define the equation and the window.
|
What exactly is the difference between a parametric and non-parametric model?
|
I think if the model is defined as a set of equations (can be a system of concurrent equations or a single one), and we learn its parameters, then is parametric. That includes differential equations,
|
What exactly is the difference between a parametric and non-parametric model?
I think if the model is defined as a set of equations (can be a system of concurrent equations or a single one), and we learn its parameters, then is parametric. That includes differential equations, and even Navier-Stokes' equation. Models defined descriptively, regardless of how they are solved, fall into the category of nonparametric. Thus, OLS would be parametric, and even quantile regression, though belongs in the domain of nonparametric statistics, is a parametric model.
On the other hand, when we use SEM (structural equation modeling) to identify the model, it would be a nonparametric model - until we have solved the SEM. PCA would be parametric, because the equations are well defined, but CCA can be nonparametric, because we are looking for correlations across all variables, and if these are Spearman's correlations, we have a nonparametric model. With Pearson's correlations, we imply a parametric (linear) model. I think clustering algorithms would be nonparametric, unless we are looking for clusters of certain shape.
And then we have the nonparametric regression, which is nonparametric, and LOESS regression, which is parametric, but serves the same purpose: we define the equation and the window.
|
What exactly is the difference between a parametric and non-parametric model?
I think if the model is defined as a set of equations (can be a system of concurrent equations or a single one), and we learn its parameters, then is parametric. That includes differential equations,
|
6,308
|
What exactly is the difference between a parametric and non-parametric model?
|
Parametric model: assumes that the population can be adequately modeled by a probability distribution that has a fixed set of parameters.
Non-parametric model: makes no assumptions about some probability distribution when modeling the data.
|
What exactly is the difference between a parametric and non-parametric model?
|
Parametric model: assumes that the population can be adequately modeled by a probability distribution that has a fixed set of parameters.
Non-parametric model: makes no assumptions about some probabil
|
What exactly is the difference between a parametric and non-parametric model?
Parametric model: assumes that the population can be adequately modeled by a probability distribution that has a fixed set of parameters.
Non-parametric model: makes no assumptions about some probability distribution when modeling the data.
|
What exactly is the difference between a parametric and non-parametric model?
Parametric model: assumes that the population can be adequately modeled by a probability distribution that has a fixed set of parameters.
Non-parametric model: makes no assumptions about some probabil
|
6,309
|
Random number-Set.seed(N) in R [duplicate]
|
The seed number you choose is the starting point used in the generation of a sequence of random numbers, which is why (provided you use the same pseudo-random number generator) you'll obtain the same results given the same seed number. As far as your second question is concerned, this short snippet from the description of the equivalent functionality in Stata might be helpful:
We cannot emphasize this enough: Do not set the seed too often. To see
why this is such a bad idea, consider the limiting case: You set the
seed, draw one pseudorandom number, reset the seed, draw again, and so
continue. The pseudorandom numbers you obtain will be nothing more
than the seeds you run through a mathematical function. The results
you obtain will not pass for random unless the seeds you choose pass
for random. If you already had such numbers, why are you even
bothering to use the pseudorandom-number generator?
http://www.stata.com/manuals13/rsetseed.pdf
|
Random number-Set.seed(N) in R [duplicate]
|
The seed number you choose is the starting point used in the generation of a sequence of random numbers, which is why (provided you use the same pseudo-random number generator) you'll obtain the same
|
Random number-Set.seed(N) in R [duplicate]
The seed number you choose is the starting point used in the generation of a sequence of random numbers, which is why (provided you use the same pseudo-random number generator) you'll obtain the same results given the same seed number. As far as your second question is concerned, this short snippet from the description of the equivalent functionality in Stata might be helpful:
We cannot emphasize this enough: Do not set the seed too often. To see
why this is such a bad idea, consider the limiting case: You set the
seed, draw one pseudorandom number, reset the seed, draw again, and so
continue. The pseudorandom numbers you obtain will be nothing more
than the seeds you run through a mathematical function. The results
you obtain will not pass for random unless the seeds you choose pass
for random. If you already had such numbers, why are you even
bothering to use the pseudorandom-number generator?
http://www.stata.com/manuals13/rsetseed.pdf
|
Random number-Set.seed(N) in R [duplicate]
The seed number you choose is the starting point used in the generation of a sequence of random numbers, which is why (provided you use the same pseudo-random number generator) you'll obtain the same
|
6,310
|
Random number-Set.seed(N) in R [duplicate]
|
In short, the numbers themselves don't really mean anything! If you are looking at someone else's code (like in the two examples you gave above), the numbers don't alter the functionality of the function; neither are there "good" numbers for specific functions. It's just down to the authors' choice.
Further, if you are only ever setting the seed once in your code, then you can kind of choose any number you like. The only thing you need to be a bit careful of is that, if you interface with any other functions that also use random numbers, then it's good to choose a non-obvious seed (so it's less likely for you both to use the same seed).
However, as Corcovado really nicely points out, for some applications, you need to be really careful about the choice you make. If mathematically you require a number of pseudo-randomly-generated numbers, then there can't be a pattern to the numbers you choose.
|
Random number-Set.seed(N) in R [duplicate]
|
In short, the numbers themselves don't really mean anything! If you are looking at someone else's code (like in the two examples you gave above), the numbers don't alter the functionality of the funct
|
Random number-Set.seed(N) in R [duplicate]
In short, the numbers themselves don't really mean anything! If you are looking at someone else's code (like in the two examples you gave above), the numbers don't alter the functionality of the function; neither are there "good" numbers for specific functions. It's just down to the authors' choice.
Further, if you are only ever setting the seed once in your code, then you can kind of choose any number you like. The only thing you need to be a bit careful of is that, if you interface with any other functions that also use random numbers, then it's good to choose a non-obvious seed (so it's less likely for you both to use the same seed).
However, as Corcovado really nicely points out, for some applications, you need to be really careful about the choice you make. If mathematically you require a number of pseudo-randomly-generated numbers, then there can't be a pattern to the numbers you choose.
|
Random number-Set.seed(N) in R [duplicate]
In short, the numbers themselves don't really mean anything! If you are looking at someone else's code (like in the two examples you gave above), the numbers don't alter the functionality of the funct
|
6,311
|
Random number-Set.seed(N) in R [duplicate]
|
The set.seed()function in R takes an (arbitrary) integer argument. So we can take any argument, say, 1 or 123 or 300 or 12345 to get the reproducible random numbers.
Also, in theTeachingDemos package, the char2seed function allows user to set the seed based on a character string.
|
Random number-Set.seed(N) in R [duplicate]
|
The set.seed()function in R takes an (arbitrary) integer argument. So we can take any argument, say, 1 or 123 or 300 or 12345 to get the reproducible random numbers.
Also, in theTeachingDemos package
|
Random number-Set.seed(N) in R [duplicate]
The set.seed()function in R takes an (arbitrary) integer argument. So we can take any argument, say, 1 or 123 or 300 or 12345 to get the reproducible random numbers.
Also, in theTeachingDemos package, the char2seed function allows user to set the seed based on a character string.
|
Random number-Set.seed(N) in R [duplicate]
The set.seed()function in R takes an (arbitrary) integer argument. So we can take any argument, say, 1 or 123 or 300 or 12345 to get the reproducible random numbers.
Also, in theTeachingDemos package
|
6,312
|
What are the advantages of stacking multiple LSTMs?
|
I think that you are referring to vertically stacked LSTM layers (assuming the horizontal axes is the time axis.
In that case the main reason for stacking LSTM is to allow for greater model complexity. In case of a simple feedforward net we stack layers to create a hierarchical feature representation of the input data to then use for some machine learning task. The same applies for stacked LSTM's.
At every time step an LSTM, besides the recurrent input. If the input is already the result from an LSTM layer (or a feedforward layer) then the current LSTM can create a more complex feature representation of the current input.
Now the difference between having a feedforward layer between the feature input and the LSTM layer and having another LSTM layer is that a feed forward layer (say a fully connected layer) does not receive feedback from its previous time step and thus can not account for certain patterns. Having an LSTM in stead (e.g. using a stacked LSTM representation) more complex input patterns can be described at every layer
|
What are the advantages of stacking multiple LSTMs?
|
I think that you are referring to vertically stacked LSTM layers (assuming the horizontal axes is the time axis.
In that case the main reason for stacking LSTM is to allow for greater model complexit
|
What are the advantages of stacking multiple LSTMs?
I think that you are referring to vertically stacked LSTM layers (assuming the horizontal axes is the time axis.
In that case the main reason for stacking LSTM is to allow for greater model complexity. In case of a simple feedforward net we stack layers to create a hierarchical feature representation of the input data to then use for some machine learning task. The same applies for stacked LSTM's.
At every time step an LSTM, besides the recurrent input. If the input is already the result from an LSTM layer (or a feedforward layer) then the current LSTM can create a more complex feature representation of the current input.
Now the difference between having a feedforward layer between the feature input and the LSTM layer and having another LSTM layer is that a feed forward layer (say a fully connected layer) does not receive feedback from its previous time step and thus can not account for certain patterns. Having an LSTM in stead (e.g. using a stacked LSTM representation) more complex input patterns can be described at every layer
|
What are the advantages of stacking multiple LSTMs?
I think that you are referring to vertically stacked LSTM layers (assuming the horizontal axes is the time axis.
In that case the main reason for stacking LSTM is to allow for greater model complexit
|
6,313
|
What are the advantages of stacking multiple LSTMs?
|
From {1}:
While it is not theoretically clear what is the additional power gained by the deeper
architecture, it was observed empirically that deep RNNs work better than shallower ones
on some tasks. In particular, Sutskever et al (2014) report that a 4-layers deep architecture
was crucial in achieving good machine-translation performance in an encoder-decoder
framework. Irsoy and Cardie (2014) also report improved results from moving from a one-layer
BI-RNN to an architecture with several layers. Many other works report result using
layered RNN architectures, but do not explicitly compare to 1-layer RNNs.
FYI:
The same question on the data science Stack Exchange: Advantages of stacking LSTMs?
Is anyone stacking LSTM and GRU cells together and why?
References:
{1} Goldberg, Yoav. "A Primer on Neural Network Models for Natural Language Processing." J. Artif. Intell. Res.(JAIR) 57 (2016): 345-420. https://scholar.google.com/scholar?cluster=3704132192758179278&hl=en&as_sdt=0,5 ;
http://u.cs.biu.ac.il/~yogo/nnlp.pdf
|
What are the advantages of stacking multiple LSTMs?
|
From {1}:
While it is not theoretically clear what is the additional power gained by the deeper
architecture, it was observed empirically that deep RNNs work better than shallower ones
on some ta
|
What are the advantages of stacking multiple LSTMs?
From {1}:
While it is not theoretically clear what is the additional power gained by the deeper
architecture, it was observed empirically that deep RNNs work better than shallower ones
on some tasks. In particular, Sutskever et al (2014) report that a 4-layers deep architecture
was crucial in achieving good machine-translation performance in an encoder-decoder
framework. Irsoy and Cardie (2014) also report improved results from moving from a one-layer
BI-RNN to an architecture with several layers. Many other works report result using
layered RNN architectures, but do not explicitly compare to 1-layer RNNs.
FYI:
The same question on the data science Stack Exchange: Advantages of stacking LSTMs?
Is anyone stacking LSTM and GRU cells together and why?
References:
{1} Goldberg, Yoav. "A Primer on Neural Network Models for Natural Language Processing." J. Artif. Intell. Res.(JAIR) 57 (2016): 345-420. https://scholar.google.com/scholar?cluster=3704132192758179278&hl=en&as_sdt=0,5 ;
http://u.cs.biu.ac.il/~yogo/nnlp.pdf
|
What are the advantages of stacking multiple LSTMs?
From {1}:
While it is not theoretically clear what is the additional power gained by the deeper
architecture, it was observed empirically that deep RNNs work better than shallower ones
on some ta
|
6,314
|
What are the advantages of stacking multiple LSTMs?
|
From playing around with LSTM for sequence classification it had the same effect as increasing model capacity in CNNs (if you're familiar with them). So you definitely get gains especially if you are underfitting your data.
Of course double edged as you can also over fit and get worse performance.
In my case I went from 1 LSTM to a stack of 2 and get pretty much instant improvement.
|
What are the advantages of stacking multiple LSTMs?
|
From playing around with LSTM for sequence classification it had the same effect as increasing model capacity in CNNs (if you're familiar with them). So you definitely get gains especially if you are
|
What are the advantages of stacking multiple LSTMs?
From playing around with LSTM for sequence classification it had the same effect as increasing model capacity in CNNs (if you're familiar with them). So you definitely get gains especially if you are underfitting your data.
Of course double edged as you can also over fit and get worse performance.
In my case I went from 1 LSTM to a stack of 2 and get pretty much instant improvement.
|
What are the advantages of stacking multiple LSTMs?
From playing around with LSTM for sequence classification it had the same effect as increasing model capacity in CNNs (if you're familiar with them). So you definitely get gains especially if you are
|
6,315
|
What are the advantages of stacking multiple LSTMs?
|
In my experience, stacking LSTM layers (beyond 3) seems to offer worse performance.
The purple has 2 layers, pink has 3 and green has 6. Everything else is held constant. It does, I'm sure, depend on task. My task is a sequence-to-sequence of fixed length input and output.
|
What are the advantages of stacking multiple LSTMs?
|
In my experience, stacking LSTM layers (beyond 3) seems to offer worse performance.
The purple has 2 layers, pink has 3 and green has 6. Everything else is held constant. It does, I'm sure, depend on
|
What are the advantages of stacking multiple LSTMs?
In my experience, stacking LSTM layers (beyond 3) seems to offer worse performance.
The purple has 2 layers, pink has 3 and green has 6. Everything else is held constant. It does, I'm sure, depend on task. My task is a sequence-to-sequence of fixed length input and output.
|
What are the advantages of stacking multiple LSTMs?
In my experience, stacking LSTM layers (beyond 3) seems to offer worse performance.
The purple has 2 layers, pink has 3 and green has 6. Everything else is held constant. It does, I'm sure, depend on
|
6,316
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
|
It is not always about statistical testing. It can also be about information theory.
The term 5σ is what it says it is: a ratio of "signal" to "noise." In hypothesis testing we have an estimate of a distribution parameter, and standard error of the estimate. The first is a "signal," the second is "noise," and the ratio of the statistics and its standard error is the z-statistics, t-statistics, F-statistics, you name it.
Nevertheless signal-to-noise ratio is useful everywhere where we receive/perceive some information through some noise. As the cited link explains
Signal-to-noise ratio (often abbreviated SNR or S/N) is a measure used in science and engineering to quantify how much the signal is corrupted by noise.
In our case the "signal" is the measured actual change in the temperature of some strata of the atmosphere and the "noise" are predictions of the change from the simulations without the known anthropogenic influences. It so happens that these simulations predicted more or less stationary temperature with a certain standard deviation σ.
Now back to statistics. All test statistics (z, t, F) are the ratios of the estimate to its standard error. So when we statisticians hear of something like S/N, we think a z-statistics and equip it with the probability. The climatologists obviously don't do this (there is no mention of the probability anywhere in the article). They simply find out that the change is "roughly three to eight" times bigger as expected, the S/N is 3σ to 8σ.
What the article is reporting is, that they made two kinds of simulations: ones with the known anthropogenic influences included in the model and the others with the known anthropogenic influences excluded. The first simulations were similar to the measured actual satellite data, while the second were way off. If this is probable or not, they don't say and obviously don't care.
To answer other questions. They didn't set any experiments, they made simulations according to their models. So there is no explicit null hypothesis except the obvious one, that the change is similar to the expected (S/N is 1).
The effect size of the signal is a difference between the actual data and the simulations. It is a signal 5 times larger then expected (five times the usual variability of the temperatures). It seems that the noise is decreasing because of the amount and possibly accuracy of the measurements.
Contrary to our expectations from the "real scientists," there is no statistical model that we could talk about, so the question about the assumptions made is vacuous. The only assumption is that their models enable them to predict climate. This is as valid as saying that the models used for the weather forecasts are solid.
There are much more then three curves. They are the simulation results from different models. They simply have to be different. And yes, have different noise. The signal, as far as it is different, are different sets of measurements, which have their measurement error, and also should be different. What this means regarding the interpretation? Probability interpretation of the S/N is not a good one. However the external validity of the findings is sound. They simply assert that the climate changes in the period from 1979 to 2011 are comparable to simulations when the known anthropogenic influences are accounted for and roughly five times bigger than the ones calculated by simulation when the known anthropogenic factors are excluded from the model.
So there is one question left. If the climatologists would ask the statisticians to make a model, what should it be? In my opinion something in the line of Brownian motion.
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
|
It is not always about statistical testing. It can also be about information theory.
The term 5σ is what it says it is: a ratio of "signal" to "noise." In hypothesis testing we have an estimate of a d
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
It is not always about statistical testing. It can also be about information theory.
The term 5σ is what it says it is: a ratio of "signal" to "noise." In hypothesis testing we have an estimate of a distribution parameter, and standard error of the estimate. The first is a "signal," the second is "noise," and the ratio of the statistics and its standard error is the z-statistics, t-statistics, F-statistics, you name it.
Nevertheless signal-to-noise ratio is useful everywhere where we receive/perceive some information through some noise. As the cited link explains
Signal-to-noise ratio (often abbreviated SNR or S/N) is a measure used in science and engineering to quantify how much the signal is corrupted by noise.
In our case the "signal" is the measured actual change in the temperature of some strata of the atmosphere and the "noise" are predictions of the change from the simulations without the known anthropogenic influences. It so happens that these simulations predicted more or less stationary temperature with a certain standard deviation σ.
Now back to statistics. All test statistics (z, t, F) are the ratios of the estimate to its standard error. So when we statisticians hear of something like S/N, we think a z-statistics and equip it with the probability. The climatologists obviously don't do this (there is no mention of the probability anywhere in the article). They simply find out that the change is "roughly three to eight" times bigger as expected, the S/N is 3σ to 8σ.
What the article is reporting is, that they made two kinds of simulations: ones with the known anthropogenic influences included in the model and the others with the known anthropogenic influences excluded. The first simulations were similar to the measured actual satellite data, while the second were way off. If this is probable or not, they don't say and obviously don't care.
To answer other questions. They didn't set any experiments, they made simulations according to their models. So there is no explicit null hypothesis except the obvious one, that the change is similar to the expected (S/N is 1).
The effect size of the signal is a difference between the actual data and the simulations. It is a signal 5 times larger then expected (five times the usual variability of the temperatures). It seems that the noise is decreasing because of the amount and possibly accuracy of the measurements.
Contrary to our expectations from the "real scientists," there is no statistical model that we could talk about, so the question about the assumptions made is vacuous. The only assumption is that their models enable them to predict climate. This is as valid as saying that the models used for the weather forecasts are solid.
There are much more then three curves. They are the simulation results from different models. They simply have to be different. And yes, have different noise. The signal, as far as it is different, are different sets of measurements, which have their measurement error, and also should be different. What this means regarding the interpretation? Probability interpretation of the S/N is not a good one. However the external validity of the findings is sound. They simply assert that the climate changes in the period from 1979 to 2011 are comparable to simulations when the known anthropogenic influences are accounted for and roughly five times bigger than the ones calculated by simulation when the known anthropogenic factors are excluded from the model.
So there is one question left. If the climatologists would ask the statisticians to make a model, what should it be? In my opinion something in the line of Brownian motion.
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
It is not always about statistical testing. It can also be about information theory.
The term 5σ is what it says it is: a ratio of "signal" to "noise." In hypothesis testing we have an estimate of a d
|
6,317
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
|
Caveat: I am NOT an expert on climatology, this is not my field. Please bear this in mind. Corrections welcome.
The figure that you are referring to comes from a recent paper Santer et al. 2019, Celebrating the anniversary of three key events in climate change science from Nature Climate Change. It is not a research paper, but a brief comment. This figure is a simplified update of a similar figure from an earlier Science paper of the same authors, Santer et al. 2018, Human influence on the seasonal cycle of tropospheric temperature. Here is the 2019 figure:
And here is the 2018 figure; panel A corresponds to the 2019 figure:
Here I will try to explain the statistical analysis behind this last figure (all four panels). The Science paper is open access and quite readable; the statistical details are, as usual, hidden in the Supplementary Materials. Before discussing statistics as such, one has to say a few words about the observational data and the simulations (climate models) used here.
1. Data
The abbreviations RSS, UAH, and STAR, refer to reconstructions of the tropospheric temperature from the satellite measurements. Tropospheric temperature has been monitored since 1979 using weather satellites: see Wikipedia on MSU temperature measurements. Unfortunately, the satellites do not directly measure temperature; they measure something else, from which the temperature can be inferred. Moreover, they are known to suffer from various time-dependent biases and calibration problems. This makes reconstructing the actual temperature a difficult problem. Several research groups perform this reconstruction, following somewhat different methodologies, and obtaining somewhat different final results. RSS, UAH, and STAR are these reconstructions. To quote Wikipedia,
Satellites do not measure temperature. They measure radiances in various wavelength bands, which must then be mathematically inverted to obtain indirect inferences of temperature. The resulting temperature profiles depend on details of the methods that are used to obtain temperatures from radiances. As a result, different groups that have analyzed the satellite data have obtained different temperature trends. Among these groups are Remote Sensing Systems (RSS) and the University of Alabama in Huntsville (UAH). The satellite series is not fully homogeneous – the record is constructed from a series of satellites with similar but not identical instrumentation. The sensors deteriorate over time, and corrections are necessary for satellite drift in orbit. Particularly large differences between reconstructed temperature series occur at the few times when there is little temporal overlap between successive satellites, making intercalibration difficult.
There is a lot of debate about which reconstruction is more reliable. Each group updates their algorithms every now and then, changing the whole reconstructed time series. This is why, for example, RSS v3.3 differs from RSS v4.0 in the above figure. Overall, AFAIK it is well accepted in the field that the estimates of the global surface temperature are more precise than the satellite measurements. In any case, what matters for this question, is that there are several available estimates of the spatially-resolved tropospheric temperature, from 1979 until now -- i.e. as as a function of latitude, longitude, and time.
Let us denote such an estimate by $T(\mathbf x, t)$.
2. Models
There are various climate models that can be run to simulate the tropospheric temperature (also as a function of latitude, longitude, and time). These models take CO2 concentration, volcanic activity, solar irradiance, aerosols concentration, and various other external influences as input, and produce temperature as output. These models can be run for the same time period (1979--now), using the actual measured external influences. The outputs can then be averaged, to obtain mean model output.
One can also run these models without inputting the anthropogenic factors (greenhouse gases, aerosols, etc.), to get an idea of non-anthropogenic model predictions. Note that all other factors (solar/volcanic/etc.) fluctuate around their mean values, so the non-anthropogenic model output is stationary by construction. In other words, the models do not allow the climate to change naturally, without any specific external cause.
Let us denote the mean anthropogenic model output by $M(\mathbf x,t)$ and the mean non-anthropogenic model output by $N(\mathbf x, t)$.
3. Fingerprints and $z$-statistics
Now we can start talking about statistics. The general idea is to look at how similar the measured tropospheric temperature $T(\mathbf x, t)$ is to the anthropogenic model output $M(\mathbf x, t)$, compared to the non-anthropogenic model output $N(\mathbf x, t)$. One can quantify the similarity in different ways, corresponding to different "fingerprints" of anthropogenic global warming.
The authors consider four different fingerprints (corresponding to the four panels of the figure above). In each case they convert all three functions defined above into annual values $T(\mathbf x, i)$, $M(\mathbf x, i)$, and $N(\mathbf x, i)$, where $i$ indexes years from 1979 until 2019. Here are the four different annual values that they use:
Annual mean: simply average temperature over the whole year.
Annual seasonal cycle: the summer temperature minus the winter temperature.
Annual mean with global mean subtracted: the same as (1) but subtracting the global average for each year across the globe, i.e. across $\mathbf x$. The result has mean zero for each $i$.
Annual seasonal cycle with global mean subtracted: the same as (2) but again subtracting the global average.
For each of these four analyses, the authors take the corresponding $M(\mathbf x, i)$, do PCA across time points, and obtain the first eigenvector $F(\mathbf x)$. It is basically a 2D pattern of maximal change of the quantity of interest according to the anthropogenic model.
Then they project the observed values $T(\mathbf x, i)$ onto this pattern $F(\mathbf x)$, i.e. compute $$Z(i) = \sum_\mathbf x T(\mathbf x, i) F(\mathbf x),$$ and find the slope $\beta$ of the resulting time series. It will be the numerator of the $z$-statistic ("signal-to-noise ratio" in the figures).
To compute the denominator, they use non-anthropogenic model instead of the actually observed values, i.e. compute $$W(i) = \sum_\mathbf x N(\mathbf x, i) F(\mathbf x),$$ and again find its slope $\beta_\mathrm{noise}$. To obtain the null distribution of slopes, they run the non-anthropogenic models for 200 years, chop the outputs in 30-year chunks and repeat the analysis. The standard deviation of the $\beta_\mathrm{noise}$ values forms the denominator of the $z$-statistic:
$$z = \frac{\beta}{\operatorname{Var}^{1/2}[\beta_\mathrm{noise}]}.$$
What you see in panels A--D of the figure above are these $z$ values for different end years of the analysis.
The null hypothesis here is that the temperature fluctuates under the influence of stationary solar/volcanic/etc inputs without any drift. The high $z$ values indicate that the observed tropospheric temperatures are not consistent with this null hypothesis.
4. Some comments
The first fingerprint (panel A) is, IMHO, the most trivial. It simply means that the observed temperatures monotonically grow whereas the temperatures under the null hypothesis do not. I do not think one needs this whole complicated machinery to make this conclusion. The global average lower tropospheric temperature (RSS variant) time series looks like this:
and clearly there is a very significant trend here. I don't think one needs any models to see that.
The fingerprint in panel B is somewhat more interesting. Here the global mean is subtracted, so the $z$-values are not driven by the rising temperature, but instead by the the spatial patterns of the temperature change. Indeed, it is well-known that the Northern hemisphere warms up faster than the Southern one (you can compare the hemispheres here: http://images.remss.com/msu/msu_time_series.html), and this is also what climate models output. The panel B is largely explained by this inter-hemispheric difference.
The fingerprint in panel C is arguably even more interesting, and was the actual focus of the Santer et al. 2018 paper (recall its title: "Human influence on the seasonal cycle of tropospheric temperature", emphasis added). As shown in Figure 2 in the paper, the models predict that the amplitude of the seasonal cycle should increase in mid-latitudes of both hemispheres (and decrease elsewhere, in particular over the Indian monsoon region). This is indeed what happens in the observed data, yielding high $z$-values in panel C. Panel D is similar to C because here the effect is not due to the global increase but due to the specific geographical pattern.
P.S. The specific criticism at judithcurry.com that you linked above looks rather superficial to me. They raise four points. The first is that these plots only show $z$-statistics but not the effect size; however, opening Santer et al. 2018 one will find all other figures clearly displaying the actual slope values which is the effect size of interest. The second I failed to understand; I suspect it is a confusion on their part. The third is about how meaningful the null hypothesis is; this is fair enough (but off-topic on CrossValidated). The last one develops some argument about autocorrelated time series but I do not see how it applies to the above calculation.
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
|
Caveat: I am NOT an expert on climatology, this is not my field. Please bear this in mind. Corrections welcome.
The figure that you are referring to comes from a recent paper Santer et al. 2019, Cel
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
Caveat: I am NOT an expert on climatology, this is not my field. Please bear this in mind. Corrections welcome.
The figure that you are referring to comes from a recent paper Santer et al. 2019, Celebrating the anniversary of three key events in climate change science from Nature Climate Change. It is not a research paper, but a brief comment. This figure is a simplified update of a similar figure from an earlier Science paper of the same authors, Santer et al. 2018, Human influence on the seasonal cycle of tropospheric temperature. Here is the 2019 figure:
And here is the 2018 figure; panel A corresponds to the 2019 figure:
Here I will try to explain the statistical analysis behind this last figure (all four panels). The Science paper is open access and quite readable; the statistical details are, as usual, hidden in the Supplementary Materials. Before discussing statistics as such, one has to say a few words about the observational data and the simulations (climate models) used here.
1. Data
The abbreviations RSS, UAH, and STAR, refer to reconstructions of the tropospheric temperature from the satellite measurements. Tropospheric temperature has been monitored since 1979 using weather satellites: see Wikipedia on MSU temperature measurements. Unfortunately, the satellites do not directly measure temperature; they measure something else, from which the temperature can be inferred. Moreover, they are known to suffer from various time-dependent biases and calibration problems. This makes reconstructing the actual temperature a difficult problem. Several research groups perform this reconstruction, following somewhat different methodologies, and obtaining somewhat different final results. RSS, UAH, and STAR are these reconstructions. To quote Wikipedia,
Satellites do not measure temperature. They measure radiances in various wavelength bands, which must then be mathematically inverted to obtain indirect inferences of temperature. The resulting temperature profiles depend on details of the methods that are used to obtain temperatures from radiances. As a result, different groups that have analyzed the satellite data have obtained different temperature trends. Among these groups are Remote Sensing Systems (RSS) and the University of Alabama in Huntsville (UAH). The satellite series is not fully homogeneous – the record is constructed from a series of satellites with similar but not identical instrumentation. The sensors deteriorate over time, and corrections are necessary for satellite drift in orbit. Particularly large differences between reconstructed temperature series occur at the few times when there is little temporal overlap between successive satellites, making intercalibration difficult.
There is a lot of debate about which reconstruction is more reliable. Each group updates their algorithms every now and then, changing the whole reconstructed time series. This is why, for example, RSS v3.3 differs from RSS v4.0 in the above figure. Overall, AFAIK it is well accepted in the field that the estimates of the global surface temperature are more precise than the satellite measurements. In any case, what matters for this question, is that there are several available estimates of the spatially-resolved tropospheric temperature, from 1979 until now -- i.e. as as a function of latitude, longitude, and time.
Let us denote such an estimate by $T(\mathbf x, t)$.
2. Models
There are various climate models that can be run to simulate the tropospheric temperature (also as a function of latitude, longitude, and time). These models take CO2 concentration, volcanic activity, solar irradiance, aerosols concentration, and various other external influences as input, and produce temperature as output. These models can be run for the same time period (1979--now), using the actual measured external influences. The outputs can then be averaged, to obtain mean model output.
One can also run these models without inputting the anthropogenic factors (greenhouse gases, aerosols, etc.), to get an idea of non-anthropogenic model predictions. Note that all other factors (solar/volcanic/etc.) fluctuate around their mean values, so the non-anthropogenic model output is stationary by construction. In other words, the models do not allow the climate to change naturally, without any specific external cause.
Let us denote the mean anthropogenic model output by $M(\mathbf x,t)$ and the mean non-anthropogenic model output by $N(\mathbf x, t)$.
3. Fingerprints and $z$-statistics
Now we can start talking about statistics. The general idea is to look at how similar the measured tropospheric temperature $T(\mathbf x, t)$ is to the anthropogenic model output $M(\mathbf x, t)$, compared to the non-anthropogenic model output $N(\mathbf x, t)$. One can quantify the similarity in different ways, corresponding to different "fingerprints" of anthropogenic global warming.
The authors consider four different fingerprints (corresponding to the four panels of the figure above). In each case they convert all three functions defined above into annual values $T(\mathbf x, i)$, $M(\mathbf x, i)$, and $N(\mathbf x, i)$, where $i$ indexes years from 1979 until 2019. Here are the four different annual values that they use:
Annual mean: simply average temperature over the whole year.
Annual seasonal cycle: the summer temperature minus the winter temperature.
Annual mean with global mean subtracted: the same as (1) but subtracting the global average for each year across the globe, i.e. across $\mathbf x$. The result has mean zero for each $i$.
Annual seasonal cycle with global mean subtracted: the same as (2) but again subtracting the global average.
For each of these four analyses, the authors take the corresponding $M(\mathbf x, i)$, do PCA across time points, and obtain the first eigenvector $F(\mathbf x)$. It is basically a 2D pattern of maximal change of the quantity of interest according to the anthropogenic model.
Then they project the observed values $T(\mathbf x, i)$ onto this pattern $F(\mathbf x)$, i.e. compute $$Z(i) = \sum_\mathbf x T(\mathbf x, i) F(\mathbf x),$$ and find the slope $\beta$ of the resulting time series. It will be the numerator of the $z$-statistic ("signal-to-noise ratio" in the figures).
To compute the denominator, they use non-anthropogenic model instead of the actually observed values, i.e. compute $$W(i) = \sum_\mathbf x N(\mathbf x, i) F(\mathbf x),$$ and again find its slope $\beta_\mathrm{noise}$. To obtain the null distribution of slopes, they run the non-anthropogenic models for 200 years, chop the outputs in 30-year chunks and repeat the analysis. The standard deviation of the $\beta_\mathrm{noise}$ values forms the denominator of the $z$-statistic:
$$z = \frac{\beta}{\operatorname{Var}^{1/2}[\beta_\mathrm{noise}]}.$$
What you see in panels A--D of the figure above are these $z$ values for different end years of the analysis.
The null hypothesis here is that the temperature fluctuates under the influence of stationary solar/volcanic/etc inputs without any drift. The high $z$ values indicate that the observed tropospheric temperatures are not consistent with this null hypothesis.
4. Some comments
The first fingerprint (panel A) is, IMHO, the most trivial. It simply means that the observed temperatures monotonically grow whereas the temperatures under the null hypothesis do not. I do not think one needs this whole complicated machinery to make this conclusion. The global average lower tropospheric temperature (RSS variant) time series looks like this:
and clearly there is a very significant trend here. I don't think one needs any models to see that.
The fingerprint in panel B is somewhat more interesting. Here the global mean is subtracted, so the $z$-values are not driven by the rising temperature, but instead by the the spatial patterns of the temperature change. Indeed, it is well-known that the Northern hemisphere warms up faster than the Southern one (you can compare the hemispheres here: http://images.remss.com/msu/msu_time_series.html), and this is also what climate models output. The panel B is largely explained by this inter-hemispheric difference.
The fingerprint in panel C is arguably even more interesting, and was the actual focus of the Santer et al. 2018 paper (recall its title: "Human influence on the seasonal cycle of tropospheric temperature", emphasis added). As shown in Figure 2 in the paper, the models predict that the amplitude of the seasonal cycle should increase in mid-latitudes of both hemispheres (and decrease elsewhere, in particular over the Indian monsoon region). This is indeed what happens in the observed data, yielding high $z$-values in panel C. Panel D is similar to C because here the effect is not due to the global increase but due to the specific geographical pattern.
P.S. The specific criticism at judithcurry.com that you linked above looks rather superficial to me. They raise four points. The first is that these plots only show $z$-statistics but not the effect size; however, opening Santer et al. 2018 one will find all other figures clearly displaying the actual slope values which is the effect size of interest. The second I failed to understand; I suspect it is a confusion on their part. The third is about how meaningful the null hypothesis is; this is fair enough (but off-topic on CrossValidated). The last one develops some argument about autocorrelated time series but I do not see how it applies to the above calculation.
|
Evidence for man-made global warming hits 'gold standard': how did they do this?
Caveat: I am NOT an expert on climatology, this is not my field. Please bear this in mind. Corrections welcome.
The figure that you are referring to comes from a recent paper Santer et al. 2019, Cel
|
6,318
|
Error "system is computationally singular" when running a glm
|
It means your design matrix is not invertible and therefore can't be used to develop a regression model. This results from linearly dependent columns, i.e. strongly correlated variables. Examine the pairwise covariance (or correlation) of your variables to investigate if there are any variables that can potentially be removed. You're looking for covariances (or correlations) >> 0. Alternatively, you can probably automate this variable selection by using a forward stepwise regression.
This can also result from having more variables than observations, in which case your design matrix is probably not full rank. This is a bit trickier to fix, but there are ways. I believe lasso regression is supposed to work well when the data is "wider" than it is "long."
Keep in mind: if you decide to try lasso or stepwise selection, your doing much more (in terms of variable selection) than just handling multicolinearity.
|
Error "system is computationally singular" when running a glm
|
It means your design matrix is not invertible and therefore can't be used to develop a regression model. This results from linearly dependent columns, i.e. strongly correlated variables. Examine the p
|
Error "system is computationally singular" when running a glm
It means your design matrix is not invertible and therefore can't be used to develop a regression model. This results from linearly dependent columns, i.e. strongly correlated variables. Examine the pairwise covariance (or correlation) of your variables to investigate if there are any variables that can potentially be removed. You're looking for covariances (or correlations) >> 0. Alternatively, you can probably automate this variable selection by using a forward stepwise regression.
This can also result from having more variables than observations, in which case your design matrix is probably not full rank. This is a bit trickier to fix, but there are ways. I believe lasso regression is supposed to work well when the data is "wider" than it is "long."
Keep in mind: if you decide to try lasso or stepwise selection, your doing much more (in terms of variable selection) than just handling multicolinearity.
|
Error "system is computationally singular" when running a glm
It means your design matrix is not invertible and therefore can't be used to develop a regression model. This results from linearly dependent columns, i.e. strongly correlated variables. Examine the p
|
6,319
|
Error "system is computationally singular" when running a glm
|
I've dealt with the exact same problem. My teacher told me that this is because one of my variables is much bigger than the others. (In my case, the trading volume was much bigger than the returns in two different moments.) The problem is because of limitations in floating-point computations and precision, not anything inherently mathematical or statistical.
Therefore I've divided the biggest variable by 1000000.
data$Volume <- data$Volume / 1000000
|
Error "system is computationally singular" when running a glm
|
I've dealt with the exact same problem. My teacher told me that this is because one of my variables is much bigger than the others. (In my case, the trading volume was much bigger than the returns in
|
Error "system is computationally singular" when running a glm
I've dealt with the exact same problem. My teacher told me that this is because one of my variables is much bigger than the others. (In my case, the trading volume was much bigger than the returns in two different moments.) The problem is because of limitations in floating-point computations and precision, not anything inherently mathematical or statistical.
Therefore I've divided the biggest variable by 1000000.
data$Volume <- data$Volume / 1000000
|
Error "system is computationally singular" when running a glm
I've dealt with the exact same problem. My teacher told me that this is because one of my variables is much bigger than the others. (In my case, the trading volume was much bigger than the returns in
|
6,320
|
Creating a "certainty score" from the votes in random forests?
|
It makes perfect sense, and all implementations of random forests I've worked with (such as MATLAB's) provide probabilistic outputs as well to do just that.
I've not worked with the R implementation, but I'd be shocked if there wasn't a simple way to obtain soft outputs from the votes as well as the hard decision.
Edit: Just glanced at R, and predict.randomForest does output probabilities as well.
|
Creating a "certainty score" from the votes in random forests?
|
It makes perfect sense, and all implementations of random forests I've worked with (such as MATLAB's) provide probabilistic outputs as well to do just that.
I've not worked with the R implementation,
|
Creating a "certainty score" from the votes in random forests?
It makes perfect sense, and all implementations of random forests I've worked with (such as MATLAB's) provide probabilistic outputs as well to do just that.
I've not worked with the R implementation, but I'd be shocked if there wasn't a simple way to obtain soft outputs from the votes as well as the hard decision.
Edit: Just glanced at R, and predict.randomForest does output probabilities as well.
|
Creating a "certainty score" from the votes in random forests?
It makes perfect sense, and all implementations of random forests I've worked with (such as MATLAB's) provide probabilistic outputs as well to do just that.
I've not worked with the R implementation,
|
6,321
|
Creating a "certainty score" from the votes in random forests?
|
If you are using R, the caret package will save you from re-inventing the wheel. For example, the following code uses cross-validation to choose the tuning parameters for a random forest model, and then outputs the mean and standard deviation of accuracy for each cross-validation fold. Finally, it calculates class probabilities for the model.
library(caret)
library(PerformanceAnalytics)
data(iris)
#Make a yes/no dataset
Dataset <- iris
Dataset$Class <- ifelse(Dataset$Species=='versicolor','Yes','No')
Dataset$Class <- as.factor(Dataset$Class)
Dataset$Species<- NULL
chart.Correlation(Dataset[-5], col= Dataset$Class)
#Fit an RF model
model <- train(Class~.,Dataset,
method='rf',TuneLength=3,
trControl=trainControl(
method='cv',number=10,
classProbs = TRUE))
model$results
#Predict class probabilities (i.e. 'certainty' scores)
pred <- predict(model,iris,"prob")
head(pred)
The nice thing about caret is that it makes it very easy to compare different predictive models. For example, if you want to try an SVM, you can replace the text method='rf' with method='svmLinear' or method='svmRadial'. You can also choose your tuning parameters based on AUC rather than accuracy by adding a line to the trainControl parameter: summaryFunction=twoClassSummary.
Finnally, there's a bit of code in there from the PerformanceAnalytics package, chart.Correlation(Dataset[-5], col= Dataset$Class), which is not needed to build the model, but provides a nice visualization of your dataset.
|
Creating a "certainty score" from the votes in random forests?
|
If you are using R, the caret package will save you from re-inventing the wheel. For example, the following code uses cross-validation to choose the tuning parameters for a random forest model, and t
|
Creating a "certainty score" from the votes in random forests?
If you are using R, the caret package will save you from re-inventing the wheel. For example, the following code uses cross-validation to choose the tuning parameters for a random forest model, and then outputs the mean and standard deviation of accuracy for each cross-validation fold. Finally, it calculates class probabilities for the model.
library(caret)
library(PerformanceAnalytics)
data(iris)
#Make a yes/no dataset
Dataset <- iris
Dataset$Class <- ifelse(Dataset$Species=='versicolor','Yes','No')
Dataset$Class <- as.factor(Dataset$Class)
Dataset$Species<- NULL
chart.Correlation(Dataset[-5], col= Dataset$Class)
#Fit an RF model
model <- train(Class~.,Dataset,
method='rf',TuneLength=3,
trControl=trainControl(
method='cv',number=10,
classProbs = TRUE))
model$results
#Predict class probabilities (i.e. 'certainty' scores)
pred <- predict(model,iris,"prob")
head(pred)
The nice thing about caret is that it makes it very easy to compare different predictive models. For example, if you want to try an SVM, you can replace the text method='rf' with method='svmLinear' or method='svmRadial'. You can also choose your tuning parameters based on AUC rather than accuracy by adding a line to the trainControl parameter: summaryFunction=twoClassSummary.
Finnally, there's a bit of code in there from the PerformanceAnalytics package, chart.Correlation(Dataset[-5], col= Dataset$Class), which is not needed to build the model, but provides a nice visualization of your dataset.
|
Creating a "certainty score" from the votes in random forests?
If you are using R, the caret package will save you from re-inventing the wheel. For example, the following code uses cross-validation to choose the tuning parameters for a random forest model, and t
|
6,322
|
Creating a "certainty score" from the votes in random forests?
|
The randomForest package in R is a pretty decent package for getting into greater details about your analysis. It provides you with the votes (either as a fraction or raw counts) and it offers built in capacity for tuning and cross validation and can even give you more information about your features as well (if you wanted to know which out of your 100 are the most important in analysis).
If you're already using that package, then maybe you want to give it a closer look and if you aren't then perhaps check it out.
|
Creating a "certainty score" from the votes in random forests?
|
The randomForest package in R is a pretty decent package for getting into greater details about your analysis. It provides you with the votes (either as a fraction or raw counts) and it offers built i
|
Creating a "certainty score" from the votes in random forests?
The randomForest package in R is a pretty decent package for getting into greater details about your analysis. It provides you with the votes (either as a fraction or raw counts) and it offers built in capacity for tuning and cross validation and can even give you more information about your features as well (if you wanted to know which out of your 100 are the most important in analysis).
If you're already using that package, then maybe you want to give it a closer look and if you aren't then perhaps check it out.
|
Creating a "certainty score" from the votes in random forests?
The randomForest package in R is a pretty decent package for getting into greater details about your analysis. It provides you with the votes (either as a fraction or raw counts) and it offers built i
|
6,323
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
It does not apply to discrete distributions. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm for example.
Is there any reason you can't use a chi-square goodness of fit test?
see http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm for more info.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
It does not apply to discrete distributions. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm for example.
Is there any reason you can't use a chi-square goodness of fit test?
see h
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
It does not apply to discrete distributions. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm for example.
Is there any reason you can't use a chi-square goodness of fit test?
see http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm for more info.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
It does not apply to discrete distributions. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm for example.
Is there any reason you can't use a chi-square goodness of fit test?
see h
|
6,324
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
As is often the case in statistics, it depends on what you mean.
If you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then look up the standard tables" then you'll get a true type I error rate lower than the one you chose (possibly a lot lower).
How much depends on "how discrete" the distribution is. If the probability of any one outcome is fairly low (so the proportion of tied-values in the data would be expected to be low) then it won't matter very much -- many people wouldn't have a problem with running a 5% test at 4.5% say. So for example, if you're testing a discrete uniform on [1,1000], you probably needn't worry.
But if there's a high probability of a value being tied, then the effect on the type I error rate can be marked. If you get a significance level of 0.005 when you wanted 0.05, that may be an issue, since it will correspondingly impact the power.
If instead you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then use a suitable critical value/calculate a suitable p-value for my situation" (say via a permutation test, for example), then the test is certainly valid in the sense that you'll get the right type I error rate -- up to the discreteness of the test statistic itself, of course. (Though there may well be better tests for your particular purpose, just as there usually are in the continuous case.)
Note that the distribution of the test-statistic itself is no longer distribution-free but a permutation-test avoids that issue.
So sometimes it's okay to use the standard tables even with discrete distributions, and even when its not okay, it's not so much the test statistic as the critical values/p-values you use with it that's the issue.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
As is often the case in statistics, it depends on what you mean.
If you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then look up the standard tables" then y
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
As is often the case in statistics, it depends on what you mean.
If you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then look up the standard tables" then you'll get a true type I error rate lower than the one you chose (possibly a lot lower).
How much depends on "how discrete" the distribution is. If the probability of any one outcome is fairly low (so the proportion of tied-values in the data would be expected to be low) then it won't matter very much -- many people wouldn't have a problem with running a 5% test at 4.5% say. So for example, if you're testing a discrete uniform on [1,1000], you probably needn't worry.
But if there's a high probability of a value being tied, then the effect on the type I error rate can be marked. If you get a significance level of 0.005 when you wanted 0.05, that may be an issue, since it will correspondingly impact the power.
If instead you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then use a suitable critical value/calculate a suitable p-value for my situation" (say via a permutation test, for example), then the test is certainly valid in the sense that you'll get the right type I error rate -- up to the discreteness of the test statistic itself, of course. (Though there may well be better tests for your particular purpose, just as there usually are in the continuous case.)
Note that the distribution of the test-statistic itself is no longer distribution-free but a permutation-test avoids that issue.
So sometimes it's okay to use the standard tables even with discrete distributions, and even when its not okay, it's not so much the test statistic as the critical values/p-values you use with it that's the issue.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
As is often the case in statistics, it depends on what you mean.
If you mean "I calculate my test statistic on a sample drawn from a discrete distribution and then look up the standard tables" then y
|
6,325
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
I believe the K-S test uses the fact that if $X$ is a random variable with CDF $F$ then $F(X)$ is a uniform random variable. This is not the case if $X$ is not continuous. For example, if $X$ is Bernoulli then $F(X)=X$, not a uniform.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
|
I believe the K-S test uses the fact that if $X$ is a random variable with CDF $F$ then $F(X)$ is a uniform random variable. This is not the case if $X$ is not continuous. For example, if $X$ is Be
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
I believe the K-S test uses the fact that if $X$ is a random variable with CDF $F$ then $F(X)$ is a uniform random variable. This is not the case if $X$ is not continuous. For example, if $X$ is Bernoulli then $F(X)=X$, not a uniform.
|
Is Kolmogorov-Smirnov test valid with discrete distributions?
I believe the K-S test uses the fact that if $X$ is a random variable with CDF $F$ then $F(X)$ is a uniform random variable. This is not the case if $X$ is not continuous. For example, if $X$ is Be
|
6,326
|
Training loss increases with time [duplicate]
|
I had such a similar behavior when training a CNN, it was because I used the gradient descent with decaying learning rate for the error calculation. Have you significantly increased the number of iterations and checked if this behavior comes much later with the new low learning rate?
|
Training loss increases with time [duplicate]
|
I had such a similar behavior when training a CNN, it was because I used the gradient descent with decaying learning rate for the error calculation. Have you significantly increased the number of iter
|
Training loss increases with time [duplicate]
I had such a similar behavior when training a CNN, it was because I used the gradient descent with decaying learning rate for the error calculation. Have you significantly increased the number of iterations and checked if this behavior comes much later with the new low learning rate?
|
Training loss increases with time [duplicate]
I had such a similar behavior when training a CNN, it was because I used the gradient descent with decaying learning rate for the error calculation. Have you significantly increased the number of iter
|
6,327
|
Training loss increases with time [duplicate]
|
With higher learning rates you are moving too much in the direction opposite to the gradient and may move away from the local minima which can increase the loss. Learning rate scheduling and gradient clipping can help.
|
Training loss increases with time [duplicate]
|
With higher learning rates you are moving too much in the direction opposite to the gradient and may move away from the local minima which can increase the loss. Learning rate scheduling and gradient
|
Training loss increases with time [duplicate]
With higher learning rates you are moving too much in the direction opposite to the gradient and may move away from the local minima which can increase the loss. Learning rate scheduling and gradient clipping can help.
|
Training loss increases with time [duplicate]
With higher learning rates you are moving too much in the direction opposite to the gradient and may move away from the local minima which can increase the loss. Learning rate scheduling and gradient
|
6,328
|
Training loss increases with time [duplicate]
|
Because as learning rate is too big, it will diverge and fail to find the minimum of the loss function. Using a scheduler to decrease learning rate after certain epochs will help solve the problem
|
Training loss increases with time [duplicate]
|
Because as learning rate is too big, it will diverge and fail to find the minimum of the loss function. Using a scheduler to decrease learning rate after certain epochs will help solve the problem
|
Training loss increases with time [duplicate]
Because as learning rate is too big, it will diverge and fail to find the minimum of the loss function. Using a scheduler to decrease learning rate after certain epochs will help solve the problem
|
Training loss increases with time [duplicate]
Because as learning rate is too big, it will diverge and fail to find the minimum of the loss function. Using a scheduler to decrease learning rate after certain epochs will help solve the problem
|
6,329
|
Difference between a SVM and a perceptron
|
It sounds right to me. People sometimes also use the word "Perceptron" to refer to the training algorithm together with the classifier. For example, someone explained this to me in the answer to this question. Also, there is nothing to stop you from using a kernel with the perceptron, and this is often a better classifier. See here for some slides (pdf) on how to implement the kernel perceptron.
The major practical difference between a (kernel) perceptron and SVM is that perceptrons can be trained online (i.e. their weights can be updated as new examples arrive one at a time) whereas SVMs cannot be. See this question for information on whether SVMs can be trained online. So, even though a SVM is usually a better classifier, perceptrons can still be useful because they are cheap and easy to re-train in a situation in which fresh training data is constantly arriving.
|
Difference between a SVM and a perceptron
|
It sounds right to me. People sometimes also use the word "Perceptron" to refer to the training algorithm together with the classifier. For example, someone explained this to me in the answer to this
|
Difference between a SVM and a perceptron
It sounds right to me. People sometimes also use the word "Perceptron" to refer to the training algorithm together with the classifier. For example, someone explained this to me in the answer to this question. Also, there is nothing to stop you from using a kernel with the perceptron, and this is often a better classifier. See here for some slides (pdf) on how to implement the kernel perceptron.
The major practical difference between a (kernel) perceptron and SVM is that perceptrons can be trained online (i.e. their weights can be updated as new examples arrive one at a time) whereas SVMs cannot be. See this question for information on whether SVMs can be trained online. So, even though a SVM is usually a better classifier, perceptrons can still be useful because they are cheap and easy to re-train in a situation in which fresh training data is constantly arriving.
|
Difference between a SVM and a perceptron
It sounds right to me. People sometimes also use the word "Perceptron" to refer to the training algorithm together with the classifier. For example, someone explained this to me in the answer to this
|
6,330
|
Difference between a SVM and a perceptron
|
SVM:
$$\min \|w\|_2 + C\sum_{i = 1}^{n}(1 - y_i(wx_i + w_0))_+ $$
Perceptron
$$\min \sum_{i = 1}^{n}(- y_i(wx_i + w_0))_+ $$
We can see that SVM has almost the same goal as L2-regularized perceptron.
Since the objective is different, we also have different optimization schemes for these two algorithms, from the $\|w\|_2$, we see that it is the key reason for using quadratic programming for optimizing SVM.
Why does perceptron allow online update? If you see the gradient descent update rule for the hinge loss (hinge loss is used by both SVM and perceptron),
$$w^t = w^{t-1} + \eta\frac{1}{N}\sum_{i = 1}^{N}y^ix^i\mathbb{I}(y^iw^tx^i \leq 0)$$
Since all machine learning algorithms can be seen as the combination of loss function and optimization algorithm.
Perceptron is no more than hinge loss (loss function) + stochastic gradient descent (optimization)
$$w^t = w^{t-1} + y^{y+1}x^{t+1}\mathbb{I}(y^{t+1}w^{t}x^{t+1} \leq 0)$$
And SVM can be seen as hinge loss + l2 regularization (loss + regularization) + quadratic programming or other fancier optimization algorithms like SMO (optimization).
|
Difference between a SVM and a perceptron
|
SVM:
$$\min \|w\|_2 + C\sum_{i = 1}^{n}(1 - y_i(wx_i + w_0))_+ $$
Perceptron
$$\min \sum_{i = 1}^{n}(- y_i(wx_i + w_0))_+ $$
We can see that SVM has almost the same goal as L2-regularized perceptron.
|
Difference between a SVM and a perceptron
SVM:
$$\min \|w\|_2 + C\sum_{i = 1}^{n}(1 - y_i(wx_i + w_0))_+ $$
Perceptron
$$\min \sum_{i = 1}^{n}(- y_i(wx_i + w_0))_+ $$
We can see that SVM has almost the same goal as L2-regularized perceptron.
Since the objective is different, we also have different optimization schemes for these two algorithms, from the $\|w\|_2$, we see that it is the key reason for using quadratic programming for optimizing SVM.
Why does perceptron allow online update? If you see the gradient descent update rule for the hinge loss (hinge loss is used by both SVM and perceptron),
$$w^t = w^{t-1} + \eta\frac{1}{N}\sum_{i = 1}^{N}y^ix^i\mathbb{I}(y^iw^tx^i \leq 0)$$
Since all machine learning algorithms can be seen as the combination of loss function and optimization algorithm.
Perceptron is no more than hinge loss (loss function) + stochastic gradient descent (optimization)
$$w^t = w^{t-1} + y^{y+1}x^{t+1}\mathbb{I}(y^{t+1}w^{t}x^{t+1} \leq 0)$$
And SVM can be seen as hinge loss + l2 regularization (loss + regularization) + quadratic programming or other fancier optimization algorithms like SMO (optimization).
|
Difference between a SVM and a perceptron
SVM:
$$\min \|w\|_2 + C\sum_{i = 1}^{n}(1 - y_i(wx_i + w_0))_+ $$
Perceptron
$$\min \sum_{i = 1}^{n}(- y_i(wx_i + w_0))_+ $$
We can see that SVM has almost the same goal as L2-regularized perceptron.
|
6,331
|
Difference between a SVM and a perceptron
|
Perceptron is the generalization of SVM where SVM is the perceptron with optimal stability. So you are correct when you say perceptron does not try to optimize the separation distance.
|
Difference between a SVM and a perceptron
|
Perceptron is the generalization of SVM where SVM is the perceptron with optimal stability. So you are correct when you say perceptron does not try to optimize the separation distance.
|
Difference between a SVM and a perceptron
Perceptron is the generalization of SVM where SVM is the perceptron with optimal stability. So you are correct when you say perceptron does not try to optimize the separation distance.
|
Difference between a SVM and a perceptron
Perceptron is the generalization of SVM where SVM is the perceptron with optimal stability. So you are correct when you say perceptron does not try to optimize the separation distance.
|
6,332
|
Detecting Outliers in Time Series (LS/AO/TC) using tsoutliers package in R. How to represent outliers in equation format?
|
The temporary change, TC, is a general type of outlier. The equation given in the documentation of the package and that you wrote is the equation that describes the dynamics of this type of outlier. You can generate it by means of the function filter as shown below. It is illuminating to display it for several values of delta. For $\delta=0$ the TC collapses in an additive
outlier; on the other extreme, $\delta=1$, the TC is like a level shift.
tc <- rep(0, 50)
tc[20] <- 1
tc1 <- filter(tc, filter = 0, method = "recursive")
tc2 <- filter(tc, filter = 0.3, method = "recursive")
tc3 <- filter(tc, filter = 0.7, method = "recursive")
tc4 <- filter(tc, filter = 1, method = "recursive")
par(mfrow = c(2,2))
plot(tc1, main = "TC delta = 0")
plot(tc2, main = "TC delta = 0.3")
plot(tc3, main = "TC delta = 0.7")
plot(tc4, main = "TC delta = 1", type = "s")
In your example, you can use the function outliers.effects to represent the effects of the detected outliers on the observed series:
# unit impulse
m1 <- ts(outliers.effects(outlier.chicken$outliers, n = length(chicken), weights = FALSE))
tsp(m1) <- tsp(chicken)
# weighted by the estimated coefficients
m2 <- ts(outliers.effects(outlier.chicken$outliers, n = length(chicken), weights = TRUE))
tsp(m2) <- tsp(chicken)
The innovational outlier, IO, is more peculiar. Contrary to the other types of outliers considered in tsoutliers, the effect of the IO depends on the selected model and on the parameter estimates. This fact can be troublesome in series with many outliers. In the first iterations of the algorithm (where the effect of some of the outliers may not have been detected and adjusted) the quality of the estimates of the ARIMA model may not be good enough as to
accurately define the IO. Moreover, as the algorithm makes progress a new ARIMA model may be selected. Thus, it is possible to detect an IO at a preliminary stage with an ARIMA model but eventually its dynamic is defined by another ARIMA model chosen in the last stage.
In this document (1) it is shown that, in some circumstances, the influence of an IO may increase as the date of its occurrence becomes more distant into the past, which is something hard to interpret or assume.
The IO has an interesting potential since it may capture seasonal outliers. The other types of outliers considered in tsoutlierscannot capture seasonal patterns. Nevertheless, in some cases it may be better to search for a possible seasonal level shifts, SLS, instead of IO (as shown in the document mentioned before).
The IO has an appealing interpretation. It is sometimes understood as an additive outlier that affects the disturbance term and then propagates in the series according to the dynamic of the ARIMA model. In this sense, the IO is like an additive outlier, both of them affect a single observation but the IO is an impulse in the disturbance term while the AO is an impulse added directly to the values generated by the ARIMA model or the data generating process.
Whether outliers affect the innovations or are outside the disturbance term may be a matter of discussion.
In the previous reference you may find some examples of real data where IO are detected.
(1) Seasonal outliers in time series. Regina Kaiser and Agustín Maravall. Document 20.II.2001.
|
Detecting Outliers in Time Series (LS/AO/TC) using tsoutliers package in R. How to represent outlier
|
The temporary change, TC, is a general type of outlier. The equation given in the documentation of the package and that you wrote is the equation that describes the dynamics of this type of outlier. Y
|
Detecting Outliers in Time Series (LS/AO/TC) using tsoutliers package in R. How to represent outliers in equation format?
The temporary change, TC, is a general type of outlier. The equation given in the documentation of the package and that you wrote is the equation that describes the dynamics of this type of outlier. You can generate it by means of the function filter as shown below. It is illuminating to display it for several values of delta. For $\delta=0$ the TC collapses in an additive
outlier; on the other extreme, $\delta=1$, the TC is like a level shift.
tc <- rep(0, 50)
tc[20] <- 1
tc1 <- filter(tc, filter = 0, method = "recursive")
tc2 <- filter(tc, filter = 0.3, method = "recursive")
tc3 <- filter(tc, filter = 0.7, method = "recursive")
tc4 <- filter(tc, filter = 1, method = "recursive")
par(mfrow = c(2,2))
plot(tc1, main = "TC delta = 0")
plot(tc2, main = "TC delta = 0.3")
plot(tc3, main = "TC delta = 0.7")
plot(tc4, main = "TC delta = 1", type = "s")
In your example, you can use the function outliers.effects to represent the effects of the detected outliers on the observed series:
# unit impulse
m1 <- ts(outliers.effects(outlier.chicken$outliers, n = length(chicken), weights = FALSE))
tsp(m1) <- tsp(chicken)
# weighted by the estimated coefficients
m2 <- ts(outliers.effects(outlier.chicken$outliers, n = length(chicken), weights = TRUE))
tsp(m2) <- tsp(chicken)
The innovational outlier, IO, is more peculiar. Contrary to the other types of outliers considered in tsoutliers, the effect of the IO depends on the selected model and on the parameter estimates. This fact can be troublesome in series with many outliers. In the first iterations of the algorithm (where the effect of some of the outliers may not have been detected and adjusted) the quality of the estimates of the ARIMA model may not be good enough as to
accurately define the IO. Moreover, as the algorithm makes progress a new ARIMA model may be selected. Thus, it is possible to detect an IO at a preliminary stage with an ARIMA model but eventually its dynamic is defined by another ARIMA model chosen in the last stage.
In this document (1) it is shown that, in some circumstances, the influence of an IO may increase as the date of its occurrence becomes more distant into the past, which is something hard to interpret or assume.
The IO has an interesting potential since it may capture seasonal outliers. The other types of outliers considered in tsoutlierscannot capture seasonal patterns. Nevertheless, in some cases it may be better to search for a possible seasonal level shifts, SLS, instead of IO (as shown in the document mentioned before).
The IO has an appealing interpretation. It is sometimes understood as an additive outlier that affects the disturbance term and then propagates in the series according to the dynamic of the ARIMA model. In this sense, the IO is like an additive outlier, both of them affect a single observation but the IO is an impulse in the disturbance term while the AO is an impulse added directly to the values generated by the ARIMA model or the data generating process.
Whether outliers affect the innovations or are outside the disturbance term may be a matter of discussion.
In the previous reference you may find some examples of real data where IO are detected.
(1) Seasonal outliers in time series. Regina Kaiser and Agustín Maravall. Document 20.II.2001.
|
Detecting Outliers in Time Series (LS/AO/TC) using tsoutliers package in R. How to represent outlier
The temporary change, TC, is a general type of outlier. The equation given in the documentation of the package and that you wrote is the equation that describes the dynamics of this type of outlier. Y
|
6,333
|
How to determine significant principal components using bootstrapping or Monte Carlo approach?
|
I am going to try and advance the dialogue here a bit even though this is my question. It's been 6 months since I asked this and unfortunately no complete answers have been given I will try and summarize what I have gathered thus far and see if anyone can elaborate on remaining issues. Please excuse the lengthy answer, but I see no other way...
First, I will demonstrate several approaches using a possibly better synthetic data set. It comes from a paper by Beckers and Rixon (2003) illustrating the use of an algorithm for conducting EOF on gappy data. I have reproduced the algorithm in R if anyone is interested (link).
Synthetic data set:
#color palette
pal <- colorRampPalette(c("blue", "cyan", "yellow", "red"))
#Generate data
m=50
n=100
frac.gaps <- 0.5 # the fraction of data with NaNs
N.S.ratio <- 0.25 # the Noise to Signal ratio for adding noise to data
x <- (seq(m)*2*pi)/m
t <- (seq(n)*2*pi)/n
#True field
Xt <-
outer(sin(x), sin(t)) +
outer(sin(2.1*x), sin(2.1*t)) +
outer(sin(3.1*x), sin(3.1*t)) +
outer(tanh(x), cos(t)) +
outer(tanh(2*x), cos(2.1*t)) +
outer(tanh(4*x), cos(0.1*t)) +
outer(tanh(2.4*x), cos(1.1*t)) +
tanh(outer(x, t, FUN="+")) +
tanh(outer(x, 2*t, FUN="+"))
Xt <- t(Xt)
image(Xt, col=pal(100))
#Noise field
set.seed(1)
RAND <- matrix(runif(length(Xt), min=-1, max=1), nrow=nrow(Xt), ncol=ncol(Xt))
R <- RAND * N.S.ratio * Xt
#True field + Noise field
Xp <- Xt + R
image(Xp, col=pal(100))
So, the true data field Xtis comprised of 9 signals and I have added some noise to it to create the observed field Xp, which will be used in the examples below. The EOFs are determined as such:
EOF
#make covariance matrix
C <- t(Xp) %*% Xp #cov(Xp)
image(C)
#Eigen decomposition
E <- svd(C)
#EOFs (U) and associated Lambda (L)
U <- E$u
L <- E$d
#projection of data onto EOFs (U) to derive principle components (A)
A <- Xp %*% U
Following the example that I used in my original example, I will determine "significant" EOFs via North's rule of thumb.
North's Rule of Thumb
Lambda_err <- sqrt(2/dim(Xp)[2])*L
upper.lim <- L+Lambda_err
lower.lim <- L-Lambda_err
NORTHok=0*L
for(i in seq(L)){
Lambdas <- L
Lambdas[i] <- NaN
nearest <- which.min(abs(L[i]-Lambdas))
if(nearest > i){
if(lower.lim[i] > upper.lim[nearest]) NORTHok[i] <- 1
}
if(nearest < i){
if(upper.lim[i] < lower.lim[nearest]) NORTHok[i] <- 1
}
}
n_sig <- min(which(NORTHok==0))-1
n_sig
plot(L[1:20],log="y", ylab="Lambda (dots) and error (vertical lines)", xlab="EOF")
segments(x0=seq(L), y0=L-Lambda_err, x1=seq(L), y1=L+Lambda_err)
abline(v=n_sig+0.5, col=2, lty=2)
text(x=n_sig, y=mean(L[1:10]), labels="North's Rule of Thumb", srt=90, col=2)
Since the Lambda values of 2:4 are very close to each other in amplitude, these are deemed insignificant by the rule of thumb - i.e. their respective EOF patterns might overlap and mix given their similar amplitudes. This is unfortunate given that we know that 9 signals actually exist in the field.
A more subjective approach is to view the log-transformed Lambda values ("Scree plot") and to then fit a regression to the trailing values. One then can determine visually at what level the lambda values lie above this line:
Scree plot
ntrail <- 35
tail(L, ntrail)
fit <- lm(log(tail(L, ntrail)) ~ seq(length(L)-ntrail+1, length(L)))
plot(log(L))
abline(fit, col=2)
So, the 5 leading EOFs lie above this line. I have tried this example when Xp has no additional noise added and the results reveal all 9 original signals. So, the insignificance of EOFs 6:9 is due to the fact that their amplitude is lower than the noise in the field.
A more objective method is the "Rule N" criteria by Overland and Preisendorfer (1982). There is an implementation within the wq package, which I show below.
Rule N
library(wq)
eofNum(Xp, distr = "normal", reps = 99)
RN <- ruleN(nrow(Xp), ncol(Xp), type = "normal", reps = 99)
RN
eigs <- svd(cov(Xp))$d
plot(eigs, log="y")
lines(RN, col=2, lty=2)
The Rule N identified 4 significant EOFs. Personally, I need to better understand this method; Why is it possible to gauge the level of error based on a random field that does not use the same distribution as that in Xp? One variation on this method would be to resample the data in Xp so that each column is reshuffled randomly. In this way, we ensure that the total variance of the random field is the same as Xp. By resampling many times, we are then able to calculate a baseline error of the decomposition.
Monte Carlo with random field (i.e. Null model comparison)
iter <- 499
LAMBDA <- matrix(NaN, ncol=iter, nrow=dim(Xp)[2])
set.seed(1)
for(i in seq(iter)){
#i=1
#random reorganize dimensions of scaled field
Xp.tmp <- NaN*Xp
for(j in seq(dim(Xp.tmp)[2])){
#j=1
Xp.tmp[,j] <- Xp[,j][sample(nrow(Xp))]
}
#make covariance matrix
C.tmp <- t(Xp.tmp) %*% Xp.tmp #cov(Xp.tmp)
#SVD decomposition
E.tmp <- svd(C.tmp)
#record Lambda (L)
LAMBDA[,i] <- E.tmp$d
print(paste(round(i/iter*100), "%", " completed", sep=""))
}
boxplot(t(LAMBDA), log="y", col=8, border=2, outpch="")
points(L)
Again, 4 EOFs are above the distributions for the random fields. My worry with this approach, and that of Rule N, is that these are not truly addressing the confidence intervals of the Lambda values; e.g. a high first Lambda value will automatically result in a lower amount of variance to be explained by trailing ones. Thus the Lambda calculated from random fields will always have a less steep slope and may result in selecting too few significant EOFs. [NOTE: The eofNum() function assumes that EOFs are calculated from a correlation matrix. This number might be different if using a e.g. a covariance matrix (centered but not scaled data).]
Finally, @tomasz74 mentioned the paper by Babamoradi et al. (2013), which I have had a brief look at. Its very interesting, but seems to be more focused on calculating CI's of EOF loadings and coefficients, rather than Lambda. Nevertheless, I believe that it might be adopted to assess Lambda error using the same methodology. A bootstrap resampling is done of the data field by resampling the rows until a new field is produced. The same row can be resampled more than once, which is a non-parametric approach and one does not need to make assumptions about the distribution of data.
Bootstrap of Lambda values
B <- 40 * nrow(Xp)
LAMBDA <- matrix(NaN, nrow=length(L), ncol=B)
for(b in seq(B)){
samp.b <- NaN*seq(nrow(Xp))
for(i in seq(nrow(Xp))){
samp.b[i] <- sample(nrow(Xp), 1)
}
Xp.b <- Xp[samp.b,]
C.b <- t(Xp.b) %*% Xp.b
E.b <- svd(C.b)
LAMBDA[,b] <- E.b$d
print(paste(round(b/B*100), "%", " completed", sep=""))
}
boxplot(t(LAMBDA), log="y", col=8, outpch="", ylab="Lambda [log-scale]")
points(L, col=4)
legend("topright", legend=c("Original"), pch=1, col=4)
While this may be a more robust than North's rule of thumb for calculating the error of Lambda values, I believe now that the question of EOF significance comes down to different opinions on what this means. For the North's rule of thumb and bootstrap methods, significance appears to be more based on whether or not teere is overlap between Lambda values. If there is, then these EOFs may be mixed in their signals and not represent "true" patterns. On the other hand, these two EOFs may describe a significant amount of variance (as compared to the decomposition of a random field - e.g. Rule N). So if one is interested in filtering out noise (i.e via EOF truncation) then Rule N would be sufficient. If one is interested in determining real patterns in a data set, then the more stringent criteria of Lambda overlap may be more robust.
Again, I am not an expert in these issues, so I am still hoping that someone with more experience can add to this explanation.
References:
Beckers, Jean-Marie, and M. Rixen. "EOF Calculations and Data Filling from Incomplete Oceanographic Datasets." Journal of Atmospheric and Oceanic Technology 20.12 (2003): 1839-1856.
Overland, J., and R. Preisendorfer, A significance test for principal components applied to a cyclone climatology, Mon. Wea. Rev., 110, 1-4, 1982.
|
How to determine significant principal components using bootstrapping or Monte Carlo approach?
|
I am going to try and advance the dialogue here a bit even though this is my question. It's been 6 months since I asked this and unfortunately no complete answers have been given I will try and summar
|
How to determine significant principal components using bootstrapping or Monte Carlo approach?
I am going to try and advance the dialogue here a bit even though this is my question. It's been 6 months since I asked this and unfortunately no complete answers have been given I will try and summarize what I have gathered thus far and see if anyone can elaborate on remaining issues. Please excuse the lengthy answer, but I see no other way...
First, I will demonstrate several approaches using a possibly better synthetic data set. It comes from a paper by Beckers and Rixon (2003) illustrating the use of an algorithm for conducting EOF on gappy data. I have reproduced the algorithm in R if anyone is interested (link).
Synthetic data set:
#color palette
pal <- colorRampPalette(c("blue", "cyan", "yellow", "red"))
#Generate data
m=50
n=100
frac.gaps <- 0.5 # the fraction of data with NaNs
N.S.ratio <- 0.25 # the Noise to Signal ratio for adding noise to data
x <- (seq(m)*2*pi)/m
t <- (seq(n)*2*pi)/n
#True field
Xt <-
outer(sin(x), sin(t)) +
outer(sin(2.1*x), sin(2.1*t)) +
outer(sin(3.1*x), sin(3.1*t)) +
outer(tanh(x), cos(t)) +
outer(tanh(2*x), cos(2.1*t)) +
outer(tanh(4*x), cos(0.1*t)) +
outer(tanh(2.4*x), cos(1.1*t)) +
tanh(outer(x, t, FUN="+")) +
tanh(outer(x, 2*t, FUN="+"))
Xt <- t(Xt)
image(Xt, col=pal(100))
#Noise field
set.seed(1)
RAND <- matrix(runif(length(Xt), min=-1, max=1), nrow=nrow(Xt), ncol=ncol(Xt))
R <- RAND * N.S.ratio * Xt
#True field + Noise field
Xp <- Xt + R
image(Xp, col=pal(100))
So, the true data field Xtis comprised of 9 signals and I have added some noise to it to create the observed field Xp, which will be used in the examples below. The EOFs are determined as such:
EOF
#make covariance matrix
C <- t(Xp) %*% Xp #cov(Xp)
image(C)
#Eigen decomposition
E <- svd(C)
#EOFs (U) and associated Lambda (L)
U <- E$u
L <- E$d
#projection of data onto EOFs (U) to derive principle components (A)
A <- Xp %*% U
Following the example that I used in my original example, I will determine "significant" EOFs via North's rule of thumb.
North's Rule of Thumb
Lambda_err <- sqrt(2/dim(Xp)[2])*L
upper.lim <- L+Lambda_err
lower.lim <- L-Lambda_err
NORTHok=0*L
for(i in seq(L)){
Lambdas <- L
Lambdas[i] <- NaN
nearest <- which.min(abs(L[i]-Lambdas))
if(nearest > i){
if(lower.lim[i] > upper.lim[nearest]) NORTHok[i] <- 1
}
if(nearest < i){
if(upper.lim[i] < lower.lim[nearest]) NORTHok[i] <- 1
}
}
n_sig <- min(which(NORTHok==0))-1
n_sig
plot(L[1:20],log="y", ylab="Lambda (dots) and error (vertical lines)", xlab="EOF")
segments(x0=seq(L), y0=L-Lambda_err, x1=seq(L), y1=L+Lambda_err)
abline(v=n_sig+0.5, col=2, lty=2)
text(x=n_sig, y=mean(L[1:10]), labels="North's Rule of Thumb", srt=90, col=2)
Since the Lambda values of 2:4 are very close to each other in amplitude, these are deemed insignificant by the rule of thumb - i.e. their respective EOF patterns might overlap and mix given their similar amplitudes. This is unfortunate given that we know that 9 signals actually exist in the field.
A more subjective approach is to view the log-transformed Lambda values ("Scree plot") and to then fit a regression to the trailing values. One then can determine visually at what level the lambda values lie above this line:
Scree plot
ntrail <- 35
tail(L, ntrail)
fit <- lm(log(tail(L, ntrail)) ~ seq(length(L)-ntrail+1, length(L)))
plot(log(L))
abline(fit, col=2)
So, the 5 leading EOFs lie above this line. I have tried this example when Xp has no additional noise added and the results reveal all 9 original signals. So, the insignificance of EOFs 6:9 is due to the fact that their amplitude is lower than the noise in the field.
A more objective method is the "Rule N" criteria by Overland and Preisendorfer (1982). There is an implementation within the wq package, which I show below.
Rule N
library(wq)
eofNum(Xp, distr = "normal", reps = 99)
RN <- ruleN(nrow(Xp), ncol(Xp), type = "normal", reps = 99)
RN
eigs <- svd(cov(Xp))$d
plot(eigs, log="y")
lines(RN, col=2, lty=2)
The Rule N identified 4 significant EOFs. Personally, I need to better understand this method; Why is it possible to gauge the level of error based on a random field that does not use the same distribution as that in Xp? One variation on this method would be to resample the data in Xp so that each column is reshuffled randomly. In this way, we ensure that the total variance of the random field is the same as Xp. By resampling many times, we are then able to calculate a baseline error of the decomposition.
Monte Carlo with random field (i.e. Null model comparison)
iter <- 499
LAMBDA <- matrix(NaN, ncol=iter, nrow=dim(Xp)[2])
set.seed(1)
for(i in seq(iter)){
#i=1
#random reorganize dimensions of scaled field
Xp.tmp <- NaN*Xp
for(j in seq(dim(Xp.tmp)[2])){
#j=1
Xp.tmp[,j] <- Xp[,j][sample(nrow(Xp))]
}
#make covariance matrix
C.tmp <- t(Xp.tmp) %*% Xp.tmp #cov(Xp.tmp)
#SVD decomposition
E.tmp <- svd(C.tmp)
#record Lambda (L)
LAMBDA[,i] <- E.tmp$d
print(paste(round(i/iter*100), "%", " completed", sep=""))
}
boxplot(t(LAMBDA), log="y", col=8, border=2, outpch="")
points(L)
Again, 4 EOFs are above the distributions for the random fields. My worry with this approach, and that of Rule N, is that these are not truly addressing the confidence intervals of the Lambda values; e.g. a high first Lambda value will automatically result in a lower amount of variance to be explained by trailing ones. Thus the Lambda calculated from random fields will always have a less steep slope and may result in selecting too few significant EOFs. [NOTE: The eofNum() function assumes that EOFs are calculated from a correlation matrix. This number might be different if using a e.g. a covariance matrix (centered but not scaled data).]
Finally, @tomasz74 mentioned the paper by Babamoradi et al. (2013), which I have had a brief look at. Its very interesting, but seems to be more focused on calculating CI's of EOF loadings and coefficients, rather than Lambda. Nevertheless, I believe that it might be adopted to assess Lambda error using the same methodology. A bootstrap resampling is done of the data field by resampling the rows until a new field is produced. The same row can be resampled more than once, which is a non-parametric approach and one does not need to make assumptions about the distribution of data.
Bootstrap of Lambda values
B <- 40 * nrow(Xp)
LAMBDA <- matrix(NaN, nrow=length(L), ncol=B)
for(b in seq(B)){
samp.b <- NaN*seq(nrow(Xp))
for(i in seq(nrow(Xp))){
samp.b[i] <- sample(nrow(Xp), 1)
}
Xp.b <- Xp[samp.b,]
C.b <- t(Xp.b) %*% Xp.b
E.b <- svd(C.b)
LAMBDA[,b] <- E.b$d
print(paste(round(b/B*100), "%", " completed", sep=""))
}
boxplot(t(LAMBDA), log="y", col=8, outpch="", ylab="Lambda [log-scale]")
points(L, col=4)
legend("topright", legend=c("Original"), pch=1, col=4)
While this may be a more robust than North's rule of thumb for calculating the error of Lambda values, I believe now that the question of EOF significance comes down to different opinions on what this means. For the North's rule of thumb and bootstrap methods, significance appears to be more based on whether or not teere is overlap between Lambda values. If there is, then these EOFs may be mixed in their signals and not represent "true" patterns. On the other hand, these two EOFs may describe a significant amount of variance (as compared to the decomposition of a random field - e.g. Rule N). So if one is interested in filtering out noise (i.e via EOF truncation) then Rule N would be sufficient. If one is interested in determining real patterns in a data set, then the more stringent criteria of Lambda overlap may be more robust.
Again, I am not an expert in these issues, so I am still hoping that someone with more experience can add to this explanation.
References:
Beckers, Jean-Marie, and M. Rixen. "EOF Calculations and Data Filling from Incomplete Oceanographic Datasets." Journal of Atmospheric and Oceanic Technology 20.12 (2003): 1839-1856.
Overland, J., and R. Preisendorfer, A significance test for principal components applied to a cyclone climatology, Mon. Wea. Rev., 110, 1-4, 1982.
|
How to determine significant principal components using bootstrapping or Monte Carlo approach?
I am going to try and advance the dialogue here a bit even though this is my question. It's been 6 months since I asked this and unfortunately no complete answers have been given I will try and summar
|
6,334
|
When is nested cross-validation really needed and can make a practical difference?
|
I would suggest that the bias depends on the variance of the model selection criterion, the higher the variance, the larger the bias is likely to be. The variance of the model selection criterion has two principal sources, the size of the dataset on which it is evaluated (so if you have a small dataset, the larger the bias is likely to be) and on the stability of the statistical model (if the model parameters are well estimated by the available training data, there is less flexibility for the model to over-fit the model selection criterion by tuning the hyper-parameters). The other relevant factor is the number of model choices to be made and/or hyper-parameters to be tune.
In my study, I am looking at powerful non-linear models and relatively small datasets (commonly used in machine learning studies) and both of these factors mean that nested cross-validation is absolutely necessary. If you increase the number of parameters (perhaps having a kernel with a scaling parameter for each attribute) the over-fitting can be "catastrophic". If you are using linear models with only a single regularisation parameter and a relatively large number of cases (relative to the number of parameters), then the difference is likely to be much smaller.
I should add that I would recommend always using nested cross-validation, provided it is computationally feasible, as it eliminates a possible source of bias so that we (and the peer-reviewers ;o) don't need to worry about whether it is negligible or not.
|
When is nested cross-validation really needed and can make a practical difference?
|
I would suggest that the bias depends on the variance of the model selection criterion, the higher the variance, the larger the bias is likely to be. The variance of the model selection criterion has
|
When is nested cross-validation really needed and can make a practical difference?
I would suggest that the bias depends on the variance of the model selection criterion, the higher the variance, the larger the bias is likely to be. The variance of the model selection criterion has two principal sources, the size of the dataset on which it is evaluated (so if you have a small dataset, the larger the bias is likely to be) and on the stability of the statistical model (if the model parameters are well estimated by the available training data, there is less flexibility for the model to over-fit the model selection criterion by tuning the hyper-parameters). The other relevant factor is the number of model choices to be made and/or hyper-parameters to be tune.
In my study, I am looking at powerful non-linear models and relatively small datasets (commonly used in machine learning studies) and both of these factors mean that nested cross-validation is absolutely necessary. If you increase the number of parameters (perhaps having a kernel with a scaling parameter for each attribute) the over-fitting can be "catastrophic". If you are using linear models with only a single regularisation parameter and a relatively large number of cases (relative to the number of parameters), then the difference is likely to be much smaller.
I should add that I would recommend always using nested cross-validation, provided it is computationally feasible, as it eliminates a possible source of bias so that we (and the peer-reviewers ;o) don't need to worry about whether it is negligible or not.
|
When is nested cross-validation really needed and can make a practical difference?
I would suggest that the bias depends on the variance of the model selection criterion, the higher the variance, the larger the bias is likely to be. The variance of the model selection criterion has
|
6,335
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
I would like to list another intuitive example.
Suppose I tell you I can predict the outcome of any coin flip. You do not believe and want to test my ability.
You tested 5 times, and I got all of them right. Do you believe I have the special ability? Maybe not. Because I can get all of them right by chance. (Specifically, suppose the coin is a fair coin, and each experiment is independent, then I can get all rights with $0.5^5\approx0.03$ with no super power. See Shufflepants's link for a joke about it).
On the other hand, if you tested me large number of times, then it is very unlikely that I can get it by chance. For example, if you tested $100$ times, the probability of me getting all of them right is $0.5^{100}\approx 0$.
The statistical concept is called statistical power, from Wikipeida
The power of a binary hypothesis test is the probability that the test correctly rejects the null hypothesis (H0) when the alternative hypothesis (H1) is true.
Back to the super power on coin flip example, essentially you want to run a hypothesis testing.
Null hypothesis (H0): I do not have the super power
Alternative hypothesis (H1): I have the super power
Now as you can see in the numerical example (test me 5 times vs test me 100 times), The statistical power has been affected by the sample size.
More to to read here. (more technical and based on t-test).
An interactive tool to understand statistical power can be found here. Note, the statistical power changes with the sample size !
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
I would like to list another intuitive example.
Suppose I tell you I can predict the outcome of any coin flip. You do not believe and want to test my ability.
You tested 5 times, and I got all of them
|
Why is 600 out of 1000 more convincing than 6 out of 10?
I would like to list another intuitive example.
Suppose I tell you I can predict the outcome of any coin flip. You do not believe and want to test my ability.
You tested 5 times, and I got all of them right. Do you believe I have the special ability? Maybe not. Because I can get all of them right by chance. (Specifically, suppose the coin is a fair coin, and each experiment is independent, then I can get all rights with $0.5^5\approx0.03$ with no super power. See Shufflepants's link for a joke about it).
On the other hand, if you tested me large number of times, then it is very unlikely that I can get it by chance. For example, if you tested $100$ times, the probability of me getting all of them right is $0.5^{100}\approx 0$.
The statistical concept is called statistical power, from Wikipeida
The power of a binary hypothesis test is the probability that the test correctly rejects the null hypothesis (H0) when the alternative hypothesis (H1) is true.
Back to the super power on coin flip example, essentially you want to run a hypothesis testing.
Null hypothesis (H0): I do not have the super power
Alternative hypothesis (H1): I have the super power
Now as you can see in the numerical example (test me 5 times vs test me 100 times), The statistical power has been affected by the sample size.
More to to read here. (more technical and based on t-test).
An interactive tool to understand statistical power can be found here. Note, the statistical power changes with the sample size !
|
Why is 600 out of 1000 more convincing than 6 out of 10?
I would like to list another intuitive example.
Suppose I tell you I can predict the outcome of any coin flip. You do not believe and want to test my ability.
You tested 5 times, and I got all of them
|
6,336
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
Think about it in terms of proportions. Let's say that preferring an orange is a success, while preferring an apple is a failure. So your mean success rate is $\mu = \frac{\text{# of sucesses}}{n}$ or in this case .6
The standard error of this quantity is estimated to be $\sqrt{\frac{\mu(1-\mu)}{n}}$. For a small sample size (i.e. 10), the standard error is $\approx .155$ but for a sample size of 1000, the standard error is $\approx .0155$. So basically, as was mentioned in the comments, "sample size matters."
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
Think about it in terms of proportions. Let's say that preferring an orange is a success, while preferring an apple is a failure. So your mean success rate is $\mu = \frac{\text{# of sucesses}}{n}$ or
|
Why is 600 out of 1000 more convincing than 6 out of 10?
Think about it in terms of proportions. Let's say that preferring an orange is a success, while preferring an apple is a failure. So your mean success rate is $\mu = \frac{\text{# of sucesses}}{n}$ or in this case .6
The standard error of this quantity is estimated to be $\sqrt{\frac{\mu(1-\mu)}{n}}$. For a small sample size (i.e. 10), the standard error is $\approx .155$ but for a sample size of 1000, the standard error is $\approx .0155$. So basically, as was mentioned in the comments, "sample size matters."
|
Why is 600 out of 1000 more convincing than 6 out of 10?
Think about it in terms of proportions. Let's say that preferring an orange is a success, while preferring an apple is a failure. So your mean success rate is $\mu = \frac{\text{# of sucesses}}{n}$ or
|
6,337
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
This concept is a consequence of the law of large numbers. From Wikipedia,
According to the law, the average of the results obtained from a large number of trials should be close to the expected value, and will tend to become closer as more trials are performed.
Results from a small sample may be farther from the expected value than that from a larger sample. And so, as stated in the question, one should be cautious of results calculated from small samples. The idea is also explained pretty well in this youTube video.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
This concept is a consequence of the law of large numbers. From Wikipedia,
According to the law, the average of the results obtained from a large number of trials should be close to the expected val
|
Why is 600 out of 1000 more convincing than 6 out of 10?
This concept is a consequence of the law of large numbers. From Wikipedia,
According to the law, the average of the results obtained from a large number of trials should be close to the expected value, and will tend to become closer as more trials are performed.
Results from a small sample may be farther from the expected value than that from a larger sample. And so, as stated in the question, one should be cautious of results calculated from small samples. The idea is also explained pretty well in this youTube video.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
This concept is a consequence of the law of large numbers. From Wikipedia,
According to the law, the average of the results obtained from a large number of trials should be close to the expected val
|
6,338
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
We're in the situation of estimating some population quantity by some sample quantity. In this case, we're using sample proportions to estimate population proportions, but the principle is considerably more general.
If you think of all the observations in your sample taking the value $1$ when they have the characteristic of interest ("preferred oranges to apples" in the example) and $0$ when they don't, then the proportion of $1$'s is the same as the mean of the set of $0$ and $1$ values -- so you can readily see that a sample proportion is actually a mean.
As we take larger and larger samples (using random sampling), the sample means will tend to converge to the population mean. (This is the law of large numbers.)
However what we really want to have some idea of is how far out we might be (such as might be represented by the width of a confidence interval for the proportion, or by the margin of error, which is normally half of such a width).
Typically, the more data you have, the less uncertainty you will have about some quantity like a mean -- because the standard deviation of the distribution of the sample mean decreases as you take larger samples. [Imagine taking means of many different samples of size 4. The distribution of those means is less variable than the distribution of the original observations-- the standard deviation should tend to be about half as big. Now if you take means of many different samples of size 400, the standard deviation of that should be much smaller again (about $\frac{_1}{^{20}}$th of the standard deviation of the original observations).
The standard deviation of the distribution of the sample mean is one way to measure the typical distance a sample mean is from the population mean, which is decreasing (it decreases as $\frac{_1}{^\sqrt{n}}$, as in the examples above).
As a result, we're more confident about the accuracy of our estimate when the sample is large -- if we repeated our experiment again, other such means would be close to the current one -- they cluster together more and more tightly, and because (in this case) our estimate is unbiased, they're clustering together around the values we're trying to estimate. A single sample mean becomes more and more informative about where the population mean might be.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
We're in the situation of estimating some population quantity by some sample quantity. In this case, we're using sample proportions to estimate population proportions, but the principle is considerabl
|
Why is 600 out of 1000 more convincing than 6 out of 10?
We're in the situation of estimating some population quantity by some sample quantity. In this case, we're using sample proportions to estimate population proportions, but the principle is considerably more general.
If you think of all the observations in your sample taking the value $1$ when they have the characteristic of interest ("preferred oranges to apples" in the example) and $0$ when they don't, then the proportion of $1$'s is the same as the mean of the set of $0$ and $1$ values -- so you can readily see that a sample proportion is actually a mean.
As we take larger and larger samples (using random sampling), the sample means will tend to converge to the population mean. (This is the law of large numbers.)
However what we really want to have some idea of is how far out we might be (such as might be represented by the width of a confidence interval for the proportion, or by the margin of error, which is normally half of such a width).
Typically, the more data you have, the less uncertainty you will have about some quantity like a mean -- because the standard deviation of the distribution of the sample mean decreases as you take larger samples. [Imagine taking means of many different samples of size 4. The distribution of those means is less variable than the distribution of the original observations-- the standard deviation should tend to be about half as big. Now if you take means of many different samples of size 400, the standard deviation of that should be much smaller again (about $\frac{_1}{^{20}}$th of the standard deviation of the original observations).
The standard deviation of the distribution of the sample mean is one way to measure the typical distance a sample mean is from the population mean, which is decreasing (it decreases as $\frac{_1}{^\sqrt{n}}$, as in the examples above).
As a result, we're more confident about the accuracy of our estimate when the sample is large -- if we repeated our experiment again, other such means would be close to the current one -- they cluster together more and more tightly, and because (in this case) our estimate is unbiased, they're clustering together around the values we're trying to estimate. A single sample mean becomes more and more informative about where the population mean might be.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
We're in the situation of estimating some population quantity by some sample quantity. In this case, we're using sample proportions to estimate population proportions, but the principle is considerabl
|
6,339
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
A rule of thumb for "counting" statistics, like counting the number of people that like oranges, or counting the number of "clicks" in a Geiger counter due to radioactive decay, is that the margin of error for the count is roughly the square-root of the expected count value. Counting statistics are known are Poisson statistics.
The square root of 6 is 2.4-ish, so the margin of error is about 40% (2.4/6). The square root of 600 is 24-ish, so the margin of error is about 4% (24/600). That is why having counted 600 is more significant that counting 6. The relative error is one-tenth.
I'm being a little sloppy about the definition of margin of error. It's really the 1-sigma value, and is not a hard cut-off, but it is the range where you expect most (68%) of the measurements to lie. So if you expect 6 orange eaters, you would expect a series of polls to give you mostly numbers in the 4 to 8 range, like 6,6,5,6,7,2,4,6,3,5,6,6,7,6,10,8,6,5,6,6,9,3,7,8.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
A rule of thumb for "counting" statistics, like counting the number of people that like oranges, or counting the number of "clicks" in a Geiger counter due to radioactive decay, is that the margin of
|
Why is 600 out of 1000 more convincing than 6 out of 10?
A rule of thumb for "counting" statistics, like counting the number of people that like oranges, or counting the number of "clicks" in a Geiger counter due to radioactive decay, is that the margin of error for the count is roughly the square-root of the expected count value. Counting statistics are known are Poisson statistics.
The square root of 6 is 2.4-ish, so the margin of error is about 40% (2.4/6). The square root of 600 is 24-ish, so the margin of error is about 4% (24/600). That is why having counted 600 is more significant that counting 6. The relative error is one-tenth.
I'm being a little sloppy about the definition of margin of error. It's really the 1-sigma value, and is not a hard cut-off, but it is the range where you expect most (68%) of the measurements to lie. So if you expect 6 orange eaters, you would expect a series of polls to give you mostly numbers in the 4 to 8 range, like 6,6,5,6,7,2,4,6,3,5,6,6,7,6,10,8,6,5,6,6,9,3,7,8.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
A rule of thumb for "counting" statistics, like counting the number of people that like oranges, or counting the number of "clicks" in a Geiger counter due to radioactive decay, is that the margin of
|
6,340
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
I don't have the name you're looking for, but the issue isn't statistical. Psychologically, the way humans process numbers in our brains give greater weight (authority) to larger numbers than it does to smaller numbers because the magnitude (physical size) is visually as important as the representative value. Thus, 600/1000 appears more credible than 6/10. This is why shoppers prefer to see "10% Off!" for values less than 100 and "Save $10!" for values over 100 (called the "Rule of 100"). It's about how our brains react to perception.
An amazing look into this and similar kinds of phenomena are discussed by Nick Kolenda in his online treatise, "An Enormous Guide to Pricing Psychology".
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
I don't have the name you're looking for, but the issue isn't statistical. Psychologically, the way humans process numbers in our brains give greater weight (authority) to larger numbers than it does
|
Why is 600 out of 1000 more convincing than 6 out of 10?
I don't have the name you're looking for, but the issue isn't statistical. Psychologically, the way humans process numbers in our brains give greater weight (authority) to larger numbers than it does to smaller numbers because the magnitude (physical size) is visually as important as the representative value. Thus, 600/1000 appears more credible than 6/10. This is why shoppers prefer to see "10% Off!" for values less than 100 and "Save $10!" for values over 100 (called the "Rule of 100"). It's about how our brains react to perception.
An amazing look into this and similar kinds of phenomena are discussed by Nick Kolenda in his online treatise, "An Enormous Guide to Pricing Psychology".
|
Why is 600 out of 1000 more convincing than 6 out of 10?
I don't have the name you're looking for, but the issue isn't statistical. Psychologically, the way humans process numbers in our brains give greater weight (authority) to larger numbers than it does
|
6,341
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
While the actual margin of error is important, the reason it sounds more convincing is because of a more heuristic (rule of thumb) experience with people. The actual margin of error confirms this heuristic has merit.
If the sample is 6 for, and 4 against, this could be 50/50 if a single person changes their vote, or a single person was recorded in error. There is only two more people on the 6 side. Everybody knows two flakes, everybody knows the sample could be cherry-picked: You only asked waitresses and nobody else. Or you only polled 10 college professors in the halls of a university. Or you asked 10 wealthy people outside of Saks Fifth Avenue.
Even the mathematical margin of error presumes true randomness and doesn't account for selection bias, or self-selection bias, or anything else, people can intuitively understand that.
In contrast, the 600 vs. 400 result has 200 more people on one side than the other, and 100 people would have to change their mind. Those numbers are very hard to come by (but not impossible) by some accident of where you were polling, how you got people to agree, how individuals understood or interpreted the question, etc.
It is more convincing not because of a mathematical proof that it should be, but because we know from experience that crowds of 1000 are much more likely to be diverse in their opinions (on anything) than a group of 10. (unless you secretly did your polling at a political party convention or a KKK rally or something else likely to draw a one-sided crowd).
The math only precisely quantifies what we already know by intuition; that it is easier to randomly encounter one or two stray votes out of 10, than it is to randomly encounter 100 or 200 stray votes out of 1000.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
While the actual margin of error is important, the reason it sounds more convincing is because of a more heuristic (rule of thumb) experience with people. The actual margin of error confirms this heur
|
Why is 600 out of 1000 more convincing than 6 out of 10?
While the actual margin of error is important, the reason it sounds more convincing is because of a more heuristic (rule of thumb) experience with people. The actual margin of error confirms this heuristic has merit.
If the sample is 6 for, and 4 against, this could be 50/50 if a single person changes their vote, or a single person was recorded in error. There is only two more people on the 6 side. Everybody knows two flakes, everybody knows the sample could be cherry-picked: You only asked waitresses and nobody else. Or you only polled 10 college professors in the halls of a university. Or you asked 10 wealthy people outside of Saks Fifth Avenue.
Even the mathematical margin of error presumes true randomness and doesn't account for selection bias, or self-selection bias, or anything else, people can intuitively understand that.
In contrast, the 600 vs. 400 result has 200 more people on one side than the other, and 100 people would have to change their mind. Those numbers are very hard to come by (but not impossible) by some accident of where you were polling, how you got people to agree, how individuals understood or interpreted the question, etc.
It is more convincing not because of a mathematical proof that it should be, but because we know from experience that crowds of 1000 are much more likely to be diverse in their opinions (on anything) than a group of 10. (unless you secretly did your polling at a political party convention or a KKK rally or something else likely to draw a one-sided crowd).
The math only precisely quantifies what we already know by intuition; that it is easier to randomly encounter one or two stray votes out of 10, than it is to randomly encounter 100 or 200 stray votes out of 1000.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
While the actual margin of error is important, the reason it sounds more convincing is because of a more heuristic (rule of thumb) experience with people. The actual margin of error confirms this heur
|
6,342
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
The short answer:
Basically it's more convincing to have 600 out of 1000 than six out of 10 because, given equal preferences it's far more likely for 6 out of 10 to occur by random chance.
Let's make an assumption - that the proportion who preferred oranges and apples are actually equal (so, 50% each). Call this a null hypothesis. Given these equal probabilities the likelihood of the two results are:
Given a sample of 10 people, there is a 38% chance of randomly getting a sample of 6 or more people who prefer oranges (which is not all that unlikely).
With a sample of 1000 people there is less than 1 in a billion chance of having 600 or more out of 1000 people prefer oranges.
(For simplicity I am assuming an infinite population from which to draw an unlimited number of samples).
A simple derivation
One way to derive this result is to simply list out the potential ways in which people can combine in our samples:
For ten people it's easy:
Consider drawing samples of 10 people at random from an infinite population of people with equal preferences for apples or oranges. With equal preferences it's easy to simply list all the potential combinations of 10 people:
Here's the full list.
r C (n=10) p
10 1 0.09766%
9 10 0.97656%
8 45 4.39453%
7 120 11.71875%
6 210 20.50781%
5 252 24.60938%
4 210 20.50781%
3 120 11.71875%
2 45 4.39453%
1 10 0.97656%
0 1 0.09766%
1024 100%
r is the number of results (people who prefer oranges), C is the number of possible ways of that many people preferring oranges, and p is the resulting discrete probability of that many people preferring oranges in our sample.
(p is just C divided by the total number of combinations. Note that there are 1024 ways of arranging these two preferences in total (i.e. 2 to the power of 10).
For instance there is only one way (one sample) for 10 people (r=10) to all prefer oranges. The same is true for all people preferring apples (r=0).
There are 10 different combinations resulting in nine of them preferring oranges. (One different person prefers apples in each sample).
There are 45 samples (combinations) where 2 people prefer apples, etc, etc.
(In general we talk about n C r combinations of results r from a sample of n people. There are online calculators you can use to verify
these numbers.)
This list allows us to gives us the probabilities above using just division. There is a 21% chance of getting 6 people in the sample that prefer oranges (210 of 1024 of the combinations). The chance of getting six or more people in our sample is 38% (the sum of all the samples with six or more people, or 386 out of 1024 combinations).
Graphically, the probabilities look like this:
With larger numbers, the number of potential combinations grows rapidly.
For a samples of just 20 people there are 1,048,576 possible
samples, all with equal likelihood. (Note: I have only shown every second combination below).
r C (n=20) p
20 1 0.00010%
18 190 0.01812%
16 4,845 0.46206%
14 38,760 3.69644%
12 125,970 12.01344%
10 184,756 17.61971%
8 125,970 12.01344%
6 38,760 3.69644%
4 4,845 0.46206%
2 190 0.01812%
0 1 0.00010%
1,048,576 100%
There is still only one sample where all 20 people prefer oranges. Combinations that feature mixed results are much more likely, simply because there are many more ways that the people in the samples can be combined.
Samples that are biased are much more unlikely, just because there are fewer combinations of people that can result in those samples:
With just 20 people in each sample, the cumulative probability of having 60% or more (12 or more) people in our sample preferring oranges
drops to just 25%.
The probability distribution can be seen to become thinner and taller:
With 1000 people the numbers are huge
We can extend the above examples to larger samples (but the numbers grow too rapidly for it to be feasible to list all the combinations),
instead I have calculated the probabilities in R:
r p (n=1000)
1000 9.332636e-302
900 5.958936e-162
800 6.175551e-86
700 5.065988e-38
600 4.633908e-11
500 0.02522502
400 4.633908e-11
300 5.065988e-38
200 6.175551e-86
100 5.958936e-162
0 9.332636e-302
The cumulative probability of having 600 or more out of 1000 people prefer oranges is just 1.364232e-10.
The probability distribution is now much more concentrated around the center:
[
(For example to calculate probability of exactly 600 out of 1000 people preferring oranges in R use dbinom(600, 1000, prob=0.5) which equals 4.633908e-11, and the probability of 600 or more people is 1-pbinom(599, 1000, prob=0.5), which equals 1.364232e-10 (less than 1 in a billion).
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
The short answer:
Basically it's more convincing to have 600 out of 1000 than six out of 10 because, given equal preferences it's far more likely for 6 out of 10 to occur by random chance.
Let's make
|
Why is 600 out of 1000 more convincing than 6 out of 10?
The short answer:
Basically it's more convincing to have 600 out of 1000 than six out of 10 because, given equal preferences it's far more likely for 6 out of 10 to occur by random chance.
Let's make an assumption - that the proportion who preferred oranges and apples are actually equal (so, 50% each). Call this a null hypothesis. Given these equal probabilities the likelihood of the two results are:
Given a sample of 10 people, there is a 38% chance of randomly getting a sample of 6 or more people who prefer oranges (which is not all that unlikely).
With a sample of 1000 people there is less than 1 in a billion chance of having 600 or more out of 1000 people prefer oranges.
(For simplicity I am assuming an infinite population from which to draw an unlimited number of samples).
A simple derivation
One way to derive this result is to simply list out the potential ways in which people can combine in our samples:
For ten people it's easy:
Consider drawing samples of 10 people at random from an infinite population of people with equal preferences for apples or oranges. With equal preferences it's easy to simply list all the potential combinations of 10 people:
Here's the full list.
r C (n=10) p
10 1 0.09766%
9 10 0.97656%
8 45 4.39453%
7 120 11.71875%
6 210 20.50781%
5 252 24.60938%
4 210 20.50781%
3 120 11.71875%
2 45 4.39453%
1 10 0.97656%
0 1 0.09766%
1024 100%
r is the number of results (people who prefer oranges), C is the number of possible ways of that many people preferring oranges, and p is the resulting discrete probability of that many people preferring oranges in our sample.
(p is just C divided by the total number of combinations. Note that there are 1024 ways of arranging these two preferences in total (i.e. 2 to the power of 10).
For instance there is only one way (one sample) for 10 people (r=10) to all prefer oranges. The same is true for all people preferring apples (r=0).
There are 10 different combinations resulting in nine of them preferring oranges. (One different person prefers apples in each sample).
There are 45 samples (combinations) where 2 people prefer apples, etc, etc.
(In general we talk about n C r combinations of results r from a sample of n people. There are online calculators you can use to verify
these numbers.)
This list allows us to gives us the probabilities above using just division. There is a 21% chance of getting 6 people in the sample that prefer oranges (210 of 1024 of the combinations). The chance of getting six or more people in our sample is 38% (the sum of all the samples with six or more people, or 386 out of 1024 combinations).
Graphically, the probabilities look like this:
With larger numbers, the number of potential combinations grows rapidly.
For a samples of just 20 people there are 1,048,576 possible
samples, all with equal likelihood. (Note: I have only shown every second combination below).
r C (n=20) p
20 1 0.00010%
18 190 0.01812%
16 4,845 0.46206%
14 38,760 3.69644%
12 125,970 12.01344%
10 184,756 17.61971%
8 125,970 12.01344%
6 38,760 3.69644%
4 4,845 0.46206%
2 190 0.01812%
0 1 0.00010%
1,048,576 100%
There is still only one sample where all 20 people prefer oranges. Combinations that feature mixed results are much more likely, simply because there are many more ways that the people in the samples can be combined.
Samples that are biased are much more unlikely, just because there are fewer combinations of people that can result in those samples:
With just 20 people in each sample, the cumulative probability of having 60% or more (12 or more) people in our sample preferring oranges
drops to just 25%.
The probability distribution can be seen to become thinner and taller:
With 1000 people the numbers are huge
We can extend the above examples to larger samples (but the numbers grow too rapidly for it to be feasible to list all the combinations),
instead I have calculated the probabilities in R:
r p (n=1000)
1000 9.332636e-302
900 5.958936e-162
800 6.175551e-86
700 5.065988e-38
600 4.633908e-11
500 0.02522502
400 4.633908e-11
300 5.065988e-38
200 6.175551e-86
100 5.958936e-162
0 9.332636e-302
The cumulative probability of having 600 or more out of 1000 people prefer oranges is just 1.364232e-10.
The probability distribution is now much more concentrated around the center:
[
(For example to calculate probability of exactly 600 out of 1000 people preferring oranges in R use dbinom(600, 1000, prob=0.5) which equals 4.633908e-11, and the probability of 600 or more people is 1-pbinom(599, 1000, prob=0.5), which equals 1.364232e-10 (less than 1 in a billion).
|
Why is 600 out of 1000 more convincing than 6 out of 10?
The short answer:
Basically it's more convincing to have 600 out of 1000 than six out of 10 because, given equal preferences it's far more likely for 6 out of 10 to occur by random chance.
Let's make
|
6,343
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
Something that has not been mentioned is to look at the problem from a Bayesian point of view.
In a Bayesian setting, a natural approach to this problem would be to use a Beta-Binomial distribution.
You can assume that the probability of someone preferring oranges over apples is $p$, which Beta distributed, and that the observations are binomially distributed with parameter $p$:
$$
p \sim \mathrm{Beta}(\alpha, \beta)\\
n_o|p \sim \mathrm{Bin}(n,p).
$$
Let's assume that you have no a-priori reason to believe that more people prefer oranges over apples or vice-versa ($\beta=\alpha$) but also that you have no strong opinion about this (weak prior: $\beta=\alpha=1$). The prior distribution of $p$ is therefore uniform $\mathrm{U}(0,1)$.
After collecting answers from $n$ questionnaires about people's preferences, you note that $n_o$ respondents prefer oranges and $n_a=n-n_o$ of them prefer apples.
The posterior distribution of $p$ is:
$$
p|n_o,n_a \sim \mathrm{Beta}(n_o+1, n_a+1).
$$
While the mode of the posterior of $p$ (i.e. the maximum-a-posteriori) is $n_o/(n_o+n_a)$ regardless of the number of respondents, the distribution itself is very different: it is much more peaked for large $n$ than for small ones.
To give you an idea, this is the posterior with $n_o=6$ and $n_a=4$:
While this is the posterior with $n_o=600$ and $n_a=400$:
How do you read these plots? You can reason as follows: "I observe that 6 out of 10 people (randomly chosen from the population) prefer oranges over apples but could the true underlying probability (for the whole population) be 0.4 or 0.8 instead? Well, according to the first plot this is quite possible."
If you do the same for the second plot (i.e. with 1000 respondents), you get that $p=0.4$ or $p=0.8$ are very very unlikely (again, I am assuming the 1000 are IID samples from the population).
Please note that although these plots look similar to david25272's, they represent something very different.
His plots ask the question: "assuming a given value of $p$ known, what is the probability of observing $n_o$ people responding that they prefer oranges over apples?"
My plots answer the question: "assuming that I observe $n_o$ people responding that they prefer oranges over apples, what is the probability distribution of $p$, the probability of people preferring oranges over apples?"
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
Something that has not been mentioned is to look at the problem from a Bayesian point of view.
In a Bayesian setting, a natural approach to this problem would be to use a Beta-Binomial distribution.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
Something that has not been mentioned is to look at the problem from a Bayesian point of view.
In a Bayesian setting, a natural approach to this problem would be to use a Beta-Binomial distribution.
You can assume that the probability of someone preferring oranges over apples is $p$, which Beta distributed, and that the observations are binomially distributed with parameter $p$:
$$
p \sim \mathrm{Beta}(\alpha, \beta)\\
n_o|p \sim \mathrm{Bin}(n,p).
$$
Let's assume that you have no a-priori reason to believe that more people prefer oranges over apples or vice-versa ($\beta=\alpha$) but also that you have no strong opinion about this (weak prior: $\beta=\alpha=1$). The prior distribution of $p$ is therefore uniform $\mathrm{U}(0,1)$.
After collecting answers from $n$ questionnaires about people's preferences, you note that $n_o$ respondents prefer oranges and $n_a=n-n_o$ of them prefer apples.
The posterior distribution of $p$ is:
$$
p|n_o,n_a \sim \mathrm{Beta}(n_o+1, n_a+1).
$$
While the mode of the posterior of $p$ (i.e. the maximum-a-posteriori) is $n_o/(n_o+n_a)$ regardless of the number of respondents, the distribution itself is very different: it is much more peaked for large $n$ than for small ones.
To give you an idea, this is the posterior with $n_o=6$ and $n_a=4$:
While this is the posterior with $n_o=600$ and $n_a=400$:
How do you read these plots? You can reason as follows: "I observe that 6 out of 10 people (randomly chosen from the population) prefer oranges over apples but could the true underlying probability (for the whole population) be 0.4 or 0.8 instead? Well, according to the first plot this is quite possible."
If you do the same for the second plot (i.e. with 1000 respondents), you get that $p=0.4$ or $p=0.8$ are very very unlikely (again, I am assuming the 1000 are IID samples from the population).
Please note that although these plots look similar to david25272's, they represent something very different.
His plots ask the question: "assuming a given value of $p$ known, what is the probability of observing $n_o$ people responding that they prefer oranges over apples?"
My plots answer the question: "assuming that I observe $n_o$ people responding that they prefer oranges over apples, what is the probability distribution of $p$, the probability of people preferring oranges over apples?"
|
Why is 600 out of 1000 more convincing than 6 out of 10?
Something that has not been mentioned is to look at the problem from a Bayesian point of view.
In a Bayesian setting, a natural approach to this problem would be to use a Beta-Binomial distribution.
|
6,344
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
This is because higher number ensures greater accuracy. For ex, if u would pick up 1000 random people from anywhere on the planet and 599 of them are male against 10 random people with 6 male, the former would be more accurate. Similarly, if you assume a population of 7 billion and calculate the number of males, you would get a more precise number which would obviously be more convincing than with just 1000 people.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
|
This is because higher number ensures greater accuracy. For ex, if u would pick up 1000 random people from anywhere on the planet and 599 of them are male against 10 random people with 6 male, the for
|
Why is 600 out of 1000 more convincing than 6 out of 10?
This is because higher number ensures greater accuracy. For ex, if u would pick up 1000 random people from anywhere on the planet and 599 of them are male against 10 random people with 6 male, the former would be more accurate. Similarly, if you assume a population of 7 billion and calculate the number of males, you would get a more precise number which would obviously be more convincing than with just 1000 people.
|
Why is 600 out of 1000 more convincing than 6 out of 10?
This is because higher number ensures greater accuracy. For ex, if u would pick up 1000 random people from anywhere on the planet and 599 of them are male against 10 random people with 6 male, the for
|
6,345
|
The Monty Hall Problem - where does our intuition fail us?
|
Consider two simple variations of the problem:
No doors are opened for the contestant. The host offers no help in picking a door. In this case it is obvious that the odds of picking the correct door are 1/3.
Before the contestant is asked to venture a guess, the host opens a door and reveals a goat. After the host reveals a goat, the contestant has to pick the car from the two remaining doors. In this case it is obvious that the odds of picking the correct door is 1/2.
For a contestant to know the probability of his door choice being correct, he has to know how many positive outcomes are available to him and divide that number by the amount of possible outcomes. Because of the two simple cases outlined above, it is very natural to think of all the possible outcomes available as the number of doors to choose from, and the amount of positive outcomes as the number of doors that conceal a car. Given this intuitive assumption, even if the host opens a door to reveal a goat after the contestant makes a guess, the probability of either door containing a car remains 1/2.
In reality, probability recognizes a set of possible outcomes larger than the three doors and it recognizes a set of positive outcomes that is larger than the singular door with the car. In the correct analysis of the problem, the host provides the contestant with new information making a new question to be addressed: what is the probability that my original guess is such that the new information provided by the host is sufficient to inform me of the correct door? In answering this question, the set of positive outcomes and the set of possible outcomes are not tangible doors and cars but rather abstract arrangements of the goats and car. The three possible outcomes are the three possible arrangements of two goats and one car behind three doors. The two positive outcomes are the two possible arrangements where the first guess of the contestant is false. In each of these two arrangements, the information given by the host (one of the two remaining doors is empty) is sufficient for the contestant to determine the door that conceals the car.
In summation:
We have a tendency to look for a simple mapping between physical manifestations of our choices (the doors and the cars) and the number of possible outcomes and desired outcomes in a question of probability. This works fine in cases where no new information is provided to the contestant. However, if the contestant is provided with more information (ie one of the doors you didn't choose is certainly not a car), this mapping breaks down and the correct question to be asked is found to be more abstract.
|
The Monty Hall Problem - where does our intuition fail us?
|
Consider two simple variations of the problem:
No doors are opened for the contestant. The host offers no help in picking a door. In this case it is obvious that the odds of picking the correct door
|
The Monty Hall Problem - where does our intuition fail us?
Consider two simple variations of the problem:
No doors are opened for the contestant. The host offers no help in picking a door. In this case it is obvious that the odds of picking the correct door are 1/3.
Before the contestant is asked to venture a guess, the host opens a door and reveals a goat. After the host reveals a goat, the contestant has to pick the car from the two remaining doors. In this case it is obvious that the odds of picking the correct door is 1/2.
For a contestant to know the probability of his door choice being correct, he has to know how many positive outcomes are available to him and divide that number by the amount of possible outcomes. Because of the two simple cases outlined above, it is very natural to think of all the possible outcomes available as the number of doors to choose from, and the amount of positive outcomes as the number of doors that conceal a car. Given this intuitive assumption, even if the host opens a door to reveal a goat after the contestant makes a guess, the probability of either door containing a car remains 1/2.
In reality, probability recognizes a set of possible outcomes larger than the three doors and it recognizes a set of positive outcomes that is larger than the singular door with the car. In the correct analysis of the problem, the host provides the contestant with new information making a new question to be addressed: what is the probability that my original guess is such that the new information provided by the host is sufficient to inform me of the correct door? In answering this question, the set of positive outcomes and the set of possible outcomes are not tangible doors and cars but rather abstract arrangements of the goats and car. The three possible outcomes are the three possible arrangements of two goats and one car behind three doors. The two positive outcomes are the two possible arrangements where the first guess of the contestant is false. In each of these two arrangements, the information given by the host (one of the two remaining doors is empty) is sufficient for the contestant to determine the door that conceals the car.
In summation:
We have a tendency to look for a simple mapping between physical manifestations of our choices (the doors and the cars) and the number of possible outcomes and desired outcomes in a question of probability. This works fine in cases where no new information is provided to the contestant. However, if the contestant is provided with more information (ie one of the doors you didn't choose is certainly not a car), this mapping breaks down and the correct question to be asked is found to be more abstract.
|
The Monty Hall Problem - where does our intuition fail us?
Consider two simple variations of the problem:
No doors are opened for the contestant. The host offers no help in picking a door. In this case it is obvious that the odds of picking the correct door
|
6,346
|
The Monty Hall Problem - where does our intuition fail us?
|
To answer the original question: Our intuition fails because of the narrative. By relating the story in the same order as the tv script, we get confused. It gets much easier if we think about what is going to happen in advance. The quiz-master will reveal a goat, so our best chance is to select a door with a goat and then switch. The storyline puts a lot of emphasis on the loss caused by our action in that one out of three chance that we happen to select the car.
The original answer:
Our aim is to eliminate both goats. We do this by marking one goat ourselves. The quizmaster is then forced to choose between revealing the car or the other goat. Revealing the car is out of the question, so the quizmaster will reveal and eliminate the one goat we did not know about. We then switch to the remaining door, thereby eliminating the goat we marked with our first choice, and get the car.
This strategy only fails if we do not mark a goat, but the car instead. But that is unlikely: there are two goats and only one car.
So we have a chance of 2 in 3 to win the car.
|
The Monty Hall Problem - where does our intuition fail us?
|
To answer the original question: Our intuition fails because of the narrative. By relating the story in the same order as the tv script, we get confused. It gets much easier if we think about what i
|
The Monty Hall Problem - where does our intuition fail us?
To answer the original question: Our intuition fails because of the narrative. By relating the story in the same order as the tv script, we get confused. It gets much easier if we think about what is going to happen in advance. The quiz-master will reveal a goat, so our best chance is to select a door with a goat and then switch. The storyline puts a lot of emphasis on the loss caused by our action in that one out of three chance that we happen to select the car.
The original answer:
Our aim is to eliminate both goats. We do this by marking one goat ourselves. The quizmaster is then forced to choose between revealing the car or the other goat. Revealing the car is out of the question, so the quizmaster will reveal and eliminate the one goat we did not know about. We then switch to the remaining door, thereby eliminating the goat we marked with our first choice, and get the car.
This strategy only fails if we do not mark a goat, but the car instead. But that is unlikely: there are two goats and only one car.
So we have a chance of 2 in 3 to win the car.
|
The Monty Hall Problem - where does our intuition fail us?
To answer the original question: Our intuition fails because of the narrative. By relating the story in the same order as the tv script, we get confused. It gets much easier if we think about what i
|
6,347
|
The Monty Hall Problem - where does our intuition fail us?
|
I find that people find the solution more intuitive if you change it to 100 doors, close first, second, to 98 doors. Similarly for 50 doors, etc.
|
The Monty Hall Problem - where does our intuition fail us?
|
I find that people find the solution more intuitive if you change it to 100 doors, close first, second, to 98 doors. Similarly for 50 doors, etc.
|
The Monty Hall Problem - where does our intuition fail us?
I find that people find the solution more intuitive if you change it to 100 doors, close first, second, to 98 doors. Similarly for 50 doors, etc.
|
The Monty Hall Problem - where does our intuition fail us?
I find that people find the solution more intuitive if you change it to 100 doors, close first, second, to 98 doors. Similarly for 50 doors, etc.
|
6,348
|
The Monty Hall Problem - where does our intuition fail us?
|
The answer is not, "of course YES!" The correct answer is, "I don't know, can you be more specific?"
The only reason why you think it is correct, is because Marliyn vos Savant said so. Her original answer to the question (although the question was widely know before her) appeared in Parade magazine on September 9, 1990. she wrote that the "correct" answer to this question was to switch doors, because switching doors gave you a higher probability of winning the car (2/3 instead of 1/3). She got lots of responses from Mathematics PhDs and other intelligent people that said she was wrong (although many of them were incorrect too).
Suppose you're on a game show, and you're given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say #1, and the host, who knows what's behind the doors, opens another door, say #3, which has a goat. He says to you, "Do you want to pick door #2?" Is it to your advantage to switch your choice of doors? — Craig F. Whitaker Columbia, Maryland
I have bolded the important part of this logic question. What is ambiguous in that statement is:
Does Monty Hall always open a door? (What would it be to your advantage to switch doors if he only opened a losing door when you picked a winning door? Answer: No)
Does Monty Hall always open a losing door? (The question specifies that he knows where the car is, and this particular time he showed a goat behind one. What would your chances be if he randomly opened a door? i.e. The Monty Fall question or what if sometimes he chooses to show winning doors.)
Does Monty Hall always open a door you did not pick?
The basics of this logic puzzle have been repeated more than once, and many times they aren't specified well enough to give the "correct" answer of 2/3.
A shopkeeper says she has two new baby beagles to show you, but she doesn't know whether they're male, female, or a pair. You tell her that you want only a male, and she telephones the fellow who's giving them a bath. "Is at least one a male?" she asks him. "Yes!" she informs you with a smile. What is the probability that the other one is a male? — Stephen I. Geller, Pasadena, California
Did the fellow look at both dogs before responding "Yes," or did he pick up a random dog and discovered it was a male and then responded "Yes."
Say that a woman and a man (who are unrelated) each has two children. We know that at least one of the woman's children is a boy and that the man's oldest child is a boy. Can you explain why the chances that the woman has two boys do not equal the chances that the man has two boys? My algebra teacher insists that the probability is greater that the man has two boys, but I think the chances may be the same. What do you think?
How do we know that the women has at least one boy? Did we look over the fence one day, and see one of them? (Answer: 50%, same as man)
The question has even tripped up our very own Jeff Atwood. He posed this question:
Let's say, hypothetically speaking, you met someone who told you they had two children, and one of them is a girl. What are the odds that person has a boy and a girl?
Jeff goes on to argue that it was a simple question, asked in simple language and brushes aside the objections of some that say that the question is incorrectly worded if you want the answer to be 2/3.
More importantly though, is why the woman volunteered the information. If she was speaking the way normal people do, when some one says "one of them is a girl," inevitably the other is a boy. If we are to assume this is a logic question, with the intent of tripping us up, we should ask that the question is more clearly defined. Did the woman volunteer the sex of one of her children, randomly selected, or is she talking about the set of her two children.
It is clear that the question is poorly worded, but people don't realize it. When similar questions are asked, where the odds are much greater to switch, people either realize that it must be a trick (and question the motive of the host), or get the "correct" answer of switching as in the one hundred doors question. This is further supported by the fact that doctors when asked about the likelihood of a woman having a particular disease after testing positive (they need to determine if she has the disease, or it is a false positive), they are better at arriving at the correct answer, depending upon how the question is phrased. There is a wonderful TED Talk that half way through covers this very case.
He described the probabilities associated with a breast cancer test: 1% of women tested have the disease, and the test is 90 percent accurate, with a 9% false positive rate. With all that information, what do you tell a woman who tests positive about the likelihood they have the disease?
If it helps, here’s the same question phrased another way:
100 out of 10,000 women at age forty who participate in routine screening have breast cancer. 90 of every 100 women with breast cancer will get a positive mammography. 891 out of 9,900 women without breast cancer will also get a positive mammography. If 10,000 women in this age group undergo a routine screening, about what percentage of women with positive mammographies will actually have breast cancer?
|
The Monty Hall Problem - where does our intuition fail us?
|
The answer is not, "of course YES!" The correct answer is, "I don't know, can you be more specific?"
The only reason why you think it is correct, is because Marliyn vos Savant said so. Her original an
|
The Monty Hall Problem - where does our intuition fail us?
The answer is not, "of course YES!" The correct answer is, "I don't know, can you be more specific?"
The only reason why you think it is correct, is because Marliyn vos Savant said so. Her original answer to the question (although the question was widely know before her) appeared in Parade magazine on September 9, 1990. she wrote that the "correct" answer to this question was to switch doors, because switching doors gave you a higher probability of winning the car (2/3 instead of 1/3). She got lots of responses from Mathematics PhDs and other intelligent people that said she was wrong (although many of them were incorrect too).
Suppose you're on a game show, and you're given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say #1, and the host, who knows what's behind the doors, opens another door, say #3, which has a goat. He says to you, "Do you want to pick door #2?" Is it to your advantage to switch your choice of doors? — Craig F. Whitaker Columbia, Maryland
I have bolded the important part of this logic question. What is ambiguous in that statement is:
Does Monty Hall always open a door? (What would it be to your advantage to switch doors if he only opened a losing door when you picked a winning door? Answer: No)
Does Monty Hall always open a losing door? (The question specifies that he knows where the car is, and this particular time he showed a goat behind one. What would your chances be if he randomly opened a door? i.e. The Monty Fall question or what if sometimes he chooses to show winning doors.)
Does Monty Hall always open a door you did not pick?
The basics of this logic puzzle have been repeated more than once, and many times they aren't specified well enough to give the "correct" answer of 2/3.
A shopkeeper says she has two new baby beagles to show you, but she doesn't know whether they're male, female, or a pair. You tell her that you want only a male, and she telephones the fellow who's giving them a bath. "Is at least one a male?" she asks him. "Yes!" she informs you with a smile. What is the probability that the other one is a male? — Stephen I. Geller, Pasadena, California
Did the fellow look at both dogs before responding "Yes," or did he pick up a random dog and discovered it was a male and then responded "Yes."
Say that a woman and a man (who are unrelated) each has two children. We know that at least one of the woman's children is a boy and that the man's oldest child is a boy. Can you explain why the chances that the woman has two boys do not equal the chances that the man has two boys? My algebra teacher insists that the probability is greater that the man has two boys, but I think the chances may be the same. What do you think?
How do we know that the women has at least one boy? Did we look over the fence one day, and see one of them? (Answer: 50%, same as man)
The question has even tripped up our very own Jeff Atwood. He posed this question:
Let's say, hypothetically speaking, you met someone who told you they had two children, and one of them is a girl. What are the odds that person has a boy and a girl?
Jeff goes on to argue that it was a simple question, asked in simple language and brushes aside the objections of some that say that the question is incorrectly worded if you want the answer to be 2/3.
More importantly though, is why the woman volunteered the information. If she was speaking the way normal people do, when some one says "one of them is a girl," inevitably the other is a boy. If we are to assume this is a logic question, with the intent of tripping us up, we should ask that the question is more clearly defined. Did the woman volunteer the sex of one of her children, randomly selected, or is she talking about the set of her two children.
It is clear that the question is poorly worded, but people don't realize it. When similar questions are asked, where the odds are much greater to switch, people either realize that it must be a trick (and question the motive of the host), or get the "correct" answer of switching as in the one hundred doors question. This is further supported by the fact that doctors when asked about the likelihood of a woman having a particular disease after testing positive (they need to determine if she has the disease, or it is a false positive), they are better at arriving at the correct answer, depending upon how the question is phrased. There is a wonderful TED Talk that half way through covers this very case.
He described the probabilities associated with a breast cancer test: 1% of women tested have the disease, and the test is 90 percent accurate, with a 9% false positive rate. With all that information, what do you tell a woman who tests positive about the likelihood they have the disease?
If it helps, here’s the same question phrased another way:
100 out of 10,000 women at age forty who participate in routine screening have breast cancer. 90 of every 100 women with breast cancer will get a positive mammography. 891 out of 9,900 women without breast cancer will also get a positive mammography. If 10,000 women in this age group undergo a routine screening, about what percentage of women with positive mammographies will actually have breast cancer?
|
The Monty Hall Problem - where does our intuition fail us?
The answer is not, "of course YES!" The correct answer is, "I don't know, can you be more specific?"
The only reason why you think it is correct, is because Marliyn vos Savant said so. Her original an
|
6,349
|
The Monty Hall Problem - where does our intuition fail us?
|
I'd modify what Graham Cookson said slightly. I think the really crucial thing that people overlook is not their first choice, but the host's choice, and the assumption that the host made sure not to reveal the car.
In fact, when I discuss this problem in a class, I present it in part as a case study in being clear on your assumptions. It is to your advantage to switch if the host is making sure only to reveal a goat. On the other hand, if the host picked randomly between doors 2 and 3, and happened to reveal a goat, then there is no advantage to switching.
(Of course, the practical upshot is that if you don't know the host's strategy, you should switch anyway.)
|
The Monty Hall Problem - where does our intuition fail us?
|
I'd modify what Graham Cookson said slightly. I think the really crucial thing that people overlook is not their first choice, but the host's choice, and the assumption that the host made sure not to
|
The Monty Hall Problem - where does our intuition fail us?
I'd modify what Graham Cookson said slightly. I think the really crucial thing that people overlook is not their first choice, but the host's choice, and the assumption that the host made sure not to reveal the car.
In fact, when I discuss this problem in a class, I present it in part as a case study in being clear on your assumptions. It is to your advantage to switch if the host is making sure only to reveal a goat. On the other hand, if the host picked randomly between doors 2 and 3, and happened to reveal a goat, then there is no advantage to switching.
(Of course, the practical upshot is that if you don't know the host's strategy, you should switch anyway.)
|
The Monty Hall Problem - where does our intuition fail us?
I'd modify what Graham Cookson said slightly. I think the really crucial thing that people overlook is not their first choice, but the host's choice, and the assumption that the host made sure not to
|
6,350
|
The Monty Hall Problem - where does our intuition fail us?
|
I agree that students find this problem very difficult. The typical response I get is that after you've been shown a goat there's a 50:50 chance of getting the car so why does it matter? Students seem to divorce their first choice from the decision they're now being asked to make i.e. they view these two actions as independent. I then remind them that they were twice as likely to have chosen the wrong door initially hence why they're better off switching.
In recent years I've started actually playing the game in glass and it helps students to understand the problem much better. I use three cardboard toilet roll "middles" and in two of them are paper clips and in the third is a £5 note.
|
The Monty Hall Problem - where does our intuition fail us?
|
I agree that students find this problem very difficult. The typical response I get is that after you've been shown a goat there's a 50:50 chance of getting the car so why does it matter? Students seem
|
The Monty Hall Problem - where does our intuition fail us?
I agree that students find this problem very difficult. The typical response I get is that after you've been shown a goat there's a 50:50 chance of getting the car so why does it matter? Students seem to divorce their first choice from the decision they're now being asked to make i.e. they view these two actions as independent. I then remind them that they were twice as likely to have chosen the wrong door initially hence why they're better off switching.
In recent years I've started actually playing the game in glass and it helps students to understand the problem much better. I use three cardboard toilet roll "middles" and in two of them are paper clips and in the third is a £5 note.
|
The Monty Hall Problem - where does our intuition fail us?
I agree that students find this problem very difficult. The typical response I get is that after you've been shown a goat there's a 50:50 chance of getting the car so why does it matter? Students seem
|
6,351
|
The Monty Hall Problem - where does our intuition fail us?
|
I believe that it's more a question of logic than a difficulty with probability that makes the Monty Hall solution surprising. Consider the following description of the problem.
You decide at home, before going to the TV show, if you are going to switch doors or stick with your first choice, whatever happens during the show. That is, you choose between strategies "Stay" or "Switch" before you play the game. There is no uncertainty involved in this choice of strategy. There is no need to introduce probabilities yet.
Let's understand the differences between the two strategies. Again, we'll not talk about probabilities.
Under strategy "Stay", you win if and only if your first choice is the "good" door. On the other hand, under strategy "Switch", you win if and only if your first choice is a "bad" door. Please, think carefully about these two cases for a minute, specially the second one. Again, notice that we didn't talk about probabilities yet. It is just a matter of logic.
Now let's talk about probabilities. Supposing that you initially assigned probability $1/3$ to the prize being behind each door, it is clear that under strategy "Stay" your probability of winning is $1/3$ (it is the probability of choosing the "good" door). But, under strategy "Switch" your probability of winning is $2/3$ (it is the probability of choosing a "bad" door). And that's why strategy "Switch" is better.
P.S. In 1990, Prof. Larry Denenberg sent a letter to TV show host Monty Hall asking for his permission to use in a book his name in the description of the well known three doors problem.
Here is an image of part of Monty's reply to that letter, where we can read:
"as I see it, it wouldn't make any difference after the player has selected Door A, and having been shown Door C - why should he then attempt to switch to Door B?"
Therefore, we can safely conclude that Monty Hall (the man himself) didn't understand the Monty Hall problem!
Monte Carlo (Monty Carlo?) simulation in Python:
import random
def rnd_door(doors):
return random.choice(list(doors))
N = 10**5
switch = True # False to stay
doors = set("ABC")
wins = 0
for _ in range(N):
prize = rnd_door(doors)
me = rnd_door(doors)
monty = rnd_door(doors - {prize, me})
if (switch):
me = (doors - {me, monty}).pop()
wins += (prize == me)
print(wins / N)
|
The Monty Hall Problem - where does our intuition fail us?
|
I believe that it's more a question of logic than a difficulty with probability that makes the Monty Hall solution surprising. Consider the following description of the problem.
You decide at home, be
|
The Monty Hall Problem - where does our intuition fail us?
I believe that it's more a question of logic than a difficulty with probability that makes the Monty Hall solution surprising. Consider the following description of the problem.
You decide at home, before going to the TV show, if you are going to switch doors or stick with your first choice, whatever happens during the show. That is, you choose between strategies "Stay" or "Switch" before you play the game. There is no uncertainty involved in this choice of strategy. There is no need to introduce probabilities yet.
Let's understand the differences between the two strategies. Again, we'll not talk about probabilities.
Under strategy "Stay", you win if and only if your first choice is the "good" door. On the other hand, under strategy "Switch", you win if and only if your first choice is a "bad" door. Please, think carefully about these two cases for a minute, specially the second one. Again, notice that we didn't talk about probabilities yet. It is just a matter of logic.
Now let's talk about probabilities. Supposing that you initially assigned probability $1/3$ to the prize being behind each door, it is clear that under strategy "Stay" your probability of winning is $1/3$ (it is the probability of choosing the "good" door). But, under strategy "Switch" your probability of winning is $2/3$ (it is the probability of choosing a "bad" door). And that's why strategy "Switch" is better.
P.S. In 1990, Prof. Larry Denenberg sent a letter to TV show host Monty Hall asking for his permission to use in a book his name in the description of the well known three doors problem.
Here is an image of part of Monty's reply to that letter, where we can read:
"as I see it, it wouldn't make any difference after the player has selected Door A, and having been shown Door C - why should he then attempt to switch to Door B?"
Therefore, we can safely conclude that Monty Hall (the man himself) didn't understand the Monty Hall problem!
Monte Carlo (Monty Carlo?) simulation in Python:
import random
def rnd_door(doors):
return random.choice(list(doors))
N = 10**5
switch = True # False to stay
doors = set("ABC")
wins = 0
for _ in range(N):
prize = rnd_door(doors)
me = rnd_door(doors)
monty = rnd_door(doors - {prize, me})
if (switch):
me = (doors - {me, monty}).pop()
wins += (prize == me)
print(wins / N)
|
The Monty Hall Problem - where does our intuition fail us?
I believe that it's more a question of logic than a difficulty with probability that makes the Monty Hall solution surprising. Consider the following description of the problem.
You decide at home, be
|
6,352
|
The Monty Hall Problem - where does our intuition fail us?
|
One does not need to know about conditional probability or Bayes Theorem to figure out that it is best to switch your answer.
Suppose you initially pick Door 1. Then the probability of Door 1 being a winner is 1/3 and the probability of Doors 2 or 3 being a winner is 2/3. If Door 2 is shown to be a loser by the host's choice then the probabilty that 2 or 3 is a winner is still 2/3. But since Door 2 is a loser, Door 3 must have a 2/3 probability of being a winner.
|
The Monty Hall Problem - where does our intuition fail us?
|
One does not need to know about conditional probability or Bayes Theorem to figure out that it is best to switch your answer.
Suppose you initially pick Door 1. Then the probability of Door 1 being
|
The Monty Hall Problem - where does our intuition fail us?
One does not need to know about conditional probability or Bayes Theorem to figure out that it is best to switch your answer.
Suppose you initially pick Door 1. Then the probability of Door 1 being a winner is 1/3 and the probability of Doors 2 or 3 being a winner is 2/3. If Door 2 is shown to be a loser by the host's choice then the probabilty that 2 or 3 is a winner is still 2/3. But since Door 2 is a loser, Door 3 must have a 2/3 probability of being a winner.
|
The Monty Hall Problem - where does our intuition fail us?
One does not need to know about conditional probability or Bayes Theorem to figure out that it is best to switch your answer.
Suppose you initially pick Door 1. Then the probability of Door 1 being
|
6,353
|
The Monty Hall Problem - where does our intuition fail us?
|
The lesson? Reformulate the question, and search for a strategy instead of looking at the situation. Turn the thing on its head, work backwards...
People are generally bad at working with chance. Animals typically fare better, once they discover that either A or B gives a higher payout on average; they stick to the choice with the better average. (don't have a reference ready - sorry.)
The first thing people are tempted to do when seeing a 80/20 distribution, is to spread their choices to match the pay-out: 80% on the better choice, and 20% on the other.
This will result in a pay-out of 68%.
Again, there is a valid scenario for people to choose such a strategy: If the odds shift over time, there's a good reason for sending out a probe and try the choice with the lower chance of success.
An important part of mathematical statistics actually studies the behaviour of processes to determine whether they are random or not.
|
The Monty Hall Problem - where does our intuition fail us?
|
The lesson? Reformulate the question, and search for a strategy instead of looking at the situation. Turn the thing on its head, work backwards...
People are generally bad at working with chance. A
|
The Monty Hall Problem - where does our intuition fail us?
The lesson? Reformulate the question, and search for a strategy instead of looking at the situation. Turn the thing on its head, work backwards...
People are generally bad at working with chance. Animals typically fare better, once they discover that either A or B gives a higher payout on average; they stick to the choice with the better average. (don't have a reference ready - sorry.)
The first thing people are tempted to do when seeing a 80/20 distribution, is to spread their choices to match the pay-out: 80% on the better choice, and 20% on the other.
This will result in a pay-out of 68%.
Again, there is a valid scenario for people to choose such a strategy: If the odds shift over time, there's a good reason for sending out a probe and try the choice with the lower chance of success.
An important part of mathematical statistics actually studies the behaviour of processes to determine whether they are random or not.
|
The Monty Hall Problem - where does our intuition fail us?
The lesson? Reformulate the question, and search for a strategy instead of looking at the situation. Turn the thing on its head, work backwards...
People are generally bad at working with chance. A
|
6,354
|
The Monty Hall Problem - where does our intuition fail us?
|
I think there are several things going on.
For one, the setup implies more information then the solution takes into account. That it is a game show, and the host is asking us if we want to switch.
If you assume the host does not want the show to spend extra money (which is reasonable), then you would assume he would try to convince you to change if you had the right door.
This is a common sense way of looking at the problem that can confuse people, however I do think the main issue is not understanding how the new choice is different then the first (which is more clear in the 100 door case).
|
The Monty Hall Problem - where does our intuition fail us?
|
I think there are several things going on.
For one, the setup implies more information then the solution takes into account. That it is a game show, and the host is asking us if we want to switch.
If
|
The Monty Hall Problem - where does our intuition fail us?
I think there are several things going on.
For one, the setup implies more information then the solution takes into account. That it is a game show, and the host is asking us if we want to switch.
If you assume the host does not want the show to spend extra money (which is reasonable), then you would assume he would try to convince you to change if you had the right door.
This is a common sense way of looking at the problem that can confuse people, however I do think the main issue is not understanding how the new choice is different then the first (which is more clear in the 100 door case).
|
The Monty Hall Problem - where does our intuition fail us?
I think there are several things going on.
For one, the setup implies more information then the solution takes into account. That it is a game show, and the host is asking us if we want to switch.
If
|
6,355
|
The Monty Hall Problem - where does our intuition fail us?
|
I'll quote this great article on lesswrong:
The possible hypotheses are Car in Door 1, Car in Door 2, and Car in
Door 3; before the game starts, there is no reason to believe any of
the three doors is more likely than the others to contain the car, and
so each of these hypotheses has prior probability 1/3.
The game begins with our selection of a door. That itself isn't
evidence about where the car is, of course -- we're assuming we have
no particular information about that, other than that it's behind one
of the doors (that's the whole point of the game!). Once we've done
that, however, we will then have the opportunity to "run a test" to
gain some "experimental data": the host will perform his task of
opening a door that is guaranteed to contain a goat. We'll represent
the result Host Opens Door 1 by a triangle, the result Host Opens Door
2 by a square, and the result Host Opens Door 3 by a pentagon -- thus
carving up our hypothesis space more finely into possibilities such as
"Car in Door 1 and Host Opens Door 2" , "Car in Door 1 and Host Opens
Door 3", etc:
Before we've made our initial selection of a door, the host is equally
likely to open either of the goat-containing doors. Thus, at the
beginning of the game, the probability of each hypothesis of the form
"Car in Door X and Host Opens Door Y" has a probability of 1/6, as
shown. So far, so good; everything is still perfectly correct.
Now we select a door; say we choose Door 2. The host then opens either
Door 1 or Door 3, to reveal a goat. Let's suppose he opens Door 1; our
diagram now looks like this:
But this shows equal probabilities of the car being behind Door 2 and
Door 3!
Did you catch the mistake?
There you go, this is how your intuition fails you.
Check out the correct solution the in the full article. It includes :
Explanation of the Bayes theorem
Wrong approach of Monty Hall
Right approach of Monty Hall
More problems...
|
The Monty Hall Problem - where does our intuition fail us?
|
I'll quote this great article on lesswrong:
The possible hypotheses are Car in Door 1, Car in Door 2, and Car in
Door 3; before the game starts, there is no reason to believe any of
the three doo
|
The Monty Hall Problem - where does our intuition fail us?
I'll quote this great article on lesswrong:
The possible hypotheses are Car in Door 1, Car in Door 2, and Car in
Door 3; before the game starts, there is no reason to believe any of
the three doors is more likely than the others to contain the car, and
so each of these hypotheses has prior probability 1/3.
The game begins with our selection of a door. That itself isn't
evidence about where the car is, of course -- we're assuming we have
no particular information about that, other than that it's behind one
of the doors (that's the whole point of the game!). Once we've done
that, however, we will then have the opportunity to "run a test" to
gain some "experimental data": the host will perform his task of
opening a door that is guaranteed to contain a goat. We'll represent
the result Host Opens Door 1 by a triangle, the result Host Opens Door
2 by a square, and the result Host Opens Door 3 by a pentagon -- thus
carving up our hypothesis space more finely into possibilities such as
"Car in Door 1 and Host Opens Door 2" , "Car in Door 1 and Host Opens
Door 3", etc:
Before we've made our initial selection of a door, the host is equally
likely to open either of the goat-containing doors. Thus, at the
beginning of the game, the probability of each hypothesis of the form
"Car in Door X and Host Opens Door Y" has a probability of 1/6, as
shown. So far, so good; everything is still perfectly correct.
Now we select a door; say we choose Door 2. The host then opens either
Door 1 or Door 3, to reveal a goat. Let's suppose he opens Door 1; our
diagram now looks like this:
But this shows equal probabilities of the car being behind Door 2 and
Door 3!
Did you catch the mistake?
There you go, this is how your intuition fails you.
Check out the correct solution the in the full article. It includes :
Explanation of the Bayes theorem
Wrong approach of Monty Hall
Right approach of Monty Hall
More problems...
|
The Monty Hall Problem - where does our intuition fail us?
I'll quote this great article on lesswrong:
The possible hypotheses are Car in Door 1, Car in Door 2, and Car in
Door 3; before the game starts, there is no reason to believe any of
the three doo
|
6,356
|
The Monty Hall Problem - where does our intuition fail us?
|
In my experience, it is the fact that people do not automatically leap from words to math. Normally, when I first present it, people get it wrong. However, I then bring out a deck of 52 cards and have them choose one. I then reveal fifty cards and ask them if they want to switch. Most people then get it. They intuitively know they probably got the wrong card when there are 52 of them and when they see fifty of them turned over, the decision is pretty simple. I don't think it is so much a paradox as a tendency to turn off the mind in math problems.
|
The Monty Hall Problem - where does our intuition fail us?
|
In my experience, it is the fact that people do not automatically leap from words to math. Normally, when I first present it, people get it wrong. However, I then bring out a deck of 52 cards and ha
|
The Monty Hall Problem - where does our intuition fail us?
In my experience, it is the fact that people do not automatically leap from words to math. Normally, when I first present it, people get it wrong. However, I then bring out a deck of 52 cards and have them choose one. I then reveal fifty cards and ask them if they want to switch. Most people then get it. They intuitively know they probably got the wrong card when there are 52 of them and when they see fifty of them turned over, the decision is pretty simple. I don't think it is so much a paradox as a tendency to turn off the mind in math problems.
|
The Monty Hall Problem - where does our intuition fail us?
In my experience, it is the fact that people do not automatically leap from words to math. Normally, when I first present it, people get it wrong. However, I then bring out a deck of 52 cards and ha
|
6,357
|
The Monty Hall Problem - where does our intuition fail us?
|
Haha! Funny coincidence, I was just reading the Curious incident of the Dog in the Nighttime to have stopped at the chapter where the speaker was explaining what the Monty Hall problem was. Here's a nice image about the scenario case.
The intuitive mathematical way how I came to understand the problem: to win after switching, you need to pick the door with either a goat and then switch to the door with the car, as you are revealed one of the goat doors when you choose either one of the three doors. There are 2 goat doors, each with a probability of 1/3. Therefore you have a 2/3 probability of choosing the door with a car by switching your choice (choosing a goat door), greater than the 1/3 choice of winning if you choose to keep your door choice. ALWAYS SWITCH! Hope this helps. :)
|
The Monty Hall Problem - where does our intuition fail us?
|
Haha! Funny coincidence, I was just reading the Curious incident of the Dog in the Nighttime to have stopped at the chapter where the speaker was explaining what the Monty Hall problem was. Here's a n
|
The Monty Hall Problem - where does our intuition fail us?
Haha! Funny coincidence, I was just reading the Curious incident of the Dog in the Nighttime to have stopped at the chapter where the speaker was explaining what the Monty Hall problem was. Here's a nice image about the scenario case.
The intuitive mathematical way how I came to understand the problem: to win after switching, you need to pick the door with either a goat and then switch to the door with the car, as you are revealed one of the goat doors when you choose either one of the three doors. There are 2 goat doors, each with a probability of 1/3. Therefore you have a 2/3 probability of choosing the door with a car by switching your choice (choosing a goat door), greater than the 1/3 choice of winning if you choose to keep your door choice. ALWAYS SWITCH! Hope this helps. :)
|
The Monty Hall Problem - where does our intuition fail us?
Haha! Funny coincidence, I was just reading the Curious incident of the Dog in the Nighttime to have stopped at the chapter where the speaker was explaining what the Monty Hall problem was. Here's a n
|
6,358
|
The Monty Hall Problem - where does our intuition fail us?
|
What misunderstanding do most people have about probability that leads to us scratching our heads?
It is not the misunderstanding, it is the reluctance (or inability) to calculate probabilities.
What general rule can we take away from this puzzle to better train our intuition in the future?
Such puzzles are puzzles just because they are counterintuitive.
I'm not in a position to determine a general rule (if such one even exists), and in my humble opinion there is no chance to train our intuition in the realm of such counterintuitive puzzles.
But you may extend your knowledge by study and practice to acquire more tools for solving problems — including counterintuitive ones.
Note:
For solving the Monty Hall Problem it is sufficient to enumerate all possibilities:
Let you chose door $\color{blue} {\text {No. 1}}$ (the $\color{blue}{\text{blue}}$ column in the following table).
There are 3 possible constellations of the (hidden) content of doors
(0 means a coat, 1 means a car):
Constellation
$\color{blue}{\text{No. 1}}$
$\text{No. 2}$
$\text{No. 3}$
1st
$\color{blue}0$
0
$\color{red}1$
2nd
$\color{blue}0$
$\color{red}1$
0
3rd
$\color{blue}1$
0
0
In the 1st constellation the host is forced to open the door No. 2 and you win, if you change your opinion.
In the 2nd constellation the host is forced to open the door No. 3 and you win, if you change your opinion.
In the 3rd constellation you lose, if you change your opinion.
All 3 constellations have the same probability, and you win in 2 of them, if you change your opinion.
|
The Monty Hall Problem - where does our intuition fail us?
|
What misunderstanding do most people have about probability that leads to us scratching our heads?
It is not the misunderstanding, it is the reluctance (or inability) to calculate probabilities.
Wha
|
The Monty Hall Problem - where does our intuition fail us?
What misunderstanding do most people have about probability that leads to us scratching our heads?
It is not the misunderstanding, it is the reluctance (or inability) to calculate probabilities.
What general rule can we take away from this puzzle to better train our intuition in the future?
Such puzzles are puzzles just because they are counterintuitive.
I'm not in a position to determine a general rule (if such one even exists), and in my humble opinion there is no chance to train our intuition in the realm of such counterintuitive puzzles.
But you may extend your knowledge by study and practice to acquire more tools for solving problems — including counterintuitive ones.
Note:
For solving the Monty Hall Problem it is sufficient to enumerate all possibilities:
Let you chose door $\color{blue} {\text {No. 1}}$ (the $\color{blue}{\text{blue}}$ column in the following table).
There are 3 possible constellations of the (hidden) content of doors
(0 means a coat, 1 means a car):
Constellation
$\color{blue}{\text{No. 1}}$
$\text{No. 2}$
$\text{No. 3}$
1st
$\color{blue}0$
0
$\color{red}1$
2nd
$\color{blue}0$
$\color{red}1$
0
3rd
$\color{blue}1$
0
0
In the 1st constellation the host is forced to open the door No. 2 and you win, if you change your opinion.
In the 2nd constellation the host is forced to open the door No. 3 and you win, if you change your opinion.
In the 3rd constellation you lose, if you change your opinion.
All 3 constellations have the same probability, and you win in 2 of them, if you change your opinion.
|
The Monty Hall Problem - where does our intuition fail us?
What misunderstanding do most people have about probability that leads to us scratching our heads?
It is not the misunderstanding, it is the reluctance (or inability) to calculate probabilities.
Wha
|
6,359
|
The Monty Hall Problem - where does our intuition fail us?
|
We can understand this problem in a very easy way (indeed, it becomes trivial!) if, instead of 3 doors, we consider 1000 doors. Thus, you choose one door, and out of the remaining 999 doors, the host opens 998 of them. After that, you should change your door, obviously. The host didn't choose that very specific door out of the 999 available for a good reason! A lot of info has been gained by the host's action. The same applies to the 3-door problem.
|
The Monty Hall Problem - where does our intuition fail us?
|
We can understand this problem in a very easy way (indeed, it becomes trivial!) if, instead of 3 doors, we consider 1000 doors. Thus, you choose one door, and out of the remaining 999 doors, the host
|
The Monty Hall Problem - where does our intuition fail us?
We can understand this problem in a very easy way (indeed, it becomes trivial!) if, instead of 3 doors, we consider 1000 doors. Thus, you choose one door, and out of the remaining 999 doors, the host opens 998 of them. After that, you should change your door, obviously. The host didn't choose that very specific door out of the 999 available for a good reason! A lot of info has been gained by the host's action. The same applies to the 3-door problem.
|
The Monty Hall Problem - where does our intuition fail us?
We can understand this problem in a very easy way (indeed, it becomes trivial!) if, instead of 3 doors, we consider 1000 doors. Thus, you choose one door, and out of the remaining 999 doors, the host
|
6,360
|
For plotting with R, should I learn ggplot2 or ggvis?
|
Start with ggplot2. It creates static plots.
Apart from static plots, ggvis can be used for creating interactive plots as well. Once you have learned the syntax of ggplot2, then the syntax for adding interactivity to create ggivs plots will follow naturally.
|
For plotting with R, should I learn ggplot2 or ggvis?
|
Start with ggplot2. It creates static plots.
Apart from static plots, ggvis can be used for creating interactive plots as well. Once you have learned the syntax of ggplot2, then the syntax for adding
|
For plotting with R, should I learn ggplot2 or ggvis?
Start with ggplot2. It creates static plots.
Apart from static plots, ggvis can be used for creating interactive plots as well. Once you have learned the syntax of ggplot2, then the syntax for adding interactivity to create ggivs plots will follow naturally.
|
For plotting with R, should I learn ggplot2 or ggvis?
Start with ggplot2. It creates static plots.
Apart from static plots, ggvis can be used for creating interactive plots as well. Once you have learned the syntax of ggplot2, then the syntax for adding
|
6,361
|
For plotting with R, should I learn ggplot2 or ggvis?
|
I want to expand a bit on Dianne Cook's answer. As she said, ggplot2 is for creating static plots, ggvis is for interactive plots. There are a bunch of implications to that:
File Type ggvis output is HTML including CSS and javascript files. ggvis does not naturally output ordinary image files. ggplot2 outputs ordinary images, which can then be embedded in HTML or pdf or gif or e-mailed, or whatever else. ggvis, if you want to e-mail the file, you're zipping-up a directory of HTML files to be viewed in a browser.
Animation A consequence of that is that if you want to create an animation, you can make the frames in ggplot2 and merge them, but there's no natural way to do this with ggvis. ggvis acting interactively will animate "live," but these are different kinds of animation. If there's more going on per frame than ggvis can process, you can't work around that (at least in a natural way) by generating the images and making the movie in the background. Similarly, the user can't download a movie or gif file from ggvis to replay.
Right now in my current project, I switched from ggplot2 to ggvis because ggplot2 was far too slow for animating interactively. But, I'd also like the user, after toying with settings, to be able to click "go" and download a full-speed, smooth-animation movie of what they did. I haven't figured out how to do this using ggvis, but it would be cake using ggplot2.
Speed ggvis is much, much, much faster than ggplot2, especially when changing data. Each ggplot2 plot has a second or a few of delay. ggvis has a second or so when you first create the plot, after that changing the data is seamless -- ggvis can be "reactively" linked to data so it updates itself whenever the data changes. With ggplot2, the whole plot is going to get redrawn.
Style & Appearance ggplot2 plots seem a bit nicer, at first glance, than ggvis plots. ggplot2 plots are quite elegant. ggvis plots are simpler, but they are growing on me. There are also extensions for ggplot2, such as the xkcd and wesanderson packages, where there's no analog for ggvis. ggplot2 plots all look like they were made by the same person (the author of ggplot2) and that gets tired after a while.
Completeness There are plot types you can create in ggplot2 that ggvis doesn't support, at least so far. For example there's no "rug" plot element in ggvis. I've seen one or two choropleths that were made with ggvis, but there's no natural built-in support yet. ggplot2 has polar coordinates (i.e., pie charts), ggvis does not. Also missing from ggvis (and available either in ggplot2 or in a ggplot2 extension): boxplots; contour plots; natural heatmaps; natural correlation charts; dotplots; violin plots; network plots; dendrograms. Of course I'm sure some very clever folks can create all these in ggvis, but I'm not that clever.
Annotations ggplot2 has a very nice, perhaps under-utilized, annotation framework. ggvis does not.
Subplots & Facets ggplot2 has a very nice, but perhaps rather limited, "faceting" feature. You can also combine multiple ggplot2 plots using the grid package. As of now, you cannot do either with ggvis. ggvis plots cannot be combined into a single image (because they aren't images, they're "live" webpages), and it doesn't support any kind of faceting or subplotting. This is supposed to be in the pipeline.
Visual Flexibility ggplot2 wants every plot to look the same, which means like the author prefers stylistically. There is no way, for example, to have a plot with multiple y axes in ggplot2. ggvis can. ggvis is a lot more flexible than ggplot2. Its far easier to do things like hide legends, combine multiple legends into one, use different scales for different things on the same plot, etc.
Deep Customizability If you want to create, say, a new clever scale, its not too hard to do that in ggplot2 (although it is pretty confusing). There just doesn't seem to be a way to do a lot of that in ggvis. Maybe its just not-yet.
Time Series ggplot2 does not like to plot time series. It can, but it doesn't want to. Actually neither of them want to; both insist on being fed data in a data.frame, and they can't handle xts or zoo objects. They don't have built-in features for slicing a time series either. But ggvis doesn't fight back against the time series as hard as ggplot2. That's partly because its so fast to update the data in a ggvis plot, I suppose. If you want to plot a timeseries you're going to have to beat either into submission, but ggvis is a lot less passive-aggressive about it.
Are They The Same Syntax? Sort of... There's a lot in common between them, and learning to think in the style of one will help to adapt to the style of the other. In particular, both are designed so all the plotting calls are piped into each other all on a single line of code. The primary advantage of this is it makes debugging and profiling really hard, and basically renders the debugging/profiling features in things like Rstudio useless. Other than that, they're syntactically quite different. Some things that are hard in ggplot2 are easy in ggvis. Some thing that are easy in ggplot2 are impossible in ggvis. And vice versa. (I have a bit of a preference for the way ggvis does things, which I find easier to understand.)
Bugs ggvis still has quite a few. Sometimes it behaves just oddly. Sometimes, though, plots randomly disappear for reasons that take hours to work-around and make very little sense. The developers admit this freely, ggvis is not production-ready yet. If you deal with any complexity, you will discover they aren't kidding.
The Bottom Line: Learning intermediate plotting in each takes about 16 hours. So, realistically, you're probably gonna learn both.
|
For plotting with R, should I learn ggplot2 or ggvis?
|
I want to expand a bit on Dianne Cook's answer. As she said, ggplot2 is for creating static plots, ggvis is for interactive plots. There are a bunch of implications to that:
File Type ggvis output
|
For plotting with R, should I learn ggplot2 or ggvis?
I want to expand a bit on Dianne Cook's answer. As she said, ggplot2 is for creating static plots, ggvis is for interactive plots. There are a bunch of implications to that:
File Type ggvis output is HTML including CSS and javascript files. ggvis does not naturally output ordinary image files. ggplot2 outputs ordinary images, which can then be embedded in HTML or pdf or gif or e-mailed, or whatever else. ggvis, if you want to e-mail the file, you're zipping-up a directory of HTML files to be viewed in a browser.
Animation A consequence of that is that if you want to create an animation, you can make the frames in ggplot2 and merge them, but there's no natural way to do this with ggvis. ggvis acting interactively will animate "live," but these are different kinds of animation. If there's more going on per frame than ggvis can process, you can't work around that (at least in a natural way) by generating the images and making the movie in the background. Similarly, the user can't download a movie or gif file from ggvis to replay.
Right now in my current project, I switched from ggplot2 to ggvis because ggplot2 was far too slow for animating interactively. But, I'd also like the user, after toying with settings, to be able to click "go" and download a full-speed, smooth-animation movie of what they did. I haven't figured out how to do this using ggvis, but it would be cake using ggplot2.
Speed ggvis is much, much, much faster than ggplot2, especially when changing data. Each ggplot2 plot has a second or a few of delay. ggvis has a second or so when you first create the plot, after that changing the data is seamless -- ggvis can be "reactively" linked to data so it updates itself whenever the data changes. With ggplot2, the whole plot is going to get redrawn.
Style & Appearance ggplot2 plots seem a bit nicer, at first glance, than ggvis plots. ggplot2 plots are quite elegant. ggvis plots are simpler, but they are growing on me. There are also extensions for ggplot2, such as the xkcd and wesanderson packages, where there's no analog for ggvis. ggplot2 plots all look like they were made by the same person (the author of ggplot2) and that gets tired after a while.
Completeness There are plot types you can create in ggplot2 that ggvis doesn't support, at least so far. For example there's no "rug" plot element in ggvis. I've seen one or two choropleths that were made with ggvis, but there's no natural built-in support yet. ggplot2 has polar coordinates (i.e., pie charts), ggvis does not. Also missing from ggvis (and available either in ggplot2 or in a ggplot2 extension): boxplots; contour plots; natural heatmaps; natural correlation charts; dotplots; violin plots; network plots; dendrograms. Of course I'm sure some very clever folks can create all these in ggvis, but I'm not that clever.
Annotations ggplot2 has a very nice, perhaps under-utilized, annotation framework. ggvis does not.
Subplots & Facets ggplot2 has a very nice, but perhaps rather limited, "faceting" feature. You can also combine multiple ggplot2 plots using the grid package. As of now, you cannot do either with ggvis. ggvis plots cannot be combined into a single image (because they aren't images, they're "live" webpages), and it doesn't support any kind of faceting or subplotting. This is supposed to be in the pipeline.
Visual Flexibility ggplot2 wants every plot to look the same, which means like the author prefers stylistically. There is no way, for example, to have a plot with multiple y axes in ggplot2. ggvis can. ggvis is a lot more flexible than ggplot2. Its far easier to do things like hide legends, combine multiple legends into one, use different scales for different things on the same plot, etc.
Deep Customizability If you want to create, say, a new clever scale, its not too hard to do that in ggplot2 (although it is pretty confusing). There just doesn't seem to be a way to do a lot of that in ggvis. Maybe its just not-yet.
Time Series ggplot2 does not like to plot time series. It can, but it doesn't want to. Actually neither of them want to; both insist on being fed data in a data.frame, and they can't handle xts or zoo objects. They don't have built-in features for slicing a time series either. But ggvis doesn't fight back against the time series as hard as ggplot2. That's partly because its so fast to update the data in a ggvis plot, I suppose. If you want to plot a timeseries you're going to have to beat either into submission, but ggvis is a lot less passive-aggressive about it.
Are They The Same Syntax? Sort of... There's a lot in common between them, and learning to think in the style of one will help to adapt to the style of the other. In particular, both are designed so all the plotting calls are piped into each other all on a single line of code. The primary advantage of this is it makes debugging and profiling really hard, and basically renders the debugging/profiling features in things like Rstudio useless. Other than that, they're syntactically quite different. Some things that are hard in ggplot2 are easy in ggvis. Some thing that are easy in ggplot2 are impossible in ggvis. And vice versa. (I have a bit of a preference for the way ggvis does things, which I find easier to understand.)
Bugs ggvis still has quite a few. Sometimes it behaves just oddly. Sometimes, though, plots randomly disappear for reasons that take hours to work-around and make very little sense. The developers admit this freely, ggvis is not production-ready yet. If you deal with any complexity, you will discover they aren't kidding.
The Bottom Line: Learning intermediate plotting in each takes about 16 hours. So, realistically, you're probably gonna learn both.
|
For plotting with R, should I learn ggplot2 or ggvis?
I want to expand a bit on Dianne Cook's answer. As she said, ggplot2 is for creating static plots, ggvis is for interactive plots. There are a bunch of implications to that:
File Type ggvis output
|
6,362
|
For plotting with R, should I learn ggplot2 or ggvis?
|
I think the message appearing after library(ggvis) is self explanatory:
The ggvis API is currently rapidly evolving. We strongly recommend
that you do not rely on this for production, but feel free to explore.
If you encounter a clear bug, please file a minimal reproducible
example at https://github.com/rstudio/ggvis/issues. For questions and
other discussion, please use https://groups.google.com/group/ggvis.
Compared to ggplot2 ggvis still lacks some features and polish (no way to add title to a graph for example, axis titles overlapping with tick labels, and there are more, facetting is not supported, etc.) On the other hand the ggvis syntax feels a bit cleaner, and interactivity is really awesome.
From my own experience ggvis is a must if you are building a shiny app. Then the benefits of having a web and R friendly graph plotting engine heavily outweigh any deficiencies it currently has.
If you want to do static graphs for data exploration, then ggplot2 is a mature library with lots of cool features and with a healthy community of users and lots of resources to learn from.
The philosophy behind both the packages is similar, so the skills can be transfered quite easily from one package to another.
|
For plotting with R, should I learn ggplot2 or ggvis?
|
I think the message appearing after library(ggvis) is self explanatory:
The ggvis API is currently rapidly evolving. We strongly recommend
that you do not rely on this for production, but feel free
|
For plotting with R, should I learn ggplot2 or ggvis?
I think the message appearing after library(ggvis) is self explanatory:
The ggvis API is currently rapidly evolving. We strongly recommend
that you do not rely on this for production, but feel free to explore.
If you encounter a clear bug, please file a minimal reproducible
example at https://github.com/rstudio/ggvis/issues. For questions and
other discussion, please use https://groups.google.com/group/ggvis.
Compared to ggplot2 ggvis still lacks some features and polish (no way to add title to a graph for example, axis titles overlapping with tick labels, and there are more, facetting is not supported, etc.) On the other hand the ggvis syntax feels a bit cleaner, and interactivity is really awesome.
From my own experience ggvis is a must if you are building a shiny app. Then the benefits of having a web and R friendly graph plotting engine heavily outweigh any deficiencies it currently has.
If you want to do static graphs for data exploration, then ggplot2 is a mature library with lots of cool features and with a healthy community of users and lots of resources to learn from.
The philosophy behind both the packages is similar, so the skills can be transfered quite easily from one package to another.
|
For plotting with R, should I learn ggplot2 or ggvis?
I think the message appearing after library(ggvis) is self explanatory:
The ggvis API is currently rapidly evolving. We strongly recommend
that you do not rely on this for production, but feel free
|
6,363
|
For plotting with R, should I learn ggplot2 or ggvis?
|
The R community keeps coming up with new (and often overlapping) packages for a variety of reasons:
1) Someone wants to change something or add something that isn't available in an existing package, but much of it overlaps (hence, many packages that do regression)
2) Someone writes a package as an assignment
3) Writing packages is fun (if you like that sort of thing)
4) They don't know the original package exists
|
For plotting with R, should I learn ggplot2 or ggvis?
|
The R community keeps coming up with new (and often overlapping) packages for a variety of reasons:
1) Someone wants to change something or add something that isn't available in an existing package, b
|
For plotting with R, should I learn ggplot2 or ggvis?
The R community keeps coming up with new (and often overlapping) packages for a variety of reasons:
1) Someone wants to change something or add something that isn't available in an existing package, but much of it overlaps (hence, many packages that do regression)
2) Someone writes a package as an assignment
3) Writing packages is fun (if you like that sort of thing)
4) They don't know the original package exists
|
For plotting with R, should I learn ggplot2 or ggvis?
The R community keeps coming up with new (and often overlapping) packages for a variety of reasons:
1) Someone wants to change something or add something that isn't available in an existing package, b
|
6,364
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
What the paradox is
There is a mixture of wine and water. Let $x$ be the amount of wine divided by the amount of water. Suppose we know that $x$ is between $1/3$ and $3$ but nothing else about $x$. We want the probability that $x \le 2$.
Without a sample space or probability model, we have no way to calculate probabilities. So we have to decide how to model the problem.
The Principle of Indifference states that if we have no reason to favour one outcome over another, then we should assign them the same probability. This means that we should say that every possible value of $x$ is equally likely. Therefore, the probability that $x \le 2$ is $(2 - 1/3)/(3 -1/3) = 5/8$.
(If you are not comfortable with continuous probability, we could do another version in which $x$ can only take on the values $1/3, 2/3, 1, 4/3, 5/3, 2, 7/3, 8/3, 3$. Then the probability would be $6/9$. This version will lead to the same paradox.)
That's fine, the answer is $5/8$. But now, what would happen if we decided to use the same model, but for the ratio of water divided by wine? Call this $y$. Then $y = 1/x$. Now, if we assume that all values of $y$ are equally likely, we want the probability that $y \ge 1/2$. But this is $(3 - 1/2)/(3-1/3) = 15/16$, (or $8/9$ in the discrete version.)
The paradox is that that these two values are not equal. So, how should we assign the probability that $x \le 2$? Should it be $5/8$ or $15/16$? It depends on our model. But why would we favour one model over the other?
The Principle of Indifference tells us to choose either model,
but they give different answers depending on which liquid is called "water" and which liquid is called "wine".
Why it matters for Bayesian statistics
In Bayesian statistics, every calculation is based on choosing a prior distribution for the parameters of interest. For example, if we wanted to make some inference about the wine/water problem, we would have to decide a prior distribution on the ratio of wine and water. Often we want to choose the prior distribution which implies "no prior knowledge", which is usually a uniform or flat prior, which assumes all values are equally likely.
But we have just seen that when we look at things in a different way, "all values of $x$ are equally likely" becomes "all values of $1/x$ are very much not equally likely", so it seems that there is no way to assign a prior distribution of "no information about the value of $x$".
This is rather alarming, since all our calculations will depend on assumptions which we didn't intend to make.
Resolution of the paradox
The paradox has been touted (for over a century) as a refutation of the Principle of Indifference.
Statisticians are happy to say that the Principle isn't valid, and this may be true, but if we can't use the Principle of Indifference, then we can't actually take random samples from anything at all, because even in a computer, sampling is ultimately based on counting the number of possible outcomes among equally likely outcomes.
So what is wrong with the paradox?
The key here is that we do have some prior knowledge about the ratio $x$ of wine to water. Namely, that it is the ratio of wine to water.
In other words, if $z$ is the proportion of water in the mixture, then $x = z/(1-z)$. So saying that all values of $x$ are equally likely is the same as saying that all values of $z/(1-z)$ are equally likely, which seems like an odd thing to assume.
If instead, we assume that all values of $z$ are equally likely, then we get the answer $5/6$, and the paradox vanishes. This is what Mikkelson is getting at in his paper.
Assuming that all values of $z$ are equally likely is a bit like saying "every molecule in the mixture is equally likely to be wine or water, and we are indifferent as to which it is" which seems like a reasonable assumption for this particular situation.
Alternatively, we could view the situation as putting a prior on $x$ proportional to $1/(1+x)^2$. This is called the Jeffreys Prior.
Jeffreys was a physicist who had the idea that priors ought to be chosen in such a way as to be invariant to reparametrisations like this.
So he would have said that, if we know the quantity $x$ is a ratio, it's natural to choose this prior instead of any other one.
I am not claiming that I have a resolution of the paradox, or that it's not important. We should definitely be careful about what priors we use and which assumptions we are implicity making. I'm just saying that choosing a prior is more or less the same as choosing a statistical model for something, and we should be careful about choosing these too.
It's a bit unfair to Bayesians to say: "Your choice of prior inevitably leads to a contradiction, but I can choose to model some quantity with a normal distribution or whatever, and it's fine because I can't be bothered to think about these issues."
Notes
Information Geometry
It would be nice if statistics could be made "coordinate-free" so that it doesn't depend on parametrisations. I believe the subject that attempts to do this is called Information Geometry, and it hasn't been found to be of much practical value so far, but you never know.
The Gibbs Paradox
The Principle of Indifference is fundamental to statistical mechanics, which is the branch of physics which describes the behaviour of gases and things. In statistical mechanics, we assume that each possible configuration of particles is equally likely; this is a fundamental assumption which underpins all calculations. This is relevant to the above for two reasons.
In the wine/water problem, statistical mechanics would say that the answer is $5/6$. A physicist would find it very weird to say something like "Let's assume that every possible ratio of hydrogen to oxygen in this container is equally likely."
The second reason is that a paradox involving the Principle of Indifference actually happened in statistical mechanics. It had to be resolved by assuming that particles are indistinguishable, otherwise the theory fails to agree with practical experiments.
I am not sure of the details, but you can read up on it under the search term "Gibbs Paradox". The indistinguishability assumption was not theoretically justified until quantum mechanics was developed.
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
What the paradox is
There is a mixture of wine and water. Let $x$ be the amount of wine divided by the amount of water. Suppose we know that $x$ is between $1/3$ and $3$ but nothing else about $x$. We
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
What the paradox is
There is a mixture of wine and water. Let $x$ be the amount of wine divided by the amount of water. Suppose we know that $x$ is between $1/3$ and $3$ but nothing else about $x$. We want the probability that $x \le 2$.
Without a sample space or probability model, we have no way to calculate probabilities. So we have to decide how to model the problem.
The Principle of Indifference states that if we have no reason to favour one outcome over another, then we should assign them the same probability. This means that we should say that every possible value of $x$ is equally likely. Therefore, the probability that $x \le 2$ is $(2 - 1/3)/(3 -1/3) = 5/8$.
(If you are not comfortable with continuous probability, we could do another version in which $x$ can only take on the values $1/3, 2/3, 1, 4/3, 5/3, 2, 7/3, 8/3, 3$. Then the probability would be $6/9$. This version will lead to the same paradox.)
That's fine, the answer is $5/8$. But now, what would happen if we decided to use the same model, but for the ratio of water divided by wine? Call this $y$. Then $y = 1/x$. Now, if we assume that all values of $y$ are equally likely, we want the probability that $y \ge 1/2$. But this is $(3 - 1/2)/(3-1/3) = 15/16$, (or $8/9$ in the discrete version.)
The paradox is that that these two values are not equal. So, how should we assign the probability that $x \le 2$? Should it be $5/8$ or $15/16$? It depends on our model. But why would we favour one model over the other?
The Principle of Indifference tells us to choose either model,
but they give different answers depending on which liquid is called "water" and which liquid is called "wine".
Why it matters for Bayesian statistics
In Bayesian statistics, every calculation is based on choosing a prior distribution for the parameters of interest. For example, if we wanted to make some inference about the wine/water problem, we would have to decide a prior distribution on the ratio of wine and water. Often we want to choose the prior distribution which implies "no prior knowledge", which is usually a uniform or flat prior, which assumes all values are equally likely.
But we have just seen that when we look at things in a different way, "all values of $x$ are equally likely" becomes "all values of $1/x$ are very much not equally likely", so it seems that there is no way to assign a prior distribution of "no information about the value of $x$".
This is rather alarming, since all our calculations will depend on assumptions which we didn't intend to make.
Resolution of the paradox
The paradox has been touted (for over a century) as a refutation of the Principle of Indifference.
Statisticians are happy to say that the Principle isn't valid, and this may be true, but if we can't use the Principle of Indifference, then we can't actually take random samples from anything at all, because even in a computer, sampling is ultimately based on counting the number of possible outcomes among equally likely outcomes.
So what is wrong with the paradox?
The key here is that we do have some prior knowledge about the ratio $x$ of wine to water. Namely, that it is the ratio of wine to water.
In other words, if $z$ is the proportion of water in the mixture, then $x = z/(1-z)$. So saying that all values of $x$ are equally likely is the same as saying that all values of $z/(1-z)$ are equally likely, which seems like an odd thing to assume.
If instead, we assume that all values of $z$ are equally likely, then we get the answer $5/6$, and the paradox vanishes. This is what Mikkelson is getting at in his paper.
Assuming that all values of $z$ are equally likely is a bit like saying "every molecule in the mixture is equally likely to be wine or water, and we are indifferent as to which it is" which seems like a reasonable assumption for this particular situation.
Alternatively, we could view the situation as putting a prior on $x$ proportional to $1/(1+x)^2$. This is called the Jeffreys Prior.
Jeffreys was a physicist who had the idea that priors ought to be chosen in such a way as to be invariant to reparametrisations like this.
So he would have said that, if we know the quantity $x$ is a ratio, it's natural to choose this prior instead of any other one.
I am not claiming that I have a resolution of the paradox, or that it's not important. We should definitely be careful about what priors we use and which assumptions we are implicity making. I'm just saying that choosing a prior is more or less the same as choosing a statistical model for something, and we should be careful about choosing these too.
It's a bit unfair to Bayesians to say: "Your choice of prior inevitably leads to a contradiction, but I can choose to model some quantity with a normal distribution or whatever, and it's fine because I can't be bothered to think about these issues."
Notes
Information Geometry
It would be nice if statistics could be made "coordinate-free" so that it doesn't depend on parametrisations. I believe the subject that attempts to do this is called Information Geometry, and it hasn't been found to be of much practical value so far, but you never know.
The Gibbs Paradox
The Principle of Indifference is fundamental to statistical mechanics, which is the branch of physics which describes the behaviour of gases and things. In statistical mechanics, we assume that each possible configuration of particles is equally likely; this is a fundamental assumption which underpins all calculations. This is relevant to the above for two reasons.
In the wine/water problem, statistical mechanics would say that the answer is $5/6$. A physicist would find it very weird to say something like "Let's assume that every possible ratio of hydrogen to oxygen in this container is equally likely."
The second reason is that a paradox involving the Principle of Indifference actually happened in statistical mechanics. It had to be resolved by assuming that particles are indistinguishable, otherwise the theory fails to agree with practical experiments.
I am not sure of the details, but you can read up on it under the search term "Gibbs Paradox". The indistinguishability assumption was not theoretically justified until quantum mechanics was developed.
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
What the paradox is
There is a mixture of wine and water. Let $x$ be the amount of wine divided by the amount of water. Suppose we know that $x$ is between $1/3$ and $3$ but nothing else about $x$. We
|
6,365
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
In the context of modern understandings of Bayesian analysis, it is really quite generous to still call this a "paradox". It is nothing more than a demonstration that uniform distributions are not invariant to nonlinear reparameterisations of their referents, such that you have to be careful when forming a "non-informative" prior on an unknown parameter in Bayesian statistics. This was important in the early days of Bayesian statistics, in dealing with some of the first attempts to formulate rules for prior ignorance; nowadays it just illustrates principles that are well-known.
As explained here, the "paradox" arises when we have a wine-water mixture, with unknown composition, and we try to formulate a prior for the ratio of wine-to-water. Suppose we let $x$ be the ratio of wine-to-water and suppose we give this unknown value a uniform prior over its possible range. The so-called "paradox" shows that you get different inferences if you apply a uniform prior to either $x$ or $1/x$ in the problem, despite the fact that there is a clear symmetry to your ignorance about these quantities (the latter is the water-to-wine ratio). This is contrary to some early crude versions of the "principle of indifference" which asserted that ignorance of an unknown quantity should be represented by a uniform prior over the possible values of that quantity.
This "paradox" is trivially resolved in modern Bayesian analysis by recognising that a more natural "non-informative" prior here is uniform over the quantity $z = \tfrac{x}{1+x}$, which is the proportion of wine (or water) in the mixture. Consequently, the problem is just a demonstration that you need to be careful when forming "non-informative" priors, to make sure that they are invariant with respect to natural transforms in the problem. Bayesian literature on non-informative priors is replete with discussions of invariance conditions, so these are issues that are now well-known.$^\dagger$
$^\dagger$ The comments seek some additional detail/references to learn about this area of the field. José Bernardo is probaby the leading expert in this field, and so his papers/books are a useful starting point. You can find a useful introduction to the subject in Irony and Singpurwalla (1997) (discussion with José Bernardo).
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
In the context of modern understandings of Bayesian analysis, it is really quite generous to still call this a "paradox". It is nothing more than a demonstration that uniform distributions are not in
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
In the context of modern understandings of Bayesian analysis, it is really quite generous to still call this a "paradox". It is nothing more than a demonstration that uniform distributions are not invariant to nonlinear reparameterisations of their referents, such that you have to be careful when forming a "non-informative" prior on an unknown parameter in Bayesian statistics. This was important in the early days of Bayesian statistics, in dealing with some of the first attempts to formulate rules for prior ignorance; nowadays it just illustrates principles that are well-known.
As explained here, the "paradox" arises when we have a wine-water mixture, with unknown composition, and we try to formulate a prior for the ratio of wine-to-water. Suppose we let $x$ be the ratio of wine-to-water and suppose we give this unknown value a uniform prior over its possible range. The so-called "paradox" shows that you get different inferences if you apply a uniform prior to either $x$ or $1/x$ in the problem, despite the fact that there is a clear symmetry to your ignorance about these quantities (the latter is the water-to-wine ratio). This is contrary to some early crude versions of the "principle of indifference" which asserted that ignorance of an unknown quantity should be represented by a uniform prior over the possible values of that quantity.
This "paradox" is trivially resolved in modern Bayesian analysis by recognising that a more natural "non-informative" prior here is uniform over the quantity $z = \tfrac{x}{1+x}$, which is the proportion of wine (or water) in the mixture. Consequently, the problem is just a demonstration that you need to be careful when forming "non-informative" priors, to make sure that they are invariant with respect to natural transforms in the problem. Bayesian literature on non-informative priors is replete with discussions of invariance conditions, so these are issues that are now well-known.$^\dagger$
$^\dagger$ The comments seek some additional detail/references to learn about this area of the field. José Bernardo is probaby the leading expert in this field, and so his papers/books are a useful starting point. You can find a useful introduction to the subject in Irony and Singpurwalla (1997) (discussion with José Bernardo).
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
In the context of modern understandings of Bayesian analysis, it is really quite generous to still call this a "paradox". It is nothing more than a demonstration that uniform distributions are not in
|
6,366
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
I believe it to be an apparent paradox and highly instructive of a common and dangerous issue in all branches of statistics, how to handle ratios. Being conscious of a possible paradox will make you cautious as a researcher. I will give you a reason to believe that it is not a paradox.
The problem has no solution, of course. Imposing the principle of indifference doesn’t solve the problem in either case. Where did that choice come from? Why that principle? Using the principle of indifference is itself a subjective choice. There is an infinite number of solutions.
Also, the wording of the problem makes it difficult to work on. So, first, I will give the language of the proposed paradox as it appears in Wikipedia. Then I will unpack it.
A mixture is known to contain a mix of wine and water in proportions such that the amount of wine divided by the amount of water is a ratio $x$ lying in the interval $1/3\leq x\leq 3$. (i.e. 25-75% alcohol) We seek the probability, $P^*$ say, that $x\leq 2$. (i.e., less than or equal to 66%.)
Note that if you were to divide the water by the wine instead and denote this $y$, then $$y=\frac{1}{x}.$$
Note that $$x\leq{2}$$ is equivalent to $$y\ge\frac{1}{2}.$$ The boundaries are still $1/3$ and $3$ but the meaning has changed.
The source of the problem is that the percentage of the total area from 2 to 3 is not the same percentage of the total area from 1/3 to1/2 if both are treated as rectangles of unit size.
The crux of the paradox is that neither frame of reference makes more sense than the other frame of reference. Why should water to wine be the canonical solution to the problem instead of wine to water?
Ratio problems show up all over the place in nature. This is an important warning.
So, now, let us unpack the problem a bit.
First, notice that you have collected no data at all. Although probabilities based only on prior distributions are a significant element of decision making, we tend to ignore them in the pedagogy because they are not computationally intense. Also, as the definition of a statistic is a function of data, then ignoring data isn’t very useful in the field of statistics as a discussion point.
Nonetheless, I am sure you drive many places on the assumption that a meteor has not struck and destroyed the route without collecting any data on local meteor strikes before leaving home.
Your priors over routes are likely not uniform in most places of travel in the United States. Some intersections have long lights; others tend to get congested.
If you had any prior experience of this type of substance, it is likely your prior would not have been uniform, and the principle of indifference would not apply. Any information at all would automatically resolve this paradox because the prior would have to conform to your frame of reference, and the expected probabilities would become equal automatically.
A key element of this paradox is truly having no information.
A possibly missed element of the problem is that you are calculating $P^*$, which is defined here as an expectation. That implies that your loss function is quadratic. Do you have quadratic loss? While the outcome would likely be a paradox under most other loss functions, using a loss function is imposing a Frequentist method on a Bayesian problem.
There is nothing specifically wrong with imposing a Frequentist criterion on a Bayesian problem. That is what Bayesian decision theory is all about. Nonetheless, reducing a distribution down to a point can produce unexpected results. One of the obvious warnings is that Bayesian methods are not invariant to transformations.
Now let us consider an alternate solution.
Let $a=\text{quantity of water}$.
Let $b=\text{quantity of wine}$.
Let $k$ equal the total volume. Assume $k$ is known with certainty.
Instead of solving $$x=\frac{b}{a}$$ we could solve $a+b=k$. Instead of one parameter to estimate, we have two. Under the principle of indifference, $\Pr(a)=2/k,$ when $.25k\le{a}\le{.75}k$ and zero elsewhere. By symmetry, the same prior holds for $b$. Each combination is equiprobable.
Now, your expected ratio is approximately 1.197 for wine to water. There is still a paradox because the expected ratio is also 1.197 for water to wine.
Is that a solution?
Consider an alternative loss function. Consider the loss function $$\mathcal{L}(\theta,\hat{\theta})=|\hat{\theta}-\theta|.$$
In that case, in both ratios, $P^*=.5$, so the ratio is 1.
These are not solutions. Now you have four possible solutions. The final one is attractive, though, because the answer does not depend on the frame of reference.
Another, maybe simpler solution, is to ignore the need for a point estimate of the probability. Just show the one thing that you know, that quantity sits inside a bounded range. The true Bayesian solution would do nothing more than describe your prior distribution. No one point would be favored over others. The decision-theoretic choice of a point is rational if you have a utility function, but is it necessary?
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
|
I believe it to be an apparent paradox and highly instructive of a common and dangerous issue in all branches of statistics, how to handle ratios. Being conscious of a possible paradox will make you
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
I believe it to be an apparent paradox and highly instructive of a common and dangerous issue in all branches of statistics, how to handle ratios. Being conscious of a possible paradox will make you cautious as a researcher. I will give you a reason to believe that it is not a paradox.
The problem has no solution, of course. Imposing the principle of indifference doesn’t solve the problem in either case. Where did that choice come from? Why that principle? Using the principle of indifference is itself a subjective choice. There is an infinite number of solutions.
Also, the wording of the problem makes it difficult to work on. So, first, I will give the language of the proposed paradox as it appears in Wikipedia. Then I will unpack it.
A mixture is known to contain a mix of wine and water in proportions such that the amount of wine divided by the amount of water is a ratio $x$ lying in the interval $1/3\leq x\leq 3$. (i.e. 25-75% alcohol) We seek the probability, $P^*$ say, that $x\leq 2$. (i.e., less than or equal to 66%.)
Note that if you were to divide the water by the wine instead and denote this $y$, then $$y=\frac{1}{x}.$$
Note that $$x\leq{2}$$ is equivalent to $$y\ge\frac{1}{2}.$$ The boundaries are still $1/3$ and $3$ but the meaning has changed.
The source of the problem is that the percentage of the total area from 2 to 3 is not the same percentage of the total area from 1/3 to1/2 if both are treated as rectangles of unit size.
The crux of the paradox is that neither frame of reference makes more sense than the other frame of reference. Why should water to wine be the canonical solution to the problem instead of wine to water?
Ratio problems show up all over the place in nature. This is an important warning.
So, now, let us unpack the problem a bit.
First, notice that you have collected no data at all. Although probabilities based only on prior distributions are a significant element of decision making, we tend to ignore them in the pedagogy because they are not computationally intense. Also, as the definition of a statistic is a function of data, then ignoring data isn’t very useful in the field of statistics as a discussion point.
Nonetheless, I am sure you drive many places on the assumption that a meteor has not struck and destroyed the route without collecting any data on local meteor strikes before leaving home.
Your priors over routes are likely not uniform in most places of travel in the United States. Some intersections have long lights; others tend to get congested.
If you had any prior experience of this type of substance, it is likely your prior would not have been uniform, and the principle of indifference would not apply. Any information at all would automatically resolve this paradox because the prior would have to conform to your frame of reference, and the expected probabilities would become equal automatically.
A key element of this paradox is truly having no information.
A possibly missed element of the problem is that you are calculating $P^*$, which is defined here as an expectation. That implies that your loss function is quadratic. Do you have quadratic loss? While the outcome would likely be a paradox under most other loss functions, using a loss function is imposing a Frequentist method on a Bayesian problem.
There is nothing specifically wrong with imposing a Frequentist criterion on a Bayesian problem. That is what Bayesian decision theory is all about. Nonetheless, reducing a distribution down to a point can produce unexpected results. One of the obvious warnings is that Bayesian methods are not invariant to transformations.
Now let us consider an alternate solution.
Let $a=\text{quantity of water}$.
Let $b=\text{quantity of wine}$.
Let $k$ equal the total volume. Assume $k$ is known with certainty.
Instead of solving $$x=\frac{b}{a}$$ we could solve $a+b=k$. Instead of one parameter to estimate, we have two. Under the principle of indifference, $\Pr(a)=2/k,$ when $.25k\le{a}\le{.75}k$ and zero elsewhere. By symmetry, the same prior holds for $b$. Each combination is equiprobable.
Now, your expected ratio is approximately 1.197 for wine to water. There is still a paradox because the expected ratio is also 1.197 for water to wine.
Is that a solution?
Consider an alternative loss function. Consider the loss function $$\mathcal{L}(\theta,\hat{\theta})=|\hat{\theta}-\theta|.$$
In that case, in both ratios, $P^*=.5$, so the ratio is 1.
These are not solutions. Now you have four possible solutions. The final one is attractive, though, because the answer does not depend on the frame of reference.
Another, maybe simpler solution, is to ignore the need for a point estimate of the probability. Just show the one thing that you know, that quantity sits inside a bounded range. The true Bayesian solution would do nothing more than describe your prior distribution. No one point would be favored over others. The decision-theoretic choice of a point is rational if you have a utility function, but is it necessary?
|
What is the Wine/Water Paradox in Bayesian statistics, and what is its resolution?
I believe it to be an apparent paradox and highly instructive of a common and dangerous issue in all branches of statistics, how to handle ratios. Being conscious of a possible paradox will make you
|
6,367
|
How to take derivative of multivariate normal density?
|
In chapter 2 of the Matrix Cookbook there is a nice review of matrix calculus stuff that gives a lot of useful identities that help with problems one would encounter doing probability and statistics, including rules to help differentiate the multivariate Gaussian likelihood.
If you have a random vector ${\boldsymbol y}$ that is multivariate normal with mean vector ${\boldsymbol \mu}$ and covariance matrix ${\boldsymbol \Sigma}$, then use equation (86) in the matrix cookbook to find that the gradient of the log likelihood ${\bf L}$ with respect to ${\boldsymbol \mu}$ is
$$\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \mu}}
&= -\frac{1}{2} \left(
\frac{\partial \left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu}\right)
}{\partial {\boldsymbol \mu}} \right) \nonumber \\
&= -\frac{1}{2}
\left( -2 {\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu}\right) \right) \nonumber \\
&= {\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\end{align}$$
I'll leave it to you to differentiate this again and find the answer to be $-{\boldsymbol \Sigma}^{-1}$.
As "extra credit", use equations (57) and (61) to find that the gradient with respect to ${\boldsymbol \Sigma}$ is
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \Sigma}}
&= -\frac{1}{2} \left( \frac{ \partial \log(|{\boldsymbol \Sigma}|)}{\partial{\boldsymbol \Sigma}}
+ \frac{\partial \left( {\boldsymbol y} - {\boldsymbol \mu}\right)'
{\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y}- {\boldsymbol \mu}\right)
}{\partial {\boldsymbol \Sigma}} \right)\\
&= -\frac{1}{2} \left( {\boldsymbol \Sigma}^{-1} -
{\boldsymbol \Sigma}^{-1}
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \right)
\end{align}
$$
I've left out a lot of the steps, but I made this derivation using only the identities found in the matrix cookbook, so I'll leave it to you to fill in the gaps.
I've used these score equations for maximum likelihood estimation, so I know they are correct :)
|
How to take derivative of multivariate normal density?
|
In chapter 2 of the Matrix Cookbook there is a nice review of matrix calculus stuff that gives a lot of useful identities that help with problems one would encounter doing probability and statistics,
|
How to take derivative of multivariate normal density?
In chapter 2 of the Matrix Cookbook there is a nice review of matrix calculus stuff that gives a lot of useful identities that help with problems one would encounter doing probability and statistics, including rules to help differentiate the multivariate Gaussian likelihood.
If you have a random vector ${\boldsymbol y}$ that is multivariate normal with mean vector ${\boldsymbol \mu}$ and covariance matrix ${\boldsymbol \Sigma}$, then use equation (86) in the matrix cookbook to find that the gradient of the log likelihood ${\bf L}$ with respect to ${\boldsymbol \mu}$ is
$$\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \mu}}
&= -\frac{1}{2} \left(
\frac{\partial \left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu}\right)
}{\partial {\boldsymbol \mu}} \right) \nonumber \\
&= -\frac{1}{2}
\left( -2 {\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu}\right) \right) \nonumber \\
&= {\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\end{align}$$
I'll leave it to you to differentiate this again and find the answer to be $-{\boldsymbol \Sigma}^{-1}$.
As "extra credit", use equations (57) and (61) to find that the gradient with respect to ${\boldsymbol \Sigma}$ is
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \Sigma}}
&= -\frac{1}{2} \left( \frac{ \partial \log(|{\boldsymbol \Sigma}|)}{\partial{\boldsymbol \Sigma}}
+ \frac{\partial \left( {\boldsymbol y} - {\boldsymbol \mu}\right)'
{\boldsymbol \Sigma}^{-1} \left( {\boldsymbol y}- {\boldsymbol \mu}\right)
}{\partial {\boldsymbol \Sigma}} \right)\\
&= -\frac{1}{2} \left( {\boldsymbol \Sigma}^{-1} -
{\boldsymbol \Sigma}^{-1}
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \right)
\end{align}
$$
I've left out a lot of the steps, but I made this derivation using only the identities found in the matrix cookbook, so I'll leave it to you to fill in the gaps.
I've used these score equations for maximum likelihood estimation, so I know they are correct :)
|
How to take derivative of multivariate normal density?
In chapter 2 of the Matrix Cookbook there is a nice review of matrix calculus stuff that gives a lot of useful identities that help with problems one would encounter doing probability and statistics,
|
6,368
|
How to take derivative of multivariate normal density?
|
Expression for log of normal density
We consider the log of the normal density
\begin{align}
\log p(y|\mu,\Sigma)=-\frac{D}{2}\log{|2\pi|}-\frac{1}{2}\log{|\Sigma|}-\frac{1}{2}(y-\mu)^\top\Sigma^{-1}(y-\mu)\quad\quad(1)
\end{align}
where $D$ denotes the dimension of $y$ and $\mu$.
Derivative w.r.t. mean
We have
\begin{align}
\frac{\partial\log p(y|\mu,\Sigma)}{\mu}=\Sigma^{-1}(y-\mu)
\end{align}
from (96, 97) the Matrix Cookbook and noting the first two terms on the r.h.s. of (1) differentiate to 0.
Derivative w.r.t. covariance
This requires careful consideration of the fact that $\Sigma$ is symmetric - see example at the bottom for the importance of taking this into account!
We have by (141) the Matrix Cookbook that for a symmetric $\Sigma$ the following derivatives
\begin{align}
\frac{\partial \log|\Sigma|}{\partial \Sigma}&=2\Sigma^{-1}-(\Sigma^{-1}\circ I)
\end{align}
and (139) the Matrix Cookbook gives
\begin{align}
\frac{\partial \textrm{trace}(\Sigma^{-1}xx^\top)}{\partial \Sigma}&=-2\Sigma^{-1}xx^\top\Sigma^{-1}+(\Sigma^{-1}xx^\top\Sigma^{-1}\circ I)
\end{align}
where $\circ$ denotes the Hadmard product and for convenience we have defined $x:=y-\mu$. Note that both expressions would be different is $\Sigma$ was not required to be symmetric. Putting these together we have
\begin{align}
\frac{\partial\log p(y|\mu,\Sigma)}{\Sigma}&=-\frac{\partial }{\partial \Sigma}\frac{1}{2}\left(D\log|2\pi|+ \log|\Sigma| + x^{\top}\Sigma^{-1}x)\right)\\
&=-\frac{\partial }{\partial \Sigma}\frac{1}{2}\left( \log|\Sigma| + \textrm{trace}(\Sigma^{-1}xx^\top)\right)\\
&=-\frac{1}{2}\left( 2\Sigma^{-1}-(\Sigma^{-1}\circ I) -2\Sigma^{-1}xx^\top\Sigma^{-1}+(\Sigma^{-1}xx^\top\Sigma^{-1}\circ I)\right)
\end{align}
as the derivative of $\frac{D}{2}\log|2\pi|$ is 0.
Note that it is WRONG to ignore that $\Sigma$ is symmetric
Impact of $\Sigma$ being symmetric
This example shows why you can't just ignore the fact $\Sigma$ is symmetric when differentiating with respect to its elements. Consider the matrix function
\begin{align}
f(X)=\Sigma_{ij} X_{ij}
\end{align}
so just sums up all the elements of $X$, some arbitrary matrix. If we consider
\begin{align*}
\\
&1)\quad X =\left(\begin{array}{cc}
a & b\\
c & d
\end{array}\right) & \implies && \frac{df}{dX} & =\left(\begin{array}{cc}
1 & 1\\
1 & 1
\end{array}\right)\\
&2)\quad X^{*}=\left(\begin{array}{cc}
a & b\\
b & c
\end{array}\right) & \implies && \frac{df}{dX^{*}} & =\left(\begin{array}{cc}
1 & 2\\
2 & 1
\end{array}\right)
\end{align*}
Then we see obviously the derivatives of $f$ w.r.t. the elements of $X$ vary depending on whether $X$ is symmetric or not.
|
How to take derivative of multivariate normal density?
|
Expression for log of normal density
We consider the log of the normal density
\begin{align}
\log p(y|\mu,\Sigma)=-\frac{D}{2}\log{|2\pi|}-\frac{1}{2}\log{|\Sigma|}-\frac{1}{2}(y-\mu)^\top\Sigma^
|
How to take derivative of multivariate normal density?
Expression for log of normal density
We consider the log of the normal density
\begin{align}
\log p(y|\mu,\Sigma)=-\frac{D}{2}\log{|2\pi|}-\frac{1}{2}\log{|\Sigma|}-\frac{1}{2}(y-\mu)^\top\Sigma^{-1}(y-\mu)\quad\quad(1)
\end{align}
where $D$ denotes the dimension of $y$ and $\mu$.
Derivative w.r.t. mean
We have
\begin{align}
\frac{\partial\log p(y|\mu,\Sigma)}{\mu}=\Sigma^{-1}(y-\mu)
\end{align}
from (96, 97) the Matrix Cookbook and noting the first two terms on the r.h.s. of (1) differentiate to 0.
Derivative w.r.t. covariance
This requires careful consideration of the fact that $\Sigma$ is symmetric - see example at the bottom for the importance of taking this into account!
We have by (141) the Matrix Cookbook that for a symmetric $\Sigma$ the following derivatives
\begin{align}
\frac{\partial \log|\Sigma|}{\partial \Sigma}&=2\Sigma^{-1}-(\Sigma^{-1}\circ I)
\end{align}
and (139) the Matrix Cookbook gives
\begin{align}
\frac{\partial \textrm{trace}(\Sigma^{-1}xx^\top)}{\partial \Sigma}&=-2\Sigma^{-1}xx^\top\Sigma^{-1}+(\Sigma^{-1}xx^\top\Sigma^{-1}\circ I)
\end{align}
where $\circ$ denotes the Hadmard product and for convenience we have defined $x:=y-\mu$. Note that both expressions would be different is $\Sigma$ was not required to be symmetric. Putting these together we have
\begin{align}
\frac{\partial\log p(y|\mu,\Sigma)}{\Sigma}&=-\frac{\partial }{\partial \Sigma}\frac{1}{2}\left(D\log|2\pi|+ \log|\Sigma| + x^{\top}\Sigma^{-1}x)\right)\\
&=-\frac{\partial }{\partial \Sigma}\frac{1}{2}\left( \log|\Sigma| + \textrm{trace}(\Sigma^{-1}xx^\top)\right)\\
&=-\frac{1}{2}\left( 2\Sigma^{-1}-(\Sigma^{-1}\circ I) -2\Sigma^{-1}xx^\top\Sigma^{-1}+(\Sigma^{-1}xx^\top\Sigma^{-1}\circ I)\right)
\end{align}
as the derivative of $\frac{D}{2}\log|2\pi|$ is 0.
Note that it is WRONG to ignore that $\Sigma$ is symmetric
Impact of $\Sigma$ being symmetric
This example shows why you can't just ignore the fact $\Sigma$ is symmetric when differentiating with respect to its elements. Consider the matrix function
\begin{align}
f(X)=\Sigma_{ij} X_{ij}
\end{align}
so just sums up all the elements of $X$, some arbitrary matrix. If we consider
\begin{align*}
\\
&1)\quad X =\left(\begin{array}{cc}
a & b\\
c & d
\end{array}\right) & \implies && \frac{df}{dX} & =\left(\begin{array}{cc}
1 & 1\\
1 & 1
\end{array}\right)\\
&2)\quad X^{*}=\left(\begin{array}{cc}
a & b\\
b & c
\end{array}\right) & \implies && \frac{df}{dX^{*}} & =\left(\begin{array}{cc}
1 & 2\\
2 & 1
\end{array}\right)
\end{align*}
Then we see obviously the derivatives of $f$ w.r.t. the elements of $X$ vary depending on whether $X$ is symmetric or not.
|
How to take derivative of multivariate normal density?
Expression for log of normal density
We consider the log of the normal density
\begin{align}
\log p(y|\mu,\Sigma)=-\frac{D}{2}\log{|2\pi|}-\frac{1}{2}\log{|\Sigma|}-\frac{1}{2}(y-\mu)^\top\Sigma^
|
6,369
|
How to take derivative of multivariate normal density?
|
I tried to computationally verify @Macro's answer but found what appears to be a minor error in the covariance solution. He obtained
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \Sigma}}
&= -\frac{1}{2} \left( {\boldsymbol \Sigma}^{-1} -
{\boldsymbol \Sigma}^{-1}
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \right)
={\bf A}
\end{align}
$$
However, it appears that the correct solution is actually
$$
{\bf B}=2{\bf A} - \text{diag}({\bf A})
$$
The following R script provides a simple example in which the finite difference is calculated for each element of ${\boldsymbol \Sigma}$. It demonstrates that ${\bf A}$ provides the correct answer only for diagonal elements while ${\bf B}$ is correct for every entry.
library(mvtnorm)
set.seed(1)
# Generate some parameters
p <- 4
mu <- rnorm(p)
Sigma <- rWishart(1, p, diag(p))[, , 1]
# Generate an observation from the distribution as a reference point
x <- rmvnorm(1, mu, Sigma)[1, ]
# Calculate the density at x
f <- dmvnorm(x, mu, Sigma)
# Choose a sufficiently small step-size
h <- .00001
# Calculate the density at x at each shifted Sigma_ij
f.shift <- matrix(NA, p, p)
for(i in 1:p) {
for(j in 1:p) {
zero.one.mat <- matrix(0, p, p)
zero.one.mat[i, j] <- 1
zero.one.mat[j, i] <- 1
Sigma.shift <- Sigma + h * zero.one.mat
f.shift[i, j] <- dmvnorm(x, mu, Sigma.shift)
}
}
# Caluclate the finite difference at each shifted Sigma_ij
fin.diff <- (f.shift - f) / h
# Calculate the solution proposed by @Macro and the true solution
A <- -1/2 * (solve(Sigma) - solve(Sigma) %*% (x - mu) %*% t(x - mu) %*% solve(Sigma))
B <- 2 * A - diag(diag(A))
# Verify that the true solution is approximately equal to the finite difference
fin.diff
A * f
B * f
|
How to take derivative of multivariate normal density?
|
I tried to computationally verify @Macro's answer but found what appears to be a minor error in the covariance solution. He obtained
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \
|
How to take derivative of multivariate normal density?
I tried to computationally verify @Macro's answer but found what appears to be a minor error in the covariance solution. He obtained
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \Sigma}}
&= -\frac{1}{2} \left( {\boldsymbol \Sigma}^{-1} -
{\boldsymbol \Sigma}^{-1}
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)
\left( {\boldsymbol y} - {\boldsymbol \mu} \right)'
{\boldsymbol \Sigma}^{-1} \right)
={\bf A}
\end{align}
$$
However, it appears that the correct solution is actually
$$
{\bf B}=2{\bf A} - \text{diag}({\bf A})
$$
The following R script provides a simple example in which the finite difference is calculated for each element of ${\boldsymbol \Sigma}$. It demonstrates that ${\bf A}$ provides the correct answer only for diagonal elements while ${\bf B}$ is correct for every entry.
library(mvtnorm)
set.seed(1)
# Generate some parameters
p <- 4
mu <- rnorm(p)
Sigma <- rWishart(1, p, diag(p))[, , 1]
# Generate an observation from the distribution as a reference point
x <- rmvnorm(1, mu, Sigma)[1, ]
# Calculate the density at x
f <- dmvnorm(x, mu, Sigma)
# Choose a sufficiently small step-size
h <- .00001
# Calculate the density at x at each shifted Sigma_ij
f.shift <- matrix(NA, p, p)
for(i in 1:p) {
for(j in 1:p) {
zero.one.mat <- matrix(0, p, p)
zero.one.mat[i, j] <- 1
zero.one.mat[j, i] <- 1
Sigma.shift <- Sigma + h * zero.one.mat
f.shift[i, j] <- dmvnorm(x, mu, Sigma.shift)
}
}
# Caluclate the finite difference at each shifted Sigma_ij
fin.diff <- (f.shift - f) / h
# Calculate the solution proposed by @Macro and the true solution
A <- -1/2 * (solve(Sigma) - solve(Sigma) %*% (x - mu) %*% t(x - mu) %*% solve(Sigma))
B <- 2 * A - diag(diag(A))
# Verify that the true solution is approximately equal to the finite difference
fin.diff
A * f
B * f
|
How to take derivative of multivariate normal density?
I tried to computationally verify @Macro's answer but found what appears to be a minor error in the covariance solution. He obtained
$$
\begin{align}
\frac{ \partial {\bf L} }{ \partial {\boldsymbol \
|
6,370
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
Both are done.
Least squares is easier, and the fact that for independent random variables "variances add" means that it's considerably more convenient; for examples, the ability to partition variances is particularly handy for comparing nested models. It's somewhat more efficient at the normal (least squares is maximum likelihood), which might seem to be a good justification -- however, some robust estimators with high breakdown can have surprisingly high efficiency at the normal.
But L1 norms are certainly used for regression problems and these days relatively often.
If you use R, you might find the discussion in section 5 here useful:
https://socialsciences.mcmaster.ca/jfox/Books/Companion/appendices/Appendix-Robust-Regression.pdf
(though the stuff before it on M estimation is also relevant, since it's also a special case of that)
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
Both are done.
Least squares is easier, and the fact that for independent random variables "variances add" means that it's considerably more convenient; for examples, the ability to partition variance
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
Both are done.
Least squares is easier, and the fact that for independent random variables "variances add" means that it's considerably more convenient; for examples, the ability to partition variances is particularly handy for comparing nested models. It's somewhat more efficient at the normal (least squares is maximum likelihood), which might seem to be a good justification -- however, some robust estimators with high breakdown can have surprisingly high efficiency at the normal.
But L1 norms are certainly used for regression problems and these days relatively often.
If you use R, you might find the discussion in section 5 here useful:
https://socialsciences.mcmaster.ca/jfox/Books/Companion/appendices/Appendix-Robust-Regression.pdf
(though the stuff before it on M estimation is also relevant, since it's also a special case of that)
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
Both are done.
Least squares is easier, and the fact that for independent random variables "variances add" means that it's considerably more convenient; for examples, the ability to partition variance
|
6,371
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
I can't help quoting from Huber, Robust Statistics, p.10 on this (sorry the quote is too long to fit in a comment):
Two time-honored measures of scatter are the mean absolute deviation
$$d_n=\frac{1}{n}\sum|x_i-\bar{x}|$$
and the mean square deviation
$$s_n=\left[\frac{1}{n}\sum(x_i-\bar{x})^2\right]^{1/2}$$
There was a dispute between Eddington (1914, p.147) and Fisher (1920,
footnote on p. 762) about the relative merits of $d_n$ and
$s_n$.[...] Fisher seemingly settled the matter by pointing out that
for normal observations $s_n$ is about 12% more efficient than $d_n$.
By the relation between the conditional mean $\hat{y}$ and the unconditional
mean $\bar{x}$ a similar argument applies to the residuals.
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
I can't help quoting from Huber, Robust Statistics, p.10 on this (sorry the quote is too long to fit in a comment):
Two time-honored measures of scatter are the mean absolute deviation
$$d_n=\frac{1}
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
I can't help quoting from Huber, Robust Statistics, p.10 on this (sorry the quote is too long to fit in a comment):
Two time-honored measures of scatter are the mean absolute deviation
$$d_n=\frac{1}{n}\sum|x_i-\bar{x}|$$
and the mean square deviation
$$s_n=\left[\frac{1}{n}\sum(x_i-\bar{x})^2\right]^{1/2}$$
There was a dispute between Eddington (1914, p.147) and Fisher (1920,
footnote on p. 762) about the relative merits of $d_n$ and
$s_n$.[...] Fisher seemingly settled the matter by pointing out that
for normal observations $s_n$ is about 12% more efficient than $d_n$.
By the relation between the conditional mean $\hat{y}$ and the unconditional
mean $\bar{x}$ a similar argument applies to the residuals.
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
I can't help quoting from Huber, Robust Statistics, p.10 on this (sorry the quote is too long to fit in a comment):
Two time-honored measures of scatter are the mean absolute deviation
$$d_n=\frac{1}
|
6,372
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
One thing that has not been mentioned yet is uniqueness. The least squares approach always produces a single "best" answer if the matrix of explanatory variables is full rank. When minimizing the sum of the absolute value of the residuals it is possible that there may be an infinite number of lines that all have the same sum of absolute residuals (the minimum). Which of those line should be used?
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
One thing that has not been mentioned yet is uniqueness. The least squares approach always produces a single "best" answer if the matrix of explanatory variables is full rank. When minimizing the su
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
One thing that has not been mentioned yet is uniqueness. The least squares approach always produces a single "best" answer if the matrix of explanatory variables is full rank. When minimizing the sum of the absolute value of the residuals it is possible that there may be an infinite number of lines that all have the same sum of absolute residuals (the minimum). Which of those line should be used?
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
One thing that has not been mentioned yet is uniqueness. The least squares approach always produces a single "best" answer if the matrix of explanatory variables is full rank. When minimizing the su
|
6,373
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
When the problem is expressed stochastically: $Y=aX+b+\epsilon$, where $\epsilon$ is normally distributed, the maximum likelihood estimate is the OLS estimate - not the minimum absolute deviation (MAD) estimate. So that's nice.
Furthermore, there is a strong link between OLS estimation and linear algebra. $\hat{Y}$ is a linear function of $Y$ --- in fact, it is a projection onto a subspace defined by the independent variables.
A lot of nice things happen with OLS --- MAD, not so much. And as @user603 points out, OLS are more efficient (where the normal model holds). It is less robust, of course.
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
|
When the problem is expressed stochastically: $Y=aX+b+\epsilon$, where $\epsilon$ is normally distributed, the maximum likelihood estimate is the OLS estimate - not the minimum absolute deviation (MAD
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
When the problem is expressed stochastically: $Y=aX+b+\epsilon$, where $\epsilon$ is normally distributed, the maximum likelihood estimate is the OLS estimate - not the minimum absolute deviation (MAD) estimate. So that's nice.
Furthermore, there is a strong link between OLS estimation and linear algebra. $\hat{Y}$ is a linear function of $Y$ --- in fact, it is a projection onto a subspace defined by the independent variables.
A lot of nice things happen with OLS --- MAD, not so much. And as @user603 points out, OLS are more efficient (where the normal model holds). It is less robust, of course.
|
Why squared residuals instead of absolute residuals in OLS estimation? [duplicate]
When the problem is expressed stochastically: $Y=aX+b+\epsilon$, where $\epsilon$ is normally distributed, the maximum likelihood estimate is the OLS estimate - not the minimum absolute deviation (MAD
|
6,374
|
Interpretation of plot (glm.model)
|
R does not have a distinct plot.glm() method. When you fit a model with glm() and run plot(), it calls ?plot.lm, which is appropriate for linear models (i.e., with a normally distributed error term).
In general, the meaning of these plots (at least for linear models) can be learned in various existing threads on CV (e.g.: Residuals vs. Fitted; qq-plots in several places: 1, 2, 3; Scale-Location; Residuals vs Leverage). However, those interpretations are not generally valid when the model in question is a logistic regression.
More specifically, the plots will often 'look funny' and lead people to believe that there is something wrong with the model when it is perfectly fine. We can see this by looking at those plots with a couple of simple simulations where we know the model is correct:
# we'll need this function to generate the Y data:
lo2p = function(lo){ exp(lo)/(1+exp(lo)) }
set.seed(10) # this makes the simulation exactly reproducible
x = runif(20, min=0, max=10) # the X data are uniformly distributed from 0 to 10
lo = -3 + .7*x # this is the true data generating process
p = lo2p(lo) # here I convert the log odds to probabilities
y = rbinom(20, size=1, prob=p) # this generates the Y data
mod = glm(y~x, family=binomial) # here I fit the model
summary(mod) # the model captures the DGP very well & has no
# ... # obvious problems:
# Deviance Residuals:
# Min 1Q Median 3Q Max
# -1.76225 -0.85236 -0.05011 0.83786 1.59393
#
# Coefficients:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -2.7370 1.4062 -1.946 0.0516 .
# x 0.6799 0.3261 2.085 0.0371 *
# ...
#
# Null deviance: 27.726 on 19 degrees of freedom
# Residual deviance: 21.236 on 18 degrees of freedom
# AIC: 25.236
#
# Number of Fisher Scoring iterations: 4
Now lets look at the plots we get from plot.lm():
Both the Residuals vs Fitted and the Scale-Location plots look like there are problems with the model, but we know there aren't any. These plots, intended for linear models, are simply often misleading when used with a logistic regression model.
Let's look at another example:
set.seed(10)
x2 = rep(c(1:4), each=40) # X is a factor with 4 levels
lo = -3 + .7*x2
p = lo2p(lo)
y = rbinom(160, size=1, prob=p)
mod = glm(y~as.factor(x2), family=binomial)
summary(mod) # again, everything looks good:
# ...
# Deviance Residuals:
# Min 1Q Median 3Q Max
# -1.0108 -0.8446 -0.3949 -0.2250 2.7162
#
# Coefficients:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -3.664 1.013 -3.618 0.000297 ***
# as.factor(x2)2 1.151 1.177 0.978 0.328125
# as.factor(x2)3 2.816 1.070 2.632 0.008481 **
# as.factor(x2)4 3.258 1.063 3.065 0.002175 **
# ...
#
# Null deviance: 160.13 on 159 degrees of freedom
# Residual deviance: 133.37 on 156 degrees of freedom
# AIC: 141.37
#
# Number of Fisher Scoring iterations: 6
Now all the plots look strange.
So what do these plots show you?
The Residuals vs Fitted plot can help you see, for example, if there are curvilinear trends that you missed. But the fit of a logistic regression is curvilinear by nature, so you can have odd looking trends in the residuals with nothing amiss.
The Normal Q-Q plot helps you detect if your residuals are normally distributed. But the deviance residuals don't have to be normally distributed for the model to be valid, so the normality / non-normality of the residuals doesn't necessarily tell you anything.
The Scale-Location plot can help you identify heteroscedasticity. But logistic regression models are pretty much heteroscedastic by nature.
The Residuals vs Leverage can help you identify possible outliers. But outliers in logistic regression don't necessarily manifest in the same way as in linear regression, so this plot may or may not be helpful in identifying them.
The simple take home lesson here is that these plots can be very hard to use to help you understand what is going on with your logistic regression model. It is probably best for people not to look at these plots at all when running logistic regression, unless they have considerable expertise.
|
Interpretation of plot (glm.model)
|
R does not have a distinct plot.glm() method. When you fit a model with glm() and run plot(), it calls ?plot.lm, which is appropriate for linear models (i.e., with a normally distributed error term).
|
Interpretation of plot (glm.model)
R does not have a distinct plot.glm() method. When you fit a model with glm() and run plot(), it calls ?plot.lm, which is appropriate for linear models (i.e., with a normally distributed error term).
In general, the meaning of these plots (at least for linear models) can be learned in various existing threads on CV (e.g.: Residuals vs. Fitted; qq-plots in several places: 1, 2, 3; Scale-Location; Residuals vs Leverage). However, those interpretations are not generally valid when the model in question is a logistic regression.
More specifically, the plots will often 'look funny' and lead people to believe that there is something wrong with the model when it is perfectly fine. We can see this by looking at those plots with a couple of simple simulations where we know the model is correct:
# we'll need this function to generate the Y data:
lo2p = function(lo){ exp(lo)/(1+exp(lo)) }
set.seed(10) # this makes the simulation exactly reproducible
x = runif(20, min=0, max=10) # the X data are uniformly distributed from 0 to 10
lo = -3 + .7*x # this is the true data generating process
p = lo2p(lo) # here I convert the log odds to probabilities
y = rbinom(20, size=1, prob=p) # this generates the Y data
mod = glm(y~x, family=binomial) # here I fit the model
summary(mod) # the model captures the DGP very well & has no
# ... # obvious problems:
# Deviance Residuals:
# Min 1Q Median 3Q Max
# -1.76225 -0.85236 -0.05011 0.83786 1.59393
#
# Coefficients:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -2.7370 1.4062 -1.946 0.0516 .
# x 0.6799 0.3261 2.085 0.0371 *
# ...
#
# Null deviance: 27.726 on 19 degrees of freedom
# Residual deviance: 21.236 on 18 degrees of freedom
# AIC: 25.236
#
# Number of Fisher Scoring iterations: 4
Now lets look at the plots we get from plot.lm():
Both the Residuals vs Fitted and the Scale-Location plots look like there are problems with the model, but we know there aren't any. These plots, intended for linear models, are simply often misleading when used with a logistic regression model.
Let's look at another example:
set.seed(10)
x2 = rep(c(1:4), each=40) # X is a factor with 4 levels
lo = -3 + .7*x2
p = lo2p(lo)
y = rbinom(160, size=1, prob=p)
mod = glm(y~as.factor(x2), family=binomial)
summary(mod) # again, everything looks good:
# ...
# Deviance Residuals:
# Min 1Q Median 3Q Max
# -1.0108 -0.8446 -0.3949 -0.2250 2.7162
#
# Coefficients:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -3.664 1.013 -3.618 0.000297 ***
# as.factor(x2)2 1.151 1.177 0.978 0.328125
# as.factor(x2)3 2.816 1.070 2.632 0.008481 **
# as.factor(x2)4 3.258 1.063 3.065 0.002175 **
# ...
#
# Null deviance: 160.13 on 159 degrees of freedom
# Residual deviance: 133.37 on 156 degrees of freedom
# AIC: 141.37
#
# Number of Fisher Scoring iterations: 6
Now all the plots look strange.
So what do these plots show you?
The Residuals vs Fitted plot can help you see, for example, if there are curvilinear trends that you missed. But the fit of a logistic regression is curvilinear by nature, so you can have odd looking trends in the residuals with nothing amiss.
The Normal Q-Q plot helps you detect if your residuals are normally distributed. But the deviance residuals don't have to be normally distributed for the model to be valid, so the normality / non-normality of the residuals doesn't necessarily tell you anything.
The Scale-Location plot can help you identify heteroscedasticity. But logistic regression models are pretty much heteroscedastic by nature.
The Residuals vs Leverage can help you identify possible outliers. But outliers in logistic regression don't necessarily manifest in the same way as in linear regression, so this plot may or may not be helpful in identifying them.
The simple take home lesson here is that these plots can be very hard to use to help you understand what is going on with your logistic regression model. It is probably best for people not to look at these plots at all when running logistic regression, unless they have considerable expertise.
|
Interpretation of plot (glm.model)
R does not have a distinct plot.glm() method. When you fit a model with glm() and run plot(), it calls ?plot.lm, which is appropriate for linear models (i.e., with a normally distributed error term).
|
6,375
|
Interpretation of plot (glm.model)
|
Residuals vs fitted - there should be no strong patterns (mild patterns are not a problem, see @gung's answer) and no outliers, residuals should be randomly distributed around zero.
Normal Q-Q - residuals should go around the diagonal line, i.e. should be normally distributed (see wiki for Q-Q plot). This plot helps checking if they are approximately normal.
Scale-location - as you can see, on Y axis there are also residuals (like in Residuals vs fitted plot), but they are scaled, so it's similar to (1), but in some cases it works better.
Residuals vs Leverage -- it helps to diagnose outlying cases. As in previous plots, outlying cases are numbered, but on this plot if there are any cases that are very different from the rest of the data they are plotted below thin red lines (check wiki on Cook's distance).
Read more on assumptions of regression as in many aspects there are similar (e.g. here, or tutorial on regression in R here).
|
Interpretation of plot (glm.model)
|
Residuals vs fitted - there should be no strong patterns (mild patterns are not a problem, see @gung's answer) and no outliers, residuals should be randomly distributed around zero.
Normal Q-Q - resid
|
Interpretation of plot (glm.model)
Residuals vs fitted - there should be no strong patterns (mild patterns are not a problem, see @gung's answer) and no outliers, residuals should be randomly distributed around zero.
Normal Q-Q - residuals should go around the diagonal line, i.e. should be normally distributed (see wiki for Q-Q plot). This plot helps checking if they are approximately normal.
Scale-location - as you can see, on Y axis there are also residuals (like in Residuals vs fitted plot), but they are scaled, so it's similar to (1), but in some cases it works better.
Residuals vs Leverage -- it helps to diagnose outlying cases. As in previous plots, outlying cases are numbered, but on this plot if there are any cases that are very different from the rest of the data they are plotted below thin red lines (check wiki on Cook's distance).
Read more on assumptions of regression as in many aspects there are similar (e.g. here, or tutorial on regression in R here).
|
Interpretation of plot (glm.model)
Residuals vs fitted - there should be no strong patterns (mild patterns are not a problem, see @gung's answer) and no outliers, residuals should be randomly distributed around zero.
Normal Q-Q - resid
|
6,376
|
Are there any good popular science book about statistics or machine learning?
|
I suspect The Lady Tasting Tea, by David Salsberg is exactly what you want. It's very much written in a narrative style, almost like a novel, with essentially no math (as I recall), so it would be accessible to anyone. I read it long ago and really enjoyed it. It reads very fast, and could give people a sense of what statistical analysis is about and how it can help us understand the world and solve practical problems.
|
Are there any good popular science book about statistics or machine learning?
|
I suspect The Lady Tasting Tea, by David Salsberg is exactly what you want. It's very much written in a narrative style, almost like a novel, with essentially no math (as I recall), so it would be ac
|
Are there any good popular science book about statistics or machine learning?
I suspect The Lady Tasting Tea, by David Salsberg is exactly what you want. It's very much written in a narrative style, almost like a novel, with essentially no math (as I recall), so it would be accessible to anyone. I read it long ago and really enjoyed it. It reads very fast, and could give people a sense of what statistical analysis is about and how it can help us understand the world and solve practical problems.
|
Are there any good popular science book about statistics or machine learning?
I suspect The Lady Tasting Tea, by David Salsberg is exactly what you want. It's very much written in a narrative style, almost like a novel, with essentially no math (as I recall), so it would be ac
|
6,377
|
Are there any good popular science book about statistics or machine learning?
|
Nate Silver's new book The Signal and the Noise: Why Most Predictions Fail – But Some Don't fits your description quite well. It is also an introduction into Bayesian thinking for laypeople. It got some attention lately and a review of the book can be found here.
Also worth checking out are Levitt & Dubner's Freakonomics books.
|
Are there any good popular science book about statistics or machine learning?
|
Nate Silver's new book The Signal and the Noise: Why Most Predictions Fail – But Some Don't fits your description quite well. It is also an introduction into Bayesian thinking for laypeople. It got so
|
Are there any good popular science book about statistics or machine learning?
Nate Silver's new book The Signal and the Noise: Why Most Predictions Fail – But Some Don't fits your description quite well. It is also an introduction into Bayesian thinking for laypeople. It got some attention lately and a review of the book can be found here.
Also worth checking out are Levitt & Dubner's Freakonomics books.
|
Are there any good popular science book about statistics or machine learning?
Nate Silver's new book The Signal and the Noise: Why Most Predictions Fail – But Some Don't fits your description quite well. It is also an introduction into Bayesian thinking for laypeople. It got so
|
6,378
|
Are there any good popular science book about statistics or machine learning?
|
More good reads:
The Flaw of Averages by Sam L. Savage
Fooled By Randomness by Nassim Taleb
Both are somewhat cautionary books about being careful towards how to interpret probability and statistics in our everyday lives. For example, in financial markets, one might misuse an everyday gaussian distribution as a risk measure with disastrous consequences, and thus we might want to use more empirical based models (such as monte carlo simulations) in practice. Taleb is very popular in financial circles, and often cautions us to be more careful about behavioral biases and over-reliance on modelling
|
Are there any good popular science book about statistics or machine learning?
|
More good reads:
The Flaw of Averages by Sam L. Savage
Fooled By Randomness by Nassim Taleb
Both are somewhat cautionary books about being careful towards how to interpret probability and statistics i
|
Are there any good popular science book about statistics or machine learning?
More good reads:
The Flaw of Averages by Sam L. Savage
Fooled By Randomness by Nassim Taleb
Both are somewhat cautionary books about being careful towards how to interpret probability and statistics in our everyday lives. For example, in financial markets, one might misuse an everyday gaussian distribution as a risk measure with disastrous consequences, and thus we might want to use more empirical based models (such as monte carlo simulations) in practice. Taleb is very popular in financial circles, and often cautions us to be more careful about behavioral biases and over-reliance on modelling
|
Are there any good popular science book about statistics or machine learning?
More good reads:
The Flaw of Averages by Sam L. Savage
Fooled By Randomness by Nassim Taleb
Both are somewhat cautionary books about being careful towards how to interpret probability and statistics i
|
6,379
|
Are there any good popular science book about statistics or machine learning?
|
"The Theory That Would Not Die" by Sharon Bertsch McGrayne is a very readable book on the history of Bayesian statistics and the general idea behind it without getting too bogged down in the math.
I am also a fan of "The Cartoon Guide to Statistics" by Gonnick and Smith as a nice introduction to the general concept of statistics with some of the math, but presented in a way that does not put you to sleep (I also have the cartoon guides to genetics, physics, and chemistry and have read a couple of the others).
|
Are there any good popular science book about statistics or machine learning?
|
"The Theory That Would Not Die" by Sharon Bertsch McGrayne is a very readable book on the history of Bayesian statistics and the general idea behind it without getting too bogged down in the math.
I a
|
Are there any good popular science book about statistics or machine learning?
"The Theory That Would Not Die" by Sharon Bertsch McGrayne is a very readable book on the history of Bayesian statistics and the general idea behind it without getting too bogged down in the math.
I am also a fan of "The Cartoon Guide to Statistics" by Gonnick and Smith as a nice introduction to the general concept of statistics with some of the math, but presented in a way that does not put you to sleep (I also have the cartoon guides to genetics, physics, and chemistry and have read a couple of the others).
|
Are there any good popular science book about statistics or machine learning?
"The Theory That Would Not Die" by Sharon Bertsch McGrayne is a very readable book on the history of Bayesian statistics and the general idea behind it without getting too bogged down in the math.
I a
|
6,380
|
Are there any good popular science book about statistics or machine learning?
|
I would suggest the following books, though neither is ideal, you should check out:
The (Mis)Behaviour of Markets by (the great) B. Mandelbrot
Struck By Lightning by Jefferey Rosenthal
with the former more focused on finance, but still statsy, and the latter is a introduction to all the interesting probability subjects: odds, the Monty Hall problem, utility functions, random walks etc.
|
Are there any good popular science book about statistics or machine learning?
|
I would suggest the following books, though neither is ideal, you should check out:
The (Mis)Behaviour of Markets by (the great) B. Mandelbrot
Struck By Lightning by Jefferey Rosenthal
with the form
|
Are there any good popular science book about statistics or machine learning?
I would suggest the following books, though neither is ideal, you should check out:
The (Mis)Behaviour of Markets by (the great) B. Mandelbrot
Struck By Lightning by Jefferey Rosenthal
with the former more focused on finance, but still statsy, and the latter is a introduction to all the interesting probability subjects: odds, the Monty Hall problem, utility functions, random walks etc.
|
Are there any good popular science book about statistics or machine learning?
I would suggest the following books, though neither is ideal, you should check out:
The (Mis)Behaviour of Markets by (the great) B. Mandelbrot
Struck By Lightning by Jefferey Rosenthal
with the form
|
6,381
|
Are there any good popular science book about statistics or machine learning?
|
A very good book for aiding basic statistical literacy and statistical reasoning - and for making the case for these as important - is The Tiger That Isn't by Andrew Dilnot, the former presenter of a popular radio show about applied statistics for the BBC.
I often recommend it as the statistics equivalent of the popular pop science book Bad Science by Ben Goldacre. It's good for introducing basic statistical reasoning, for showing the importance of basic statistical reasoning, and getting people concerned about the lack of basic statistical reasoning among people who really should know better (particularly politicians, journalists, etc). Very accessible, engaging, funny in places, deeply worrying in others! Particularly good as an introduction for anyone who thinks of numbers as 'not their thing'.
|
Are there any good popular science book about statistics or machine learning?
|
A very good book for aiding basic statistical literacy and statistical reasoning - and for making the case for these as important - is The Tiger That Isn't by Andrew Dilnot, the former presenter of
|
Are there any good popular science book about statistics or machine learning?
A very good book for aiding basic statistical literacy and statistical reasoning - and for making the case for these as important - is The Tiger That Isn't by Andrew Dilnot, the former presenter of a popular radio show about applied statistics for the BBC.
I often recommend it as the statistics equivalent of the popular pop science book Bad Science by Ben Goldacre. It's good for introducing basic statistical reasoning, for showing the importance of basic statistical reasoning, and getting people concerned about the lack of basic statistical reasoning among people who really should know better (particularly politicians, journalists, etc). Very accessible, engaging, funny in places, deeply worrying in others! Particularly good as an introduction for anyone who thinks of numbers as 'not their thing'.
|
Are there any good popular science book about statistics or machine learning?
A very good book for aiding basic statistical literacy and statistical reasoning - and for making the case for these as important - is The Tiger That Isn't by Andrew Dilnot, the former presenter of
|
6,382
|
Are there any good popular science book about statistics or machine learning?
|
Ian Ayres is author of the book "Super Crunchers: Why Thinking-by-Numbers Is the New Way to Be Smart" which discusses several examples of data mining.
|
Are there any good popular science book about statistics or machine learning?
|
Ian Ayres is author of the book "Super Crunchers: Why Thinking-by-Numbers Is the New Way to Be Smart" which discusses several examples of data mining.
|
Are there any good popular science book about statistics or machine learning?
Ian Ayres is author of the book "Super Crunchers: Why Thinking-by-Numbers Is the New Way to Be Smart" which discusses several examples of data mining.
|
Are there any good popular science book about statistics or machine learning?
Ian Ayres is author of the book "Super Crunchers: Why Thinking-by-Numbers Is the New Way to Be Smart" which discusses several examples of data mining.
|
6,383
|
Are there any good popular science book about statistics or machine learning?
|
The Drunkard's Walk by Leonard Mlodinow is an easy to read introduction to basic stats and probability. The content is aimed at an audience with no statistical or mathematical training, and there are no equations. I found it a little too dumbed down. There are lots of anecdotes relating various applications of bad statistics, and clear explanations of why they were wrong.
The book covers basic stats and conditional probability.
|
Are there any good popular science book about statistics or machine learning?
|
The Drunkard's Walk by Leonard Mlodinow is an easy to read introduction to basic stats and probability. The content is aimed at an audience with no statistical or mathematical training, and there are
|
Are there any good popular science book about statistics or machine learning?
The Drunkard's Walk by Leonard Mlodinow is an easy to read introduction to basic stats and probability. The content is aimed at an audience with no statistical or mathematical training, and there are no equations. I found it a little too dumbed down. There are lots of anecdotes relating various applications of bad statistics, and clear explanations of why they were wrong.
The book covers basic stats and conditional probability.
|
Are there any good popular science book about statistics or machine learning?
The Drunkard's Walk by Leonard Mlodinow is an easy to read introduction to basic stats and probability. The content is aimed at an audience with no statistical or mathematical training, and there are
|
6,384
|
Are there any good popular science book about statistics or machine learning?
|
I figured I'd fill in a gap here by pointing out a few good mass market-style books on fuzzy sets, information theory, entropy and statistical reasoning that I've read and highly recommend.
• For all things fuzzy, a good informal starting point is McNeill, Dan, 1993, Fuzzy Logic. Simon & Schuster: New York.
• For a good mass market intro to neural nets, organized around some interesting speculations about the organization of the human brain, see Hawkins, Jeff, 2004, On Intelligence. Times Books: New York.
For easily readable introductions to important topics like the pitfalls of statistics and fallacious reasoning, try these three:
• Huff, Darrell, 1954, How to Lie with Statistics. W.W. Norton & Company New York.
• Kault, David, 2003, Statistics with Common Sense. Greenwood Press: Westport, Connecticut.
• Smith, Gary, 2014, Standard Deviations: Flawed Assumptions, Tortured Data and Other Ways to Lie with Statistics. Overlook Press: New York.
The following are all related to information theory and entropy:
• Lucky, R. W., 1989, Silicon Dreams: Information, Man, and Machine. St. Martin's Press: New York.
• This author does an excellent job of putting information theory in context and pointing out abuses of it, while still writing in a way a non-specialist can grasp: Pierce, John Robinson, 1961, Symbols, Signals, and Noise: The Nature and Process of Communication. Harper: New York.
• I read this similar title, but can't remember if it's a later edition or a follow-up: Pierce, John Robinson, 1980, An Introduction to Information Theory: Symbols, Signals & Noise. Dover Publications: New York.
• If I remember right, this author was easily readable, while still getting into some more advanced concepts: Brillouin, Léon, 1964, Science, Uncertainty and Information. Academic Press: New York.
• Also see Brillouin, Léon, 1962, Science and Information Theory. Academic Press: New York.
• I read this long ago, but believe this author was readable and had some interesting observations on information theory: Bar-Hillel, Yehoshua, 1964, Language and Information: Selected Essays On Their Theory and Application. Addison-Wesley Pub. Co. Reading, Mass.
I want to caution that the mass market books on mind-blowing topics like chaos, information, quantum physics, probability, randomness, "Cybernetics," self-organization, fuzzy sets and artificial intelligence contain a small but prominent minority of material that is blown way out of proportion, sometimes to the point of being logically invalid. Each of these theories has well-known proponents who don't know when to stop with a good thing and make huge logical leaps to turn their particular fields into grandiose explanations of everything. Each has authors that go way beyond the evidence, even to the point of ignoring explicit warnings by the founders of their fields, as Shannon did about misuses of information entropy. There is a feverish, unhealthy tint to their writing, which in sometimes qualifies as junk science produced by cranks. I could name some famous names who continue to print outrageous things about these topics, based on obvious logical fallacies and sometimes grossly mistaken points of fact. I won't do that here to avoid a serious flame war, because I'd have to call out some idols and sacred cows. Just be aware that misleading material of this kind is out there and be ready to red-flag it. Watch out for extraordinary claims without the requisite extraordinary proof.
|
Are there any good popular science book about statistics or machine learning?
|
I figured I'd fill in a gap here by pointing out a few good mass market-style books on fuzzy sets, information theory, entropy and statistical reasoning that I've read and highly recommend.
• For all
|
Are there any good popular science book about statistics or machine learning?
I figured I'd fill in a gap here by pointing out a few good mass market-style books on fuzzy sets, information theory, entropy and statistical reasoning that I've read and highly recommend.
• For all things fuzzy, a good informal starting point is McNeill, Dan, 1993, Fuzzy Logic. Simon & Schuster: New York.
• For a good mass market intro to neural nets, organized around some interesting speculations about the organization of the human brain, see Hawkins, Jeff, 2004, On Intelligence. Times Books: New York.
For easily readable introductions to important topics like the pitfalls of statistics and fallacious reasoning, try these three:
• Huff, Darrell, 1954, How to Lie with Statistics. W.W. Norton & Company New York.
• Kault, David, 2003, Statistics with Common Sense. Greenwood Press: Westport, Connecticut.
• Smith, Gary, 2014, Standard Deviations: Flawed Assumptions, Tortured Data and Other Ways to Lie with Statistics. Overlook Press: New York.
The following are all related to information theory and entropy:
• Lucky, R. W., 1989, Silicon Dreams: Information, Man, and Machine. St. Martin's Press: New York.
• This author does an excellent job of putting information theory in context and pointing out abuses of it, while still writing in a way a non-specialist can grasp: Pierce, John Robinson, 1961, Symbols, Signals, and Noise: The Nature and Process of Communication. Harper: New York.
• I read this similar title, but can't remember if it's a later edition or a follow-up: Pierce, John Robinson, 1980, An Introduction to Information Theory: Symbols, Signals & Noise. Dover Publications: New York.
• If I remember right, this author was easily readable, while still getting into some more advanced concepts: Brillouin, Léon, 1964, Science, Uncertainty and Information. Academic Press: New York.
• Also see Brillouin, Léon, 1962, Science and Information Theory. Academic Press: New York.
• I read this long ago, but believe this author was readable and had some interesting observations on information theory: Bar-Hillel, Yehoshua, 1964, Language and Information: Selected Essays On Their Theory and Application. Addison-Wesley Pub. Co. Reading, Mass.
I want to caution that the mass market books on mind-blowing topics like chaos, information, quantum physics, probability, randomness, "Cybernetics," self-organization, fuzzy sets and artificial intelligence contain a small but prominent minority of material that is blown way out of proportion, sometimes to the point of being logically invalid. Each of these theories has well-known proponents who don't know when to stop with a good thing and make huge logical leaps to turn their particular fields into grandiose explanations of everything. Each has authors that go way beyond the evidence, even to the point of ignoring explicit warnings by the founders of their fields, as Shannon did about misuses of information entropy. There is a feverish, unhealthy tint to their writing, which in sometimes qualifies as junk science produced by cranks. I could name some famous names who continue to print outrageous things about these topics, based on obvious logical fallacies and sometimes grossly mistaken points of fact. I won't do that here to avoid a serious flame war, because I'd have to call out some idols and sacred cows. Just be aware that misleading material of this kind is out there and be ready to red-flag it. Watch out for extraordinary claims without the requisite extraordinary proof.
|
Are there any good popular science book about statistics or machine learning?
I figured I'd fill in a gap here by pointing out a few good mass market-style books on fuzzy sets, information theory, entropy and statistical reasoning that I've read and highly recommend.
• For all
|
6,385
|
Are there any good popular science book about statistics or machine learning?
|
The Master Algorithm: How the Quest for the Ultimate Learning Machine Will Remake Our World is a book by Pedro Domingos released in 2015. Domingos wrote the book in order to generate interest from people outside the field.
The book outlines five tribes of machine learning: inductive
reasoning, connectionism, evolutionary computation, Bayes' theorem and
analogical modelling. The author explains these tribes to the reader
by referring to more understandable processes of logic, connections
made in the brain, natural selection, probability and similarity
judgements. Throughout the book, it is suggested that each different
tribe has the potential to contribute to a unifying "master
algorithm".
https://en.m.wikipedia.org/wiki/The_Master_Algorithm
|
Are there any good popular science book about statistics or machine learning?
|
The Master Algorithm: How the Quest for the Ultimate Learning Machine Will Remake Our World is a book by Pedro Domingos released in 2015. Domingos wrote the book in order to generate interest from peo
|
Are there any good popular science book about statistics or machine learning?
The Master Algorithm: How the Quest for the Ultimate Learning Machine Will Remake Our World is a book by Pedro Domingos released in 2015. Domingos wrote the book in order to generate interest from people outside the field.
The book outlines five tribes of machine learning: inductive
reasoning, connectionism, evolutionary computation, Bayes' theorem and
analogical modelling. The author explains these tribes to the reader
by referring to more understandable processes of logic, connections
made in the brain, natural selection, probability and similarity
judgements. Throughout the book, it is suggested that each different
tribe has the potential to contribute to a unifying "master
algorithm".
https://en.m.wikipedia.org/wiki/The_Master_Algorithm
|
Are there any good popular science book about statistics or machine learning?
The Master Algorithm: How the Quest for the Ultimate Learning Machine Will Remake Our World is a book by Pedro Domingos released in 2015. Domingos wrote the book in order to generate interest from peo
|
6,386
|
Are there any good popular science book about statistics or machine learning?
|
Numbers Rule your World, by Kaiser Fung, describes the importance of statistics in a lot of systems that are fundamental to modern society, like insurance markets.
Number Sense, also by Kaiser Fung, talks about "big data" more specifically.
|
Are there any good popular science book about statistics or machine learning?
|
Numbers Rule your World, by Kaiser Fung, describes the importance of statistics in a lot of systems that are fundamental to modern society, like insurance markets.
Number Sense, also by Kaiser Fung, t
|
Are there any good popular science book about statistics or machine learning?
Numbers Rule your World, by Kaiser Fung, describes the importance of statistics in a lot of systems that are fundamental to modern society, like insurance markets.
Number Sense, also by Kaiser Fung, talks about "big data" more specifically.
|
Are there any good popular science book about statistics or machine learning?
Numbers Rule your World, by Kaiser Fung, describes the importance of statistics in a lot of systems that are fundamental to modern society, like insurance markets.
Number Sense, also by Kaiser Fung, t
|
6,387
|
Least-angle regression vs. lasso
|
The "no free lunch" theorems suggest that there are no a-priori distinctions between statistical inference algorithms, i.e. whether LARS or LASSO works best depends on the nature of the particular dataset. In practice then, it is best to try both and use some reliable estimator of generalisation performance to decide which to use in operation (or use an ensemble). As the differences between LARS and LASSO are rather slight, the differences in performance are likely to be rather slight as well, but in general there is only one way to find out for sure!
|
Least-angle regression vs. lasso
|
The "no free lunch" theorems suggest that there are no a-priori distinctions between statistical inference algorithms, i.e. whether LARS or LASSO works best depends on the nature of the particular dat
|
Least-angle regression vs. lasso
The "no free lunch" theorems suggest that there are no a-priori distinctions between statistical inference algorithms, i.e. whether LARS or LASSO works best depends on the nature of the particular dataset. In practice then, it is best to try both and use some reliable estimator of generalisation performance to decide which to use in operation (or use an ensemble). As the differences between LARS and LASSO are rather slight, the differences in performance are likely to be rather slight as well, but in general there is only one way to find out for sure!
|
Least-angle regression vs. lasso
The "no free lunch" theorems suggest that there are no a-priori distinctions between statistical inference algorithms, i.e. whether LARS or LASSO works best depends on the nature of the particular dat
|
6,388
|
Least-angle regression vs. lasso
|
When used in stage-wise mode, the LARS algorithm is a greedy method that does not yield a provably consistent estimator (in other words, it does not converge to a stable result when you increase the number of samples).
Conversely, the LASSO (and thus the LARS algorithm when used in LASSO mode) solves a convex data fitting problem. In particular, this problem (the L1 penalized linear estimator) has plenty of nice proved properties (consistency, sparsistency).
I would thus try to always use the LARS in LASSO mode (or use another solver for LASSO), unless you have very good reasons to prefer stage-wise.
|
Least-angle regression vs. lasso
|
When used in stage-wise mode, the LARS algorithm is a greedy method that does not yield a provably consistent estimator (in other words, it does not converge to a stable result when you increase the n
|
Least-angle regression vs. lasso
When used in stage-wise mode, the LARS algorithm is a greedy method that does not yield a provably consistent estimator (in other words, it does not converge to a stable result when you increase the number of samples).
Conversely, the LASSO (and thus the LARS algorithm when used in LASSO mode) solves a convex data fitting problem. In particular, this problem (the L1 penalized linear estimator) has plenty of nice proved properties (consistency, sparsistency).
I would thus try to always use the LARS in LASSO mode (or use another solver for LASSO), unless you have very good reasons to prefer stage-wise.
|
Least-angle regression vs. lasso
When used in stage-wise mode, the LARS algorithm is a greedy method that does not yield a provably consistent estimator (in other words, it does not converge to a stable result when you increase the n
|
6,389
|
Least-angle regression vs. lasso
|
As mentioned before, LARS is a particular method to solve the Lasso problem, i.e. the $l_1$-regularized least squares problem. Its success stems from the fact that it requires an asymptotic effort comparable to standard least-squares regression, and thus a highly superior performance than required by the solution of a quadratic programming problem. Later extensions of LARS also adressed the more general elastic-net problem where you include a sum of $l_1$ and $l_2$-regularization terms into the least-squares functional.
The intention of this answer is to point out that LARS nowadays seems to have been superseeded by coordinate-descent and stochastic coordinate-descent methods. These methods are based on particularly simple algorithms, while at the same time the performance seems to be higher than that of LARS (often one or two orders of magnitude faster). For examples see this paper of Friedman et al.
So, if you plan to implement LARS, don't. Use coordinate-descent which takes a few hours.
|
Least-angle regression vs. lasso
|
As mentioned before, LARS is a particular method to solve the Lasso problem, i.e. the $l_1$-regularized least squares problem. Its success stems from the fact that it requires an asymptotic effort com
|
Least-angle regression vs. lasso
As mentioned before, LARS is a particular method to solve the Lasso problem, i.e. the $l_1$-regularized least squares problem. Its success stems from the fact that it requires an asymptotic effort comparable to standard least-squares regression, and thus a highly superior performance than required by the solution of a quadratic programming problem. Later extensions of LARS also adressed the more general elastic-net problem where you include a sum of $l_1$ and $l_2$-regularization terms into the least-squares functional.
The intention of this answer is to point out that LARS nowadays seems to have been superseeded by coordinate-descent and stochastic coordinate-descent methods. These methods are based on particularly simple algorithms, while at the same time the performance seems to be higher than that of LARS (often one or two orders of magnitude faster). For examples see this paper of Friedman et al.
So, if you plan to implement LARS, don't. Use coordinate-descent which takes a few hours.
|
Least-angle regression vs. lasso
As mentioned before, LARS is a particular method to solve the Lasso problem, i.e. the $l_1$-regularized least squares problem. Its success stems from the fact that it requires an asymptotic effort com
|
6,390
|
Least-angle regression vs. lasso
|
LASSO is not an algorithm per se, but an operator.
There are many different ways to derive efficient algorithms for $\ell_1$ regularized problems. For instance, one can use quadratic programming to them tackle directly. I guess this is what you refer to as LASSO.
Another one is LARS, very popular because of its simplicity, connection with forward procedures (yet not too greedy), very constructive proof and easy generalization.
Even compared with state of the art quadratic programming solvers, LARS can be much more efficient.
|
Least-angle regression vs. lasso
|
LASSO is not an algorithm per se, but an operator.
There are many different ways to derive efficient algorithms for $\ell_1$ regularized problems. For instance, one can use quadratic programming to t
|
Least-angle regression vs. lasso
LASSO is not an algorithm per se, but an operator.
There are many different ways to derive efficient algorithms for $\ell_1$ regularized problems. For instance, one can use quadratic programming to them tackle directly. I guess this is what you refer to as LASSO.
Another one is LARS, very popular because of its simplicity, connection with forward procedures (yet not too greedy), very constructive proof and easy generalization.
Even compared with state of the art quadratic programming solvers, LARS can be much more efficient.
|
Least-angle regression vs. lasso
LASSO is not an algorithm per se, but an operator.
There are many different ways to derive efficient algorithms for $\ell_1$ regularized problems. For instance, one can use quadratic programming to t
|
6,391
|
Least-angle regression vs. lasso
|
The computation of the lasso solutions is a quadratic programming problem, and can be tackled by standard numerical analysis algorithms. But the least angle regression procedure is a better approach. This algorithm exploits the special structure of the lasso problem, and provides an efficient way to compute the solutions simultaneously for all values of $\lambda$.
Here is my opinion:
Your question can be divided to two parts. High dimensional cases and low dimensional cases.
On the other hand it depends on what criteria are you going to use for selecting the optimal model. in the original paper of LARS, it is proved a $C_p$ criteria for selecting the best model and also you can see a SVS and CV criteria in the 'Discussion' of the paper as well. Generally, there are tiny differences between LARS and Lasso and can be ignored completely.
In addition LARS is computationally fast and reliable. Lasso is fast but there is a tiny difference between algorithm that causes the LARS win the speed challenge. On the other hand there are alternative packages for example in R, called 'glmnet' that work more reliable than lars package(because it is more general).
To sum up, there is nothing significant that can be considered about lars and lasso. It depended on the context you are going to use model.
I personally advise using glmnet in R in both high and low dimensional cases. or if you are interested in different criteria, you can use http://cran.r-project.org/web/packages/msgps/ package.
|
Least-angle regression vs. lasso
|
The computation of the lasso solutions is a quadratic programming problem, and can be tackled by standard numerical analysis algorithms. But the least angle regression procedure is a better approach.
|
Least-angle regression vs. lasso
The computation of the lasso solutions is a quadratic programming problem, and can be tackled by standard numerical analysis algorithms. But the least angle regression procedure is a better approach. This algorithm exploits the special structure of the lasso problem, and provides an efficient way to compute the solutions simultaneously for all values of $\lambda$.
Here is my opinion:
Your question can be divided to two parts. High dimensional cases and low dimensional cases.
On the other hand it depends on what criteria are you going to use for selecting the optimal model. in the original paper of LARS, it is proved a $C_p$ criteria for selecting the best model and also you can see a SVS and CV criteria in the 'Discussion' of the paper as well. Generally, there are tiny differences between LARS and Lasso and can be ignored completely.
In addition LARS is computationally fast and reliable. Lasso is fast but there is a tiny difference between algorithm that causes the LARS win the speed challenge. On the other hand there are alternative packages for example in R, called 'glmnet' that work more reliable than lars package(because it is more general).
To sum up, there is nothing significant that can be considered about lars and lasso. It depended on the context you are going to use model.
I personally advise using glmnet in R in both high and low dimensional cases. or if you are interested in different criteria, you can use http://cran.r-project.org/web/packages/msgps/ package.
|
Least-angle regression vs. lasso
The computation of the lasso solutions is a quadratic programming problem, and can be tackled by standard numerical analysis algorithms. But the least angle regression procedure is a better approach.
|
6,392
|
Least-angle regression vs. lasso
|
In some contexts a regularized version of the least squares solution may be preferable. The LASSO (least absolute shrinkage and selection operator) algorithm, for example, finds a least-squares solution with the constraint that | β | 1, the L1-norm of the parameter vector, is no greater than a given value. Equivalently, it may solve an unconstrained minimization of the least-squares penalty with α | β | 1 added, where α is a constant (this is the Lagrangian form of the constrained problem.) This problem may be solved using quadratic programming or more general convex optimization methods, as well as by specific algorithms such as the least angle regression algorithm. The L1-regularized formulation is useful in some contexts due to its tendency to prefer solutions with fewer nonzero parameter values, effectively reducing the number of variables upon which the given solution is dependent.[11] For this reason, the LASSO and its variants are fundamental to the field of compressed sensing.
|
Least-angle regression vs. lasso
|
In some contexts a regularized version of the least squares solution may be preferable. The LASSO (least absolute shrinkage and selection operator) algorithm, for example, finds a least-squares soluti
|
Least-angle regression vs. lasso
In some contexts a regularized version of the least squares solution may be preferable. The LASSO (least absolute shrinkage and selection operator) algorithm, for example, finds a least-squares solution with the constraint that | β | 1, the L1-norm of the parameter vector, is no greater than a given value. Equivalently, it may solve an unconstrained minimization of the least-squares penalty with α | β | 1 added, where α is a constant (this is the Lagrangian form of the constrained problem.) This problem may be solved using quadratic programming or more general convex optimization methods, as well as by specific algorithms such as the least angle regression algorithm. The L1-regularized formulation is useful in some contexts due to its tendency to prefer solutions with fewer nonzero parameter values, effectively reducing the number of variables upon which the given solution is dependent.[11] For this reason, the LASSO and its variants are fundamental to the field of compressed sensing.
|
Least-angle regression vs. lasso
In some contexts a regularized version of the least squares solution may be preferable. The LASSO (least absolute shrinkage and selection operator) algorithm, for example, finds a least-squares soluti
|
6,393
|
Are neural networks better than SVMs?
|
Short answer: On small data sets, SVM might be preferred.
Long answer:
Historically, neural networks are older than SVMs and SVMs were initially developed as a method of efficiently training the neural networks. So, when SVMs matured in 1990s, there was a reason why people switched from neural networks to SVMs. Later, as data sets grew larger and more complex, so that feature selection became a (even bigger) problem, while, at the same time, computational power rose, people switched back again.
This development already suggests that both have their strengths and weaknesses and that there is, as Haitao says, no free lunch.
Essentially, both methods do some kind of data transformation to "send" them into a higher dimensional space. What the kernel function does for the SVMs, the hidden layers do for neural networks. The last, output layer in the network also performs a linear separation of the so transformed data. So this is not the core difference.
To demonstrate this, I'm so free to use Haitao's example. As you can see below, a two-layer neural network, with 5 neurons in the hidden layer, can perfectly separate the two classes. The blue class can be fully enclosed in a pentagon (pale blue) area. Each neuron in the hidden layer determines a linear boundary---a side of the pentagon, producing, say, +1 when its input is a point on the "blue" side of the line and -1 otherwise (it could also produce 0, it doesn't really matter).
I have used different colours to highlight which neuron is responsible for which boundary. The output neuron (black) simply checks (performs a logical AND, which is again a linearly separable function) whether all hidden neurons give the same, "positive" answer. Observe that this last neuron has five inputs. I.e. its input is a 5-dimensional vector. So the hidden layers have transformed 2D data into 5D data.
Notice, however, that the boundaries drawn by the neural network are somewhat arbitrary. You can shift and rotate them slightly without really affecting the result. How the network draws the boundary is somewhat random; it depends on the initialisation of the weights and on the order you present the training set to it. This is where SVMs differ: They are guaranteed to draw the boundary mid-way between the closest points of the two classes! It can be (has been) shown that this boundary is the optimal one. Finding the boundary is a convex (quadratic) optimisation problem for which fast algorithms exist. Also, the kernel trick has the computational advantage that it's usually much faster to compute a single non-linear function than to pass the vector through many hidden layers.
However, since SVMs never compute the boundary explicitly, but through the weighted sum of the kernel functions over the pairs of the input data, the computational effort scales quadratically with the data set size. For large data sets this quickly becomes impractical.
Also, when the data are high-dimensional (think of images, with millions of pixels) the SVMs might become overwhelmed by the curse of dimensionality: It becomes too easy to draw a good boundary on the training set, but which has poor generalisation properties. Convolutional neural networks, on the other hand, are capable of learning the relevant features from the data.
There is also a computational power issue here: Today's networks like to use activation functions which are linear in segments, like the ReLUs, for a reason. Applying them is simple linear algebra, something GPUs are good at (because 3D graphics also involves a lot of matrix multiplications). So today's neural networks are, in part, a by-product of the gaming industry.
In summary, my suggestion is to use SVMs for low-dimensional, small data sets and neural networks for high-dimensional large data sets.
|
Are neural networks better than SVMs?
|
Short answer: On small data sets, SVM might be preferred.
Long answer:
Historically, neural networks are older than SVMs and SVMs were initially developed as a method of efficiently training the neura
|
Are neural networks better than SVMs?
Short answer: On small data sets, SVM might be preferred.
Long answer:
Historically, neural networks are older than SVMs and SVMs were initially developed as a method of efficiently training the neural networks. So, when SVMs matured in 1990s, there was a reason why people switched from neural networks to SVMs. Later, as data sets grew larger and more complex, so that feature selection became a (even bigger) problem, while, at the same time, computational power rose, people switched back again.
This development already suggests that both have their strengths and weaknesses and that there is, as Haitao says, no free lunch.
Essentially, both methods do some kind of data transformation to "send" them into a higher dimensional space. What the kernel function does for the SVMs, the hidden layers do for neural networks. The last, output layer in the network also performs a linear separation of the so transformed data. So this is not the core difference.
To demonstrate this, I'm so free to use Haitao's example. As you can see below, a two-layer neural network, with 5 neurons in the hidden layer, can perfectly separate the two classes. The blue class can be fully enclosed in a pentagon (pale blue) area. Each neuron in the hidden layer determines a linear boundary---a side of the pentagon, producing, say, +1 when its input is a point on the "blue" side of the line and -1 otherwise (it could also produce 0, it doesn't really matter).
I have used different colours to highlight which neuron is responsible for which boundary. The output neuron (black) simply checks (performs a logical AND, which is again a linearly separable function) whether all hidden neurons give the same, "positive" answer. Observe that this last neuron has five inputs. I.e. its input is a 5-dimensional vector. So the hidden layers have transformed 2D data into 5D data.
Notice, however, that the boundaries drawn by the neural network are somewhat arbitrary. You can shift and rotate them slightly without really affecting the result. How the network draws the boundary is somewhat random; it depends on the initialisation of the weights and on the order you present the training set to it. This is where SVMs differ: They are guaranteed to draw the boundary mid-way between the closest points of the two classes! It can be (has been) shown that this boundary is the optimal one. Finding the boundary is a convex (quadratic) optimisation problem for which fast algorithms exist. Also, the kernel trick has the computational advantage that it's usually much faster to compute a single non-linear function than to pass the vector through many hidden layers.
However, since SVMs never compute the boundary explicitly, but through the weighted sum of the kernel functions over the pairs of the input data, the computational effort scales quadratically with the data set size. For large data sets this quickly becomes impractical.
Also, when the data are high-dimensional (think of images, with millions of pixels) the SVMs might become overwhelmed by the curse of dimensionality: It becomes too easy to draw a good boundary on the training set, but which has poor generalisation properties. Convolutional neural networks, on the other hand, are capable of learning the relevant features from the data.
There is also a computational power issue here: Today's networks like to use activation functions which are linear in segments, like the ReLUs, for a reason. Applying them is simple linear algebra, something GPUs are good at (because 3D graphics also involves a lot of matrix multiplications). So today's neural networks are, in part, a by-product of the gaming industry.
In summary, my suggestion is to use SVMs for low-dimensional, small data sets and neural networks for high-dimensional large data sets.
|
Are neural networks better than SVMs?
Short answer: On small data sets, SVM might be preferred.
Long answer:
Historically, neural networks are older than SVMs and SVMs were initially developed as a method of efficiently training the neura
|
6,394
|
Are neural networks better than SVMs?
|
You may have heard of the "no free lunch theorem" in machine learning. For each model, there are pros and cons for specific data and use case.
So. NN is not better than SVM and I can give couple examples easily. One important argument is SVM is convex but NN is generally not. Having a convex problem is desirable because we have more tools to solve it more reliable.
If we know our data, we can pick a better model to fit data better. For example, if we have some data like donut shape. Like this
using SVM with right kernel is better than using NN and NN may overfit data in this case.
|
Are neural networks better than SVMs?
|
You may have heard of the "no free lunch theorem" in machine learning. For each model, there are pros and cons for specific data and use case.
So. NN is not better than SVM and I can give couple examp
|
Are neural networks better than SVMs?
You may have heard of the "no free lunch theorem" in machine learning. For each model, there are pros and cons for specific data and use case.
So. NN is not better than SVM and I can give couple examples easily. One important argument is SVM is convex but NN is generally not. Having a convex problem is desirable because we have more tools to solve it more reliable.
If we know our data, we can pick a better model to fit data better. For example, if we have some data like donut shape. Like this
using SVM with right kernel is better than using NN and NN may overfit data in this case.
|
Are neural networks better than SVMs?
You may have heard of the "no free lunch theorem" in machine learning. For each model, there are pros and cons for specific data and use case.
So. NN is not better than SVM and I can give couple examp
|
6,395
|
Are neural networks better than SVMs?
|
SVM is interesting if you have a kernel in mind that you know is appropriate, or a domain-specific kernel that would be difficult to express in a differentiable way (a common example might be a string-similarity space for DNA sequences). But what if you have no idea what kind of kernel you should use? What if your data is a wide collection of values and you're not even sure in advance which ones have relevance? You could spend human researcher time doing feature engineering, or you could try automatic kernel search methods, which are pretty expensive, but might even come up with something that could be considered interpretable, on a good day.
Or you could dump the whole thing into a DNN and train. What a neural net does through backprop and gradient descent could very well be considered to be learning a kernel, only instead of having a nice functional form, it's composed (literally) of a large number of applications of a basic nonlinearity, with some additions and multiplications thrown in. The next-to-last layer of a typical classification network is the result of this — it's a projection into a space with one dimension per neuron in that layer, where the categories are well-separated, and then the final result (ignoring the softmax, which is really just a kind of normalization) is an affine map of that space into one where the categories are axis-aligned, so the surfaces of separation come for free with the geometry (but we could send them backwards onto that second-to-last layer if we wanted).
The DNN classifier accomplishes something very similar to an SVM classifier, only it does it in a "dumb" way using gradient descent and repetition of simple differentiable units. But sometimes in computation, "dumb" has its advantages. Ease of application to GPUs (which love applying the same simple operation to a large number of data points in parallel) is one. The ability of SGD and minibatch gradient descent to scale up to very large numbers of examples with minimal loss of efficiency is another. Of course, it comes with its own downsides. If you make the wrong choices of NN architecture, initial weights, optimization method, learning rate, batch size, etc. then the stochastic training process might completely fail to converge, or take a million years to do so — whereas SVM training is basically deterministic.
(Forgive an amateur blundering around, oversimplifying, and abusing terminology; these are my personal experiences after 15 years or so of playing with this stuff on an occasional hobby level).
|
Are neural networks better than SVMs?
|
SVM is interesting if you have a kernel in mind that you know is appropriate, or a domain-specific kernel that would be difficult to express in a differentiable way (a common example might be a string
|
Are neural networks better than SVMs?
SVM is interesting if you have a kernel in mind that you know is appropriate, or a domain-specific kernel that would be difficult to express in a differentiable way (a common example might be a string-similarity space for DNA sequences). But what if you have no idea what kind of kernel you should use? What if your data is a wide collection of values and you're not even sure in advance which ones have relevance? You could spend human researcher time doing feature engineering, or you could try automatic kernel search methods, which are pretty expensive, but might even come up with something that could be considered interpretable, on a good day.
Or you could dump the whole thing into a DNN and train. What a neural net does through backprop and gradient descent could very well be considered to be learning a kernel, only instead of having a nice functional form, it's composed (literally) of a large number of applications of a basic nonlinearity, with some additions and multiplications thrown in. The next-to-last layer of a typical classification network is the result of this — it's a projection into a space with one dimension per neuron in that layer, where the categories are well-separated, and then the final result (ignoring the softmax, which is really just a kind of normalization) is an affine map of that space into one where the categories are axis-aligned, so the surfaces of separation come for free with the geometry (but we could send them backwards onto that second-to-last layer if we wanted).
The DNN classifier accomplishes something very similar to an SVM classifier, only it does it in a "dumb" way using gradient descent and repetition of simple differentiable units. But sometimes in computation, "dumb" has its advantages. Ease of application to GPUs (which love applying the same simple operation to a large number of data points in parallel) is one. The ability of SGD and minibatch gradient descent to scale up to very large numbers of examples with minimal loss of efficiency is another. Of course, it comes with its own downsides. If you make the wrong choices of NN architecture, initial weights, optimization method, learning rate, batch size, etc. then the stochastic training process might completely fail to converge, or take a million years to do so — whereas SVM training is basically deterministic.
(Forgive an amateur blundering around, oversimplifying, and abusing terminology; these are my personal experiences after 15 years or so of playing with this stuff on an occasional hobby level).
|
Are neural networks better than SVMs?
SVM is interesting if you have a kernel in mind that you know is appropriate, or a domain-specific kernel that would be difficult to express in a differentiable way (a common example might be a string
|
6,396
|
Are neural networks better than SVMs?
|
The paper "Every Model Learned by Gradient Descent Is Approximately a Kernel Machine" by Pedro Domingos, shows that every NN learned by gradient descent (not stochastic) is in essence a kernel machine. The kernel has rather a complicated form:
$$
K(x, x^{'}) = \int_{c(t)} \nabla_w y(x) \nabla_w y(x^{'}) dt
$$
Where $c(t)$ is the path traversed by a NN during the gradient descent. These is result is actually of a controversial practical importance, but gives rather an interesting interpretation and insights.
|
Are neural networks better than SVMs?
|
The paper "Every Model Learned by Gradient Descent Is Approximately a Kernel Machine" by Pedro Domingos, shows that every NN learned by gradient descent (not stochastic) is in essence a kernel machine
|
Are neural networks better than SVMs?
The paper "Every Model Learned by Gradient Descent Is Approximately a Kernel Machine" by Pedro Domingos, shows that every NN learned by gradient descent (not stochastic) is in essence a kernel machine. The kernel has rather a complicated form:
$$
K(x, x^{'}) = \int_{c(t)} \nabla_w y(x) \nabla_w y(x^{'}) dt
$$
Where $c(t)$ is the path traversed by a NN during the gradient descent. These is result is actually of a controversial practical importance, but gives rather an interesting interpretation and insights.
|
Are neural networks better than SVMs?
The paper "Every Model Learned by Gradient Descent Is Approximately a Kernel Machine" by Pedro Domingos, shows that every NN learned by gradient descent (not stochastic) is in essence a kernel machine
|
6,397
|
Are neural networks better than SVMs?
|
I am not an expert, so consider this as an opinion from someone who is still learning about these two fields.
Short Answer
Theoretically, No. DNNs can perform all the functions of SVMs and more.
Practically, mostly no. For most modern problems DNNs are a better choice. If your input data size is small and you are successful in finding a suitable kernel, however, an SVM may be a more efficient solution. But, if you can't determine a suitable kernel, NNs are then a better choice.
Long Answer
If we gloss over some details about the constraints of different implementations, deep neural networks are essentially universal function approximators. Given enough training time and a sufficiently robust architecture and training set (what we might call operating at the theoretical limit) they will essentially learn an approximation of an optimum solution. It might be an SVM-style kernel transformation or it might be some other function, it all depends on what approach actually works best for the task at hand.
In this sense, I think DNNs can be thought of as a super set that contains SVMs as one option among many. If an SVM is the most appropriate, the DNN will automatically learn the best kernel transformation for the task (assuming we are operating at the limit). So in a purely theoretical sense, I would say no, there is nothing an SVM can do that a DNN cannot (given enough layers of sufficient size, training, ect.)
From a practical perspective, however, which one is better comes down to the particular problem at hand and the constraints you are working with. In general though, I think DNNs are still often the better solution in practice, especially for most modern problems.
There are many ways of looking at this, but I think one of the more informative is thinking about the kernel. In some sense, SVMs are not "learning" a solution to your problem, they are just applying the kernel you pre-specified to your data. If that kernel results in your data being linearly separable in kernel space, great, it will work, if not, it will "fail" (to varying degrees). The key point being that you are not learning the appropriate kernel from your data, you are essentially guessing that your predetermined kernel will work. DNNs, on the other hand, can be thought of as simultaneously learning the appropriate kernel and applying it to your data. I think this is a major advantage of DNNs, especially in more "exploratory" cases.
If, however, you already "know the answer" to your classification problem (in the sense you know the input data has certain properties and have a kernel that is known to exploit those properties to make the classes linearly separable in kernel space) then an SVM may be a better solution. Given that the computational load scales quadratically with the data set size for SVMs, however, your data also needs to be small enough.
SVMs may also be preferred in that they are more "predictable"/theoretically founded. You know they are applying X kernel transformation to the data and attempting to linearly separate the classes by drawing a hyperplane equidistant between the two closest points from each class. That's a solution with defined behavior. What's going on inside of a very deep neural network, however, is much more difficult to ascertain.
In conclusion, from a theoretical perspective, I think DNNs provide power and flexibility beyond what SVMs can provide, and from a practical perspective, given that many modern problems involve fairly large input data sets and often no obviously appropriate kernel, I think NNs are often the more appropriate choice. The only benefits of SVMs over DNNs that I can see are that SVMs are more interpretable, easier to train, and and can be more computationally efficient for small datasets.
|
Are neural networks better than SVMs?
|
I am not an expert, so consider this as an opinion from someone who is still learning about these two fields.
Short Answer
Theoretically, No. DNNs can perform all the functions of SVMs and more.
Pract
|
Are neural networks better than SVMs?
I am not an expert, so consider this as an opinion from someone who is still learning about these two fields.
Short Answer
Theoretically, No. DNNs can perform all the functions of SVMs and more.
Practically, mostly no. For most modern problems DNNs are a better choice. If your input data size is small and you are successful in finding a suitable kernel, however, an SVM may be a more efficient solution. But, if you can't determine a suitable kernel, NNs are then a better choice.
Long Answer
If we gloss over some details about the constraints of different implementations, deep neural networks are essentially universal function approximators. Given enough training time and a sufficiently robust architecture and training set (what we might call operating at the theoretical limit) they will essentially learn an approximation of an optimum solution. It might be an SVM-style kernel transformation or it might be some other function, it all depends on what approach actually works best for the task at hand.
In this sense, I think DNNs can be thought of as a super set that contains SVMs as one option among many. If an SVM is the most appropriate, the DNN will automatically learn the best kernel transformation for the task (assuming we are operating at the limit). So in a purely theoretical sense, I would say no, there is nothing an SVM can do that a DNN cannot (given enough layers of sufficient size, training, ect.)
From a practical perspective, however, which one is better comes down to the particular problem at hand and the constraints you are working with. In general though, I think DNNs are still often the better solution in practice, especially for most modern problems.
There are many ways of looking at this, but I think one of the more informative is thinking about the kernel. In some sense, SVMs are not "learning" a solution to your problem, they are just applying the kernel you pre-specified to your data. If that kernel results in your data being linearly separable in kernel space, great, it will work, if not, it will "fail" (to varying degrees). The key point being that you are not learning the appropriate kernel from your data, you are essentially guessing that your predetermined kernel will work. DNNs, on the other hand, can be thought of as simultaneously learning the appropriate kernel and applying it to your data. I think this is a major advantage of DNNs, especially in more "exploratory" cases.
If, however, you already "know the answer" to your classification problem (in the sense you know the input data has certain properties and have a kernel that is known to exploit those properties to make the classes linearly separable in kernel space) then an SVM may be a better solution. Given that the computational load scales quadratically with the data set size for SVMs, however, your data also needs to be small enough.
SVMs may also be preferred in that they are more "predictable"/theoretically founded. You know they are applying X kernel transformation to the data and attempting to linearly separate the classes by drawing a hyperplane equidistant between the two closest points from each class. That's a solution with defined behavior. What's going on inside of a very deep neural network, however, is much more difficult to ascertain.
In conclusion, from a theoretical perspective, I think DNNs provide power and flexibility beyond what SVMs can provide, and from a practical perspective, given that many modern problems involve fairly large input data sets and often no obviously appropriate kernel, I think NNs are often the more appropriate choice. The only benefits of SVMs over DNNs that I can see are that SVMs are more interpretable, easier to train, and and can be more computationally efficient for small datasets.
|
Are neural networks better than SVMs?
I am not an expert, so consider this as an opinion from someone who is still learning about these two fields.
Short Answer
Theoretically, No. DNNs can perform all the functions of SVMs and more.
Pract
|
6,398
|
Are neural networks better than SVMs?
|
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
One specific benefit that these models have over SVMs is that their size is fixed: they are parametric models, while SVMs are non-parametric. That is, in an ANN you have a bunch of hidden layers with sizes h1 through hn depending on the number of features, plus bias parameters, and those make up your model. By contrast, an SVM (at least a kernelized one) consists of a set of support vectors, selected from the training set, with a weight for each. In the worst case, the number of support vectors is exactly the number of training samples (though that mainly occurs with small training sets or in degenerate cases) and in general its model size scales linearly. In natural language processing, SVM classifiers with tens of thousands of support vectors, each having hundreds of thousands of features, is not unheard of.
Also, online training of FF nets is very simple compared to online SVM fitting, and predicting can be quite a bit faster.
|
Are neural networks better than SVMs?
|
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
|
Are neural networks better than SVMs?
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
One specific benefit that these models have over SVMs is that their size is fixed: they are parametric models, while SVMs are non-parametric. That is, in an ANN you have a bunch of hidden layers with sizes h1 through hn depending on the number of features, plus bias parameters, and those make up your model. By contrast, an SVM (at least a kernelized one) consists of a set of support vectors, selected from the training set, with a weight for each. In the worst case, the number of support vectors is exactly the number of training samples (though that mainly occurs with small training sets or in degenerate cases) and in general its model size scales linearly. In natural language processing, SVM classifiers with tens of thousands of support vectors, each having hundreds of thousands of features, is not unheard of.
Also, online training of FF nets is very simple compared to online SVM fitting, and predicting can be quite a bit faster.
|
Are neural networks better than SVMs?
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
|
6,399
|
When to use fixed effects vs using cluster SEs?
|
Both approaches, using group fixed effects and/or cluster-adjusted standard error take into account different issues related to clustered (or panel) data and I would clearly view them as distinct approaches. Often you want to use both of them:
First of all, cluster-adjusted standard error account for within-cluster correlation or heteroscedasticity which the fixed-effects estimator does not take into account unless you are willing to make further assumptions, see the Imbens and Wooldridge lecture slides for an good discussion of short and long panels and various issues related to this problem. There is also a novel paper about this topic by Cameron and Miller: A Practitioner's Guide to Cluster-Robust Inference which might be interesting for you. If you do not want to model the variance-covariance matrix and you suspect that within-cluster correlation is present, I advise to use cluster robust standard error because the bias in your SE may be severe (much more problematic than for heteroscedasticity, see Angrist & Pischke Chapter III.8 for a discussion of this topic. But you need enough cluster (Angrist and Pischke say 40-50 as a role of thumb). Cluster-adjusted standard error take into account standard error but leave your point estimates unchanged (standard error will usually go up)!
Fixed-effects estimation takes into account unobserved time-invariant heterogeneity (as you mentioned). This can be good or bad: On the hand, you need less assumptions to get consistent estimations. On the other hand, you throw away a lot of variance which might be useful. Some people like Andrew Gelman prefer hierarchical modeling to fixed effects but here opinions differ. Fixed-effects estimation will change both, point and interval estimates (also here standard error will usually be higher).
So to sum up: Cluster-robust standard error are an easy way to account for possible issues related to clustered data if you do not want to bother with modeling inter- and intra-cluster correlation (and there are enough clusters available). Fixed-effects estimation will take use only certain variation, so it depends on your model whether you want to make estimates based on less variation or not. But without further assumptions fixed-effects estimation will not take care of the problems related to intra-cluster correlation for the variance matrix. Neither will cluster-robust standard error take into account problems related to the use of fixed-effects estimation.
|
When to use fixed effects vs using cluster SEs?
|
Both approaches, using group fixed effects and/or cluster-adjusted standard error take into account different issues related to clustered (or panel) data and I would clearly view them as distinct appr
|
When to use fixed effects vs using cluster SEs?
Both approaches, using group fixed effects and/or cluster-adjusted standard error take into account different issues related to clustered (or panel) data and I would clearly view them as distinct approaches. Often you want to use both of them:
First of all, cluster-adjusted standard error account for within-cluster correlation or heteroscedasticity which the fixed-effects estimator does not take into account unless you are willing to make further assumptions, see the Imbens and Wooldridge lecture slides for an good discussion of short and long panels and various issues related to this problem. There is also a novel paper about this topic by Cameron and Miller: A Practitioner's Guide to Cluster-Robust Inference which might be interesting for you. If you do not want to model the variance-covariance matrix and you suspect that within-cluster correlation is present, I advise to use cluster robust standard error because the bias in your SE may be severe (much more problematic than for heteroscedasticity, see Angrist & Pischke Chapter III.8 for a discussion of this topic. But you need enough cluster (Angrist and Pischke say 40-50 as a role of thumb). Cluster-adjusted standard error take into account standard error but leave your point estimates unchanged (standard error will usually go up)!
Fixed-effects estimation takes into account unobserved time-invariant heterogeneity (as you mentioned). This can be good or bad: On the hand, you need less assumptions to get consistent estimations. On the other hand, you throw away a lot of variance which might be useful. Some people like Andrew Gelman prefer hierarchical modeling to fixed effects but here opinions differ. Fixed-effects estimation will change both, point and interval estimates (also here standard error will usually be higher).
So to sum up: Cluster-robust standard error are an easy way to account for possible issues related to clustered data if you do not want to bother with modeling inter- and intra-cluster correlation (and there are enough clusters available). Fixed-effects estimation will take use only certain variation, so it depends on your model whether you want to make estimates based on less variation or not. But without further assumptions fixed-effects estimation will not take care of the problems related to intra-cluster correlation for the variance matrix. Neither will cluster-robust standard error take into account problems related to the use of fixed-effects estimation.
|
When to use fixed effects vs using cluster SEs?
Both approaches, using group fixed effects and/or cluster-adjusted standard error take into account different issues related to clustered (or panel) data and I would clearly view them as distinct appr
|
6,400
|
When to use fixed effects vs using cluster SEs?
|
Fixed effects are for removing unobserved heterogeneity BETWEEN different groups in your data.
I disagree with the implication in the accepted response that the decision to use a FE model will depend on whether you want to use "less variation or not". If your dependent variable is affected by unobservable variables that systematically vary across groups in your panel, then the coefficient on any variable that is correlated with this variation will be biased. Unless your X variables have been randomly assigned (and they never will be with observation data), it is usually fairly easy to make the argument for omitted variables bias. You may be able to control for some of the omitted variables with a good list of control variables, but if strong identification is your number 1 goal, even an extensive list of controls can leave room for critical readers to doubt your results. In these cases, it is usually a good idea to use a fixed-effects model.
Clustered standard errors are for accounting for situations where observations WITHIN each group are not i.i.d. (independently and identically distributed).
A classic example is if you have many observations for a panel of firms across time. You can account for firm-level fixed effects, but there still may be some unexplained variation in your dependent variable that is correlated across time. In general, when working with time-series data, it is usually safe to assume temporal serial correlation in the error terms within your groups. These situations are the most obvious use-cases for clustered SEs.
Some illustrative examples:
If you have experimental data where you assign treatments randomly, but make repeated observations for each individual/group over time, you would be justified in omitting fixed effects, but would want to cluster your SEs.
Alternatively, if you have many observations per group for non-experimental data, but each within-group observation can be considered as an i.i.d. draw from their larger group (e.g., you have observations from many schools, but each group is a randomly drawn subset of students from their school), you would want to include fixed effects but would not need clustered SEs.
|
When to use fixed effects vs using cluster SEs?
|
Fixed effects are for removing unobserved heterogeneity BETWEEN different groups in your data.
I disagree with the implication in the accepted response that the decision to use a FE model will depend
|
When to use fixed effects vs using cluster SEs?
Fixed effects are for removing unobserved heterogeneity BETWEEN different groups in your data.
I disagree with the implication in the accepted response that the decision to use a FE model will depend on whether you want to use "less variation or not". If your dependent variable is affected by unobservable variables that systematically vary across groups in your panel, then the coefficient on any variable that is correlated with this variation will be biased. Unless your X variables have been randomly assigned (and they never will be with observation data), it is usually fairly easy to make the argument for omitted variables bias. You may be able to control for some of the omitted variables with a good list of control variables, but if strong identification is your number 1 goal, even an extensive list of controls can leave room for critical readers to doubt your results. In these cases, it is usually a good idea to use a fixed-effects model.
Clustered standard errors are for accounting for situations where observations WITHIN each group are not i.i.d. (independently and identically distributed).
A classic example is if you have many observations for a panel of firms across time. You can account for firm-level fixed effects, but there still may be some unexplained variation in your dependent variable that is correlated across time. In general, when working with time-series data, it is usually safe to assume temporal serial correlation in the error terms within your groups. These situations are the most obvious use-cases for clustered SEs.
Some illustrative examples:
If you have experimental data where you assign treatments randomly, but make repeated observations for each individual/group over time, you would be justified in omitting fixed effects, but would want to cluster your SEs.
Alternatively, if you have many observations per group for non-experimental data, but each within-group observation can be considered as an i.i.d. draw from their larger group (e.g., you have observations from many schools, but each group is a randomly drawn subset of students from their school), you would want to include fixed effects but would not need clustered SEs.
|
When to use fixed effects vs using cluster SEs?
Fixed effects are for removing unobserved heterogeneity BETWEEN different groups in your data.
I disagree with the implication in the accepted response that the decision to use a FE model will depend
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.