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
|
|---|---|---|---|---|---|---|
10,401
|
How many lags to use in the Ljung-Box test of a time series?
|
Let me suggest you our R package hwwntest. It has implemented Wavelet-based white noise tests that do not require any tuning parameters and have good statistical size and power.
Additionally, I have recently found "Thoughts on the Ljung-Box test" which is excellent discussion on the topic from Rob Hyndman.
Update: Considering the alternative discussion in this thread regarding ARMAX, another incentive to look at hwwntest is the availability of a theoretical power function for one of the tests against an alternative hypothesis of ARMA(p,q) model.
|
How many lags to use in the Ljung-Box test of a time series?
|
Let me suggest you our R package hwwntest. It has implemented Wavelet-based white noise tests that do not require any tuning parameters and have good statistical size and power.
Additionally, I have r
|
How many lags to use in the Ljung-Box test of a time series?
Let me suggest you our R package hwwntest. It has implemented Wavelet-based white noise tests that do not require any tuning parameters and have good statistical size and power.
Additionally, I have recently found "Thoughts on the Ljung-Box test" which is excellent discussion on the topic from Rob Hyndman.
Update: Considering the alternative discussion in this thread regarding ARMAX, another incentive to look at hwwntest is the availability of a theoretical power function for one of the tests against an alternative hypothesis of ARMA(p,q) model.
|
How many lags to use in the Ljung-Box test of a time series?
Let me suggest you our R package hwwntest. It has implemented Wavelet-based white noise tests that do not require any tuning parameters and have good statistical size and power.
Additionally, I have r
|
10,402
|
Why break down the denominator in Bayes' Theorem?
|
The short answer to your question is, "most of the time we don't know what P(cheese) is, and it is often (relatively) difficult to calculate."
The longer answer why Bayes' Rule/Theorem is normally stated in the way that you wrote is because in Bayesian problems we have - sitting in our lap - a prior distribution (the P(B) above) and likelihood (the P(A|B), P(A|notB) above) and it is a relatively simple matter of multiplication to compute the posterior (the P(B|A)). Going to the trouble to reexpress P(A) in its summarized form is effort that could be spent elsewhere.
It might not seem so complicated in the context of an email because, as you rightly noted, it's just P(cheese), right? The trouble is that with more involved on-the-battlefield Bayesian problems the denominator is an unsightly integral, which may or may not have a closed-form solution. In fact, sometimes we need sophisticated Monte Carlo methods just to approximate the integral and churning the numbers can be a real pain in the rear.
But more to the point, we usually don't even care what P(cheese) is. Bear in mind, we are trying to hone our belief regarding whether or not an email is spam, and couldn't care less about the marginal distribution of the data (the P(A), above). It is just a normalization constant, anyway, which doesn't depend on the parameter; the act of summation washes out whatever info we had about the parameter. The constant is a nuisance to calculate and is ultimately irrelevant when it comes to zeroing in on our beliefs about whether or not the email's spam. Sometimes we are obliged to calculate it, in which case the quickest way to do so is with the info we already have: the prior and likelihood.
|
Why break down the denominator in Bayes' Theorem?
|
The short answer to your question is, "most of the time we don't know what P(cheese) is, and it is often (relatively) difficult to calculate."
The longer answer why Bayes' Rule/Theorem is normally st
|
Why break down the denominator in Bayes' Theorem?
The short answer to your question is, "most of the time we don't know what P(cheese) is, and it is often (relatively) difficult to calculate."
The longer answer why Bayes' Rule/Theorem is normally stated in the way that you wrote is because in Bayesian problems we have - sitting in our lap - a prior distribution (the P(B) above) and likelihood (the P(A|B), P(A|notB) above) and it is a relatively simple matter of multiplication to compute the posterior (the P(B|A)). Going to the trouble to reexpress P(A) in its summarized form is effort that could be spent elsewhere.
It might not seem so complicated in the context of an email because, as you rightly noted, it's just P(cheese), right? The trouble is that with more involved on-the-battlefield Bayesian problems the denominator is an unsightly integral, which may or may not have a closed-form solution. In fact, sometimes we need sophisticated Monte Carlo methods just to approximate the integral and churning the numbers can be a real pain in the rear.
But more to the point, we usually don't even care what P(cheese) is. Bear in mind, we are trying to hone our belief regarding whether or not an email is spam, and couldn't care less about the marginal distribution of the data (the P(A), above). It is just a normalization constant, anyway, which doesn't depend on the parameter; the act of summation washes out whatever info we had about the parameter. The constant is a nuisance to calculate and is ultimately irrelevant when it comes to zeroing in on our beliefs about whether or not the email's spam. Sometimes we are obliged to calculate it, in which case the quickest way to do so is with the info we already have: the prior and likelihood.
|
Why break down the denominator in Bayes' Theorem?
The short answer to your question is, "most of the time we don't know what P(cheese) is, and it is often (relatively) difficult to calculate."
The longer answer why Bayes' Rule/Theorem is normally st
|
10,403
|
Why break down the denominator in Bayes' Theorem?
|
One reason for using the total probability rule is that we often deal with the component probabilities in that expression and it's straightforward to find the marginal probability by simply plugging in the values. For an illustration of this, see the following example on Wikipedia:
Bayes' Theorem > Example 1: Drug Testing
Another reason is recognizing equivalent forms of Bayes' Rule by manipulating that expression. For example:
$P(B|A) = \frac{P(A|B) P(B)}{P(A|B)P(B) + P(A|\lnot B)P(\lnot B)}$
Divide through the RHS by the numerator:
$P(B|A) = \frac{1} {1 + \frac{P(A|\lnot B)}{P(A|B)} \frac{P(\lnot B)}{P(B)}}$
Which is a nice equivalent form for Bayes' Rule, made even handier by subtracting this from the original expression to obtain:
$\frac{P(\lnot B|A)}{P(B|A)} = \frac{P(A|\lnot B)} {P(A|B)} \frac {P(\lnot B)} {P(B)}$
This is Bayes' Rule stated in terms of Odds, i.e. posterior odds against B = Bayes factor against B times the prior odds against B. (Or you could invert it to get an expression in terms of odds for B.) The Bayes factor is the ratio of the likelihoods of your models. Given that we're uncertain about the underlying data generating mechanism, we observe data and update our beliefs.
I'm not sure if you find this useful, but hopefully it's not baffling; you should obviously work with the expression that works best for your scenario. Maybe someone else can pipe in with even better reasons.
|
Why break down the denominator in Bayes' Theorem?
|
One reason for using the total probability rule is that we often deal with the component probabilities in that expression and it's straightforward to find the marginal probability by simply plugging i
|
Why break down the denominator in Bayes' Theorem?
One reason for using the total probability rule is that we often deal with the component probabilities in that expression and it's straightforward to find the marginal probability by simply plugging in the values. For an illustration of this, see the following example on Wikipedia:
Bayes' Theorem > Example 1: Drug Testing
Another reason is recognizing equivalent forms of Bayes' Rule by manipulating that expression. For example:
$P(B|A) = \frac{P(A|B) P(B)}{P(A|B)P(B) + P(A|\lnot B)P(\lnot B)}$
Divide through the RHS by the numerator:
$P(B|A) = \frac{1} {1 + \frac{P(A|\lnot B)}{P(A|B)} \frac{P(\lnot B)}{P(B)}}$
Which is a nice equivalent form for Bayes' Rule, made even handier by subtracting this from the original expression to obtain:
$\frac{P(\lnot B|A)}{P(B|A)} = \frac{P(A|\lnot B)} {P(A|B)} \frac {P(\lnot B)} {P(B)}$
This is Bayes' Rule stated in terms of Odds, i.e. posterior odds against B = Bayes factor against B times the prior odds against B. (Or you could invert it to get an expression in terms of odds for B.) The Bayes factor is the ratio of the likelihoods of your models. Given that we're uncertain about the underlying data generating mechanism, we observe data and update our beliefs.
I'm not sure if you find this useful, but hopefully it's not baffling; you should obviously work with the expression that works best for your scenario. Maybe someone else can pipe in with even better reasons.
|
Why break down the denominator in Bayes' Theorem?
One reason for using the total probability rule is that we often deal with the component probabilities in that expression and it's straightforward to find the marginal probability by simply plugging i
|
10,404
|
Why break down the denominator in Bayes' Theorem?
|
Previous replies are detailed enough, but an intuitive way of looking why $P (A) $ (ie dinominator in the Bayes theorem) is broken into two cases.
It is hard to comment about what is the $P(A)$ without any knowledge whether the email is ham or spam. You are correct that "cheese" appears in spam as well as in ham, but if you look at the probability of appearance of "cheese" given that the email is ham ($P(A | B)$, $B$ is representative for ham), you can definitely say a lot of it. At least in my case, I don't receive a lot of spams which contain cheese, therefore in my case $P(A | B)$ will be high (say 90%). Similarly, $P(A | \neg B)$ will be low in my case, as not a lot of spams contain the word cheese. Basically, we try to look at the occurrence of event of interest (here A) partitioned into two disjoint events, $B$ and $\neg B$. If we partition A into two separate events, we can say better about the conditional probabilities $P(A | B)$ and $P(A | \neg B)$. In order to get the total probability we also need to weight for the conditional probabilities for the occurance of events on which we condition ie $P(B)$ and $P(\neg B)$. Therefore the final expression $$P(A) = P(A|B)\cdot P(B)+P(A|\neg B)\cdot P(\neg B)$$
|
Why break down the denominator in Bayes' Theorem?
|
Previous replies are detailed enough, but an intuitive way of looking why $P (A) $ (ie dinominator in the Bayes theorem) is broken into two cases.
It is hard to comment about what is the $P(A)$ withou
|
Why break down the denominator in Bayes' Theorem?
Previous replies are detailed enough, but an intuitive way of looking why $P (A) $ (ie dinominator in the Bayes theorem) is broken into two cases.
It is hard to comment about what is the $P(A)$ without any knowledge whether the email is ham or spam. You are correct that "cheese" appears in spam as well as in ham, but if you look at the probability of appearance of "cheese" given that the email is ham ($P(A | B)$, $B$ is representative for ham), you can definitely say a lot of it. At least in my case, I don't receive a lot of spams which contain cheese, therefore in my case $P(A | B)$ will be high (say 90%). Similarly, $P(A | \neg B)$ will be low in my case, as not a lot of spams contain the word cheese. Basically, we try to look at the occurrence of event of interest (here A) partitioned into two disjoint events, $B$ and $\neg B$. If we partition A into two separate events, we can say better about the conditional probabilities $P(A | B)$ and $P(A | \neg B)$. In order to get the total probability we also need to weight for the conditional probabilities for the occurance of events on which we condition ie $P(B)$ and $P(\neg B)$. Therefore the final expression $$P(A) = P(A|B)\cdot P(B)+P(A|\neg B)\cdot P(\neg B)$$
|
Why break down the denominator in Bayes' Theorem?
Previous replies are detailed enough, but an intuitive way of looking why $P (A) $ (ie dinominator in the Bayes theorem) is broken into two cases.
It is hard to comment about what is the $P(A)$ withou
|
10,405
|
How LDA, a classification technique, also serves as dimensionality reduction technique like PCA
|
As I've noted in the comment to your question, discriminant analysis is a composite procedure with two distinct stages - dimensionality reduction (supervised) and classification stage. At dimensionality reduction we extract discriminant functions which replace the original explanatory variables. Then we classify (typically by Bayes' approach) observations to the classes using those functions.
Some people tend to fail to recognize this clear-cut two-stage nature of LDA simply because they have got acquainted themselves only with LDA with 2 classes (called Fisher's discriminant analysis). In such analysis, only one discriminant function exists and classification is straightforward, and so everything can be explained in a textbook in a single "pass" without inviting concepts of space reduction and Bayes classification.
LDA is closely related to MANOVA. The latter is a "surface and broad" side of the (multivariate) linear model while the "depth and focused" picture of it is canonical correlation analysis (CCA). The thing is that the correlation between two multivariate sets of variables is not uni-dimensional and is explained by a few pairs of "latent" variables called canonical variates.
As a dimensionality reduction, LDA is theoretically a CCA with two sets of variables, one set being the correlated "explanatory" interval variables and the other set being the $k-1$ dummy (or other contrast coded) variables representing the $k$ groups, the classes of observations.
In CCA, we consider the two correlated variable sets X and Y as equal in rights. Therefore we extract canonical variates from both sides, and they form pairs: variate 1 from set X and variate 1 from set Y with canonical correlation between them maximal; then variate 2 from set X and variate 2 from set Y with a smaller canonical correlation, etc. In LDA, we usually are not interested numerically in canonical variates from the class set side; we however take interest in the canonical variates from the explanatory set side. Those are called canonical discriminant functions or discriminants.
The discriminants are what correlate maximally with the "lines" of separateness among the groups. Discriminant 1 explains the major portion of separateness; discriminant 2 picks some of the separeteness left unexplained due to the orthogonality to the previous separateness; descriminat 3 explains yet some remnant of separateness orthogonal to the previous two, etc. In LDA with $p$ input variables (dimensions) and $k$ classes the possible number of discriminants (reduced dimensions) is $min(k-1,p)$ and when the assumptions of LDA hold this number of them completely discriminate between classes and are able to fully classify the data to the classes (see).
To repeate, this is actually CCA in its nature. LDA with 3+ classes is even called "canonical LDA". Despite that CCA and LDA are typically implemented algorithmically somewhat differently, in views of program efficiency, they are "same" enough so that it is possible to recalculate results (coefficients etc.) obtained in one procedure onto those obtained in the other. Most of the LDA specificity lies in the domain of coding the categorical variables representing groups. This is that same dilemma which is observed in (M)ANOVA. Different coding schemes lead to different ways of interpretation of the coefficients.
Since LDA (as dimensionality reduction) can be understood as a particular case of CCA, you definitely have to explore this answer comparing CCA with PCA and regression. The main point there is that CCA is, in a sense, closer to regression than to PCA because CCA is a supervised technique (a latent linear combination is drawn out to correlate with something external) and PCA is not (a latent linear combination is drawn to summarize the internal). These are two branches of dimensionality reduction.
When it comes to math you might find that while the variances of the principal components correspond to the eigenvalues of the data cloud (the covariance matrix between the variables), the variances of the discriminants are not so clearly related to those eigenvalues that are produced in LDA. The reason is that in LDA, eigenvalues do not summarize the shape of the data cloud; rather, they pertain to the abstract quantity of the ratio of the between-class to the within-class variation in the cloud.
So, principal components maximize variance and discriminants maximize class separation; a simple case where a PC fails to discriminate between classes well enough but a discriminant can is these pictures. When drawn as lines in the original feature space discriminants do not usually appear orthogonal (being uncorrelated, nevertheless), but PCs do.
Footnote for meticulous. How, in their results, LDA is exactly related to CCA. To repeat: if you do LDA with p variables and k classes and you do CCA with Set1 as those p variables and Set2 as k-1 indicator dummy variables representing groups (actually, not necessarily indicator variables - other types of contrast variables, such as deviation or Helmert - will do), then the results are equivalent in regards to the canonical variates extracted for Set1 - they directly correspond to the discriminant functions extracted in the LDA. What is the exact relationship, though?
Algebra and terminology of LDA is explained here, and algebra and terminology of CCA is explained here. Canonical correlations will be the same. But what about coefficients and "latents"'s values (scores)? Consider a $j$th discriminant and correspondent ($j$th) canonical variate. For them,
$\frac {\text {CCA standardized coefficient}}{\text {LDA raw coefficient}} = \frac {\text {CCA canonical variate value}}{\text {LDA discriminant value}} = \sqrt \frac {\text {pooled within class variance in the variate }}{\text {pooled within class variance in the discriminant}}$
"Pooled within class variance" is the weighted average of the group variances with weight = n-1 in a group. In discriminant, this quantity is $1$ (read in LDA algebra link), and so the coefficient of proportionality to switch onto CCA results from LDA results is simply $$\sqrt {\text {pooled within class variance in the variate}}$$. But because the canonical variate is standardized in the whole sample, this coefficient is equal to the $\text {st. deviation of the discriminant}$ (which is standardized within groups). So, just divide the LDA results (coefficients and scores) by the discriminant's $\sigma$ to get the CCA results.
The difference between CCA and LDA is due to that LDA "knows" that there are classes (groups): you directly indicate the groups to compute the within and between scatter matrices. That makes it both the computations faster and results more convenient for subsequent classification by discriminants. CCA, on the other hand, isn't aware of classes and process the data as if they all were continuous variables - which is more general but a slower way of computation. But the results are equivalent, and I've shown how.
So far it was implied that the k-1 dummies are entered CCA the typical way, i.e. centered (like the variables of Set1). One might ask, is it possible to enter all k dummies and do not center them (to escape singularity)? Yes, it is possible, albeit probably less convenient. There will appear a zero-eigenvalue additional canonical variate, coefficients for it should be thrown away. Other results remain valid. Except the dfs to test the significance of canonical correlations. Df for the 1st correlation will be p*k which is wrong and the true df, as in LDA, is p*(k-1).
|
How LDA, a classification technique, also serves as dimensionality reduction technique like PCA
|
As I've noted in the comment to your question, discriminant analysis is a composite procedure with two distinct stages - dimensionality reduction (supervised) and classification stage. At dimensionali
|
How LDA, a classification technique, also serves as dimensionality reduction technique like PCA
As I've noted in the comment to your question, discriminant analysis is a composite procedure with two distinct stages - dimensionality reduction (supervised) and classification stage. At dimensionality reduction we extract discriminant functions which replace the original explanatory variables. Then we classify (typically by Bayes' approach) observations to the classes using those functions.
Some people tend to fail to recognize this clear-cut two-stage nature of LDA simply because they have got acquainted themselves only with LDA with 2 classes (called Fisher's discriminant analysis). In such analysis, only one discriminant function exists and classification is straightforward, and so everything can be explained in a textbook in a single "pass" without inviting concepts of space reduction and Bayes classification.
LDA is closely related to MANOVA. The latter is a "surface and broad" side of the (multivariate) linear model while the "depth and focused" picture of it is canonical correlation analysis (CCA). The thing is that the correlation between two multivariate sets of variables is not uni-dimensional and is explained by a few pairs of "latent" variables called canonical variates.
As a dimensionality reduction, LDA is theoretically a CCA with two sets of variables, one set being the correlated "explanatory" interval variables and the other set being the $k-1$ dummy (or other contrast coded) variables representing the $k$ groups, the classes of observations.
In CCA, we consider the two correlated variable sets X and Y as equal in rights. Therefore we extract canonical variates from both sides, and they form pairs: variate 1 from set X and variate 1 from set Y with canonical correlation between them maximal; then variate 2 from set X and variate 2 from set Y with a smaller canonical correlation, etc. In LDA, we usually are not interested numerically in canonical variates from the class set side; we however take interest in the canonical variates from the explanatory set side. Those are called canonical discriminant functions or discriminants.
The discriminants are what correlate maximally with the "lines" of separateness among the groups. Discriminant 1 explains the major portion of separateness; discriminant 2 picks some of the separeteness left unexplained due to the orthogonality to the previous separateness; descriminat 3 explains yet some remnant of separateness orthogonal to the previous two, etc. In LDA with $p$ input variables (dimensions) and $k$ classes the possible number of discriminants (reduced dimensions) is $min(k-1,p)$ and when the assumptions of LDA hold this number of them completely discriminate between classes and are able to fully classify the data to the classes (see).
To repeate, this is actually CCA in its nature. LDA with 3+ classes is even called "canonical LDA". Despite that CCA and LDA are typically implemented algorithmically somewhat differently, in views of program efficiency, they are "same" enough so that it is possible to recalculate results (coefficients etc.) obtained in one procedure onto those obtained in the other. Most of the LDA specificity lies in the domain of coding the categorical variables representing groups. This is that same dilemma which is observed in (M)ANOVA. Different coding schemes lead to different ways of interpretation of the coefficients.
Since LDA (as dimensionality reduction) can be understood as a particular case of CCA, you definitely have to explore this answer comparing CCA with PCA and regression. The main point there is that CCA is, in a sense, closer to regression than to PCA because CCA is a supervised technique (a latent linear combination is drawn out to correlate with something external) and PCA is not (a latent linear combination is drawn to summarize the internal). These are two branches of dimensionality reduction.
When it comes to math you might find that while the variances of the principal components correspond to the eigenvalues of the data cloud (the covariance matrix between the variables), the variances of the discriminants are not so clearly related to those eigenvalues that are produced in LDA. The reason is that in LDA, eigenvalues do not summarize the shape of the data cloud; rather, they pertain to the abstract quantity of the ratio of the between-class to the within-class variation in the cloud.
So, principal components maximize variance and discriminants maximize class separation; a simple case where a PC fails to discriminate between classes well enough but a discriminant can is these pictures. When drawn as lines in the original feature space discriminants do not usually appear orthogonal (being uncorrelated, nevertheless), but PCs do.
Footnote for meticulous. How, in their results, LDA is exactly related to CCA. To repeat: if you do LDA with p variables and k classes and you do CCA with Set1 as those p variables and Set2 as k-1 indicator dummy variables representing groups (actually, not necessarily indicator variables - other types of contrast variables, such as deviation or Helmert - will do), then the results are equivalent in regards to the canonical variates extracted for Set1 - they directly correspond to the discriminant functions extracted in the LDA. What is the exact relationship, though?
Algebra and terminology of LDA is explained here, and algebra and terminology of CCA is explained here. Canonical correlations will be the same. But what about coefficients and "latents"'s values (scores)? Consider a $j$th discriminant and correspondent ($j$th) canonical variate. For them,
$\frac {\text {CCA standardized coefficient}}{\text {LDA raw coefficient}} = \frac {\text {CCA canonical variate value}}{\text {LDA discriminant value}} = \sqrt \frac {\text {pooled within class variance in the variate }}{\text {pooled within class variance in the discriminant}}$
"Pooled within class variance" is the weighted average of the group variances with weight = n-1 in a group. In discriminant, this quantity is $1$ (read in LDA algebra link), and so the coefficient of proportionality to switch onto CCA results from LDA results is simply $$\sqrt {\text {pooled within class variance in the variate}}$$. But because the canonical variate is standardized in the whole sample, this coefficient is equal to the $\text {st. deviation of the discriminant}$ (which is standardized within groups). So, just divide the LDA results (coefficients and scores) by the discriminant's $\sigma$ to get the CCA results.
The difference between CCA and LDA is due to that LDA "knows" that there are classes (groups): you directly indicate the groups to compute the within and between scatter matrices. That makes it both the computations faster and results more convenient for subsequent classification by discriminants. CCA, on the other hand, isn't aware of classes and process the data as if they all were continuous variables - which is more general but a slower way of computation. But the results are equivalent, and I've shown how.
So far it was implied that the k-1 dummies are entered CCA the typical way, i.e. centered (like the variables of Set1). One might ask, is it possible to enter all k dummies and do not center them (to escape singularity)? Yes, it is possible, albeit probably less convenient. There will appear a zero-eigenvalue additional canonical variate, coefficients for it should be thrown away. Other results remain valid. Except the dfs to test the significance of canonical correlations. Df for the 1st correlation will be p*k which is wrong and the true df, as in LDA, is p*(k-1).
|
How LDA, a classification technique, also serves as dimensionality reduction technique like PCA
As I've noted in the comment to your question, discriminant analysis is a composite procedure with two distinct stages - dimensionality reduction (supervised) and classification stage. At dimensionali
|
10,406
|
Do we still need to do feature selection while using Regularization algorithms?
|
Feature selection sometimes improves the performance of regularized models, but in my experience it generally makes generalization performance worse. The reason for this is that the more choices we make regarding our model (including the values of the parameters, the choice of features, the setting of hyper-parameters, the choice of kernel...), the more data we need to make these choices reliably. Generally we make these choices by minimizing some criterion evaluated over a finite set of data, which means that the criterion inevitably has a non-zero variance. As a result, if we minimize the criterion too agressively, we can over-fit it, i.e. we can make choices that minimize the criterion because of features that depend on the particular sample on which it is evaluated, rather than because it will produce a genuine improvement in performance. I call this "over-fitting in model selection" to differentiate it from the more familiar form of over-fitting resulting from tuning the model parameters.
Now the SVM is an approximate implementation of a bound on generalization performance that does not depend on the dimensionality, so in principle, we can expect good performance without feature selection, provided the regularization parameters are correctly chosen. Most feature selection methods have no such performance "guarantees".
For L1 methods, I certainly wouldn't bother with feature selection, as the L1 criterion is generally effective in trimming features. The reason that it is effective is that it induces an ordering in which features enter and leave the model, which reduces the number of available choices in selecting features, and hence is less prone to over-fitting.
The best reason for feature selection is to find out which features are relevant/important. The worst reason for feature selection is to improve performance, for regularised models, generally it makes things worse. However, for some datasets, it can make a big difference, so the best thing to do is to try it and use a robust, unbiased performance evaluation scheme (e.g. nested cross-validation) to find out whether yours is one of those datasets.
|
Do we still need to do feature selection while using Regularization algorithms?
|
Feature selection sometimes improves the performance of regularized models, but in my experience it generally makes generalization performance worse. The reason for this is that the more choices we m
|
Do we still need to do feature selection while using Regularization algorithms?
Feature selection sometimes improves the performance of regularized models, but in my experience it generally makes generalization performance worse. The reason for this is that the more choices we make regarding our model (including the values of the parameters, the choice of features, the setting of hyper-parameters, the choice of kernel...), the more data we need to make these choices reliably. Generally we make these choices by minimizing some criterion evaluated over a finite set of data, which means that the criterion inevitably has a non-zero variance. As a result, if we minimize the criterion too agressively, we can over-fit it, i.e. we can make choices that minimize the criterion because of features that depend on the particular sample on which it is evaluated, rather than because it will produce a genuine improvement in performance. I call this "over-fitting in model selection" to differentiate it from the more familiar form of over-fitting resulting from tuning the model parameters.
Now the SVM is an approximate implementation of a bound on generalization performance that does not depend on the dimensionality, so in principle, we can expect good performance without feature selection, provided the regularization parameters are correctly chosen. Most feature selection methods have no such performance "guarantees".
For L1 methods, I certainly wouldn't bother with feature selection, as the L1 criterion is generally effective in trimming features. The reason that it is effective is that it induces an ordering in which features enter and leave the model, which reduces the number of available choices in selecting features, and hence is less prone to over-fitting.
The best reason for feature selection is to find out which features are relevant/important. The worst reason for feature selection is to improve performance, for regularised models, generally it makes things worse. However, for some datasets, it can make a big difference, so the best thing to do is to try it and use a robust, unbiased performance evaluation scheme (e.g. nested cross-validation) to find out whether yours is one of those datasets.
|
Do we still need to do feature selection while using Regularization algorithms?
Feature selection sometimes improves the performance of regularized models, but in my experience it generally makes generalization performance worse. The reason for this is that the more choices we m
|
10,407
|
Do we still need to do feature selection while using Regularization algorithms?
|
A lot of people do think that regularization is enough to take care of extraneous variables and no variable selection is needed if you appropriately regularize, do partial pooling, create hierarchical models, etc. when the goal is predictive accuracy. For example, if a parameter estimate for a particular variable $j$ is regularized all the way down to $\hat{\beta}_j = .0001$ or is entirely removed from the model ($\hat{\beta}_j = 0$) really doesn't make a big difference in prediction problems.
However, there are still reasons to completely remove a variable.
Sometimes the goal is not predictive accuracy but explanation of a world phenomenon. Sometimes you want to know what variables do and do not impact a certain dependent variable. In these types of situations, a parsimonious model is a preferred way to understand and interpret
You're setting yourself up for risk. If you leave in a variable $\hat{\beta}_j$ that truly doesn't have an effect then you're setting yourself up for the possibility that if you collect different data then the variable impacts results. This is especially pertinent for models that get refit over and over again with different applications.
Computational reasons - a model with fewer variables generally runs faster and you don't have to store the data for those extraneous variables.
|
Do we still need to do feature selection while using Regularization algorithms?
|
A lot of people do think that regularization is enough to take care of extraneous variables and no variable selection is needed if you appropriately regularize, do partial pooling, create hierarchical
|
Do we still need to do feature selection while using Regularization algorithms?
A lot of people do think that regularization is enough to take care of extraneous variables and no variable selection is needed if you appropriately regularize, do partial pooling, create hierarchical models, etc. when the goal is predictive accuracy. For example, if a parameter estimate for a particular variable $j$ is regularized all the way down to $\hat{\beta}_j = .0001$ or is entirely removed from the model ($\hat{\beta}_j = 0$) really doesn't make a big difference in prediction problems.
However, there are still reasons to completely remove a variable.
Sometimes the goal is not predictive accuracy but explanation of a world phenomenon. Sometimes you want to know what variables do and do not impact a certain dependent variable. In these types of situations, a parsimonious model is a preferred way to understand and interpret
You're setting yourself up for risk. If you leave in a variable $\hat{\beta}_j$ that truly doesn't have an effect then you're setting yourself up for the possibility that if you collect different data then the variable impacts results. This is especially pertinent for models that get refit over and over again with different applications.
Computational reasons - a model with fewer variables generally runs faster and you don't have to store the data for those extraneous variables.
|
Do we still need to do feature selection while using Regularization algorithms?
A lot of people do think that regularization is enough to take care of extraneous variables and no variable selection is needed if you appropriately regularize, do partial pooling, create hierarchical
|
10,408
|
Do we still need to do feature selection while using Regularization algorithms?
|
I don't think overfitting is the reason that we need feature selection in the first place. In fact, overfitting is something that happens if we don't give our model enough data, and feature selection further reduces the amount of data that we pass our algorithm.
I would instead say that feature selection is needed as a preprocessing step for models which do not have the power to determine the importance of features on their own, or for algorithms which get much less efficient if they have to do this importance weighting on their own.
Take for instance a simple k-nearest neighbor algorithm based on Euclidean distance. It will always look at all features as having the same weight or importance to the final classification. So if you give it 100 features but only three of these are relevant for your classification problem, then all the noise from these extra features will completely drown out the information from the three important features, and you won't get any useful predictions. If you instead determine the critical features beforehand and pass only those to the classifier, it will work much better (not to mention be much faster).
On the other hand, look at a random forest classifier. While training, it will automatically determine which features are the most useful by finding an optimal split by choosing from a subset of all features. Therefore, it will do much better at sifting through the 97 useless features to find the three good ones. Of course, it will still run faster if you do the selection beforehand, but its classification power will usually not suffer much by giving it a lot of extra features, even if they are not relevant.
Finally, look at neural networks. Again, this is a model which has the power to ignore irrelevant features, and training by backpropagation will usually converge to using the interesting features. However, it is known that standard training algorithm converge much faster if the inputs are "whitened", i.e., scaled to unit variance and with removed cross correlation (LeCun et al, 1998). Therefore, although you don't strictly need to do feature selection, it can pay in pure performance terms to do preprocessing of the input data.
So in summary, I would say feature selection has less to do with overfitting and more with enhancing the classification power and computational efficiency of a learning method. How much it is needed depends a lot on the method in question.
|
Do we still need to do feature selection while using Regularization algorithms?
|
I don't think overfitting is the reason that we need feature selection in the first place. In fact, overfitting is something that happens if we don't give our model enough data, and feature selection
|
Do we still need to do feature selection while using Regularization algorithms?
I don't think overfitting is the reason that we need feature selection in the first place. In fact, overfitting is something that happens if we don't give our model enough data, and feature selection further reduces the amount of data that we pass our algorithm.
I would instead say that feature selection is needed as a preprocessing step for models which do not have the power to determine the importance of features on their own, or for algorithms which get much less efficient if they have to do this importance weighting on their own.
Take for instance a simple k-nearest neighbor algorithm based on Euclidean distance. It will always look at all features as having the same weight or importance to the final classification. So if you give it 100 features but only three of these are relevant for your classification problem, then all the noise from these extra features will completely drown out the information from the three important features, and you won't get any useful predictions. If you instead determine the critical features beforehand and pass only those to the classifier, it will work much better (not to mention be much faster).
On the other hand, look at a random forest classifier. While training, it will automatically determine which features are the most useful by finding an optimal split by choosing from a subset of all features. Therefore, it will do much better at sifting through the 97 useless features to find the three good ones. Of course, it will still run faster if you do the selection beforehand, but its classification power will usually not suffer much by giving it a lot of extra features, even if they are not relevant.
Finally, look at neural networks. Again, this is a model which has the power to ignore irrelevant features, and training by backpropagation will usually converge to using the interesting features. However, it is known that standard training algorithm converge much faster if the inputs are "whitened", i.e., scaled to unit variance and with removed cross correlation (LeCun et al, 1998). Therefore, although you don't strictly need to do feature selection, it can pay in pure performance terms to do preprocessing of the input data.
So in summary, I would say feature selection has less to do with overfitting and more with enhancing the classification power and computational efficiency of a learning method. How much it is needed depends a lot on the method in question.
|
Do we still need to do feature selection while using Regularization algorithms?
I don't think overfitting is the reason that we need feature selection in the first place. In fact, overfitting is something that happens if we don't give our model enough data, and feature selection
|
10,409
|
Do we still need to do feature selection while using Regularization algorithms?
|
In the case of lasso, preprocessing the data to remove nuisance features is actually pretty common. For a recent paper discussing ways to do this, please see Xiang et al's Screening Tests for Lasso Problems. The common motivation mentioned in the papers I've seen is to reduce the computational burden of computing the solution.
|
Do we still need to do feature selection while using Regularization algorithms?
|
In the case of lasso, preprocessing the data to remove nuisance features is actually pretty common. For a recent paper discussing ways to do this, please see Xiang et al's Screening Tests for Lasso Pr
|
Do we still need to do feature selection while using Regularization algorithms?
In the case of lasso, preprocessing the data to remove nuisance features is actually pretty common. For a recent paper discussing ways to do this, please see Xiang et al's Screening Tests for Lasso Problems. The common motivation mentioned in the papers I've seen is to reduce the computational burden of computing the solution.
|
Do we still need to do feature selection while using Regularization algorithms?
In the case of lasso, preprocessing the data to remove nuisance features is actually pretty common. For a recent paper discussing ways to do this, please see Xiang et al's Screening Tests for Lasso Pr
|
10,410
|
Do we still need to do feature selection while using Regularization algorithms?
|
I think if you do not have sufficient number of data points to robustly optimize the parameters you can do feature selection to remove some variables. But I would not suggest doing too much of it since you can lose the signal you want to model.
Plus there might be certain features you do not want in your models based on business understanding which you may want to remove.
|
Do we still need to do feature selection while using Regularization algorithms?
|
I think if you do not have sufficient number of data points to robustly optimize the parameters you can do feature selection to remove some variables. But I would not suggest doing too much of it sinc
|
Do we still need to do feature selection while using Regularization algorithms?
I think if you do not have sufficient number of data points to robustly optimize the parameters you can do feature selection to remove some variables. But I would not suggest doing too much of it since you can lose the signal you want to model.
Plus there might be certain features you do not want in your models based on business understanding which you may want to remove.
|
Do we still need to do feature selection while using Regularization algorithms?
I think if you do not have sufficient number of data points to robustly optimize the parameters you can do feature selection to remove some variables. But I would not suggest doing too much of it sinc
|
10,411
|
Why does logistic regression produce well-calibrated models?
|
Yes.
The predicted probability vector $p$ from logistic regression satisfies the matrix equation
$$ X^t(p - y) = 0$$
Where $X$ is the design matrix and $y$ is the response vector. This can be viewed as a collection of linear equations, one arising from each column of the design matrix $X$.
Specializing to the intercept column (which is a row in the transposed matrix), the associated linear equation is
$$ \sum_i( p_i - y_i) = 0 $$
so the overall average predicted probability is equal to the average of the response.
More generally, for a binary feature column $x_{ij}$, the associated linear equation is
$$ \sum_i x_{ij}(p_i - y_i) = \sum_{i \mid x_{ij} = 1}(p_i - y_i) = 0$$
so the sum (and hence average) of the predicted probabilities equals the sum of the response, even when specializing to those records for which $x_{ij} = 1$.
|
Why does logistic regression produce well-calibrated models?
|
Yes.
The predicted probability vector $p$ from logistic regression satisfies the matrix equation
$$ X^t(p - y) = 0$$
Where $X$ is the design matrix and $y$ is the response vector. This can be viewed
|
Why does logistic regression produce well-calibrated models?
Yes.
The predicted probability vector $p$ from logistic regression satisfies the matrix equation
$$ X^t(p - y) = 0$$
Where $X$ is the design matrix and $y$ is the response vector. This can be viewed as a collection of linear equations, one arising from each column of the design matrix $X$.
Specializing to the intercept column (which is a row in the transposed matrix), the associated linear equation is
$$ \sum_i( p_i - y_i) = 0 $$
so the overall average predicted probability is equal to the average of the response.
More generally, for a binary feature column $x_{ij}$, the associated linear equation is
$$ \sum_i x_{ij}(p_i - y_i) = \sum_{i \mid x_{ij} = 1}(p_i - y_i) = 0$$
so the sum (and hence average) of the predicted probabilities equals the sum of the response, even when specializing to those records for which $x_{ij} = 1$.
|
Why does logistic regression produce well-calibrated models?
Yes.
The predicted probability vector $p$ from logistic regression satisfies the matrix equation
$$ X^t(p - y) = 0$$
Where $X$ is the design matrix and $y$ is the response vector. This can be viewed
|
10,412
|
Why does logistic regression produce well-calibrated models?
|
I think I can provide you an easy-to-understand explanation as follows:
We know that its loss function can be expressed as the following function:
$$
J(\theta) =
-\frac{1}{m}\sum_{i=1}^m
\left[ y^{(i)}\log\left(h_\theta \left(x^{(i)}\right)\right) +
(1 -y^{(i)})\log\left(1-h_\theta \left(x^{(i)}\right)\right)\right]
$$
Where m represents the number of all the training cases, $y^{(i)}$ the label of the ith case, $h_{\theta}(x^{(i)})$ the predicted probability of the ith case: $\frac{1}{1+\exp[-\alpha -\sum_j \theta_j x^{(i)}_j]}$. (notice the bias $\alpha$ here)
Since the goal of training is to minimize the loss function, let us evaluate its partial derivative with respect to each parameter $\theta_j$(the detailed derivation can be found here):
$$\frac{\partial J(\theta)}{\partial \theta_j}=\frac{1}{m}\sum_{i=1}^m\left[h_\theta\left(x^{(i)}\right)-y^{(i)}\right]\,x_j^{(i)}$$
And setting it to zero yeils:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)x_j^{(i)}=\sum_{i=1}^m y^{(i)}\,x_j^{(i)}$$
That means that if the model is fully trained, the predicted probabilities we get for the training set spread themselves out so that for each feature the sum of the weighted (all) values of that feature is equal to the sum of the values of that feature of the positive observations.
The above fits every feature so as the bias $\alpha$. Setting $x_0$ as 1 and $\alpha$ as $\theta_0$ yeilds:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)x_0^{(i)}=\sum_{i=1}^m y^{(i)}\,x_0^{(i)}$$
Then we get:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)=\sum_{i=1}^m y^{(i)}$$
Where $h_\theta\left(x^{(i)}\right)$ is the predicted probability of the fully trained model for the ith case. And we can write the function in a compact way:
$$\sum_{i=1}^m p^{(i)} =\sum_{i=1}^m y^{(i)}$$
We can see obviously that the logistic regression is well-calibrated.
Reference: Log-linear Models and Conditional Random Fields by Charles Elkan
|
Why does logistic regression produce well-calibrated models?
|
I think I can provide you an easy-to-understand explanation as follows:
We know that its loss function can be expressed as the following function:
$$
J(\theta) =
-\frac{1}{m}\sum_{i=1}^m
\left[ y^
|
Why does logistic regression produce well-calibrated models?
I think I can provide you an easy-to-understand explanation as follows:
We know that its loss function can be expressed as the following function:
$$
J(\theta) =
-\frac{1}{m}\sum_{i=1}^m
\left[ y^{(i)}\log\left(h_\theta \left(x^{(i)}\right)\right) +
(1 -y^{(i)})\log\left(1-h_\theta \left(x^{(i)}\right)\right)\right]
$$
Where m represents the number of all the training cases, $y^{(i)}$ the label of the ith case, $h_{\theta}(x^{(i)})$ the predicted probability of the ith case: $\frac{1}{1+\exp[-\alpha -\sum_j \theta_j x^{(i)}_j]}$. (notice the bias $\alpha$ here)
Since the goal of training is to minimize the loss function, let us evaluate its partial derivative with respect to each parameter $\theta_j$(the detailed derivation can be found here):
$$\frac{\partial J(\theta)}{\partial \theta_j}=\frac{1}{m}\sum_{i=1}^m\left[h_\theta\left(x^{(i)}\right)-y^{(i)}\right]\,x_j^{(i)}$$
And setting it to zero yeils:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)x_j^{(i)}=\sum_{i=1}^m y^{(i)}\,x_j^{(i)}$$
That means that if the model is fully trained, the predicted probabilities we get for the training set spread themselves out so that for each feature the sum of the weighted (all) values of that feature is equal to the sum of the values of that feature of the positive observations.
The above fits every feature so as the bias $\alpha$. Setting $x_0$ as 1 and $\alpha$ as $\theta_0$ yeilds:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)x_0^{(i)}=\sum_{i=1}^m y^{(i)}\,x_0^{(i)}$$
Then we get:
$$\sum_{i=1}^m h_\theta\left(x^{(i)}\right)=\sum_{i=1}^m y^{(i)}$$
Where $h_\theta\left(x^{(i)}\right)$ is the predicted probability of the fully trained model for the ith case. And we can write the function in a compact way:
$$\sum_{i=1}^m p^{(i)} =\sum_{i=1}^m y^{(i)}$$
We can see obviously that the logistic regression is well-calibrated.
Reference: Log-linear Models and Conditional Random Fields by Charles Elkan
|
Why does logistic regression produce well-calibrated models?
I think I can provide you an easy-to-understand explanation as follows:
We know that its loss function can be expressed as the following function:
$$
J(\theta) =
-\frac{1}{m}\sum_{i=1}^m
\left[ y^
|
10,413
|
Why does logistic regression produce well-calibrated models?
|
Logistic regression models are typically trained by minimizing the negative log likelihood. Maximum-likelihood models are known to asymptotically identify the solution minimizing the Kullback-Leibler divergence $D_{KL}(P, Q)$ between the empirical data distribution $P$ and the distribution $Q$ described by the model, see wiki. Minimizing the KL divergence between the two distributions implies optimizing for calibration.
|
Why does logistic regression produce well-calibrated models?
|
Logistic regression models are typically trained by minimizing the negative log likelihood. Maximum-likelihood models are known to asymptotically identify the solution minimizing the Kullback-Leibler
|
Why does logistic regression produce well-calibrated models?
Logistic regression models are typically trained by minimizing the negative log likelihood. Maximum-likelihood models are known to asymptotically identify the solution minimizing the Kullback-Leibler divergence $D_{KL}(P, Q)$ between the empirical data distribution $P$ and the distribution $Q$ described by the model, see wiki. Minimizing the KL divergence between the two distributions implies optimizing for calibration.
|
Why does logistic regression produce well-calibrated models?
Logistic regression models are typically trained by minimizing the negative log likelihood. Maximum-likelihood models are known to asymptotically identify the solution minimizing the Kullback-Leibler
|
10,414
|
Why is a "negative binomial" random variable called that?
|
It's a reference to the fact that a certain binomial coefficient that appears in the formula for that distribution can be written more simply with negative numbers.
When you conduct a series of experiment with success probability $p$, the likelihood that you will see $r$ failures after exactly $k$ trials is
${k+r−1}\choose {k}$ $p^k(1−p)^r$.
This can also be written as
$(−1)^k$${−r}\choose {k}$$p^k(1−p)^r$
and the word "negative" refers to that $−r$ in that binomial coefficient. Observe how this formula looks just like the formula for the ordinary binomial distribution except for that sign coefficient.
Another name for the negative binomial distribution is Pascal's distribution so there is that too.
=========================================================================
More detailed answer according to Wikipedia:
The probability mass function of the negative binomial distribution is
$f(k; r, p) \equiv \Pr(X = k) = \binom{k+r-1}{k} p^k(1-p)^r \quad\text{for }k = 0, 1, 2, \dotsc $
Here the quantity in parentheses is the binomial coefficient, and is equal to
$\binom{k+r-1}{k} = \frac{(k+r-1)!}{k!\,(r-1)!} = \frac{(k+r-1)(k+r-2)\dotsm(r)}{k!}$.
This quantity can alternatively be written in the following manner, explaining the name “negative binomial”:
$\frac{(k+r-1)\dotsm(r)}{k!} = (-1)^k \frac{(-r)(-r-1)(-r-2)\dotsm(-r-k+1)}{k!} = (-1)^k\binom{-r}{k}$.
|
Why is a "negative binomial" random variable called that?
|
It's a reference to the fact that a certain binomial coefficient that appears in the formula for that distribution can be written more simply with negative numbers.
When you conduct a series of experi
|
Why is a "negative binomial" random variable called that?
It's a reference to the fact that a certain binomial coefficient that appears in the formula for that distribution can be written more simply with negative numbers.
When you conduct a series of experiment with success probability $p$, the likelihood that you will see $r$ failures after exactly $k$ trials is
${k+r−1}\choose {k}$ $p^k(1−p)^r$.
This can also be written as
$(−1)^k$${−r}\choose {k}$$p^k(1−p)^r$
and the word "negative" refers to that $−r$ in that binomial coefficient. Observe how this formula looks just like the formula for the ordinary binomial distribution except for that sign coefficient.
Another name for the negative binomial distribution is Pascal's distribution so there is that too.
=========================================================================
More detailed answer according to Wikipedia:
The probability mass function of the negative binomial distribution is
$f(k; r, p) \equiv \Pr(X = k) = \binom{k+r-1}{k} p^k(1-p)^r \quad\text{for }k = 0, 1, 2, \dotsc $
Here the quantity in parentheses is the binomial coefficient, and is equal to
$\binom{k+r-1}{k} = \frac{(k+r-1)!}{k!\,(r-1)!} = \frac{(k+r-1)(k+r-2)\dotsm(r)}{k!}$.
This quantity can alternatively be written in the following manner, explaining the name “negative binomial”:
$\frac{(k+r-1)\dotsm(r)}{k!} = (-1)^k \frac{(-r)(-r-1)(-r-2)\dotsm(-r-k+1)}{k!} = (-1)^k\binom{-r}{k}$.
|
Why is a "negative binomial" random variable called that?
It's a reference to the fact that a certain binomial coefficient that appears in the formula for that distribution can be written more simply with negative numbers.
When you conduct a series of experi
|
10,415
|
Why is a "negative binomial" random variable called that?
|
I think the most likely origin is that if you take any moment formula from $\mathrm{Bin}(n,q)$ and you replace the parameters $n$ and $q$ in that formula with negative values $-\alpha$ and $-\theta$, then the result will be the equivalent moment formula for a Negative Binomial distribution with parameters $\alpha$ and $\theta$. For short, it looks like as if the Negative Binomial distribution is a Binomial distribution with negative coefficients.
Some background:
In actuarial science (where the distribution was discovered), they use a different parameterization for the Negative Binomial distribution. Actuaries use $\,\alpha=r\,$ and $\,\theta=\frac{p}{1-p}\,$. Actuaries define the Negative Binomial distribution as the mixture distribution of the Poisson family over a Gamma distribution with parameters $\,\alpha\,$ and $\,\theta$, i.e. the distribution with density
$f(x)=\frac{1}{\theta^\alpha\Gamma(\alpha)}x^{\alpha-1}\mathrm{e}^{x/\theta}.$
That definition makes it extremely easy to compute the probability generating function, $\mathrm{Pgf}$, of the Negative Binomial distribution in terms of the moment generating function, $\mathrm{Mgf}_\Gamma$, of the Gamma distribution. Let $N$ be Negative Binomial and $\Gamma$ the Gamma distributed parameter, then:
$\mathrm{Pgf}(z)=\mathbb{E}[z^N]=\mathbb{E}[\mathbb{E}[z^N|\Gamma]]=\mathbb{E}[\mathrm{Pgf}_{\mathrm{Pois}(\Gamma)}(z)]=\mathbb{E}[\mathrm{e}^{\Gamma(z-1)}]=\mathrm{Mgf}_{\Gamma}(z-1)=(1-\theta(z-1))^{-\alpha}.$
And, if you compare the above probability generating function of the Negative Binomial distribution with the probability generating function of $\mathrm{Bin}(n,q)$, you will see that they are the same, only that $n$ and $q$ have been replaced with $-\alpha$ and $-\theta$. As the probability generating function determines the moments uniquely through its derivatives (evaluated at 1) and $n,q,-\alpha,-\theta$ are just constants, you will get the same moment formulas for Binomial and Negative Binomial just with negative parameters.
|
Why is a "negative binomial" random variable called that?
|
I think the most likely origin is that if you take any moment formula from $\mathrm{Bin}(n,q)$ and you replace the parameters $n$ and $q$ in that formula with negative values $-\alpha$ and $-\theta$,
|
Why is a "negative binomial" random variable called that?
I think the most likely origin is that if you take any moment formula from $\mathrm{Bin}(n,q)$ and you replace the parameters $n$ and $q$ in that formula with negative values $-\alpha$ and $-\theta$, then the result will be the equivalent moment formula for a Negative Binomial distribution with parameters $\alpha$ and $\theta$. For short, it looks like as if the Negative Binomial distribution is a Binomial distribution with negative coefficients.
Some background:
In actuarial science (where the distribution was discovered), they use a different parameterization for the Negative Binomial distribution. Actuaries use $\,\alpha=r\,$ and $\,\theta=\frac{p}{1-p}\,$. Actuaries define the Negative Binomial distribution as the mixture distribution of the Poisson family over a Gamma distribution with parameters $\,\alpha\,$ and $\,\theta$, i.e. the distribution with density
$f(x)=\frac{1}{\theta^\alpha\Gamma(\alpha)}x^{\alpha-1}\mathrm{e}^{x/\theta}.$
That definition makes it extremely easy to compute the probability generating function, $\mathrm{Pgf}$, of the Negative Binomial distribution in terms of the moment generating function, $\mathrm{Mgf}_\Gamma$, of the Gamma distribution. Let $N$ be Negative Binomial and $\Gamma$ the Gamma distributed parameter, then:
$\mathrm{Pgf}(z)=\mathbb{E}[z^N]=\mathbb{E}[\mathbb{E}[z^N|\Gamma]]=\mathbb{E}[\mathrm{Pgf}_{\mathrm{Pois}(\Gamma)}(z)]=\mathbb{E}[\mathrm{e}^{\Gamma(z-1)}]=\mathrm{Mgf}_{\Gamma}(z-1)=(1-\theta(z-1))^{-\alpha}.$
And, if you compare the above probability generating function of the Negative Binomial distribution with the probability generating function of $\mathrm{Bin}(n,q)$, you will see that they are the same, only that $n$ and $q$ have been replaced with $-\alpha$ and $-\theta$. As the probability generating function determines the moments uniquely through its derivatives (evaluated at 1) and $n,q,-\alpha,-\theta$ are just constants, you will get the same moment formulas for Binomial and Negative Binomial just with negative parameters.
|
Why is a "negative binomial" random variable called that?
I think the most likely origin is that if you take any moment formula from $\mathrm{Bin}(n,q)$ and you replace the parameters $n$ and $q$ in that formula with negative values $-\alpha$ and $-\theta$,
|
10,416
|
Why is a "negative binomial" random variable called that?
|
Below are some alternative explanations.
They relate to the currently accepted answer. It boils down to a negative index somewhere that contrasts to the positive index for the 'regular' binomial distribution. But, in these historic cases, there is a different focus in relation to the place where the 'negative' index occurs.
Alternative explanation 1
The typical binomial distribution relates to the term with $p^r$ in the expansion $(q+p)^k$
The negative binomial distribution relates to the term with $p^r$ in the expansion $(q - p)^{-k}$ and rewriting $p' = -p$ and $k' = -k$
$$\begin{array}{}(q-p)^{-k} &=& \sum_{r=0}^\infty {-k\choose r} q^r (-p)^{-k-r}\\
&= &\sum_{r=0}^\infty \frac{k'(k'-1)\dots(k'-r+1)}{r!} q^r (p')^{k'-r}
\end{array}$$
This stems from Haldane 1941 "The fitting of binomial distributions"
In other cases a good fit may be obtained to a binomial distribution where $P_r$, is the coefficient of $t^r$ in the expansion $(1 -p +pt)^k$. Here $p$ and $k$ are both positive or both negative. Where they are negative it is convenient to write $p' = -p$, $k' = - k$.
In Fisher's 1941 The negative binomial distribution the expressions $(q+p)^n$ and $(q-p)^{-k}$ are used.
Alternative explanation 2
In Yule 1910 "On the Distribution of Deaths with Age when the Causes of Death Act Cumulatively, and Similar Frequency Distributions"
The expression is related with the binomial expansion of $p^r(1-q)^{-r}$ on page 28
But this is the binomial expansion of $p^r (1 - q)^{-r}$, and we have
therefore reached the law that the proportions of the original population dying during the successive exposures, if $r$ unfavourable exposures are fatal, are given by the successive terms of the binomial expansion of $p^r(1-q)^{-r}$
also later at the end of the page
As our discontinuous series is a binomial series, the form of curve to which we will pass will evidently be the binomial curve of Professor Pearson (type iii of his memoir*), though he derived it from a binomial series with positive and not with negative index.
[link added by me]
|
Why is a "negative binomial" random variable called that?
|
Below are some alternative explanations.
They relate to the currently accepted answer. It boils down to a negative index somewhere that contrasts to the positive index for the 'regular' binomial distr
|
Why is a "negative binomial" random variable called that?
Below are some alternative explanations.
They relate to the currently accepted answer. It boils down to a negative index somewhere that contrasts to the positive index for the 'regular' binomial distribution. But, in these historic cases, there is a different focus in relation to the place where the 'negative' index occurs.
Alternative explanation 1
The typical binomial distribution relates to the term with $p^r$ in the expansion $(q+p)^k$
The negative binomial distribution relates to the term with $p^r$ in the expansion $(q - p)^{-k}$ and rewriting $p' = -p$ and $k' = -k$
$$\begin{array}{}(q-p)^{-k} &=& \sum_{r=0}^\infty {-k\choose r} q^r (-p)^{-k-r}\\
&= &\sum_{r=0}^\infty \frac{k'(k'-1)\dots(k'-r+1)}{r!} q^r (p')^{k'-r}
\end{array}$$
This stems from Haldane 1941 "The fitting of binomial distributions"
In other cases a good fit may be obtained to a binomial distribution where $P_r$, is the coefficient of $t^r$ in the expansion $(1 -p +pt)^k$. Here $p$ and $k$ are both positive or both negative. Where they are negative it is convenient to write $p' = -p$, $k' = - k$.
In Fisher's 1941 The negative binomial distribution the expressions $(q+p)^n$ and $(q-p)^{-k}$ are used.
Alternative explanation 2
In Yule 1910 "On the Distribution of Deaths with Age when the Causes of Death Act Cumulatively, and Similar Frequency Distributions"
The expression is related with the binomial expansion of $p^r(1-q)^{-r}$ on page 28
But this is the binomial expansion of $p^r (1 - q)^{-r}$, and we have
therefore reached the law that the proportions of the original population dying during the successive exposures, if $r$ unfavourable exposures are fatal, are given by the successive terms of the binomial expansion of $p^r(1-q)^{-r}$
also later at the end of the page
As our discontinuous series is a binomial series, the form of curve to which we will pass will evidently be the binomial curve of Professor Pearson (type iii of his memoir*), though he derived it from a binomial series with positive and not with negative index.
[link added by me]
|
Why is a "negative binomial" random variable called that?
Below are some alternative explanations.
They relate to the currently accepted answer. It boils down to a negative index somewhere that contrasts to the positive index for the 'regular' binomial distr
|
10,417
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
There are several ways for calculating confidence intervals for the mean of a lognormal distribution. I am going to present two methods: Bootstrap and Profile likelihood. I will also present a discussion on the Jeffreys prior.
Bootstrap
For the MLE
In this case, the MLE of $(\mu,\sigma)$ for a sample $(x_1,...,x_n)$ are
$$\hat\mu= \dfrac{1}{n}\sum_{j=1}^n\log(x_j);\,\,\,\hat\sigma^2=\dfrac{1}{n}\sum_{j=1}^n(\log(x_j)-\hat\mu)^2.$$
Then, the MLE of the mean is $\hat\delta=\exp(\hat\mu+\hat\sigma^2/2)$. By resampling we can obtain a bootstrap sample of $\hat\delta$ and, using this, we can calculate several bootstrap confidence intervals. The following R codes shows how to obtain these.
rm(list=ls())
library(boot)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Statistic (MLE)
mle = function(dat){
m = mean(log(dat))
s = mean((log(dat)-m)^2)
return(exp(m+s/2))
}
# Bootstrap
boots.out = boot(data=data0, statistic=function(d, ind){mle(d[ind])}, R = 10000)
plot(density(boots.out$t))
# 4 types of Bootstrap confidence intervals
boot.ci(boots.out, conf = 0.95, type = "all")
For the sample mean
Now, considering the estimator $\tilde{\delta}=\bar{x}$ instead of the MLE. Other type of estimators might be considered as well.
rm(list=ls())
library(boot)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Statistic (MLE)
samp.mean = function(dat) return(mean(dat))
# Bootstrap
boots.out = boot(data=data0, statistic=function(d, ind){samp.mean(d[ind])}, R = 10000)
plot(density(boots.out$t))
# 4 types of Bootstrap confidence intervals
boot.ci(boots.out, conf = 0.95, type = "all")
Profile likelihood
For the definition of likelihood and profile likelihood functions, see. Using the invariance property of the likelihood we can reparameterise as follows $(\mu,\sigma)\rightarrow(\delta,\sigma)$, where $\delta=\exp(\mu+\sigma^2/2)$ and then calculate numerically the profile likelihood of $\delta$.
$$R_p(\delta)=\dfrac{\sup_{\sigma}{\mathcal L}(\delta,\sigma)}{\sup_{\delta,\sigma}{\mathcal L}(\delta,\sigma)}.$$
This function takes values in $(0,1]$; an interval of level $0.147$ has an approximate confidence of $95\%$. We are going to use this property for constructing a confidence interval for $\delta$. The following R codes shows how to obtain this interval.
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Log likelihood
ll = function(mu,sigma) return( sum(log(dlnorm(data0,mu,sigma))))
# Profile likelihood
Rp = function(delta){
temp = function(sigma) return( sum(log(dlnorm(data0,log(delta)-0.5*sigma^2,sigma)) ))
max=exp(optimize(temp,c(0.25,1.5),maximum=TRUE)$objective -ll(mean(log(data0)),sqrt(mean((log(data0)-mean(log(data0)))^2))))
return(max)
}
vec = seq(1.2,2.5,0.001)
rvec = lapply(vec,Rp)
plot(vec,rvec,type="l")
# Profile confidence intervals
tr = function(delta) return(Rp(delta)-0.147)
c(uniroot(tr,c(1.2,1.6))$root,uniroot(tr,c(2,2.3))$root)
$\star$ Bayesian
In this section, an alternative algorithm, based on Metropolis-Hastings sampling and the use of the Jeffreys prior, for calculating a credibility interval for $\delta$ is presented.
Recall that the Jeffreys prior for $(\mu,\sigma)$ in a lognormal model is
$$\pi(\mu,\sigma)\propto \sigma^{-2},$$
and that this prior is invariant under reparameterisations. This prior is improper, but the posterior of the parameters is proper if the sample size $n\geq 2$. The following R code shows how to obtain a 95% credibility interval using this Bayesian model.
library(mcmc)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Log posterior
lp = function(par){
if(par[2]>0) return( sum(log(dlnorm(data0,par[1],par[2]))) - 2*log(par[2]))
else return(-Inf)
}
# Metropolis-Hastings
NMH = 260000
out = metrop(lp, scale = 0.175, initial = c(0.1,0.8), nbatch = NMH)
#Acceptance rate
out$acc
deltap = exp( out$batch[,1][seq(10000,NMH,25)] + 0.5*(out$batch[,2][seq(10000,NMH,25)])^2 )
plot(density(deltap))
# 95% credibility interval
c(quantile(deltap,0.025),quantile(deltap,0.975))
Note that they are very similar.
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
There are several ways for calculating confidence intervals for the mean of a lognormal distribution. I am going to present two methods: Bootstrap and Profile likelihood. I will also present a discuss
|
How do I calculate a confidence interval for the mean of a log-normal data set?
There are several ways for calculating confidence intervals for the mean of a lognormal distribution. I am going to present two methods: Bootstrap and Profile likelihood. I will also present a discussion on the Jeffreys prior.
Bootstrap
For the MLE
In this case, the MLE of $(\mu,\sigma)$ for a sample $(x_1,...,x_n)$ are
$$\hat\mu= \dfrac{1}{n}\sum_{j=1}^n\log(x_j);\,\,\,\hat\sigma^2=\dfrac{1}{n}\sum_{j=1}^n(\log(x_j)-\hat\mu)^2.$$
Then, the MLE of the mean is $\hat\delta=\exp(\hat\mu+\hat\sigma^2/2)$. By resampling we can obtain a bootstrap sample of $\hat\delta$ and, using this, we can calculate several bootstrap confidence intervals. The following R codes shows how to obtain these.
rm(list=ls())
library(boot)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Statistic (MLE)
mle = function(dat){
m = mean(log(dat))
s = mean((log(dat)-m)^2)
return(exp(m+s/2))
}
# Bootstrap
boots.out = boot(data=data0, statistic=function(d, ind){mle(d[ind])}, R = 10000)
plot(density(boots.out$t))
# 4 types of Bootstrap confidence intervals
boot.ci(boots.out, conf = 0.95, type = "all")
For the sample mean
Now, considering the estimator $\tilde{\delta}=\bar{x}$ instead of the MLE. Other type of estimators might be considered as well.
rm(list=ls())
library(boot)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Statistic (MLE)
samp.mean = function(dat) return(mean(dat))
# Bootstrap
boots.out = boot(data=data0, statistic=function(d, ind){samp.mean(d[ind])}, R = 10000)
plot(density(boots.out$t))
# 4 types of Bootstrap confidence intervals
boot.ci(boots.out, conf = 0.95, type = "all")
Profile likelihood
For the definition of likelihood and profile likelihood functions, see. Using the invariance property of the likelihood we can reparameterise as follows $(\mu,\sigma)\rightarrow(\delta,\sigma)$, where $\delta=\exp(\mu+\sigma^2/2)$ and then calculate numerically the profile likelihood of $\delta$.
$$R_p(\delta)=\dfrac{\sup_{\sigma}{\mathcal L}(\delta,\sigma)}{\sup_{\delta,\sigma}{\mathcal L}(\delta,\sigma)}.$$
This function takes values in $(0,1]$; an interval of level $0.147$ has an approximate confidence of $95\%$. We are going to use this property for constructing a confidence interval for $\delta$. The following R codes shows how to obtain this interval.
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Log likelihood
ll = function(mu,sigma) return( sum(log(dlnorm(data0,mu,sigma))))
# Profile likelihood
Rp = function(delta){
temp = function(sigma) return( sum(log(dlnorm(data0,log(delta)-0.5*sigma^2,sigma)) ))
max=exp(optimize(temp,c(0.25,1.5),maximum=TRUE)$objective -ll(mean(log(data0)),sqrt(mean((log(data0)-mean(log(data0)))^2))))
return(max)
}
vec = seq(1.2,2.5,0.001)
rvec = lapply(vec,Rp)
plot(vec,rvec,type="l")
# Profile confidence intervals
tr = function(delta) return(Rp(delta)-0.147)
c(uniroot(tr,c(1.2,1.6))$root,uniroot(tr,c(2,2.3))$root)
$\star$ Bayesian
In this section, an alternative algorithm, based on Metropolis-Hastings sampling and the use of the Jeffreys prior, for calculating a credibility interval for $\delta$ is presented.
Recall that the Jeffreys prior for $(\mu,\sigma)$ in a lognormal model is
$$\pi(\mu,\sigma)\propto \sigma^{-2},$$
and that this prior is invariant under reparameterisations. This prior is improper, but the posterior of the parameters is proper if the sample size $n\geq 2$. The following R code shows how to obtain a 95% credibility interval using this Bayesian model.
library(mcmc)
set.seed(1)
# Simulated data
data0 = exp(rnorm(100))
# Log posterior
lp = function(par){
if(par[2]>0) return( sum(log(dlnorm(data0,par[1],par[2]))) - 2*log(par[2]))
else return(-Inf)
}
# Metropolis-Hastings
NMH = 260000
out = metrop(lp, scale = 0.175, initial = c(0.1,0.8), nbatch = NMH)
#Acceptance rate
out$acc
deltap = exp( out$batch[,1][seq(10000,NMH,25)] + 0.5*(out$batch[,2][seq(10000,NMH,25)])^2 )
plot(density(deltap))
# 95% credibility interval
c(quantile(deltap,0.025),quantile(deltap,0.975))
Note that they are very similar.
|
How do I calculate a confidence interval for the mean of a log-normal data set?
There are several ways for calculating confidence intervals for the mean of a lognormal distribution. I am going to present two methods: Bootstrap and Profile likelihood. I will also present a discuss
|
10,418
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
You might try the Bayesian approach with Jeffreys' prior. It should yield credibility intervals with a correct frequentist-matching property: the confidence level of the credibility interval is close to its credibility level.
# required package
library(bayesm)
# simulated data
mu <- 0
sdv <- 1
y <- exp(rnorm(1000, mean=mu, sd=sdv))
# model matrix
X <- model.matrix(log(y)~1)
# prior parameters
Theta0 <- c(0)
A0 <- 0.0001*diag(1)
nu0 <- 0 # Jeffreys prior for the normal model; set nu0 to 1 for the lognormal model
sigam0sq <- 0
# number of simulations
n.sims <- 5000
# run posterior simulations
Data <- list(y=log(y),X=X)
Prior <- list(betabar=Theta0, A=A0, nu=nu0, ssq=sigam0sq)
Mcmc <- list(R=n.sims)
bayesian.reg <- runireg(Data, Prior, Mcmc)
mu.sims <- t(bayesian.reg$betadraw) # transpose of bayesian.reg$betadraw
sigmasq.sims <- bayesian.reg$sigmasqdraw
# posterior simulations of the mean of y: exp(mu+sigma²/2)
lmean.sims <- exp(mu.sims+sigmasq.sims/2)
# credibility interval about lmean:
quantile(lmean.sims, probs = c(0.025, 0.975))
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
You might try the Bayesian approach with Jeffreys' prior. It should yield credibility intervals with a correct frequentist-matching property: the confidence level of the credibility interval is close
|
How do I calculate a confidence interval for the mean of a log-normal data set?
You might try the Bayesian approach with Jeffreys' prior. It should yield credibility intervals with a correct frequentist-matching property: the confidence level of the credibility interval is close to its credibility level.
# required package
library(bayesm)
# simulated data
mu <- 0
sdv <- 1
y <- exp(rnorm(1000, mean=mu, sd=sdv))
# model matrix
X <- model.matrix(log(y)~1)
# prior parameters
Theta0 <- c(0)
A0 <- 0.0001*diag(1)
nu0 <- 0 # Jeffreys prior for the normal model; set nu0 to 1 for the lognormal model
sigam0sq <- 0
# number of simulations
n.sims <- 5000
# run posterior simulations
Data <- list(y=log(y),X=X)
Prior <- list(betabar=Theta0, A=A0, nu=nu0, ssq=sigam0sq)
Mcmc <- list(R=n.sims)
bayesian.reg <- runireg(Data, Prior, Mcmc)
mu.sims <- t(bayesian.reg$betadraw) # transpose of bayesian.reg$betadraw
sigmasq.sims <- bayesian.reg$sigmasqdraw
# posterior simulations of the mean of y: exp(mu+sigma²/2)
lmean.sims <- exp(mu.sims+sigmasq.sims/2)
# credibility interval about lmean:
quantile(lmean.sims, probs = c(0.025, 0.975))
|
How do I calculate a confidence interval for the mean of a log-normal data set?
You might try the Bayesian approach with Jeffreys' prior. It should yield credibility intervals with a correct frequentist-matching property: the confidence level of the credibility interval is close
|
10,419
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
Another approximate confidence interval for the mean $\delta = \exp\left(\mu+\sigma^2/2\right)$ of the i.i.d. random variables in a random sample $\left(X_1, \ldots, X_n\right)$ of size $n$ from a $\mathcal{LN}\left(\mu,\sigma^2\right)$ distribution can be established by considering the asymptotic distribution of the MLE $\hat\delta = \exp\left(\hat\mu + \hat\sigma^2/2\right)$ for $\delta$, which can be obtained by applying the multivariate delta method to the asymptotic distribution of the MLE $\left(\hat\mu, \hat\sigma^2\right)^\top$ for $\left(\mu, \sigma^2\right)^\top$:
The entries of $\left(\hat\mu, \hat\sigma^2\right)^\top$ are given by
$$
\hat\mu = \frac{1}{n} \sum_{i=1}^n\ln\left(x_i\right),\\
\hat\sigma^2 = \frac{1}{n} \sum_{i=1}^n\left(\ln\left(x_i\right)-\hat\mu\right)^2.
$$
From MLE theory we know that
$$
\sqrt{n}
\left(
\begin{pmatrix}
\hat\mu \\
\hat\sigma^2
\end{pmatrix}
-
\begin{pmatrix}
\mu \\
\sigma^2
\end{pmatrix}
\right)
\overset{d}{\to}
\mathcal N\left(
\begin{pmatrix}
0 \\
0
\end{pmatrix},
I\left(\mu, \sigma^2\right)^{-1}
\right),
$$
where $I\left(\mu, \sigma^2\right)^{-1} = \mathrm{diag}\left( \sigma^2, 2\sigma^4 \right)$ is the inverse of the expected Fisher information from a single $X_i$.$^\star$
The gradient of $\left(\mu, \sigma^2\right) \mapsto \exp\left(\mu+\sigma^2/2\right)$ is given by $\left(\exp\left(\mu+\sigma^2/2\right), \exp\left(\mu+\sigma^2/2\right)/2\right)^\top$ and hence the delta method yields
$$
\sqrt{n} \left(\hat\delta - \delta\right)
\overset{d}{\to}
\mathcal{N}\left(0, \delta^2 \sigma^2 \left(1+\frac{\sigma^2}{2} \right) \right).
$$
Finally, after replacing $\delta^2$ and $\sigma^2$ with its consistent estimators $\hat\delta^2$ and $\hat\sigma^2$, we get the approximate $(1-\alpha)\times 100\%$ confidence interval
$$
\hat\delta \mp z_{1-\alpha/2} \times \hat\delta \times \frac{1}{\sqrt n} \times \sqrt{\hat\sigma^2\left(1+\frac{\hat\sigma^2}{2}\right)}
$$
for $\delta$.
alpha <- 0.05
n <- 100
mu <- 0
sigma_sq <- 1
x <- rlnorm(n, mu, sqrt(sigma_sq))
mu_mle <- mean(log(x))
sigma_sq_mle <- mean((log(x) - mu_mle)^2)
delta_mle <- exp(mu_mle + sigma_sq_mle/2)
z <- qnorm(1 - alpha/2)
moe <- z * delta_mle * 1/sqrt(n) * sqrt(sigma_sq_mle * (1 + sigma_sq_mle/2))
sprintf("%d%% CI for the mean: [%f, %f]",
(1-alpha)*100, delta_mle - moe, delta_mle + moe)
$^\star$This seems to be wrong in the Wikipedia article on the log-normal distribution (accessed 2022-08-28).
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
Another approximate confidence interval for the mean $\delta = \exp\left(\mu+\sigma^2/2\right)$ of the i.i.d. random variables in a random sample $\left(X_1, \ldots, X_n\right)$ of size $n$ from a $\m
|
How do I calculate a confidence interval for the mean of a log-normal data set?
Another approximate confidence interval for the mean $\delta = \exp\left(\mu+\sigma^2/2\right)$ of the i.i.d. random variables in a random sample $\left(X_1, \ldots, X_n\right)$ of size $n$ from a $\mathcal{LN}\left(\mu,\sigma^2\right)$ distribution can be established by considering the asymptotic distribution of the MLE $\hat\delta = \exp\left(\hat\mu + \hat\sigma^2/2\right)$ for $\delta$, which can be obtained by applying the multivariate delta method to the asymptotic distribution of the MLE $\left(\hat\mu, \hat\sigma^2\right)^\top$ for $\left(\mu, \sigma^2\right)^\top$:
The entries of $\left(\hat\mu, \hat\sigma^2\right)^\top$ are given by
$$
\hat\mu = \frac{1}{n} \sum_{i=1}^n\ln\left(x_i\right),\\
\hat\sigma^2 = \frac{1}{n} \sum_{i=1}^n\left(\ln\left(x_i\right)-\hat\mu\right)^2.
$$
From MLE theory we know that
$$
\sqrt{n}
\left(
\begin{pmatrix}
\hat\mu \\
\hat\sigma^2
\end{pmatrix}
-
\begin{pmatrix}
\mu \\
\sigma^2
\end{pmatrix}
\right)
\overset{d}{\to}
\mathcal N\left(
\begin{pmatrix}
0 \\
0
\end{pmatrix},
I\left(\mu, \sigma^2\right)^{-1}
\right),
$$
where $I\left(\mu, \sigma^2\right)^{-1} = \mathrm{diag}\left( \sigma^2, 2\sigma^4 \right)$ is the inverse of the expected Fisher information from a single $X_i$.$^\star$
The gradient of $\left(\mu, \sigma^2\right) \mapsto \exp\left(\mu+\sigma^2/2\right)$ is given by $\left(\exp\left(\mu+\sigma^2/2\right), \exp\left(\mu+\sigma^2/2\right)/2\right)^\top$ and hence the delta method yields
$$
\sqrt{n} \left(\hat\delta - \delta\right)
\overset{d}{\to}
\mathcal{N}\left(0, \delta^2 \sigma^2 \left(1+\frac{\sigma^2}{2} \right) \right).
$$
Finally, after replacing $\delta^2$ and $\sigma^2$ with its consistent estimators $\hat\delta^2$ and $\hat\sigma^2$, we get the approximate $(1-\alpha)\times 100\%$ confidence interval
$$
\hat\delta \mp z_{1-\alpha/2} \times \hat\delta \times \frac{1}{\sqrt n} \times \sqrt{\hat\sigma^2\left(1+\frac{\hat\sigma^2}{2}\right)}
$$
for $\delta$.
alpha <- 0.05
n <- 100
mu <- 0
sigma_sq <- 1
x <- rlnorm(n, mu, sqrt(sigma_sq))
mu_mle <- mean(log(x))
sigma_sq_mle <- mean((log(x) - mu_mle)^2)
delta_mle <- exp(mu_mle + sigma_sq_mle/2)
z <- qnorm(1 - alpha/2)
moe <- z * delta_mle * 1/sqrt(n) * sqrt(sigma_sq_mle * (1 + sigma_sq_mle/2))
sprintf("%d%% CI for the mean: [%f, %f]",
(1-alpha)*100, delta_mle - moe, delta_mle + moe)
$^\star$This seems to be wrong in the Wikipedia article on the log-normal distribution (accessed 2022-08-28).
|
How do I calculate a confidence interval for the mean of a log-normal data set?
Another approximate confidence interval for the mean $\delta = \exp\left(\mu+\sigma^2/2\right)$ of the i.i.d. random variables in a random sample $\left(X_1, \ldots, X_n\right)$ of size $n$ from a $\m
|
10,420
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
However, I'm a bit suspicious of this method, simply because it doesn't work for the mean itself: 10mean(log10(X))≠mean(X)
You're right -- that's the formula for the geometric mean, not the arithmetic mean. The arithmetic mean is a parameter from the normal distribution, and is often not very meaningful for lognormal data. The geometric mean is the corresponding parameter from the lognormal distribution if you want to talk more meaningfully about a central tendency for your data.
And you would indeed calculate the CIs about the geometric mean by taking the logarithms of the data, calculating the mean and CIs as usual, and back-transforming. You're right that you really don't want to mix your distributions by putting the CIs for the geometric mean around the arithmetic mean....yeowch!
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
However, I'm a bit suspicious of this method, simply because it doesn't work for the mean itself: 10mean(log10(X))≠mean(X)
You're right -- that's the formula for the geometric mean, not the arithmeti
|
How do I calculate a confidence interval for the mean of a log-normal data set?
However, I'm a bit suspicious of this method, simply because it doesn't work for the mean itself: 10mean(log10(X))≠mean(X)
You're right -- that's the formula for the geometric mean, not the arithmetic mean. The arithmetic mean is a parameter from the normal distribution, and is often not very meaningful for lognormal data. The geometric mean is the corresponding parameter from the lognormal distribution if you want to talk more meaningfully about a central tendency for your data.
And you would indeed calculate the CIs about the geometric mean by taking the logarithms of the data, calculating the mean and CIs as usual, and back-transforming. You're right that you really don't want to mix your distributions by putting the CIs for the geometric mean around the arithmetic mean....yeowch!
|
How do I calculate a confidence interval for the mean of a log-normal data set?
However, I'm a bit suspicious of this method, simply because it doesn't work for the mean itself: 10mean(log10(X))≠mean(X)
You're right -- that's the formula for the geometric mean, not the arithmeti
|
10,421
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
As @dnidz said, you probably want to be computing the geometric mean and its CI, not the arithmetic mean and its CI, when data are sampled from a lognormal distribution. Why?
First, let's think about normal distributions. For an ideal normal population (distribution), the arithmetic mean and the median are identical. For any given sample, those two values are usually not identical. Which of the two values is likely to be closer to the true mean (and median; they are the same) of the population? The median is computed only from the ranks of the values. The arithmetic mean is computed from the actual values and takes into account an assumption about the distribution. If that assumption of sampling from a normal assumption is true, the arithmetic mean of the sample is likely to be closer to the mean and median of the distribution than is the median of the sample. That is why the arithmetic mean (the average) is so commonly used.
Now let’s switch to the lognormal distribution. The median and geometric mean of an ideal lognormal distribution are identical, but the arithmetic mean has a larger value. How much larger depends on how asymmetrical the distribution is as expressed by the Geometric standard deviation.
Your goal (I assume) is to estimate the median of the population (or distribution) from a sample of data. If you are sampling from a lognormal population, the best estimate is the geometric mean. That is likely to be a better estimate than the sample median and a much better estimate than the arithmetic mean.
The figure on the left below shows an ideal lognormal distribution (GeoMean=10; GeoSD=4) with its arithmetic and geometric mean. The graph on the right shows a sample of data (on a logarithmic axis) showing the two means and the median.
If you agree that the geometric mean is most appropriate:
Transform all values to logarithms.
Compute the arithmetic mean and the 95% CI of that mean from the set of logarithms.
Back transform the mean and both confidence limits to the original units. You'll have calculated the geometric mean and its 95% CI.
(Biologists use the common base 10 logarithm and the 10^ back transofrm. Mathematicians and physical scientists use the natural ln logarithm and the exp() back transform. The results will be the same either way.)
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
As @dnidz said, you probably want to be computing the geometric mean and its CI, not the arithmetic mean and its CI, when data are sampled from a lognormal distribution. Why?
First, let's think about
|
How do I calculate a confidence interval for the mean of a log-normal data set?
As @dnidz said, you probably want to be computing the geometric mean and its CI, not the arithmetic mean and its CI, when data are sampled from a lognormal distribution. Why?
First, let's think about normal distributions. For an ideal normal population (distribution), the arithmetic mean and the median are identical. For any given sample, those two values are usually not identical. Which of the two values is likely to be closer to the true mean (and median; they are the same) of the population? The median is computed only from the ranks of the values. The arithmetic mean is computed from the actual values and takes into account an assumption about the distribution. If that assumption of sampling from a normal assumption is true, the arithmetic mean of the sample is likely to be closer to the mean and median of the distribution than is the median of the sample. That is why the arithmetic mean (the average) is so commonly used.
Now let’s switch to the lognormal distribution. The median and geometric mean of an ideal lognormal distribution are identical, but the arithmetic mean has a larger value. How much larger depends on how asymmetrical the distribution is as expressed by the Geometric standard deviation.
Your goal (I assume) is to estimate the median of the population (or distribution) from a sample of data. If you are sampling from a lognormal population, the best estimate is the geometric mean. That is likely to be a better estimate than the sample median and a much better estimate than the arithmetic mean.
The figure on the left below shows an ideal lognormal distribution (GeoMean=10; GeoSD=4) with its arithmetic and geometric mean. The graph on the right shows a sample of data (on a logarithmic axis) showing the two means and the median.
If you agree that the geometric mean is most appropriate:
Transform all values to logarithms.
Compute the arithmetic mean and the 95% CI of that mean from the set of logarithms.
Back transform the mean and both confidence limits to the original units. You'll have calculated the geometric mean and its 95% CI.
(Biologists use the common base 10 logarithm and the 10^ back transofrm. Mathematicians and physical scientists use the natural ln logarithm and the exp() back transform. The results will be the same either way.)
|
How do I calculate a confidence interval for the mean of a log-normal data set?
As @dnidz said, you probably want to be computing the geometric mean and its CI, not the arithmetic mean and its CI, when data are sampled from a lognormal distribution. Why?
First, let's think about
|
10,422
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
Ulf Olsson (2005)$^{[1]}$ presents several possibilities of calculating confidence intervals for a lognormal mean. First, let's clarify the notation. Let $X$ be a random variable following a log-normal distribution with mean $\operatorname{E}(X)=\theta$. Let $Y = \log(X)$ be the log-transformed variable which is normally distributed with mean $\operatorname{E}(Y)=\mu$ and variance $\operatorname{Var}(Y)=\sigma^2$. The sample equivalents of the mean and variance of $Y$ are $\bar{y}$ and $s^2$. We seek a confidence interval for the mean of $X$, defined as
$$
\operatorname{E}(X) = \theta = e^{\left(\mu + \frac{\sigma^2}{2}\right)}
$$
A possible $(1 - \alpha)\,\%$-confidence interval for $\log(\theta)$ is given by (see also Zhou et al. 1997$^{[2]}$):
$$
\bar{y}+\frac{s^2}{2}\pm z_{1-\alpha/2}\sqrt{\frac{s^2}{n}+\frac{s^4}{2(n-1)}}
$$
where $z_{1-\alpha/2}$ is the appropriate quantile of the standard normal distribution. The limits of this confidence interval are then back-transformed to give a confidence interval for $\theta$.
Olsson recommends using $t$-quantiles with $n-1$ degrees of freedom instead of $z$-quantiles:
$$
\bar{y}+\frac{s^2}{2}\pm t_{1-\alpha/2, n-1}\sqrt{\frac{s^2}{n}+\frac{s^4}{2(n-1)}}
$$
He found that this modification improved the performance, although the coverage probability was lower than nominal for $n<50$.
Let's inspect the performance of this formula in a very small simulation:
# The function to calculate the CI
ci_lnorm <- function(x, alpha = 0.05) {
n <- length(x)
tval <- qt(1 - alpha/2, n - 1)
y <- log(x)
ybar <- mean(y)
s <- sd(y)
exp(ybar + s^2/2 + c(-1, 1)*tval*sqrt((s^2/n) + (s^4/(2*(n - 1)))))
}
# True parameters of X (on normal log-scale)
mu <- 1
s <- 2.5
true_mean <- exp(mu + (1/2)*s^2)
# Simulation
set.seed(142857)
res <- replicate(1e5, {
x <- rlnorm(10, mu, s)
ci <- ci_lnorm(x)
ifelse(ci[2] > true_mean && ci[1] < true_mean, 1, 0)
})
# Coverage
mean(res)
[1] 0.91053
The simulated coverage for $n=10, \mu = 1, \sigma = 2.5$ is around $91.1\,\%$ based on $100\,000$ simulations.
References
$[1]:$ Olsson, U. (2005). Confidence intervals for the mean of a log-normal distribution. Journal of Statistics Education, 13(1). (link)
$[2]:$ Zhou, X. H., & Gao, S. (1997). Confidence intervals for the log‐normal mean. Statistics in medicine, 16(7), 783-790. (link)
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
Ulf Olsson (2005)$^{[1]}$ presents several possibilities of calculating confidence intervals for a lognormal mean. First, let's clarify the notation. Let $X$ be a random variable following a log-norma
|
How do I calculate a confidence interval for the mean of a log-normal data set?
Ulf Olsson (2005)$^{[1]}$ presents several possibilities of calculating confidence intervals for a lognormal mean. First, let's clarify the notation. Let $X$ be a random variable following a log-normal distribution with mean $\operatorname{E}(X)=\theta$. Let $Y = \log(X)$ be the log-transformed variable which is normally distributed with mean $\operatorname{E}(Y)=\mu$ and variance $\operatorname{Var}(Y)=\sigma^2$. The sample equivalents of the mean and variance of $Y$ are $\bar{y}$ and $s^2$. We seek a confidence interval for the mean of $X$, defined as
$$
\operatorname{E}(X) = \theta = e^{\left(\mu + \frac{\sigma^2}{2}\right)}
$$
A possible $(1 - \alpha)\,\%$-confidence interval for $\log(\theta)$ is given by (see also Zhou et al. 1997$^{[2]}$):
$$
\bar{y}+\frac{s^2}{2}\pm z_{1-\alpha/2}\sqrt{\frac{s^2}{n}+\frac{s^4}{2(n-1)}}
$$
where $z_{1-\alpha/2}$ is the appropriate quantile of the standard normal distribution. The limits of this confidence interval are then back-transformed to give a confidence interval for $\theta$.
Olsson recommends using $t$-quantiles with $n-1$ degrees of freedom instead of $z$-quantiles:
$$
\bar{y}+\frac{s^2}{2}\pm t_{1-\alpha/2, n-1}\sqrt{\frac{s^2}{n}+\frac{s^4}{2(n-1)}}
$$
He found that this modification improved the performance, although the coverage probability was lower than nominal for $n<50$.
Let's inspect the performance of this formula in a very small simulation:
# The function to calculate the CI
ci_lnorm <- function(x, alpha = 0.05) {
n <- length(x)
tval <- qt(1 - alpha/2, n - 1)
y <- log(x)
ybar <- mean(y)
s <- sd(y)
exp(ybar + s^2/2 + c(-1, 1)*tval*sqrt((s^2/n) + (s^4/(2*(n - 1)))))
}
# True parameters of X (on normal log-scale)
mu <- 1
s <- 2.5
true_mean <- exp(mu + (1/2)*s^2)
# Simulation
set.seed(142857)
res <- replicate(1e5, {
x <- rlnorm(10, mu, s)
ci <- ci_lnorm(x)
ifelse(ci[2] > true_mean && ci[1] < true_mean, 1, 0)
})
# Coverage
mean(res)
[1] 0.91053
The simulated coverage for $n=10, \mu = 1, \sigma = 2.5$ is around $91.1\,\%$ based on $100\,000$ simulations.
References
$[1]:$ Olsson, U. (2005). Confidence intervals for the mean of a log-normal distribution. Journal of Statistics Education, 13(1). (link)
$[2]:$ Zhou, X. H., & Gao, S. (1997). Confidence intervals for the log‐normal mean. Statistics in medicine, 16(7), 783-790. (link)
|
How do I calculate a confidence interval for the mean of a log-normal data set?
Ulf Olsson (2005)$^{[1]}$ presents several possibilities of calculating confidence intervals for a lognormal mean. First, let's clarify the notation. Let $X$ be a random variable following a log-norma
|
10,423
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
On R you can try EnvStats::elnorm(data_vector, ci = TRUE)$interval$limits
Otherwise, on the below answer you can see how to get either prediction on confidence intervals with different prob values.
https://stats.stackexchange.com/a/109236/162190
Both ways give the same limits of CI.
|
How do I calculate a confidence interval for the mean of a log-normal data set?
|
On R you can try EnvStats::elnorm(data_vector, ci = TRUE)$interval$limits
Otherwise, on the below answer you can see how to get either prediction on confidence intervals with different prob values.
ht
|
How do I calculate a confidence interval for the mean of a log-normal data set?
On R you can try EnvStats::elnorm(data_vector, ci = TRUE)$interval$limits
Otherwise, on the below answer you can see how to get either prediction on confidence intervals with different prob values.
https://stats.stackexchange.com/a/109236/162190
Both ways give the same limits of CI.
|
How do I calculate a confidence interval for the mean of a log-normal data set?
On R you can try EnvStats::elnorm(data_vector, ci = TRUE)$interval$limits
Otherwise, on the below answer you can see how to get either prediction on confidence intervals with different prob values.
ht
|
10,424
|
Dealing with correlated regressors
|
Principal components make a lot of sense... mathematically. However, I'd be wary of simply using some mathematical trick in this case and hoping that I don't need to think about my problem.
I'd recommend thinking a little about what kind of predictors I have, what the independent variable is, why my predictors are correlated, whether some of my predictors are actually measuring the same underlying reality (if so, whether I can just work with a single measurement and which of my predictors would be best for this), what I am doing the analysis for - if I'm not interested in inference, only in prediction, then I could actually leave things just as they are, as long as future predictor values are similar to past ones.
|
Dealing with correlated regressors
|
Principal components make a lot of sense... mathematically. However, I'd be wary of simply using some mathematical trick in this case and hoping that I don't need to think about my problem.
I'd recomm
|
Dealing with correlated regressors
Principal components make a lot of sense... mathematically. However, I'd be wary of simply using some mathematical trick in this case and hoping that I don't need to think about my problem.
I'd recommend thinking a little about what kind of predictors I have, what the independent variable is, why my predictors are correlated, whether some of my predictors are actually measuring the same underlying reality (if so, whether I can just work with a single measurement and which of my predictors would be best for this), what I am doing the analysis for - if I'm not interested in inference, only in prediction, then I could actually leave things just as they are, as long as future predictor values are similar to past ones.
|
Dealing with correlated regressors
Principal components make a lot of sense... mathematically. However, I'd be wary of simply using some mathematical trick in this case and hoping that I don't need to think about my problem.
I'd recomm
|
10,425
|
Dealing with correlated regressors
|
You can use principal components or ridge regression to deal with this problem. On the other hand, if you have two variables that are correlated highly enough to cause problems with parameter estimation, then you could almost certainly drop either one of the two without losing much in terms of prediction--because the two variables carry the same information. Of course, that only works when the problem is due to two highly correlated independents. When the problem involves more than two variables that are together nearly collinear (any two of which may have only moderate correlations), you'll probably need one of the other methods.
|
Dealing with correlated regressors
|
You can use principal components or ridge regression to deal with this problem. On the other hand, if you have two variables that are correlated highly enough to cause problems with parameter estimat
|
Dealing with correlated regressors
You can use principal components or ridge regression to deal with this problem. On the other hand, if you have two variables that are correlated highly enough to cause problems with parameter estimation, then you could almost certainly drop either one of the two without losing much in terms of prediction--because the two variables carry the same information. Of course, that only works when the problem is due to two highly correlated independents. When the problem involves more than two variables that are together nearly collinear (any two of which may have only moderate correlations), you'll probably need one of the other methods.
|
Dealing with correlated regressors
You can use principal components or ridge regression to deal with this problem. On the other hand, if you have two variables that are correlated highly enough to cause problems with parameter estimat
|
10,426
|
Dealing with correlated regressors
|
Here is another thought that is inspired by Stephan's answer:
If some of your correlated regressors are meaningfully related (e.g., they are different measures of intelligence i.e., verbal, math etc) then you can create a single variable that measures the same variable using one of the following techniques:
Sum the regressors (appropriate if the regressors are components of a whole, e.g., verbal IQ + math IQ = Overall IQ)
Average of the regressors (appropriate if the regressors are measuring the same underlying construct e.g., size of left shoe, size of right shoe to measure length of feet)
Factor analysis (to account for errors in measurements and to extract a latent factor)
You can then drop all the correlated regressors and replace them with the one variable that emerges from the above analysis.
|
Dealing with correlated regressors
|
Here is another thought that is inspired by Stephan's answer:
If some of your correlated regressors are meaningfully related (e.g., they are different measures of intelligence i.e., verbal, math etc)
|
Dealing with correlated regressors
Here is another thought that is inspired by Stephan's answer:
If some of your correlated regressors are meaningfully related (e.g., they are different measures of intelligence i.e., verbal, math etc) then you can create a single variable that measures the same variable using one of the following techniques:
Sum the regressors (appropriate if the regressors are components of a whole, e.g., verbal IQ + math IQ = Overall IQ)
Average of the regressors (appropriate if the regressors are measuring the same underlying construct e.g., size of left shoe, size of right shoe to measure length of feet)
Factor analysis (to account for errors in measurements and to extract a latent factor)
You can then drop all the correlated regressors and replace them with the one variable that emerges from the above analysis.
|
Dealing with correlated regressors
Here is another thought that is inspired by Stephan's answer:
If some of your correlated regressors are meaningfully related (e.g., they are different measures of intelligence i.e., verbal, math etc)
|
10,427
|
Dealing with correlated regressors
|
I was about to say much the same thing as Stephan Kolassa above (so have upvoted his answer). I'd only add that sometimes multicollinearity can be due to using extensive variables which are all highly correlated with some measure of size, and things can be improved by using intensive variables, i.e. dividing everything through by some measure of size. E.g. if your units are countries, you might divide by population, area, or GNP, depending on context.
Oh - and to answer the second part of the original question: I can't think of any situation when adding the product of all the correlated regressors would be a good idea. How would it help? What would it mean?
|
Dealing with correlated regressors
|
I was about to say much the same thing as Stephan Kolassa above (so have upvoted his answer). I'd only add that sometimes multicollinearity can be due to using extensive variables which are all highly
|
Dealing with correlated regressors
I was about to say much the same thing as Stephan Kolassa above (so have upvoted his answer). I'd only add that sometimes multicollinearity can be due to using extensive variables which are all highly correlated with some measure of size, and things can be improved by using intensive variables, i.e. dividing everything through by some measure of size. E.g. if your units are countries, you might divide by population, area, or GNP, depending on context.
Oh - and to answer the second part of the original question: I can't think of any situation when adding the product of all the correlated regressors would be a good idea. How would it help? What would it mean?
|
Dealing with correlated regressors
I was about to say much the same thing as Stephan Kolassa above (so have upvoted his answer). I'd only add that sometimes multicollinearity can be due to using extensive variables which are all highly
|
10,428
|
Dealing with correlated regressors
|
I'm no expert on this, but my first thought would be to run a principal component analysis on the predictor variables, then use the resulting principal components to predict your dependent variable.
|
Dealing with correlated regressors
|
I'm no expert on this, but my first thought would be to run a principal component analysis on the predictor variables, then use the resulting principal components to predict your dependent variable.
|
Dealing with correlated regressors
I'm no expert on this, but my first thought would be to run a principal component analysis on the predictor variables, then use the resulting principal components to predict your dependent variable.
|
Dealing with correlated regressors
I'm no expert on this, but my first thought would be to run a principal component analysis on the predictor variables, then use the resulting principal components to predict your dependent variable.
|
10,429
|
Dealing with correlated regressors
|
One of the ways to reduce the effects of correlation is to standardize the regressors. In standardizing, all the regressors are subtracted by their respective means and divided by their respective standard deviations. Specifically, if $X$ is the regression matrix:
$$x_{ij}^{standardized}=\frac {x_{ij}-\overline{x_{.j}}} {s_{j}}$$
This is not a remedy, but definitely a step in the right direction.
|
Dealing with correlated regressors
|
One of the ways to reduce the effects of correlation is to standardize the regressors. In standardizing, all the regressors are subtracted by their respective means and divided by their respective sta
|
Dealing with correlated regressors
One of the ways to reduce the effects of correlation is to standardize the regressors. In standardizing, all the regressors are subtracted by their respective means and divided by their respective standard deviations. Specifically, if $X$ is the regression matrix:
$$x_{ij}^{standardized}=\frac {x_{ij}-\overline{x_{.j}}} {s_{j}}$$
This is not a remedy, but definitely a step in the right direction.
|
Dealing with correlated regressors
One of the ways to reduce the effects of correlation is to standardize the regressors. In standardizing, all the regressors are subtracted by their respective means and divided by their respective sta
|
10,430
|
Is accuracy an improper scoring rule in a binary classification setting?
|
TL;DR
Accuracy is an improper scoring rule. Don't use it.
The slightly longer version
Actually, accuracy is not even a scoring rule. So asking whether it is (strictly) proper is a category error. The most we can say is that under additional assumptions, accuracy is consistent with a scoring rule that is improper, discontinuous and misleading. (Don't use it.)
Your confusion
Your confusion stems from the fact that misclassification loss as per the paper you cite is not a scoring rule, either.
The details: scoring rules vs. classification evaluations
Let us fix terminology. We are interested in a binary outcome $y\in\{0,1\}$, and we have a probabilistic prediction $\widehat{q} = \widehat{P}(Y=1)\in(0,1)$. We know that $P(Y=1)=\eta>0.5$, but our model $\widehat{q}$ may or may not know that.
A scoring rule is a mapping that takes a probabilistic prediction $\widehat{q}$ and an outcome $y$ to a loss,
$$ s\colon (\widehat{q},y) \mapsto s(\widehat{q},y). $$
$s$ is proper if it is optimized in expectation by $\widehat{q}=\eta$. ("Optimized" usually means "minimized", but some authors flip signs and try to maximize a scoring rule.) $s$ is strictly proper if it is optimized in expectation only by $\widehat{q}=\eta$.
We will typically evaluate $s$ on many predictions $\widehat{q}_i$ and corresponding outcomes $y_i$ and average to estimate this expectation.
Now, what is accuracy? Accuracy does not take a probabilistic prediction as an argument. It takes a classification $\widehat{y}\in\{0,1\}$ and an outcome:
$$ a\colon (\widehat{y},y)\mapsto a(\widehat{y},y) =
\begin{cases} 1, & \widehat{y}=y \\ 0, & \widehat{y} \neq y. \end{cases} $$
Therefore, accuracy is not a scoring rule. It is a classification evaluation. (This is a term I just invented; don't go looking for it in the literature.)
Now, of course we can take a probabilistic prediction like our $\widehat{q}$ and turn it into a classification $\widehat{y}$. But to do so, we will need the additional assumptions alluded to above. For instance, it is very common to use a threshold $\theta$ and classify:
$$ \widehat{y}(\widehat{q},\theta) :=
\begin{cases} 1, & \widehat{q}\geq \theta \\ 0, & \widehat{q}<\theta. \end{cases} $$
A very common threshold value is $\theta=0.5$. Note that if we use this threshold and then evaluate the accuracy over many predictions $\widehat{q}_i$ (as above) and corresponding outcomes $y_i$, then we arrive exactly at the misclassification loss as per Buja et al. Thus, misclassification loss is also not a scoring rule, but a classification evaluation.
If we take a classification algorithm like the one above, we can turn a classification evaluation into a scoring rule. The point is that we need the additional assumptions of the classifier. And that accuracy or misclassification loss or whatever other classification evaluation we choose may then depend less on the probabilistic prediction $\widehat{q}$ and more on the way we turn $\widehat{q}$ into a classification $\widehat{y}=\widehat{y}(\widehat{q},\theta)$. So optimizing the classification evaluation may be chasing after a red herring if we are really interested in evaluating $\widehat{q}$.
Now, what is improper about these scoring-rules-under-additional-assumptions? Nothing, in the present case. $\widehat{q}=\eta$, under the implicit $\theta =0.5$, will maximize accuracy and minimize misclassification loss over all possible $\widehat{q}\in(0,1)$. So in this case, our scoring-rule-under-additional-assumptions is proper.
Note that what is important for accuracy or misclassification loss is only one question: do we classify ($\widehat{y}$) everything as the majority class or not? If we do so, accuracy or misclassification loss are happy. If not, they aren't. What is important about this question is that it has only a very tenuous connection to the quality of $\widehat{q}$.
Consequently, our scoring-rules-under-additional-assumptions are not strictly proper, as any $\widehat{q}\geq\theta$ will lead to the same classification evaluation. We might use the standard $\theta=0.5$, believe that the majority class occurs with $\widehat{q}=0.99$ and classify everything as the majority class, because $\widehat{q}\geq\theta$. Accuracy is high, but we have no incentive to improve our $\widehat{q}$ to the correct value of $\eta$.
Or we might have done an extensive analysis of the asymmetric costs of misclassification and decided that the best classification probability threshold should actually be $\theta =0.2$. For instance, this could happen if $y=1$ means that you suffer from some disease. It might be better to treat you even if you don't suffer from the disease ($y=0$), rather than the other way around, so it might make sense to treat people even if there is a low predicted probability (small $\widehat{q}$) they suffer from it. We might then have a horrendously wrong model that believes that the true majority class only occurs with $\widehat{q}=0.25$ - but because of the costs of misclassification, we still classify everything as this (assumed) minority class, because again $\widehat{q}\geq\theta$. If we did this, accuracy or misclassification loss would make us believe we are doing everything right, even if our predictive model does not even get which one of our two classes is the majority one.
Therefore, accuracy or misclassification loss can be misleading.
In addition, accuracy and misclassification loss are improper under the additional assumptions in more complex situations where the outcomes are not iid. Frank Harrell, in his blog post Damage Caused by Classification Accuracy and Other Discontinuous Improper Accuracy Scoring Rules cites an example from one of his books where using accuracy or misclassification loss will lead to a misspecified model, since they are not optimized by the correct conditional predictive probability.
Another problem with accuracy and misclassification loss is that they are discontinuous as a function of the threshold $\theta$. Frank Harrell goes into this, too.
More information can be found at Why is accuracy not the best measure for assessing classification models?.
The bottom line
Don't use accuracy. Nor misclassification loss.
The nitpick: "strict" vs. "strictly"
Should we be talking about "strict" proper scoring rules, or about "strictly" proper scoring rules? "Strict" modifies "proper", not "scoring rule". (There are "proper scoring rules" and "strictly proper scoring rules", but no "strict scoring rules".) As such, "strictly" should be an adverb, not an adjective, and "strictly" should be used. As is more common in the literature, e.g., the papers by Tilmann Gneiting.
|
Is accuracy an improper scoring rule in a binary classification setting?
|
TL;DR
Accuracy is an improper scoring rule. Don't use it.
The slightly longer version
Actually, accuracy is not even a scoring rule. So asking whether it is (strictly) proper is a category error. The
|
Is accuracy an improper scoring rule in a binary classification setting?
TL;DR
Accuracy is an improper scoring rule. Don't use it.
The slightly longer version
Actually, accuracy is not even a scoring rule. So asking whether it is (strictly) proper is a category error. The most we can say is that under additional assumptions, accuracy is consistent with a scoring rule that is improper, discontinuous and misleading. (Don't use it.)
Your confusion
Your confusion stems from the fact that misclassification loss as per the paper you cite is not a scoring rule, either.
The details: scoring rules vs. classification evaluations
Let us fix terminology. We are interested in a binary outcome $y\in\{0,1\}$, and we have a probabilistic prediction $\widehat{q} = \widehat{P}(Y=1)\in(0,1)$. We know that $P(Y=1)=\eta>0.5$, but our model $\widehat{q}$ may or may not know that.
A scoring rule is a mapping that takes a probabilistic prediction $\widehat{q}$ and an outcome $y$ to a loss,
$$ s\colon (\widehat{q},y) \mapsto s(\widehat{q},y). $$
$s$ is proper if it is optimized in expectation by $\widehat{q}=\eta$. ("Optimized" usually means "minimized", but some authors flip signs and try to maximize a scoring rule.) $s$ is strictly proper if it is optimized in expectation only by $\widehat{q}=\eta$.
We will typically evaluate $s$ on many predictions $\widehat{q}_i$ and corresponding outcomes $y_i$ and average to estimate this expectation.
Now, what is accuracy? Accuracy does not take a probabilistic prediction as an argument. It takes a classification $\widehat{y}\in\{0,1\}$ and an outcome:
$$ a\colon (\widehat{y},y)\mapsto a(\widehat{y},y) =
\begin{cases} 1, & \widehat{y}=y \\ 0, & \widehat{y} \neq y. \end{cases} $$
Therefore, accuracy is not a scoring rule. It is a classification evaluation. (This is a term I just invented; don't go looking for it in the literature.)
Now, of course we can take a probabilistic prediction like our $\widehat{q}$ and turn it into a classification $\widehat{y}$. But to do so, we will need the additional assumptions alluded to above. For instance, it is very common to use a threshold $\theta$ and classify:
$$ \widehat{y}(\widehat{q},\theta) :=
\begin{cases} 1, & \widehat{q}\geq \theta \\ 0, & \widehat{q}<\theta. \end{cases} $$
A very common threshold value is $\theta=0.5$. Note that if we use this threshold and then evaluate the accuracy over many predictions $\widehat{q}_i$ (as above) and corresponding outcomes $y_i$, then we arrive exactly at the misclassification loss as per Buja et al. Thus, misclassification loss is also not a scoring rule, but a classification evaluation.
If we take a classification algorithm like the one above, we can turn a classification evaluation into a scoring rule. The point is that we need the additional assumptions of the classifier. And that accuracy or misclassification loss or whatever other classification evaluation we choose may then depend less on the probabilistic prediction $\widehat{q}$ and more on the way we turn $\widehat{q}$ into a classification $\widehat{y}=\widehat{y}(\widehat{q},\theta)$. So optimizing the classification evaluation may be chasing after a red herring if we are really interested in evaluating $\widehat{q}$.
Now, what is improper about these scoring-rules-under-additional-assumptions? Nothing, in the present case. $\widehat{q}=\eta$, under the implicit $\theta =0.5$, will maximize accuracy and minimize misclassification loss over all possible $\widehat{q}\in(0,1)$. So in this case, our scoring-rule-under-additional-assumptions is proper.
Note that what is important for accuracy or misclassification loss is only one question: do we classify ($\widehat{y}$) everything as the majority class or not? If we do so, accuracy or misclassification loss are happy. If not, they aren't. What is important about this question is that it has only a very tenuous connection to the quality of $\widehat{q}$.
Consequently, our scoring-rules-under-additional-assumptions are not strictly proper, as any $\widehat{q}\geq\theta$ will lead to the same classification evaluation. We might use the standard $\theta=0.5$, believe that the majority class occurs with $\widehat{q}=0.99$ and classify everything as the majority class, because $\widehat{q}\geq\theta$. Accuracy is high, but we have no incentive to improve our $\widehat{q}$ to the correct value of $\eta$.
Or we might have done an extensive analysis of the asymmetric costs of misclassification and decided that the best classification probability threshold should actually be $\theta =0.2$. For instance, this could happen if $y=1$ means that you suffer from some disease. It might be better to treat you even if you don't suffer from the disease ($y=0$), rather than the other way around, so it might make sense to treat people even if there is a low predicted probability (small $\widehat{q}$) they suffer from it. We might then have a horrendously wrong model that believes that the true majority class only occurs with $\widehat{q}=0.25$ - but because of the costs of misclassification, we still classify everything as this (assumed) minority class, because again $\widehat{q}\geq\theta$. If we did this, accuracy or misclassification loss would make us believe we are doing everything right, even if our predictive model does not even get which one of our two classes is the majority one.
Therefore, accuracy or misclassification loss can be misleading.
In addition, accuracy and misclassification loss are improper under the additional assumptions in more complex situations where the outcomes are not iid. Frank Harrell, in his blog post Damage Caused by Classification Accuracy and Other Discontinuous Improper Accuracy Scoring Rules cites an example from one of his books where using accuracy or misclassification loss will lead to a misspecified model, since they are not optimized by the correct conditional predictive probability.
Another problem with accuracy and misclassification loss is that they are discontinuous as a function of the threshold $\theta$. Frank Harrell goes into this, too.
More information can be found at Why is accuracy not the best measure for assessing classification models?.
The bottom line
Don't use accuracy. Nor misclassification loss.
The nitpick: "strict" vs. "strictly"
Should we be talking about "strict" proper scoring rules, or about "strictly" proper scoring rules? "Strict" modifies "proper", not "scoring rule". (There are "proper scoring rules" and "strictly proper scoring rules", but no "strict scoring rules".) As such, "strictly" should be an adverb, not an adjective, and "strictly" should be used. As is more common in the literature, e.g., the papers by Tilmann Gneiting.
|
Is accuracy an improper scoring rule in a binary classification setting?
TL;DR
Accuracy is an improper scoring rule. Don't use it.
The slightly longer version
Actually, accuracy is not even a scoring rule. So asking whether it is (strictly) proper is a category error. The
|
10,431
|
Bayesian batting average prior
|
Notice that:
\begin{equation}
\frac{\alpha\cdot\beta}{(\alpha+\beta)^2}=(\frac{\alpha}{\alpha+\beta})\cdot(1-\frac{\alpha}{\alpha+\beta})
\end{equation}
This means the variance can therefore be expressed in terms of the mean as
\begin{equation}
\sigma^2=\frac{\mu\cdot(1-\mu)}{\alpha+\beta+1} \\
\end{equation}
If you want a mean of $.27$ and a standard deviation of $.18$ (variance $.0324$), just calculate:
\begin{equation}
\alpha+\beta=\frac{\mu(1-\mu)}{\sigma^2}-1=\frac{.27\cdot(1-.27)}{.0324}-1=5.083333 \\
\end{equation}
Now that you know the total, $\alpha$ and $\beta$ are easy:
\begin{equation}
\alpha=\mu(\alpha+\beta)=.27 \cdot 5.083333=1.372499 \\
\beta=(1-\mu)(\alpha+\beta)=(1-.27) \cdot 5.083333=3.710831
\end{equation}
You can check this answer in R:
> mean(rbeta(10000000, 1.372499, 3.710831))
[1] 0.2700334
> var(rbeta(10000000, 1.372499, 3.710831))
[1] 0.03241907
|
Bayesian batting average prior
|
Notice that:
\begin{equation}
\frac{\alpha\cdot\beta}{(\alpha+\beta)^2}=(\frac{\alpha}{\alpha+\beta})\cdot(1-\frac{\alpha}{\alpha+\beta})
\end{equation}
This means the variance can therefore be expres
|
Bayesian batting average prior
Notice that:
\begin{equation}
\frac{\alpha\cdot\beta}{(\alpha+\beta)^2}=(\frac{\alpha}{\alpha+\beta})\cdot(1-\frac{\alpha}{\alpha+\beta})
\end{equation}
This means the variance can therefore be expressed in terms of the mean as
\begin{equation}
\sigma^2=\frac{\mu\cdot(1-\mu)}{\alpha+\beta+1} \\
\end{equation}
If you want a mean of $.27$ and a standard deviation of $.18$ (variance $.0324$), just calculate:
\begin{equation}
\alpha+\beta=\frac{\mu(1-\mu)}{\sigma^2}-1=\frac{.27\cdot(1-.27)}{.0324}-1=5.083333 \\
\end{equation}
Now that you know the total, $\alpha$ and $\beta$ are easy:
\begin{equation}
\alpha=\mu(\alpha+\beta)=.27 \cdot 5.083333=1.372499 \\
\beta=(1-\mu)(\alpha+\beta)=(1-.27) \cdot 5.083333=3.710831
\end{equation}
You can check this answer in R:
> mean(rbeta(10000000, 1.372499, 3.710831))
[1] 0.2700334
> var(rbeta(10000000, 1.372499, 3.710831))
[1] 0.03241907
|
Bayesian batting average prior
Notice that:
\begin{equation}
\frac{\alpha\cdot\beta}{(\alpha+\beta)^2}=(\frac{\alpha}{\alpha+\beta})\cdot(1-\frac{\alpha}{\alpha+\beta})
\end{equation}
This means the variance can therefore be expres
|
10,432
|
Bayesian batting average prior
|
I wanted to add this as a comment on the excellent answer but it ran long and will look better with answer formatting.
Something to keep in mind is that not all $(\mu, \sigma^2)$ are possible. It's clear $\mu \in [0,1]$, but not as clear are the limitations for $\sigma^2$.
Using the same reasoning as David, we can express
$$ \sigma^2(\alpha, \mu) = \frac{\mu^2 (1-\mu)}{\alpha + \mu} $$
This is decreasing with respect to $\alpha$, so the largest $\sigma^2$ can be for a given $\mu$ is:
$$\lim_{\alpha \rightarrow 0}\sigma^2(\alpha, \mu) = \mu(1-\mu)$$
This is only a supremum since the set of valid $\alpha$ is open (i.e., for Beta, we must have $\alpha > 0$); this limit is itself maximized at $\mu = \frac12$.
Notice the relationship to a corresponding Bernoulli RV. The Beta distribution with mean $\mu$, since it is forced to take all values between 0 and 1, must be less dispersed (i.e., have lower variance) than the Bernoulli RV with the same mean (which has all of its mass at the ends of the interval). In fact, sending $\alpha$ to 0 and fixing $\beta = \frac{1-\mu}{\mu} \alpha$ amounts to putting more and more of the mass of the PDF close to 0 and 1, i.e., getting closer to a Bernoulli distribution, which is why the supremum of the variance is exactly the corresponding Bernoulli variance.
Taken together, here is the set of valid means and variances for Beta:
(Indeed this is noted on the Wikipedia page for Beta)
|
Bayesian batting average prior
|
I wanted to add this as a comment on the excellent answer but it ran long and will look better with answer formatting.
Something to keep in mind is that not all $(\mu, \sigma^2)$ are possible. It's cl
|
Bayesian batting average prior
I wanted to add this as a comment on the excellent answer but it ran long and will look better with answer formatting.
Something to keep in mind is that not all $(\mu, \sigma^2)$ are possible. It's clear $\mu \in [0,1]$, but not as clear are the limitations for $\sigma^2$.
Using the same reasoning as David, we can express
$$ \sigma^2(\alpha, \mu) = \frac{\mu^2 (1-\mu)}{\alpha + \mu} $$
This is decreasing with respect to $\alpha$, so the largest $\sigma^2$ can be for a given $\mu$ is:
$$\lim_{\alpha \rightarrow 0}\sigma^2(\alpha, \mu) = \mu(1-\mu)$$
This is only a supremum since the set of valid $\alpha$ is open (i.e., for Beta, we must have $\alpha > 0$); this limit is itself maximized at $\mu = \frac12$.
Notice the relationship to a corresponding Bernoulli RV. The Beta distribution with mean $\mu$, since it is forced to take all values between 0 and 1, must be less dispersed (i.e., have lower variance) than the Bernoulli RV with the same mean (which has all of its mass at the ends of the interval). In fact, sending $\alpha$ to 0 and fixing $\beta = \frac{1-\mu}{\mu} \alpha$ amounts to putting more and more of the mass of the PDF close to 0 and 1, i.e., getting closer to a Bernoulli distribution, which is why the supremum of the variance is exactly the corresponding Bernoulli variance.
Taken together, here is the set of valid means and variances for Beta:
(Indeed this is noted on the Wikipedia page for Beta)
|
Bayesian batting average prior
I wanted to add this as a comment on the excellent answer but it ran long and will look better with answer formatting.
Something to keep in mind is that not all $(\mu, \sigma^2)$ are possible. It's cl
|
10,433
|
Reversing PCA back to the original variables [duplicate]
|
Yes. Basically, what you did was to do:
$$\mathrm{PC}=\mathbf{V}X,$$
where $\mathrm{PC}$ are the principal components, $X$ is your matrix with the data (centered, and with data points in columns) and $\mathbf{V}$ is the matrix with the loadings (the matrix with the eigenvectors of the sample covariance matrix of $X$). Therefore, you can do:
$$\mathbf{V}^{-1}\cdot\mathrm{PC}=X,$$
but, because the matrix of loadings is orthonormal (they are eigenvectors!), then $\mathbf{V}^{-1}=\mathbf{V}^{T}$, so:
$$\mathbf{V}^T\cdot\mathrm{PC}=X.$$
Note that this gives you exactly the same equation you cite for the recovery of the PCs, but now for the data, and you can retain as many PCS as you like.
|
Reversing PCA back to the original variables [duplicate]
|
Yes. Basically, what you did was to do:
$$\mathrm{PC}=\mathbf{V}X,$$
where $\mathrm{PC}$ are the principal components, $X$ is your matrix with the data (centered, and with data points in columns) and
|
Reversing PCA back to the original variables [duplicate]
Yes. Basically, what you did was to do:
$$\mathrm{PC}=\mathbf{V}X,$$
where $\mathrm{PC}$ are the principal components, $X$ is your matrix with the data (centered, and with data points in columns) and $\mathbf{V}$ is the matrix with the loadings (the matrix with the eigenvectors of the sample covariance matrix of $X$). Therefore, you can do:
$$\mathbf{V}^{-1}\cdot\mathrm{PC}=X,$$
but, because the matrix of loadings is orthonormal (they are eigenvectors!), then $\mathbf{V}^{-1}=\mathbf{V}^{T}$, so:
$$\mathbf{V}^T\cdot\mathrm{PC}=X.$$
Note that this gives you exactly the same equation you cite for the recovery of the PCs, but now for the data, and you can retain as many PCS as you like.
|
Reversing PCA back to the original variables [duplicate]
Yes. Basically, what you did was to do:
$$\mathrm{PC}=\mathbf{V}X,$$
where $\mathrm{PC}$ are the principal components, $X$ is your matrix with the data (centered, and with data points in columns) and
|
10,434
|
Reversing PCA back to the original variables [duplicate]
|
I have a doubt about the above answers. Since after dimension reduction, we only know 2 principal components, and the rest principal components are abandoned. The projection matrix V is not a square matrix (not completely orthonormal, it is a semi-orthogonal matrix). Suppose n is the number of samples and m is the number of variables. $X$ is a $m$-by-$n$ matrix, $V$ is a 2-by-m matrix (whose rows are the top 2 eigenvectors of the covariance matrix of $X$), PC is a 2-by-n matrix. Then we have PC = VX. Then $VV^T$ is an identity matrix, but $V^TV$ is not. Thus $V^TPC=V^TVX$ cannot give us the exact original matrix $X$, since $V^TV$ is not an identity matrix.
|
Reversing PCA back to the original variables [duplicate]
|
I have a doubt about the above answers. Since after dimension reduction, we only know 2 principal components, and the rest principal components are abandoned. The projection matrix V is not a square m
|
Reversing PCA back to the original variables [duplicate]
I have a doubt about the above answers. Since after dimension reduction, we only know 2 principal components, and the rest principal components are abandoned. The projection matrix V is not a square matrix (not completely orthonormal, it is a semi-orthogonal matrix). Suppose n is the number of samples and m is the number of variables. $X$ is a $m$-by-$n$ matrix, $V$ is a 2-by-m matrix (whose rows are the top 2 eigenvectors of the covariance matrix of $X$), PC is a 2-by-n matrix. Then we have PC = VX. Then $VV^T$ is an identity matrix, but $V^TV$ is not. Thus $V^TPC=V^TVX$ cannot give us the exact original matrix $X$, since $V^TV$ is not an identity matrix.
|
Reversing PCA back to the original variables [duplicate]
I have a doubt about the above answers. Since after dimension reduction, we only know 2 principal components, and the rest principal components are abandoned. The projection matrix V is not a square m
|
10,435
|
Converting standard error to standard deviation?
|
Standard error refers to the standard deviation of the sampling distribution of a statistic. Whether or not that formula is appropriate depends on what statistic we are talking about.
The standard deviation of the sample mean is $\sigma/\sqrt{n}$ where $\sigma$ is the (population) standard deviation of the data and $n$ is the sample size - this may be what you're referring to. So, if it is the standard error of the sample mean you're referring to then, yes, that formula is appropriate.
In general, the standard deviation of a statistic is not given by the formula you gave. The relationship between the standard deviation of a statistic and the standard deviation of the data depends on what statistic we're talking about. For example, the standard error of the sample standard deviation (more info here) from a normally distributed sample of size $n$ is $$ \sigma \cdot \frac{\Gamma( \frac{n-1}{2} )}{ \Gamma(n/2) } \cdot \sqrt{\frac{n-1}{2} - \left( \frac{ \Gamma(n/2) }{ \Gamma( \frac{n-1}{2} ) } \right)^2 } $$ In other situations there may be no relationship at all between the standard error and the population standard deviation. For example, if $X_1, ..., X_n \sim N(0,\sigma^2)$, then number of observations which exceed $0$ is ${\rm Binomial}(n,1/2)$ so its standard error is $\sqrt{n/4}$, regardless of $\sigma$.
|
Converting standard error to standard deviation?
|
Standard error refers to the standard deviation of the sampling distribution of a statistic. Whether or not that formula is appropriate depends on what statistic we are talking about.
The standard de
|
Converting standard error to standard deviation?
Standard error refers to the standard deviation of the sampling distribution of a statistic. Whether or not that formula is appropriate depends on what statistic we are talking about.
The standard deviation of the sample mean is $\sigma/\sqrt{n}$ where $\sigma$ is the (population) standard deviation of the data and $n$ is the sample size - this may be what you're referring to. So, if it is the standard error of the sample mean you're referring to then, yes, that formula is appropriate.
In general, the standard deviation of a statistic is not given by the formula you gave. The relationship between the standard deviation of a statistic and the standard deviation of the data depends on what statistic we're talking about. For example, the standard error of the sample standard deviation (more info here) from a normally distributed sample of size $n$ is $$ \sigma \cdot \frac{\Gamma( \frac{n-1}{2} )}{ \Gamma(n/2) } \cdot \sqrt{\frac{n-1}{2} - \left( \frac{ \Gamma(n/2) }{ \Gamma( \frac{n-1}{2} ) } \right)^2 } $$ In other situations there may be no relationship at all between the standard error and the population standard deviation. For example, if $X_1, ..., X_n \sim N(0,\sigma^2)$, then number of observations which exceed $0$ is ${\rm Binomial}(n,1/2)$ so its standard error is $\sqrt{n/4}$, regardless of $\sigma$.
|
Converting standard error to standard deviation?
Standard error refers to the standard deviation of the sampling distribution of a statistic. Whether or not that formula is appropriate depends on what statistic we are talking about.
The standard de
|
10,436
|
How does entropy depend on location and scale?
|
Since the probability element of $X$ is $f(x)\mathrm{d}x,$ the change of variable $y = x\sigma + \mu$ is equivalent to $x = (y-\mu)/\sigma,$ whence from
$$f(x)\mathrm{d}x = f\left(\frac{y-\mu}{\sigma}\right)\mathrm{d}\left(\frac{y-\mu}{\color{red}\sigma}\right) = \frac{1}{\color{red}\sigma} f\left(\frac{y-\mu}{\sigma}\right) \mathrm{d}y$$
it follows that the density of $Y$ is
$$f_Y(y) = \frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right).$$
(Keep an eye on that $1/\color{red}\sigma$ factor in the subsequent derivation--and remember it appears here because $y$ is a uniformly rescaled version of $x;$ that is, $\mathrm d x = \mathrm d y / \color{red}\sigma.$)
According to the definition, the (differential) entropy of $Y$ is
$$H(Y) = -\int_{-\infty}^{\infty} \log\left(\frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right)\right) \frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right) \mathrm{d}y.$$
Upon changing the variable back to $x = (y-\mu)/\sigma$ this becomes
$$\eqalign{
H(Y) &= -\int_{-\infty}^{\infty} \log\left(\frac{1}{\color{red}\sigma}f\left(x\right)\right) f\left(x\right) \mathrm{d}x \\
&= -\int_{-\infty}^{\infty} \left(\log\left(\frac{1}{\color{red}\sigma}\right) + \log\left(f\left(x\right)\right)\right) f\left(x\right) \mathrm{d}x \\
&= \log\left(\color{red}\sigma\right) \int_{-\infty}^{\infty} f(x) \mathrm{d}x -\int_{-\infty}^{\infty} \log\left(f\left(x\right)\right) f\left(x\right) \mathrm{d}x \\
&= \log(\color{red}\sigma) + H_f.
}$$
These calculations used basic properties of the logarithm, the linearity of integration, and the fact that $f(x)\mathrm{d}x$ integrates to unity (the Law of Total Probability).
The conclusion is
The (differential) entropy of $Y = X\sigma + \mu$ is the entropy of $X$ plus $\log(\sigma).$
In words, shifting a random variable does not change its entropy (we may think of the entropy as depending on the values of the probability density, but not on where those values occur), while scaling a continuous variable (which, for $\sigma \ge 1$ "stretches" or "smears" it out) increases its entropy by $\log(\sigma).$ This supports the intuition that high-entropy distributions are "more spread out" than low-entropy distributions.
As a consequence of this result, we are free to choose convenient values of $\mu$ and $\sigma$ when computing the entropy of any distribution. For example, the entropy of a Normal$(\mu,\sigma)$ distribution can be found by setting $\mu=0$ and $\sigma=1.$ The logarithm of the density in this case is
$$\log(f(x)) = -\frac{1}{2}\log(2\pi) - x^2/2,$$
whence
$$H = -E\left[-\frac{1}{2}\log(2\pi) - X^2/2\right] = \frac{1}{2}\log(2\pi) + \frac{1}{2}.$$
Consequently the entropy of a Normal$(\mu,\sigma)$ distribution is obtained simply by adding $\log\sigma$ to this result, giving
$$H = \frac{1}{2}\log(2\pi) + \frac{1}{2} + \log(\sigma) = \frac{1}{2}\log\left(2\pi\,e\,\sigma^2\right)$$
as reported by Wikipedia.
|
How does entropy depend on location and scale?
|
Since the probability element of $X$ is $f(x)\mathrm{d}x,$ the change of variable $y = x\sigma + \mu$ is equivalent to $x = (y-\mu)/\sigma,$ whence from
$$f(x)\mathrm{d}x = f\left(\frac{y-\mu}{\sigma}
|
How does entropy depend on location and scale?
Since the probability element of $X$ is $f(x)\mathrm{d}x,$ the change of variable $y = x\sigma + \mu$ is equivalent to $x = (y-\mu)/\sigma,$ whence from
$$f(x)\mathrm{d}x = f\left(\frac{y-\mu}{\sigma}\right)\mathrm{d}\left(\frac{y-\mu}{\color{red}\sigma}\right) = \frac{1}{\color{red}\sigma} f\left(\frac{y-\mu}{\sigma}\right) \mathrm{d}y$$
it follows that the density of $Y$ is
$$f_Y(y) = \frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right).$$
(Keep an eye on that $1/\color{red}\sigma$ factor in the subsequent derivation--and remember it appears here because $y$ is a uniformly rescaled version of $x;$ that is, $\mathrm d x = \mathrm d y / \color{red}\sigma.$)
According to the definition, the (differential) entropy of $Y$ is
$$H(Y) = -\int_{-\infty}^{\infty} \log\left(\frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right)\right) \frac{1}{\color{red}\sigma}f\left(\frac{y-\mu}{\sigma}\right) \mathrm{d}y.$$
Upon changing the variable back to $x = (y-\mu)/\sigma$ this becomes
$$\eqalign{
H(Y) &= -\int_{-\infty}^{\infty} \log\left(\frac{1}{\color{red}\sigma}f\left(x\right)\right) f\left(x\right) \mathrm{d}x \\
&= -\int_{-\infty}^{\infty} \left(\log\left(\frac{1}{\color{red}\sigma}\right) + \log\left(f\left(x\right)\right)\right) f\left(x\right) \mathrm{d}x \\
&= \log\left(\color{red}\sigma\right) \int_{-\infty}^{\infty} f(x) \mathrm{d}x -\int_{-\infty}^{\infty} \log\left(f\left(x\right)\right) f\left(x\right) \mathrm{d}x \\
&= \log(\color{red}\sigma) + H_f.
}$$
These calculations used basic properties of the logarithm, the linearity of integration, and the fact that $f(x)\mathrm{d}x$ integrates to unity (the Law of Total Probability).
The conclusion is
The (differential) entropy of $Y = X\sigma + \mu$ is the entropy of $X$ plus $\log(\sigma).$
In words, shifting a random variable does not change its entropy (we may think of the entropy as depending on the values of the probability density, but not on where those values occur), while scaling a continuous variable (which, for $\sigma \ge 1$ "stretches" or "smears" it out) increases its entropy by $\log(\sigma).$ This supports the intuition that high-entropy distributions are "more spread out" than low-entropy distributions.
As a consequence of this result, we are free to choose convenient values of $\mu$ and $\sigma$ when computing the entropy of any distribution. For example, the entropy of a Normal$(\mu,\sigma)$ distribution can be found by setting $\mu=0$ and $\sigma=1.$ The logarithm of the density in this case is
$$\log(f(x)) = -\frac{1}{2}\log(2\pi) - x^2/2,$$
whence
$$H = -E\left[-\frac{1}{2}\log(2\pi) - X^2/2\right] = \frac{1}{2}\log(2\pi) + \frac{1}{2}.$$
Consequently the entropy of a Normal$(\mu,\sigma)$ distribution is obtained simply by adding $\log\sigma$ to this result, giving
$$H = \frac{1}{2}\log(2\pi) + \frac{1}{2} + \log(\sigma) = \frac{1}{2}\log\left(2\pi\,e\,\sigma^2\right)$$
as reported by Wikipedia.
|
How does entropy depend on location and scale?
Since the probability element of $X$ is $f(x)\mathrm{d}x,$ the change of variable $y = x\sigma + \mu$ is equivalent to $x = (y-\mu)/\sigma,$ whence from
$$f(x)\mathrm{d}x = f\left(\frac{y-\mu}{\sigma}
|
10,437
|
Why does a decision tree have low bias & high variance?
|
A bit late to the party but i feel that this question could use answer with concrete examples.
I will write summary of this excellent article: bias-variance-trade-off, which helped me understand the topic.
The prediction error for any machine learning algorithm can be broken down into three parts:
Bias Error
Variance Error
Irreducible Error
Irreducible error
As the name implies, is an error component that we cannot correct, regardless of algorithm and it's parameter selection. Irreducible error is due to complexities which are simply not captured in the training set. This could be attributes which we don't have in a learning set but they affect the mapping to outcome regardless.
Bias error
Bias error is due to our assumptions about target function. The more assumptions(restrictions) we make about target functions, the more bias we introduce. Models with high bias are less flexible because we have imposed more rules on the target functions.
Variance error
Variance error is variability of a target function's form with respect to different training sets. Models with small variance error will not change much if you replace couple of samples in training set. Models with high variance might be affected even with small changes in training set.
Consider simple linear regression:
Y=b0+b1x
Obviously, this is a fairly restrictive definition of a target function and therefore this model has a high bias.
On the other hand, due to low variance if you change couple of data samples, it's unlikely that this will cause major changes in the overall mapping the target function performs. On the other hand, algorithm such as k-nearest-neighbors have high variance and low bias. It's easy to imagine how different samples might affect K-N-N decision surface.
Generally, parametric algorithms have a high bias and low variance, and vice versa.
One of the challenges of machine learning is finding the right balance of bias error and variance error.
Decision tree
Now that we have these definitions in place, it's also straightforward to see that decision trees are example of model with low bias and high variance. The tree makes almost no assumptions about target function but it is highly susceptible to variance in data.
There are ensemble algorithms, such as bootstrapping aggregation and random forest, which aim to reduce variance at the small cost of bias in decision tree.
|
Why does a decision tree have low bias & high variance?
|
A bit late to the party but i feel that this question could use answer with concrete examples.
I will write summary of this excellent article: bias-variance-trade-off, which helped me understand the
|
Why does a decision tree have low bias & high variance?
A bit late to the party but i feel that this question could use answer with concrete examples.
I will write summary of this excellent article: bias-variance-trade-off, which helped me understand the topic.
The prediction error for any machine learning algorithm can be broken down into three parts:
Bias Error
Variance Error
Irreducible Error
Irreducible error
As the name implies, is an error component that we cannot correct, regardless of algorithm and it's parameter selection. Irreducible error is due to complexities which are simply not captured in the training set. This could be attributes which we don't have in a learning set but they affect the mapping to outcome regardless.
Bias error
Bias error is due to our assumptions about target function. The more assumptions(restrictions) we make about target functions, the more bias we introduce. Models with high bias are less flexible because we have imposed more rules on the target functions.
Variance error
Variance error is variability of a target function's form with respect to different training sets. Models with small variance error will not change much if you replace couple of samples in training set. Models with high variance might be affected even with small changes in training set.
Consider simple linear regression:
Y=b0+b1x
Obviously, this is a fairly restrictive definition of a target function and therefore this model has a high bias.
On the other hand, due to low variance if you change couple of data samples, it's unlikely that this will cause major changes in the overall mapping the target function performs. On the other hand, algorithm such as k-nearest-neighbors have high variance and low bias. It's easy to imagine how different samples might affect K-N-N decision surface.
Generally, parametric algorithms have a high bias and low variance, and vice versa.
One of the challenges of machine learning is finding the right balance of bias error and variance error.
Decision tree
Now that we have these definitions in place, it's also straightforward to see that decision trees are example of model with low bias and high variance. The tree makes almost no assumptions about target function but it is highly susceptible to variance in data.
There are ensemble algorithms, such as bootstrapping aggregation and random forest, which aim to reduce variance at the small cost of bias in decision tree.
|
Why does a decision tree have low bias & high variance?
A bit late to the party but i feel that this question could use answer with concrete examples.
I will write summary of this excellent article: bias-variance-trade-off, which helped me understand the
|
10,438
|
Why does a decision tree have low bias & high variance?
|
If the number of levels is too high i.e a complicated decision tree, the model tends to overfit.
Intuitively, it can be understood in this way. When there are too many decision nodes to go through before arriving at the result i.e number of nodes to traverse before reaching the leaf nodes is high, the conditions that you are checking against becomes multiplicative. That is, the computation becomes
(condition 1)&&(condition 2)&&(condition 3)&&(condition 4)&&(condition5).
Only if all the conditions are satisfied, a decision is reached. As you can see, this will work very well for the training set as you are continuously narrowing down on the data. The tree becomes highly tuned to the data present in the training set.
But when a new data point is fed, even if one of the parameters deviates slightly, the condition will not be met and it will take the wrong branch.
|
Why does a decision tree have low bias & high variance?
|
If the number of levels is too high i.e a complicated decision tree, the model tends to overfit.
Intuitively, it can be understood in this way. When there are too many decision nodes to go through bef
|
Why does a decision tree have low bias & high variance?
If the number of levels is too high i.e a complicated decision tree, the model tends to overfit.
Intuitively, it can be understood in this way. When there are too many decision nodes to go through before arriving at the result i.e number of nodes to traverse before reaching the leaf nodes is high, the conditions that you are checking against becomes multiplicative. That is, the computation becomes
(condition 1)&&(condition 2)&&(condition 3)&&(condition 4)&&(condition5).
Only if all the conditions are satisfied, a decision is reached. As you can see, this will work very well for the training set as you are continuously narrowing down on the data. The tree becomes highly tuned to the data present in the training set.
But when a new data point is fed, even if one of the parameters deviates slightly, the condition will not be met and it will take the wrong branch.
|
Why does a decision tree have low bias & high variance?
If the number of levels is too high i.e a complicated decision tree, the model tends to overfit.
Intuitively, it can be understood in this way. When there are too many decision nodes to go through bef
|
10,439
|
Why does a decision tree have low bias & high variance?
|
Why does a decision tree have low bias & high variance? Does it depend
on whether the tree is shallow or deep? Or can we say this
irrespective of the depth/levels of the tree? Why is bias low & variance high? Please explain intuitively and mathematically.
Bias vs Variance
More Bias = error from the model being more simpler (does not fit the data very well)
More Variance = error from the model being more complex (fits the data too well, and learns the noise in addition to the inherent patterns in the data)
Everything is relative
I want to start by saying that everything is relative. Decision Tree in general has low bias and high variance that let's say random forests. Similarly, a shallower tree would have higher bias and lower variance that the same tree with higher depth.
Comparing variance of decision trees and random forests
Now with that ironed out, let's think why decision trees would be worse in variance (higher variance and lower bias) than let's say random forests. The way a decision tree algorithm works is that the data is split again and again as we go down in the tree, so the actual predictions would be made by fewer and fewer data points. Compared to that, random forests aggregate the decisions of multiple trees, and that too, less-correlated trees through randomization, hence the model generalizes better (=> performs more reliably across different datasets = lower variance). Similarly, we are making more simplifying assumptions on random forests to consult only a subset of data and features to fit a single tree, hence higher bias. BTW, similary, a tree with lower height = less reliant on fewer data points generalizes better and and has less variance compared to a deep tree.
|
Why does a decision tree have low bias & high variance?
|
Why does a decision tree have low bias & high variance? Does it depend
on whether the tree is shallow or deep? Or can we say this
irrespective of the depth/levels of the tree? Why is bias low & va
|
Why does a decision tree have low bias & high variance?
Why does a decision tree have low bias & high variance? Does it depend
on whether the tree is shallow or deep? Or can we say this
irrespective of the depth/levels of the tree? Why is bias low & variance high? Please explain intuitively and mathematically.
Bias vs Variance
More Bias = error from the model being more simpler (does not fit the data very well)
More Variance = error from the model being more complex (fits the data too well, and learns the noise in addition to the inherent patterns in the data)
Everything is relative
I want to start by saying that everything is relative. Decision Tree in general has low bias and high variance that let's say random forests. Similarly, a shallower tree would have higher bias and lower variance that the same tree with higher depth.
Comparing variance of decision trees and random forests
Now with that ironed out, let's think why decision trees would be worse in variance (higher variance and lower bias) than let's say random forests. The way a decision tree algorithm works is that the data is split again and again as we go down in the tree, so the actual predictions would be made by fewer and fewer data points. Compared to that, random forests aggregate the decisions of multiple trees, and that too, less-correlated trees through randomization, hence the model generalizes better (=> performs more reliably across different datasets = lower variance). Similarly, we are making more simplifying assumptions on random forests to consult only a subset of data and features to fit a single tree, hence higher bias. BTW, similary, a tree with lower height = less reliant on fewer data points generalizes better and and has less variance compared to a deep tree.
|
Why does a decision tree have low bias & high variance?
Why does a decision tree have low bias & high variance? Does it depend
on whether the tree is shallow or deep? Or can we say this
irrespective of the depth/levels of the tree? Why is bias low & va
|
10,440
|
Why does a decision tree have low bias & high variance?
|
A complicated decision tree (e.g. deep) has low bias and high variance. The bias-variance tradeoff does depend on the depth of the tree.
Decision tree is sensitive to where it splits and how it splits. Therefore, even small changes in input variable values might result in very different tree structure.
|
Why does a decision tree have low bias & high variance?
|
A complicated decision tree (e.g. deep) has low bias and high variance. The bias-variance tradeoff does depend on the depth of the tree.
Decision tree is sensitive to where it splits and how it splits
|
Why does a decision tree have low bias & high variance?
A complicated decision tree (e.g. deep) has low bias and high variance. The bias-variance tradeoff does depend on the depth of the tree.
Decision tree is sensitive to where it splits and how it splits. Therefore, even small changes in input variable values might result in very different tree structure.
|
Why does a decision tree have low bias & high variance?
A complicated decision tree (e.g. deep) has low bias and high variance. The bias-variance tradeoff does depend on the depth of the tree.
Decision tree is sensitive to where it splits and how it splits
|
10,441
|
Why does a decision tree have low bias & high variance?
|
Context: decision tree has low bias & high variance
Q. Does it depend on whether the tree is shallow or deep?
A. If the tree is shallow then we're not checking a lot of conditions/constrains ie the logic is simple or less complex, hence it automatically reduces over-fitting. This introduces more bias compared to deeper trees where we overfit the data. It can be imagined as we're deliberately not calculating more conditions means we're making some assumption (introduces bias) while creating the tree.
Q. Or can we say this irrespective of the depth/levels of the tree?
A. It can be thought of as more the depth means lesser the bias as we're relying on data more rather than assumptions.
Q. Why is bias low & variance high?
A. This has already been answered well in other answers.
|
Why does a decision tree have low bias & high variance?
|
Context: decision tree has low bias & high variance
Q. Does it depend on whether the tree is shallow or deep?
A. If the tree is shallow then we're not checking a lot of conditions/constrains ie the l
|
Why does a decision tree have low bias & high variance?
Context: decision tree has low bias & high variance
Q. Does it depend on whether the tree is shallow or deep?
A. If the tree is shallow then we're not checking a lot of conditions/constrains ie the logic is simple or less complex, hence it automatically reduces over-fitting. This introduces more bias compared to deeper trees where we overfit the data. It can be imagined as we're deliberately not calculating more conditions means we're making some assumption (introduces bias) while creating the tree.
Q. Or can we say this irrespective of the depth/levels of the tree?
A. It can be thought of as more the depth means lesser the bias as we're relying on data more rather than assumptions.
Q. Why is bias low & variance high?
A. This has already been answered well in other answers.
|
Why does a decision tree have low bias & high variance?
Context: decision tree has low bias & high variance
Q. Does it depend on whether the tree is shallow or deep?
A. If the tree is shallow then we're not checking a lot of conditions/constrains ie the l
|
10,442
|
Expected value and variance of log(a)
|
If we consider "approximation" in a fairly general sense we can get somewhere.
We have to assume not that we have an actual normal distribution but something that's approximately normal except the density cannot be nonzero in a neighborhood of 0.
So let's say that $a$ is "approximately normal" (and concentrated near the mean*) in a sense that we can handwave away the concerns about $a$ coming near 0 (and its subsequent impact on the moments of $\log(a)$, because $a$ doesn't 'get down near 0'), but with the same low order moments as the specified normal distribution, then we could use Taylor series to approximate the moments of the transformed random variable.
For some transformation $g(X)$, this involves expanding $g(\mu_X + X-\mu_X)$ as a Taylor series (think $g(x+h)$ where $\mu_X$ is taking the role of '$x$' and $X-\mu_X$ takes the role of '$h$') and then taking expectations and then either computing the variance or the expectation of the square of the expansion (from which can be obtained the variance).
The resulting approximate expectation and variance are:
$\text{E}\left[g(X)\right]\approx g(\mu_X) +\frac{g''(\mu_X)}{2}\sigma_X^2$ and
$\text{Var}\left[g(X)\right]\approx \left(g'(\mu_X)\right)^2\sigma^2_X$
and so (if I didn't make any errors), when $g() = \log()$:
$$\text{E}\left[\log(a)\right]\approx log(\mu_a) -\frac{\sigma_a^2}{2\mu_a^2}$$
$$\text{Var}\left[\log(a)\right]\approx \sigma^2_a/\mu_a^2$$
* For this to be a good approximation you generally want the standard deviation of $a$ to be quite small compared to the mean (low coefficient of variation).
|
Expected value and variance of log(a)
|
If we consider "approximation" in a fairly general sense we can get somewhere.
We have to assume not that we have an actual normal distribution but something that's approximately normal except the den
|
Expected value and variance of log(a)
If we consider "approximation" in a fairly general sense we can get somewhere.
We have to assume not that we have an actual normal distribution but something that's approximately normal except the density cannot be nonzero in a neighborhood of 0.
So let's say that $a$ is "approximately normal" (and concentrated near the mean*) in a sense that we can handwave away the concerns about $a$ coming near 0 (and its subsequent impact on the moments of $\log(a)$, because $a$ doesn't 'get down near 0'), but with the same low order moments as the specified normal distribution, then we could use Taylor series to approximate the moments of the transformed random variable.
For some transformation $g(X)$, this involves expanding $g(\mu_X + X-\mu_X)$ as a Taylor series (think $g(x+h)$ where $\mu_X$ is taking the role of '$x$' and $X-\mu_X$ takes the role of '$h$') and then taking expectations and then either computing the variance or the expectation of the square of the expansion (from which can be obtained the variance).
The resulting approximate expectation and variance are:
$\text{E}\left[g(X)\right]\approx g(\mu_X) +\frac{g''(\mu_X)}{2}\sigma_X^2$ and
$\text{Var}\left[g(X)\right]\approx \left(g'(\mu_X)\right)^2\sigma^2_X$
and so (if I didn't make any errors), when $g() = \log()$:
$$\text{E}\left[\log(a)\right]\approx log(\mu_a) -\frac{\sigma_a^2}{2\mu_a^2}$$
$$\text{Var}\left[\log(a)\right]\approx \sigma^2_a/\mu_a^2$$
* For this to be a good approximation you generally want the standard deviation of $a$ to be quite small compared to the mean (low coefficient of variation).
|
Expected value and variance of log(a)
If we consider "approximation" in a fairly general sense we can get somewhere.
We have to assume not that we have an actual normal distribution but something that's approximately normal except the den
|
10,443
|
Keras, how does SGD learning rate decay work?
|
The documentation that you're referring to includes a reference to the Python source (just click on the [Source] link in the appropriate place), that can be used to answer your questions. Here's the most relevant line, showing how decay modifies the learning rate:
lr = self.lr * (1. / (1. + self.decay * self.iterations))
The nesterov option does not have to be set to True for momentum to be used; it results in momentum being used in a different way, as again can be seen from the source:
v = self.momentum * m - lr * g # velocity
if self.nesterov:
new_p = p + self.momentum * v - lr * g
else:
new_p = p + v
|
Keras, how does SGD learning rate decay work?
|
The documentation that you're referring to includes a reference to the Python source (just click on the [Source] link in the appropriate place), that can be used to answer your questions. Here's the m
|
Keras, how does SGD learning rate decay work?
The documentation that you're referring to includes a reference to the Python source (just click on the [Source] link in the appropriate place), that can be used to answer your questions. Here's the most relevant line, showing how decay modifies the learning rate:
lr = self.lr * (1. / (1. + self.decay * self.iterations))
The nesterov option does not have to be set to True for momentum to be used; it results in momentum being used in a different way, as again can be seen from the source:
v = self.momentum * m - lr * g # velocity
if self.nesterov:
new_p = p + self.momentum * v - lr * g
else:
new_p = p + v
|
Keras, how does SGD learning rate decay work?
The documentation that you're referring to includes a reference to the Python source (just click on the [Source] link in the appropriate place), that can be used to answer your questions. Here's the m
|
10,444
|
Why is the quasi-Poisson in GLM not treated as a special case of negative binomial?
|
The quasi-Poisson is not a full maximum likelihood (ML) model but a quasi-ML model. You just use the estimating function (or score function) from the Poisson model to estimate the coefficients, and then employ a certain variance function to obtain suitable standard errors (or rather a full covariance matrix) to perform inference. Hence, glm() does not supply and logLik() or AIC() here etc.
As you correctly point out, a model with the same expectation and variance function can be embedded into the negative binomial (NB) framework if the size parameter $\theta_i$ varies along with the expectation $\mu_i$. In the literature, this is typically called the NB1 parametrization. See for example the Cameron & Trivedi book (Regression Analysis of Count Data) or "Analysis of Microdata" by Winkelmann & Boes.
If there are no regressors (just an intercept) the NB1 parametrization and the NB2 parametrization employed by MASS's glm.nb() coincide. With regressors they differ. In the statistical literature the NB2 parametrization is more frequently used but some software packages also offer the NB1 version. For example in R, you can use the gamlss package to do gamlss(y ~ x, family = NBII). Note that somewhat confusingly gamlss uses NBI for the NB2 parametrization and NBII for NB1. (But jargon and terminology is not unified across all communities.)
Then you could ask, of course, why use quasi-Poisson if there is NB1 available? There is still a subtle difference: The former uses quasi-ML and obtains the estimate from the dispersion from the squared deviance (or Pearson) residuals. The latter uses full ML. In practice, the difference often isn't large but the motivations for using either model are slightly different.
|
Why is the quasi-Poisson in GLM not treated as a special case of negative binomial?
|
The quasi-Poisson is not a full maximum likelihood (ML) model but a quasi-ML model. You just use the estimating function (or score function) from the Poisson model to estimate the coefficients, and th
|
Why is the quasi-Poisson in GLM not treated as a special case of negative binomial?
The quasi-Poisson is not a full maximum likelihood (ML) model but a quasi-ML model. You just use the estimating function (or score function) from the Poisson model to estimate the coefficients, and then employ a certain variance function to obtain suitable standard errors (or rather a full covariance matrix) to perform inference. Hence, glm() does not supply and logLik() or AIC() here etc.
As you correctly point out, a model with the same expectation and variance function can be embedded into the negative binomial (NB) framework if the size parameter $\theta_i$ varies along with the expectation $\mu_i$. In the literature, this is typically called the NB1 parametrization. See for example the Cameron & Trivedi book (Regression Analysis of Count Data) or "Analysis of Microdata" by Winkelmann & Boes.
If there are no regressors (just an intercept) the NB1 parametrization and the NB2 parametrization employed by MASS's glm.nb() coincide. With regressors they differ. In the statistical literature the NB2 parametrization is more frequently used but some software packages also offer the NB1 version. For example in R, you can use the gamlss package to do gamlss(y ~ x, family = NBII). Note that somewhat confusingly gamlss uses NBI for the NB2 parametrization and NBII for NB1. (But jargon and terminology is not unified across all communities.)
Then you could ask, of course, why use quasi-Poisson if there is NB1 available? There is still a subtle difference: The former uses quasi-ML and obtains the estimate from the dispersion from the squared deviance (or Pearson) residuals. The latter uses full ML. In practice, the difference often isn't large but the motivations for using either model are slightly different.
|
Why is the quasi-Poisson in GLM not treated as a special case of negative binomial?
The quasi-Poisson is not a full maximum likelihood (ML) model but a quasi-ML model. You just use the estimating function (or score function) from the Poisson model to estimate the coefficients, and th
|
10,445
|
The order of variables in ANOVA matters, doesn't it?
|
This question evidently came from a study with an unbalanced two-way design, analyzed in R with the aov() function; this page provides a more recent and detailed example of this issue.
The general answer to this question, as to so many, is: "It depends." Here it depends on whether the design is balanced and, if not, which flavor of ANOVA is chosen.
First, it depends on whether the design is balanced. In the best of all possible worlds, with equal numbers of cases in all cells of a factorial design, there would be no difference due to the order of entering the factors into the model, regardless of how ANOVA is performed.* The cases at hand, evidently from a retrospective clinical cohort, seem to be from a real world where such balance was not found. So the order might matter.
Second, it depends on how the ANOVA is performed, which is a somewhat contentious issue. The types of ANOVA for unbalanced designs differ in the order of evaluating main effects and interactions. Evaluating interactions is fundamental to two-way and higher-order ANOVA, so there are disputes over the best way to proceed. See this Cross Validated page for one explanation and discussion. See the Details and the Warning for the Anova() (with a capital "A") function in the manual for the car package for a different view.
The order of factors does matter in unbalanced designs under the default aov() in R, which uses what are called type-I tests. These are sequential attributions of variance to factors in the order of entry into the model, as the present question envisioned. The order does not matter with the type-II or type-III tests provided by the Anova() function in the car package in R. These alternatives, however, have their own potential disadvantages noted in the above links.
Finally, consider the relation to multiple linear regression as with lm() in R, which is essentially the same type of model if you include interaction terms. The order of entry of variables in lm() does not matter in terms of regression coefficients and p-values reported by summary(lm()), in which a k-level categorical factor is coded as (k-1) binary dummy variables and a regression coefficient is reported for each dummy.
It is, however, possible to wrap the lm() output with anova() (lower-case "a," from the R stats package) or Anova() to summarize the influence of each factor over all of its levels, as one expects in classical ANOVA. Then the ordering of factors will matter with anova() as for aov(), and will not matter with Anova(). Similarly, the disputes over which type of ANOVA to use would return. So it's not safe to assume order-independence of factor entry with all downstream uses of lm() models.
*Having equal numbers of observations in all cells is sufficient but, as I understand it, not necessary for the order of factors to be irrelevant. Less demanding types of balance may allow for order-independence.
|
The order of variables in ANOVA matters, doesn't it?
|
This question evidently came from a study with an unbalanced two-way design, analyzed in R with the aov() function; this page provides a more recent and detailed example of this issue.
The general ans
|
The order of variables in ANOVA matters, doesn't it?
This question evidently came from a study with an unbalanced two-way design, analyzed in R with the aov() function; this page provides a more recent and detailed example of this issue.
The general answer to this question, as to so many, is: "It depends." Here it depends on whether the design is balanced and, if not, which flavor of ANOVA is chosen.
First, it depends on whether the design is balanced. In the best of all possible worlds, with equal numbers of cases in all cells of a factorial design, there would be no difference due to the order of entering the factors into the model, regardless of how ANOVA is performed.* The cases at hand, evidently from a retrospective clinical cohort, seem to be from a real world where such balance was not found. So the order might matter.
Second, it depends on how the ANOVA is performed, which is a somewhat contentious issue. The types of ANOVA for unbalanced designs differ in the order of evaluating main effects and interactions. Evaluating interactions is fundamental to two-way and higher-order ANOVA, so there are disputes over the best way to proceed. See this Cross Validated page for one explanation and discussion. See the Details and the Warning for the Anova() (with a capital "A") function in the manual for the car package for a different view.
The order of factors does matter in unbalanced designs under the default aov() in R, which uses what are called type-I tests. These are sequential attributions of variance to factors in the order of entry into the model, as the present question envisioned. The order does not matter with the type-II or type-III tests provided by the Anova() function in the car package in R. These alternatives, however, have their own potential disadvantages noted in the above links.
Finally, consider the relation to multiple linear regression as with lm() in R, which is essentially the same type of model if you include interaction terms. The order of entry of variables in lm() does not matter in terms of regression coefficients and p-values reported by summary(lm()), in which a k-level categorical factor is coded as (k-1) binary dummy variables and a regression coefficient is reported for each dummy.
It is, however, possible to wrap the lm() output with anova() (lower-case "a," from the R stats package) or Anova() to summarize the influence of each factor over all of its levels, as one expects in classical ANOVA. Then the ordering of factors will matter with anova() as for aov(), and will not matter with Anova(). Similarly, the disputes over which type of ANOVA to use would return. So it's not safe to assume order-independence of factor entry with all downstream uses of lm() models.
*Having equal numbers of observations in all cells is sufficient but, as I understand it, not necessary for the order of factors to be irrelevant. Less demanding types of balance may allow for order-independence.
|
The order of variables in ANOVA matters, doesn't it?
This question evidently came from a study with an unbalanced two-way design, analyzed in R with the aov() function; this page provides a more recent and detailed example of this issue.
The general ans
|
10,446
|
The order of variables in ANOVA matters, doesn't it?
|
The term hierarchical model refers to the structure between the factors. For example, a multi-center study is hierarchical: You have the patients nested within the hospitals treating them. Each hospital treats patients with placebo and verum, but recieving each of them in either hospital A or B is slightly different due to some common effect of the hospital governing on all their patients (might even be an interaction effect with the experimental agent). So it's called hierarchical effect.
Now your ectomy methods may be hierarchical: Is it plausible that a certain tonsillectomy method is slightly different (in itself, not yet in the effect, because that's what your are going to estimate and test) depending on the adenoidectomy method used prior on the same patient? If yes, you should specify it in your model.
Your observation that y~a+b may be different from y~b+a indicates that there is something wrong. Additive effects commute, so there should not be a difference (apart from small numerical differences). It is neither plausible nor desired that the effect of the surgery methods may depend on the order in which the statistician later specifies the effects. So you probably picked the wrong approach to feed R with the data.
|
The order of variables in ANOVA matters, doesn't it?
|
The term hierarchical model refers to the structure between the factors. For example, a multi-center study is hierarchical: You have the patients nested within the hospitals treating them. Each hospit
|
The order of variables in ANOVA matters, doesn't it?
The term hierarchical model refers to the structure between the factors. For example, a multi-center study is hierarchical: You have the patients nested within the hospitals treating them. Each hospital treats patients with placebo and verum, but recieving each of them in either hospital A or B is slightly different due to some common effect of the hospital governing on all their patients (might even be an interaction effect with the experimental agent). So it's called hierarchical effect.
Now your ectomy methods may be hierarchical: Is it plausible that a certain tonsillectomy method is slightly different (in itself, not yet in the effect, because that's what your are going to estimate and test) depending on the adenoidectomy method used prior on the same patient? If yes, you should specify it in your model.
Your observation that y~a+b may be different from y~b+a indicates that there is something wrong. Additive effects commute, so there should not be a difference (apart from small numerical differences). It is neither plausible nor desired that the effect of the surgery methods may depend on the order in which the statistician later specifies the effects. So you probably picked the wrong approach to feed R with the data.
|
The order of variables in ANOVA matters, doesn't it?
The term hierarchical model refers to the structure between the factors. For example, a multi-center study is hierarchical: You have the patients nested within the hospitals treating them. Each hospit
|
10,447
|
Constructing confidence intervals based on profile likelihood
|
In general, the confidence interval based on the standard error strongly depends on the assumption of normality for the estimator. The "profile likelihood confidence interval" provides an alternative.
I am pretty sure you can find documentation for this. For instance, here and references therein.
Here is a brief overview.
Let us say the data depend upon two (vectors of) parameters, $\theta$ and $\delta$, where $\theta$ is of interest and $\delta$ is a nuisance parameter.
The profile likelihood of $\theta$ is defined by
$L_p(\theta) = \max_{\delta} L(\theta, \delta)$
where $L(\theta, \delta)$ is the 'complete likelihood'. $L_p(\theta)$ does no longer depend on $\delta$ since it has been profiled out.
Let a null hypothesis be $H_0 : \theta = \theta_0$ and the likelihood ratio statistic be
$LR = 2 (\log L_p(\hat{\theta}) - \log L_p(\theta_0))$
where $\hat{\theta}$ is the value of $\theta$ that maximises the profile likelihood $L_p(\theta)$.
A "profile likelihood confidence interval" for $\theta$ consists of those values $\theta_0$ for which the test is not significant.
|
Constructing confidence intervals based on profile likelihood
|
In general, the confidence interval based on the standard error strongly depends on the assumption of normality for the estimator. The "profile likelihood confidence interval" provides an alternative.
|
Constructing confidence intervals based on profile likelihood
In general, the confidence interval based on the standard error strongly depends on the assumption of normality for the estimator. The "profile likelihood confidence interval" provides an alternative.
I am pretty sure you can find documentation for this. For instance, here and references therein.
Here is a brief overview.
Let us say the data depend upon two (vectors of) parameters, $\theta$ and $\delta$, where $\theta$ is of interest and $\delta$ is a nuisance parameter.
The profile likelihood of $\theta$ is defined by
$L_p(\theta) = \max_{\delta} L(\theta, \delta)$
where $L(\theta, \delta)$ is the 'complete likelihood'. $L_p(\theta)$ does no longer depend on $\delta$ since it has been profiled out.
Let a null hypothesis be $H_0 : \theta = \theta_0$ and the likelihood ratio statistic be
$LR = 2 (\log L_p(\hat{\theta}) - \log L_p(\theta_0))$
where $\hat{\theta}$ is the value of $\theta$ that maximises the profile likelihood $L_p(\theta)$.
A "profile likelihood confidence interval" for $\theta$ consists of those values $\theta_0$ for which the test is not significant.
|
Constructing confidence intervals based on profile likelihood
In general, the confidence interval based on the standard error strongly depends on the assumption of normality for the estimator. The "profile likelihood confidence interval" provides an alternative.
|
10,448
|
What are the assumptions of ridge regression and how to test them?
|
What is an assumption of a statistical procedure?
I am not a statistician and so this might be wrong, but I think the word "assumption" is often used quite informally and can refer to various things. To me, an "assumption" is, strictly speaking, something that only a theoretical result (theorem) can have.
When people talk about assumptions of linear regression (see here for an in-depth discussion), they are usually referring to the Gauss-Markov theorem that says that under assumptions of uncorrelated, equal-variance, zero-mean errors, OLS estimate is BLUE, i.e. is unbiased and has minimum variance. Outside of the context of Gauss-Markov theorem, it is not clear to me what a "regression assumption" would even mean.
Similarly, assumptions of a, say, one-sample t-test refer to the assumptions under which $t$-statistic is $t$-distributed and hence the inference is valid. It is not called a "theorem", but it is a clear mathematical result: if $n$ samples are normally distributed, then $t$-statistic will follow Student's $t$-distribution with $n-1$ degrees of freedom.
Assumptions of penalized regression techniques
Consider now any regularized regression technique: ridge regression, lasso, elastic net, principal components regression, partial least squares regression, etc. etc. The whole point of these methods is to make a biased estimate of regression parameters, and hoping to reduce the expected loss by exploiting the bias-variance trade-off.
All of these methods include one or several regularization parameters and none of them has a definite rule for selecting the values of these parameter. The optimal value is usually found via some sort of cross-validation procedure, but there are various methods of cross-validation and they can yield somewhat different results. Moreover, it is not uncommon to invoke some additional rules of thumb in addition to cross-validation. As a result, the actual outcome $\hat \beta$ of any of these penalized regression methods is not actually fully defined by the method, but can depend on the analyst's choices.
It is therefore not clear to me how there can be any theoretical optimality statement about $\hat \beta$, and so I am not sure that talking about "assumptions" (presence or absence thereof) of penalized methods such as ridge regression makes sense at all.
But what about the mathematical result that ridge regression always beats OLS?
Hoerl & Kennard (1970) in Ridge Regression: Biased Estimation for Nonorthogonal Problems proved that there always exists a value of regularization parameter $\lambda$ such that ridge regression estimate of $\beta$ has a strictly smaller expected loss than the OLS estimate. It is a surprising result -- see here for some discussion, but it only proves the existence of such $\lambda$, which will be dataset-dependent.
This result does not actually require any assumptions and is always true, but it would be strange to claim that ridge regression does not have any assumptions.
Okay, but how do I know if I can apply ridge regression or not?
I would say that even if we cannot talk of assumptions, we can talk about rules of thumb. It is well-known that ridge regression tends to be most useful in case of multiple regression with correlated predictors. It is well-known that it tends to outperform OLS, often by a large margin. It will tend to outperform it even in the case of heteroscedasticity, correlated errors, or whatever else. So the simple rule of thumb says that if you have multicollinear data, ridge regression and cross-validation is a good idea.
There are probably other useful rules of thumb and tricks of trade (such as e.g. what to do with gross outliers). But they are not assumptions.
Note that for OLS regression one needs some assumptions for $p$-values to hold. In contrast, it is tricky to obtain $p$-values in ridge regression. If this is done at all, it is done by bootstrapping or some similar approach and again it would be hard to point at specific assumptions here because there are no mathematical guarantees.
|
What are the assumptions of ridge regression and how to test them?
|
What is an assumption of a statistical procedure?
I am not a statistician and so this might be wrong, but I think the word "assumption" is often used quite informally and can refer to various things.
|
What are the assumptions of ridge regression and how to test them?
What is an assumption of a statistical procedure?
I am not a statistician and so this might be wrong, but I think the word "assumption" is often used quite informally and can refer to various things. To me, an "assumption" is, strictly speaking, something that only a theoretical result (theorem) can have.
When people talk about assumptions of linear regression (see here for an in-depth discussion), they are usually referring to the Gauss-Markov theorem that says that under assumptions of uncorrelated, equal-variance, zero-mean errors, OLS estimate is BLUE, i.e. is unbiased and has minimum variance. Outside of the context of Gauss-Markov theorem, it is not clear to me what a "regression assumption" would even mean.
Similarly, assumptions of a, say, one-sample t-test refer to the assumptions under which $t$-statistic is $t$-distributed and hence the inference is valid. It is not called a "theorem", but it is a clear mathematical result: if $n$ samples are normally distributed, then $t$-statistic will follow Student's $t$-distribution with $n-1$ degrees of freedom.
Assumptions of penalized regression techniques
Consider now any regularized regression technique: ridge regression, lasso, elastic net, principal components regression, partial least squares regression, etc. etc. The whole point of these methods is to make a biased estimate of regression parameters, and hoping to reduce the expected loss by exploiting the bias-variance trade-off.
All of these methods include one or several regularization parameters and none of them has a definite rule for selecting the values of these parameter. The optimal value is usually found via some sort of cross-validation procedure, but there are various methods of cross-validation and they can yield somewhat different results. Moreover, it is not uncommon to invoke some additional rules of thumb in addition to cross-validation. As a result, the actual outcome $\hat \beta$ of any of these penalized regression methods is not actually fully defined by the method, but can depend on the analyst's choices.
It is therefore not clear to me how there can be any theoretical optimality statement about $\hat \beta$, and so I am not sure that talking about "assumptions" (presence or absence thereof) of penalized methods such as ridge regression makes sense at all.
But what about the mathematical result that ridge regression always beats OLS?
Hoerl & Kennard (1970) in Ridge Regression: Biased Estimation for Nonorthogonal Problems proved that there always exists a value of regularization parameter $\lambda$ such that ridge regression estimate of $\beta$ has a strictly smaller expected loss than the OLS estimate. It is a surprising result -- see here for some discussion, but it only proves the existence of such $\lambda$, which will be dataset-dependent.
This result does not actually require any assumptions and is always true, but it would be strange to claim that ridge regression does not have any assumptions.
Okay, but how do I know if I can apply ridge regression or not?
I would say that even if we cannot talk of assumptions, we can talk about rules of thumb. It is well-known that ridge regression tends to be most useful in case of multiple regression with correlated predictors. It is well-known that it tends to outperform OLS, often by a large margin. It will tend to outperform it even in the case of heteroscedasticity, correlated errors, or whatever else. So the simple rule of thumb says that if you have multicollinear data, ridge regression and cross-validation is a good idea.
There are probably other useful rules of thumb and tricks of trade (such as e.g. what to do with gross outliers). But they are not assumptions.
Note that for OLS regression one needs some assumptions for $p$-values to hold. In contrast, it is tricky to obtain $p$-values in ridge regression. If this is done at all, it is done by bootstrapping or some similar approach and again it would be hard to point at specific assumptions here because there are no mathematical guarantees.
|
What are the assumptions of ridge regression and how to test them?
What is an assumption of a statistical procedure?
I am not a statistician and so this might be wrong, but I think the word "assumption" is often used quite informally and can refer to various things.
|
10,449
|
What are the assumptions of ridge regression and how to test them?
|
I would like to provide some input from the statistics perspective. If Y~N(Xb, sigma2*In), then the mean square error of b^ is
MSE(b^)=E(b^-b).T*(b^-b)=E(|b^-b|^2)=sigma2*trace(inv(X.T*X))
D(|b^-b|^2)=2*sigma4*trace((X.T*X)^(-2))
b^=inv(X.T*X)*X.T*Y
If X.TX is approximately zero,then inv(X.TX) will be very big. So the parameter estimate of b is not stable and can have the following problem.
some absolute value of the parameter estimate is very big
b has opposite positive or negative sign than expected.
adding or removing variables or observations will make the parameter estimates changes dramatically.
In order to make the ordinal least square estimate of b stable, we introduce the ridge regression by estimating the b^(k)=inv(X.T*X+kI)*X.T*Y. And we can prove that there is always a k that make the mean square error of
MSE(b^(k)) < MSE(b^).
In machine learning, the ridge regression is called the L2 regularization and is to combat over-fitting problems caused by many features.
|
What are the assumptions of ridge regression and how to test them?
|
I would like to provide some input from the statistics perspective. If Y~N(Xb, sigma2*In), then the mean square error of b^ is
MSE(b^)=E(b^-b).T*(b^-b)=E(|b^-b|^2)=sigma2*trace(inv(X.T*X))
D(|b^-b|^
|
What are the assumptions of ridge regression and how to test them?
I would like to provide some input from the statistics perspective. If Y~N(Xb, sigma2*In), then the mean square error of b^ is
MSE(b^)=E(b^-b).T*(b^-b)=E(|b^-b|^2)=sigma2*trace(inv(X.T*X))
D(|b^-b|^2)=2*sigma4*trace((X.T*X)^(-2))
b^=inv(X.T*X)*X.T*Y
If X.TX is approximately zero,then inv(X.TX) will be very big. So the parameter estimate of b is not stable and can have the following problem.
some absolute value of the parameter estimate is very big
b has opposite positive or negative sign than expected.
adding or removing variables or observations will make the parameter estimates changes dramatically.
In order to make the ordinal least square estimate of b stable, we introduce the ridge regression by estimating the b^(k)=inv(X.T*X+kI)*X.T*Y. And we can prove that there is always a k that make the mean square error of
MSE(b^(k)) < MSE(b^).
In machine learning, the ridge regression is called the L2 regularization and is to combat over-fitting problems caused by many features.
|
What are the assumptions of ridge regression and how to test them?
I would like to provide some input from the statistics perspective. If Y~N(Xb, sigma2*In), then the mean square error of b^ is
MSE(b^)=E(b^-b).T*(b^-b)=E(|b^-b|^2)=sigma2*trace(inv(X.T*X))
D(|b^-b|^
|
10,450
|
With categorical data, can there be clusters without the variables being related?
|
Consider the clear-cluster case with uncorrelated scale variables - such as the top-right picture in the question. And categorize its data.
We subdivided the scale range of both variables X and Y into 3 bins which now onward we treat as categorical labels. Moreover, we'll declare them nominal, not ordinal, because the question asked is implicitly and primarily about qualitative data. The spots' size is the frequency in a frequency cross-table cell; all cases in the same cell are considered identical.
Intuitively and most generally, "clusters" are defined as clots of data points separated by sparse regions in the data "space". It was initially with scale data and it remains same impression in the cross-tabulation of the categorized data. X and Y now categorical, but they still look uncorrelated: chi-square association is very near to zero. And clusters are there.
But recall we're dealing with nominal categories which order in the table is arbitrary. We may reorder whole rows and/or columns as we like, without affecting the observed chi-square value. Do reordering...
...to meet that clusters just dissapeared. The four cells, a1, a3, c1 and c3, could be united in a single cluster. So no, we really don't have any clusters in the categorical data.
Cases of cells a1 and c3 (or likewise of a3 and c1) are complete-dissimilar: they don't share same attribures. To induce clusters in our data - a1 and c3 to form the clusters - we have to empty, to some great extent, confounding cells a3 and c1, by dropping these cases from the dataset.
Now clusters do exist. But at the same time we lost uncorrelatedness. The diagonal structure showing up in the table signals that chi-square statistic got far from zero.
Pity. Let us attempt to preserve uncorrelatedness and more or less clear clusters at the same time. We may decide to sufficiently empty just cell a3, for example, and then to consider a1+c1 as a cluster which opposes cluster c3:
That operation didn't bring Chi-square any far from zero...
[Indeed, table such as for example
6 6 1
6 6 1
1 1 0
retains about the same very low chi-square association after
dividing 2nd column by 3 and multiplying 2nd row by 3, which gives
6 2 1
18 6 3
1 1/3 0
Cell (1,2) got thrice lower frequency. We had, however, to upheave
cell (2,1) frequency thrice, to keep Chi-sq almost as before.]
...but the situation with clusters is confused. Cluster a1+c1 contains cases that partly identical, partly half-dissimilar. That a cluster is relatively low-homogeneous is itself not a preclusion for a clear-cluster structure in a dataset. However, the problem with our, categorical data is that cluster a1+c1 is in no way better than cluster c1+c3, its symmetric analogue. That means that the cluster solution is unstable - it will depend on the case order in the dataset. An unstable solution, even it is relatively "clear-clustered", is a bad solution, unreliable.
The only way to overcome the problem and to make solution both clear and stable will be to untie cell c3 from cell c1 by moving its data below to cell b3 (or to b2).
So we have clear clusters a1+c1 vs b3. But look, here again the diagonal pattern shows up - and chi-square of the table bounds high above zero.
Conclusion. It is impossible to have two chi-square-unassociated nominal variables and good clusters of the data cases simultaneously. Clear & stable clusters imply inducing variable association.
It is also clear that if the association is present - i.e. diagonal pattern exists or achievable by reordering - then clusters must exist. This is because the nature of categorical data ("all or nothing") doesn't permit half tones and borderline conditions, therefore picture like bottom-left in the OP's question can't emerge with categorical, nominal data.
I surmise that as we get more and more nominal variables (instead of just two) which are bivariately chi-square unrelated, we come closer to the possibility to have clusters. But zero multivariate chi-square, I expect still will be incompatible with clusters. That yet has to be shown (not by me or not this time).
Finally, a remark on @Bey's (aka user75138) answer which I partly supported. I've commented it with my agreement on that one has first to decide on the distance metric and the association measure before he can put the question "is variable association independent from case clusters?". This is because no universal association measure exist, nor universal statistical definition of clusters. I would further add, he must also decide on the clustering technique. Various methods of clustering differently define what are "clusters" they are after. So, the whole statement might be true.
That said, the weakness of such a dictum is that it's too broad. One should attempt to show concretely, whether and where a choice on distance metric / association measure / cluster method opens room to reconcile uncorrelatedness with clusteredness, for nominal data. He would keep in mind, particular, that not all the many proximity coefficients for binary data make sense with nominal data, since for nominal data, "both cases lack this attribute" can never be the ground for their similarity.
Update, reporting my simulations findings.
Repearedly, 2- or 3-variable nominal data were randomly generated, with the number of categories in a variable varying from 3 to 5, and the total sample size varying from 300 to 600. Bivariate chi-square association was very low in all the generated datasets (Cramer's V almost never above $.1$). Also, for 3-variable data 3-way chi-square association (main effects multinomial model), Pearson and Log-likelihood, was low and never significant.
Two methods of cluster analysis were used to cluster cases in each of the generated datasets - Hierarchical clustering (complete method, Dice similarity measure), and TwoStep clustering (basing on log-likelihood distance). Then a range of cluster solutions (varying by the number of clusters in a solution) from each analysis was checked by some internal clustering criterions (silhouette statistic, point-biserial $r$, AIC & BIC) in search of a relatively "good" solution, indicating the presence of clear clusters. A liked solution was then tested for stability by means of permuting case order in the dataset and redoing the clustering on it.
Findings generally support reasoning displayed above within the answer. There was never very clear clusters (such as might occure if the chi-square association be strong). And the results of the different clustering criterions often contradicted each other (which isn't very likely to expect when clusters are really clear).
Sometimes hierarchical clustering would offer a k-cluster solution that is somewhat good, as observed via a clustering criterion plot; however, testing it for stability will fail to show it is stable. For example, this 3-variable 4x4x3 data
V1 V2 V3 Count
1 1 1 21
2 24
3 1
2 1 22
2 26
3 1
3 1 1
2 1
3 1
4 1 17
2 20
3 1
2 1 1 10
2 12
3 1
2 1 10
2 12
3 1
3 1 1
2 1
3 1
4 1 8
2 9
3 1
3 1 1 24
2 28
3 1
2 1 25
2 30
3 1
3 1 1
2 1
3 1
4 1 19
2 23
3 1
4 1 1 24
2 28
3 1
2 1 26
2 30
3 1
3 1 1
2 1
3 1
4 1 19
2 23
3 1
when clustered by the complete linkage hiearchical method, Dice similarity, seem to be split - quite reasonably - into 9 clusters - in this case in agreement among the three internal validity judges:
But the solution is not stable, as seen from the noncomplete sparsity of the confusion matrix of the original solution against the permuted (case-reordered) solution:
If the solution had been stable (as it would likely be had we continuous data) we would have chosen the 9-cluster solution as sufficiently persuasive one.
Clustering based on log-likelihood distance (as opposed to Dice similarity) may give stable and "not bad" (internally quite valid) solutions. But that is because the distance, at least as it is in TwoStep cluster of SPSS, encourage and foster high-populated clusters and neglect low-populated ones. It does not demand clusters with very low frequency inside to be dense inside (that seem to be the "policy" of TwoStep cluster analysis, which was designed specially for big data and to give few clusters; so small clusters are seen as if outliers). For example, these 2-variable data
would be combined by TwoStep into 5 clusters as shown, stably, and the 5-cluster solution is not at all bad as judged by some clustering criterions. Because the four populated clusters are very dense inside (actually, all cases identical), and only one, fifth cluster, which includes few cases, is extremely entropy'ed. So apparent actually is 12-cluster solution, not 5-cluster, but 12 is the total number of cells in the frequency table, which, as a "cluster solution" is trivial and uninteresting.
|
With categorical data, can there be clusters without the variables being related?
|
Consider the clear-cluster case with uncorrelated scale variables - such as the top-right picture in the question. And categorize its data.
We subdivided the scale range of both variables X and Y int
|
With categorical data, can there be clusters without the variables being related?
Consider the clear-cluster case with uncorrelated scale variables - such as the top-right picture in the question. And categorize its data.
We subdivided the scale range of both variables X and Y into 3 bins which now onward we treat as categorical labels. Moreover, we'll declare them nominal, not ordinal, because the question asked is implicitly and primarily about qualitative data. The spots' size is the frequency in a frequency cross-table cell; all cases in the same cell are considered identical.
Intuitively and most generally, "clusters" are defined as clots of data points separated by sparse regions in the data "space". It was initially with scale data and it remains same impression in the cross-tabulation of the categorized data. X and Y now categorical, but they still look uncorrelated: chi-square association is very near to zero. And clusters are there.
But recall we're dealing with nominal categories which order in the table is arbitrary. We may reorder whole rows and/or columns as we like, without affecting the observed chi-square value. Do reordering...
...to meet that clusters just dissapeared. The four cells, a1, a3, c1 and c3, could be united in a single cluster. So no, we really don't have any clusters in the categorical data.
Cases of cells a1 and c3 (or likewise of a3 and c1) are complete-dissimilar: they don't share same attribures. To induce clusters in our data - a1 and c3 to form the clusters - we have to empty, to some great extent, confounding cells a3 and c1, by dropping these cases from the dataset.
Now clusters do exist. But at the same time we lost uncorrelatedness. The diagonal structure showing up in the table signals that chi-square statistic got far from zero.
Pity. Let us attempt to preserve uncorrelatedness and more or less clear clusters at the same time. We may decide to sufficiently empty just cell a3, for example, and then to consider a1+c1 as a cluster which opposes cluster c3:
That operation didn't bring Chi-square any far from zero...
[Indeed, table such as for example
6 6 1
6 6 1
1 1 0
retains about the same very low chi-square association after
dividing 2nd column by 3 and multiplying 2nd row by 3, which gives
6 2 1
18 6 3
1 1/3 0
Cell (1,2) got thrice lower frequency. We had, however, to upheave
cell (2,1) frequency thrice, to keep Chi-sq almost as before.]
...but the situation with clusters is confused. Cluster a1+c1 contains cases that partly identical, partly half-dissimilar. That a cluster is relatively low-homogeneous is itself not a preclusion for a clear-cluster structure in a dataset. However, the problem with our, categorical data is that cluster a1+c1 is in no way better than cluster c1+c3, its symmetric analogue. That means that the cluster solution is unstable - it will depend on the case order in the dataset. An unstable solution, even it is relatively "clear-clustered", is a bad solution, unreliable.
The only way to overcome the problem and to make solution both clear and stable will be to untie cell c3 from cell c1 by moving its data below to cell b3 (or to b2).
So we have clear clusters a1+c1 vs b3. But look, here again the diagonal pattern shows up - and chi-square of the table bounds high above zero.
Conclusion. It is impossible to have two chi-square-unassociated nominal variables and good clusters of the data cases simultaneously. Clear & stable clusters imply inducing variable association.
It is also clear that if the association is present - i.e. diagonal pattern exists or achievable by reordering - then clusters must exist. This is because the nature of categorical data ("all or nothing") doesn't permit half tones and borderline conditions, therefore picture like bottom-left in the OP's question can't emerge with categorical, nominal data.
I surmise that as we get more and more nominal variables (instead of just two) which are bivariately chi-square unrelated, we come closer to the possibility to have clusters. But zero multivariate chi-square, I expect still will be incompatible with clusters. That yet has to be shown (not by me or not this time).
Finally, a remark on @Bey's (aka user75138) answer which I partly supported. I've commented it with my agreement on that one has first to decide on the distance metric and the association measure before he can put the question "is variable association independent from case clusters?". This is because no universal association measure exist, nor universal statistical definition of clusters. I would further add, he must also decide on the clustering technique. Various methods of clustering differently define what are "clusters" they are after. So, the whole statement might be true.
That said, the weakness of such a dictum is that it's too broad. One should attempt to show concretely, whether and where a choice on distance metric / association measure / cluster method opens room to reconcile uncorrelatedness with clusteredness, for nominal data. He would keep in mind, particular, that not all the many proximity coefficients for binary data make sense with nominal data, since for nominal data, "both cases lack this attribute" can never be the ground for their similarity.
Update, reporting my simulations findings.
Repearedly, 2- or 3-variable nominal data were randomly generated, with the number of categories in a variable varying from 3 to 5, and the total sample size varying from 300 to 600. Bivariate chi-square association was very low in all the generated datasets (Cramer's V almost never above $.1$). Also, for 3-variable data 3-way chi-square association (main effects multinomial model), Pearson and Log-likelihood, was low and never significant.
Two methods of cluster analysis were used to cluster cases in each of the generated datasets - Hierarchical clustering (complete method, Dice similarity measure), and TwoStep clustering (basing on log-likelihood distance). Then a range of cluster solutions (varying by the number of clusters in a solution) from each analysis was checked by some internal clustering criterions (silhouette statistic, point-biserial $r$, AIC & BIC) in search of a relatively "good" solution, indicating the presence of clear clusters. A liked solution was then tested for stability by means of permuting case order in the dataset and redoing the clustering on it.
Findings generally support reasoning displayed above within the answer. There was never very clear clusters (such as might occure if the chi-square association be strong). And the results of the different clustering criterions often contradicted each other (which isn't very likely to expect when clusters are really clear).
Sometimes hierarchical clustering would offer a k-cluster solution that is somewhat good, as observed via a clustering criterion plot; however, testing it for stability will fail to show it is stable. For example, this 3-variable 4x4x3 data
V1 V2 V3 Count
1 1 1 21
2 24
3 1
2 1 22
2 26
3 1
3 1 1
2 1
3 1
4 1 17
2 20
3 1
2 1 1 10
2 12
3 1
2 1 10
2 12
3 1
3 1 1
2 1
3 1
4 1 8
2 9
3 1
3 1 1 24
2 28
3 1
2 1 25
2 30
3 1
3 1 1
2 1
3 1
4 1 19
2 23
3 1
4 1 1 24
2 28
3 1
2 1 26
2 30
3 1
3 1 1
2 1
3 1
4 1 19
2 23
3 1
when clustered by the complete linkage hiearchical method, Dice similarity, seem to be split - quite reasonably - into 9 clusters - in this case in agreement among the three internal validity judges:
But the solution is not stable, as seen from the noncomplete sparsity of the confusion matrix of the original solution against the permuted (case-reordered) solution:
If the solution had been stable (as it would likely be had we continuous data) we would have chosen the 9-cluster solution as sufficiently persuasive one.
Clustering based on log-likelihood distance (as opposed to Dice similarity) may give stable and "not bad" (internally quite valid) solutions. But that is because the distance, at least as it is in TwoStep cluster of SPSS, encourage and foster high-populated clusters and neglect low-populated ones. It does not demand clusters with very low frequency inside to be dense inside (that seem to be the "policy" of TwoStep cluster analysis, which was designed specially for big data and to give few clusters; so small clusters are seen as if outliers). For example, these 2-variable data
would be combined by TwoStep into 5 clusters as shown, stably, and the 5-cluster solution is not at all bad as judged by some clustering criterions. Because the four populated clusters are very dense inside (actually, all cases identical), and only one, fifth cluster, which includes few cases, is extremely entropy'ed. So apparent actually is 12-cluster solution, not 5-cluster, but 12 is the total number of cells in the frequency table, which, as a "cluster solution" is trivial and uninteresting.
|
With categorical data, can there be clusters without the variables being related?
Consider the clear-cluster case with uncorrelated scale variables - such as the top-right picture in the question. And categorize its data.
We subdivided the scale range of both variables X and Y int
|
10,451
|
With categorical data, can there be clusters without the variables being related?
|
As I'm sure you know, correlation is a measure of the linear relationship between two variables, not how close the points are to each other. This explains the top four figures.
Of course, you could also create similar graphs for discrete, real-valued data as well.
The problem with more abstract distributions, such as $X \in \{A,B,C,D\}$ is that, unlike variables taking values in $\mathbb{R}$, we cannot assume that the image of a categorical random variable forms a metric space. We get this automatically when $X \subset \mathbb{R}$, but not so when we have $X$ taking values on some arbitrary set.
You'd need to define a metric for the categorical space before you can really even talk about clustering in the geometric sense.
|
With categorical data, can there be clusters without the variables being related?
|
As I'm sure you know, correlation is a measure of the linear relationship between two variables, not how close the points are to each other. This explains the top four figures.
Of course, you could al
|
With categorical data, can there be clusters without the variables being related?
As I'm sure you know, correlation is a measure of the linear relationship between two variables, not how close the points are to each other. This explains the top four figures.
Of course, you could also create similar graphs for discrete, real-valued data as well.
The problem with more abstract distributions, such as $X \in \{A,B,C,D\}$ is that, unlike variables taking values in $\mathbb{R}$, we cannot assume that the image of a categorical random variable forms a metric space. We get this automatically when $X \subset \mathbb{R}$, but not so when we have $X$ taking values on some arbitrary set.
You'd need to define a metric for the categorical space before you can really even talk about clustering in the geometric sense.
|
With categorical data, can there be clusters without the variables being related?
As I'm sure you know, correlation is a measure of the linear relationship between two variables, not how close the points are to each other. This explains the top four figures.
Of course, you could al
|
10,452
|
With categorical data, can there be clusters without the variables being related?
|
Consider the Hamming distance -- the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. From this definition it seems obvious that we can produce data for which we have clusters based on the Hamming distance but no correlations between the variables.
An example follows using Mathematica.
Create some categorical data (3 symbols long sequences of uniform random sampling of 4 characters):
chs = CharacterRange["a", "d"];
words = StringJoin @@@ Union[Table[RandomChoice[chs, 3], 40]];
Length[words]
words
(* 29 *)
(* {"aac", "aad", "abb", "aca", "acb", "acd", "adb", "adc", "baa", "bab", "bac", "bad", "bcc", "bcd", "caa", "cab", "cac", "cad", "cbb", "ccb", "cda", "cdb", "dab", "dba", "dbb", "dbd", "dca", "dcc", "dcd"} *)
Use mosaic plots for the relationship between the variables (conditional probabilities for pairs of values from different columns):
Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MosaicPlot.m"]
wordSeqs = Characters /@ words;
opts = {ColorRules -> {2 -> ColorData[7, "ColorList"]}, ImageSize -> 400};
Grid[{{MosaicPlot[wordSeqs[[All, {1, 2}]],
"ColumnNames" -> {"column 1", "column 2"}, opts],
MosaicPlot[wordSeqs[[All, {2, 3}]],
"ColumnNames" -> {"column 2", "column 3"}, opts],
MosaicPlot[wordSeqs[[All, {1, 3}]],
"ColumnNames" -> {"column 1", "column 3"}, opts]}}, Dividers -> All]
We can see that there is no correlation.
Find clusters:
cls = FindClusters[words, 3, DistanceFunction -> HammingDistance]
(* {{"aac", "aad", "adc", "bac"}, {"abb", "acb", "adb", "baa", "bab", "bad",
"caa", "cab", "cac", "cad", "cbb", "ccb", "cda", "cdb", "dab",
"dbb"}, {"aca", "acd", "bcc", "bcd", "dba", "dbd", "dca", "dcc", "dcd"}} *)
If we replace every character with an integer we can see from this plot how the clusters are formed with Hamming distance:
esrules = Thread[chs -> Range[Length[chs]]]; gr1 =
ListPointPlot3D[Characters[cls] /. esrules,
PlotStyle -> {PointSize[0.02]}, PlotLegends -> Automatic,
FaceGrids -> {Bottom, Left, Back}];
gr2 = Graphics3D[
Map[Text[#, Characters[#] /. esrules, {1, 1}] &, Flatten[cls]]];
Show[gr1, gr2]
Further clustering
Let us make a graph by connecting the words for which the Hamming distance is 1:
mat = Clip[Outer[HammingDistance, words, words], {0, 1}, {0, 0}];
nngr = AdjacencyGraph[mat,
VertexLabels -> Thread[Range[Length[words]] -> words]]
Now let us find the community clusters:
CommunityGraphPlot[nngr]
Compare the graph clusters with the one found with FindClusters (which was forced to find 3). We can see "bac" is highly central, and "aad" can belong to the green cluster, which corresponds to cluster 1 in 3D plot.
Graph data
Here is the edge list of nngr:
{1 <-> 2, 1 <-> 8, 1 <-> 11, 1 <-> 17, 2 <-> 6, 2 <-> 12, 2 <-> 18,
3 <-> 5, 3 <-> 7, 3 <-> 19, 3 <-> 25, 4 <-> 5, 4 <-> 6, 4 <-> 27,
5 <-> 6, 5 <-> 7, 5 <-> 20, 6 <-> 14, 6 <-> 29, 7 <-> 8, 7 <-> 22,
9 <-> 10, 9 <-> 11, 9 <-> 12, 9 <-> 15, 10 <-> 11, 10 <-> 12,
10 <-> 16, 10 <-> 23, 11 <-> 12, 11 <-> 13, 11 <-> 17, 12 <-> 14,
12 <-> 18, 13 <-> 14, 13 <-> 28, 14 <-> 29, 15 <-> 16, 15 <-> 17,
15 <-> 18, 15 <-> 21, 16 <-> 17, 16 <-> 18, 16 <-> 19, 16 <-> 20,
16 <-> 22, 16 <-> 23, 17 <-> 18, 19 <-> 20, 19 <-> 22, 19 <-> 25,
20 <-> 22, 21 <-> 22, 23 <-> 25, 24 <-> 25, 24 <-> 26, 24 <-> 27,
25 <-> 26, 26 <-> 29, 27 <-> 28, 27 <-> 29, 28 <-> 29}
|
With categorical data, can there be clusters without the variables being related?
|
Consider the Hamming distance -- the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. From this definition it seems obv
|
With categorical data, can there be clusters without the variables being related?
Consider the Hamming distance -- the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. From this definition it seems obvious that we can produce data for which we have clusters based on the Hamming distance but no correlations between the variables.
An example follows using Mathematica.
Create some categorical data (3 symbols long sequences of uniform random sampling of 4 characters):
chs = CharacterRange["a", "d"];
words = StringJoin @@@ Union[Table[RandomChoice[chs, 3], 40]];
Length[words]
words
(* 29 *)
(* {"aac", "aad", "abb", "aca", "acb", "acd", "adb", "adc", "baa", "bab", "bac", "bad", "bcc", "bcd", "caa", "cab", "cac", "cad", "cbb", "ccb", "cda", "cdb", "dab", "dba", "dbb", "dbd", "dca", "dcc", "dcd"} *)
Use mosaic plots for the relationship between the variables (conditional probabilities for pairs of values from different columns):
Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MosaicPlot.m"]
wordSeqs = Characters /@ words;
opts = {ColorRules -> {2 -> ColorData[7, "ColorList"]}, ImageSize -> 400};
Grid[{{MosaicPlot[wordSeqs[[All, {1, 2}]],
"ColumnNames" -> {"column 1", "column 2"}, opts],
MosaicPlot[wordSeqs[[All, {2, 3}]],
"ColumnNames" -> {"column 2", "column 3"}, opts],
MosaicPlot[wordSeqs[[All, {1, 3}]],
"ColumnNames" -> {"column 1", "column 3"}, opts]}}, Dividers -> All]
We can see that there is no correlation.
Find clusters:
cls = FindClusters[words, 3, DistanceFunction -> HammingDistance]
(* {{"aac", "aad", "adc", "bac"}, {"abb", "acb", "adb", "baa", "bab", "bad",
"caa", "cab", "cac", "cad", "cbb", "ccb", "cda", "cdb", "dab",
"dbb"}, {"aca", "acd", "bcc", "bcd", "dba", "dbd", "dca", "dcc", "dcd"}} *)
If we replace every character with an integer we can see from this plot how the clusters are formed with Hamming distance:
esrules = Thread[chs -> Range[Length[chs]]]; gr1 =
ListPointPlot3D[Characters[cls] /. esrules,
PlotStyle -> {PointSize[0.02]}, PlotLegends -> Automatic,
FaceGrids -> {Bottom, Left, Back}];
gr2 = Graphics3D[
Map[Text[#, Characters[#] /. esrules, {1, 1}] &, Flatten[cls]]];
Show[gr1, gr2]
Further clustering
Let us make a graph by connecting the words for which the Hamming distance is 1:
mat = Clip[Outer[HammingDistance, words, words], {0, 1}, {0, 0}];
nngr = AdjacencyGraph[mat,
VertexLabels -> Thread[Range[Length[words]] -> words]]
Now let us find the community clusters:
CommunityGraphPlot[nngr]
Compare the graph clusters with the one found with FindClusters (which was forced to find 3). We can see "bac" is highly central, and "aad" can belong to the green cluster, which corresponds to cluster 1 in 3D plot.
Graph data
Here is the edge list of nngr:
{1 <-> 2, 1 <-> 8, 1 <-> 11, 1 <-> 17, 2 <-> 6, 2 <-> 12, 2 <-> 18,
3 <-> 5, 3 <-> 7, 3 <-> 19, 3 <-> 25, 4 <-> 5, 4 <-> 6, 4 <-> 27,
5 <-> 6, 5 <-> 7, 5 <-> 20, 6 <-> 14, 6 <-> 29, 7 <-> 8, 7 <-> 22,
9 <-> 10, 9 <-> 11, 9 <-> 12, 9 <-> 15, 10 <-> 11, 10 <-> 12,
10 <-> 16, 10 <-> 23, 11 <-> 12, 11 <-> 13, 11 <-> 17, 12 <-> 14,
12 <-> 18, 13 <-> 14, 13 <-> 28, 14 <-> 29, 15 <-> 16, 15 <-> 17,
15 <-> 18, 15 <-> 21, 16 <-> 17, 16 <-> 18, 16 <-> 19, 16 <-> 20,
16 <-> 22, 16 <-> 23, 17 <-> 18, 19 <-> 20, 19 <-> 22, 19 <-> 25,
20 <-> 22, 21 <-> 22, 23 <-> 25, 24 <-> 25, 24 <-> 26, 24 <-> 27,
25 <-> 26, 26 <-> 29, 27 <-> 28, 27 <-> 29, 28 <-> 29}
|
With categorical data, can there be clusters without the variables being related?
Consider the Hamming distance -- the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. From this definition it seems obv
|
10,453
|
With categorical data, can there be clusters without the variables being related?
|
@ttnphns' point about pairwise vs multivariate association is well taken. Related to that is the old saw about the importance of demonstrating association with simple metrics before leaping into a multivariate framework. In other words, if simple pairwise measures of association show no relationship then it becomes increasingly unlikely that multivariate relationships will show anything either. I say "increasingly unlikely" because of a reluctance to use the word "impossible." In addition, I am agnostic as to the metric employed whether it be a monotonic Spearman correlations for ordinal data, Somer's D, Kendall's Tau, polychoric correlation, the Reshef's MIC, Szelkey's distance correlation, whatever. The choice of metric is not important in this discussion.
The original work done on finding latent structure in categorical information dates back to the early 50s and Paul Lazersfeld, the Columbia sociologist. Essentially, he invented a class of latent variable models that has seen extensive development and modification since. First, with the 60s work of James Coleman, the U of C political economist, on latent voter election propensities, followed by the contributions of the late Clifford Clogg, also a sociologist, whose MELISSA software was the first publicly available latent class freeware.
In the 80s, latent class models were extended from purely categorical information to finite mixture models with development of tools such as Latent Gold from Statistical Innovations. In addition, Bill Dillon, a marketing scientist, developed a Gauss program for fitting latent discriminant finite mixture models. The literature on this approach to fitting mixtures of categorical and continuous information is actually quite extensive. It's just not as well known outside of the fields where it has been most widely applied, e.g., marketing science where these models are used for consumer segmentation and clustering.
However, these finite mixture model approaches to latent clustering and contingency table analysis are considered old school in today's world of massive data. The state-of-the-art in finding association among a huge set of contingency tables are the decompositions available from deploying tensor models such as those developed by David Dunson and other Bayesians at Duke. Here is the abstract from one of their papers as well as a link:
Contingency table analysis routinely relies on log linear models, with
latent structure analysis providing a common alternative. Latent
structure models lead to a low rank tensor factorization of the
probability mass function for multivariate categorical data, while log
linear models achieve dimensionality reduction through sparsity.
Little is known about the relationship between these notions of
dimensionality reduction in the two paradigms. We derive several
results relating the support of a log-linear model to the nonnegative
rank of the associated probability tensor. Motivated by these
findings, we propose a new collapsed Tucker class of tensor
decompositions, which bridge existing PARAFAC and Tucker
decompositions, providing a more flexible framework for parsimoniously
characterizing multivariate categorical data. Taking a Bayesian
approach to inference, we illustrate advantages of the new
decompositions in simulations and an application to functional
disability data.
https://arxiv.org/pdf/1404.0396.pdf
|
With categorical data, can there be clusters without the variables being related?
|
@ttnphns' point about pairwise vs multivariate association is well taken. Related to that is the old saw about the importance of demonstrating association with simple metrics before leaping into a mul
|
With categorical data, can there be clusters without the variables being related?
@ttnphns' point about pairwise vs multivariate association is well taken. Related to that is the old saw about the importance of demonstrating association with simple metrics before leaping into a multivariate framework. In other words, if simple pairwise measures of association show no relationship then it becomes increasingly unlikely that multivariate relationships will show anything either. I say "increasingly unlikely" because of a reluctance to use the word "impossible." In addition, I am agnostic as to the metric employed whether it be a monotonic Spearman correlations for ordinal data, Somer's D, Kendall's Tau, polychoric correlation, the Reshef's MIC, Szelkey's distance correlation, whatever. The choice of metric is not important in this discussion.
The original work done on finding latent structure in categorical information dates back to the early 50s and Paul Lazersfeld, the Columbia sociologist. Essentially, he invented a class of latent variable models that has seen extensive development and modification since. First, with the 60s work of James Coleman, the U of C political economist, on latent voter election propensities, followed by the contributions of the late Clifford Clogg, also a sociologist, whose MELISSA software was the first publicly available latent class freeware.
In the 80s, latent class models were extended from purely categorical information to finite mixture models with development of tools such as Latent Gold from Statistical Innovations. In addition, Bill Dillon, a marketing scientist, developed a Gauss program for fitting latent discriminant finite mixture models. The literature on this approach to fitting mixtures of categorical and continuous information is actually quite extensive. It's just not as well known outside of the fields where it has been most widely applied, e.g., marketing science where these models are used for consumer segmentation and clustering.
However, these finite mixture model approaches to latent clustering and contingency table analysis are considered old school in today's world of massive data. The state-of-the-art in finding association among a huge set of contingency tables are the decompositions available from deploying tensor models such as those developed by David Dunson and other Bayesians at Duke. Here is the abstract from one of their papers as well as a link:
Contingency table analysis routinely relies on log linear models, with
latent structure analysis providing a common alternative. Latent
structure models lead to a low rank tensor factorization of the
probability mass function for multivariate categorical data, while log
linear models achieve dimensionality reduction through sparsity.
Little is known about the relationship between these notions of
dimensionality reduction in the two paradigms. We derive several
results relating the support of a log-linear model to the nonnegative
rank of the associated probability tensor. Motivated by these
findings, we propose a new collapsed Tucker class of tensor
decompositions, which bridge existing PARAFAC and Tucker
decompositions, providing a more flexible framework for parsimoniously
characterizing multivariate categorical data. Taking a Bayesian
approach to inference, we illustrate advantages of the new
decompositions in simulations and an application to functional
disability data.
https://arxiv.org/pdf/1404.0396.pdf
|
With categorical data, can there be clusters without the variables being related?
@ttnphns' point about pairwise vs multivariate association is well taken. Related to that is the old saw about the importance of demonstrating association with simple metrics before leaping into a mul
|
10,454
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
Ok, I found the answer myself:
Conditinal Random Fields (CRFs) are a special case of Markov Random Fields (MRFs).
1.5.4 Conditional Random Field
A Conditional Random Field (CRF) is a form of MRF that defines a posterior for
variables x given data z, as with the hidden MRF above. Unlike the hidden MRF,
however, the factorization into the data distribution P (x|z) and the prior P
(x) is not made explicit [288]. This allows complex dependencies of x on z to
be written directly in the posterior distribution, without the factorization
being made explicit. (Given P (x|z), such factorizations always exist,
however—infinitely many of them, in fact—so there is no suggestion that the CRF
is more general than the hidden MRF, only that it may be more convenient to
deal with.)
Source: Blake, Kohli and Rother: Markov random fields for vision and image processing. 2011.
A conditional random field or CRF (Lafferty et al. 2001), sometimes a
discriminative random field (Kumar and Hebert 2003), is just a version of an
MRF where all the clique potentials are conditioned on input features:
[...]
The advantage of a CRF over an MRF is analogous to the advantage of a discriminative
classifier over a generative classifier (see Section 8.6), namely, we don’t need to “waste resources”
modeling things that we always observe. [...]
The disadvantage of CRFs over MRFs is that they require labeled training data, and they are slower to train[...]
Source: Kevin P. Murphy: Machine Learning: A Probabilistic Perspective
Answering my question:
If I fix the values of the observed nodes of an MRF, does it become a CRF?
Yes. Fixing the values is the same as conditioning on them. However, you should note that there are differences in training, too.
Watching many of the lectures about PGM (probabilistic graphical models) on coursera helped me a lot.
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
Ok, I found the answer myself:
Conditinal Random Fields (CRFs) are a special case of Markov Random Fields (MRFs).
1.5.4 Conditional Random Field
A Conditional Random Field (CRF) is a form of MRF that
|
What's the difference between a Markov Random Field and a Conditional Random Field?
Ok, I found the answer myself:
Conditinal Random Fields (CRFs) are a special case of Markov Random Fields (MRFs).
1.5.4 Conditional Random Field
A Conditional Random Field (CRF) is a form of MRF that defines a posterior for
variables x given data z, as with the hidden MRF above. Unlike the hidden MRF,
however, the factorization into the data distribution P (x|z) and the prior P
(x) is not made explicit [288]. This allows complex dependencies of x on z to
be written directly in the posterior distribution, without the factorization
being made explicit. (Given P (x|z), such factorizations always exist,
however—infinitely many of them, in fact—so there is no suggestion that the CRF
is more general than the hidden MRF, only that it may be more convenient to
deal with.)
Source: Blake, Kohli and Rother: Markov random fields for vision and image processing. 2011.
A conditional random field or CRF (Lafferty et al. 2001), sometimes a
discriminative random field (Kumar and Hebert 2003), is just a version of an
MRF where all the clique potentials are conditioned on input features:
[...]
The advantage of a CRF over an MRF is analogous to the advantage of a discriminative
classifier over a generative classifier (see Section 8.6), namely, we don’t need to “waste resources”
modeling things that we always observe. [...]
The disadvantage of CRFs over MRFs is that they require labeled training data, and they are slower to train[...]
Source: Kevin P. Murphy: Machine Learning: A Probabilistic Perspective
Answering my question:
If I fix the values of the observed nodes of an MRF, does it become a CRF?
Yes. Fixing the values is the same as conditioning on them. However, you should note that there are differences in training, too.
Watching many of the lectures about PGM (probabilistic graphical models) on coursera helped me a lot.
|
What's the difference between a Markov Random Field and a Conditional Random Field?
Ok, I found the answer myself:
Conditinal Random Fields (CRFs) are a special case of Markov Random Fields (MRFs).
1.5.4 Conditional Random Field
A Conditional Random Field (CRF) is a form of MRF that
|
10,455
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
Let's contrast conditional inference under MRFs with modeling using a CRF, settling on definitions along the way, and then address the original question.
MRF
A Markov Random Field (MRF) with respect to a graph $G$ is
a set of random variables (or random "elements" if you like) corresponding to the nodes in $G$ (thus, a "random field")
with a joint distribution that is Markov with respect to $G$; that is, the joint probability distribution associated with this MRF is subject to the Markov constraint given by G: for any two variables, $V_i$ and $V_j$, the value of $V_i$ is conditionally independent of $V_j$ given its neighbors $\mathcal{B}_i$. In this case, it is said that the joint probability distribution $P(\{V_i\})$ factorizes according to $G$.
Conditional Inference Under an MRF
Since an MRF represents a joint distribution over many variables that obeys Markov constraints, then we can compute conditional probability distributions given observed values of some variables.
For example, if I have a joint distribution over four random variables: IsRaining, SprinklerOn, SidewalkWet, and GrassWet, then on Monday I might want to infer the joint probability distribution over IsRaining and SprinklerOn given that I have observed SidewalkWet=False and GrassWet=True. On Tuesday, I might want to infer the joint probability distribution over IsRaining and SprinklerOn given that I have observed SidewalkWet=True and GrassWet=True.
In other words, we can use the same MRF model to make inferences in these two different situations, but we wouldn't say that we've changed the model. In fact, although we observed SidewalkWet and GrassWet in both cases described here, the MRF itself doesn't have "observed variables" per se---all variables have the same status in the eyes of the MRF, so the MRF also models, e.g., the joint distribution of SidewalkWet and GrassWet.
CRF
In contrast, we can define a Conditional [Markov] Random Field (CRF) with respect to a graph $G$ as
a set of random variables corresponding to the nodes in $G$, a subset $\{X_i\}_{i=1}^n$ of which are assumed to always be observed and remaining variables $\{Y_i\}_{i=1}^m$
with a conditional distribution $P(\{Y_i\}_{i=1}^m|\{X_i\}_{i=1}^n)$ that is Markov with respect to $G$
The Difference
For both MRFs and CRFs, we typically fit a model that we can then use for conditional inference in diverse settings (as in the rain example above). However, while the MRF has no consistently designated "observed variables" and needs a joint distribution over all variables that adheres to the Markov constraints of $G$, a CRF:
designates a subset of variables as "observed"
only defines a conditional distribution on non-observed given observed variables; it does not model the probability of the observed variables (if distributions are expressed in terms of parameters, this is often seen as a benefit since parameters are not wasted in explaining the probability of things that will always be known)
needs only obey Markov constraints with respect to the unobserved variables (i.e. the distribution over unobserved variables can depend arbitrarily on the observed variables while inference is at least as tractable as for the MRF on $G$)
Since a CRF does not need to obey Markov constraints on the observed variables $\{X_i\}$, these are typically not even shown in graphical representations of a CRF (possibly a point of confusion sometimes). Instead, the CRF on $G$ is defined as an MRF on a graph $G'$ where nodes are only included for the $\{Y_i\}$s and where the parameters of the joint distribution of $\{Y_i\}$s are functions of the $\{X_i\}$s, thus conditionally defining a distribution of $\{Y_i\}$s given the $\{X_i\}$s.
Example
As a final example, the following linear-chain MRF would indicate that all of the $Y_i$ variables are conditionally independent of $X_1, X_2, ... X_{n-1}$ given a known value of $X_n$:
In contrast, a CRF defined on the same $G$ with the same designation of $\{X_i\}$s as being always observed, would allow for distributions of the $\{Y_i\}$s that depend arbitrarily on any of the $\{X_i\}$s.
Conclusion
So, although ("yes") the conditional distribution of a MRF on $G$ given designated observed variables can be considered to be a CRF with respect to $G$ (since it defines a conditional distribution that obeys the Markov constraints of $G$), it is somewhat degenerate, and does not achieve the generality of CRFs on $G$. Instead, the appropriate recipe would be, given an MRF on $G$, define an MRF on the non-observed subset of $G$ with parameters of the MRF expressed as the output of parameterized functions of the observed variables, training the function parameters to maximize the likelihood of the resulting conditional MRFs on labeled data.
In addition to the potential savings of model paramters, increased expressiveness of conditional model, and retention of inference efficiency, a final important point about the CRF recipe is that, for discrete models (and a large subset of non-discrete models), despite the expressiveness of the CRF family, the log-likelihood can be expressed as a convex function of the function parameters allowing for global optimization with gradient descent.
See also: the original crf paper and this tutorial
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
Let's contrast conditional inference under MRFs with modeling using a CRF, settling on definitions along the way, and then address the original question.
MRF
A Markov Random Field (MRF) with respect t
|
What's the difference between a Markov Random Field and a Conditional Random Field?
Let's contrast conditional inference under MRFs with modeling using a CRF, settling on definitions along the way, and then address the original question.
MRF
A Markov Random Field (MRF) with respect to a graph $G$ is
a set of random variables (or random "elements" if you like) corresponding to the nodes in $G$ (thus, a "random field")
with a joint distribution that is Markov with respect to $G$; that is, the joint probability distribution associated with this MRF is subject to the Markov constraint given by G: for any two variables, $V_i$ and $V_j$, the value of $V_i$ is conditionally independent of $V_j$ given its neighbors $\mathcal{B}_i$. In this case, it is said that the joint probability distribution $P(\{V_i\})$ factorizes according to $G$.
Conditional Inference Under an MRF
Since an MRF represents a joint distribution over many variables that obeys Markov constraints, then we can compute conditional probability distributions given observed values of some variables.
For example, if I have a joint distribution over four random variables: IsRaining, SprinklerOn, SidewalkWet, and GrassWet, then on Monday I might want to infer the joint probability distribution over IsRaining and SprinklerOn given that I have observed SidewalkWet=False and GrassWet=True. On Tuesday, I might want to infer the joint probability distribution over IsRaining and SprinklerOn given that I have observed SidewalkWet=True and GrassWet=True.
In other words, we can use the same MRF model to make inferences in these two different situations, but we wouldn't say that we've changed the model. In fact, although we observed SidewalkWet and GrassWet in both cases described here, the MRF itself doesn't have "observed variables" per se---all variables have the same status in the eyes of the MRF, so the MRF also models, e.g., the joint distribution of SidewalkWet and GrassWet.
CRF
In contrast, we can define a Conditional [Markov] Random Field (CRF) with respect to a graph $G$ as
a set of random variables corresponding to the nodes in $G$, a subset $\{X_i\}_{i=1}^n$ of which are assumed to always be observed and remaining variables $\{Y_i\}_{i=1}^m$
with a conditional distribution $P(\{Y_i\}_{i=1}^m|\{X_i\}_{i=1}^n)$ that is Markov with respect to $G$
The Difference
For both MRFs and CRFs, we typically fit a model that we can then use for conditional inference in diverse settings (as in the rain example above). However, while the MRF has no consistently designated "observed variables" and needs a joint distribution over all variables that adheres to the Markov constraints of $G$, a CRF:
designates a subset of variables as "observed"
only defines a conditional distribution on non-observed given observed variables; it does not model the probability of the observed variables (if distributions are expressed in terms of parameters, this is often seen as a benefit since parameters are not wasted in explaining the probability of things that will always be known)
needs only obey Markov constraints with respect to the unobserved variables (i.e. the distribution over unobserved variables can depend arbitrarily on the observed variables while inference is at least as tractable as for the MRF on $G$)
Since a CRF does not need to obey Markov constraints on the observed variables $\{X_i\}$, these are typically not even shown in graphical representations of a CRF (possibly a point of confusion sometimes). Instead, the CRF on $G$ is defined as an MRF on a graph $G'$ where nodes are only included for the $\{Y_i\}$s and where the parameters of the joint distribution of $\{Y_i\}$s are functions of the $\{X_i\}$s, thus conditionally defining a distribution of $\{Y_i\}$s given the $\{X_i\}$s.
Example
As a final example, the following linear-chain MRF would indicate that all of the $Y_i$ variables are conditionally independent of $X_1, X_2, ... X_{n-1}$ given a known value of $X_n$:
In contrast, a CRF defined on the same $G$ with the same designation of $\{X_i\}$s as being always observed, would allow for distributions of the $\{Y_i\}$s that depend arbitrarily on any of the $\{X_i\}$s.
Conclusion
So, although ("yes") the conditional distribution of a MRF on $G$ given designated observed variables can be considered to be a CRF with respect to $G$ (since it defines a conditional distribution that obeys the Markov constraints of $G$), it is somewhat degenerate, and does not achieve the generality of CRFs on $G$. Instead, the appropriate recipe would be, given an MRF on $G$, define an MRF on the non-observed subset of $G$ with parameters of the MRF expressed as the output of parameterized functions of the observed variables, training the function parameters to maximize the likelihood of the resulting conditional MRFs on labeled data.
In addition to the potential savings of model paramters, increased expressiveness of conditional model, and retention of inference efficiency, a final important point about the CRF recipe is that, for discrete models (and a large subset of non-discrete models), despite the expressiveness of the CRF family, the log-likelihood can be expressed as a convex function of the function parameters allowing for global optimization with gradient descent.
See also: the original crf paper and this tutorial
|
What's the difference between a Markov Random Field and a Conditional Random Field?
Let's contrast conditional inference under MRFs with modeling using a CRF, settling on definitions along the way, and then address the original question.
MRF
A Markov Random Field (MRF) with respect t
|
10,456
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
MRF vs Bayes nets: Unpreciesly (but normally) speaking, there are two types of graphical models: undirected graphical models and directed graphical models(one more type, for instance Tanner graph). The former is also known as Markov Random Fields/Markov network and the later Bayes nets/Bayesian network. (Sometimes the independence assumptions in both can be represented by chordal graphs)
Markov implies the way it factorizes and random field means a particular distribution among those defined by an undirected model.
CRF $\in$ MRF: When some variables are observed we can use the same undirected graph representation(as the undirected graphs) and parameterization to encode a conditional distribution $P(Y|X)$ where $Y$ is a set of target variables and $X$ is a (disjoint) set of observed variables.
And the only difference lies in that for a standard Markov network the normalization term sums over X and Y but for CRF the term sums over only Y.
Reference:
Undirected graphical models (Markov random fields)
Probabilistic Graphical Models Principles and Techniques (2009, The MIT Press)
Markov random fields
|
What's the difference between a Markov Random Field and a Conditional Random Field?
|
MRF vs Bayes nets: Unpreciesly (but normally) speaking, there are two types of graphical models: undirected graphical models and directed graphical models(one more type, for instance Tanner graph). Th
|
What's the difference between a Markov Random Field and a Conditional Random Field?
MRF vs Bayes nets: Unpreciesly (but normally) speaking, there are two types of graphical models: undirected graphical models and directed graphical models(one more type, for instance Tanner graph). The former is also known as Markov Random Fields/Markov network and the later Bayes nets/Bayesian network. (Sometimes the independence assumptions in both can be represented by chordal graphs)
Markov implies the way it factorizes and random field means a particular distribution among those defined by an undirected model.
CRF $\in$ MRF: When some variables are observed we can use the same undirected graph representation(as the undirected graphs) and parameterization to encode a conditional distribution $P(Y|X)$ where $Y$ is a set of target variables and $X$ is a (disjoint) set of observed variables.
And the only difference lies in that for a standard Markov network the normalization term sums over X and Y but for CRF the term sums over only Y.
Reference:
Undirected graphical models (Markov random fields)
Probabilistic Graphical Models Principles and Techniques (2009, The MIT Press)
Markov random fields
|
What's the difference between a Markov Random Field and a Conditional Random Field?
MRF vs Bayes nets: Unpreciesly (but normally) speaking, there are two types of graphical models: undirected graphical models and directed graphical models(one more type, for instance Tanner graph). Th
|
10,457
|
Is there a statistical application that requires strong consistency?
|
If you need a reference for the answer in my comment above, here is one, from Andrew Gelman's blog:
Which reminds me of Lucien Le Cam’s reply when I asked him once whether he could think of any examples where the distinction between the strong law of large numbers (convergence with probability 1) and the weak law (convergence in probability) made any difference. Le Cam replied, No, he did not know of any examples. Le Cam was the theoretical statistician’s theoretical statistician, so there’s your answer.
One could maybe add that the real importance of this different modes of convergence lies in the mathematics, that they permit the use of different mathematical techniques, in the development of the theory, only. And that might be important enough, but for the development of theory, not in the concrete practical applications.
|
Is there a statistical application that requires strong consistency?
|
If you need a reference for the answer in my comment above, here is one, from Andrew Gelman's blog:
Which reminds me of Lucien Le Cam’s reply when I asked him once whether he could think of any examp
|
Is there a statistical application that requires strong consistency?
If you need a reference for the answer in my comment above, here is one, from Andrew Gelman's blog:
Which reminds me of Lucien Le Cam’s reply when I asked him once whether he could think of any examples where the distinction between the strong law of large numbers (convergence with probability 1) and the weak law (convergence in probability) made any difference. Le Cam replied, No, he did not know of any examples. Le Cam was the theoretical statistician’s theoretical statistician, so there’s your answer.
One could maybe add that the real importance of this different modes of convergence lies in the mathematics, that they permit the use of different mathematical techniques, in the development of the theory, only. And that might be important enough, but for the development of theory, not in the concrete practical applications.
|
Is there a statistical application that requires strong consistency?
If you need a reference for the answer in my comment above, here is one, from Andrew Gelman's blog:
Which reminds me of Lucien Le Cam’s reply when I asked him once whether he could think of any examp
|
10,458
|
Is there a nonparametric equivalent of Tukey HSD?
|
I did a little google research because I found the question quite interesting, these tests have been mentioned:
Nemenyi-Damico-Wolfe-Dunn test (link, there is an r-package for doing the test)
Dwass-Steel-Chritchlow-Fligner (link, Conover WJ, Practical Nonparametric Statistics (3rd edition). Wiley 1999.
Conover-Inman test (link, same as above)
I didn't know any of these and I don't know if any of these is available in JMP. If not: There are people doing a standard anova but simply replacing the dependent values by their ranks. Then you could use Tukey's HSD again.
|
Is there a nonparametric equivalent of Tukey HSD?
|
I did a little google research because I found the question quite interesting, these tests have been mentioned:
Nemenyi-Damico-Wolfe-Dunn test (link, there is an r-package for doing the test)
Dwass-S
|
Is there a nonparametric equivalent of Tukey HSD?
I did a little google research because I found the question quite interesting, these tests have been mentioned:
Nemenyi-Damico-Wolfe-Dunn test (link, there is an r-package for doing the test)
Dwass-Steel-Chritchlow-Fligner (link, Conover WJ, Practical Nonparametric Statistics (3rd edition). Wiley 1999.
Conover-Inman test (link, same as above)
I didn't know any of these and I don't know if any of these is available in JMP. If not: There are people doing a standard anova but simply replacing the dependent values by their ranks. Then you could use Tukey's HSD again.
|
Is there a nonparametric equivalent of Tukey HSD?
I did a little google research because I found the question quite interesting, these tests have been mentioned:
Nemenyi-Damico-Wolfe-Dunn test (link, there is an r-package for doing the test)
Dwass-S
|
10,459
|
Is there a nonparametric equivalent of Tukey HSD?
|
There is kruskalmc function in pgirmess package in R. Description of the test:
Multiple comparison test between treatments or treatments versus
control after Kruskal-Wallis test.
|
Is there a nonparametric equivalent of Tukey HSD?
|
There is kruskalmc function in pgirmess package in R. Description of the test:
Multiple comparison test between treatments or treatments versus
control after Kruskal-Wallis test.
|
Is there a nonparametric equivalent of Tukey HSD?
There is kruskalmc function in pgirmess package in R. Description of the test:
Multiple comparison test between treatments or treatments versus
control after Kruskal-Wallis test.
|
Is there a nonparametric equivalent of Tukey HSD?
There is kruskalmc function in pgirmess package in R. Description of the test:
Multiple comparison test between treatments or treatments versus
control after Kruskal-Wallis test.
|
10,460
|
Is there a nonparametric equivalent of Tukey HSD?
|
If you want to test for an effect using many Wilcoxon statistics, You can go about by calculating the range of your statistics, and then simulating the distribution of the range under the "all effect are null" hypothesis. I do not think you will find tables for the distribution of the range of sample from a Wilcoxon distribution.
|
Is there a nonparametric equivalent of Tukey HSD?
|
If you want to test for an effect using many Wilcoxon statistics, You can go about by calculating the range of your statistics, and then simulating the distribution of the range under the "all effect
|
Is there a nonparametric equivalent of Tukey HSD?
If you want to test for an effect using many Wilcoxon statistics, You can go about by calculating the range of your statistics, and then simulating the distribution of the range under the "all effect are null" hypothesis. I do not think you will find tables for the distribution of the range of sample from a Wilcoxon distribution.
|
Is there a nonparametric equivalent of Tukey HSD?
If you want to test for an effect using many Wilcoxon statistics, You can go about by calculating the range of your statistics, and then simulating the distribution of the range under the "all effect
|
10,461
|
Is there a nonparametric equivalent of Tukey HSD?
|
JMP does Steel-Dwass comparisons. Use 'Fit Y by X' then on the 'Oneway Analysis of ...' menu choose 'Nonparametric' -> 'Nonparametric Multiple Comparisons' -> 'Steel-Dwass All Pairs'
|
Is there a nonparametric equivalent of Tukey HSD?
|
JMP does Steel-Dwass comparisons. Use 'Fit Y by X' then on the 'Oneway Analysis of ...' menu choose 'Nonparametric' -> 'Nonparametric Multiple Comparisons' -> 'Steel-Dwass All Pairs'
|
Is there a nonparametric equivalent of Tukey HSD?
JMP does Steel-Dwass comparisons. Use 'Fit Y by X' then on the 'Oneway Analysis of ...' menu choose 'Nonparametric' -> 'Nonparametric Multiple Comparisons' -> 'Steel-Dwass All Pairs'
|
Is there a nonparametric equivalent of Tukey HSD?
JMP does Steel-Dwass comparisons. Use 'Fit Y by X' then on the 'Oneway Analysis of ...' menu choose 'Nonparametric' -> 'Nonparametric Multiple Comparisons' -> 'Steel-Dwass All Pairs'
|
10,462
|
Why the names Type 1, 2 error?
|
Great question, motivated me to Google it :) Per Wikipedia (with minor formatting edits):
A type I error (or error of the first kind) is the incorrect rejection of a true null hypothesis.
A type II error (or error of the second kind) is the failure to reject a false null hypothesis.
Further down the page it discusses the etymology:
In 1928, Jerzy Neyman (1894–1981) and Egon Pearson (1895–1980), both
eminent statisticians, discussed the problems associated with
"deciding whether or not a particular sample may be judged as likely
to have been randomly drawn from a certain population" ...
"...in testing hypotheses two considerations must be kept in view, (1)
we must be able to reduce the chance of rejecting a true hypothesis to
as low a value as desired; (2) the test must be so devised that it
will reject the hypothesis tested when it is likely to be false."
They also noted that, in deciding whether to fail to reject, or reject a particular hypothesis amongst a "set of alternative hypotheses", $H_1$, $H_2$, . . ., it was easy to make an error:
"...[and] these errors will be of two kinds:
(I) we reject $H_0$ [i.e.,
the hypothesis to be tested] when it is true
(II) we fail to reject
$H_0$ when some alternative hypothesis $H_A$ or $H_1$ is true."
In the same paper they call these two sources of error, errors of type I and errors of type II respectively.
So it looks like the first type of error was based on Fisher's original work on significance testing. The second type of error was based on Neyman and Pearson's extension of Fisher's work, namely the introduction of the alternative hypothesis and hence hypothesis testing. See here for more detail.
It appears that the order in which these types of errors were identified correspond to their number, as given by Neyman and Pearson.
|
Why the names Type 1, 2 error?
|
Great question, motivated me to Google it :) Per Wikipedia (with minor formatting edits):
A type I error (or error of the first kind) is the incorrect rejection of a true null hypothesis.
A type II
|
Why the names Type 1, 2 error?
Great question, motivated me to Google it :) Per Wikipedia (with minor formatting edits):
A type I error (or error of the first kind) is the incorrect rejection of a true null hypothesis.
A type II error (or error of the second kind) is the failure to reject a false null hypothesis.
Further down the page it discusses the etymology:
In 1928, Jerzy Neyman (1894–1981) and Egon Pearson (1895–1980), both
eminent statisticians, discussed the problems associated with
"deciding whether or not a particular sample may be judged as likely
to have been randomly drawn from a certain population" ...
"...in testing hypotheses two considerations must be kept in view, (1)
we must be able to reduce the chance of rejecting a true hypothesis to
as low a value as desired; (2) the test must be so devised that it
will reject the hypothesis tested when it is likely to be false."
They also noted that, in deciding whether to fail to reject, or reject a particular hypothesis amongst a "set of alternative hypotheses", $H_1$, $H_2$, . . ., it was easy to make an error:
"...[and] these errors will be of two kinds:
(I) we reject $H_0$ [i.e.,
the hypothesis to be tested] when it is true
(II) we fail to reject
$H_0$ when some alternative hypothesis $H_A$ or $H_1$ is true."
In the same paper they call these two sources of error, errors of type I and errors of type II respectively.
So it looks like the first type of error was based on Fisher's original work on significance testing. The second type of error was based on Neyman and Pearson's extension of Fisher's work, namely the introduction of the alternative hypothesis and hence hypothesis testing. See here for more detail.
It appears that the order in which these types of errors were identified correspond to their number, as given by Neyman and Pearson.
|
Why the names Type 1, 2 error?
Great question, motivated me to Google it :) Per Wikipedia (with minor formatting edits):
A type I error (or error of the first kind) is the incorrect rejection of a true null hypothesis.
A type II
|
10,463
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
|
Update: Thanks to this discussion, scikit-learn was updated and works correctly now. Its LDA source code can be found here. The original issue was due to a minor bug (see this github discussion) and my answer was actually not pointing at it correctly (apologies for any confusion caused). As all of that does not matter anymore (bug is fixed), I edited my answer to focus on how LDA can be solved via SVD, which is the default algorithm in scikit-learn.
After defining within- and between-class scatter matrices $\boldsymbol \Sigma_W$ and $\boldsymbol \Sigma_B$, the standard LDA calculation, as pointed out in your question, is to take eigenvectors of $\boldsymbol \Sigma_W^{-1} \boldsymbol \Sigma_B$ as discriminant axes (see e.g. here). The same axes, however, can be computed in a slightly different way, exploiting a whitening matrix:
Compute $\boldsymbol \Sigma_W^{-1/2}$. This is a whitening transformation with respect to the pooled within-class covariance (see my linked answer for details).
Note that if you have eigen-decomposition $\boldsymbol \Sigma_W = \mathbf{U}\mathbf{S}\mathbf{U}^\top$, then $\boldsymbol \Sigma_W^{-1/2}=\mathbf{U}\mathbf{S}^{-1/2}\mathbf{U}^\top$. Note also that one compute the same by doing SVD of pooled within-class data: $\mathbf{X}_W = \mathbf{U} \mathbf{L} \mathbf{V}^\top \Rightarrow \boldsymbol\Sigma_W^{-1/2}=\mathbf{U}\mathbf{L}^{-1}\mathbf{U}^\top$.
Find eigenvectors of $\boldsymbol \Sigma_W^{-1/2} \boldsymbol \Sigma_B \boldsymbol \Sigma_W^{-1/2}$, let us call them $\mathbf{A}^*$.
Again, note that one can compute it by doing SVD of between-class data $\mathbf{X}_B$, transformed with $\boldsymbol \Sigma_W^{-1/2}$, i.e. between-class data whitened with respect to the within-class covariance.
The discriminant axes $\mathbf A$ will be given by $\boldsymbol \Sigma_W^{-1/2} \mathbf{A}^*$, i.e. by the principal axes of transformed data, transformed again.
Indeed, if $\mathbf a^*$ is an eigenvector of the above matrix, then $$\boldsymbol \Sigma_W^{-1/2} \boldsymbol \Sigma_B \boldsymbol \Sigma_W^{-1/2}\mathbf a^* = \lambda \mathbf a^*,$$ and multiplying from the left by $\boldsymbol \Sigma_W^{-1/2}$ and defining $\mathbf a = \boldsymbol \Sigma_W^{-1/2}\mathbf a^*$, we immediately obtain: $$\boldsymbol \Sigma_W^{-1} \boldsymbol \Sigma_B \mathbf a = \lambda \mathbf a.$$
In summary, LDA is equivalent to whitening the matrix of class means with respect to within-class covariance, doing PCA on the class means, and back-transforming the resulting principal axes into the original (unwhitened) space.
This is pointed out e.g. in The Elements of Statistical Learning, section 4.3.3. In scikit-learn this is the default way to compute LDA because SVD of a data matrix is numerically more stable than eigen-decomposition of its covariance matrix.
Note that one can use any whitening transformation instead of $\boldsymbol \Sigma_W^{-1/2}$ and everything will still work exactly the same. In scikit-learn $\mathbf{L}^{-1}\mathbf{U}^\top$ is used (instead of $\mathbf{U}\mathbf{L}^{-1}\mathbf{U}^\top$), and it works just fine (contrary to what was originally written in my answer).
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
|
Update: Thanks to this discussion, scikit-learn was updated and works correctly now. Its LDA source code can be found here. The original issue was due to a minor bug (see this github discussion) and
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
Update: Thanks to this discussion, scikit-learn was updated and works correctly now. Its LDA source code can be found here. The original issue was due to a minor bug (see this github discussion) and my answer was actually not pointing at it correctly (apologies for any confusion caused). As all of that does not matter anymore (bug is fixed), I edited my answer to focus on how LDA can be solved via SVD, which is the default algorithm in scikit-learn.
After defining within- and between-class scatter matrices $\boldsymbol \Sigma_W$ and $\boldsymbol \Sigma_B$, the standard LDA calculation, as pointed out in your question, is to take eigenvectors of $\boldsymbol \Sigma_W^{-1} \boldsymbol \Sigma_B$ as discriminant axes (see e.g. here). The same axes, however, can be computed in a slightly different way, exploiting a whitening matrix:
Compute $\boldsymbol \Sigma_W^{-1/2}$. This is a whitening transformation with respect to the pooled within-class covariance (see my linked answer for details).
Note that if you have eigen-decomposition $\boldsymbol \Sigma_W = \mathbf{U}\mathbf{S}\mathbf{U}^\top$, then $\boldsymbol \Sigma_W^{-1/2}=\mathbf{U}\mathbf{S}^{-1/2}\mathbf{U}^\top$. Note also that one compute the same by doing SVD of pooled within-class data: $\mathbf{X}_W = \mathbf{U} \mathbf{L} \mathbf{V}^\top \Rightarrow \boldsymbol\Sigma_W^{-1/2}=\mathbf{U}\mathbf{L}^{-1}\mathbf{U}^\top$.
Find eigenvectors of $\boldsymbol \Sigma_W^{-1/2} \boldsymbol \Sigma_B \boldsymbol \Sigma_W^{-1/2}$, let us call them $\mathbf{A}^*$.
Again, note that one can compute it by doing SVD of between-class data $\mathbf{X}_B$, transformed with $\boldsymbol \Sigma_W^{-1/2}$, i.e. between-class data whitened with respect to the within-class covariance.
The discriminant axes $\mathbf A$ will be given by $\boldsymbol \Sigma_W^{-1/2} \mathbf{A}^*$, i.e. by the principal axes of transformed data, transformed again.
Indeed, if $\mathbf a^*$ is an eigenvector of the above matrix, then $$\boldsymbol \Sigma_W^{-1/2} \boldsymbol \Sigma_B \boldsymbol \Sigma_W^{-1/2}\mathbf a^* = \lambda \mathbf a^*,$$ and multiplying from the left by $\boldsymbol \Sigma_W^{-1/2}$ and defining $\mathbf a = \boldsymbol \Sigma_W^{-1/2}\mathbf a^*$, we immediately obtain: $$\boldsymbol \Sigma_W^{-1} \boldsymbol \Sigma_B \mathbf a = \lambda \mathbf a.$$
In summary, LDA is equivalent to whitening the matrix of class means with respect to within-class covariance, doing PCA on the class means, and back-transforming the resulting principal axes into the original (unwhitened) space.
This is pointed out e.g. in The Elements of Statistical Learning, section 4.3.3. In scikit-learn this is the default way to compute LDA because SVD of a data matrix is numerically more stable than eigen-decomposition of its covariance matrix.
Note that one can use any whitening transformation instead of $\boldsymbol \Sigma_W^{-1/2}$ and everything will still work exactly the same. In scikit-learn $\mathbf{L}^{-1}\mathbf{U}^\top$ is used (instead of $\mathbf{U}\mathbf{L}^{-1}\mathbf{U}^\top$), and it works just fine (contrary to what was originally written in my answer).
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
Update: Thanks to this discussion, scikit-learn was updated and works correctly now. Its LDA source code can be found here. The original issue was due to a minor bug (see this github discussion) and
|
10,464
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
|
Just to close this question, the discussed issue with the LDA has been fixed in scikit-learn 0.15.2.
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
|
Just to close this question, the discussed issue with the LDA has been fixed in scikit-learn 0.15.2.
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
Just to close this question, the discussed issue with the LDA has been fixed in scikit-learn 0.15.2.
|
Why is Python's scikit-learn LDA not working correctly and how does it compute LDA via SVD?
Just to close this question, the discussed issue with the LDA has been fixed in scikit-learn 0.15.2.
|
10,465
|
Definition of autocorrelation time (for effective sample size)
|
First, the appropriate definition of "effective sample size" is IMO linked to a quite specific question. If $X_1, X_2, \ldots$ are identically distributed with mean $\mu$ and variance 1 the empirical mean
$$\hat{\mu} = \frac{1}{n} \sum_{k=1}^n X_k$$
is an unbiased estimator of $\mu$. But what about its variance? For independent variables the variance is $n^{-1}$. For a weakly stationary time series, the variance of $\hat{\mu}$ is
$$\frac{1}{n^2} \sum_{k, l=1}^n \text{cov}(X_k, X_l) = \frac{1}{n}\left(1 + 2\left(\frac{n-1}{n} \rho_1 + \frac{n-2}{n} \rho_2 + \ldots + \frac{1}{n} \rho_{n-1}\right) \right) \simeq \frac{\tau_a}{n}.$$
The approximation is valid for large enough $n$. If we define $n_{\text{eff}} = n/\tau_a$, the variance of the empirical mean for a weakly stationary time series is approximately $n_{\text{eff}}^{-1}$, which is the same variance as if we had $n_{\text{eff}}$ independent samples. Thus $n_{\text{eff}} = n/\tau_a$ is an appropriate definition if we ask for the variance of the empirical average. It might be inappropriate for other purposes.
With a negative correlation between observations it is certainly possible that the variance can become smaller than $n^{-1}$ ($n_{\text{eff}} > n$). This is a well known variance reduction technique in Monto Carlo integration: If we introduce negative correlation between the variables instead of correlation 0, we can reduce the variance without increasing the sample size.
|
Definition of autocorrelation time (for effective sample size)
|
First, the appropriate definition of "effective sample size" is IMO linked to a quite specific question. If $X_1, X_2, \ldots$ are identically distributed with mean $\mu$ and variance 1 the empirical
|
Definition of autocorrelation time (for effective sample size)
First, the appropriate definition of "effective sample size" is IMO linked to a quite specific question. If $X_1, X_2, \ldots$ are identically distributed with mean $\mu$ and variance 1 the empirical mean
$$\hat{\mu} = \frac{1}{n} \sum_{k=1}^n X_k$$
is an unbiased estimator of $\mu$. But what about its variance? For independent variables the variance is $n^{-1}$. For a weakly stationary time series, the variance of $\hat{\mu}$ is
$$\frac{1}{n^2} \sum_{k, l=1}^n \text{cov}(X_k, X_l) = \frac{1}{n}\left(1 + 2\left(\frac{n-1}{n} \rho_1 + \frac{n-2}{n} \rho_2 + \ldots + \frac{1}{n} \rho_{n-1}\right) \right) \simeq \frac{\tau_a}{n}.$$
The approximation is valid for large enough $n$. If we define $n_{\text{eff}} = n/\tau_a$, the variance of the empirical mean for a weakly stationary time series is approximately $n_{\text{eff}}^{-1}$, which is the same variance as if we had $n_{\text{eff}}$ independent samples. Thus $n_{\text{eff}} = n/\tau_a$ is an appropriate definition if we ask for the variance of the empirical average. It might be inappropriate for other purposes.
With a negative correlation between observations it is certainly possible that the variance can become smaller than $n^{-1}$ ($n_{\text{eff}} > n$). This is a well known variance reduction technique in Monto Carlo integration: If we introduce negative correlation between the variables instead of correlation 0, we can reduce the variance without increasing the sample size.
|
Definition of autocorrelation time (for effective sample size)
First, the appropriate definition of "effective sample size" is IMO linked to a quite specific question. If $X_1, X_2, \ldots$ are identically distributed with mean $\mu$ and variance 1 the empirical
|
10,466
|
Definition of autocorrelation time (for effective sample size)
|
see
http://arxiv.org/pdf/1403.5536v1.pdf
and
https://cran.r-project.org/web/packages/mcmcse/mcmcse.pdf
for effective sample size. I think the alternative formulation using the ratio of sample variance and asymptotic Markov chain variance via batch mean is more appropriate estimator.
|
Definition of autocorrelation time (for effective sample size)
|
see
http://arxiv.org/pdf/1403.5536v1.pdf
and
https://cran.r-project.org/web/packages/mcmcse/mcmcse.pdf
for effective sample size. I think the alternative formulation using the ratio of sample varian
|
Definition of autocorrelation time (for effective sample size)
see
http://arxiv.org/pdf/1403.5536v1.pdf
and
https://cran.r-project.org/web/packages/mcmcse/mcmcse.pdf
for effective sample size. I think the alternative formulation using the ratio of sample variance and asymptotic Markov chain variance via batch mean is more appropriate estimator.
|
Definition of autocorrelation time (for effective sample size)
see
http://arxiv.org/pdf/1403.5536v1.pdf
and
https://cran.r-project.org/web/packages/mcmcse/mcmcse.pdf
for effective sample size. I think the alternative formulation using the ratio of sample varian
|
10,467
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
|
There exist many such coefficients (most are expressed here). Just try to meditate on what are the consequences of the differences in formulas, especially when you compute a matrix of coefficients.
Imagine, for example, that objects 1 and 2 similar, as objects 3 and 4 are. But 1 and 2 have many of the attributes on the list while 3 and 4 have only few attributes. In this case, Russell-Rao (proportion of co-attributes to the total number of attributes under consideration) will be high for pair 1-2 and low for pair 3-4. But Jaccard (proportion of co-attributes to the combined number of attributes both objects have = probability that if either object has an attribute then they both have it) will be high for both pairs 1-2 and 3-4.
This adjustment for the base level of "saturation by attributes" makes Jaccard so popular and more useful than Russell-Rao, e.g. in cluster analysis or multidimensional scaling. You might, in a sense, further refine the above adjustment by selecting Kulczynski-2 measure which is the arithmetic mean probability that if one object has an attribute, the other object has it too:
$$
(\frac{a}{a+b} + \frac{a}{a+c}) /2
$$
Here the base (or field) of attributes for the two objects is not pooled, as in Jaccard, but is own for each of the two objects. Consequently, if the objects differ greatly on the number of attributes they have, and all its attributes the "poorer" object shares with the "richer" one, Kulczynski will be high whereas Jaccard will be moderate.
Or you could prefer to compute geometric mean probability that if one object has an attribute, the other object has it too, which yields Ochiai measure:
$$
\sqrt {\frac{a}{a+b} \frac{a}{a+c}}
$$
Because product increases weaker than sum when only one of the terms grows, Ochiai will be really high only if both of the two proportions (probabilities) are high, which implies that to be considered similar by Ochiai the objects must share the great shares of their attributes. In short, Ochiai curbs similarity if $b$ and $c$ are unequal. Ochiai is in fact the cosine similarity measure (and Russell-Rao is the dot product similarity).
P.S.
Is it just because for some datasets, the simultaneous absence of both
attributes (d) doesn't convey any information?
Speaking of similarity measures, one shouldn't mix nominal dichotomous attributes (e.g. female, male) with binary attributes (present vs absent). Binary attribute isn't symmetric (in general), - if you and I share a characteristic, it is the basis for calling us similar; if you and I both miss the characteristic, it may or may not be considered the evidence of similarity, depending on the context of the study. Hence the divergent treatment of $d$ is possible.
Note also that if you wish to compute similarity between objects based on 1+ nominal attributes (dichotomous or polytomous), recode each such variable into the set of dummy binary variables. Then the recommended similarity measure to compute will be Dice (which, when computed for 1+ sets of dummy variables, is equivalent to Ochiai and Kulczynski-2).
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
|
There exist many such coefficients (most are expressed here). Just try to meditate on what are the consequences of the differences in formulas, especially when you compute a matrix of coefficients.
Im
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
There exist many such coefficients (most are expressed here). Just try to meditate on what are the consequences of the differences in formulas, especially when you compute a matrix of coefficients.
Imagine, for example, that objects 1 and 2 similar, as objects 3 and 4 are. But 1 and 2 have many of the attributes on the list while 3 and 4 have only few attributes. In this case, Russell-Rao (proportion of co-attributes to the total number of attributes under consideration) will be high for pair 1-2 and low for pair 3-4. But Jaccard (proportion of co-attributes to the combined number of attributes both objects have = probability that if either object has an attribute then they both have it) will be high for both pairs 1-2 and 3-4.
This adjustment for the base level of "saturation by attributes" makes Jaccard so popular and more useful than Russell-Rao, e.g. in cluster analysis or multidimensional scaling. You might, in a sense, further refine the above adjustment by selecting Kulczynski-2 measure which is the arithmetic mean probability that if one object has an attribute, the other object has it too:
$$
(\frac{a}{a+b} + \frac{a}{a+c}) /2
$$
Here the base (or field) of attributes for the two objects is not pooled, as in Jaccard, but is own for each of the two objects. Consequently, if the objects differ greatly on the number of attributes they have, and all its attributes the "poorer" object shares with the "richer" one, Kulczynski will be high whereas Jaccard will be moderate.
Or you could prefer to compute geometric mean probability that if one object has an attribute, the other object has it too, which yields Ochiai measure:
$$
\sqrt {\frac{a}{a+b} \frac{a}{a+c}}
$$
Because product increases weaker than sum when only one of the terms grows, Ochiai will be really high only if both of the two proportions (probabilities) are high, which implies that to be considered similar by Ochiai the objects must share the great shares of their attributes. In short, Ochiai curbs similarity if $b$ and $c$ are unequal. Ochiai is in fact the cosine similarity measure (and Russell-Rao is the dot product similarity).
P.S.
Is it just because for some datasets, the simultaneous absence of both
attributes (d) doesn't convey any information?
Speaking of similarity measures, one shouldn't mix nominal dichotomous attributes (e.g. female, male) with binary attributes (present vs absent). Binary attribute isn't symmetric (in general), - if you and I share a characteristic, it is the basis for calling us similar; if you and I both miss the characteristic, it may or may not be considered the evidence of similarity, depending on the context of the study. Hence the divergent treatment of $d$ is possible.
Note also that if you wish to compute similarity between objects based on 1+ nominal attributes (dichotomous or polytomous), recode each such variable into the set of dummy binary variables. Then the recommended similarity measure to compute will be Dice (which, when computed for 1+ sets of dummy variables, is equivalent to Ochiai and Kulczynski-2).
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
There exist many such coefficients (most are expressed here). Just try to meditate on what are the consequences of the differences in formulas, especially when you compute a matrix of coefficients.
Im
|
10,468
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
|
The usefulness of the Tanimoto coefficient over the traditional accuracy (i.e. Russell-Rao) is evident in image analysis, when comparing a segmentation to a gold-standard. Consider these two images:
In each of these images which are binary 'masks', we have two objects of the same size but placed at slightly different locations, and we want to evaluate to what extent these objects are identical in shape and position by assessing their overlap. Usually one (e.g. the purple mask) is a segmentation (produced by a computer algorithm), e.g. this could be an attempt to locate the heart from a medical image. The other, (e.g. green) is the gold-standard (i.e. the heart, as identified by an expert clinician). Where there is white colour, the two shapes overlap. Black pixels are background.
The two images are identical (i.e. the outcome of the segmentation algorithm, as well as the gold standard, are the same in both images), except for a lot of background "padding" in the second image (e.g. this could represent two experiments with two different x-ray machines, where the 2nd machine had a wider ray covering more body area, but otherwise the size of the heart is the same in both image sets).
Clearly, since the segmentation and gold standard in both images are identical, if we evaluate the segmentation accuracy against the gold standard, we would like our metric to output the same 'accuracy' result in both experiments.
However, if we attempt to assess the quality of the segmentation using the Russel-Rao approach, we would get a misleadingly high accuracy for the right image (close to 100%), because "background pixels identified correctly as background pixels" contribute towards the overall accuracy of the sets, and background pixels are disproportionately represented in the second set. The objects whose overlap we want to evaluate in medical segmentation are often tiny specks in a massive background, so this is not very useful to us. Furthermore, this would lead to problems if we were trying to compare the accuracy of one segmentation algorithm to another, and the two were evaluated on images of different size! (or, equivalently, at different scales). The scaling / size of the embedding image should not make a difference in the evaluation of a segmentation against a gold-standard!.
By contrast, the tanimoto coefficient does not care about the background pixels, making it invariant to 'scale'. So as far as the tanimoto coefficient is concerned, the similarity of both these sets will be identical, making it a far more useful similarity metric for us to use to evaluate the quality of a segmentation algorithm.
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
|
The usefulness of the Tanimoto coefficient over the traditional accuracy (i.e. Russell-Rao) is evident in image analysis, when comparing a segmentation to a gold-standard. Consider these two images:
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
The usefulness of the Tanimoto coefficient over the traditional accuracy (i.e. Russell-Rao) is evident in image analysis, when comparing a segmentation to a gold-standard. Consider these two images:
In each of these images which are binary 'masks', we have two objects of the same size but placed at slightly different locations, and we want to evaluate to what extent these objects are identical in shape and position by assessing their overlap. Usually one (e.g. the purple mask) is a segmentation (produced by a computer algorithm), e.g. this could be an attempt to locate the heart from a medical image. The other, (e.g. green) is the gold-standard (i.e. the heart, as identified by an expert clinician). Where there is white colour, the two shapes overlap. Black pixels are background.
The two images are identical (i.e. the outcome of the segmentation algorithm, as well as the gold standard, are the same in both images), except for a lot of background "padding" in the second image (e.g. this could represent two experiments with two different x-ray machines, where the 2nd machine had a wider ray covering more body area, but otherwise the size of the heart is the same in both image sets).
Clearly, since the segmentation and gold standard in both images are identical, if we evaluate the segmentation accuracy against the gold standard, we would like our metric to output the same 'accuracy' result in both experiments.
However, if we attempt to assess the quality of the segmentation using the Russel-Rao approach, we would get a misleadingly high accuracy for the right image (close to 100%), because "background pixels identified correctly as background pixels" contribute towards the overall accuracy of the sets, and background pixels are disproportionately represented in the second set. The objects whose overlap we want to evaluate in medical segmentation are often tiny specks in a massive background, so this is not very useful to us. Furthermore, this would lead to problems if we were trying to compare the accuracy of one segmentation algorithm to another, and the two were evaluated on images of different size! (or, equivalently, at different scales). The scaling / size of the embedding image should not make a difference in the evaluation of a segmentation against a gold-standard!.
By contrast, the tanimoto coefficient does not care about the background pixels, making it invariant to 'scale'. So as far as the tanimoto coefficient is concerned, the similarity of both these sets will be identical, making it a far more useful similarity metric for us to use to evaluate the quality of a segmentation algorithm.
|
Similarity Coefficients for binary data: Why choose Jaccard over Russell and Rao?
The usefulness of the Tanimoto coefficient over the traditional accuracy (i.e. Russell-Rao) is evident in image analysis, when comparing a segmentation to a gold-standard. Consider these two images:
|
10,469
|
What are the assumptions of the permutation test?
|
The literature distinguishes between two types of permutations tests: (1) the randomization test is the permutation test where exchangeability is satisfied by random assignment of experimental units to conditions; (2) the permutation test is the exact same test but applied to a situation where other assumptions (i.e., other than random assignment) are needed to justify exchangeability.
Some references regarding the naming conventions (i.e., randomization vs permutation):
Kempthorne & Doerfler, Biometrika, 1969; Edgington & Onghena, Randomization Tests, 4th Ed., 2007]
For assumptions, the randomization test (i.e., Fisher's randomization test for experimental data) only requires what Donald Rubin refers to as the stable unit treatment value assumption (SUTVA). See Rubin's 1980 comment on Basu's paper in JASA. SUTVA is also one of the fundamental assumptions (along with strong ignorability) for causal inference under the Neyman-Rubin potential outcomes model (cf. Paul Holland's 1986 JASA paper). Essentially, SUTVA says that there is no interference between units and that the treatment conditions are the same for all recipients. More formally, SUTVA assumes independence between the potential outcomes and the assignment mechanism.
Consider the two-sample problem with participants randomly assigned to a control group or a treatment group. SUTVA would be violated if, for example, two study participants were acquainted and the assignment status of one of them exerted some influence on the outcome of the other. This is what is meant by no interference between units.
The above discussion applies to the randomization test wherein participants were randomly assigned to groups. In the context of a permutation test, SUTVA is also necessary, but it may not rest on the randomization because there was none.
In the absence of random assignment, the validity of permutation tests may rely on distributional assumptions like identical shape of distribution or symmetric distributions (depending on the test) to satisfy exchangeability (see Box and Anderson, JRSSB, 1955]).
In an interesting paper, Hayes, Psych Methods, 1996, shows through simulation how Type I error rates may become inflated if permutation tests are used with non-randomized data.
|
What are the assumptions of the permutation test?
|
The literature distinguishes between two types of permutations tests: (1) the randomization test is the permutation test where exchangeability is satisfied by random assignment of experimental units t
|
What are the assumptions of the permutation test?
The literature distinguishes between two types of permutations tests: (1) the randomization test is the permutation test where exchangeability is satisfied by random assignment of experimental units to conditions; (2) the permutation test is the exact same test but applied to a situation where other assumptions (i.e., other than random assignment) are needed to justify exchangeability.
Some references regarding the naming conventions (i.e., randomization vs permutation):
Kempthorne & Doerfler, Biometrika, 1969; Edgington & Onghena, Randomization Tests, 4th Ed., 2007]
For assumptions, the randomization test (i.e., Fisher's randomization test for experimental data) only requires what Donald Rubin refers to as the stable unit treatment value assumption (SUTVA). See Rubin's 1980 comment on Basu's paper in JASA. SUTVA is also one of the fundamental assumptions (along with strong ignorability) for causal inference under the Neyman-Rubin potential outcomes model (cf. Paul Holland's 1986 JASA paper). Essentially, SUTVA says that there is no interference between units and that the treatment conditions are the same for all recipients. More formally, SUTVA assumes independence between the potential outcomes and the assignment mechanism.
Consider the two-sample problem with participants randomly assigned to a control group or a treatment group. SUTVA would be violated if, for example, two study participants were acquainted and the assignment status of one of them exerted some influence on the outcome of the other. This is what is meant by no interference between units.
The above discussion applies to the randomization test wherein participants were randomly assigned to groups. In the context of a permutation test, SUTVA is also necessary, but it may not rest on the randomization because there was none.
In the absence of random assignment, the validity of permutation tests may rely on distributional assumptions like identical shape of distribution or symmetric distributions (depending on the test) to satisfy exchangeability (see Box and Anderson, JRSSB, 1955]).
In an interesting paper, Hayes, Psych Methods, 1996, shows through simulation how Type I error rates may become inflated if permutation tests are used with non-randomized data.
|
What are the assumptions of the permutation test?
The literature distinguishes between two types of permutations tests: (1) the randomization test is the permutation test where exchangeability is satisfied by random assignment of experimental units t
|
10,470
|
Does the Gibbs Sampling algorithm guarantee detailed balance?
|
You tried to show detailed balance for the Markov chain that is obtained by considering one transition of the Markov chain to be the 'Gibbs sweep' where you sample each component in turn from its conditional distribution. For this chain, detailed balance is not satisfied. The point is rather that each sampling of a particular component from its conditional distribution is a transition that satisfies detailed balance. It would be more accurate to say that Gibbs sampling is a special case of a slightly generalized Metropolis-Hastings, where you alternate between multiple different proposals. More details follow.
The sweeps do not satisfy detailed balance
I construct a counterexample. Consider two Bernoulli variables ($X_1,X_2$), with probabilities as shown in the following table:
\begin{equation}
\begin{array}{ccc}
& X_2 = 0 & X_2 = 1 \\
X_1 = 0 & \frac{1}{3} & \frac{1}{3} \\
X_1 = 1 & 0 & \frac{1}{3}
\end{array}
\end{equation}
Assume the Gibbs sweep is ordered so that $X_1$ is sampled first. Moving from state $(0,0)$ to state $(1,1)$ in one move is impossible, since it would require going from $(0,0)$ to $(1,0)$. However, moving from $(1,1)$ to $(0,0)$ has positive probability, namely $\frac{1}{4}$. Hence we conclude that detailed balance is not satisfied.
However, this chain still has a stationary distribution that is the correct one. Detailed balance is a sufficient, but not necessary, condition for converging to the target distribution.
The component-wise moves satisfy detailed balance
Consider a two-variate state where we sample the first variable from its conditional distribution. A move between $(x_1,x_2)$ and $(y_1,y_2)$ has zero probability in both directions if $x_2 \neq y_2$ and thus for these cases detailed balance clearly holds. Next, consider $x_2 = y_2$:
\begin{equation}
\pi(x_1,x_2) \mathrm{Prob}((x_1,x_2) \rightarrow (y_1,x_2)) = \pi(x_1,x_2)\,p(y_1 \mid X_2 = x_2) = \pi(x_1,x_2) \, \frac{\pi(y_1,x_2)}{\sum_z \pi(z,x_2)} \\
= \pi(y_1,x_2) \, \frac{\pi(x_1,x_2)}{\sum_z \pi(z,x_2)} = \pi(y_1,x_2) \,p(x_1 \mid X_2 = x_2) = \pi(y_1,x_2) \mathrm{Prob}((y_1,x_2) \rightarrow (x_1,x_2)).
\end{equation}
How the component-wise moves are Metropolis-Hastings moves?
Sampling from the first component, our proposal distribution is the conditional distribution. (For all other components, we propose the current values with probability $1$). Considering a move from $(x_1, x_2)$ to $(y_1, y_2)$, the ratio of target probabilities is
\begin{equation}
\frac{\pi(y_1,x_2)}{\pi(x_1,x_2)}.
\end{equation}
But the ratio of proposal probabilities is
\begin{equation}
\frac{\mathrm{Prob}((y_1,x_2) \rightarrow (x_1,x_2))}{\mathrm{Prob}((x_1,x_2) \rightarrow (y_1,x_2))} = \frac{\frac{\pi(x_1,x_2)}{\sum_z \pi(z,x_2)}}{\frac{\pi(y_1,x_2)}{\sum_z \pi(z,x_2)}} = \frac{\pi(x_1,x_2)}{\pi(y_1,x_2)}.
\end{equation}
So, the ratio of target probabilities and the ratio of proposal probabilities are reciprocals, and thus the acceptance probability will be $1$. In this sense, each of the moves in the Gibbs sampler are special cases of Metropolis-Hastings moves. However, the overall algorithm viewed in this light is a slight generalization of the typically presented Metropolis-Hastings algorithm in that you have alternate between different proposal distributions (one for each component of the target variable).
|
Does the Gibbs Sampling algorithm guarantee detailed balance?
|
You tried to show detailed balance for the Markov chain that is obtained by considering one transition of the Markov chain to be the 'Gibbs sweep' where you sample each component in turn from its cond
|
Does the Gibbs Sampling algorithm guarantee detailed balance?
You tried to show detailed balance for the Markov chain that is obtained by considering one transition of the Markov chain to be the 'Gibbs sweep' where you sample each component in turn from its conditional distribution. For this chain, detailed balance is not satisfied. The point is rather that each sampling of a particular component from its conditional distribution is a transition that satisfies detailed balance. It would be more accurate to say that Gibbs sampling is a special case of a slightly generalized Metropolis-Hastings, where you alternate between multiple different proposals. More details follow.
The sweeps do not satisfy detailed balance
I construct a counterexample. Consider two Bernoulli variables ($X_1,X_2$), with probabilities as shown in the following table:
\begin{equation}
\begin{array}{ccc}
& X_2 = 0 & X_2 = 1 \\
X_1 = 0 & \frac{1}{3} & \frac{1}{3} \\
X_1 = 1 & 0 & \frac{1}{3}
\end{array}
\end{equation}
Assume the Gibbs sweep is ordered so that $X_1$ is sampled first. Moving from state $(0,0)$ to state $(1,1)$ in one move is impossible, since it would require going from $(0,0)$ to $(1,0)$. However, moving from $(1,1)$ to $(0,0)$ has positive probability, namely $\frac{1}{4}$. Hence we conclude that detailed balance is not satisfied.
However, this chain still has a stationary distribution that is the correct one. Detailed balance is a sufficient, but not necessary, condition for converging to the target distribution.
The component-wise moves satisfy detailed balance
Consider a two-variate state where we sample the first variable from its conditional distribution. A move between $(x_1,x_2)$ and $(y_1,y_2)$ has zero probability in both directions if $x_2 \neq y_2$ and thus for these cases detailed balance clearly holds. Next, consider $x_2 = y_2$:
\begin{equation}
\pi(x_1,x_2) \mathrm{Prob}((x_1,x_2) \rightarrow (y_1,x_2)) = \pi(x_1,x_2)\,p(y_1 \mid X_2 = x_2) = \pi(x_1,x_2) \, \frac{\pi(y_1,x_2)}{\sum_z \pi(z,x_2)} \\
= \pi(y_1,x_2) \, \frac{\pi(x_1,x_2)}{\sum_z \pi(z,x_2)} = \pi(y_1,x_2) \,p(x_1 \mid X_2 = x_2) = \pi(y_1,x_2) \mathrm{Prob}((y_1,x_2) \rightarrow (x_1,x_2)).
\end{equation}
How the component-wise moves are Metropolis-Hastings moves?
Sampling from the first component, our proposal distribution is the conditional distribution. (For all other components, we propose the current values with probability $1$). Considering a move from $(x_1, x_2)$ to $(y_1, y_2)$, the ratio of target probabilities is
\begin{equation}
\frac{\pi(y_1,x_2)}{\pi(x_1,x_2)}.
\end{equation}
But the ratio of proposal probabilities is
\begin{equation}
\frac{\mathrm{Prob}((y_1,x_2) \rightarrow (x_1,x_2))}{\mathrm{Prob}((x_1,x_2) \rightarrow (y_1,x_2))} = \frac{\frac{\pi(x_1,x_2)}{\sum_z \pi(z,x_2)}}{\frac{\pi(y_1,x_2)}{\sum_z \pi(z,x_2)}} = \frac{\pi(x_1,x_2)}{\pi(y_1,x_2)}.
\end{equation}
So, the ratio of target probabilities and the ratio of proposal probabilities are reciprocals, and thus the acceptance probability will be $1$. In this sense, each of the moves in the Gibbs sampler are special cases of Metropolis-Hastings moves. However, the overall algorithm viewed in this light is a slight generalization of the typically presented Metropolis-Hastings algorithm in that you have alternate between different proposal distributions (one for each component of the target variable).
|
Does the Gibbs Sampling algorithm guarantee detailed balance?
You tried to show detailed balance for the Markov chain that is obtained by considering one transition of the Markov chain to be the 'Gibbs sweep' where you sample each component in turn from its cond
|
10,471
|
What does the y axis in a kernel density plot mean? [duplicate]
|
You are correct that
the area under the curve of a density function represents the probability of getting an x value between a range of x values
But remember area is not just height: width is also important. So if you have a spike at 0, if the width is very small (say 0.1) then the height can be quite a bit higher than 1 (up to 10, if the spike is perfectly rectangular, since $0.1\times10 = 1$) without violating any rules of probability. The height of the spike is large, but the area under the spike is still quite small.
For the same reason, density functions of continuous random variables can have values greater than one. If you plot a Normal(0,0.0001) pdf, for example, you will find that the peak is quite high.
I missed your second question initially, but $P(x<2)=\frac{150}{1000}=.15$ means that the area under the curve to the left of 2 (i.e., the area of the two spikes at 0 and 1, more or less) is .15.
|
What does the y axis in a kernel density plot mean? [duplicate]
|
You are correct that
the area under the curve of a density function represents the probability of getting an x value between a range of x values
But remember area is not just height: width is also i
|
What does the y axis in a kernel density plot mean? [duplicate]
You are correct that
the area under the curve of a density function represents the probability of getting an x value between a range of x values
But remember area is not just height: width is also important. So if you have a spike at 0, if the width is very small (say 0.1) then the height can be quite a bit higher than 1 (up to 10, if the spike is perfectly rectangular, since $0.1\times10 = 1$) without violating any rules of probability. The height of the spike is large, but the area under the spike is still quite small.
For the same reason, density functions of continuous random variables can have values greater than one. If you plot a Normal(0,0.0001) pdf, for example, you will find that the peak is quite high.
I missed your second question initially, but $P(x<2)=\frac{150}{1000}=.15$ means that the area under the curve to the left of 2 (i.e., the area of the two spikes at 0 and 1, more or less) is .15.
|
What does the y axis in a kernel density plot mean? [duplicate]
You are correct that
the area under the curve of a density function represents the probability of getting an x value between a range of x values
But remember area is not just height: width is also i
|
10,472
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
I think it will be helpful to separate the question into two parts:
What is the functional form of your empirical distribution? and
What does that functional form imply about the generating process in your network?
The first question is a statistics question. If you've applied the methods of Clauset et al. for fitting the power-law distribution and those methods gave you a $p>0.1$ for the upper-tail fit, then you're allowed to say that the upper tail (looking at your figure, this is $x\geq15$ or so) is plausibly power-law distributed. If the methods gave you $p<0.1$ then you can't say that, even if the fit looks good to the eye. Deciding whether the log-normal fit is better means basically doing the same thing. Can you reject that model as a generating process for the degree distribution data you have? If not, then you're allowed to put the log-normal into the "plausible" category.
As a small technical point, degrees are integer quantities, while a log-normal distribution requires a continuous variable, so the two are not really compatible (unless you are only talking about $x\gg1$ when the difference between integers and real values for these kinds of questions becomes negligible). To do the statistics properly, you'd want to write down the pdf for a "log-normally" distributed integer quantity, derive estimators for it and apply those to your data.
The second question is actually harder of the two. As some people pointed out in the comments above, there are many mechanisms that produce power-law distributions and preferential attachment (in all its variations and glory) is just one of many. Thus, observing a power-law distribution in your data (even a genuine one that passes the necessary statistical tests) is not sufficient evidence to conclude that the generating process was preferential attachment. Or, more generally, if you have a mechanism A that produces some pattern X in data (e.g., a log-normal degree distribution in your network). Observing pattern X in your data is not evidence that your data were produced by mechanism A. The data are consistent with A, but that doesn't mean A is the right mechanism.
To really show that A is the answer, you have to test its mechanistic assumptions directly and show that they also hold for your system, and preferably also show that other predictions of the mechanism also hold in the data. A really great example of the assumption-testing part was done by Sid Redner (see Figure 4 of this paper), in which he showed that for citation networks, the linear preferential attachment assumption actually holds in the data.
Finally, the term "scale-free network" is overloaded in the literature, so I would strongly suggest avoiding it. People use it to refer to networks with power-law degree distributions and to networks grown by (linear) preferential attachment. But as we just explained, these two things are not the same, so using a single term to refer to both is just confusing. In your case, a log-normal distribution is completely inconsistent with the classic linear preferential attachment mechanism, so if you decide that log-normal is the answer to question 1 (in my answer), then it would imply that your network is not 'scale free' in that sense. The fact that the upper tail is 'okay' as a power-law distribution would be meaningless in that case, since there is always some portion of the upper tail of any empirical distribution that will pass that test (and it will pass because the test loses power when there isn't much data to go on, which is exactly what happens in the extreme upper tail).
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
I think it will be helpful to separate the question into two parts:
What is the functional form of your empirical distribution? and
What does that functional form imply about the generating process i
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
I think it will be helpful to separate the question into two parts:
What is the functional form of your empirical distribution? and
What does that functional form imply about the generating process in your network?
The first question is a statistics question. If you've applied the methods of Clauset et al. for fitting the power-law distribution and those methods gave you a $p>0.1$ for the upper-tail fit, then you're allowed to say that the upper tail (looking at your figure, this is $x\geq15$ or so) is plausibly power-law distributed. If the methods gave you $p<0.1$ then you can't say that, even if the fit looks good to the eye. Deciding whether the log-normal fit is better means basically doing the same thing. Can you reject that model as a generating process for the degree distribution data you have? If not, then you're allowed to put the log-normal into the "plausible" category.
As a small technical point, degrees are integer quantities, while a log-normal distribution requires a continuous variable, so the two are not really compatible (unless you are only talking about $x\gg1$ when the difference between integers and real values for these kinds of questions becomes negligible). To do the statistics properly, you'd want to write down the pdf for a "log-normally" distributed integer quantity, derive estimators for it and apply those to your data.
The second question is actually harder of the two. As some people pointed out in the comments above, there are many mechanisms that produce power-law distributions and preferential attachment (in all its variations and glory) is just one of many. Thus, observing a power-law distribution in your data (even a genuine one that passes the necessary statistical tests) is not sufficient evidence to conclude that the generating process was preferential attachment. Or, more generally, if you have a mechanism A that produces some pattern X in data (e.g., a log-normal degree distribution in your network). Observing pattern X in your data is not evidence that your data were produced by mechanism A. The data are consistent with A, but that doesn't mean A is the right mechanism.
To really show that A is the answer, you have to test its mechanistic assumptions directly and show that they also hold for your system, and preferably also show that other predictions of the mechanism also hold in the data. A really great example of the assumption-testing part was done by Sid Redner (see Figure 4 of this paper), in which he showed that for citation networks, the linear preferential attachment assumption actually holds in the data.
Finally, the term "scale-free network" is overloaded in the literature, so I would strongly suggest avoiding it. People use it to refer to networks with power-law degree distributions and to networks grown by (linear) preferential attachment. But as we just explained, these two things are not the same, so using a single term to refer to both is just confusing. In your case, a log-normal distribution is completely inconsistent with the classic linear preferential attachment mechanism, so if you decide that log-normal is the answer to question 1 (in my answer), then it would imply that your network is not 'scale free' in that sense. The fact that the upper tail is 'okay' as a power-law distribution would be meaningless in that case, since there is always some portion of the upper tail of any empirical distribution that will pass that test (and it will pass because the test loses power when there isn't much data to go on, which is exactly what happens in the extreme upper tail).
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
I think it will be helpful to separate the question into two parts:
What is the functional form of your empirical distribution? and
What does that functional form imply about the generating process i
|
10,473
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
Coming to this site after counting my bubble distributions and using power law for viscosity data.
Skimming through the example data sets in the power law paper by Clauset et al. they have put up some real horrors of data sets, far from the power law data sets to support their argument. Just from common sense I certainly wouldn't have tried to fit a power law function to the whole data range for most of them. However, self-scaling behaviour in the real world may be valid across a part of an observed system, but break down when some system property reaches a physical or functional limit.
The very readable papers below refer to growth-curve fitting for ecologists, with a good discussion on power law and related distributions, based on observation-based models of population behaviour.
The author is much more pragmatic than Clauset et al. Quoting:
"...if the aim is only a best fit and scales outside the scale window of the data set are not discussed, any model may suffice given that it produces a good fit and produces no maxima or minima inside the scale window studied." "One is often forced to fit the same model, as other researchers have applied to their data, in order to be able to compare parameter values, but one can do this in addition to the application of a better fitting model or models with better expected shapes, or both." Restful words.
Tjørve, E. (2003). Shapes and functions of species-area curves: A review of possible models. Journal of Biogeography, 30(6), 827-835.
Tjørve, E. (2009). Shapes and functions of species-area curves (ii): A review of new models and parameterizations. Journal of Biogeography, 36(8), 1435-1445.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
Coming to this site after counting my bubble distributions and using power law for viscosity data.
Skimming through the example data sets in the power law paper by Clauset et al. they have put up some
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
Coming to this site after counting my bubble distributions and using power law for viscosity data.
Skimming through the example data sets in the power law paper by Clauset et al. they have put up some real horrors of data sets, far from the power law data sets to support their argument. Just from common sense I certainly wouldn't have tried to fit a power law function to the whole data range for most of them. However, self-scaling behaviour in the real world may be valid across a part of an observed system, but break down when some system property reaches a physical or functional limit.
The very readable papers below refer to growth-curve fitting for ecologists, with a good discussion on power law and related distributions, based on observation-based models of population behaviour.
The author is much more pragmatic than Clauset et al. Quoting:
"...if the aim is only a best fit and scales outside the scale window of the data set are not discussed, any model may suffice given that it produces a good fit and produces no maxima or minima inside the scale window studied." "One is often forced to fit the same model, as other researchers have applied to their data, in order to be able to compare parameter values, but one can do this in addition to the application of a better fitting model or models with better expected shapes, or both." Restful words.
Tjørve, E. (2003). Shapes and functions of species-area curves: A review of possible models. Journal of Biogeography, 30(6), 827-835.
Tjørve, E. (2009). Shapes and functions of species-area curves (ii): A review of new models and parameterizations. Journal of Biogeography, 36(8), 1435-1445.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
Coming to this site after counting my bubble distributions and using power law for viscosity data.
Skimming through the example data sets in the power law paper by Clauset et al. they have put up some
|
10,474
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
I'm having a related conversation about this associated with a question I asked elsewhere on CrossValidated. There, I asked whether the gamma distribution was a good distribution to use in a simulation of a social network where the probability of ties is endogenous to some continuous "popularity" characteristic of nodes. @NickCox suggested that I use the lognormal distribution instead. I replied that the lognormal distribution has some theoretical justification as the underlying process describing popularity because popularity could be interpreted as the product of many positive-valued random variables (e.g., wealth, income, height, sexual prowess, fighting prowess, IQ). This makes more sense to me than the theoretical justification for the power law, and it jives with the empirical data, which suggests that the power law's shape is too inflexible to explain the cross-network variation in the degree distribution. The lognormal, by comparison, has a very flexible shape, with the mode approaching zero for high variance. Furthermore, it makes sense that the skewness of the degree distribution should increase with the variance due to the preferential attachment effect.
In sum, I think that the lognormal distribution fits your data best because the lognormal distribution describes the underlying process of degree distribution formation better than the power law or exponential distributions.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
I'm having a related conversation about this associated with a question I asked elsewhere on CrossValidated. There, I asked whether the gamma distribution was a good distribution to use in a simulatio
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
I'm having a related conversation about this associated with a question I asked elsewhere on CrossValidated. There, I asked whether the gamma distribution was a good distribution to use in a simulation of a social network where the probability of ties is endogenous to some continuous "popularity" characteristic of nodes. @NickCox suggested that I use the lognormal distribution instead. I replied that the lognormal distribution has some theoretical justification as the underlying process describing popularity because popularity could be interpreted as the product of many positive-valued random variables (e.g., wealth, income, height, sexual prowess, fighting prowess, IQ). This makes more sense to me than the theoretical justification for the power law, and it jives with the empirical data, which suggests that the power law's shape is too inflexible to explain the cross-network variation in the degree distribution. The lognormal, by comparison, has a very flexible shape, with the mode approaching zero for high variance. Furthermore, it makes sense that the skewness of the degree distribution should increase with the variance due to the preferential attachment effect.
In sum, I think that the lognormal distribution fits your data best because the lognormal distribution describes the underlying process of degree distribution formation better than the power law or exponential distributions.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
I'm having a related conversation about this associated with a question I asked elsewhere on CrossValidated. There, I asked whether the gamma distribution was a good distribution to use in a simulatio
|
10,475
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
The above results show that degree distribution can be both power law and lognormal, which may suggest that small world and scale free properties co-exist in the network under studied. To examine whether the network is scale free (with constant scaling parameter) with preferential attachment, experimental design is often required. In the article of Sid Redner mentioned above, growth rate is used to understand the growth mechanism. While Gallos, Song and Makse use boxes to cover the network, and conclude that network degree distribution follows power law distribution, if NB(lB) ~ lB^-dB. Or examing the relationships between cluster coefficient and degree (whether the relationship satisfies power law). Otherwise, it is discussed that hierachical networks have both small world and scale free network properties. (typing Fractal scale free, there are many articles suggested by google).
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
The above results show that degree distribution can be both power law and lognormal, which may suggest that small world and scale free properties co-exist in the network under studied. To examine whet
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
The above results show that degree distribution can be both power law and lognormal, which may suggest that small world and scale free properties co-exist in the network under studied. To examine whether the network is scale free (with constant scaling parameter) with preferential attachment, experimental design is often required. In the article of Sid Redner mentioned above, growth rate is used to understand the growth mechanism. While Gallos, Song and Makse use boxes to cover the network, and conclude that network degree distribution follows power law distribution, if NB(lB) ~ lB^-dB. Or examing the relationships between cluster coefficient and degree (whether the relationship satisfies power law). Otherwise, it is discussed that hierachical networks have both small world and scale free network properties. (typing Fractal scale free, there are many articles suggested by google).
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
The above results show that degree distribution can be both power law and lognormal, which may suggest that small world and scale free properties co-exist in the network under studied. To examine whet
|
10,476
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
Check out this 2019 article: https://www.nature.com/articles/s41467-019-08746-5
Contrary to the claims of much of network science, applying robust statistical tools to nearly 1000 social, biological, technical, transportation, and information networks showed that a log-normal distribution fit the data as well or better than power laws.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
Check out this 2019 article: https://www.nature.com/articles/s41467-019-08746-5
Contrary to the claims of much of network science, applying robust statistical tools to nearly 1000 social, biological,
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
Check out this 2019 article: https://www.nature.com/articles/s41467-019-08746-5
Contrary to the claims of much of network science, applying robust statistical tools to nearly 1000 social, biological, technical, transportation, and information networks showed that a log-normal distribution fit the data as well or better than power laws.
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
Check out this 2019 article: https://www.nature.com/articles/s41467-019-08746-5
Contrary to the claims of much of network science, applying robust statistical tools to nearly 1000 social, biological,
|
10,477
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
|
in our work, log normal implies that the underlying system is limit cycle attractive whereas power law implies that it is unstable periodic or chaos if you like. as limit cycle doesn't really exist in nature, this is really a question of degree. of course, chaos too is limited in its representation of systems as being necessarily statistically stable, which is also idealized; but the two form a useful spectrum
we know from the kuramoto model that fully deterministic systems can produce a wide range of distributions, including normal, spontaneously. so the idea that we can infer an underlying mechanism purely from a statistical analysis seems pretty silly. at best, we can disprove the null set. i suggest spending some time reading poincare's original papers if you want more insights into your question
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
|
in our work, log normal implies that the underlying system is limit cycle attractive whereas power law implies that it is unstable periodic or chaos if you like. as limit cycle doesn't really exist in
|
Interpreting the difference between lognormal and power law distribution (network degree distribution)
in our work, log normal implies that the underlying system is limit cycle attractive whereas power law implies that it is unstable periodic or chaos if you like. as limit cycle doesn't really exist in nature, this is really a question of degree. of course, chaos too is limited in its representation of systems as being necessarily statistically stable, which is also idealized; but the two form a useful spectrum
we know from the kuramoto model that fully deterministic systems can produce a wide range of distributions, including normal, spontaneously. so the idea that we can infer an underlying mechanism purely from a statistical analysis seems pretty silly. at best, we can disprove the null set. i suggest spending some time reading poincare's original papers if you want more insights into your question
|
Interpreting the difference between lognormal and power law distribution (network degree distributio
in our work, log normal implies that the underlying system is limit cycle attractive whereas power law implies that it is unstable periodic or chaos if you like. as limit cycle doesn't really exist in
|
10,478
|
What optimization methods work best for LSTMs?
|
Ironically the best Optimizers for LSTMs are themselves LSTMs:
https://arxiv.org/abs/1606.04474
Learning to learn by gradient descent by gradient descent.
The basic idea is to use a neural network (specifically here a LSTM network) to co-learn and teach the gradients of the original network. It's called meta learning.
This method, while proposed by Juergen Schmidhuber in 2000, was only recently shown to out-perform the other optimizers in RNN training. ( see the original paper for a nice graphic)
|
What optimization methods work best for LSTMs?
|
Ironically the best Optimizers for LSTMs are themselves LSTMs:
https://arxiv.org/abs/1606.04474
Learning to learn by gradient descent by gradient descent.
The basic idea is to use a neural network (
|
What optimization methods work best for LSTMs?
Ironically the best Optimizers for LSTMs are themselves LSTMs:
https://arxiv.org/abs/1606.04474
Learning to learn by gradient descent by gradient descent.
The basic idea is to use a neural network (specifically here a LSTM network) to co-learn and teach the gradients of the original network. It's called meta learning.
This method, while proposed by Juergen Schmidhuber in 2000, was only recently shown to out-perform the other optimizers in RNN training. ( see the original paper for a nice graphic)
|
What optimization methods work best for LSTMs?
Ironically the best Optimizers for LSTMs are themselves LSTMs:
https://arxiv.org/abs/1606.04474
Learning to learn by gradient descent by gradient descent.
The basic idea is to use a neural network (
|
10,479
|
What optimization methods work best for LSTMs?
|
There is in general no clear evidence as to which optimisation method to use in what scenario. There has been some analysis in the behaviour of these methods under different scenarios however nothing is conclusive. If you want to dive into this stuff then I recommend:
http://papers.nips.cc/paper/5486-identifying-and-attacking-the-saddle-point-problem-in-high-dimensional-non-convex-optimization.pdf
In order to at least provide you with somewhat of an answer I would argue that often the configuration of your optimisation routine is more important than the actual routine itself.
Moreover I recommend you to look into papers to see what techniques are being used. Alex Graves from example has bene using RMSprop throughout most of his publications on generating sequences.
|
What optimization methods work best for LSTMs?
|
There is in general no clear evidence as to which optimisation method to use in what scenario. There has been some analysis in the behaviour of these methods under different scenarios however nothing
|
What optimization methods work best for LSTMs?
There is in general no clear evidence as to which optimisation method to use in what scenario. There has been some analysis in the behaviour of these methods under different scenarios however nothing is conclusive. If you want to dive into this stuff then I recommend:
http://papers.nips.cc/paper/5486-identifying-and-attacking-the-saddle-point-problem-in-high-dimensional-non-convex-optimization.pdf
In order to at least provide you with somewhat of an answer I would argue that often the configuration of your optimisation routine is more important than the actual routine itself.
Moreover I recommend you to look into papers to see what techniques are being used. Alex Graves from example has bene using RMSprop throughout most of his publications on generating sequences.
|
What optimization methods work best for LSTMs?
There is in general no clear evidence as to which optimisation method to use in what scenario. There has been some analysis in the behaviour of these methods under different scenarios however nothing
|
10,480
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
You have to understand what TSNE does before you use it.
It starts by building a neighboorhood graph between feature vectors based on distance.
The graph connects a node(feature vector) to its n nearest nodes(in terms of distance in feature space). This n is called the perplexity parameter.
The purpose of building this graph is rooted in the sort of sampling TSNE relies on to build its new representation of your feature vectors.
A sequence for TSNE model building is generated using a random walk on your TSNE feature graph.
In my experience... a few of my problems came from reasoning about how feature representation affects the building of this graph. I also play around with the perplexity parameter, as it has an effect on how focused my sampling is.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
You have to understand what TSNE does before you use it.
It starts by building a neighboorhood graph between feature vectors based on distance.
The graph connects a node(feature vector) to its n ne
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
You have to understand what TSNE does before you use it.
It starts by building a neighboorhood graph between feature vectors based on distance.
The graph connects a node(feature vector) to its n nearest nodes(in terms of distance in feature space). This n is called the perplexity parameter.
The purpose of building this graph is rooted in the sort of sampling TSNE relies on to build its new representation of your feature vectors.
A sequence for TSNE model building is generated using a random walk on your TSNE feature graph.
In my experience... a few of my problems came from reasoning about how feature representation affects the building of this graph. I also play around with the perplexity parameter, as it has an effect on how focused my sampling is.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
You have to understand what TSNE does before you use it.
It starts by building a neighboorhood graph between feature vectors based on distance.
The graph connects a node(feature vector) to its n ne
|
10,481
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
It is hard to compare these approaches.
PCA is parameter free. Given the data, you just have to look at the principal components.
On the other hand, t-SNE relies on severe parameters : perplexity, early exaggeration, learning rate, number of iterations - though default values usually provide good results.
So you can't just compare them, you have to compare the PCA to the best result you can achieve with t-SNE (or the best result you achieved over several tries of t-SNE). Otherwise, it would be equivalent to ask "why does my linear model performs better than my (not tuned) gradient boosting model?".
Edit After seeing many questions related to the differences between these two approaches, I wrote this blog post summarizing the pros and cons of each method.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
It is hard to compare these approaches.
PCA is parameter free. Given the data, you just have to look at the principal components.
On the other hand, t-SNE relies on severe parameters : perplexity, ear
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
It is hard to compare these approaches.
PCA is parameter free. Given the data, you just have to look at the principal components.
On the other hand, t-SNE relies on severe parameters : perplexity, early exaggeration, learning rate, number of iterations - though default values usually provide good results.
So you can't just compare them, you have to compare the PCA to the best result you can achieve with t-SNE (or the best result you achieved over several tries of t-SNE). Otherwise, it would be equivalent to ask "why does my linear model performs better than my (not tuned) gradient boosting model?".
Edit After seeing many questions related to the differences between these two approaches, I wrote this blog post summarizing the pros and cons of each method.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
It is hard to compare these approaches.
PCA is parameter free. Given the data, you just have to look at the principal components.
On the other hand, t-SNE relies on severe parameters : perplexity, ear
|
10,482
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
I ran t-sne on a dataset to replace PCA and (despite the bug that Rum Wei noticed) got better results. In my application case, rough pca worked well while rough t-sne gave me random looking results. It was due to the scaling/centering step included in the pca (by default in most packages) but not used in the t-sne.
My points were areas and the distance between them made little sense without previous scaling, it got me from "random looking" to "make sense".
As RUser4512 said, you might also want to test your parameters. On his website, the author recommends a perplexity between 5 and 50 (yours seems quite small), he also warns that too big a perplexity will give you an almost homogeneous sphere of points (which is good to know).
Distill has a very nice article with some interactive visualization that really helps to understand the impact of the parameters.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
I ran t-sne on a dataset to replace PCA and (despite the bug that Rum Wei noticed) got better results. In my application case, rough pca worked well while rough t-sne gave me random looking results. I
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
I ran t-sne on a dataset to replace PCA and (despite the bug that Rum Wei noticed) got better results. In my application case, rough pca worked well while rough t-sne gave me random looking results. It was due to the scaling/centering step included in the pca (by default in most packages) but not used in the t-sne.
My points were areas and the distance between them made little sense without previous scaling, it got me from "random looking" to "make sense".
As RUser4512 said, you might also want to test your parameters. On his website, the author recommends a perplexity between 5 and 50 (yours seems quite small), he also warns that too big a perplexity will give you an almost homogeneous sphere of points (which is good to know).
Distill has a very nice article with some interactive visualization that really helps to understand the impact of the parameters.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
I ran t-sne on a dataset to replace PCA and (despite the bug that Rum Wei noticed) got better results. In my application case, rough pca worked well while rough t-sne gave me random looking results. I
|
10,483
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
An important difference between methods like PCA and SVD with tSNE is that tSNE is using a non-linear scale. This often makes for plots that are more visually balanced but be careful interpreting them in the same manner as you would for PCA. This difference likely accounts for the difference between the plots shown above.
See the following article for more detail on interpreting the non-linear scale of tSNE: https://distill.pub/2016/misread-tsne/ (Wattenberg, et al., "How to Use t-SNE Effectively", Distill, 2016. http://doi.org/10.23915/distill.00002)
It is not unexpected that the tSNE data will be mixing up the "clusters" as they are not that distinct in the PCA data. Some points within clusters 2 and 4 are more distant from the cluster centroid than the difference between the clusters for example. You would get very different clustering results with a different k-parameter. Unless you have a specific biological rationale for using 5 clusters, I would recommend using a graph-based or unsupervised hierarchical clustering approach.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
|
An important difference between methods like PCA and SVD with tSNE is that tSNE is using a non-linear scale. This often makes for plots that are more visually balanced but be careful interpreting them
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
An important difference between methods like PCA and SVD with tSNE is that tSNE is using a non-linear scale. This often makes for plots that are more visually balanced but be careful interpreting them in the same manner as you would for PCA. This difference likely accounts for the difference between the plots shown above.
See the following article for more detail on interpreting the non-linear scale of tSNE: https://distill.pub/2016/misread-tsne/ (Wattenberg, et al., "How to Use t-SNE Effectively", Distill, 2016. http://doi.org/10.23915/distill.00002)
It is not unexpected that the tSNE data will be mixing up the "clusters" as they are not that distinct in the PCA data. Some points within clusters 2 and 4 are more distant from the cluster centroid than the difference between the clusters for example. You would get very different clustering results with a different k-parameter. Unless you have a specific biological rationale for using 5 clusters, I would recommend using a graph-based or unsupervised hierarchical clustering approach.
|
What's wrong with t-SNE vs PCA for dimensional reduction using R?
An important difference between methods like PCA and SVD with tSNE is that tSNE is using a non-linear scale. This often makes for plots that are more visually balanced but be careful interpreting them
|
10,484
|
Specifying a difference in differences model with multiple time periods
|
The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress
$$Y_{ist} = \alpha +\gamma_s (\text{Treatment}_s) + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$
where $D_t \equiv \text{Treatment}_s\cdot d_t$ is a dummy variable which equals one for treatment units $s$ in the post-treatment period ($d_t = 1$) and is zero otherwise. Note that this is a more general formulation of the difference in differences regression which allows for different timings of the treatment for different treated units.
As was pointed out correctly in the comments your proposed solution c) does not work out due to collinearity with the time dummies and the dummy for the post-treatment period. However, a slight variant of this turns out to be a robustness check. Let $\gamma_{s0}$ and $\gamma_{s1}$ be two sets of dummy variables for each control unit $s0$ and each treated unit $s1$, respectively, then interacting the dummies for the treated units with the time variable $t$ and regressing
$$Y_{ist} = \gamma_{s0} + \gamma_{s1}t + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$
includes a unit specific time trend $\gamma_{s1}t$. When you include these unit specific time trends and the difference in differences coefficient $\delta$ does not change significantly you can be more confident about your results. Otherwise you might wonder whether your treatment effect has absorbed differences between treated units due to an underlying time trend (can happen when policies kick in at different points in time).
An example cited in Angrist and Pischke (2009) Mostly Harmless Econometrics is a labor market policy study by Besley and Burgess (2004). In their paper it happens that the inclusion of state-specific time trends kills the estimated treatment effect. Note though that for this robustness check you need more than 3 time periods.
|
Specifying a difference in differences model with multiple time periods
|
The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress
$$Y_{ist} = \alpha +\gamma_s (\text{
|
Specifying a difference in differences model with multiple time periods
The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress
$$Y_{ist} = \alpha +\gamma_s (\text{Treatment}_s) + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$
where $D_t \equiv \text{Treatment}_s\cdot d_t$ is a dummy variable which equals one for treatment units $s$ in the post-treatment period ($d_t = 1$) and is zero otherwise. Note that this is a more general formulation of the difference in differences regression which allows for different timings of the treatment for different treated units.
As was pointed out correctly in the comments your proposed solution c) does not work out due to collinearity with the time dummies and the dummy for the post-treatment period. However, a slight variant of this turns out to be a robustness check. Let $\gamma_{s0}$ and $\gamma_{s1}$ be two sets of dummy variables for each control unit $s0$ and each treated unit $s1$, respectively, then interacting the dummies for the treated units with the time variable $t$ and regressing
$$Y_{ist} = \gamma_{s0} + \gamma_{s1}t + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$
includes a unit specific time trend $\gamma_{s1}t$. When you include these unit specific time trends and the difference in differences coefficient $\delta$ does not change significantly you can be more confident about your results. Otherwise you might wonder whether your treatment effect has absorbed differences between treated units due to an underlying time trend (can happen when policies kick in at different points in time).
An example cited in Angrist and Pischke (2009) Mostly Harmless Econometrics is a labor market policy study by Besley and Burgess (2004). In their paper it happens that the inclusion of state-specific time trends kills the estimated treatment effect. Note though that for this robustness check you need more than 3 time periods.
|
Specifying a difference in differences model with multiple time periods
The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress
$$Y_{ist} = \alpha +\gamma_s (\text{
|
10,485
|
Specifying a difference in differences model with multiple time periods
|
I would like to clarify something (and indirectly address a question in the comments). In particular, it concerns the use of unit-specific linear time trends. As a robustness check, it would appear you are only interacting dummies for treated units (i.e., $\gamma_{1s}$) with a continuous time trend. However, it is actually the case that you are interacting a full set of unit/state dummies (unit/state fixed effects) with a linear time trend variable.
Angrist and Pischke (2009) recommend this approach on page 238 in Mostly Harmless Econometrics. Differences in notation can cause confusion. Reproducing specification 5.2.7:
$$
y_{ist} = \gamma_{0s} + \gamma_{1s} t + \lambda_{t} + \delta D_{st} + X^{'}_{ist}\beta + \varepsilon_{ist},
$$
where $\gamma_{0s}$ is a state-specific intercept, in accordance with the $s$ subscript used in their book. You can view $\gamma_{1s}$ as the state-specific trend coefficient multiplying the time trend variable, $t$. Different papers use different notation. For example, Wolfers (2006) replicates a model incorporating state-specific linear time trends. Reproducing model (1):
$$
y_{s,t} = \sum_{s} State_{s} + \sum_{t} Year_{t} + \sum_{s} State_{s}*Time_{t} + \delta D_{s,t} + \varepsilon_{s,t},
$$
where the model includes state and year fixed effects (i.e., dummies for each state and year). The treatment variable $D_{s,t}$ is when state $s$ adopts a unilateral divorce regime in period $t$. Notice this specification interacts state dummies with a linear time trend (i.e., $Time_{t}$). This is yet another representation of state-specific linear time trends in your model specification.
Unit-specific linear time trends is also addressed nicely in the comments section here.
In sum, you want to interact all unit (group) dummies with a continuous time trend variable.
You can read the paper by Justin Wolfers (2006) for free here.
|
Specifying a difference in differences model with multiple time periods
|
I would like to clarify something (and indirectly address a question in the comments). In particular, it concerns the use of unit-specific linear time trends. As a robustness check, it would appear yo
|
Specifying a difference in differences model with multiple time periods
I would like to clarify something (and indirectly address a question in the comments). In particular, it concerns the use of unit-specific linear time trends. As a robustness check, it would appear you are only interacting dummies for treated units (i.e., $\gamma_{1s}$) with a continuous time trend. However, it is actually the case that you are interacting a full set of unit/state dummies (unit/state fixed effects) with a linear time trend variable.
Angrist and Pischke (2009) recommend this approach on page 238 in Mostly Harmless Econometrics. Differences in notation can cause confusion. Reproducing specification 5.2.7:
$$
y_{ist} = \gamma_{0s} + \gamma_{1s} t + \lambda_{t} + \delta D_{st} + X^{'}_{ist}\beta + \varepsilon_{ist},
$$
where $\gamma_{0s}$ is a state-specific intercept, in accordance with the $s$ subscript used in their book. You can view $\gamma_{1s}$ as the state-specific trend coefficient multiplying the time trend variable, $t$. Different papers use different notation. For example, Wolfers (2006) replicates a model incorporating state-specific linear time trends. Reproducing model (1):
$$
y_{s,t} = \sum_{s} State_{s} + \sum_{t} Year_{t} + \sum_{s} State_{s}*Time_{t} + \delta D_{s,t} + \varepsilon_{s,t},
$$
where the model includes state and year fixed effects (i.e., dummies for each state and year). The treatment variable $D_{s,t}$ is when state $s$ adopts a unilateral divorce regime in period $t$. Notice this specification interacts state dummies with a linear time trend (i.e., $Time_{t}$). This is yet another representation of state-specific linear time trends in your model specification.
Unit-specific linear time trends is also addressed nicely in the comments section here.
In sum, you want to interact all unit (group) dummies with a continuous time trend variable.
You can read the paper by Justin Wolfers (2006) for free here.
|
Specifying a difference in differences model with multiple time periods
I would like to clarify something (and indirectly address a question in the comments). In particular, it concerns the use of unit-specific linear time trends. As a robustness check, it would appear yo
|
10,486
|
How should mixed effects models be compared and or validated?
|
The main problem on model selection in mixed models is to define the degrees of freedom (df) of a model, truly. To compute df of a mixed model, one has to define the number of estimated parameters including fixed and random effects. And this is not straightforward. This paper by Jiming Jiang and others (2008) entitled "Fence methods for mixed model selection" could be applied in such situations. A new related work is this one by Greven, S. & Kneib, T. (2010) entitled "On the behavior of marginal and conditional AIC in linear mixed models". Hope this could be helpful.
|
How should mixed effects models be compared and or validated?
|
The main problem on model selection in mixed models is to define the degrees of freedom (df) of a model, truly. To compute df of a mixed model, one has to define the number of estimated parameters inc
|
How should mixed effects models be compared and or validated?
The main problem on model selection in mixed models is to define the degrees of freedom (df) of a model, truly. To compute df of a mixed model, one has to define the number of estimated parameters including fixed and random effects. And this is not straightforward. This paper by Jiming Jiang and others (2008) entitled "Fence methods for mixed model selection" could be applied in such situations. A new related work is this one by Greven, S. & Kneib, T. (2010) entitled "On the behavior of marginal and conditional AIC in linear mixed models". Hope this could be helpful.
|
How should mixed effects models be compared and or validated?
The main problem on model selection in mixed models is to define the degrees of freedom (df) of a model, truly. To compute df of a mixed model, one has to define the number of estimated parameters inc
|
10,487
|
How should mixed effects models be compared and or validated?
|
One way to compare models (whether mixed or otherwise) is to plot results. Suppose you havae model A and model B; produce the fitted values from each and graph them against each other in a scatter plot. If the values are very similar (using your judgement as to whether they are) choose the simpler model. Another idea is to find the differences between the fitted values and graph these against the independent values; you can also make a density plot of the differences.
In general, I am a proponent of not using statistical tests to compare models (although AIC and its variants certainly have virtues) but rather using judgement. Of course, this has the (dis)advantage of not giving precise answers.
|
How should mixed effects models be compared and or validated?
|
One way to compare models (whether mixed or otherwise) is to plot results. Suppose you havae model A and model B; produce the fitted values from each and graph them against each other in a scatter plo
|
How should mixed effects models be compared and or validated?
One way to compare models (whether mixed or otherwise) is to plot results. Suppose you havae model A and model B; produce the fitted values from each and graph them against each other in a scatter plot. If the values are very similar (using your judgement as to whether they are) choose the simpler model. Another idea is to find the differences between the fitted values and graph these against the independent values; you can also make a density plot of the differences.
In general, I am a proponent of not using statistical tests to compare models (although AIC and its variants certainly have virtues) but rather using judgement. Of course, this has the (dis)advantage of not giving precise answers.
|
How should mixed effects models be compared and or validated?
One way to compare models (whether mixed or otherwise) is to plot results. Suppose you havae model A and model B; produce the fitted values from each and graph them against each other in a scatter plo
|
10,488
|
How likely am I to be descended from a particular person born in the year 1300?
|
Because this question is receiving answers that vary from astronomically small to almost 100%, I would like to offer a simulation to serve as a reference and inspiration for improved solutions.
I call these "flame plots." Each one documents the dispersion of genetic material within a population as it reproduces in discrete generations. The plots are arrays of thin vertical segments depicting people. Each row represents a generation, with the starting one at the top. The descendants of each generation are in the row immediately beneath it.
At the beginning, just one person in a population of size $n$ is marked and plots as red. (It's hard to see, but they are always plotted at the right of the top row.) Their direct descendants are likewise drawn in red; they will show up in completely random positions. Other descendants are plotted as white. Because the population sizes can vary from one generation to the next, a gray border at the right is used to fill empty space.
Here is an array of 20 independent simulation results.
The red genetic material eventually died out in nine of these simulations, leaving survivors in the remaining 11 (55%). (In one scenario, the bottom left, it looks like the entire population eventually died out.) Wherever there were survivors, though, almost all the population contained the red genetic material. This provides evidence that the chance of a randomly selected individual from the last generation containing the red gene is about 50%.
The simulation works by randomly determining a survivorship and a mean birth rate at the beginning of each generation. Survivorship is drawn from a Beta(6,2) distribution: it averages 75%. This number reflects both mortality before adulthood and those people not having any children. Birth rate is drawn from a Gamma(2.8, 1) distribution, so it averages 2.8. The result is a brutal story of insufficient reproductive capacity to compensate for generally high mortality. It represents an extremely pessimistic, worst-case model--but (as I have suggested in comments) the ability of the population to grow is not essential. All that matters in each generation is the proportion of red within the population.
To model reproduction, the current population is thinned down to the survivors by taking a simple random sample of the desired size. These survivors are randomly paired (any odd survivor left over after pairing doesn't get to reproduce). Each pair produces a number of children drawn from a Poisson distribution whose mean is the generation's birth rate. If either of the parents contains the red marker, all the children inherit it: this models the idea of direct descent through either parent.
This example starts with a population of 512 and runs the simulation for 11 generations (12 rows including the start). Variations of this simulation starting with as few as $n=8$ and as many as $2^{14} = 16,384$ people, using different amounts of survivorship and birth rates, all exhibit similar characteristics: by the end of $\log_2(n)$ generations (nine in this case), there's about a 1/3 chance that all the red has died out, but if it hasn't, then the majority of the population is red. Within two or three more generations, almost all the population is red and will remain red (or else the population will die out altogether).
A survivorship of 75% or less in a generation isn't fanciful, by the way. In late 1347 rats infested with bubonic plague first made their way from Asia to Europe; during the next three years, somewhere between 10% and 50% of the European population died as a result. The plague recurred almost once a generation for hundreds of years afterwards (but usually not with the same extreme mortality).
Code
The simulation was created with Mathematica 8:
randomPairs[s_List] := Partition[s[[Ordering[RandomReal[{0, 1}, Length[s]]]]], 2];
next[s_List, survive_, nKids_] := Flatten[ConstantArray[Max[#],
RandomVariate[PoissonDistribution[nKids]]] & /@
randomPairs[RandomSample[s, Ceiling[survive Length[s]]]]]
Partition[Table[
With[{n = 6}, ArrayPlot[NestList[next[#, RandomVariate[BetaDistribution[6, 2]],
RandomVariate[GammaDistribution[3.2, 1]]] &,
Join[ConstantArray[0, 2^n - 1], ConstantArray[1, 1]], n + 2],
AspectRatio -> 2^(n/3)/(2 n),
ColorRules -> {1 -> RGBColor[.6, .1, .1]},
Background -> RGBColor[.9, .9, .9]]
], {i, 1, 20}
], 4] // TableForm
|
How likely am I to be descended from a particular person born in the year 1300?
|
Because this question is receiving answers that vary from astronomically small to almost 100%, I would like to offer a simulation to serve as a reference and inspiration for improved solutions.
I call
|
How likely am I to be descended from a particular person born in the year 1300?
Because this question is receiving answers that vary from astronomically small to almost 100%, I would like to offer a simulation to serve as a reference and inspiration for improved solutions.
I call these "flame plots." Each one documents the dispersion of genetic material within a population as it reproduces in discrete generations. The plots are arrays of thin vertical segments depicting people. Each row represents a generation, with the starting one at the top. The descendants of each generation are in the row immediately beneath it.
At the beginning, just one person in a population of size $n$ is marked and plots as red. (It's hard to see, but they are always plotted at the right of the top row.) Their direct descendants are likewise drawn in red; they will show up in completely random positions. Other descendants are plotted as white. Because the population sizes can vary from one generation to the next, a gray border at the right is used to fill empty space.
Here is an array of 20 independent simulation results.
The red genetic material eventually died out in nine of these simulations, leaving survivors in the remaining 11 (55%). (In one scenario, the bottom left, it looks like the entire population eventually died out.) Wherever there were survivors, though, almost all the population contained the red genetic material. This provides evidence that the chance of a randomly selected individual from the last generation containing the red gene is about 50%.
The simulation works by randomly determining a survivorship and a mean birth rate at the beginning of each generation. Survivorship is drawn from a Beta(6,2) distribution: it averages 75%. This number reflects both mortality before adulthood and those people not having any children. Birth rate is drawn from a Gamma(2.8, 1) distribution, so it averages 2.8. The result is a brutal story of insufficient reproductive capacity to compensate for generally high mortality. It represents an extremely pessimistic, worst-case model--but (as I have suggested in comments) the ability of the population to grow is not essential. All that matters in each generation is the proportion of red within the population.
To model reproduction, the current population is thinned down to the survivors by taking a simple random sample of the desired size. These survivors are randomly paired (any odd survivor left over after pairing doesn't get to reproduce). Each pair produces a number of children drawn from a Poisson distribution whose mean is the generation's birth rate. If either of the parents contains the red marker, all the children inherit it: this models the idea of direct descent through either parent.
This example starts with a population of 512 and runs the simulation for 11 generations (12 rows including the start). Variations of this simulation starting with as few as $n=8$ and as many as $2^{14} = 16,384$ people, using different amounts of survivorship and birth rates, all exhibit similar characteristics: by the end of $\log_2(n)$ generations (nine in this case), there's about a 1/3 chance that all the red has died out, but if it hasn't, then the majority of the population is red. Within two or three more generations, almost all the population is red and will remain red (or else the population will die out altogether).
A survivorship of 75% or less in a generation isn't fanciful, by the way. In late 1347 rats infested with bubonic plague first made their way from Asia to Europe; during the next three years, somewhere between 10% and 50% of the European population died as a result. The plague recurred almost once a generation for hundreds of years afterwards (but usually not with the same extreme mortality).
Code
The simulation was created with Mathematica 8:
randomPairs[s_List] := Partition[s[[Ordering[RandomReal[{0, 1}, Length[s]]]]], 2];
next[s_List, survive_, nKids_] := Flatten[ConstantArray[Max[#],
RandomVariate[PoissonDistribution[nKids]]] & /@
randomPairs[RandomSample[s, Ceiling[survive Length[s]]]]]
Partition[Table[
With[{n = 6}, ArrayPlot[NestList[next[#, RandomVariate[BetaDistribution[6, 2]],
RandomVariate[GammaDistribution[3.2, 1]]] &,
Join[ConstantArray[0, 2^n - 1], ConstantArray[1, 1]], n + 2],
AspectRatio -> 2^(n/3)/(2 n),
ColorRules -> {1 -> RGBColor[.6, .1, .1]},
Background -> RGBColor[.9, .9, .9]]
], {i, 1, 20}
], 4] // TableForm
|
How likely am I to be descended from a particular person born in the year 1300?
Because this question is receiving answers that vary from astronomically small to almost 100%, I would like to offer a simulation to serve as a reference and inspiration for improved solutions.
I call
|
10,489
|
How likely am I to be descended from a particular person born in the year 1300?
|
What happens when you try counting ancestors?
You have 2 parents, 4 grandparents, 8 great grandparents, ... So if you go back $n$ generations then you have $2^n$ ancestors. Let's assume an average generation length of $25$ years. Then there have been about $28$ generations since 1300, which gives us about 268 million ancestors at that time.
This is the right ballpark, but there is something wrong with this calculation, because the population of Earth in 1300 did not mix uniformly, and we are ignoring intermarriage within your ancestral "tree", i.e. we are double counting some ancestors.
Still, I think, this can lead to a correct upper bound on the probability that randomly chosen person in 1300 is your ancestor by taking the ratio $2^{28}$ to the population in 1300
|
How likely am I to be descended from a particular person born in the year 1300?
|
What happens when you try counting ancestors?
You have 2 parents, 4 grandparents, 8 great grandparents, ... So if you go back $n$ generations then you have $2^n$ ancestors. Let's assume an average ge
|
How likely am I to be descended from a particular person born in the year 1300?
What happens when you try counting ancestors?
You have 2 parents, 4 grandparents, 8 great grandparents, ... So if you go back $n$ generations then you have $2^n$ ancestors. Let's assume an average generation length of $25$ years. Then there have been about $28$ generations since 1300, which gives us about 268 million ancestors at that time.
This is the right ballpark, but there is something wrong with this calculation, because the population of Earth in 1300 did not mix uniformly, and we are ignoring intermarriage within your ancestral "tree", i.e. we are double counting some ancestors.
Still, I think, this can lead to a correct upper bound on the probability that randomly chosen person in 1300 is your ancestor by taking the ratio $2^{28}$ to the population in 1300
|
How likely am I to be descended from a particular person born in the year 1300?
What happens when you try counting ancestors?
You have 2 parents, 4 grandparents, 8 great grandparents, ... So if you go back $n$ generations then you have $2^n$ ancestors. Let's assume an average ge
|
10,490
|
How likely am I to be descended from a particular person born in the year 1300?
|
The further back you go, the more likely that you are related to a person that successfully passed along their genes that lived in that time. Of the 1/4 billion ancestors that you have that lived in 1300, many of them would show up hundreds (if not thousands, millions) of times in your family tree. Genetic drift and the number of times we are directly related to someone are likely more relevant to the differences in our genetic code than who our ancestors were.
|
How likely am I to be descended from a particular person born in the year 1300?
|
The further back you go, the more likely that you are related to a person that successfully passed along their genes that lived in that time. Of the 1/4 billion ancestors that you have that lived in 1
|
How likely am I to be descended from a particular person born in the year 1300?
The further back you go, the more likely that you are related to a person that successfully passed along their genes that lived in that time. Of the 1/4 billion ancestors that you have that lived in 1300, many of them would show up hundreds (if not thousands, millions) of times in your family tree. Genetic drift and the number of times we are directly related to someone are likely more relevant to the differences in our genetic code than who our ancestors were.
|
How likely am I to be descended from a particular person born in the year 1300?
The further back you go, the more likely that you are related to a person that successfully passed along their genes that lived in that time. Of the 1/4 billion ancestors that you have that lived in 1
|
10,491
|
How likely am I to be descended from a particular person born in the year 1300?
|
The probability is=1-z, every descendant in this problem is related to ancestors above. Whatever the initial rate of reproduction is (1-z) is your probability of being descendant from someone in the initial population.Only uncertain probability is what are the chances of being alive in final population.
I agree with Erad's answer, although I now think it responds to a question that was not asked - namely what is the probability that you are alive given certain known reproductive and population constraints on your fore-bearers.
|
How likely am I to be descended from a particular person born in the year 1300?
|
The probability is=1-z, every descendant in this problem is related to ancestors above. Whatever the initial rate of reproduction is (1-z) is your probability of being descendant from someone in the i
|
How likely am I to be descended from a particular person born in the year 1300?
The probability is=1-z, every descendant in this problem is related to ancestors above. Whatever the initial rate of reproduction is (1-z) is your probability of being descendant from someone in the initial population.Only uncertain probability is what are the chances of being alive in final population.
I agree with Erad's answer, although I now think it responds to a question that was not asked - namely what is the probability that you are alive given certain known reproductive and population constraints on your fore-bearers.
|
How likely am I to be descended from a particular person born in the year 1300?
The probability is=1-z, every descendant in this problem is related to ancestors above. Whatever the initial rate of reproduction is (1-z) is your probability of being descendant from someone in the i
|
10,492
|
How likely am I to be descended from a particular person born in the year 1300?
|
My updated short answer is:
$$ p > {(1-z)} \times {{{1} \over {n_1(1-z)}} \over {2}} = {2 \over n_1} $$
Answer explained:
Given a particular person today, it is certain that they are a descendant of at least 2 people in 1300.
When picking a particular person in 1300, there is (1-z) chance that person never reproduced, and the other term is for the number of 'parent couples', and the probability for the person to be related to this couple (1 / number of couples).
The (1-z) ends up cancelling out, leaving us with
$$ p > {2 \over n_1} $$
Now just for fun but not necessary for solving the probability question
Here is the population of any given generation k in the chain between then and today.
$$ n_{k+1} = {{n_k(1-z)\times c} \over 2} = {n_1(1-z)^kc^k \over 2^k}$$
Lets plug in some numbers as an example. For assumptions, I use:
g = 28 (25-year generations between 1300 and 2011)
n = 360M (world population estimate in 1300 from wikipedia)
z = 0.2, c = 2.77=8 (not real data, but does end up with about 7B people in 2011)
Resulting in:
$$p > 2 / 360,000,000 = 5.56 \times 10^{-9}$$
or over one in 180M.
Thanks for reading, Erad
|
How likely am I to be descended from a particular person born in the year 1300?
|
My updated short answer is:
$$ p > {(1-z)} \times {{{1} \over {n_1(1-z)}} \over {2}} = {2 \over n_1} $$
Answer explained:
Given a particular person today, it is certain that they are a descendant of a
|
How likely am I to be descended from a particular person born in the year 1300?
My updated short answer is:
$$ p > {(1-z)} \times {{{1} \over {n_1(1-z)}} \over {2}} = {2 \over n_1} $$
Answer explained:
Given a particular person today, it is certain that they are a descendant of at least 2 people in 1300.
When picking a particular person in 1300, there is (1-z) chance that person never reproduced, and the other term is for the number of 'parent couples', and the probability for the person to be related to this couple (1 / number of couples).
The (1-z) ends up cancelling out, leaving us with
$$ p > {2 \over n_1} $$
Now just for fun but not necessary for solving the probability question
Here is the population of any given generation k in the chain between then and today.
$$ n_{k+1} = {{n_k(1-z)\times c} \over 2} = {n_1(1-z)^kc^k \over 2^k}$$
Lets plug in some numbers as an example. For assumptions, I use:
g = 28 (25-year generations between 1300 and 2011)
n = 360M (world population estimate in 1300 from wikipedia)
z = 0.2, c = 2.77=8 (not real data, but does end up with about 7B people in 2011)
Resulting in:
$$p > 2 / 360,000,000 = 5.56 \times 10^{-9}$$
or over one in 180M.
Thanks for reading, Erad
|
How likely am I to be descended from a particular person born in the year 1300?
My updated short answer is:
$$ p > {(1-z)} \times {{{1} \over {n_1(1-z)}} \over {2}} = {2 \over n_1} $$
Answer explained:
Given a particular person today, it is certain that they are a descendant of a
|
10,493
|
How likely am I to be descended from a particular person born in the year 1300?
|
This is a very interesting question as it is asking us to mathematically solve a fractal. Such as the famous game of life.
The % of the population which each generation related to will grow over each iteration, starting at $p_1={2 \over n_1}$ and at the limit generation will approach $\lim_{k \to \infty } p_k = (1-z)$.
If we denote $p_k$ as the probability of someone in generation $k$ to be related to the initial population. And for simplicity lets relax the siblings & cousins rule (can be added later). Then:
$$p_1 = {2 \over n_1}$$
As each person in the new generation has exactly 2 ancestors in the initial population.
$$
p_2 = relatives \times {2 \over n_2} + non.relatives \times {4 \over n_2}
$$
In this case relatives could be calculated as:
$$ relatives = {\binom{c}{2} \times {n \over c} \over \binom{n}{2}} = {c-1 \over n-1}$$
Or in other words, the number of sibling combinations, times the number of siblings family, divided by the total mating combinations.
$$p_3 = immediate.relatives \times {4 \over n_3} + cousins \times {6 \over n_3} + non.relatives \times {8 \over n_3}$$
With each generation, the probability to be related to someone at the initial population will undoubtedly grow, but at a decreasing pace. This is because the probability to draw "relatives" which are coming from the same or similar tree will grow.
Lets use ethnicity as an example. Lets say we know for a fact someone is 100% Caucasian. At generation 28 he is most likely related to a significant portion of the Caucasian population in 1300 (As shown by @whuber simulation). Lets say he is marrying someone who is 100% of a different ethnicity. Their offspring will be linked to approximately double the number of people they are linked to from 1300.
Another interesting thought is that given the human (homosapien) race started from ~600 people in Africa, then we are most likely a genetic permutation of all of them who successfully mated.
|
How likely am I to be descended from a particular person born in the year 1300?
|
This is a very interesting question as it is asking us to mathematically solve a fractal. Such as the famous game of life.
The % of the population which each generation related to will grow over each
|
How likely am I to be descended from a particular person born in the year 1300?
This is a very interesting question as it is asking us to mathematically solve a fractal. Such as the famous game of life.
The % of the population which each generation related to will grow over each iteration, starting at $p_1={2 \over n_1}$ and at the limit generation will approach $\lim_{k \to \infty } p_k = (1-z)$.
If we denote $p_k$ as the probability of someone in generation $k$ to be related to the initial population. And for simplicity lets relax the siblings & cousins rule (can be added later). Then:
$$p_1 = {2 \over n_1}$$
As each person in the new generation has exactly 2 ancestors in the initial population.
$$
p_2 = relatives \times {2 \over n_2} + non.relatives \times {4 \over n_2}
$$
In this case relatives could be calculated as:
$$ relatives = {\binom{c}{2} \times {n \over c} \over \binom{n}{2}} = {c-1 \over n-1}$$
Or in other words, the number of sibling combinations, times the number of siblings family, divided by the total mating combinations.
$$p_3 = immediate.relatives \times {4 \over n_3} + cousins \times {6 \over n_3} + non.relatives \times {8 \over n_3}$$
With each generation, the probability to be related to someone at the initial population will undoubtedly grow, but at a decreasing pace. This is because the probability to draw "relatives" which are coming from the same or similar tree will grow.
Lets use ethnicity as an example. Lets say we know for a fact someone is 100% Caucasian. At generation 28 he is most likely related to a significant portion of the Caucasian population in 1300 (As shown by @whuber simulation). Lets say he is marrying someone who is 100% of a different ethnicity. Their offspring will be linked to approximately double the number of people they are linked to from 1300.
Another interesting thought is that given the human (homosapien) race started from ~600 people in Africa, then we are most likely a genetic permutation of all of them who successfully mated.
|
How likely am I to be descended from a particular person born in the year 1300?
This is a very interesting question as it is asking us to mathematically solve a fractal. Such as the famous game of life.
The % of the population which each generation related to will grow over each
|
10,494
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
|
As it turns out you can use profile maximum likelihood to ensure the necessary properties. You can prove that for given $\hat\theta$, $l(\hat\theta,\Sigma)$ is maximised by
$$\hat\Sigma=\frac{1}{n}\sum_{i=1}^n\hat{\varepsilon}_i\hat{\varepsilon}_i',$$
where
$$\hat{\varepsilon}_i=y_i-f(x_i,\hat\theta)$$
Then it is possible to show that
$$\sum_{i=1}^n(y_i-f(x_i,\hat\theta))'\hat\Sigma^{-1}(y-f(x_i,\hat\theta)))=const,$$
hence we only need to maximise
$$l_R(\theta,\Sigma)=-\frac{n}{2} \log\det\hat\Sigma.$$
Naturally in this case $\Sigma$ will satisfy all the necessary properties. The proofs are identical for the case when $f$ is linear which can be found in Time Series Analysis by J. D. Hamilton page 295, hence I omitted them.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
|
As it turns out you can use profile maximum likelihood to ensure the necessary properties. You can prove that for given $\hat\theta$, $l(\hat\theta,\Sigma)$ is maximised by
$$\hat\Sigma=\frac{1}{n}\su
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
As it turns out you can use profile maximum likelihood to ensure the necessary properties. You can prove that for given $\hat\theta$, $l(\hat\theta,\Sigma)$ is maximised by
$$\hat\Sigma=\frac{1}{n}\sum_{i=1}^n\hat{\varepsilon}_i\hat{\varepsilon}_i',$$
where
$$\hat{\varepsilon}_i=y_i-f(x_i,\hat\theta)$$
Then it is possible to show that
$$\sum_{i=1}^n(y_i-f(x_i,\hat\theta))'\hat\Sigma^{-1}(y-f(x_i,\hat\theta)))=const,$$
hence we only need to maximise
$$l_R(\theta,\Sigma)=-\frac{n}{2} \log\det\hat\Sigma.$$
Naturally in this case $\Sigma$ will satisfy all the necessary properties. The proofs are identical for the case when $f$ is linear which can be found in Time Series Analysis by J. D. Hamilton page 295, hence I omitted them.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
As it turns out you can use profile maximum likelihood to ensure the necessary properties. You can prove that for given $\hat\theta$, $l(\hat\theta,\Sigma)$ is maximised by
$$\hat\Sigma=\frac{1}{n}\su
|
10,495
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
|
Assuming that in constructing the covariance matrix, you are automatically taking care of the symmetry issue, your log-likelihood will be $-\infty$ when $\Sigma$ is not positive definite because of the $\log {\rm det} \ \Sigma$ term in the model right? To prevent a numerical error if ${\rm det} \ \Sigma < 0$ I would precalculate ${\rm det} \ \Sigma$ and, if it is not positive, then make the log likelihood equal -Inf, otherwise continue. You have to calculate the determinant anyways, so this is not costing you any extra calculation.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
|
Assuming that in constructing the covariance matrix, you are automatically taking care of the symmetry issue, your log-likelihood will be $-\infty$ when $\Sigma$ is not positive definite because of th
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
Assuming that in constructing the covariance matrix, you are automatically taking care of the symmetry issue, your log-likelihood will be $-\infty$ when $\Sigma$ is not positive definite because of the $\log {\rm det} \ \Sigma$ term in the model right? To prevent a numerical error if ${\rm det} \ \Sigma < 0$ I would precalculate ${\rm det} \ \Sigma$ and, if it is not positive, then make the log likelihood equal -Inf, otherwise continue. You have to calculate the determinant anyways, so this is not costing you any extra calculation.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
Assuming that in constructing the covariance matrix, you are automatically taking care of the symmetry issue, your log-likelihood will be $-\infty$ when $\Sigma$ is not positive definite because of th
|
10,496
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
|
An alternative parameterization for the covariance matrix is in terms of eigenvalues $\lambda_1,...,\lambda_p$ and $p(p-1)/2$ "Givens" angles $\theta_ij$.
That is, we can write
$$\Sigma = G^T \Lambda G$$
where $G$ is orthonormal, and
$$\Lambda = diag(\lambda_1, ..., \lambda_p)$$
with $\lambda_1 \geq ... \geq \lambda_p \geq 0$.
Meanwhile, $G$ can be parameterized uniquely in terms of $p(p-1)/2$ angles, $\theta_{ij}$, where $i = 1,2,...,p-1$ and $j = i, ..., p-1$.[1]
(details to be added)
[1]: Hoffman, Raffenetti, Ruedenberg. "Generalization of Euler Angles to N‐Dimensional Orthogonal Matrices". J. Math. Phys. 13, 528 (1972)
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
|
An alternative parameterization for the covariance matrix is in terms of eigenvalues $\lambda_1,...,\lambda_p$ and $p(p-1)/2$ "Givens" angles $\theta_ij$.
That is, we can write
$$\Sigma = G^T \Lambda
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
An alternative parameterization for the covariance matrix is in terms of eigenvalues $\lambda_1,...,\lambda_p$ and $p(p-1)/2$ "Givens" angles $\theta_ij$.
That is, we can write
$$\Sigma = G^T \Lambda G$$
where $G$ is orthonormal, and
$$\Lambda = diag(\lambda_1, ..., \lambda_p)$$
with $\lambda_1 \geq ... \geq \lambda_p \geq 0$.
Meanwhile, $G$ can be parameterized uniquely in terms of $p(p-1)/2$ angles, $\theta_{ij}$, where $i = 1,2,...,p-1$ and $j = i, ..., p-1$.[1]
(details to be added)
[1]: Hoffman, Raffenetti, Ruedenberg. "Generalization of Euler Angles to N‐Dimensional Orthogonal Matrices". J. Math. Phys. 13, 528 (1972)
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
An alternative parameterization for the covariance matrix is in terms of eigenvalues $\lambda_1,...,\lambda_p$ and $p(p-1)/2$ "Givens" angles $\theta_ij$.
That is, we can write
$$\Sigma = G^T \Lambda
|
10,497
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
|
Along the lines of charles.y.zheng's solution, you may wish to model $\Sigma = \Lambda + C C^{\top}$, where $\Lambda$ is a diagonal matrix, and $C$ is a Cholesky factorization of a rank update to $\Lambda$. You only then need to keep the diagonal of $\Lambda$ positive to keep $\Sigma$ positive definite. That is, you should estimate the diagonal of $\Lambda$ and the elements of $C$ instead of estimating $\Sigma$.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
|
Along the lines of charles.y.zheng's solution, you may wish to model $\Sigma = \Lambda + C C^{\top}$, where $\Lambda$ is a diagonal matrix, and $C$ is a Cholesky factorization of a rank update to $\La
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum likelihood?
Along the lines of charles.y.zheng's solution, you may wish to model $\Sigma = \Lambda + C C^{\top}$, where $\Lambda$ is a diagonal matrix, and $C$ is a Cholesky factorization of a rank update to $\Lambda$. You only then need to keep the diagonal of $\Lambda$ positive to keep $\Sigma$ positive definite. That is, you should estimate the diagonal of $\Lambda$ and the elements of $C$ instead of estimating $\Sigma$.
|
How to ensure properties of covariance matrix when fitting multivariate normal model using maximum l
Along the lines of charles.y.zheng's solution, you may wish to model $\Sigma = \Lambda + C C^{\top}$, where $\Lambda$ is a diagonal matrix, and $C$ is a Cholesky factorization of a rank update to $\La
|
10,498
|
Having a conjugate prior: Deep property or mathematical accident?
|
It is not by accident. Here you shall find a brief a very nice review on conjugate priors. Concretely, it mentions that if there exist a set of sufficient statistics of fixed dimension for the given likelihood function, then you can construct a conjugate prior to it. Having a set of sufficient statistics means that you can factorize the likelihood in a form that lets you estimate the parameters in a computationally efficient way.
Besides that, having conjugate priors is not only computationally convenient. It also provides smoothing and allows to work with very little samples or no previous samples, which is necessary for problems like decision making, in cases where you have very little evidence.
|
Having a conjugate prior: Deep property or mathematical accident?
|
It is not by accident. Here you shall find a brief a very nice review on conjugate priors. Concretely, it mentions that if there exist a set of sufficient statistics of fixed dimension for the given l
|
Having a conjugate prior: Deep property or mathematical accident?
It is not by accident. Here you shall find a brief a very nice review on conjugate priors. Concretely, it mentions that if there exist a set of sufficient statistics of fixed dimension for the given likelihood function, then you can construct a conjugate prior to it. Having a set of sufficient statistics means that you can factorize the likelihood in a form that lets you estimate the parameters in a computationally efficient way.
Besides that, having conjugate priors is not only computationally convenient. It also provides smoothing and allows to work with very little samples or no previous samples, which is necessary for problems like decision making, in cases where you have very little evidence.
|
Having a conjugate prior: Deep property or mathematical accident?
It is not by accident. Here you shall find a brief a very nice review on conjugate priors. Concretely, it mentions that if there exist a set of sufficient statistics of fixed dimension for the given l
|
10,499
|
Having a conjugate prior: Deep property or mathematical accident?
|
I am very new to Bayesian statistics, but it seems to me that all of these distributions (and if not all of them then at least those that are useful) share the property that they are described by some limited metric about the observations that define them. I.e., for a normal distribution, you don't need to know every detail about every observation, just their total count and sum.
To put it another way, assuming you already know the class/family of distribution, then the distribution has strictly lower information entropy than the observations that resulted in it.
Does this seem trivial, or is it kind of what you're looking for?
|
Having a conjugate prior: Deep property or mathematical accident?
|
I am very new to Bayesian statistics, but it seems to me that all of these distributions (and if not all of them then at least those that are useful) share the property that they are described by some
|
Having a conjugate prior: Deep property or mathematical accident?
I am very new to Bayesian statistics, but it seems to me that all of these distributions (and if not all of them then at least those that are useful) share the property that they are described by some limited metric about the observations that define them. I.e., for a normal distribution, you don't need to know every detail about every observation, just their total count and sum.
To put it another way, assuming you already know the class/family of distribution, then the distribution has strictly lower information entropy than the observations that resulted in it.
Does this seem trivial, or is it kind of what you're looking for?
|
Having a conjugate prior: Deep property or mathematical accident?
I am very new to Bayesian statistics, but it seems to me that all of these distributions (and if not all of them then at least those that are useful) share the property that they are described by some
|
10,500
|
Having a conjugate prior: Deep property or mathematical accident?
|
What properties are "deep" is a very subjective issue! so the answer depends on your concept of "deep". But, if having conjugate priors is a "deep" property, in some sense, then that sense is mathematical and not statistical. The only reason that (some) statisticians are interested in conjugate priors is that they simplify some computations. But that is less important for each day that passes!
EDIT
Trying to answer @whuber comment below. First, an answer needs to ask more precisely what is a conjugate family of priors? It means a family that is closed under sampling, so, (for the given sampling model), the prior and posterior distributions belong to the same family. That is clearly true for the family of all distributions, but that interpretation leaves the question without content, so we need a more limited interpretation. Further, as pointed out by Diaconis & Ylvisaker, for the binomial model, if we let $h$ be a bounded positive function on $[0,1]$ and $f(p;\alpha,\beta)$ be the beta density then $h(p)f(p;\alpha,\beta)$ is a conjugate prior. It lacks some of the properties of the usual beta conjugate prior, but the family it generates is closed under sampling, so a conjugate prior. We don't get nice closed formulas, but we only need one numerical integration to get the normalizing constant.
Now, the usual beta prior density has one further important property: The posterior expectation is a linear function:
$$ \DeclareMathOperator{\E}{\mathbb{E}}
\E \left\{ \E (\theta \mid X=x)\right\} = ax+b
$$
(for some $a,b$). The corresponding property holds for the "usual" conjugate priors in exponential families, see Diaconis & Ylvisaker. So in these sense the usual conjugate families plays a role in Bayesian statistics similar to the Gauss-Markov theorem in classical statistics (see Role of Gauss-Markov Theorem in Linear Regression): it is a justification for linear methods.
There is also another viewpoint leading to the usual conjugate families. If we think of the prior information as representing information from some prior data (from the same sampling distribution family), then we could incorporate this information as a prior likelihood function. Then we could get a combined likelihood function by multiplying the prior likelihood with the data likelihood. We could instead choose to represent the prior data information via a prior distribution, the "usual" conjugate prior is the choice that gives a $\text{prior}\times\text{likelihood}$ proportional to the combined likelihood above. See https://en.wikipedia.org/wiki/Conjugate_prior where this interpretation is used to give prior data interpretations to the parameters in the (usual) conjugate families listed.
So, summarizing, the usual conjugate families in exponential families can be justified as priors leading to linear methods, or as priors coming from representing prior data. Hope this extended answer helps!
|
Having a conjugate prior: Deep property or mathematical accident?
|
What properties are "deep" is a very subjective issue! so the answer depends on your concept of "deep". But, if having conjugate priors is a "deep" property, in some sense, then that sense is mathemat
|
Having a conjugate prior: Deep property or mathematical accident?
What properties are "deep" is a very subjective issue! so the answer depends on your concept of "deep". But, if having conjugate priors is a "deep" property, in some sense, then that sense is mathematical and not statistical. The only reason that (some) statisticians are interested in conjugate priors is that they simplify some computations. But that is less important for each day that passes!
EDIT
Trying to answer @whuber comment below. First, an answer needs to ask more precisely what is a conjugate family of priors? It means a family that is closed under sampling, so, (for the given sampling model), the prior and posterior distributions belong to the same family. That is clearly true for the family of all distributions, but that interpretation leaves the question without content, so we need a more limited interpretation. Further, as pointed out by Diaconis & Ylvisaker, for the binomial model, if we let $h$ be a bounded positive function on $[0,1]$ and $f(p;\alpha,\beta)$ be the beta density then $h(p)f(p;\alpha,\beta)$ is a conjugate prior. It lacks some of the properties of the usual beta conjugate prior, but the family it generates is closed under sampling, so a conjugate prior. We don't get nice closed formulas, but we only need one numerical integration to get the normalizing constant.
Now, the usual beta prior density has one further important property: The posterior expectation is a linear function:
$$ \DeclareMathOperator{\E}{\mathbb{E}}
\E \left\{ \E (\theta \mid X=x)\right\} = ax+b
$$
(for some $a,b$). The corresponding property holds for the "usual" conjugate priors in exponential families, see Diaconis & Ylvisaker. So in these sense the usual conjugate families plays a role in Bayesian statistics similar to the Gauss-Markov theorem in classical statistics (see Role of Gauss-Markov Theorem in Linear Regression): it is a justification for linear methods.
There is also another viewpoint leading to the usual conjugate families. If we think of the prior information as representing information from some prior data (from the same sampling distribution family), then we could incorporate this information as a prior likelihood function. Then we could get a combined likelihood function by multiplying the prior likelihood with the data likelihood. We could instead choose to represent the prior data information via a prior distribution, the "usual" conjugate prior is the choice that gives a $\text{prior}\times\text{likelihood}$ proportional to the combined likelihood above. See https://en.wikipedia.org/wiki/Conjugate_prior where this interpretation is used to give prior data interpretations to the parameters in the (usual) conjugate families listed.
So, summarizing, the usual conjugate families in exponential families can be justified as priors leading to linear methods, or as priors coming from representing prior data. Hope this extended answer helps!
|
Having a conjugate prior: Deep property or mathematical accident?
What properties are "deep" is a very subjective issue! so the answer depends on your concept of "deep". But, if having conjugate priors is a "deep" property, in some sense, then that sense is mathemat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.