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
|
|---|---|---|---|---|---|---|
7,301
|
Variable importance from SVM
|
If you use l-1 penalty on the weight vector, it does automatic feature selection as the weights corresponding to irrelevant attributes are automatically set to zero. See this paper. The (absolute) magnitude of each non-zero weights can give an idea about the importance of the corresponding attribute.
Also look at this paper which uses criteria derived from SVMs to guide the attribute selection.
|
Variable importance from SVM
|
If you use l-1 penalty on the weight vector, it does automatic feature selection as the weights corresponding to irrelevant attributes are automatically set to zero. See this paper. The (absolute) mag
|
Variable importance from SVM
If you use l-1 penalty on the weight vector, it does automatic feature selection as the weights corresponding to irrelevant attributes are automatically set to zero. See this paper. The (absolute) magnitude of each non-zero weights can give an idea about the importance of the corresponding attribute.
Also look at this paper which uses criteria derived from SVMs to guide the attribute selection.
|
Variable importance from SVM
If you use l-1 penalty on the weight vector, it does automatic feature selection as the weights corresponding to irrelevant attributes are automatically set to zero. See this paper. The (absolute) mag
|
7,302
|
Variable importance from SVM
|
Isabelle Guyon, André Elisseeff, "An Introduction to Variable and Feature Selection", JMLR, 3(Mar):1157-1182, 2003. http://jmlr.csail.mit.edu/papers/v3/guyon03a.html
is well worth reading, it will give a good overview of approaches and issues. The one thing I would add is that feature selection doesn't necessarily improve predictive performance, and can easily make it worse (beacuse it is easy to over-fit the feature selection criterion). One of the advantages of (especially linear) SVMs is that they work well with large numbers of features (providing you tune the regularisation parameter properly), so there is often no need if you are only interested in prediction.
|
Variable importance from SVM
|
Isabelle Guyon, André Elisseeff, "An Introduction to Variable and Feature Selection", JMLR, 3(Mar):1157-1182, 2003. http://jmlr.csail.mit.edu/papers/v3/guyon03a.html
is well worth reading, it will giv
|
Variable importance from SVM
Isabelle Guyon, André Elisseeff, "An Introduction to Variable and Feature Selection", JMLR, 3(Mar):1157-1182, 2003. http://jmlr.csail.mit.edu/papers/v3/guyon03a.html
is well worth reading, it will give a good overview of approaches and issues. The one thing I would add is that feature selection doesn't necessarily improve predictive performance, and can easily make it worse (beacuse it is easy to over-fit the feature selection criterion). One of the advantages of (especially linear) SVMs is that they work well with large numbers of features (providing you tune the regularisation parameter properly), so there is often no need if you are only interested in prediction.
|
Variable importance from SVM
Isabelle Guyon, André Elisseeff, "An Introduction to Variable and Feature Selection", JMLR, 3(Mar):1157-1182, 2003. http://jmlr.csail.mit.edu/papers/v3/guyon03a.html
is well worth reading, it will giv
|
7,303
|
Variable importance from SVM
|
If you use R, the variable importance can be calculated with Importance method in rminer package. This is my sample code:
library(rminer)
M <- fit(y~., data=train, model="svm", kpar=list(sigma=0.10), C=2)
svm.imp <- Importance(M, data=train)
In detail, refer to the following link https://cran.r-project.org/web/packages/rminer/rminer.pdf
|
Variable importance from SVM
|
If you use R, the variable importance can be calculated with Importance method in rminer package. This is my sample code:
library(rminer)
M <- fit(y~., data=train, model="svm", kpar=list(sigma=0.10),
|
Variable importance from SVM
If you use R, the variable importance can be calculated with Importance method in rminer package. This is my sample code:
library(rminer)
M <- fit(y~., data=train, model="svm", kpar=list(sigma=0.10), C=2)
svm.imp <- Importance(M, data=train)
In detail, refer to the following link https://cran.r-project.org/web/packages/rminer/rminer.pdf
|
Variable importance from SVM
If you use R, the variable importance can be calculated with Importance method in rminer package. This is my sample code:
library(rminer)
M <- fit(y~., data=train, model="svm", kpar=list(sigma=0.10),
|
7,304
|
Are the digits of $\pi$ statistically random?
|
The US National Institute of Standard has put together a battery of tests that a (pseudo-)random number generator must pass to be considered adequate, see http://csrc.nist.gov/groups/ST/toolkit/rng/stats_tests.html. There are also tests known as the Diehard suite of tests, which overlap somewhat with NIST tests. Developers of Stata statistical package report their Diehard results as a part of their certification process. I imagine you can take blocks of digits of $\pi$, say in groups of consecutive 15 digits, to be comparable to the double type accuracy, and run these batteries of tests on thus obtained numbers.
|
Are the digits of $\pi$ statistically random?
|
The US National Institute of Standard has put together a battery of tests that a (pseudo-)random number generator must pass to be considered adequate, see http://csrc.nist.gov/groups/ST/toolkit/rng/st
|
Are the digits of $\pi$ statistically random?
The US National Institute of Standard has put together a battery of tests that a (pseudo-)random number generator must pass to be considered adequate, see http://csrc.nist.gov/groups/ST/toolkit/rng/stats_tests.html. There are also tests known as the Diehard suite of tests, which overlap somewhat with NIST tests. Developers of Stata statistical package report their Diehard results as a part of their certification process. I imagine you can take blocks of digits of $\pi$, say in groups of consecutive 15 digits, to be comparable to the double type accuracy, and run these batteries of tests on thus obtained numbers.
|
Are the digits of $\pi$ statistically random?
The US National Institute of Standard has put together a battery of tests that a (pseudo-)random number generator must pass to be considered adequate, see http://csrc.nist.gov/groups/ST/toolkit/rng/st
|
7,305
|
Are the digits of $\pi$ statistically random?
|
Answering just the first of your questions: "What tests would you apply to determine if this [sequence] is truly random?"
How about treating it as a time-series, and checking for auto-correlations? Here is some R code. First some test data (first 1000 digits):
digits_string="1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989"
digits=as.numeric(unlist(strsplit(digits_string,"")))
Check the counts of each digit:
> table(digits)
digits
0 1 2 3 4 5 6 7 8 9
93 116 103 102 93 97 94 95 101 106
Then turn it into a time-series, and run the Box-Pierce test:
d=as.ts( digits )
Box.test(d)
which tells me:
X-squared = 1.2449, df = 1, p-value = 0.2645
Typically you'd want the p-value to be under 0.05 to say there are auto-correlations.
Run acf(d) to see the auto-correlations. I've not included an image here as it is a dull chart, though it is curious that the biggest lags are at 11 and 22. Run acf(d,lag.max=40) to show that there is no peak at lag=33, and that it was just coincidence!
P.S. We could compare how well those 1000 digits of pi did, by doing the same tests on real random numbers.
probs=sapply(1:100,function(n){
digits=floor(runif(1000)*10)
bt=Box.test(ts(digits))
bt$p.value
})
This generates 1000 random digits, does the test, and repeats this 100 times.
> summary(probs)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.006725 0.226800 0.469300 0.467100 0.709900 0.969900
> sd(probs)
[1] 0.2904346
So our result was comfortably within the first standard deviation, and pi quacks like a random duck. (I used set.seed(1) if you want to reproduce those exact numbers.)
|
Are the digits of $\pi$ statistically random?
|
Answering just the first of your questions: "What tests would you apply to determine if this [sequence] is truly random?"
How about treating it as a time-series, and checking for auto-correlations? He
|
Are the digits of $\pi$ statistically random?
Answering just the first of your questions: "What tests would you apply to determine if this [sequence] is truly random?"
How about treating it as a time-series, and checking for auto-correlations? Here is some R code. First some test data (first 1000 digits):
digits_string="1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989"
digits=as.numeric(unlist(strsplit(digits_string,"")))
Check the counts of each digit:
> table(digits)
digits
0 1 2 3 4 5 6 7 8 9
93 116 103 102 93 97 94 95 101 106
Then turn it into a time-series, and run the Box-Pierce test:
d=as.ts( digits )
Box.test(d)
which tells me:
X-squared = 1.2449, df = 1, p-value = 0.2645
Typically you'd want the p-value to be under 0.05 to say there are auto-correlations.
Run acf(d) to see the auto-correlations. I've not included an image here as it is a dull chart, though it is curious that the biggest lags are at 11 and 22. Run acf(d,lag.max=40) to show that there is no peak at lag=33, and that it was just coincidence!
P.S. We could compare how well those 1000 digits of pi did, by doing the same tests on real random numbers.
probs=sapply(1:100,function(n){
digits=floor(runif(1000)*10)
bt=Box.test(ts(digits))
bt$p.value
})
This generates 1000 random digits, does the test, and repeats this 100 times.
> summary(probs)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.006725 0.226800 0.469300 0.467100 0.709900 0.969900
> sd(probs)
[1] 0.2904346
So our result was comfortably within the first standard deviation, and pi quacks like a random duck. (I used set.seed(1) if you want to reproduce those exact numbers.)
|
Are the digits of $\pi$ statistically random?
Answering just the first of your questions: "What tests would you apply to determine if this [sequence] is truly random?"
How about treating it as a time-series, and checking for auto-correlations? He
|
7,306
|
Are the digits of $\pi$ statistically random?
|
It's a strange question. Numbers aren't random.
As a time series of base 10 digits, $\pi$ is completely fixed.
If you are talking about randomly selecting an index for the time series, and picking that number, sure it's random. But so is the boring, rational number $0.1212121212\ldots$. In both cases, the "randomness" comes from picking things at random, like drawing names from a hat.
If what you're talking about is more nuanced, as in "If I sequentially reveal a possibly random sequence of numbers, could you tell me if it's a fixed subset from $\pi$? And where did it come from?". Well first, though $\pi$ is not repeating, different random sequences will at least locally align for a small run. That's a number theory result, not a statistical one. As soon as you break, you have to scan on to the next instance of alignment. Computationally it's not tractable to align any random sequence because $\pi$ could match up to the $2^{2^{2^2}}+1$-th place. Heck even if the sequence did align with $\pi$ somewhere, doesn't mean it's not random. For instance, I could choose 3 at random, doesn't mean it's the first digit of $\pi$.
|
Are the digits of $\pi$ statistically random?
|
It's a strange question. Numbers aren't random.
As a time series of base 10 digits, $\pi$ is completely fixed.
If you are talking about randomly selecting an index for the time series, and picking tha
|
Are the digits of $\pi$ statistically random?
It's a strange question. Numbers aren't random.
As a time series of base 10 digits, $\pi$ is completely fixed.
If you are talking about randomly selecting an index for the time series, and picking that number, sure it's random. But so is the boring, rational number $0.1212121212\ldots$. In both cases, the "randomness" comes from picking things at random, like drawing names from a hat.
If what you're talking about is more nuanced, as in "If I sequentially reveal a possibly random sequence of numbers, could you tell me if it's a fixed subset from $\pi$? And where did it come from?". Well first, though $\pi$ is not repeating, different random sequences will at least locally align for a small run. That's a number theory result, not a statistical one. As soon as you break, you have to scan on to the next instance of alignment. Computationally it's not tractable to align any random sequence because $\pi$ could match up to the $2^{2^{2^2}}+1$-th place. Heck even if the sequence did align with $\pi$ somewhere, doesn't mean it's not random. For instance, I could choose 3 at random, doesn't mean it's the first digit of $\pi$.
|
Are the digits of $\pi$ statistically random?
It's a strange question. Numbers aren't random.
As a time series of base 10 digits, $\pi$ is completely fixed.
If you are talking about randomly selecting an index for the time series, and picking tha
|
7,307
|
When is t-SNE misleading?
|
T-Sne is a reduction technique that maintains the small scale structure (i.e. what is particularly close to what) of the space, which makes it very good at visualizing data separability. This means that T-Sne is particularly useful for early visualization geared at understanding the degree of data separability. Other techniques (PCA for example) leave data in lower dimensional representations projected on top of each other as dimensions disappear, which makes it very difficult to make any clear statement about separability in the higher dimensional space.
So for example, if you get a T-Sne graph with lots of overlapping data, odds are high that your classifier will perform badly, no matter what you do. Conversely, if you see clearly separated data in the T-Sne graph, then the underlying, high-dimensional data contains sufficient variability to build a good classifier.
|
When is t-SNE misleading?
|
T-Sne is a reduction technique that maintains the small scale structure (i.e. what is particularly close to what) of the space, which makes it very good at visualizing data separability. This means th
|
When is t-SNE misleading?
T-Sne is a reduction technique that maintains the small scale structure (i.e. what is particularly close to what) of the space, which makes it very good at visualizing data separability. This means that T-Sne is particularly useful for early visualization geared at understanding the degree of data separability. Other techniques (PCA for example) leave data in lower dimensional representations projected on top of each other as dimensions disappear, which makes it very difficult to make any clear statement about separability in the higher dimensional space.
So for example, if you get a T-Sne graph with lots of overlapping data, odds are high that your classifier will perform badly, no matter what you do. Conversely, if you see clearly separated data in the T-Sne graph, then the underlying, high-dimensional data contains sufficient variability to build a good classifier.
|
When is t-SNE misleading?
T-Sne is a reduction technique that maintains the small scale structure (i.e. what is particularly close to what) of the space, which makes it very good at visualizing data separability. This means th
|
7,308
|
When is t-SNE misleading?
|
Out of the box, tSNE has a few hyperparameters, the main one being perplexity. Remember that heuristically, perplexity defines a notion of similarity for tSNE and a universal perplexity is used for all data-points. You could try generating a labelled dataset where each cluster has wildly different perplexity. This can be accomplished by doing a mixture of gaussians, with a wide range of different variances. I'm guessing this will also cause issues in the Barnes-Hut implementation of tSNE, which relies on quartiling data and using only nearest neighbours. tSNE also has an initial relaxation period, which attempts to pass clusters through each other. During this period, there is no penalty or repulsion. So for example, if your data looks a matted clump of noodles (each noodle representing a given cluster), you're gonna have a hard time calibrating the initial pass through, and I doubt tSNE will work well. In some sense I think this hints that tSNE will not work well if your data is woven together and initially resides in a low dimensional space, say 5.
In general tSNE is good because of the "t" part, which resolves an outstanding issue in SNE of how to space points in lower dimensional spaces, compared to higher dimensions. It turns out that on average, the spacing of data points in higher dimensions behaves completely differently from lower dimensions. In particular, tSNE strongly advocates against using Gaussians to measure distances in lower dimensions, opting instead for the one dimensional $t$ distribution (i.e. the Cauchy Distribution) which has heaver tails and allows for more spread in the lower dimensional representation. So conceivably the "t" in tSNE could also be a hyperparameter, where instead you can choose different distributions (albeit at a high computational cost).
You should think of tSNE as an unsupervised method of clustering, and as such there's zero reason to think that it's the only tool for the job. I think overall it can be a fantastic tool if calibrated right. However it is quite slow on large datasets and you might be better off using some optimized form of $k$-means for example, or even PCA, depending on how sparse the data is.
|
When is t-SNE misleading?
|
Out of the box, tSNE has a few hyperparameters, the main one being perplexity. Remember that heuristically, perplexity defines a notion of similarity for tSNE and a universal perplexity is used for al
|
When is t-SNE misleading?
Out of the box, tSNE has a few hyperparameters, the main one being perplexity. Remember that heuristically, perplexity defines a notion of similarity for tSNE and a universal perplexity is used for all data-points. You could try generating a labelled dataset where each cluster has wildly different perplexity. This can be accomplished by doing a mixture of gaussians, with a wide range of different variances. I'm guessing this will also cause issues in the Barnes-Hut implementation of tSNE, which relies on quartiling data and using only nearest neighbours. tSNE also has an initial relaxation period, which attempts to pass clusters through each other. During this period, there is no penalty or repulsion. So for example, if your data looks a matted clump of noodles (each noodle representing a given cluster), you're gonna have a hard time calibrating the initial pass through, and I doubt tSNE will work well. In some sense I think this hints that tSNE will not work well if your data is woven together and initially resides in a low dimensional space, say 5.
In general tSNE is good because of the "t" part, which resolves an outstanding issue in SNE of how to space points in lower dimensional spaces, compared to higher dimensions. It turns out that on average, the spacing of data points in higher dimensions behaves completely differently from lower dimensions. In particular, tSNE strongly advocates against using Gaussians to measure distances in lower dimensions, opting instead for the one dimensional $t$ distribution (i.e. the Cauchy Distribution) which has heaver tails and allows for more spread in the lower dimensional representation. So conceivably the "t" in tSNE could also be a hyperparameter, where instead you can choose different distributions (albeit at a high computational cost).
You should think of tSNE as an unsupervised method of clustering, and as such there's zero reason to think that it's the only tool for the job. I think overall it can be a fantastic tool if calibrated right. However it is quite slow on large datasets and you might be better off using some optimized form of $k$-means for example, or even PCA, depending on how sparse the data is.
|
When is t-SNE misleading?
Out of the box, tSNE has a few hyperparameters, the main one being perplexity. Remember that heuristically, perplexity defines a notion of similarity for tSNE and a universal perplexity is used for al
|
7,309
|
Cloud computing platforms for machine learning [closed]
|
I've not used these firms, but these are just some of the options. However, setting up on EC2 is very simple. At least after you've numbed your head by banging it against the wall hard enough and often enough. It also increases your pain threshold. Kids these days have it so much easier. When I was getting started, we were doing fog computing: we hadn't the foggiest what we were computing.
Reminiscences aside... Tools and resources exist to bypass these vendors and get started on your own. JD Long has, with segue, made it easier to start using R on EMR.
Regarding Python, boto is a suite that allows for getting Python up and running easily on EC2. It's also pretty easy to get Python up and running on Google's AppEngine, if you're willing to consider an EC2 alternative. If you know Python, then there's really no need to hire a company to do the lifting for you, unless you are unfamiliar with scaling, sharding, load balancing, etc., at even a conceptual level. On the other hand, if you are contemplating spending a lot of money on such services, it's a good idea to become familiar with how to make your code efficient.
As for Octave on the cloud, I have no idea what's exists other than these three companies. Monkey Analytics used to offer it, but it seems they're gone. I would recommend avoiding Octave, and focus on Python or R.
One resource for making it easier to get set up is StarCluster. Again, no experience with them, but that may be a helpful route.
In all honesty, Ubuntu (or Windows) and EC2 are not that hard to learn. I wouldn't really recommend Windows for R, as there's not a lot of love among R developers and Windows. (NB: As far as I can tell there are no serious Mac OS X cloud services.) Once you have a remote desktop, you're in business. Learning how to scale is the next step.
Update 1: Other, more general, cloud managing services include RighstScale and Scalr.
Update 2: I want to emphasize that learning to set up your instances and clusters in the cloud for yourself is important. Among the benefits of hands-on work:
Learn how to manage a mixture of resources (multiple instances, multiple instance types, lots of HDs, different availability zones or regions, various monitoring tools, and more)
Tinker with GPUs if you wish (check out gputools)
You can more easily update or roll-back your selection of packages
You may be able to get much lower costs by using either spot instances or reserved instances.
You can try out different R GUIs or IDEs, which might not be an option for the cloud vendors.
There are benefits to using a managed provider, such as a shorter learning curve, possibly better support for sharing resources among a group, and maybe some nice gizmos, but I can't speak to the benefits as I began using EC2 before any of these came to market.
|
Cloud computing platforms for machine learning [closed]
|
I've not used these firms, but these are just some of the options. However, setting up on EC2 is very simple. At least after you've numbed your head by banging it against the wall hard enough and of
|
Cloud computing platforms for machine learning [closed]
I've not used these firms, but these are just some of the options. However, setting up on EC2 is very simple. At least after you've numbed your head by banging it against the wall hard enough and often enough. It also increases your pain threshold. Kids these days have it so much easier. When I was getting started, we were doing fog computing: we hadn't the foggiest what we were computing.
Reminiscences aside... Tools and resources exist to bypass these vendors and get started on your own. JD Long has, with segue, made it easier to start using R on EMR.
Regarding Python, boto is a suite that allows for getting Python up and running easily on EC2. It's also pretty easy to get Python up and running on Google's AppEngine, if you're willing to consider an EC2 alternative. If you know Python, then there's really no need to hire a company to do the lifting for you, unless you are unfamiliar with scaling, sharding, load balancing, etc., at even a conceptual level. On the other hand, if you are contemplating spending a lot of money on such services, it's a good idea to become familiar with how to make your code efficient.
As for Octave on the cloud, I have no idea what's exists other than these three companies. Monkey Analytics used to offer it, but it seems they're gone. I would recommend avoiding Octave, and focus on Python or R.
One resource for making it easier to get set up is StarCluster. Again, no experience with them, but that may be a helpful route.
In all honesty, Ubuntu (or Windows) and EC2 are not that hard to learn. I wouldn't really recommend Windows for R, as there's not a lot of love among R developers and Windows. (NB: As far as I can tell there are no serious Mac OS X cloud services.) Once you have a remote desktop, you're in business. Learning how to scale is the next step.
Update 1: Other, more general, cloud managing services include RighstScale and Scalr.
Update 2: I want to emphasize that learning to set up your instances and clusters in the cloud for yourself is important. Among the benefits of hands-on work:
Learn how to manage a mixture of resources (multiple instances, multiple instance types, lots of HDs, different availability zones or regions, various monitoring tools, and more)
Tinker with GPUs if you wish (check out gputools)
You can more easily update or roll-back your selection of packages
You may be able to get much lower costs by using either spot instances or reserved instances.
You can try out different R GUIs or IDEs, which might not be an option for the cloud vendors.
There are benefits to using a managed provider, such as a shorter learning curve, possibly better support for sharing resources among a group, and maybe some nice gizmos, but I can't speak to the benefits as I began using EC2 before any of these came to market.
|
Cloud computing platforms for machine learning [closed]
I've not used these firms, but these are just some of the options. However, setting up on EC2 is very simple. At least after you've numbed your head by banging it against the wall hard enough and of
|
7,310
|
Cloud computing platforms for machine learning [closed]
|
There's also PiCloud for running Python code in parallel on EC2.
From their product page:
PiCloud is a cloud-computing platform that integrates into the Python
Programming Language. It enables you to leverage the computing power
of Amazon Web Services without having to manage, maintain, or
configure virtual servers.
PiCloud integrates seamlessly into your existing code base through a
custom Python library, cloud. To offload the execution of a function
to our servers, all you must do is pass your desired function into the
cloud library. PiCloud will run the function on its high-performance
cluster. As you run more functions, our cluster auto-scales to meet
your computational needs. Getting on the cloud has never been this
easy!
|
Cloud computing platforms for machine learning [closed]
|
There's also PiCloud for running Python code in parallel on EC2.
From their product page:
PiCloud is a cloud-computing platform that integrates into the Python
Programming Language. It enables you
|
Cloud computing platforms for machine learning [closed]
There's also PiCloud for running Python code in parallel on EC2.
From their product page:
PiCloud is a cloud-computing platform that integrates into the Python
Programming Language. It enables you to leverage the computing power
of Amazon Web Services without having to manage, maintain, or
configure virtual servers.
PiCloud integrates seamlessly into your existing code base through a
custom Python library, cloud. To offload the execution of a function
to our servers, all you must do is pass your desired function into the
cloud library. PiCloud will run the function on its high-performance
cluster. As you run more functions, our cluster auto-scales to meet
your computational needs. Getting on the cloud has never been this
easy!
|
Cloud computing platforms for machine learning [closed]
There's also PiCloud for running Python code in parallel on EC2.
From their product page:
PiCloud is a cloud-computing platform that integrates into the Python
Programming Language. It enables you
|
7,311
|
Cloud computing platforms for machine learning [closed]
|
Did you try CloudStat before? Different from other clouds, CloudStat is meant only for R Language users. There is no more setup. you can just login and use up to 7.5 Gb RAM for free.
However, with free account, your analysis will be viewed and used by public.
The option is pay $ 5 per month to make your analysis private.
|
Cloud computing platforms for machine learning [closed]
|
Did you try CloudStat before? Different from other clouds, CloudStat is meant only for R Language users. There is no more setup. you can just login and use up to 7.5 Gb RAM for free.
However, with fr
|
Cloud computing platforms for machine learning [closed]
Did you try CloudStat before? Different from other clouds, CloudStat is meant only for R Language users. There is no more setup. you can just login and use up to 7.5 Gb RAM for free.
However, with free account, your analysis will be viewed and used by public.
The option is pay $ 5 per month to make your analysis private.
|
Cloud computing platforms for machine learning [closed]
Did you try CloudStat before? Different from other clouds, CloudStat is meant only for R Language users. There is no more setup. you can just login and use up to 7.5 Gb RAM for free.
However, with fr
|
7,312
|
Cloud computing platforms for machine learning [closed]
|
One cloud computing platform that I can recommend are Backbone who provide a secure productivity enhancing cloud computing platform.
|
Cloud computing platforms for machine learning [closed]
|
One cloud computing platform that I can recommend are Backbone who provide a secure productivity enhancing cloud computing platform.
|
Cloud computing platforms for machine learning [closed]
One cloud computing platform that I can recommend are Backbone who provide a secure productivity enhancing cloud computing platform.
|
Cloud computing platforms for machine learning [closed]
One cloud computing platform that I can recommend are Backbone who provide a secure productivity enhancing cloud computing platform.
|
7,313
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
I'm also interested in figuring out what the difference might be. The best I can offer you, for now, is that this blog post suggests that the Kenward-Roger approximation is slightly, but probably not significantly, more conservative than the Satterthwaite approximation. The author also notes that they are both more conservative than the normal approximation, but again, not by much if the sample size is high enough. I'm not sure whether or not this was a generalizable conclusion of the author's or not though.
Edit: I will add that the article "A comparison of denominator degrees of freedom approximation methods in the unbalanced two-way factorial mixed model" by K.B. Gregory seems to indicate that neither method is typically a better method, although there are apparently occasions where the Kenward-Roger approximation loses some level of conservativeness.
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
I'm also interested in figuring out what the difference might be. The best I can offer you, for now, is that this blog post suggests that the Kenward-Roger approximation is slightly, but probably not
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
I'm also interested in figuring out what the difference might be. The best I can offer you, for now, is that this blog post suggests that the Kenward-Roger approximation is slightly, but probably not significantly, more conservative than the Satterthwaite approximation. The author also notes that they are both more conservative than the normal approximation, but again, not by much if the sample size is high enough. I'm not sure whether or not this was a generalizable conclusion of the author's or not though.
Edit: I will add that the article "A comparison of denominator degrees of freedom approximation methods in the unbalanced two-way factorial mixed model" by K.B. Gregory seems to indicate that neither method is typically a better method, although there are apparently occasions where the Kenward-Roger approximation loses some level of conservativeness.
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
I'm also interested in figuring out what the difference might be. The best I can offer you, for now, is that this blog post suggests that the Kenward-Roger approximation is slightly, but probably not
|
7,314
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
Another difference between the two methods is described in Luke (2017):
Both the Kenward-Roger (Kenward & Roger, 1997) and Satterthwaite (1941) approaches are used to estimate denominator degrees of freedom for F statistics or degrees of freedom for t statistics. SAS PROC MIXED uses the Satterthwaite approximation (SAS Institute, 2008). While the Satterthwaite approximation can be applied to ML or REML models, the Kenward-Roger approximation is applied to REML models only.
(my bold)
Luke, S.G. (2017). Evaluating significance in linear mixed-effects models in R. Behavior Research Methods, 49:4, 1494-1502. https://doi.org/10.3758/s13428-016-0809-y
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
Another difference between the two methods is described in Luke (2017):
Both the Kenward-Roger (Kenward & Roger, 1997) and Satterthwaite (1941) approaches are used to estimate denominator degrees of
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
Another difference between the two methods is described in Luke (2017):
Both the Kenward-Roger (Kenward & Roger, 1997) and Satterthwaite (1941) approaches are used to estimate denominator degrees of freedom for F statistics or degrees of freedom for t statistics. SAS PROC MIXED uses the Satterthwaite approximation (SAS Institute, 2008). While the Satterthwaite approximation can be applied to ML or REML models, the Kenward-Roger approximation is applied to REML models only.
(my bold)
Luke, S.G. (2017). Evaluating significance in linear mixed-effects models in R. Behavior Research Methods, 49:4, 1494-1502. https://doi.org/10.3758/s13428-016-0809-y
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
Another difference between the two methods is described in Luke (2017):
Both the Kenward-Roger (Kenward & Roger, 1997) and Satterthwaite (1941) approaches are used to estimate denominator degrees of
|
7,315
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
"This latest result uses the Satterthwaite method, which is implemented in the lmerTest package. Note that, with this method, not only are the degrees of freedom slightly different, but so are the standard errors. That is because the Kenward-Roger method also entails making a bias adjustment to the covariance matrix of the fixed effects"
https://cran.r-project.org/web/packages/emmeans/vignettes/sophisticated.html
This is about degrees of freedom in emmeans, but I think might be useful.
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
|
"This latest result uses the Satterthwaite method, which is implemented in the lmerTest package. Note that, with this method, not only are the degrees of freedom slightly different, but so are the sta
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
"This latest result uses the Satterthwaite method, which is implemented in the lmerTest package. Note that, with this method, not only are the degrees of freedom slightly different, but so are the standard errors. That is because the Kenward-Roger method also entails making a bias adjustment to the covariance matrix of the fixed effects"
https://cran.r-project.org/web/packages/emmeans/vignettes/sophisticated.html
This is about degrees of freedom in emmeans, but I think might be useful.
|
Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models
"This latest result uses the Satterthwaite method, which is implemented in the lmerTest package. Note that, with this method, not only are the degrees of freedom slightly different, but so are the sta
|
7,316
|
Free data set for very high dimensional classification [closed]
|
Dorothea
n=1950
p=100000 (0.1M, half is artificially added noise)
k=2 (~10x unbalanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
|
Dorothea
n=1950
p=100000 (0.1M, half is artificially added noise)
k=2 (~10x unbalanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Dorothea
n=1950
p=100000 (0.1M, half is artificially added noise)
k=2 (~10x unbalanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Dorothea
n=1950
p=100000 (0.1M, half is artificially added noise)
k=2 (~10x unbalanced)
From NIPS2003.
|
7,317
|
Free data set for very high dimensional classification [closed]
|
Gisette
n=13500
p=5000 (half is artificially added noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
|
Gisette
n=13500
p=5000 (half is artificially added noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Gisette
n=13500
p=5000 (half is artificially added noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Gisette
n=13500
p=5000 (half is artificially added noise)
k=2 (balanced)
From NIPS2003.
|
7,318
|
Free data set for very high dimensional classification [closed]
|
Dexter
n=2600
p=20000 (10k+53 is artificial noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
|
Dexter
n=2600
p=20000 (10k+53 is artificial noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Dexter
n=2600
p=20000 (10k+53 is artificial noise)
k=2 (balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Dexter
n=2600
p=20000 (10k+53 is artificial noise)
k=2 (balanced)
From NIPS2003.
|
7,319
|
Free data set for very high dimensional classification [closed]
|
Arcene
n=900
p=10000 (3k is artificially added noise)
k=2 (~balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
|
Arcene
n=900
p=10000 (3k is artificially added noise)
k=2 (~balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Arcene
n=900
p=10000 (3k is artificially added noise)
k=2 (~balanced)
From NIPS2003.
|
Free data set for very high dimensional classification [closed]
Arcene
n=900
p=10000 (3k is artificially added noise)
k=2 (~balanced)
From NIPS2003.
|
7,320
|
Free data set for very high dimensional classification [closed]
|
Prostate (gene expression array)
k=2
n=48+52
p=6033
Available via (among other) R package spls
name of the dataset: prostate
error rate = 3/102 (see here) also I think there are paper which show 1/102 error rate. I would say this is an easy test case.
|
Free data set for very high dimensional classification [closed]
|
Prostate (gene expression array)
k=2
n=48+52
p=6033
Available via (among other) R package spls
name of the dataset: prostate
error rate = 3/102 (see here) also I think there are paper which sho
|
Free data set for very high dimensional classification [closed]
Prostate (gene expression array)
k=2
n=48+52
p=6033
Available via (among other) R package spls
name of the dataset: prostate
error rate = 3/102 (see here) also I think there are paper which show 1/102 error rate. I would say this is an easy test case.
|
Free data set for very high dimensional classification [closed]
Prostate (gene expression array)
k=2
n=48+52
p=6033
Available via (among other) R package spls
name of the dataset: prostate
error rate = 3/102 (see here) also I think there are paper which sho
|
7,321
|
Probability inequalities
|
Using the Chernoff bound you suggested for some $s\le 1/(2\sigma^2)$ that will be specified later,
\[
P[X>t] \le \exp(-st) \exp\Big(-(N/2) \log(1-\sigma^4s^2) \Big) \le \exp(-st + \sigma^4s^2 N)
\]
where the second inequality holds thanks to $-\log(1-x)\le 2x$ for any $x\in(0,1/2)$. Now take $t=\epsilon \sigma^2 N$ and $s=t/(2\sigma^4N)$, the right hand side becomes $\exp(-t^2/(4\sigma^4N)=\exp(-\epsilon^2 N/4)$ which yields
\[
P[X>\epsilon \sigma^2 N] \le \exp(-\epsilon^2 N/4).
\]
for any $\epsilon\in(0,1)$.
Another avenue is to directly apply concentration inequalities such as the Hanson-Wright inequality, or concentration inequalities for Gaussian chaos of order 2 which encompasses the random variable you are interested in.
Simpler approach without using the moment generating function
Take $\sigma=1$ for simplicity (otherwise, one may rescale by dividing by $\sigma^2$).
Write $v=(v_1,...,v_n)^T$ and $w=(w_1,...,w_n)^T$. You are asking for upper bounds
on $P(v^Tw>\epsilon N)$.
Let $Z= w^T v/\|v\|$. Then $Z\sim N(0,1)$ by independence of $v,w$
and $\|v\|^2$ is independent of $Z$ with the $\chi^2$ distribution with $n$ degrees-of-freedom.
By standard bounds on standard normal and $\chi^2$ random variables,
$$P(|Z|>\epsilon\sqrt{n/2})\le 2\exp(-\epsilon^2 n/4),
\qquad\qquad
P(\|v\|>\sqrt{2n}) \le \exp(-n(\sqrt 2 -1)^2/2).
$$
Combining with the union bound gives an upper bound on $P(v^Tw>\epsilon N)$
of the form $ 2\exp(-\epsilon^2 n/4) + \exp(-n(\sqrt 2 -1)^2/2)$.
|
Probability inequalities
|
Using the Chernoff bound you suggested for some $s\le 1/(2\sigma^2)$ that will be specified later,
\[
P[X>t] \le \exp(-st) \exp\Big(-(N/2) \log(1-\sigma^4s^2) \Big) \le \exp(-st + \sigma^4s^2 N)
\]
w
|
Probability inequalities
Using the Chernoff bound you suggested for some $s\le 1/(2\sigma^2)$ that will be specified later,
\[
P[X>t] \le \exp(-st) \exp\Big(-(N/2) \log(1-\sigma^4s^2) \Big) \le \exp(-st + \sigma^4s^2 N)
\]
where the second inequality holds thanks to $-\log(1-x)\le 2x$ for any $x\in(0,1/2)$. Now take $t=\epsilon \sigma^2 N$ and $s=t/(2\sigma^4N)$, the right hand side becomes $\exp(-t^2/(4\sigma^4N)=\exp(-\epsilon^2 N/4)$ which yields
\[
P[X>\epsilon \sigma^2 N] \le \exp(-\epsilon^2 N/4).
\]
for any $\epsilon\in(0,1)$.
Another avenue is to directly apply concentration inequalities such as the Hanson-Wright inequality, or concentration inequalities for Gaussian chaos of order 2 which encompasses the random variable you are interested in.
Simpler approach without using the moment generating function
Take $\sigma=1$ for simplicity (otherwise, one may rescale by dividing by $\sigma^2$).
Write $v=(v_1,...,v_n)^T$ and $w=(w_1,...,w_n)^T$. You are asking for upper bounds
on $P(v^Tw>\epsilon N)$.
Let $Z= w^T v/\|v\|$. Then $Z\sim N(0,1)$ by independence of $v,w$
and $\|v\|^2$ is independent of $Z$ with the $\chi^2$ distribution with $n$ degrees-of-freedom.
By standard bounds on standard normal and $\chi^2$ random variables,
$$P(|Z|>\epsilon\sqrt{n/2})\le 2\exp(-\epsilon^2 n/4),
\qquad\qquad
P(\|v\|>\sqrt{2n}) \le \exp(-n(\sqrt 2 -1)^2/2).
$$
Combining with the union bound gives an upper bound on $P(v^Tw>\epsilon N)$
of the form $ 2\exp(-\epsilon^2 n/4) + \exp(-n(\sqrt 2 -1)^2/2)$.
|
Probability inequalities
Using the Chernoff bound you suggested for some $s\le 1/(2\sigma^2)$ that will be specified later,
\[
P[X>t] \le \exp(-st) \exp\Big(-(N/2) \log(1-\sigma^4s^2) \Big) \le \exp(-st + \sigma^4s^2 N)
\]
w
|
7,322
|
Probability inequalities
|
The bound you obtain is of order $e^{-\epsilon}$ as $\epsilon \to \infty$. I don't think you can do much better for general $\epsilon$. From the Wikipedia page on Product Variables the distribution of $w_i v_i$ is $K_0(z)/\pi$ where $K_0$ is a modified Bessel function. From (10.25.3) in the DLMF function list, $K_0(t) \sim e^{-t}/\sqrt{t}$ so that for $x$ sufficiently large $\mathbb{P}(w_i v_i > x) \sim \int_x^\infty e^{-t}/\sqrt{t} dt$ which is not going to give you a sub-Gaussian bound.
|
Probability inequalities
|
The bound you obtain is of order $e^{-\epsilon}$ as $\epsilon \to \infty$. I don't think you can do much better for general $\epsilon$. From the Wikipedia page on Product Variables the distribution of
|
Probability inequalities
The bound you obtain is of order $e^{-\epsilon}$ as $\epsilon \to \infty$. I don't think you can do much better for general $\epsilon$. From the Wikipedia page on Product Variables the distribution of $w_i v_i$ is $K_0(z)/\pi$ where $K_0$ is a modified Bessel function. From (10.25.3) in the DLMF function list, $K_0(t) \sim e^{-t}/\sqrt{t}$ so that for $x$ sufficiently large $\mathbb{P}(w_i v_i > x) \sim \int_x^\infty e^{-t}/\sqrt{t} dt$ which is not going to give you a sub-Gaussian bound.
|
Probability inequalities
The bound you obtain is of order $e^{-\epsilon}$ as $\epsilon \to \infty$. I don't think you can do much better for general $\epsilon$. From the Wikipedia page on Product Variables the distribution of
|
7,323
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
Inside this small and vexed question even smaller questions are struggling to get out.
The most detailed discussion to date appears to be
Alfredo R. Paloyo. 2011. When did we begin to spell “heteros*edasticity” correctly? Ruhr Economic Papers 0300.
see here
(a reference I owe to @Andy here in Ten fold chat). I can't do justice to its dense and detailed discussion. What follows is more by nature of an executive summary, modulo a little whimsy.
Modern search facilities make it possible to be confident that homoscedastic(ity) and heteroscedastic(ity) are modern coinages introduced, explicitly or implicitly, by the British statistician Karl Pearson in 1905. (Pearson ranged widely over several disciplines, but in the second half of his life his work was firmly centred on statistics.)
Modifying c to k raises absolutely no statistical issue. The idea is at its simplest that the Greek root being used includes the letter kappa ($\kappa$), whose direct equivalent in English is k, and so that k is the correct spelling.
However, as others have done elsewhere, we note that this suggestion was made particularly by J.H. McCulloch in the journal Econometrica, a journal which failed to follow the same logic by renaming itself Econometrika, nay Ekonometrika. (The roots behind "economics" are also Greek, including the word oikos. Ecologists will want to add that there is a journal Oikos even though, once again, ecology did not call itself oikology.)
Further, it is remarkable that Karl Pearson was no hater of k, as he changed his own name from Carl to Karl and named his own journal Biometrika, in full and conscious recognition of the original Greek words he used when devising that name.
The root question then is purely one of language, and of how faithful it is proper to be to the original words behind a coinage. If you follow up the McCulloch reference, the discussion turns to whether such words came into English directly or via other languages, and so hinges on criteria that may appear to many readers as arbitrary if not arcane. (Note that criteria is another word of Greek origin that escaped the k treatment.) Most language authorities now acknowledge that present spelling can owe much to historical accidents and that any long-established usage eventually can over-turn logic (or more precisely etymology). In total, there is plenty of scope here for scepticism (or skepticism).
In terms of tribal or other preferences, it is my impression that
Econometric usage seems to be shifting towards the k form. The McCulloch paper had an effect, indirectly if not directly.
British English seems to make more use of c forms over k forms than does American English. The form sceptic is standard in British spelling, for example.
All puns and wordplay here should be considered intentional even when accidental.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
Inside this small and vexed question even smaller questions are struggling to get out.
The most detailed discussion to date appears to be
Alfredo R. Paloyo. 2011. When did we begin to spell “hetero
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
Inside this small and vexed question even smaller questions are struggling to get out.
The most detailed discussion to date appears to be
Alfredo R. Paloyo. 2011. When did we begin to spell “heteros*edasticity” correctly? Ruhr Economic Papers 0300.
see here
(a reference I owe to @Andy here in Ten fold chat). I can't do justice to its dense and detailed discussion. What follows is more by nature of an executive summary, modulo a little whimsy.
Modern search facilities make it possible to be confident that homoscedastic(ity) and heteroscedastic(ity) are modern coinages introduced, explicitly or implicitly, by the British statistician Karl Pearson in 1905. (Pearson ranged widely over several disciplines, but in the second half of his life his work was firmly centred on statistics.)
Modifying c to k raises absolutely no statistical issue. The idea is at its simplest that the Greek root being used includes the letter kappa ($\kappa$), whose direct equivalent in English is k, and so that k is the correct spelling.
However, as others have done elsewhere, we note that this suggestion was made particularly by J.H. McCulloch in the journal Econometrica, a journal which failed to follow the same logic by renaming itself Econometrika, nay Ekonometrika. (The roots behind "economics" are also Greek, including the word oikos. Ecologists will want to add that there is a journal Oikos even though, once again, ecology did not call itself oikology.)
Further, it is remarkable that Karl Pearson was no hater of k, as he changed his own name from Carl to Karl and named his own journal Biometrika, in full and conscious recognition of the original Greek words he used when devising that name.
The root question then is purely one of language, and of how faithful it is proper to be to the original words behind a coinage. If you follow up the McCulloch reference, the discussion turns to whether such words came into English directly or via other languages, and so hinges on criteria that may appear to many readers as arbitrary if not arcane. (Note that criteria is another word of Greek origin that escaped the k treatment.) Most language authorities now acknowledge that present spelling can owe much to historical accidents and that any long-established usage eventually can over-turn logic (or more precisely etymology). In total, there is plenty of scope here for scepticism (or skepticism).
In terms of tribal or other preferences, it is my impression that
Econometric usage seems to be shifting towards the k form. The McCulloch paper had an effect, indirectly if not directly.
British English seems to make more use of c forms over k forms than does American English. The form sceptic is standard in British spelling, for example.
All puns and wordplay here should be considered intentional even when accidental.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
Inside this small and vexed question even smaller questions are struggling to get out.
The most detailed discussion to date appears to be
Alfredo R. Paloyo. 2011. When did we begin to spell “hetero
|
7,324
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
There is a tradition in English language to use special letters to indicate that a word is of Greek origin (and as all language "rules", it is not absolutely observed). Most of the times for example, when you see "ph" in an English word, it indicates that it has a Greek origin, as in, say, "photograph" which is the transcription of a Greek word ("phos" means "light" and "graph" is also a Greek root for "write/draw", so "photograph" $\approx$ "a writing/drawing of light").
The same happens with "c" and "k": the use of "k" indicates that the word has a Greek origin. And it does because "Heteroskedasticity" is a composite word: "Hetero + Skedasis" where "Hetero" is a Greek word that indicates "difference" and "Skedasis" means "dispersion". So "Heteroskedasticity = different dispersion", and so different variance, which is what we want to express with the word.
But as I said previously, language "rules" can be flexible, especially for international languages as English (your remark that in "less international" languages like French or German, the spelling appears to be fixed is to the point)-and so people that had to write the word and perhaps were not sure of its spelling, decided to use "c" which is the "natural" choice. Or they normatively thought that words should be "merged" in the language they are used as much as possible.
As for what Greek statisticians do, I guess even the slightest amount of "national pride" (or national chauvinism), would be enough to make them use "k" instead of "c".
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
There is a tradition in English language to use special letters to indicate that a word is of Greek origin (and as all language "rules", it is not absolutely observed). Most of the times for example,
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
There is a tradition in English language to use special letters to indicate that a word is of Greek origin (and as all language "rules", it is not absolutely observed). Most of the times for example, when you see "ph" in an English word, it indicates that it has a Greek origin, as in, say, "photograph" which is the transcription of a Greek word ("phos" means "light" and "graph" is also a Greek root for "write/draw", so "photograph" $\approx$ "a writing/drawing of light").
The same happens with "c" and "k": the use of "k" indicates that the word has a Greek origin. And it does because "Heteroskedasticity" is a composite word: "Hetero + Skedasis" where "Hetero" is a Greek word that indicates "difference" and "Skedasis" means "dispersion". So "Heteroskedasticity = different dispersion", and so different variance, which is what we want to express with the word.
But as I said previously, language "rules" can be flexible, especially for international languages as English (your remark that in "less international" languages like French or German, the spelling appears to be fixed is to the point)-and so people that had to write the word and perhaps were not sure of its spelling, decided to use "c" which is the "natural" choice. Or they normatively thought that words should be "merged" in the language they are used as much as possible.
As for what Greek statisticians do, I guess even the slightest amount of "national pride" (or national chauvinism), would be enough to make them use "k" instead of "c".
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
There is a tradition in English language to use special letters to indicate that a word is of Greek origin (and as all language "rules", it is not absolutely observed). Most of the times for example,
|
7,325
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
In Polish it is "heteroskedastyczność", but sometimes "heteroscedastyczność" is used instead. For examples you can check the book by Andrzej Gałecki and Tomasz Burzykowski, who were born and educated in Poland. They use the "c" form in their book written in English. Notice, however, that the forms used by different authors could just reflect editorial policies of journals and publishers, so may not reflect how authors consider how words should be spelled.
Wikipedia (which uses the "c" form) leads to a paper by McCulloch (1985) who argues that the "k" form is appropriate since the word has Greek origin and is written as $\kappa$, which should be transliterated as "k".
McCulloch, J.H. (1985). On Heteros*edasticity. Econometrica, 53(2), 483.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
In Polish it is "heteroskedastyczność", but sometimes "heteroscedastyczność" is used instead. For examples you can check the book by Andrzej Gałecki and Tomasz Burzykowski, who were born and educated
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
In Polish it is "heteroskedastyczność", but sometimes "heteroscedastyczność" is used instead. For examples you can check the book by Andrzej Gałecki and Tomasz Burzykowski, who were born and educated in Poland. They use the "c" form in their book written in English. Notice, however, that the forms used by different authors could just reflect editorial policies of journals and publishers, so may not reflect how authors consider how words should be spelled.
Wikipedia (which uses the "c" form) leads to a paper by McCulloch (1985) who argues that the "k" form is appropriate since the word has Greek origin and is written as $\kappa$, which should be transliterated as "k".
McCulloch, J.H. (1985). On Heteros*edasticity. Econometrica, 53(2), 483.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
In Polish it is "heteroskedastyczność", but sometimes "heteroscedastyczność" is used instead. For examples you can check the book by Andrzej Gałecki and Tomasz Burzykowski, who were born and educated
|
7,326
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
The missing explanation is that letter 'C' was always pronounced as the modern English 'K' in classical Latin, while K itself was actually a redundant letter. A Greek word with the letter Kappa borrowed into Latin, in Roman times, would have always been spelled with a C. Later, in Vulgar Latin and by extension in French and English, the pronunciation of C became corrupted and was pronounced as a 'S' or a 'CH' when it came before vowels 'E' and 'I'.
Therefore the objectively correct spelling (by Latin standards) would be with a C, and the fact that an alternate K-spelling exists shows that the word is a modernism and doesn't hail from Roman times. By modern English standards, both spellings are equivalent.
What I'm trying to say is that when Pearson first used the spelling "heteroskedasticity", he made a judgement call to intentionally go against the norm (for his own subjective reasons) and spell it with a K (according to Nick Cox's answer, he did the same with "Biometrika"). There is no linguistic motive behind this spelling other than the fact (perhaps) that he knew that these words would have once been pronounced with a 'k' and found it aesthetically more pleasing to spell them so.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
The missing explanation is that letter 'C' was always pronounced as the modern English 'K' in classical Latin, while K itself was actually a redundant letter. A Greek word with the letter Kappa borrow
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
The missing explanation is that letter 'C' was always pronounced as the modern English 'K' in classical Latin, while K itself was actually a redundant letter. A Greek word with the letter Kappa borrowed into Latin, in Roman times, would have always been spelled with a C. Later, in Vulgar Latin and by extension in French and English, the pronunciation of C became corrupted and was pronounced as a 'S' or a 'CH' when it came before vowels 'E' and 'I'.
Therefore the objectively correct spelling (by Latin standards) would be with a C, and the fact that an alternate K-spelling exists shows that the word is a modernism and doesn't hail from Roman times. By modern English standards, both spellings are equivalent.
What I'm trying to say is that when Pearson first used the spelling "heteroskedasticity", he made a judgement call to intentionally go against the norm (for his own subjective reasons) and spell it with a K (according to Nick Cox's answer, he did the same with "Biometrika"). There is no linguistic motive behind this spelling other than the fact (perhaps) that he knew that these words would have once been pronounced with a 'k' and found it aesthetically more pleasing to spell them so.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
The missing explanation is that letter 'C' was always pronounced as the modern English 'K' in classical Latin, while K itself was actually a redundant letter. A Greek word with the letter Kappa borrow
|
7,327
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
This is a very interesting discussion.
One problem with using the c instead of k is that in the modern Italianized Latin pronunciation, the combination ce (as with ci) yields a "soft c" (/ch/ sound); moreover, the combination sce yields the soft /sh/ sound. So the word heteroscedastic would be pronounced /hetero-sheh-das-tic/.
The letter c only makes a hard /k/ sound in front of the vowels a, o, and u. To force a c to make the hard /k/ sound in front of soft vowels (e and i), you need to add a modifier. Different Romance languages have handled this in different ways... In Italian, the convention is to use the otherwise silent h after the c: ce = /cheh/, whereas che = /keh/; and sce = /sheh/, whereas sche = /skeh/. In Spanish, the c is replaced by a qu: que = /keh/. There is a similar practice in French and Portuguese.
For this reason, it would be quite rational to favor the k spelling of heteroskedastic. It pays homage to the original Greek transcription and is arguably more phonetically correct in the Romance languages and by extension in English.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
|
This is a very interesting discussion.
One problem with using the c instead of k is that in the modern Italianized Latin pronunciation, the combination ce (as with ci) yields a "soft c" (/ch/ sound);
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
This is a very interesting discussion.
One problem with using the c instead of k is that in the modern Italianized Latin pronunciation, the combination ce (as with ci) yields a "soft c" (/ch/ sound); moreover, the combination sce yields the soft /sh/ sound. So the word heteroscedastic would be pronounced /hetero-sheh-das-tic/.
The letter c only makes a hard /k/ sound in front of the vowels a, o, and u. To force a c to make the hard /k/ sound in front of soft vowels (e and i), you need to add a modifier. Different Romance languages have handled this in different ways... In Italian, the convention is to use the otherwise silent h after the c: ce = /cheh/, whereas che = /keh/; and sce = /sheh/, whereas sche = /skeh/. In Spanish, the c is replaced by a qu: que = /keh/. There is a similar practice in French and Portuguese.
For this reason, it would be quite rational to favor the k spelling of heteroskedastic. It pays homage to the original Greek transcription and is arguably more phonetically correct in the Romance languages and by extension in English.
|
Why are there two spellings of "heteroskedastic" or "heteroscedastic"?
This is a very interesting discussion.
One problem with using the c instead of k is that in the modern Italianized Latin pronunciation, the combination ce (as with ci) yields a "soft c" (/ch/ sound);
|
7,328
|
Can AUC-ROC be between 0-0.5?
|
A perfect predictor gives an AUC-ROC score of 1, a predictor which makes random guesses has an AUC-ROC score of 0.5.
If you get a score of 0 that means the classifier is perfectly incorrect, it is predicting the incorrect choice 100% of the time. If you just changed the prediction of this classifier to the opposite choice then it could predict perfectly and have an AUC-ROC score of 1.
So in practice if you get an AUC-ROC score between 0 and 0.5 you might have a mistake in the way you labeled your classifier targets or you might have a bad training algorithm. If you get a score of 0.2 this shows that the data contains enough information to get a score of 0.8 but something went wrong.
|
Can AUC-ROC be between 0-0.5?
|
A perfect predictor gives an AUC-ROC score of 1, a predictor which makes random guesses has an AUC-ROC score of 0.5.
If you get a score of 0 that means the classifier is perfectly incorrect, it is pre
|
Can AUC-ROC be between 0-0.5?
A perfect predictor gives an AUC-ROC score of 1, a predictor which makes random guesses has an AUC-ROC score of 0.5.
If you get a score of 0 that means the classifier is perfectly incorrect, it is predicting the incorrect choice 100% of the time. If you just changed the prediction of this classifier to the opposite choice then it could predict perfectly and have an AUC-ROC score of 1.
So in practice if you get an AUC-ROC score between 0 and 0.5 you might have a mistake in the way you labeled your classifier targets or you might have a bad training algorithm. If you get a score of 0.2 this shows that the data contains enough information to get a score of 0.8 but something went wrong.
|
Can AUC-ROC be between 0-0.5?
A perfect predictor gives an AUC-ROC score of 1, a predictor which makes random guesses has an AUC-ROC score of 0.5.
If you get a score of 0 that means the classifier is perfectly incorrect, it is pre
|
7,329
|
Can AUC-ROC be between 0-0.5?
|
I am sorry, but these answers are dangerously wrong. No, you cannot just flip AUC after you see the data. Imagine you are buying stocks, and you always bought the wrong one, but you said to yourself, then it's ok, because if you were purchasing the opposite of what your model was predicting, then you would make money.
The thing is that there are many, often non-obvious reasons how you can bias your results and get consistently below-average performance. If you now flip your AUC, you might think you are the best modeler in the world, although there was never any signal in the data.
Here is a simulation example. Notice that the predictor is just a random variable with no relationship to the target. Also, notice that the average AUC is around 0.3.
library(MLmetrics)
aucs <- list()
for (sim in seq_len(100)){
n <- 100
df <- data.frame(x=rnorm(n),
y=c(rep(0, n/2), rep(1, n/2)))
predictions <- list()
for(i in seq_len(n)){
train <- df[-i,]
test <- df[i,]
glm_fit <- glm(y ~ x, family = 'binomial', data = train)
predictions[[i]] <- predict(glm_fit, newdata = test, type = 'response')
}
predictions <- unlist(predictions)
aucs[[sim]] <- MLmetrics::AUC(predictions, df$y)
}
aucs <- unlist(aucs)
plot(aucs); abline(h=mean(aucs), col='red')
Results
Of course, there is no way a classifier could learn anything from the data since the data are random. The bellow chance AUC is there because LOOCV creates a biased, unbalanced training set. However, that doesn't mean that if you don't use LOOCV, you are safe. The point of this story is that there are ways, many ways how the results can have bellow average performance even if there is nothing in the data, and therefore you should not flip the predictions unless you know what you are doing. And since you've got bellow average performance, you don't see what you are doing :)
Here is a couple of papers that touched this problem, but I am sure others did as well
Classification based hypothesis testing in neuroscience: Below‐chance level classification rates and overlooked statistical properties of linear parametric classifiers by Jamalabadi et al (2016).
How to control for confounds in decoding analyses of neuroimaging data by Snoek et al (2019).
|
Can AUC-ROC be between 0-0.5?
|
I am sorry, but these answers are dangerously wrong. No, you cannot just flip AUC after you see the data. Imagine you are buying stocks, and you always bought the wrong one, but you said to yourself,
|
Can AUC-ROC be between 0-0.5?
I am sorry, but these answers are dangerously wrong. No, you cannot just flip AUC after you see the data. Imagine you are buying stocks, and you always bought the wrong one, but you said to yourself, then it's ok, because if you were purchasing the opposite of what your model was predicting, then you would make money.
The thing is that there are many, often non-obvious reasons how you can bias your results and get consistently below-average performance. If you now flip your AUC, you might think you are the best modeler in the world, although there was never any signal in the data.
Here is a simulation example. Notice that the predictor is just a random variable with no relationship to the target. Also, notice that the average AUC is around 0.3.
library(MLmetrics)
aucs <- list()
for (sim in seq_len(100)){
n <- 100
df <- data.frame(x=rnorm(n),
y=c(rep(0, n/2), rep(1, n/2)))
predictions <- list()
for(i in seq_len(n)){
train <- df[-i,]
test <- df[i,]
glm_fit <- glm(y ~ x, family = 'binomial', data = train)
predictions[[i]] <- predict(glm_fit, newdata = test, type = 'response')
}
predictions <- unlist(predictions)
aucs[[sim]] <- MLmetrics::AUC(predictions, df$y)
}
aucs <- unlist(aucs)
plot(aucs); abline(h=mean(aucs), col='red')
Results
Of course, there is no way a classifier could learn anything from the data since the data are random. The bellow chance AUC is there because LOOCV creates a biased, unbalanced training set. However, that doesn't mean that if you don't use LOOCV, you are safe. The point of this story is that there are ways, many ways how the results can have bellow average performance even if there is nothing in the data, and therefore you should not flip the predictions unless you know what you are doing. And since you've got bellow average performance, you don't see what you are doing :)
Here is a couple of papers that touched this problem, but I am sure others did as well
Classification based hypothesis testing in neuroscience: Below‐chance level classification rates and overlooked statistical properties of linear parametric classifiers by Jamalabadi et al (2016).
How to control for confounds in decoding analyses of neuroimaging data by Snoek et al (2019).
|
Can AUC-ROC be between 0-0.5?
I am sorry, but these answers are dangerously wrong. No, you cannot just flip AUC after you see the data. Imagine you are buying stocks, and you always bought the wrong one, but you said to yourself,
|
7,330
|
Can AUC-ROC be between 0-0.5?
|
They can, if the system you're analyzing performs below chance level. Trivially, you could easily construct a classifier with 0 AUC by having it always answer opposite to the truth.
In practice of course you train your classifier on some data so values very much smaller than 0.5 would typically indicate an error in your algorithm, data labels, or choice of train/test data. E.g. if you mistakenly switched the class labels in your train data your expected AUC would be 1 minus the "true" AUC (given correct labels). The AUC could also be < 0.5 if you split your data into train & test partitions in such a way that the patterns to be classified were systematically different. This might happen (for example) if one class was more common in the train vs. the test set, or if the patterns in each set had systematically different intercepts that you didn't correct for.
Lastly, it could also happen randomly because your classifier is at chance level in the long run but happened to get "unlucky" in your test sample (i.e. get a few more errors than successes). But in that case the values should still be relatively close to 0.5 (how close depends on the number of data points).
|
Can AUC-ROC be between 0-0.5?
|
They can, if the system you're analyzing performs below chance level. Trivially, you could easily construct a classifier with 0 AUC by having it always answer opposite to the truth.
In practice of co
|
Can AUC-ROC be between 0-0.5?
They can, if the system you're analyzing performs below chance level. Trivially, you could easily construct a classifier with 0 AUC by having it always answer opposite to the truth.
In practice of course you train your classifier on some data so values very much smaller than 0.5 would typically indicate an error in your algorithm, data labels, or choice of train/test data. E.g. if you mistakenly switched the class labels in your train data your expected AUC would be 1 minus the "true" AUC (given correct labels). The AUC could also be < 0.5 if you split your data into train & test partitions in such a way that the patterns to be classified were systematically different. This might happen (for example) if one class was more common in the train vs. the test set, or if the patterns in each set had systematically different intercepts that you didn't correct for.
Lastly, it could also happen randomly because your classifier is at chance level in the long run but happened to get "unlucky" in your test sample (i.e. get a few more errors than successes). But in that case the values should still be relatively close to 0.5 (how close depends on the number of data points).
|
Can AUC-ROC be between 0-0.5?
They can, if the system you're analyzing performs below chance level. Trivially, you could easily construct a classifier with 0 AUC by having it always answer opposite to the truth.
In practice of co
|
7,331
|
Why is Poisson regression used for count data?
|
Poisson distributed data is intrinsically integer-valued, which makes sense for count data. Ordinary Least Squares (OLS, which you call "linear regression") assumes that true values are normally distributed around the expected value and can take any real value, positive or negative, integer or fractional, whatever. Finally, logistic regression only works for data that is 0-1-valued (TRUE-FALSE-valued), like "has a disease" versus "doesn't have the disease". Thus, the Poisson distribution makes the most sense for count data.
That said, a normal distribution is often a rather good approximation to a Poisson one for data with a mean above 30 or so. And in a regression framework, where you have predictors influencing the count, an OLS with its normal distribution may be easier to fit and would actually be more general, since the Poisson distribution and regression assume that the mean and the variance are equal, while OLS can deal with unequal means and variances - for a count data model with different means and variances, one could use a negative binomial distribution, for instance.
|
Why is Poisson regression used for count data?
|
Poisson distributed data is intrinsically integer-valued, which makes sense for count data. Ordinary Least Squares (OLS, which you call "linear regression") assumes that true values are normally distr
|
Why is Poisson regression used for count data?
Poisson distributed data is intrinsically integer-valued, which makes sense for count data. Ordinary Least Squares (OLS, which you call "linear regression") assumes that true values are normally distributed around the expected value and can take any real value, positive or negative, integer or fractional, whatever. Finally, logistic regression only works for data that is 0-1-valued (TRUE-FALSE-valued), like "has a disease" versus "doesn't have the disease". Thus, the Poisson distribution makes the most sense for count data.
That said, a normal distribution is often a rather good approximation to a Poisson one for data with a mean above 30 or so. And in a regression framework, where you have predictors influencing the count, an OLS with its normal distribution may be easier to fit and would actually be more general, since the Poisson distribution and regression assume that the mean and the variance are equal, while OLS can deal with unequal means and variances - for a count data model with different means and variances, one could use a negative binomial distribution, for instance.
|
Why is Poisson regression used for count data?
Poisson distributed data is intrinsically integer-valued, which makes sense for count data. Ordinary Least Squares (OLS, which you call "linear regression") assumes that true values are normally distr
|
7,332
|
Why is Poisson regression used for count data?
|
Essentially, it's because linear and logistic regression make the wrong kinds of assumptions about what count outcomes look like. Imagine your model as a very stupid robot that will relentlessly follow your orders, no matter how nonsensical those orders are; it completely lacks the ability to evaluate what you tell it. If you tell your robot that something like votes is distributed continuously from negative infinity to infinity, that's what it believes votes are like, and it might give you nonsensical predictions (Ross Perot will receive -10.469 votes in the upcoming election).
Conversely, the Poisson distribution is discrete and positive (or zero... zero counts as positive, yes?). At a very minimum, this will force your robot to give you answers that could actually happen in real life. They may or may not be good answers, but they will at least be drawn from the possible set of "number of votes cast".
Of course, the Poisson has its own problems: it assumes that the mean of the vote count variable will also be the same as its variance. I don't know if I've ever actually seen a non-contrived example where this was true. Fortunately, bright people have come up with other distributions that are also positive and discrete, but that add parameters to allow the variance to, er, vary (e.g., negative binomial regression).
|
Why is Poisson regression used for count data?
|
Essentially, it's because linear and logistic regression make the wrong kinds of assumptions about what count outcomes look like. Imagine your model as a very stupid robot that will relentlessly foll
|
Why is Poisson regression used for count data?
Essentially, it's because linear and logistic regression make the wrong kinds of assumptions about what count outcomes look like. Imagine your model as a very stupid robot that will relentlessly follow your orders, no matter how nonsensical those orders are; it completely lacks the ability to evaluate what you tell it. If you tell your robot that something like votes is distributed continuously from negative infinity to infinity, that's what it believes votes are like, and it might give you nonsensical predictions (Ross Perot will receive -10.469 votes in the upcoming election).
Conversely, the Poisson distribution is discrete and positive (or zero... zero counts as positive, yes?). At a very minimum, this will force your robot to give you answers that could actually happen in real life. They may or may not be good answers, but they will at least be drawn from the possible set of "number of votes cast".
Of course, the Poisson has its own problems: it assumes that the mean of the vote count variable will also be the same as its variance. I don't know if I've ever actually seen a non-contrived example where this was true. Fortunately, bright people have come up with other distributions that are also positive and discrete, but that add parameters to allow the variance to, er, vary (e.g., negative binomial regression).
|
Why is Poisson regression used for count data?
Essentially, it's because linear and logistic regression make the wrong kinds of assumptions about what count outcomes look like. Imagine your model as a very stupid robot that will relentlessly foll
|
7,333
|
Why is Poisson regression used for count data?
|
Mathematically if you start with the simple assumption that the probability of an event occurring in a defined interval $T = 1$ is $\lambda$ you can show the expected number of events in the interval $T = t$ is is $\lambda.t$, the variance is also $\lambda.t$ and the probability distribution is
$$p(N=n) = \frac{(\lambda.t)^{n}e^{-\lambda.t}}{n!}$$
Via this and the maximum likelihood method & generalised linear models (or some other method) you arrive at Poisson regression.
In simple terms Poisson Regression is the model that fits the assumptions of the underlying random process generating a small number of events at a rate (i.e. number per unit time) determined by other variables in the model.
|
Why is Poisson regression used for count data?
|
Mathematically if you start with the simple assumption that the probability of an event occurring in a defined interval $T = 1$ is $\lambda$ you can show the expected number of events in the interval
|
Why is Poisson regression used for count data?
Mathematically if you start with the simple assumption that the probability of an event occurring in a defined interval $T = 1$ is $\lambda$ you can show the expected number of events in the interval $T = t$ is is $\lambda.t$, the variance is also $\lambda.t$ and the probability distribution is
$$p(N=n) = \frac{(\lambda.t)^{n}e^{-\lambda.t}}{n!}$$
Via this and the maximum likelihood method & generalised linear models (or some other method) you arrive at Poisson regression.
In simple terms Poisson Regression is the model that fits the assumptions of the underlying random process generating a small number of events at a rate (i.e. number per unit time) determined by other variables in the model.
|
Why is Poisson regression used for count data?
Mathematically if you start with the simple assumption that the probability of an event occurring in a defined interval $T = 1$ is $\lambda$ you can show the expected number of events in the interval
|
7,334
|
Why is Poisson regression used for count data?
|
Others have basically said the same thing I'm going to but I thought I'd add my take on it. It depends on what you're doing exactly but a lot of times we like to conceptualize the problem/data at hand. This is a slightly different approach compared to just building a model that predicts pretty well. If we are trying to conceptualize what's going on it makes sense to model count data using a non-negative distribution that only puts mass at integer values. We also have many results that essentially boil down to saying that under certain conditions count data really is distributed as a poisson. So if our goal is to conceptualize the problem it really makes sense to use a poisson as the response variable. Others have pointed out other reasons why it's a good idea but if you're really trying to conceptualize the problem and really understand how data that you see could be generated then using a poisson regression makes a lot of sense in some situations.
|
Why is Poisson regression used for count data?
|
Others have basically said the same thing I'm going to but I thought I'd add my take on it. It depends on what you're doing exactly but a lot of times we like to conceptualize the problem/data at han
|
Why is Poisson regression used for count data?
Others have basically said the same thing I'm going to but I thought I'd add my take on it. It depends on what you're doing exactly but a lot of times we like to conceptualize the problem/data at hand. This is a slightly different approach compared to just building a model that predicts pretty well. If we are trying to conceptualize what's going on it makes sense to model count data using a non-negative distribution that only puts mass at integer values. We also have many results that essentially boil down to saying that under certain conditions count data really is distributed as a poisson. So if our goal is to conceptualize the problem it really makes sense to use a poisson as the response variable. Others have pointed out other reasons why it's a good idea but if you're really trying to conceptualize the problem and really understand how data that you see could be generated then using a poisson regression makes a lot of sense in some situations.
|
Why is Poisson regression used for count data?
Others have basically said the same thing I'm going to but I thought I'd add my take on it. It depends on what you're doing exactly but a lot of times we like to conceptualize the problem/data at han
|
7,335
|
Why is Poisson regression used for count data?
|
My understanding is primarily because counts are always positive and discrete, the Poisson can summarize such data with one parameter. The main catch being that the variance equals the mean.
|
Why is Poisson regression used for count data?
|
My understanding is primarily because counts are always positive and discrete, the Poisson can summarize such data with one parameter. The main catch being that the variance equals the mean.
|
Why is Poisson regression used for count data?
My understanding is primarily because counts are always positive and discrete, the Poisson can summarize such data with one parameter. The main catch being that the variance equals the mean.
|
Why is Poisson regression used for count data?
My understanding is primarily because counts are always positive and discrete, the Poisson can summarize such data with one parameter. The main catch being that the variance equals the mean.
|
7,336
|
Changing the scale of a variable to 0-100
|
Any variable (univariate distribution) $v$ with observed $min_{old}$ and $max_{old}$ values (or these could be preset potential bounds for values) can be rescaled to range $min_{new}$ to $max_{new}$ by the following formula:
$\frac{max_{new}-min_{new}}{max_{old}-min_{old}}\cdot (v-max_{old})+max_{new}$
or
$\frac{max_{new}-min_{new}}{max_{old}-min_{old}}\cdot (v-min_{old})+min_{new}$.
|
Changing the scale of a variable to 0-100
|
Any variable (univariate distribution) $v$ with observed $min_{old}$ and $max_{old}$ values (or these could be preset potential bounds for values) can be rescaled to range $min_{new}$ to $max_{new}$ b
|
Changing the scale of a variable to 0-100
Any variable (univariate distribution) $v$ with observed $min_{old}$ and $max_{old}$ values (or these could be preset potential bounds for values) can be rescaled to range $min_{new}$ to $max_{new}$ by the following formula:
$\frac{max_{new}-min_{new}}{max_{old}-min_{old}}\cdot (v-max_{old})+max_{new}$
or
$\frac{max_{new}-min_{new}}{max_{old}-min_{old}}\cdot (v-min_{old})+min_{new}$.
|
Changing the scale of a variable to 0-100
Any variable (univariate distribution) $v$ with observed $min_{old}$ and $max_{old}$ values (or these could be preset potential bounds for values) can be rescaled to range $min_{new}$ to $max_{new}$ b
|
7,337
|
Changing the scale of a variable to 0-100
|
For R there is also already available rescale function from scales package, which does exactly what you want and what @AndrewTulloch and @ttnphns described:
library(scales)
rescale(c(-10, -9, -5, 2, 6), to = c(0, 100)) ## Use scales:::rescale() if you have several packages loaded using the same function name
[1] 0.00 6.25 31.25 75.00 100.00
|
Changing the scale of a variable to 0-100
|
For R there is also already available rescale function from scales package, which does exactly what you want and what @AndrewTulloch and @ttnphns described:
library(scales)
rescale(c(-10, -9, -5, 2, 6
|
Changing the scale of a variable to 0-100
For R there is also already available rescale function from scales package, which does exactly what you want and what @AndrewTulloch and @ttnphns described:
library(scales)
rescale(c(-10, -9, -5, 2, 6), to = c(0, 100)) ## Use scales:::rescale() if you have several packages loaded using the same function name
[1] 0.00 6.25 31.25 75.00 100.00
|
Changing the scale of a variable to 0-100
For R there is also already available rescale function from scales package, which does exactly what you want and what @AndrewTulloch and @ttnphns described:
library(scales)
rescale(c(-10, -9, -5, 2, 6
|
7,338
|
Changing the scale of a variable to 0-100
|
first, lets get some example data:
x <- runif(20, -10, 10)
Here are two functions that will work in R
rescale <- function(x) (x-min(x))/(max(x) - min(x)) * 100
rescale(x)
Or, you could use other transformations. For example, the logit transform was mentioned by @ondrej
plogis(x)*100
or, other transforms:
pnorm(x)*100
pnorm(x, 0, 100) * 100
punif(x, min(x), max(x))*100
|
Changing the scale of a variable to 0-100
|
first, lets get some example data:
x <- runif(20, -10, 10)
Here are two functions that will work in R
rescale <- function(x) (x-min(x))/(max(x) - min(x)) * 100
rescale(x)
Or, you could use other tra
|
Changing the scale of a variable to 0-100
first, lets get some example data:
x <- runif(20, -10, 10)
Here are two functions that will work in R
rescale <- function(x) (x-min(x))/(max(x) - min(x)) * 100
rescale(x)
Or, you could use other transformations. For example, the logit transform was mentioned by @ondrej
plogis(x)*100
or, other transforms:
pnorm(x)*100
pnorm(x, 0, 100) * 100
punif(x, min(x), max(x))*100
|
Changing the scale of a variable to 0-100
first, lets get some example data:
x <- runif(20, -10, 10)
Here are two functions that will work in R
rescale <- function(x) (x-min(x))/(max(x) - min(x)) * 100
rescale(x)
Or, you could use other tra
|
7,339
|
Changing the scale of a variable to 0-100
|
Just to add to ttnphnss's answer, to implement this process in Python (for example), this function will do the trick:
from __future__ import division
def rescale(values, new_min = 0, new_max = 100):
output = []
old_min, old_max = min(values), max(values)
for v in values:
new_v = (new_max - new_min) / (old_max - old_min) * (v - old_min) + new_min
output.append(new_v)
return output
print rescale([1, 2, 3, 4, 5])
# [0.0, 25.0, 50.0, 75.0, 100.0]
|
Changing the scale of a variable to 0-100
|
Just to add to ttnphnss's answer, to implement this process in Python (for example), this function will do the trick:
from __future__ import division
def rescale(values, new_min = 0, new_max = 100):
|
Changing the scale of a variable to 0-100
Just to add to ttnphnss's answer, to implement this process in Python (for example), this function will do the trick:
from __future__ import division
def rescale(values, new_min = 0, new_max = 100):
output = []
old_min, old_max = min(values), max(values)
for v in values:
new_v = (new_max - new_min) / (old_max - old_min) * (v - old_min) + new_min
output.append(new_v)
return output
print rescale([1, 2, 3, 4, 5])
# [0.0, 25.0, 50.0, 75.0, 100.0]
|
Changing the scale of a variable to 0-100
Just to add to ttnphnss's answer, to implement this process in Python (for example), this function will do the trick:
from __future__ import division
def rescale(values, new_min = 0, new_max = 100):
|
7,340
|
Changing the scale of a variable to 0-100
|
I suggest not to bind the index to 0-100 interval, as it does not improve interpretation, but rather makes it more difficult. If the index constituents can be negative, then it is possible that the index becomes negative, and it reflects what's going on with constituents better than some low value in 0-100 range, in my opinion.
|
Changing the scale of a variable to 0-100
|
I suggest not to bind the index to 0-100 interval, as it does not improve interpretation, but rather makes it more difficult. If the index constituents can be negative, then it is possible that the in
|
Changing the scale of a variable to 0-100
I suggest not to bind the index to 0-100 interval, as it does not improve interpretation, but rather makes it more difficult. If the index constituents can be negative, then it is possible that the index becomes negative, and it reflects what's going on with constituents better than some low value in 0-100 range, in my opinion.
|
Changing the scale of a variable to 0-100
I suggest not to bind the index to 0-100 interval, as it does not improve interpretation, but rather makes it more difficult. If the index constituents can be negative, then it is possible that the in
|
7,341
|
Changing the scale of a variable to 0-100
|
For R with standard packages loaded, you may just use scale() from 'base' package:
x=c(2,4,8,16)
x.scaled = scale(x,FALSE,max(x)) # divide each value in x by max(x)
x.scaled = as.vector(x.scaled)
use 'as.vector()' to retrieve the scaled x as vector.
|
Changing the scale of a variable to 0-100
|
For R with standard packages loaded, you may just use scale() from 'base' package:
x=c(2,4,8,16)
x.scaled = scale(x,FALSE,max(x)) # divide each value in x by max(x)
x.scaled = as.vector(x.scaled)
u
|
Changing the scale of a variable to 0-100
For R with standard packages loaded, you may just use scale() from 'base' package:
x=c(2,4,8,16)
x.scaled = scale(x,FALSE,max(x)) # divide each value in x by max(x)
x.scaled = as.vector(x.scaled)
use 'as.vector()' to retrieve the scaled x as vector.
|
Changing the scale of a variable to 0-100
For R with standard packages loaded, you may just use scale() from 'base' package:
x=c(2,4,8,16)
x.scaled = scale(x,FALSE,max(x)) # divide each value in x by max(x)
x.scaled = as.vector(x.scaled)
u
|
7,342
|
What is the weak side of decision trees?
|
Here are a couple I can think of:
They can be extremely sensitive to small perturbations in the data: a slight change can result in a drastically different tree.
They can easily overfit. This can be negated by validation methods and pruning, but this is a grey area.
They can have problems out-of-sample prediction (this is related to them being non-smooth).
Some of these are related to the problem of multicollinearity: when two variables both explain the same thing, a decision tree will greedily choose the best one, whereas many other methods will use them both. Ensemble methods such as random forests can negate this to a certain extent, but you lose the ease of understanding.
However the biggest problem, from my point of view at least, is the lack of a principled probabilistic framework. Many other methods have things like confidence intervals, posterior distributions etc., which give us some idea of how good a model is. A decision tree is ultimately an ad hoc heuristic, which can still be very useful (they are excellent for finding the sources of bugs in data processing), but there is the danger of people treating the output as "the" correct model (from my experience, this happens a lot in marketing).
|
What is the weak side of decision trees?
|
Here are a couple I can think of:
They can be extremely sensitive to small perturbations in the data: a slight change can result in a drastically different tree.
They can easily overfit. This can be
|
What is the weak side of decision trees?
Here are a couple I can think of:
They can be extremely sensitive to small perturbations in the data: a slight change can result in a drastically different tree.
They can easily overfit. This can be negated by validation methods and pruning, but this is a grey area.
They can have problems out-of-sample prediction (this is related to them being non-smooth).
Some of these are related to the problem of multicollinearity: when two variables both explain the same thing, a decision tree will greedily choose the best one, whereas many other methods will use them both. Ensemble methods such as random forests can negate this to a certain extent, but you lose the ease of understanding.
However the biggest problem, from my point of view at least, is the lack of a principled probabilistic framework. Many other methods have things like confidence intervals, posterior distributions etc., which give us some idea of how good a model is. A decision tree is ultimately an ad hoc heuristic, which can still be very useful (they are excellent for finding the sources of bugs in data processing), but there is the danger of people treating the output as "the" correct model (from my experience, this happens a lot in marketing).
|
What is the weak side of decision trees?
Here are a couple I can think of:
They can be extremely sensitive to small perturbations in the data: a slight change can result in a drastically different tree.
They can easily overfit. This can be
|
7,343
|
What is the weak side of decision trees?
|
One disadvantage is that all terms are assumed to interact. That is, you can't have two explanatory variables that behave independently. Every variable in the tree is forced to interact with every variable further up the tree. This is extremely inefficient if there are variables that have no or weak interactions.
|
What is the weak side of decision trees?
|
One disadvantage is that all terms are assumed to interact. That is, you can't have two explanatory variables that behave independently. Every variable in the tree is forced to interact with every var
|
What is the weak side of decision trees?
One disadvantage is that all terms are assumed to interact. That is, you can't have two explanatory variables that behave independently. Every variable in the tree is forced to interact with every variable further up the tree. This is extremely inefficient if there are variables that have no or weak interactions.
|
What is the weak side of decision trees?
One disadvantage is that all terms are assumed to interact. That is, you can't have two explanatory variables that behave independently. Every variable in the tree is forced to interact with every var
|
7,344
|
What is the weak side of decision trees?
|
My answer is directed to CART (the C 4.5/C 5 implementations) though i don't think are limited to it. My guess is that this is what the OP has in mind--it's usually what someone means when they say "Decision Tree."
Limitations of Decision Trees:
Low-Performance
By 'performance' i don't mean resolution, but execution speed. The reason why it's poor is that you need to 'redraw the tree' every time you wish to update your CART model--data classified by an already-trained Tree, that you then want to add to the Tree (i.e., use as a training data point) requires that you start from over--training instances can not be added incrementally, as they can for most other supervised learning algorithms. Perhaps the best way to state this is that Decision Trees cannot be trained in online mode, rather only in batch mode. Obviously you won't notice this limitation if you don't update your classifier, but then i would expect that you see a drop in resolution.
This is significant because for Multi-Layer Perceptrons for instance, once it's trained, then it can begin classifying data; that data can also be used to 'tune' the already-trained classifier, though with Decision Trees, you need to retrain with the entire data set (original data used in training plus any new instances).
Poor Resolution on Data With Complex Relationships Among the Variables
Decision Trees classify by step-wise assessment of a data point of unknown class, one node at time, starting at the root node and ending with a terminal node. And at each node, only two possibilities are possible (left-right), hence there are some variable relationships that Decision Trees just can't learn.
Practically Limited to Classification
Decision Trees work best when they are trained to assign a data point to a class--preferably one of only a few possible classes. I don't believe i have ever had any success using a Decision Tree in regression mode (i.e., continuous output, such as price, or expected lifetime revenue). This is not a formal or inherent limitation but a practical one. Most of the time, Decision Trees are used for prediction of factors or discrete outcomes.
Poor Resolution With Continuous Expectation Variables
Again, in principle, it's ok to have independent variables like "download time" or "number of days since previous online purchase"--just change your splitting criterion to variance (it's usually Information Entropy or Gini Impurity for discrete variables) but in my experience Decision Trees rarely work well in these instance. Exceptions are cases like "student's age" which looks continuous but in practice the range of values is quite small (particularly if they are reported as integers).
|
What is the weak side of decision trees?
|
My answer is directed to CART (the C 4.5/C 5 implementations) though i don't think are limited to it. My guess is that this is what the OP has in mind--it's usually what someone means when they say "D
|
What is the weak side of decision trees?
My answer is directed to CART (the C 4.5/C 5 implementations) though i don't think are limited to it. My guess is that this is what the OP has in mind--it's usually what someone means when they say "Decision Tree."
Limitations of Decision Trees:
Low-Performance
By 'performance' i don't mean resolution, but execution speed. The reason why it's poor is that you need to 'redraw the tree' every time you wish to update your CART model--data classified by an already-trained Tree, that you then want to add to the Tree (i.e., use as a training data point) requires that you start from over--training instances can not be added incrementally, as they can for most other supervised learning algorithms. Perhaps the best way to state this is that Decision Trees cannot be trained in online mode, rather only in batch mode. Obviously you won't notice this limitation if you don't update your classifier, but then i would expect that you see a drop in resolution.
This is significant because for Multi-Layer Perceptrons for instance, once it's trained, then it can begin classifying data; that data can also be used to 'tune' the already-trained classifier, though with Decision Trees, you need to retrain with the entire data set (original data used in training plus any new instances).
Poor Resolution on Data With Complex Relationships Among the Variables
Decision Trees classify by step-wise assessment of a data point of unknown class, one node at time, starting at the root node and ending with a terminal node. And at each node, only two possibilities are possible (left-right), hence there are some variable relationships that Decision Trees just can't learn.
Practically Limited to Classification
Decision Trees work best when they are trained to assign a data point to a class--preferably one of only a few possible classes. I don't believe i have ever had any success using a Decision Tree in regression mode (i.e., continuous output, such as price, or expected lifetime revenue). This is not a formal or inherent limitation but a practical one. Most of the time, Decision Trees are used for prediction of factors or discrete outcomes.
Poor Resolution With Continuous Expectation Variables
Again, in principle, it's ok to have independent variables like "download time" or "number of days since previous online purchase"--just change your splitting criterion to variance (it's usually Information Entropy or Gini Impurity for discrete variables) but in my experience Decision Trees rarely work well in these instance. Exceptions are cases like "student's age" which looks continuous but in practice the range of values is quite small (particularly if they are reported as integers).
|
What is the weak side of decision trees?
My answer is directed to CART (the C 4.5/C 5 implementations) though i don't think are limited to it. My guess is that this is what the OP has in mind--it's usually what someone means when they say "D
|
7,345
|
What is the weak side of decision trees?
|
There are good answers here, but I am surprised that one thing has not been emphasized. CART does not make any distributional assumptions about the data, particularly the response variable. In contrast, OLS regression (for continuous response variables) and logistic regression (for certain categorical response variables), for example, do make strong assumptions; specifically, OLS regression assumes the response is conditionally normally distributed, and logistic assumes the response is binomial or multinomial.
CART's lack of such assumptions is a double-edged sword. When those assumptions are not warranted, this gives the approach a relative advantage. On the other hand, when those assumptions hold, more information can be extracted from the data by taking those facts into account. That is, standard regression methods can be more informative than CART when the assumptions are true.
|
What is the weak side of decision trees?
|
There are good answers here, but I am surprised that one thing has not been emphasized. CART does not make any distributional assumptions about the data, particularly the response variable. In contr
|
What is the weak side of decision trees?
There are good answers here, but I am surprised that one thing has not been emphasized. CART does not make any distributional assumptions about the data, particularly the response variable. In contrast, OLS regression (for continuous response variables) and logistic regression (for certain categorical response variables), for example, do make strong assumptions; specifically, OLS regression assumes the response is conditionally normally distributed, and logistic assumes the response is binomial or multinomial.
CART's lack of such assumptions is a double-edged sword. When those assumptions are not warranted, this gives the approach a relative advantage. On the other hand, when those assumptions hold, more information can be extracted from the data by taking those facts into account. That is, standard regression methods can be more informative than CART when the assumptions are true.
|
What is the weak side of decision trees?
There are good answers here, but I am surprised that one thing has not been emphasized. CART does not make any distributional assumptions about the data, particularly the response variable. In contr
|
7,346
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
That is a 95% confidence interval for $x$, but not the 95% confidence interval. For any continuous strictly-monotonic transformation, your method is a legitimate way to get a confidence interval for the transformed value. (For monotonically decreasing functions, you reverse the bounds.) The other excellent answer by tchakravarty shows that the quantiles match up for these transformations, which shows how you can prove this result.
Generally speaking, there are an infinite number of possible 95% confidence intervals you could formulate for $x$, and while this is one of them, it is not generally the shortest possible interval with this level of confidence. When formulating a confidence interval, it is usually best to try to optimise to produce the shortest possible interval with the required level of coverage --- that ensures that you can make the most accurate inference possible at the required confidence level. You can find an explanation of how to do this in a related question here.
Taking a nonlinear transformation of an existing interval does not give you the optimum (shortest) confidence interval (unless by an incredible coincidence!). The general method used to obtain the shortest confidence interval is to go back and look at the initial probability statement operating on the pivotal quantity used to formulate the interval. Instead of using "equal tails" in the probability statement, you set the relative tail sizes as a control variable, and then you find the formula for the length of the confidence interval conditional on that variable. Finally, you use calculus methods to determine the value of the control variable that minimises the interval length. Often this method can be programmed for broad classes of problems, allowing you to rapidly compute optimal confidence intervals for an object of interest.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
That is a 95% confidence interval for $x$, but not the 95% confidence interval. For any continuous strictly-monotonic transformation, your method is a legitimate way to get a confidence interval for
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
That is a 95% confidence interval for $x$, but not the 95% confidence interval. For any continuous strictly-monotonic transformation, your method is a legitimate way to get a confidence interval for the transformed value. (For monotonically decreasing functions, you reverse the bounds.) The other excellent answer by tchakravarty shows that the quantiles match up for these transformations, which shows how you can prove this result.
Generally speaking, there are an infinite number of possible 95% confidence intervals you could formulate for $x$, and while this is one of them, it is not generally the shortest possible interval with this level of confidence. When formulating a confidence interval, it is usually best to try to optimise to produce the shortest possible interval with the required level of coverage --- that ensures that you can make the most accurate inference possible at the required confidence level. You can find an explanation of how to do this in a related question here.
Taking a nonlinear transformation of an existing interval does not give you the optimum (shortest) confidence interval (unless by an incredible coincidence!). The general method used to obtain the shortest confidence interval is to go back and look at the initial probability statement operating on the pivotal quantity used to formulate the interval. Instead of using "equal tails" in the probability statement, you set the relative tail sizes as a control variable, and then you find the formula for the length of the confidence interval conditional on that variable. Finally, you use calculus methods to determine the value of the control variable that minimises the interval length. Often this method can be programmed for broad classes of problems, allowing you to rapidly compute optimal confidence intervals for an object of interest.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
That is a 95% confidence interval for $x$, but not the 95% confidence interval. For any continuous strictly-monotonic transformation, your method is a legitimate way to get a confidence interval for
|
7,347
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
You can easily show that this is the case.
Let $Y\equiv \log(X)$. Then, the $\alpha$-quantile of $Y$ is $y\in\mathbb{R}$, such that $\mathbb{P}[Y \leq y] = \alpha$. Similarly, the $\alpha$-quantile of $X$ is $x \in \mathbb{R}^+$, such that $\mathbb{P}[X \leq x] = \alpha$, or, $\mathbb{P}[\log(X) \leq y] = \alpha$, or, $\mathbb{P}[X \leq \exp(y)] = \alpha$. Thus, $y = \exp(x)$. Note that there are regularity conditions relating to the continuity and monotonicity of the transformation function $\log$ that you need to be careful about when applying this result more generally.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
You can easily show that this is the case.
Let $Y\equiv \log(X)$. Then, the $\alpha$-quantile of $Y$ is $y\in\mathbb{R}$, such that $\mathbb{P}[Y \leq y] = \alpha$. Similarly, the $\alpha$-quantile of
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
You can easily show that this is the case.
Let $Y\equiv \log(X)$. Then, the $\alpha$-quantile of $Y$ is $y\in\mathbb{R}$, such that $\mathbb{P}[Y \leq y] = \alpha$. Similarly, the $\alpha$-quantile of $X$ is $x \in \mathbb{R}^+$, such that $\mathbb{P}[X \leq x] = \alpha$, or, $\mathbb{P}[\log(X) \leq y] = \alpha$, or, $\mathbb{P}[X \leq \exp(y)] = \alpha$. Thus, $y = \exp(x)$. Note that there are regularity conditions relating to the continuity and monotonicity of the transformation function $\log$ that you need to be careful about when applying this result more generally.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
You can easily show that this is the case.
Let $Y\equiv \log(X)$. Then, the $\alpha$-quantile of $Y$ is $y\in\mathbb{R}$, such that $\mathbb{P}[Y \leq y] = \alpha$. Similarly, the $\alpha$-quantile of
|
7,348
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
Confidence intervals do not change when you transform the parameters (with a monotonic transformation)
Confidence intervals are based on probabilities conditional on the parameters, and do not transform if you transform the parameters. Unlike (Bayesian) probabilities of the parameters (on which credible intervals are based). See for instance in this question: If a credible interval has a flat prior, is a 95% confidence interval equal to a 95% credible interval? a confidence interval is not just like a credible interval with a flat prior. For a confidence interval we have:
The boundaries of probabilities (credibility intervals) will be different when you transform the variable, (for likelihood functions this is not the case). E.g for some parameter $a$ and a monotonic transformation $f(a)$ (e.g. logarithm) you get the equivalent likelihood intervals
$$\begin{array}{ccccc}
a_{\min} &<& a &<& a_{\max}\\
f(a_{\min}) &<& f(a) &<& f(a_{\max})
\end{array}$$
Why is this?
See in this question Can we reject a null hypothesis with confidence intervals produced via sampling rather than the null hypothesis?
You might see the confidence intervals as being constructed as a range of values for which an $\alpha$ level hypothesis test would succeed and outside the range an $\alpha$ level hypothesis test would fail.
That is, we choose the range of $\theta$ (as a function of $X$) based on a probability conditional on the $\theta$'s. For instance
$$I_{\alpha}(X) = \lbrace \theta: F_X(\alpha/2,\theta) \leq X \leq F_X(1-\alpha/2,\theta) \rbrace$$
the range of all hypotheses $\theta$ for which the observation is inside a two-tailed $\alpha\%$ hypothesis test.
This condition, the hypotheses, does not change with the transformation. For instance, the hypothesis $\theta = 1$, is the same as the hypothesis $\log(\theta) = 0$.
Graphical intuition
You could consider a 2d view of hypotheses on the x-axis and observations on the y-axis (see also The basic logic of constructing a confidence interval):
You could define a $\alpha$-% confidence region in two ways:
in vertical direction $L(\theta) < X < U(\theta)$ the probability for the data $X$, conditional on the parameter being truly $\theta$, to fall inside these bounds is $\alpha$ .
in horizontal direction $L(X) < \theta < U(X)$ the probability that an experiment will have the true parameter inside the confidence interval is $\alpha$%.
For the actual computation of the confidence interval we often use the vertical direction. We compute the boundaries for each $\theta$ as a hypothesis test. This computation will be the same for a transformed $\theta$.
So when you transform the parameter, then the image will just look the same, and only the scale on the x-axis will change. For a transformation of a probability density this is not the same and the transformation is more than just a change of the scale.
However,
Indeed like Ben has answered. There is not a single confidence interval, and there are many ways to choose the boundaries. However, whenever the decision is to make the confidence interval based on probabilities conditional on the parameters, then the transformation does not matter (like the before mentioned $I_{\alpha}(X) = \lbrace \theta: F_X(\alpha/2,\theta) \leq X \leq F_X(1-\alpha/2,\theta) \rbrace$).
I would disagree that there is a shortest possible interval.
Or at least this can not be defined in a unique way, or possibly it can be defined based on the conditional distribution of observations, but in that case transformation (of the conditional part) does not matter.
In that case (based on conditional distribution) you define the boundaries such that the vertical direction is smallest (e.g. how people often make the smallest decision boundaries for a hypothesis test). This is the most common way to determine the confidence interval. Optimizing the confidence interval such that you get the smallest interval in the vertical direction is independent from transformations of the parameter (you can see this as stretching/deforming the figure in horizontal direction, which does not change the distance between the boundaries in vertical direction).
Making the boundaries smallest in the horizontal direction is more difficult, because there is no good way to define/measure it (making the interval shorter for one observation requires making the interval larger for another, and one would need some way to weigh the different observations). It could be possible, maybe, if you use some prior for the distribution of $\theta$. In that case one could shift the choice of the boundaries (which still must be in the vertical direction to ensure 95% coverage, conditional on $\theta$, but they do not need to be optimal in vertical direction) in order to optimise some measure for the length of the interval. In that case, the transformation does indeed change the situation. But this way of constructing confidence intervals is not very typical.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
|
Confidence intervals do not change when you transform the parameters (with a monotonic transformation)
Confidence intervals are based on probabilities conditional on the parameters, and do not transfo
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
Confidence intervals do not change when you transform the parameters (with a monotonic transformation)
Confidence intervals are based on probabilities conditional on the parameters, and do not transform if you transform the parameters. Unlike (Bayesian) probabilities of the parameters (on which credible intervals are based). See for instance in this question: If a credible interval has a flat prior, is a 95% confidence interval equal to a 95% credible interval? a confidence interval is not just like a credible interval with a flat prior. For a confidence interval we have:
The boundaries of probabilities (credibility intervals) will be different when you transform the variable, (for likelihood functions this is not the case). E.g for some parameter $a$ and a monotonic transformation $f(a)$ (e.g. logarithm) you get the equivalent likelihood intervals
$$\begin{array}{ccccc}
a_{\min} &<& a &<& a_{\max}\\
f(a_{\min}) &<& f(a) &<& f(a_{\max})
\end{array}$$
Why is this?
See in this question Can we reject a null hypothesis with confidence intervals produced via sampling rather than the null hypothesis?
You might see the confidence intervals as being constructed as a range of values for which an $\alpha$ level hypothesis test would succeed and outside the range an $\alpha$ level hypothesis test would fail.
That is, we choose the range of $\theta$ (as a function of $X$) based on a probability conditional on the $\theta$'s. For instance
$$I_{\alpha}(X) = \lbrace \theta: F_X(\alpha/2,\theta) \leq X \leq F_X(1-\alpha/2,\theta) \rbrace$$
the range of all hypotheses $\theta$ for which the observation is inside a two-tailed $\alpha\%$ hypothesis test.
This condition, the hypotheses, does not change with the transformation. For instance, the hypothesis $\theta = 1$, is the same as the hypothesis $\log(\theta) = 0$.
Graphical intuition
You could consider a 2d view of hypotheses on the x-axis and observations on the y-axis (see also The basic logic of constructing a confidence interval):
You could define a $\alpha$-% confidence region in two ways:
in vertical direction $L(\theta) < X < U(\theta)$ the probability for the data $X$, conditional on the parameter being truly $\theta$, to fall inside these bounds is $\alpha$ .
in horizontal direction $L(X) < \theta < U(X)$ the probability that an experiment will have the true parameter inside the confidence interval is $\alpha$%.
For the actual computation of the confidence interval we often use the vertical direction. We compute the boundaries for each $\theta$ as a hypothesis test. This computation will be the same for a transformed $\theta$.
So when you transform the parameter, then the image will just look the same, and only the scale on the x-axis will change. For a transformation of a probability density this is not the same and the transformation is more than just a change of the scale.
However,
Indeed like Ben has answered. There is not a single confidence interval, and there are many ways to choose the boundaries. However, whenever the decision is to make the confidence interval based on probabilities conditional on the parameters, then the transformation does not matter (like the before mentioned $I_{\alpha}(X) = \lbrace \theta: F_X(\alpha/2,\theta) \leq X \leq F_X(1-\alpha/2,\theta) \rbrace$).
I would disagree that there is a shortest possible interval.
Or at least this can not be defined in a unique way, or possibly it can be defined based on the conditional distribution of observations, but in that case transformation (of the conditional part) does not matter.
In that case (based on conditional distribution) you define the boundaries such that the vertical direction is smallest (e.g. how people often make the smallest decision boundaries for a hypothesis test). This is the most common way to determine the confidence interval. Optimizing the confidence interval such that you get the smallest interval in the vertical direction is independent from transformations of the parameter (you can see this as stretching/deforming the figure in horizontal direction, which does not change the distance between the boundaries in vertical direction).
Making the boundaries smallest in the horizontal direction is more difficult, because there is no good way to define/measure it (making the interval shorter for one observation requires making the interval larger for another, and one would need some way to weigh the different observations). It could be possible, maybe, if you use some prior for the distribution of $\theta$. In that case one could shift the choice of the boundaries (which still must be in the vertical direction to ensure 95% coverage, conditional on $\theta$, but they do not need to be optimal in vertical direction) in order to optimise some measure for the length of the interval. In that case, the transformation does indeed change the situation. But this way of constructing confidence intervals is not very typical.
|
I know the 95% confidence interval for ln(x), do I also know the 95% confidence interval of x?
Confidence intervals do not change when you transform the parameters (with a monotonic transformation)
Confidence intervals are based on probabilities conditional on the parameters, and do not transfo
|
7,349
|
How to generate numbers based on an arbitrary discrete distribution?
|
One of the best algorithms for sampling from a discrete distribution is the alias method.
The alias method (efficiently) precomputes a two-dimensional data structure to partition a rectangle into areas proportional to the probabilities.
In this schematic from the referenced site, a rectangle of unit height has been partitioned into four kinds of regions--as differentiated by color--in the proportions $1/2$, $1/3$, $1/12$, and $1/12$, in order to sample repeatedly from a discrete distribution with these probabilities. The vertical strips have a constant (unit) width. Each is divided into just one or two pieces. The identities of the pieces and the locations of the vertical divisions are stored in tables accessible via the column index.
The table can be sampled in two simple steps (one for each coordinate) requiring generating just two independent uniform values and $O(1)$ calculation. This improves on the $O(\log(n))$ computation needed to invert the discrete CDF as described in other replies here.
|
How to generate numbers based on an arbitrary discrete distribution?
|
One of the best algorithms for sampling from a discrete distribution is the alias method.
The alias method (efficiently) precomputes a two-dimensional data structure to partition a rectangle into area
|
How to generate numbers based on an arbitrary discrete distribution?
One of the best algorithms for sampling from a discrete distribution is the alias method.
The alias method (efficiently) precomputes a two-dimensional data structure to partition a rectangle into areas proportional to the probabilities.
In this schematic from the referenced site, a rectangle of unit height has been partitioned into four kinds of regions--as differentiated by color--in the proportions $1/2$, $1/3$, $1/12$, and $1/12$, in order to sample repeatedly from a discrete distribution with these probabilities. The vertical strips have a constant (unit) width. Each is divided into just one or two pieces. The identities of the pieces and the locations of the vertical divisions are stored in tables accessible via the column index.
The table can be sampled in two simple steps (one for each coordinate) requiring generating just two independent uniform values and $O(1)$ calculation. This improves on the $O(\log(n))$ computation needed to invert the discrete CDF as described in other replies here.
|
How to generate numbers based on an arbitrary discrete distribution?
One of the best algorithms for sampling from a discrete distribution is the alias method.
The alias method (efficiently) precomputes a two-dimensional data structure to partition a rectangle into area
|
7,350
|
How to generate numbers based on an arbitrary discrete distribution?
|
You can do this easily in R, just specify the size you need:
sample(x=c(1,2,3), size=1000, replace=TRUE, prob=c(.04,.50,.46))
|
How to generate numbers based on an arbitrary discrete distribution?
|
You can do this easily in R, just specify the size you need:
sample(x=c(1,2,3), size=1000, replace=TRUE, prob=c(.04,.50,.46))
|
How to generate numbers based on an arbitrary discrete distribution?
You can do this easily in R, just specify the size you need:
sample(x=c(1,2,3), size=1000, replace=TRUE, prob=c(.04,.50,.46))
|
How to generate numbers based on an arbitrary discrete distribution?
You can do this easily in R, just specify the size you need:
sample(x=c(1,2,3), size=1000, replace=TRUE, prob=c(.04,.50,.46))
|
7,351
|
How to generate numbers based on an arbitrary discrete distribution?
|
In your example, say you draw your pseudorandom Uniform[0,1] value and call it U. Then output:
1 if U<0.04
2 if U>=0.04 and U<0.54
3 if U>=0.54
If the % specified are a, b, ..., simply output
value 1 if U
value 2 if U>=a and U<(a+b)
etc.
Essentially, we are mapping the % into subsets of [0,1], and we know the probability that a uniform random value falls into any range is simply the length of that range. Putting the ranges in order seems the simplest, if not unique, way to do it. This is assuming that you are asking about discrete distributions only; for continuous, can do something like "rejection sampling" (Wikipedia entry).
|
How to generate numbers based on an arbitrary discrete distribution?
|
In your example, say you draw your pseudorandom Uniform[0,1] value and call it U. Then output:
1 if U<0.04
2 if U>=0.04 and U<0.54
3 if U>=0.54
If the % specified are a, b, ..., simply output
value 1
|
How to generate numbers based on an arbitrary discrete distribution?
In your example, say you draw your pseudorandom Uniform[0,1] value and call it U. Then output:
1 if U<0.04
2 if U>=0.04 and U<0.54
3 if U>=0.54
If the % specified are a, b, ..., simply output
value 1 if U
value 2 if U>=a and U<(a+b)
etc.
Essentially, we are mapping the % into subsets of [0,1], and we know the probability that a uniform random value falls into any range is simply the length of that range. Putting the ranges in order seems the simplest, if not unique, way to do it. This is assuming that you are asking about discrete distributions only; for continuous, can do something like "rejection sampling" (Wikipedia entry).
|
How to generate numbers based on an arbitrary discrete distribution?
In your example, say you draw your pseudorandom Uniform[0,1] value and call it U. Then output:
1 if U<0.04
2 if U>=0.04 and U<0.54
3 if U>=0.54
If the % specified are a, b, ..., simply output
value 1
|
7,352
|
How to generate numbers based on an arbitrary discrete distribution?
|
Suppose there are $m$ possible discrete outcomes. You divide up the interval $[0,1]$ into subintervals based on the cumulative probability mass function, $F$, to give the partitioned $(0,1)$ interval
$$ I_{1} \cup I_{2} \cup \cdots \cup I_{m}$$
where $I_{j} = (F(j-1), F(j))$ and $F(0) \equiv 0$. In your example $m = 3$ and
$$I_1 = (0,.04), \ \ \ \ \ I_2 = (.04,.54), \ \ \ \ \ I_3 = (.54,1)$$
since $F(1) = .04$ and $F(2) = .54$ and $F(3) = 1$.
Then you can generate $X$ with distribution $F$ using the following algorithm:
(1) generate $U \sim {\rm Uniform}(0,1)$
(2) If $U \in I_{j}$, then $X = j$.
This step can be accomplished by looking at whether $U$ is less than each of the cumulative probabilities, and seeing where the change point (from TRUE to FALSE) occurs, which should be a matter of using a boolean operator in whatever programming language you're using and finding where the first FALSE occurs in the vector.
Note that $U$ will be in exactly one of the intervals $I_{j}$ since they are disjoint and partition $[0,1]$.
|
How to generate numbers based on an arbitrary discrete distribution?
|
Suppose there are $m$ possible discrete outcomes. You divide up the interval $[0,1]$ into subintervals based on the cumulative probability mass function, $F$, to give the partitioned $(0,1)$ interval
|
How to generate numbers based on an arbitrary discrete distribution?
Suppose there are $m$ possible discrete outcomes. You divide up the interval $[0,1]$ into subintervals based on the cumulative probability mass function, $F$, to give the partitioned $(0,1)$ interval
$$ I_{1} \cup I_{2} \cup \cdots \cup I_{m}$$
where $I_{j} = (F(j-1), F(j))$ and $F(0) \equiv 0$. In your example $m = 3$ and
$$I_1 = (0,.04), \ \ \ \ \ I_2 = (.04,.54), \ \ \ \ \ I_3 = (.54,1)$$
since $F(1) = .04$ and $F(2) = .54$ and $F(3) = 1$.
Then you can generate $X$ with distribution $F$ using the following algorithm:
(1) generate $U \sim {\rm Uniform}(0,1)$
(2) If $U \in I_{j}$, then $X = j$.
This step can be accomplished by looking at whether $U$ is less than each of the cumulative probabilities, and seeing where the change point (from TRUE to FALSE) occurs, which should be a matter of using a boolean operator in whatever programming language you're using and finding where the first FALSE occurs in the vector.
Note that $U$ will be in exactly one of the intervals $I_{j}$ since they are disjoint and partition $[0,1]$.
|
How to generate numbers based on an arbitrary discrete distribution?
Suppose there are $m$ possible discrete outcomes. You divide up the interval $[0,1]$ into subintervals based on the cumulative probability mass function, $F$, to give the partitioned $(0,1)$ interval
|
7,353
|
How to generate numbers based on an arbitrary discrete distribution?
|
One simple algorithm is to start with your uniform random number and in a loop first subtract off the first probability, if the result is negative then you return the first value, if still positive then you go to the next iteration and subtract off the next probability, check if negative, etc.
This is nice in that the number of values/probabilities can be infinite but you only need to calculate the probabilities when you get close to those numbers (for something like generating from a Poisson or negative binomial distribution).
If you have a finite set of probabilities, but will be generating many numbers from them then it could be more efficient to sort the probabilities so that you subtract the largest first, then the 2nd largest next and so forth.
|
How to generate numbers based on an arbitrary discrete distribution?
|
One simple algorithm is to start with your uniform random number and in a loop first subtract off the first probability, if the result is negative then you return the first value, if still positive th
|
How to generate numbers based on an arbitrary discrete distribution?
One simple algorithm is to start with your uniform random number and in a loop first subtract off the first probability, if the result is negative then you return the first value, if still positive then you go to the next iteration and subtract off the next probability, check if negative, etc.
This is nice in that the number of values/probabilities can be infinite but you only need to calculate the probabilities when you get close to those numbers (for something like generating from a Poisson or negative binomial distribution).
If you have a finite set of probabilities, but will be generating many numbers from them then it could be more efficient to sort the probabilities so that you subtract the largest first, then the 2nd largest next and so forth.
|
How to generate numbers based on an arbitrary discrete distribution?
One simple algorithm is to start with your uniform random number and in a loop first subtract off the first probability, if the result is negative then you return the first value, if still positive th
|
7,354
|
How to generate numbers based on an arbitrary discrete distribution?
|
First of all, let me draw your attention to a python library with ready-to-use classes for either integer or floating point random number generation that follow arbitrary distribution.
Generally speaking there are several approaches to this problem. Some are linear in time, but require large memory storage, some run in O(n log(n)) time. Some are optimized for integer numbers and some are defined for circular histograms (for example: generating random time spots during a day). In the above mentioned library I used this paper for integer number cases and this recipe for floating point numbers. It (still) lacks circular histogram support and is generally messy, but it works well.
|
How to generate numbers based on an arbitrary discrete distribution?
|
First of all, let me draw your attention to a python library with ready-to-use classes for either integer or floating point random number generation that follow arbitrary distribution.
Generally spea
|
How to generate numbers based on an arbitrary discrete distribution?
First of all, let me draw your attention to a python library with ready-to-use classes for either integer or floating point random number generation that follow arbitrary distribution.
Generally speaking there are several approaches to this problem. Some are linear in time, but require large memory storage, some run in O(n log(n)) time. Some are optimized for integer numbers and some are defined for circular histograms (for example: generating random time spots during a day). In the above mentioned library I used this paper for integer number cases and this recipe for floating point numbers. It (still) lacks circular histogram support and is generally messy, but it works well.
|
How to generate numbers based on an arbitrary discrete distribution?
First of all, let me draw your attention to a python library with ready-to-use classes for either integer or floating point random number generation that follow arbitrary distribution.
Generally spea
|
7,355
|
How to generate numbers based on an arbitrary discrete distribution?
|
I had the same problem. Given a set where each item has a probability and whose items' probabilities sum up to one, I wanted to draw a sample efficiently, i.e. without sorting anything and without repeatedly iterating over the set.
The following function draws the lowest of $N$ uniformly distributed random numbers within the interval $[a,1)$. Let $r$ be a random number from $[0,1)$.
\begin{equation}
\text{next}(N, a) = 1 - (1 - a) \cdot \sqrt[N]{r}
\end{equation}
You can use this function to draw an ascending series $(a_i)$ of $N$ uniformly distributed random numbers in [0,1). Here is an example with $N = 10$:
$a_0 = \text{next}(10, 0)$
$a_1 = \text{next}(9, a_0)$
$a_2 = \text{next}(8, a_1)$
$\dots$
$a_9 = \text{next}(1, a_8)$
While drawing that ascending series $(a_i)$ of uniformly distributed numbers, iterate over the set of probabilities $P$ which represents your arbitraty (yet finite) distribution. Let $0 \leq k < |P|$ be the iterator and $p_k \in P$. After drawing $a_i$, increment $k$ zero or more times until $\sum p_0 \dots p_k > a_i$. Then add $p_k$ to your sample and move on with drawing $a_{i+1}$.
Example with the op's set $\{(1, 0.04), (2, 0.5), (3, 0.46)\}$ and sample size $N = 10$:
i a_i k Sum Draw
0 0.031 0 0.04 1
1 0.200 1 0.54 2
2 0.236 1 0.54 2
3 0.402 1 0.54 2
4 0.488 1 0.54 2
5 0.589 2 1.0 3
6 0.625 2 1.0 3
7 0.638 2 1.0 3
8 0.738 2 1.0 3
9 0.942 2 1.0 3
Sample: $(1, 2, 2, 2, 2, 3, 3, 3, 3, 3)$
If you wonder about the $\text{next}$ function: It is the inverse of the probability that one of $N$ uniformly distributed random numbers lies within the interval $[a, x)$ with $x \leq 1$.
|
How to generate numbers based on an arbitrary discrete distribution?
|
I had the same problem. Given a set where each item has a probability and whose items' probabilities sum up to one, I wanted to draw a sample efficiently, i.e. without sorting anything and without rep
|
How to generate numbers based on an arbitrary discrete distribution?
I had the same problem. Given a set where each item has a probability and whose items' probabilities sum up to one, I wanted to draw a sample efficiently, i.e. without sorting anything and without repeatedly iterating over the set.
The following function draws the lowest of $N$ uniformly distributed random numbers within the interval $[a,1)$. Let $r$ be a random number from $[0,1)$.
\begin{equation}
\text{next}(N, a) = 1 - (1 - a) \cdot \sqrt[N]{r}
\end{equation}
You can use this function to draw an ascending series $(a_i)$ of $N$ uniformly distributed random numbers in [0,1). Here is an example with $N = 10$:
$a_0 = \text{next}(10, 0)$
$a_1 = \text{next}(9, a_0)$
$a_2 = \text{next}(8, a_1)$
$\dots$
$a_9 = \text{next}(1, a_8)$
While drawing that ascending series $(a_i)$ of uniformly distributed numbers, iterate over the set of probabilities $P$ which represents your arbitraty (yet finite) distribution. Let $0 \leq k < |P|$ be the iterator and $p_k \in P$. After drawing $a_i$, increment $k$ zero or more times until $\sum p_0 \dots p_k > a_i$. Then add $p_k$ to your sample and move on with drawing $a_{i+1}$.
Example with the op's set $\{(1, 0.04), (2, 0.5), (3, 0.46)\}$ and sample size $N = 10$:
i a_i k Sum Draw
0 0.031 0 0.04 1
1 0.200 1 0.54 2
2 0.236 1 0.54 2
3 0.402 1 0.54 2
4 0.488 1 0.54 2
5 0.589 2 1.0 3
6 0.625 2 1.0 3
7 0.638 2 1.0 3
8 0.738 2 1.0 3
9 0.942 2 1.0 3
Sample: $(1, 2, 2, 2, 2, 3, 3, 3, 3, 3)$
If you wonder about the $\text{next}$ function: It is the inverse of the probability that one of $N$ uniformly distributed random numbers lies within the interval $[a, x)$ with $x \leq 1$.
|
How to generate numbers based on an arbitrary discrete distribution?
I had the same problem. Given a set where each item has a probability and whose items' probabilities sum up to one, I wanted to draw a sample efficiently, i.e. without sorting anything and without rep
|
7,356
|
How to determine the confidence of a neural network prediction?
|
It sounds like you are looking for a prediction-interval, i.e., an interval that contains a prespecified percentage of future realizations. (Look at the tag wikis for prediction-interval and confidence-interval for the difference.)
Your best bet is likely to work directly with NN architectures that do not output single point predictions, but entire predictive distributions. You can then directly extract desired prediction intervals (or mean, or median point predictions) from these distributions. I and others have been arguing that predictive distributions are much more useful than point predictions, but to be honest, I have not yet seen a lot of work on predictive distributions with neural nets, although I have been keeping my eyes open. This paper sounds like it might be useful. You might want to search a bit, perhaps also using other keywords like "forecast distributions" or "predictive densities" and such.
That said, you might want to look into Michael Feindt's NeuroBayes algorithm, which uses a Bayesian approach to forecast predictive densities.
|
How to determine the confidence of a neural network prediction?
|
It sounds like you are looking for a prediction-interval, i.e., an interval that contains a prespecified percentage of future realizations. (Look at the tag wikis for prediction-interval and confidenc
|
How to determine the confidence of a neural network prediction?
It sounds like you are looking for a prediction-interval, i.e., an interval that contains a prespecified percentage of future realizations. (Look at the tag wikis for prediction-interval and confidence-interval for the difference.)
Your best bet is likely to work directly with NN architectures that do not output single point predictions, but entire predictive distributions. You can then directly extract desired prediction intervals (or mean, or median point predictions) from these distributions. I and others have been arguing that predictive distributions are much more useful than point predictions, but to be honest, I have not yet seen a lot of work on predictive distributions with neural nets, although I have been keeping my eyes open. This paper sounds like it might be useful. You might want to search a bit, perhaps also using other keywords like "forecast distributions" or "predictive densities" and such.
That said, you might want to look into Michael Feindt's NeuroBayes algorithm, which uses a Bayesian approach to forecast predictive densities.
|
How to determine the confidence of a neural network prediction?
It sounds like you are looking for a prediction-interval, i.e., an interval that contains a prespecified percentage of future realizations. (Look at the tag wikis for prediction-interval and confidenc
|
7,357
|
How to determine the confidence of a neural network prediction?
|
I'm not sure you can compute a confidence interval for a single prediction, but you can indeed compute a confidence interval for error rate of the whole dataset (you can generalize for accuracy and whatever other measure you are assessing).
If $e$ is your error rate while classifying some data $S$ of size $n$, a 95% confidence interval for your error rate is given by:
$$ e \pm 1.96\sqrt{\frac{e\,(1-e)}{n}}$$.
(see "Machine Learning" book from Tom Mitchell, chapter 5.)
EDIT
Guess I should state a more general case, which is:
$$ e \pm z_N\sqrt{\frac{e\,(1-e)}{n}},$$
where common choices for $z_N$ are listed in the following table:
confidence level 80% 90% 95% 98% 99%
values of zN 1.28 1.64 1.96 2.33 2.58
|
How to determine the confidence of a neural network prediction?
|
I'm not sure you can compute a confidence interval for a single prediction, but you can indeed compute a confidence interval for error rate of the whole dataset (you can generalize for accuracy and wh
|
How to determine the confidence of a neural network prediction?
I'm not sure you can compute a confidence interval for a single prediction, but you can indeed compute a confidence interval for error rate of the whole dataset (you can generalize for accuracy and whatever other measure you are assessing).
If $e$ is your error rate while classifying some data $S$ of size $n$, a 95% confidence interval for your error rate is given by:
$$ e \pm 1.96\sqrt{\frac{e\,(1-e)}{n}}$$.
(see "Machine Learning" book from Tom Mitchell, chapter 5.)
EDIT
Guess I should state a more general case, which is:
$$ e \pm z_N\sqrt{\frac{e\,(1-e)}{n}},$$
where common choices for $z_N$ are listed in the following table:
confidence level 80% 90% 95% 98% 99%
values of zN 1.28 1.64 1.96 2.33 2.58
|
How to determine the confidence of a neural network prediction?
I'm not sure you can compute a confidence interval for a single prediction, but you can indeed compute a confidence interval for error rate of the whole dataset (you can generalize for accuracy and wh
|
7,358
|
How to determine the confidence of a neural network prediction?
|
In terms of directly outputting prediction intervals, there's a 2011 paper 'Comprehensive Review of Neural Network-Based Prediction Intervals'
They compare four approaches:
1: Delta method
2: Bayesian method
3: Mean variance estimation
4: Bootstrap
The same authors went on to develop Lower Upper Bound Estimation Method for Construction of Neural Network-Based Prediction Intervals which directly outputs a lower and upper bound from the NN. Unfortunately it does not work with backprop, but recent work made this possible, High-Quality Prediction Intervals for Deep Learning.
Alternative to directly outputting prediction intervals, Bayesian neural networks (BNNs) model uncertainty in a NN's parameters, and hence capture uncertainty at the output. This is hard to do, but popular methods include running MC dropout at prediction time, or ensembling.
|
How to determine the confidence of a neural network prediction?
|
In terms of directly outputting prediction intervals, there's a 2011 paper 'Comprehensive Review of Neural Network-Based Prediction Intervals'
They compare four approaches:
1: Delta method
2: Bayesian
|
How to determine the confidence of a neural network prediction?
In terms of directly outputting prediction intervals, there's a 2011 paper 'Comprehensive Review of Neural Network-Based Prediction Intervals'
They compare four approaches:
1: Delta method
2: Bayesian method
3: Mean variance estimation
4: Bootstrap
The same authors went on to develop Lower Upper Bound Estimation Method for Construction of Neural Network-Based Prediction Intervals which directly outputs a lower and upper bound from the NN. Unfortunately it does not work with backprop, but recent work made this possible, High-Quality Prediction Intervals for Deep Learning.
Alternative to directly outputting prediction intervals, Bayesian neural networks (BNNs) model uncertainty in a NN's parameters, and hence capture uncertainty at the output. This is hard to do, but popular methods include running MC dropout at prediction time, or ensembling.
|
How to determine the confidence of a neural network prediction?
In terms of directly outputting prediction intervals, there's a 2011 paper 'Comprehensive Review of Neural Network-Based Prediction Intervals'
They compare four approaches:
1: Delta method
2: Bayesian
|
7,359
|
How to determine the confidence of a neural network prediction?
|
I don't know of any method to do that in an exact way.
A work-around could be to assume that you have gaussian noise and make the Neural Network predict a mean $\mu$ and variance $\sigma$. For the cost function you can use the NLPD (negative log probability density). For datapoint $(x_i,y_i)$ that will be $-\log N(y_i-\mu(x_i),\sigma(x_i))$. This will make your $\mu(x_i)$ try to predict your $y_i$ and your $\sigma(x_i)$ be smaller when you have more confidence and bigger when you have less.
To check how good are your assumptions for the validation data you may want to look at $\frac{y_i-\mu(x_i)}{\sigma(x_i)}$ to see if they roughly follow a $N(0,1)$. On test data you again want to maximize the probability of your test data so you can use NLPD metric again.
|
How to determine the confidence of a neural network prediction?
|
I don't know of any method to do that in an exact way.
A work-around could be to assume that you have gaussian noise and make the Neural Network predict a mean $\mu$ and variance $\sigma$. For the c
|
How to determine the confidence of a neural network prediction?
I don't know of any method to do that in an exact way.
A work-around could be to assume that you have gaussian noise and make the Neural Network predict a mean $\mu$ and variance $\sigma$. For the cost function you can use the NLPD (negative log probability density). For datapoint $(x_i,y_i)$ that will be $-\log N(y_i-\mu(x_i),\sigma(x_i))$. This will make your $\mu(x_i)$ try to predict your $y_i$ and your $\sigma(x_i)$ be smaller when you have more confidence and bigger when you have less.
To check how good are your assumptions for the validation data you may want to look at $\frac{y_i-\mu(x_i)}{\sigma(x_i)}$ to see if they roughly follow a $N(0,1)$. On test data you again want to maximize the probability of your test data so you can use NLPD metric again.
|
How to determine the confidence of a neural network prediction?
I don't know of any method to do that in an exact way.
A work-around could be to assume that you have gaussian noise and make the Neural Network predict a mean $\mu$ and variance $\sigma$. For the c
|
7,360
|
How to determine the confidence of a neural network prediction?
|
There are actually ways of doing this using dropout. Run the evaluation with dropout enabled (it's usually disabled for evaluation but turned on when training), and run the evaluation several times.
The result distribution from multiple different runs can be used as confidence intervals.
See the paper "Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning"
Watch the youtube presentation Andrew Rowan - Bayesian Deep Learning with Edward (and a trick using Dropout)
|
How to determine the confidence of a neural network prediction?
|
There are actually ways of doing this using dropout. Run the evaluation with dropout enabled (it's usually disabled for evaluation but turned on when training), and run the evaluation several times.
|
How to determine the confidence of a neural network prediction?
There are actually ways of doing this using dropout. Run the evaluation with dropout enabled (it's usually disabled for evaluation but turned on when training), and run the evaluation several times.
The result distribution from multiple different runs can be used as confidence intervals.
See the paper "Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning"
Watch the youtube presentation Andrew Rowan - Bayesian Deep Learning with Edward (and a trick using Dropout)
|
How to determine the confidence of a neural network prediction?
There are actually ways of doing this using dropout. Run the evaluation with dropout enabled (it's usually disabled for evaluation but turned on when training), and run the evaluation several times.
|
7,361
|
How to determine the confidence of a neural network prediction?
|
Prediction intervals (PI) in non parametric regression & classification problems, such as neural nets, SVMs, random forests, etc. are difficult to construct. I'd love to hear other opinions on this.
However, as far as I know, Conformal Prediction (CP) is the only principled method for building calibrated PI for prediction in nonparametric regression and classification problems. For a tutorial on CP, see Shfer & Vovk (2008), J. Machine Learning Research 9, 371-421 [pdf]
|
How to determine the confidence of a neural network prediction?
|
Prediction intervals (PI) in non parametric regression & classification problems, such as neural nets, SVMs, random forests, etc. are difficult to construct. I'd love to hear other opinions on this.
|
How to determine the confidence of a neural network prediction?
Prediction intervals (PI) in non parametric regression & classification problems, such as neural nets, SVMs, random forests, etc. are difficult to construct. I'd love to hear other opinions on this.
However, as far as I know, Conformal Prediction (CP) is the only principled method for building calibrated PI for prediction in nonparametric regression and classification problems. For a tutorial on CP, see Shfer & Vovk (2008), J. Machine Learning Research 9, 371-421 [pdf]
|
How to determine the confidence of a neural network prediction?
Prediction intervals (PI) in non parametric regression & classification problems, such as neural nets, SVMs, random forests, etc. are difficult to construct. I'd love to hear other opinions on this.
|
7,362
|
How to determine the confidence of a neural network prediction?
|
I have not heard of any method that gives a confidence interval for a neural network prediction. Despite a lack of formal methodology, it seems like it might be feasible to construct one. I have never attempted this due to the compute power that would be needed and I make no claims on this working for certain, but one method that might work for a tiny neural net (or with blazing fast GPU power it could work for moderate sized nets) would be to resample the training set and build many similar networks (say 10,000 times) with the same parameters and initial settings, and build confidence intervals based on the predictions for each of your bootstrapped net.
For example, in the 10,000 networks trained as discussed above, one might get 2.0 (after rounding the neural net regression predictions) 9,000 of those times, so you would predict 2.0 with a 90% CI. You could then build an array of CIs for each prediction made and choose the mode to report as the primary CI.
|
How to determine the confidence of a neural network prediction?
|
I have not heard of any method that gives a confidence interval for a neural network prediction. Despite a lack of formal methodology, it seems like it might be feasible to construct one. I have never
|
How to determine the confidence of a neural network prediction?
I have not heard of any method that gives a confidence interval for a neural network prediction. Despite a lack of formal methodology, it seems like it might be feasible to construct one. I have never attempted this due to the compute power that would be needed and I make no claims on this working for certain, but one method that might work for a tiny neural net (or with blazing fast GPU power it could work for moderate sized nets) would be to resample the training set and build many similar networks (say 10,000 times) with the same parameters and initial settings, and build confidence intervals based on the predictions for each of your bootstrapped net.
For example, in the 10,000 networks trained as discussed above, one might get 2.0 (after rounding the neural net regression predictions) 9,000 of those times, so you would predict 2.0 with a 90% CI. You could then build an array of CIs for each prediction made and choose the mode to report as the primary CI.
|
How to determine the confidence of a neural network prediction?
I have not heard of any method that gives a confidence interval for a neural network prediction. Despite a lack of formal methodology, it seems like it might be feasible to construct one. I have never
|
7,363
|
How to determine the confidence of a neural network prediction?
|
This article is an interesting presentation by Yarin Gal of a technique based on dropout:
http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
Archived version: https://web.archive.org/web/20210422213844/http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
|
How to determine the confidence of a neural network prediction?
|
This article is an interesting presentation by Yarin Gal of a technique based on dropout:
http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
Archived version: https://web.archive.org/web/20210422
|
How to determine the confidence of a neural network prediction?
This article is an interesting presentation by Yarin Gal of a technique based on dropout:
http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
Archived version: https://web.archive.org/web/20210422213844/http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
|
How to determine the confidence of a neural network prediction?
This article is an interesting presentation by Yarin Gal of a technique based on dropout:
http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html
Archived version: https://web.archive.org/web/20210422
|
7,364
|
How to determine the confidence of a neural network prediction?
|
Work in Progress...
There has been a lot of work on predictive intervals for neural nets going back over the years:
The simplest approach (Nix and Weigend, 1994) is to train a second neural network to predict the mean-squared error of the first. Regression networks trained to minimise the mean-squared error learn the conditional mean of the target distribution, so the output of the first network is an estimate of the conditional mean of the targets and the second learns the conditional mean of the squared distance of the targets from the mean, i.e. the conditional variance. In practice, they don't have to be separate networks, you can have one network with two outputs, one for the conditional mean and one for the conditional variance.
References
D. A. Nix and A. S. Weigend, "Estimating the mean and variance of the target probability distribution," Proceedings of 1994 IEEE International Conference on Neural Networks (ICNN'94), 1994, pp. 55-60 vol.1, doi: 10.1109/ICNN.1994.374138.
David A. Nix, Andreas S. Weigend, Learning Local Error Bars for Nonlinear Regression, NIPS 1994 (pdf)
CM Bishop, CS Qazaz, Regression with input-dependent noise: A Bayesian treatment, Advances in neural information processing systems, 347-353, 1997 (pdf)
|
How to determine the confidence of a neural network prediction?
|
Work in Progress...
There has been a lot of work on predictive intervals for neural nets going back over the years:
The simplest approach (Nix and Weigend, 1994) is to train a second neural network to
|
How to determine the confidence of a neural network prediction?
Work in Progress...
There has been a lot of work on predictive intervals for neural nets going back over the years:
The simplest approach (Nix and Weigend, 1994) is to train a second neural network to predict the mean-squared error of the first. Regression networks trained to minimise the mean-squared error learn the conditional mean of the target distribution, so the output of the first network is an estimate of the conditional mean of the targets and the second learns the conditional mean of the squared distance of the targets from the mean, i.e. the conditional variance. In practice, they don't have to be separate networks, you can have one network with two outputs, one for the conditional mean and one for the conditional variance.
References
D. A. Nix and A. S. Weigend, "Estimating the mean and variance of the target probability distribution," Proceedings of 1994 IEEE International Conference on Neural Networks (ICNN'94), 1994, pp. 55-60 vol.1, doi: 10.1109/ICNN.1994.374138.
David A. Nix, Andreas S. Weigend, Learning Local Error Bars for Nonlinear Regression, NIPS 1994 (pdf)
CM Bishop, CS Qazaz, Regression with input-dependent noise: A Bayesian treatment, Advances in neural information processing systems, 347-353, 1997 (pdf)
|
How to determine the confidence of a neural network prediction?
Work in Progress...
There has been a lot of work on predictive intervals for neural nets going back over the years:
The simplest approach (Nix and Weigend, 1994) is to train a second neural network to
|
7,365
|
How to determine the confidence of a neural network prediction?
|
I find that a simple method is MC dropout. In prediction you duplicate the case and expand that into a batch and enable the dropout, then you will obtain multiple outputs for the same input but with different dropped parameters. You get multiple outputs through one forward pass(and only one model) and then get a distribution of the output.
|
How to determine the confidence of a neural network prediction?
|
I find that a simple method is MC dropout. In prediction you duplicate the case and expand that into a batch and enable the dropout, then you will obtain multiple outputs for the same input but with d
|
How to determine the confidence of a neural network prediction?
I find that a simple method is MC dropout. In prediction you duplicate the case and expand that into a batch and enable the dropout, then you will obtain multiple outputs for the same input but with different dropped parameters. You get multiple outputs through one forward pass(and only one model) and then get a distribution of the output.
|
How to determine the confidence of a neural network prediction?
I find that a simple method is MC dropout. In prediction you duplicate the case and expand that into a batch and enable the dropout, then you will obtain multiple outputs for the same input but with d
|
7,366
|
How to determine the confidence of a neural network prediction?
|
There is no way, all ML models is not about phenomen understanding, it's interpolation methods with hope "that it works". Start with such questions confidence, robustnes to noise there is no answers.
So to derive something please use various applied and fundamental science:
Use control (and make assumption about dynamics)
Use convex optimization (with some extra condition on function)
Use math statistics (with preliminary assumptions on distributions)
Use signal processing (with some assumptions that signal is band limited)
Scientist use some prelimiary assumptions (called axioms) to derive something.
There is no way to give any confidence without some preliminary assumption, so problem in not in DL mehtod, but it's problem in any method which try to interpolate without ANY preliminary assumption-there is no way to derive via algebra something intellegently without an assumption.
NN and various ML methods are for fast prototyping to create "something" which seems works "someway" checked with cross-validation.
Even more deeper the regression fitting E[Y|X] or it's estimate can be absolutely incorrect problem to solve (maybe p.d.f. in point Y=E[Y|X] has minimum, not maximum), and there are a lot of such subtle things.
Also let me remind two unsolvable problems in AI/ML,
which can be for some reasons be forgotten, behind beauty slogans:
(1) It's interpolation methods, not extrapolation - it has no ability to deal with new problems
(2) nobody knows how any model will behave on data which is not from the same distribution (man in costume of banana for pedestrian localization)
|
How to determine the confidence of a neural network prediction?
|
There is no way, all ML models is not about phenomen understanding, it's interpolation methods with hope "that it works". Start with such questions confidence, robustnes to noise there is no answers.
|
How to determine the confidence of a neural network prediction?
There is no way, all ML models is not about phenomen understanding, it's interpolation methods with hope "that it works". Start with such questions confidence, robustnes to noise there is no answers.
So to derive something please use various applied and fundamental science:
Use control (and make assumption about dynamics)
Use convex optimization (with some extra condition on function)
Use math statistics (with preliminary assumptions on distributions)
Use signal processing (with some assumptions that signal is band limited)
Scientist use some prelimiary assumptions (called axioms) to derive something.
There is no way to give any confidence without some preliminary assumption, so problem in not in DL mehtod, but it's problem in any method which try to interpolate without ANY preliminary assumption-there is no way to derive via algebra something intellegently without an assumption.
NN and various ML methods are for fast prototyping to create "something" which seems works "someway" checked with cross-validation.
Even more deeper the regression fitting E[Y|X] or it's estimate can be absolutely incorrect problem to solve (maybe p.d.f. in point Y=E[Y|X] has minimum, not maximum), and there are a lot of such subtle things.
Also let me remind two unsolvable problems in AI/ML,
which can be for some reasons be forgotten, behind beauty slogans:
(1) It's interpolation methods, not extrapolation - it has no ability to deal with new problems
(2) nobody knows how any model will behave on data which is not from the same distribution (man in costume of banana for pedestrian localization)
|
How to determine the confidence of a neural network prediction?
There is no way, all ML models is not about phenomen understanding, it's interpolation methods with hope "that it works". Start with such questions confidence, robustnes to noise there is no answers.
|
7,367
|
Interpretation of Shapiro-Wilk test
|
No - you cannot say "the sample has a normal distribution" or "the sample comes from a population which has a normal distribution", but only "you cannot reject the hypothesis that the sample comes from a population which has a normal distribution".
In fact the sample does not have a normal distribution (see the qqplot below), but you would not expect it to as it is only a sample. The question as to the distribution of the underlying population remains open.
qqnorm( c(0.269, 0.357, 0.2, 0.221, 0.275,
0.277, 0.253, 0.127, 0.246) )
|
Interpretation of Shapiro-Wilk test
|
No - you cannot say "the sample has a normal distribution" or "the sample comes from a population which has a normal distribution", but only "you cannot reject the hypothesis that the sample comes fro
|
Interpretation of Shapiro-Wilk test
No - you cannot say "the sample has a normal distribution" or "the sample comes from a population which has a normal distribution", but only "you cannot reject the hypothesis that the sample comes from a population which has a normal distribution".
In fact the sample does not have a normal distribution (see the qqplot below), but you would not expect it to as it is only a sample. The question as to the distribution of the underlying population remains open.
qqnorm( c(0.269, 0.357, 0.2, 0.221, 0.275,
0.277, 0.253, 0.127, 0.246) )
|
Interpretation of Shapiro-Wilk test
No - you cannot say "the sample has a normal distribution" or "the sample comes from a population which has a normal distribution", but only "you cannot reject the hypothesis that the sample comes fro
|
7,368
|
Interpretation of Shapiro-Wilk test
|
Failing to reject a null hypothesis is an indication that the sample you have is too small to pick up whatever deviations from normality you have - but your sample is so small that even quite substantial deviations from normality likely won't be detected.
However a hypothesis test is pretty much beside the point in most cases that people use a test of normality for - you actually know the answer to the question you are testing - the distribution of the population from your data are drawn is not going to be normal. (It might be pretty close sometimes, but actually normal?)
The question you should care about isn't 'is the distribution they're drawn from normal' (it won't be). The question you actually should care about is more like 'is the deviation from normality I have going to materially impact my results?'. If that's potentially an issue, you might consider an analysis that's less likely to have that problem.
|
Interpretation of Shapiro-Wilk test
|
Failing to reject a null hypothesis is an indication that the sample you have is too small to pick up whatever deviations from normality you have - but your sample is so small that even quite substant
|
Interpretation of Shapiro-Wilk test
Failing to reject a null hypothesis is an indication that the sample you have is too small to pick up whatever deviations from normality you have - but your sample is so small that even quite substantial deviations from normality likely won't be detected.
However a hypothesis test is pretty much beside the point in most cases that people use a test of normality for - you actually know the answer to the question you are testing - the distribution of the population from your data are drawn is not going to be normal. (It might be pretty close sometimes, but actually normal?)
The question you should care about isn't 'is the distribution they're drawn from normal' (it won't be). The question you actually should care about is more like 'is the deviation from normality I have going to materially impact my results?'. If that's potentially an issue, you might consider an analysis that's less likely to have that problem.
|
Interpretation of Shapiro-Wilk test
Failing to reject a null hypothesis is an indication that the sample you have is too small to pick up whatever deviations from normality you have - but your sample is so small that even quite substant
|
7,369
|
Interpretation of Shapiro-Wilk test
|
Considering that you are pretty new to statistics, I suspect that you are thinking about this because these are residuals of an estimate of a mean and you want to know whether the assumption of normality is valid for confidence estimates using a $t$-distribution.
$t$-tests are quite robust to violations of this assumption, the data look vaguely normal in Henry's q-q plot, and the Shapiro test doesn't indicate that the data come from a population with a non-normal distribution, so I would say that a $t$-test is appropriate.
I further speculate that you are looking at proportions, in which case you could use a binomial distribution if you were concerned about violations of assumptions.
If it was some other concern that got you to Shapiro tests, you can ignore everything I just said.
|
Interpretation of Shapiro-Wilk test
|
Considering that you are pretty new to statistics, I suspect that you are thinking about this because these are residuals of an estimate of a mean and you want to know whether the assumption of normal
|
Interpretation of Shapiro-Wilk test
Considering that you are pretty new to statistics, I suspect that you are thinking about this because these are residuals of an estimate of a mean and you want to know whether the assumption of normality is valid for confidence estimates using a $t$-distribution.
$t$-tests are quite robust to violations of this assumption, the data look vaguely normal in Henry's q-q plot, and the Shapiro test doesn't indicate that the data come from a population with a non-normal distribution, so I would say that a $t$-test is appropriate.
I further speculate that you are looking at proportions, in which case you could use a binomial distribution if you were concerned about violations of assumptions.
If it was some other concern that got you to Shapiro tests, you can ignore everything I just said.
|
Interpretation of Shapiro-Wilk test
Considering that you are pretty new to statistics, I suspect that you are thinking about this because these are residuals of an estimate of a mean and you want to know whether the assumption of normal
|
7,370
|
Interpretation of Shapiro-Wilk test
|
As Henry already said you can't say it's normal. Just try to run the following command in R several times:
shapiro.test(runif(9))
This will test the sample of 9 numbers from uniform distribution. Many times the p-value will be much larger than 0.05 - which means that you cannot conclude that the distribution is normal.
|
Interpretation of Shapiro-Wilk test
|
As Henry already said you can't say it's normal. Just try to run the following command in R several times:
shapiro.test(runif(9))
This will test the sample of 9 numbers from uniform distribution. Ma
|
Interpretation of Shapiro-Wilk test
As Henry already said you can't say it's normal. Just try to run the following command in R several times:
shapiro.test(runif(9))
This will test the sample of 9 numbers from uniform distribution. Many times the p-value will be much larger than 0.05 - which means that you cannot conclude that the distribution is normal.
|
Interpretation of Shapiro-Wilk test
As Henry already said you can't say it's normal. Just try to run the following command in R several times:
shapiro.test(runif(9))
This will test the sample of 9 numbers from uniform distribution. Ma
|
7,371
|
Interpretation of Shapiro-Wilk test
|
I was also looking on how to properly interpret W value in Shapiro-Wilk test and according to Emil O. W. Kirkegaard's article "W values from the Shapiro-Wilk test visualized with different datasets" it's very difficult to say anything about the normality of a distribution looking at W value alone.
As he states in conclusion:
Generally we see that given a large sample, SW is sensitive to departures from non-normality. If the departure is very small, however, it is not very important.
We also see that it is hard to reduce the W value even if one deliberately tries. One needs to test extremely non-normal distribution in order for it to fall appreciatively below .99.
See original article for more information.
|
Interpretation of Shapiro-Wilk test
|
I was also looking on how to properly interpret W value in Shapiro-Wilk test and according to Emil O. W. Kirkegaard's article "W values from the Shapiro-Wilk test visualized with different datasets" i
|
Interpretation of Shapiro-Wilk test
I was also looking on how to properly interpret W value in Shapiro-Wilk test and according to Emil O. W. Kirkegaard's article "W values from the Shapiro-Wilk test visualized with different datasets" it's very difficult to say anything about the normality of a distribution looking at W value alone.
As he states in conclusion:
Generally we see that given a large sample, SW is sensitive to departures from non-normality. If the departure is very small, however, it is not very important.
We also see that it is hard to reduce the W value even if one deliberately tries. One needs to test extremely non-normal distribution in order for it to fall appreciatively below .99.
See original article for more information.
|
Interpretation of Shapiro-Wilk test
I was also looking on how to properly interpret W value in Shapiro-Wilk test and according to Emil O. W. Kirkegaard's article "W values from the Shapiro-Wilk test visualized with different datasets" i
|
7,372
|
Interpretation of Shapiro-Wilk test
|
One important issue not mentioned by previous answer are the test limitations:
The test has limitations, most importantly that the test has a bias by sample size. The larger the sample, the more likely you’ll get a statistically significant result.
To answer the original question (very small sample size): see the following articles about better alternatives like QQ plot and histogram for this specific case.
|
Interpretation of Shapiro-Wilk test
|
One important issue not mentioned by previous answer are the test limitations:
The test has limitations, most importantly that the test has a bias by sample size. The larger the sample, the more lik
|
Interpretation of Shapiro-Wilk test
One important issue not mentioned by previous answer are the test limitations:
The test has limitations, most importantly that the test has a bias by sample size. The larger the sample, the more likely you’ll get a statistically significant result.
To answer the original question (very small sample size): see the following articles about better alternatives like QQ plot and histogram for this specific case.
|
Interpretation of Shapiro-Wilk test
One important issue not mentioned by previous answer are the test limitations:
The test has limitations, most importantly that the test has a bias by sample size. The larger the sample, the more lik
|
7,373
|
How to perform orthogonal regression (total least squares) via PCA?
|
Ordinary least squares vs. total least squares
Let's first consider the simplest case of only one predictor (independent) variable $x$. For simplicity, let both $x$ and $y$ be centered, i.e. intercept is always zero. The difference between standard OLS regression and "orthogonal" TLS regression is clearly shown on this (adapted by me) figure from the most popular answer in the most popular thread on PCA:
OLS fits the equation $y=\beta x$ by minimizing squared distances between observed values $y$ and predicted values $\hat y$. TLS fits the same equation by minimizing squared distances between $(x,y)$ points and their projection on the line. In this simplest case TLS line is simply the first principal component of the 2D data. To find $\beta$, do PCA on $(x,y)$ points, i.e. construct the $2\times 2$ covariance matrix $\boldsymbol \Sigma$ and find its first eigenvector $\mathbf v = (v_x, v_y)$; then $\beta = v_y/v_x$.
In Matlab:
v = pca([x y]); //# x and y are centered column vectors
beta = v(2,1)/v(1,1);
In R:
v <- prcomp(cbind(x,y))$rotation
beta <- v[2,1]/v[1,1]
By the way, this will yield correct slope even if $x$ and $y$ were not centered (because built-in PCA functions automatically perform centering). To recover the intercept, compute $\beta_0 = \bar y - \beta \bar x$.
OLS vs. TLS, multiple regression
Given a dependent variable $y$ and many independent variables $x_i$ (again, all centered for simplicity), regression fits an equation $$y= \beta_1 x_1 + \ldots + \beta_p x_p.$$ OLS does the fit by minimizing the squared errors between observed values of $y$ and predicted values $\hat y$. TLS does the fit by minimizing the squared distances between observed $(\mathbf x, y)\in\mathbb R^{p+1}$ points and the closest points on the regression plane/hyperplane.
Note that there is no "regression line" anymore! The equation above specifies a hyperplane: it's a 2D plane if there are two predictors, 3D hyperplane if there are three predictors, etc. So the solution above does not work: we cannot get the TLS solution by taking the first PC only (which is a line). Still, the solution can be easily obtained via PCA.
As before, PCA is performed on $(\mathbf x, y)$ points. This yields $p+1$ eigenvectors in columns of $\mathbf V$. The first $p$ eigenvectors define a $p$-dimensional hyperplane $\mathcal H$ that we need; the last (number $p+1$) eigenvector $\mathbf v_{p+1}$ is orthogonal to it. The question is how to transform the basis of $\mathcal H$ given by the first $p$ eigenvectors into the $\boldsymbol \beta$ coefficients.
Observe that if we set $x_i=0$ for all $i \ne k$ and only $x_k=1$, then $\hat y=\beta_k$, i.e. the vector $$(0,\ldots, 1, \ldots, \beta_k) \in \mathcal H$$ lies in the hyperplane $\mathcal H$. On the other hand, we know that $$\mathbf v_{p+1}=(v_1, \ldots, v_{p+1}) \:\bot\: \mathcal H$$ is orthogonal to it. I.e. their dot product must be zero: $$v_k + \beta_k v_{p+1}=0 \Rightarrow \beta_k = -v_k/v_{p+1}.$$
In Matlab:
v = pca([X y]); //# X is a centered n-times-p matrix, y is n-times-1 column vector
beta = -v(1:end-1,end)/v(end,end);
In R:
v <- prcomp(cbind(X,y))$rotation
beta <- -v[-ncol(v),ncol(v)] / v[ncol(v),ncol(v)]
Again, this will yield correct slopes even if $x$ and $y$ were not centered (because built-in PCA functions automatically perform centering). To recover the intercept, compute $\beta_0 = \bar y - \bar {\mathbf x} \boldsymbol \beta$.
As a sanity check, notice that this solution coincides with the previous one in case of only a single predictor $x$. Indeed, then the $(x,y)$ space is 2D, and so, given that the first PCA eigenvector is orthogonal to the second (last) one, $v^{(1)}_y/v^{(1)}_x=-v^{(2)}_x/v^{(2)}_y$.
Closed form solution for TLS
Surprisingly, it turns out that there is a closed form equation for $\boldsymbol \beta$. The argument below is taken from Sabine van Huffel's book "The total least squares" (section 2.3.2).
Let $\mathbf X$ and $\mathbf y$ be the centered data matrices. The last PCA eigenvector $\mathbf v_{p+1}$ is an eigenvector of the covariance matrix of $[\mathbf X\: \mathbf y]$ with an eigenvalue $\sigma^2_{p+1}$. If it is an eigenvector, then so is $-\mathbf v_{p+1}/v_{p+1} = (\boldsymbol \beta\:\: -1)^\top$. Writing down the eigenvector equation:
$$\left(\begin{array}{c}\mathbf X^\top \mathbf X & \mathbf X^\top \mathbf y\\ \mathbf y^\top \mathbf X & \mathbf y^\top \mathbf y\end{array}\right) \left(\begin{array}{c}\boldsymbol \beta \\ -1\end{array}\right) = \sigma^2_{p+1}\left(\begin{array}{c}\boldsymbol \beta \\ -1\end{array}\right),$$
and computing the product on the left, we immediately get that $$\boldsymbol \beta_\mathrm{TLS} = (\mathbf X^\top \mathbf X - \sigma^2_{p+1}\mathbf I)^{-1} \mathbf X^\top \mathbf y,$$ which strongly reminds the familiar OLS expression $$\boldsymbol \beta_\mathrm{OLS} = (\mathbf X^\top \mathbf X)^{-1} \mathbf X^\top \mathbf y.$$
Multivariate multiple regression
The same formula can be generalized to the multivariate case, but even to define what multivariate TLS does, would require some algebra. See Wikipedia on TLS. Multivariate OLS regression is equivalent to a bunch of univariate OLS regressions for each dependent variable, but in the TLS case it is not so.
|
How to perform orthogonal regression (total least squares) via PCA?
|
Ordinary least squares vs. total least squares
Let's first consider the simplest case of only one predictor (independent) variable $x$. For simplicity, let both $x$ and $y$ be centered, i.e. intercept
|
How to perform orthogonal regression (total least squares) via PCA?
Ordinary least squares vs. total least squares
Let's first consider the simplest case of only one predictor (independent) variable $x$. For simplicity, let both $x$ and $y$ be centered, i.e. intercept is always zero. The difference between standard OLS regression and "orthogonal" TLS regression is clearly shown on this (adapted by me) figure from the most popular answer in the most popular thread on PCA:
OLS fits the equation $y=\beta x$ by minimizing squared distances between observed values $y$ and predicted values $\hat y$. TLS fits the same equation by minimizing squared distances between $(x,y)$ points and their projection on the line. In this simplest case TLS line is simply the first principal component of the 2D data. To find $\beta$, do PCA on $(x,y)$ points, i.e. construct the $2\times 2$ covariance matrix $\boldsymbol \Sigma$ and find its first eigenvector $\mathbf v = (v_x, v_y)$; then $\beta = v_y/v_x$.
In Matlab:
v = pca([x y]); //# x and y are centered column vectors
beta = v(2,1)/v(1,1);
In R:
v <- prcomp(cbind(x,y))$rotation
beta <- v[2,1]/v[1,1]
By the way, this will yield correct slope even if $x$ and $y$ were not centered (because built-in PCA functions automatically perform centering). To recover the intercept, compute $\beta_0 = \bar y - \beta \bar x$.
OLS vs. TLS, multiple regression
Given a dependent variable $y$ and many independent variables $x_i$ (again, all centered for simplicity), regression fits an equation $$y= \beta_1 x_1 + \ldots + \beta_p x_p.$$ OLS does the fit by minimizing the squared errors between observed values of $y$ and predicted values $\hat y$. TLS does the fit by minimizing the squared distances between observed $(\mathbf x, y)\in\mathbb R^{p+1}$ points and the closest points on the regression plane/hyperplane.
Note that there is no "regression line" anymore! The equation above specifies a hyperplane: it's a 2D plane if there are two predictors, 3D hyperplane if there are three predictors, etc. So the solution above does not work: we cannot get the TLS solution by taking the first PC only (which is a line). Still, the solution can be easily obtained via PCA.
As before, PCA is performed on $(\mathbf x, y)$ points. This yields $p+1$ eigenvectors in columns of $\mathbf V$. The first $p$ eigenvectors define a $p$-dimensional hyperplane $\mathcal H$ that we need; the last (number $p+1$) eigenvector $\mathbf v_{p+1}$ is orthogonal to it. The question is how to transform the basis of $\mathcal H$ given by the first $p$ eigenvectors into the $\boldsymbol \beta$ coefficients.
Observe that if we set $x_i=0$ for all $i \ne k$ and only $x_k=1$, then $\hat y=\beta_k$, i.e. the vector $$(0,\ldots, 1, \ldots, \beta_k) \in \mathcal H$$ lies in the hyperplane $\mathcal H$. On the other hand, we know that $$\mathbf v_{p+1}=(v_1, \ldots, v_{p+1}) \:\bot\: \mathcal H$$ is orthogonal to it. I.e. their dot product must be zero: $$v_k + \beta_k v_{p+1}=0 \Rightarrow \beta_k = -v_k/v_{p+1}.$$
In Matlab:
v = pca([X y]); //# X is a centered n-times-p matrix, y is n-times-1 column vector
beta = -v(1:end-1,end)/v(end,end);
In R:
v <- prcomp(cbind(X,y))$rotation
beta <- -v[-ncol(v),ncol(v)] / v[ncol(v),ncol(v)]
Again, this will yield correct slopes even if $x$ and $y$ were not centered (because built-in PCA functions automatically perform centering). To recover the intercept, compute $\beta_0 = \bar y - \bar {\mathbf x} \boldsymbol \beta$.
As a sanity check, notice that this solution coincides with the previous one in case of only a single predictor $x$. Indeed, then the $(x,y)$ space is 2D, and so, given that the first PCA eigenvector is orthogonal to the second (last) one, $v^{(1)}_y/v^{(1)}_x=-v^{(2)}_x/v^{(2)}_y$.
Closed form solution for TLS
Surprisingly, it turns out that there is a closed form equation for $\boldsymbol \beta$. The argument below is taken from Sabine van Huffel's book "The total least squares" (section 2.3.2).
Let $\mathbf X$ and $\mathbf y$ be the centered data matrices. The last PCA eigenvector $\mathbf v_{p+1}$ is an eigenvector of the covariance matrix of $[\mathbf X\: \mathbf y]$ with an eigenvalue $\sigma^2_{p+1}$. If it is an eigenvector, then so is $-\mathbf v_{p+1}/v_{p+1} = (\boldsymbol \beta\:\: -1)^\top$. Writing down the eigenvector equation:
$$\left(\begin{array}{c}\mathbf X^\top \mathbf X & \mathbf X^\top \mathbf y\\ \mathbf y^\top \mathbf X & \mathbf y^\top \mathbf y\end{array}\right) \left(\begin{array}{c}\boldsymbol \beta \\ -1\end{array}\right) = \sigma^2_{p+1}\left(\begin{array}{c}\boldsymbol \beta \\ -1\end{array}\right),$$
and computing the product on the left, we immediately get that $$\boldsymbol \beta_\mathrm{TLS} = (\mathbf X^\top \mathbf X - \sigma^2_{p+1}\mathbf I)^{-1} \mathbf X^\top \mathbf y,$$ which strongly reminds the familiar OLS expression $$\boldsymbol \beta_\mathrm{OLS} = (\mathbf X^\top \mathbf X)^{-1} \mathbf X^\top \mathbf y.$$
Multivariate multiple regression
The same formula can be generalized to the multivariate case, but even to define what multivariate TLS does, would require some algebra. See Wikipedia on TLS. Multivariate OLS regression is equivalent to a bunch of univariate OLS regressions for each dependent variable, but in the TLS case it is not so.
|
How to perform orthogonal regression (total least squares) via PCA?
Ordinary least squares vs. total least squares
Let's first consider the simplest case of only one predictor (independent) variable $x$. For simplicity, let both $x$ and $y$ be centered, i.e. intercept
|
7,374
|
How to perform orthogonal regression (total least squares) via PCA?
|
Based on the naive GNU Octave implementation found here, something like this might (grain of salt, it's late) work.
tls <- function(A, b){
n <- ncol(A)
C <- cbind(A, b)
V <- svd(C)$v
VAB <- V[1:n, (n+1):ncol(V)]
VBB <- V[(n+1):nrow(V), (n+1):ncol(V)]
return(-VAB/VBB)
}
|
How to perform orthogonal regression (total least squares) via PCA?
|
Based on the naive GNU Octave implementation found here, something like this might (grain of salt, it's late) work.
tls <- function(A, b){
n <- ncol(A)
C <- cbind(A, b)
V <- svd(C)$v
VAB <-
|
How to perform orthogonal regression (total least squares) via PCA?
Based on the naive GNU Octave implementation found here, something like this might (grain of salt, it's late) work.
tls <- function(A, b){
n <- ncol(A)
C <- cbind(A, b)
V <- svd(C)$v
VAB <- V[1:n, (n+1):ncol(V)]
VBB <- V[(n+1):nrow(V), (n+1):ncol(V)]
return(-VAB/VBB)
}
|
How to perform orthogonal regression (total least squares) via PCA?
Based on the naive GNU Octave implementation found here, something like this might (grain of salt, it's late) work.
tls <- function(A, b){
n <- ncol(A)
C <- cbind(A, b)
V <- svd(C)$v
VAB <-
|
7,375
|
How to perform orthogonal regression (total least squares) via PCA?
|
princomp is running principal component analysis instead of total least squares regression. As far as I know there is no R function nor package that does TLS; at most there is Deming regression in MethComp.
Yet, please treat this as a suggestion that it is most likely not worth it.
|
How to perform orthogonal regression (total least squares) via PCA?
|
princomp is running principal component analysis instead of total least squares regression. As far as I know there is no R function nor package that does TLS; at most there is Deming regression in Met
|
How to perform orthogonal regression (total least squares) via PCA?
princomp is running principal component analysis instead of total least squares regression. As far as I know there is no R function nor package that does TLS; at most there is Deming regression in MethComp.
Yet, please treat this as a suggestion that it is most likely not worth it.
|
How to perform orthogonal regression (total least squares) via PCA?
princomp is running principal component analysis instead of total least squares regression. As far as I know there is no R function nor package that does TLS; at most there is Deming regression in Met
|
7,376
|
Calculate Transition Matrix (Markov) in R
|
I am not immediately aware of a "built-in" function (e.g., in base or similar), but we can do this very easily and efficiently in a couple of lines of code.
Here is a function that takes a matrix (not a data frame) as an input and produces either the transition counts (prob=FALSE) or, by default (prob=TRUE), the estimated transition probabilities.
# Function to calculate first-order Markov transition matrix.
# Each *row* corresponds to a single run of the Markov chain
trans.matrix <- function(X, prob=T)
{
tt <- table( c(X[,-ncol(X)]), c(X[,-1]) )
if(prob) tt <- tt / rowSums(tt)
tt
}
If you need to call it on a data frame you can always do
trans.matrix(as.matrix(dat))
If you're looking for some third-party package, then Rseek or the R search site may provide additional resources.
|
Calculate Transition Matrix (Markov) in R
|
I am not immediately aware of a "built-in" function (e.g., in base or similar), but we can do this very easily and efficiently in a couple of lines of code.
Here is a function that takes a matrix (not
|
Calculate Transition Matrix (Markov) in R
I am not immediately aware of a "built-in" function (e.g., in base or similar), but we can do this very easily and efficiently in a couple of lines of code.
Here is a function that takes a matrix (not a data frame) as an input and produces either the transition counts (prob=FALSE) or, by default (prob=TRUE), the estimated transition probabilities.
# Function to calculate first-order Markov transition matrix.
# Each *row* corresponds to a single run of the Markov chain
trans.matrix <- function(X, prob=T)
{
tt <- table( c(X[,-ncol(X)]), c(X[,-1]) )
if(prob) tt <- tt / rowSums(tt)
tt
}
If you need to call it on a data frame you can always do
trans.matrix(as.matrix(dat))
If you're looking for some third-party package, then Rseek or the R search site may provide additional resources.
|
Calculate Transition Matrix (Markov) in R
I am not immediately aware of a "built-in" function (e.g., in base or similar), but we can do this very easily and efficiently in a couple of lines of code.
Here is a function that takes a matrix (not
|
7,377
|
Calculate Transition Matrix (Markov) in R
|
I have just uploaded a new R package, markovchain, based on S4 programming style. Along with various methods to handle S4 markovchain objects it contains a function to fit a Markov chain from a sequence of states. Have a look at:
library(markovchain)
sequence <- c("a", "b", "a", "a", "a", "a", "b", "a", "b", "a",
"b", "a", "a", "b", "b", "b", "a")
mcFit <- markovchainFit(data=sequence)
It could help.
|
Calculate Transition Matrix (Markov) in R
|
I have just uploaded a new R package, markovchain, based on S4 programming style. Along with various methods to handle S4 markovchain objects it contains a function to fit a Markov chain from a sequen
|
Calculate Transition Matrix (Markov) in R
I have just uploaded a new R package, markovchain, based on S4 programming style. Along with various methods to handle S4 markovchain objects it contains a function to fit a Markov chain from a sequence of states. Have a look at:
library(markovchain)
sequence <- c("a", "b", "a", "a", "a", "a", "b", "a", "b", "a",
"b", "a", "a", "b", "b", "b", "a")
mcFit <- markovchainFit(data=sequence)
It could help.
|
Calculate Transition Matrix (Markov) in R
I have just uploaded a new R package, markovchain, based on S4 programming style. Along with various methods to handle S4 markovchain objects it contains a function to fit a Markov chain from a sequen
|
7,378
|
Pre-training in deep convolutional neural network?
|
I'm not sure if this exactly answers your question, but from what I understand the reason you don't see people pretraining (I mean this in an unsupervised pretraining sense) conv nets is because there have been various innovations in purely supervised training that have rendered unsupervised pretraining unnecessary (for now, who knows what problems and issues the future will hold?).
One of the main innovations was moving away from sigmoidal (sigmoid, tanh) activation units, which can saturate/have regions of near flat curvature and thus very little gradient gets propagated backwards, so learning is incredibly slow if not completely halted for all practical intents and purposes. The Glorot, Bordes and Bengio article Deep Sparse Rectifier Neural Networks used rectified linear units (ReLUs) as activation functions in lieu of the traditional sigmoidal units. The ReLUs have the following form: $f(x) = \max(0, x)$. Notice that they are unbounded and for the positive part, has constant gradient 1.
The Glorot, Bordes and Bengio article used ReLUs for multilayer perceptrons and not Conv Nets. A previous article What is the best Multi-Stage Architecture for Object Recognition by Jarret and others from Yann LeCun's NYU group used rectifying nonlinearities but for the sigmoidal units, so they had activation functions of the form $f(x) = |\tanh(x)|$, etc. Both articles observed that using rectifying nonlinearities seems to close much of the gap between purely supervised methods and unsupervised pretrained methods.
Another innovation is that we have figured out much better initializations for deep networks. Using the idea of standardizing variance across the layers of a network, good rules of thumb have been established over the years. One of the first, most popular ones was by Glorot and Bengio Understanding the Difficulty of Training Deep Feedforward Networks which provided a way to initialize deep nets under a linear activation hypothesis and later on Delving Deep Into Rectifiers by a group of Microsoft Research team members which modify the Glorot and Bengio weight initialization to account for the rectifying nonlinearities. The weight initialization is a big deal for extremely deep nets. For a 30 layer conv net, the MSR weight initialization performed much better than the Glorot weight initialization. Keep in mind that the Glorot paper came out in 2010 and the MSR paper came out in 2015.
I am not sure if the ImageNet Classification with Deep Convolutional Neural Networks paper by Alex Krizhevsky, Ilya Sutskever and Geoff Hinton was the first to use ReLUs for conv nets, but it had the biggest impact. In this paper we see that ReLUs for conv nets speeds up learning, as evidenced by one of their CIFAR-10 graphs which shows that ReLU conv nets can achieve lower training error rates faster than non-ReLU conv nets. These ReLUs do not suffer from the vanishing gradient/saturating sigmoidal issues and can be used to train much deeper nets. One of the other big innovations has been the use of Dropout training, a stochastic noise injection or model averaging technique (depending on your point of view) which allows us to train deeper, bigger neural networks longer without overfitting as much.
And the conv net innovation continued at a blistering pace, nearly all of the methods using ReLUs (or some modification like PReLUs from Microsoft Research), Dropout, and purely supervised training (SGD + Momentum, possibly some adaptive learning rate techniques like RMSProp or ADAGrad).
So as of now, a lot of the top performing conv nets seem to be of a purely supervised nature. That's not to say that unsupervised pretraining or using unsupervised techniques may not be important in the future. But some incredibly deep conv nets have been trained, have matched or surpassed human level performance on very rich datasets, just using supervised training. In fact I believe the latest Microsoft Research submission to the ImageNet 2015 contest had 150 layers. That is not a typo. 150.
If you want to use unsupervised pretraining for conv nets, I think you would be best finding a task where "standard" supervised training of conv nets doesn't perform so well and try unsupervised pretraining.
Unlike natural language modeling, it seems to be hard to find an unsupervised task that helps a corresponding supervised task when it comes to image data. But if you look around the Internet enough, you see some of the pioneers of deep learning (Yoshua Bengio, Yann LeCun to name a few) talk about how important they think unsupervised learning is and will be.
|
Pre-training in deep convolutional neural network?
|
I'm not sure if this exactly answers your question, but from what I understand the reason you don't see people pretraining (I mean this in an unsupervised pretraining sense) conv nets is because there
|
Pre-training in deep convolutional neural network?
I'm not sure if this exactly answers your question, but from what I understand the reason you don't see people pretraining (I mean this in an unsupervised pretraining sense) conv nets is because there have been various innovations in purely supervised training that have rendered unsupervised pretraining unnecessary (for now, who knows what problems and issues the future will hold?).
One of the main innovations was moving away from sigmoidal (sigmoid, tanh) activation units, which can saturate/have regions of near flat curvature and thus very little gradient gets propagated backwards, so learning is incredibly slow if not completely halted for all practical intents and purposes. The Glorot, Bordes and Bengio article Deep Sparse Rectifier Neural Networks used rectified linear units (ReLUs) as activation functions in lieu of the traditional sigmoidal units. The ReLUs have the following form: $f(x) = \max(0, x)$. Notice that they are unbounded and for the positive part, has constant gradient 1.
The Glorot, Bordes and Bengio article used ReLUs for multilayer perceptrons and not Conv Nets. A previous article What is the best Multi-Stage Architecture for Object Recognition by Jarret and others from Yann LeCun's NYU group used rectifying nonlinearities but for the sigmoidal units, so they had activation functions of the form $f(x) = |\tanh(x)|$, etc. Both articles observed that using rectifying nonlinearities seems to close much of the gap between purely supervised methods and unsupervised pretrained methods.
Another innovation is that we have figured out much better initializations for deep networks. Using the idea of standardizing variance across the layers of a network, good rules of thumb have been established over the years. One of the first, most popular ones was by Glorot and Bengio Understanding the Difficulty of Training Deep Feedforward Networks which provided a way to initialize deep nets under a linear activation hypothesis and later on Delving Deep Into Rectifiers by a group of Microsoft Research team members which modify the Glorot and Bengio weight initialization to account for the rectifying nonlinearities. The weight initialization is a big deal for extremely deep nets. For a 30 layer conv net, the MSR weight initialization performed much better than the Glorot weight initialization. Keep in mind that the Glorot paper came out in 2010 and the MSR paper came out in 2015.
I am not sure if the ImageNet Classification with Deep Convolutional Neural Networks paper by Alex Krizhevsky, Ilya Sutskever and Geoff Hinton was the first to use ReLUs for conv nets, but it had the biggest impact. In this paper we see that ReLUs for conv nets speeds up learning, as evidenced by one of their CIFAR-10 graphs which shows that ReLU conv nets can achieve lower training error rates faster than non-ReLU conv nets. These ReLUs do not suffer from the vanishing gradient/saturating sigmoidal issues and can be used to train much deeper nets. One of the other big innovations has been the use of Dropout training, a stochastic noise injection or model averaging technique (depending on your point of view) which allows us to train deeper, bigger neural networks longer without overfitting as much.
And the conv net innovation continued at a blistering pace, nearly all of the methods using ReLUs (or some modification like PReLUs from Microsoft Research), Dropout, and purely supervised training (SGD + Momentum, possibly some adaptive learning rate techniques like RMSProp or ADAGrad).
So as of now, a lot of the top performing conv nets seem to be of a purely supervised nature. That's not to say that unsupervised pretraining or using unsupervised techniques may not be important in the future. But some incredibly deep conv nets have been trained, have matched or surpassed human level performance on very rich datasets, just using supervised training. In fact I believe the latest Microsoft Research submission to the ImageNet 2015 contest had 150 layers. That is not a typo. 150.
If you want to use unsupervised pretraining for conv nets, I think you would be best finding a task where "standard" supervised training of conv nets doesn't perform so well and try unsupervised pretraining.
Unlike natural language modeling, it seems to be hard to find an unsupervised task that helps a corresponding supervised task when it comes to image data. But if you look around the Internet enough, you see some of the pioneers of deep learning (Yoshua Bengio, Yann LeCun to name a few) talk about how important they think unsupervised learning is and will be.
|
Pre-training in deep convolutional neural network?
I'm not sure if this exactly answers your question, but from what I understand the reason you don't see people pretraining (I mean this in an unsupervised pretraining sense) conv nets is because there
|
7,379
|
Pre-training in deep convolutional neural network?
|
As can be understood from the above answers, pre-training was 'fashioned out' when multiple things happened. However, I do want to distill my understanding of it:
Long time ago in 2010, everyone cared about pre-training. Here is a great paper on the subject that I did not see brought up.
Slightly before before Alex Krizhevsky, Ilya Sutskever and Geoff Hinton published their imagenet paper, people still believed features mattered but were focused mostly on unsupervised learning and even self taught learning to manufacture those features.
It is not hard to see why - the building blocks of neural networks at the time were not as robust and converged very slowly to useful features. Many times they even failed spectacularly. Pre training was useful when you had ample data you could get a good initialization for SGD.
When relu was brought up, networks converged faster. When leaky relu and more recent solutions were brought up, neural nets became more robust machines when it comes to converging to a viable result. I highly recommend that you play with an excellent neural networks demo this talented googler wrote, you will see what I am talking about.
Getting to our main point, that is not to say that some form of Pre-training is not important in deep learning. If you want to get state of the art results you have to perform pre-processing of the data (ZCA for example) and properly choose the initial weights - this is a very good paper on the subject.
So you see, pre-training changed in form to pre-processing and weights initialization but remained in function and it became more elegant.
As a final note, machine learning is very fashionable. I am personally betting like Andrew Ng that unsupervised and self-taught learning will be dominant in the future so don't make this a religion :)
|
Pre-training in deep convolutional neural network?
|
As can be understood from the above answers, pre-training was 'fashioned out' when multiple things happened. However, I do want to distill my understanding of it:
Long time ago in 2010, everyone care
|
Pre-training in deep convolutional neural network?
As can be understood from the above answers, pre-training was 'fashioned out' when multiple things happened. However, I do want to distill my understanding of it:
Long time ago in 2010, everyone cared about pre-training. Here is a great paper on the subject that I did not see brought up.
Slightly before before Alex Krizhevsky, Ilya Sutskever and Geoff Hinton published their imagenet paper, people still believed features mattered but were focused mostly on unsupervised learning and even self taught learning to manufacture those features.
It is not hard to see why - the building blocks of neural networks at the time were not as robust and converged very slowly to useful features. Many times they even failed spectacularly. Pre training was useful when you had ample data you could get a good initialization for SGD.
When relu was brought up, networks converged faster. When leaky relu and more recent solutions were brought up, neural nets became more robust machines when it comes to converging to a viable result. I highly recommend that you play with an excellent neural networks demo this talented googler wrote, you will see what I am talking about.
Getting to our main point, that is not to say that some form of Pre-training is not important in deep learning. If you want to get state of the art results you have to perform pre-processing of the data (ZCA for example) and properly choose the initial weights - this is a very good paper on the subject.
So you see, pre-training changed in form to pre-processing and weights initialization but remained in function and it became more elegant.
As a final note, machine learning is very fashionable. I am personally betting like Andrew Ng that unsupervised and self-taught learning will be dominant in the future so don't make this a religion :)
|
Pre-training in deep convolutional neural network?
As can be understood from the above answers, pre-training was 'fashioned out' when multiple things happened. However, I do want to distill my understanding of it:
Long time ago in 2010, everyone care
|
7,380
|
Pre-training in deep convolutional neural network?
|
There are some papers but not as much as autoencoders or RBMs. I think the reason is the time line of NN. Stacked RBM and autoencoder are introduced at 2006 and 2007, respectively. After employment of ReLU at 2009 unsupervised learning is partially abandoned (when there is enough data to learn in direct supervised learning). Even though Convolution net (or LeNet) is invented at 1989, it couldn't trained as deep structure till 2012 which is after popularization of direct supervised learning with ReLU. So researchers, I guess, have trained it mostly by using direct supervised learning.
|
Pre-training in deep convolutional neural network?
|
There are some papers but not as much as autoencoders or RBMs. I think the reason is the time line of NN. Stacked RBM and autoencoder are introduced at 2006 and 2007, respectively. After employment of
|
Pre-training in deep convolutional neural network?
There are some papers but not as much as autoencoders or RBMs. I think the reason is the time line of NN. Stacked RBM and autoencoder are introduced at 2006 and 2007, respectively. After employment of ReLU at 2009 unsupervised learning is partially abandoned (when there is enough data to learn in direct supervised learning). Even though Convolution net (or LeNet) is invented at 1989, it couldn't trained as deep structure till 2012 which is after popularization of direct supervised learning with ReLU. So researchers, I guess, have trained it mostly by using direct supervised learning.
|
Pre-training in deep convolutional neural network?
There are some papers but not as much as autoencoders or RBMs. I think the reason is the time line of NN. Stacked RBM and autoencoder are introduced at 2006 and 2007, respectively. After employment of
|
7,381
|
When to log transform a time series before fitting an ARIMA model
|
Some caveats before to proceed. As I often suggest to my students, use auto.arima() things only as a first approximation to your final result or if you want to have parsimonious model when you check that your rival theory-based model do better.
Data
You have clearly to start from the description of time series data you are working with. In macro-econometrics you usually work with aggregated data, and geometric means (surprisingly) have more empirical evidence for macro time series data, probably because most of them decomposable into exponentially growing trend.
By the way Rob's suggestion "visually" works for time series with clear seasonal part, as slowly varying annual data is less clear for the increases in variation. Luckily exponentially growing trend is usually seen (if it seems to be linear, than no need for logs).
Model
If your analysis is based on some theory that states that some weighted geometric mean $Y(t) = X_1^{\alpha_1}(t)...X_k^{\alpha_k}(t)\varepsilon(t)$ more known as the multiplicative regression model is the one you have to work with. Then you usually move to a log-log regression model, that is linear in parameters and most of your variables, but some growth rates, are transformed.
In financial econometrics logs are a common thing due to the popularity of log-returns, because...
Log transformations have nice properties
In log-log regression model it is the interpretation of estimated parameter, say $\alpha_i$ as the elasticity of $Y(t)$ on $X_i(t)$.
In error-correction models we have an empirically stronger assumption that proportions are more stable (stationary) than the absolute differences.
In financial econometrics it is easy to aggregate the log-returns over time.
There are many other reasons not mentioned here.
Finally
Note that log-transformation is usually applied to non-negative (level) variables. If you observe the differences of two time series (net export, for instance) it is not even possible to take the log, you have either to search for original data in levels or assume the form of common trend that was subtracted.
[addition after edit] If you still want a statistical criterion for when to do log transformation a simple solution would be any test for heteroscedasticity. In the case of increasing variance I would recommend Goldfeld-Quandt Test or similar to it. In R it is located in library(lmtest) and is denoted by gqtest(y~1) function. Simply regress on intercept term if you don't have any regression model, y is your dependent variable.
|
When to log transform a time series before fitting an ARIMA model
|
Some caveats before to proceed. As I often suggest to my students, use auto.arima() things only as a first approximation to your final result or if you want to have parsimonious model when you check t
|
When to log transform a time series before fitting an ARIMA model
Some caveats before to proceed. As I often suggest to my students, use auto.arima() things only as a first approximation to your final result or if you want to have parsimonious model when you check that your rival theory-based model do better.
Data
You have clearly to start from the description of time series data you are working with. In macro-econometrics you usually work with aggregated data, and geometric means (surprisingly) have more empirical evidence for macro time series data, probably because most of them decomposable into exponentially growing trend.
By the way Rob's suggestion "visually" works for time series with clear seasonal part, as slowly varying annual data is less clear for the increases in variation. Luckily exponentially growing trend is usually seen (if it seems to be linear, than no need for logs).
Model
If your analysis is based on some theory that states that some weighted geometric mean $Y(t) = X_1^{\alpha_1}(t)...X_k^{\alpha_k}(t)\varepsilon(t)$ more known as the multiplicative regression model is the one you have to work with. Then you usually move to a log-log regression model, that is linear in parameters and most of your variables, but some growth rates, are transformed.
In financial econometrics logs are a common thing due to the popularity of log-returns, because...
Log transformations have nice properties
In log-log regression model it is the interpretation of estimated parameter, say $\alpha_i$ as the elasticity of $Y(t)$ on $X_i(t)$.
In error-correction models we have an empirically stronger assumption that proportions are more stable (stationary) than the absolute differences.
In financial econometrics it is easy to aggregate the log-returns over time.
There are many other reasons not mentioned here.
Finally
Note that log-transformation is usually applied to non-negative (level) variables. If you observe the differences of two time series (net export, for instance) it is not even possible to take the log, you have either to search for original data in levels or assume the form of common trend that was subtracted.
[addition after edit] If you still want a statistical criterion for when to do log transformation a simple solution would be any test for heteroscedasticity. In the case of increasing variance I would recommend Goldfeld-Quandt Test or similar to it. In R it is located in library(lmtest) and is denoted by gqtest(y~1) function. Simply regress on intercept term if you don't have any regression model, y is your dependent variable.
|
When to log transform a time series before fitting an ARIMA model
Some caveats before to proceed. As I often suggest to my students, use auto.arima() things only as a first approximation to your final result or if you want to have parsimonious model when you check t
|
7,382
|
When to log transform a time series before fitting an ARIMA model
|
Plot a graph of the data against time. If it looks like the variation increases with the level of the series, take logs. Otherwise model the original data.
|
When to log transform a time series before fitting an ARIMA model
|
Plot a graph of the data against time. If it looks like the variation increases with the level of the series, take logs. Otherwise model the original data.
|
When to log transform a time series before fitting an ARIMA model
Plot a graph of the data against time. If it looks like the variation increases with the level of the series, take logs. Otherwise model the original data.
|
When to log transform a time series before fitting an ARIMA model
Plot a graph of the data against time. If it looks like the variation increases with the level of the series, take logs. Otherwise model the original data.
|
7,383
|
When to log transform a time series before fitting an ARIMA model
|
By Their Fruits Ye Shall Know Them
The assumption (to be tested) is that the errors from the model have constant variance. Note this does not mean the errors from an assumed model. When you use a simple graphical analysis you are essentially assuming a linear model in time.
Thus if you have an inadequate model such as might be suggested by a casual plot of the data against time you may incorrectly conclude about the need for a power transform. Box and Jenkins did so with their Airline Data example. They did not not account for 3 unusual values in the most recent data thus they incorrectly concluded that there was higher variation in the residuals at the highest level of the series.
For more on this subject please see http://www.autobox.com/pdfs/vegas_ibf_09a.pdf
|
When to log transform a time series before fitting an ARIMA model
|
By Their Fruits Ye Shall Know Them
The assumption (to be tested) is that the errors from the model have constant variance. Note this does not mean the errors from an assumed model. When you use a simp
|
When to log transform a time series before fitting an ARIMA model
By Their Fruits Ye Shall Know Them
The assumption (to be tested) is that the errors from the model have constant variance. Note this does not mean the errors from an assumed model. When you use a simple graphical analysis you are essentially assuming a linear model in time.
Thus if you have an inadequate model such as might be suggested by a casual plot of the data against time you may incorrectly conclude about the need for a power transform. Box and Jenkins did so with their Airline Data example. They did not not account for 3 unusual values in the most recent data thus they incorrectly concluded that there was higher variation in the residuals at the highest level of the series.
For more on this subject please see http://www.autobox.com/pdfs/vegas_ibf_09a.pdf
|
When to log transform a time series before fitting an ARIMA model
By Their Fruits Ye Shall Know Them
The assumption (to be tested) is that the errors from the model have constant variance. Note this does not mean the errors from an assumed model. When you use a simp
|
7,384
|
When to log transform a time series before fitting an ARIMA model
|
You might want to log-transform series when they are somehow naturally geometric or where the time value of an investment implies that you will be comparing to a minimal risk bond that has a positive return. This will make them more "linearizable", and therefore suitable for a simple differencing recurrence relationship.
|
When to log transform a time series before fitting an ARIMA model
|
You might want to log-transform series when they are somehow naturally geometric or where the time value of an investment implies that you will be comparing to a minimal risk bond that has a positive
|
When to log transform a time series before fitting an ARIMA model
You might want to log-transform series when they are somehow naturally geometric or where the time value of an investment implies that you will be comparing to a minimal risk bond that has a positive return. This will make them more "linearizable", and therefore suitable for a simple differencing recurrence relationship.
|
When to log transform a time series before fitting an ARIMA model
You might want to log-transform series when they are somehow naturally geometric or where the time value of an investment implies that you will be comparing to a minimal risk bond that has a positive
|
7,385
|
Expected prediction error - derivation
|
\begin{align*}
EPE(f) &= \int [y - f(x)]^2 Pr(dx, dy) \\
&= \int [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x)p(y|x)dxdy \\
&= \int_x\left( \int_y [y - f(x)]^2p(y|x)dy \right)p(x)dx \\
&= \int_x \left( E_{Y|X}([Y - f(X)]^2|X = x) \right) p(x)dx\\
&= E_{X}E_{Y|X}([Y - f(X)]^2| X = x)
\end{align*}
|
Expected prediction error - derivation
|
\begin{align*}
EPE(f) &= \int [y - f(x)]^2 Pr(dx, dy) \\
&= \int [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x)p(y|x)dxdy \\
&= \int_x\left( \i
|
Expected prediction error - derivation
\begin{align*}
EPE(f) &= \int [y - f(x)]^2 Pr(dx, dy) \\
&= \int [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x)p(y|x)dxdy \\
&= \int_x\left( \int_y [y - f(x)]^2p(y|x)dy \right)p(x)dx \\
&= \int_x \left( E_{Y|X}([Y - f(X)]^2|X = x) \right) p(x)dx\\
&= E_{X}E_{Y|X}([Y - f(X)]^2| X = x)
\end{align*}
|
Expected prediction error - derivation
\begin{align*}
EPE(f) &= \int [y - f(x)]^2 Pr(dx, dy) \\
&= \int [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x,y)dxdy \\
&= \int_x \int_y [y - f(x)]^2p(x)p(y|x)dxdy \\
&= \int_x\left( \i
|
7,386
|
Expected prediction error - derivation
|
The equation (2.11) is a consequence of the following little equality. For any two random variables $Z_1$ and $Z_2$, and any function $g$
$$ E_{Z_1, Z_2} (g(Z_1, Z_2)) = E_{Z_2}(E_{Z_1 \mid Z_2}(g(Z_1, Z_2) \mid Z_2)) $$
The notation $E_{Z_1, Z_2}$ is the expectation over the joint distribution. The notation $E_{Z_1 \mid Z_2}$ essentially says "integrate over the conditional distribution of $Z_1$ as if $Z_2$ was fixed".
It's easy to verify this in the case that $Z_1$ and $Z_2$ are discrete random variables by just unwinding the definitions involved
$$
\begin{align}
E_{Z_2} & (E_{Z_1 \mid Z_2}(g(Z_1, Z_2) \mid Z_2)) \\
&= E_{Z_2} \left( \sum_{z_1} g(z_1, Z_2) Pr(Z_1 = z_1 \mid Z_2 ) \right) \\
&= \sum_{z_2} \left( \sum_{z_1} g(z_1, z_2) Pr(Z_1 = z_1 \mid Z_2 = z_2 ) \right) Pr(Z_2 = z_2) \\
&= \sum_{z_1, z_2} g(z_1, z_2) Pr(Z_1 = z_1 \mid Z_2 = z_2) Pr(Z_2 = z_2) \\
&= \sum_{z_1, z_2} g(z_1, z_2) Pr(Z_1 = z_1, Z_2 = z_2 ) \\
&= E_{Z_1, Z_2} (g(Z_1, Z_2))
\end{align}
$$
The continuous case can either be viewed informally as a limit of this argument, or formally verified once all the measure theoretic do-dads are in place.
To unwind the application, take $Z_1 = Y$, $Z_2 = X$, and $g(x, y) = (y - f(x))^2$. Everything lines up exactly.
The assertion (2.12) asks us to consider minimizing
$$ E_X E_{Y \mid X} (Y - f(X))^2 $$
where we are free to choose $f$ as we wish. Again, focusing on the discrete case, and dropping halfway into the unwinding above, we see that we are minimizing
$$ \sum_{x} \left( \sum_{y} (y - f(x))^2 Pr(Y = y \mid X = x) \right) Pr(X = x) $$
Everything inside the big parenthesis is non-negative, and you can minimize a sum of non-negative quantities by minimizing the summands individually. In context, this means that we can choose $f$ to minimize
$$\sum_{y} (y - f(x))^2 Pr(Y = y \mid X = x)$$
individually for each discrete value of $x$. This is exactly the content of what ESL is claiming, only with fancier notation.
|
Expected prediction error - derivation
|
The equation (2.11) is a consequence of the following little equality. For any two random variables $Z_1$ and $Z_2$, and any function $g$
$$ E_{Z_1, Z_2} (g(Z_1, Z_2)) = E_{Z_2}(E_{Z_1 \mid Z_2}(g(Z_
|
Expected prediction error - derivation
The equation (2.11) is a consequence of the following little equality. For any two random variables $Z_1$ and $Z_2$, and any function $g$
$$ E_{Z_1, Z_2} (g(Z_1, Z_2)) = E_{Z_2}(E_{Z_1 \mid Z_2}(g(Z_1, Z_2) \mid Z_2)) $$
The notation $E_{Z_1, Z_2}$ is the expectation over the joint distribution. The notation $E_{Z_1 \mid Z_2}$ essentially says "integrate over the conditional distribution of $Z_1$ as if $Z_2$ was fixed".
It's easy to verify this in the case that $Z_1$ and $Z_2$ are discrete random variables by just unwinding the definitions involved
$$
\begin{align}
E_{Z_2} & (E_{Z_1 \mid Z_2}(g(Z_1, Z_2) \mid Z_2)) \\
&= E_{Z_2} \left( \sum_{z_1} g(z_1, Z_2) Pr(Z_1 = z_1 \mid Z_2 ) \right) \\
&= \sum_{z_2} \left( \sum_{z_1} g(z_1, z_2) Pr(Z_1 = z_1 \mid Z_2 = z_2 ) \right) Pr(Z_2 = z_2) \\
&= \sum_{z_1, z_2} g(z_1, z_2) Pr(Z_1 = z_1 \mid Z_2 = z_2) Pr(Z_2 = z_2) \\
&= \sum_{z_1, z_2} g(z_1, z_2) Pr(Z_1 = z_1, Z_2 = z_2 ) \\
&= E_{Z_1, Z_2} (g(Z_1, Z_2))
\end{align}
$$
The continuous case can either be viewed informally as a limit of this argument, or formally verified once all the measure theoretic do-dads are in place.
To unwind the application, take $Z_1 = Y$, $Z_2 = X$, and $g(x, y) = (y - f(x))^2$. Everything lines up exactly.
The assertion (2.12) asks us to consider minimizing
$$ E_X E_{Y \mid X} (Y - f(X))^2 $$
where we are free to choose $f$ as we wish. Again, focusing on the discrete case, and dropping halfway into the unwinding above, we see that we are minimizing
$$ \sum_{x} \left( \sum_{y} (y - f(x))^2 Pr(Y = y \mid X = x) \right) Pr(X = x) $$
Everything inside the big parenthesis is non-negative, and you can minimize a sum of non-negative quantities by minimizing the summands individually. In context, this means that we can choose $f$ to minimize
$$\sum_{y} (y - f(x))^2 Pr(Y = y \mid X = x)$$
individually for each discrete value of $x$. This is exactly the content of what ESL is claiming, only with fancier notation.
|
Expected prediction error - derivation
The equation (2.11) is a consequence of the following little equality. For any two random variables $Z_1$ and $Z_2$, and any function $g$
$$ E_{Z_1, Z_2} (g(Z_1, Z_2)) = E_{Z_2}(E_{Z_1 \mid Z_2}(g(Z_
|
7,387
|
Expected prediction error - derivation
|
I find some parts in this book express in a way that is difficult to understand, especially for those who do not have a strong background in statistics.
I will try to make it simple and hope that you can get rid of confusion.
Claim 1 (Smoothing) $E(X) = E(E(X|Y)),\forall X,Y$
Proof:
Notice that E(Y) is a constant but E(Y|X) is a random variable depending on X.
\begin{align}
E(E(X|Y)) &= \displaystyle\int E(X|Y=y) f_Y(y) dy \\
&= \int \int x f_{X|Y} (x|y) dx f_Y(y) dy \\
&= \int \int x f_{X|Y} (x|y) f_Y(y) dx dy \\
&= \int \int x f_{XY} (x,y) dx dy \\
&= \int x \left(\int f_{XY} (x,y) dy \right) dx \\
&= \int x f_X(x) dx = E(X)
\end{align}
Claim 2: $E(Y - f(X))^2 \geq E(Y - E(Y|X))^2, \forall f$
Proof:
\begin{align}
E((Y - f(X))^2 | X) &= E( ([Y - E(Y|X)] + [E(Y|X) - f(X)])^2|X) \\
&= E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) + \\
&\qquad 2 E((Y - E(Y|X))(E(Y|X) - f(X))|X) \\
&=E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) + \\
&\qquad 2 (E(Y|X) - f(X)) E(Y - E(Y|X))|X) \\[5pt]
&( \text{ since } E(Y|X) - f(X) \text{ is constant given } X) \\[5pt]
&= E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) \text{ ( use Claim 1 }) \\
&\geq E((Y-E(Y|X))^2 |X)
\end{align}
Taking expectation both sides of the above equation give Claim 2 (Q.E.D)
Therefore, the optimal f is $f(X) = E(Y|X)$
|
Expected prediction error - derivation
|
I find some parts in this book express in a way that is difficult to understand, especially for those who do not have a strong background in statistics.
I will try to make it simple and hope that you
|
Expected prediction error - derivation
I find some parts in this book express in a way that is difficult to understand, especially for those who do not have a strong background in statistics.
I will try to make it simple and hope that you can get rid of confusion.
Claim 1 (Smoothing) $E(X) = E(E(X|Y)),\forall X,Y$
Proof:
Notice that E(Y) is a constant but E(Y|X) is a random variable depending on X.
\begin{align}
E(E(X|Y)) &= \displaystyle\int E(X|Y=y) f_Y(y) dy \\
&= \int \int x f_{X|Y} (x|y) dx f_Y(y) dy \\
&= \int \int x f_{X|Y} (x|y) f_Y(y) dx dy \\
&= \int \int x f_{XY} (x,y) dx dy \\
&= \int x \left(\int f_{XY} (x,y) dy \right) dx \\
&= \int x f_X(x) dx = E(X)
\end{align}
Claim 2: $E(Y - f(X))^2 \geq E(Y - E(Y|X))^2, \forall f$
Proof:
\begin{align}
E((Y - f(X))^2 | X) &= E( ([Y - E(Y|X)] + [E(Y|X) - f(X)])^2|X) \\
&= E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) + \\
&\qquad 2 E((Y - E(Y|X))(E(Y|X) - f(X))|X) \\
&=E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) + \\
&\qquad 2 (E(Y|X) - f(X)) E(Y - E(Y|X))|X) \\[5pt]
&( \text{ since } E(Y|X) - f(X) \text{ is constant given } X) \\[5pt]
&= E((Y-E(Y|X))^2 |X) + E((E(Y|X) - f(X))^2|X) \text{ ( use Claim 1 }) \\
&\geq E((Y-E(Y|X))^2 |X)
\end{align}
Taking expectation both sides of the above equation give Claim 2 (Q.E.D)
Therefore, the optimal f is $f(X) = E(Y|X)$
|
Expected prediction error - derivation
I find some parts in this book express in a way that is difficult to understand, especially for those who do not have a strong background in statistics.
I will try to make it simple and hope that you
|
7,388
|
Expected prediction error - derivation
|
I found the explanation in the textbook and the other answers here (and Confusion in regression function derivation and Confused by Derivation of Regression Function) inadequate, so I decided to add my own version. I know many readers of the book and this website will not have a background in measure theory but for me it makes everything clearer. Some of the difficulties the authors have - to my mind - comes from avoiding rigorous treatment of the probability parts of their arguments:
Let $X : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R}^p,\mathcal{B}(\mathbf{R}^p)\bigr)$ and $Y : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$ be random variables (there's no need for them not to be on the same underlying probability space, so we may as well do it like this). Define the expected prediction error as
$$
EPE(f) = \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\Bigr].
$$
Aside: Recall that given some other random variable $Z : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$, we have that $\mathbb{E}(Z |X ) : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$ is a random variable of the form $\omega \mapsto G(X(\omega))$ f. When we write $\mathbb{E}(Z|X=x)$, we are evaluating the random variable $\mathbb{E}(Z |X )$ at some $\omega \in \Omega$ for which $X(\omega) = x$. And recall that the definition of the conditional expectation means that
$$
\mathbb{E}(Z) = \mathbb{E}\biggl( \mathbb{E}(Z |X ) \biggr).
$$
Also: From a rigorous perspective, there isn't really such a thing as $\mathbb{E}_X$ or $\mathbb{E}_{Y|X}$; this is just confusing: If everything is on the same probability space then "$\mathbb{E}$" means "integrate over the probability space'' and nothing else, every time.
So
\begin{align}
EPE(f) &= \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\Bigr]\\
& = \mathbb{E}\biggl(\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X \Bigr]\biggr)\\
&= \int_{\Omega} \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X\Bigr] d\mathbb{P}(\omega)
\end{align}
By taking $Z = \bigl(Y-f(X)\bigr)^2$ in our aside above, we can see that the integrand here is of the form $G(X(\omega))$, i.e. we can write this as $\int_{\Omega} G(X(\omega)) d\mathbb{P}(\omega)$ and - using the definition of the the law $\mu_X$ of $X$ - this is equal to $\int_{\mathbf{R}^p} G(x) d\mu_X(x)$. This certainly makes it clear that to choose an $f$ which minimizes the EPE you should minimize the integrand pointwise as a function of $x$. So let's try to do that: By linearity and 'taking out what is known' (i.e. the fact that $f(X)$ is $\sigma(X)$-measurable):
\begin{align*}
\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X\Bigr] &= \mathbb{E}\bigl[ Y^2 | X\bigr] - 2\mathbb{E}\bigl[ Y f(X) | X\bigr] + \mathbb{E}\bigl[ f(X)^2 | X\bigr] \\
&= \mathbb{E}\bigl[ Y^2 | X\bigr] - 2f(X)\mathbb{E}\bigl[ Y | X\bigr] + f(X)^2 \\
&= \mathbb{E}\bigl[ Y^2 | X\bigr] - \mathbb{E}\bigl[ Y | X\bigr]^2 + \biggl(f(X) - \mathbb{E}\bigl[ Y | X\bigr] \biggr)^2
\end{align*}
Then when we evaluate both sides at some $\omega \in \Omega$ for which $X(\omega) = x$, we get
$$
\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X=x\Bigr] = \mathbb{E}\bigl[ Y^2 | X=x\bigr] - \mathbb{E}\bigl[ Y | X=x\bigr]^2 + \biggl(f(x) - \mathbb{E}\bigl[ Y | X=x\bigr] \biggr)^2,
$$
and we can see that the choice of $f(x)$ which minimizes this expression is $f(x) = \mathbb{E}\bigl[ Y | X=x\bigr]$, the so-called 'regression function'
|
Expected prediction error - derivation
|
I found the explanation in the textbook and the other answers here (and Confusion in regression function derivation and Confused by Derivation of Regression Function) inadequate, so I decided to add m
|
Expected prediction error - derivation
I found the explanation in the textbook and the other answers here (and Confusion in regression function derivation and Confused by Derivation of Regression Function) inadequate, so I decided to add my own version. I know many readers of the book and this website will not have a background in measure theory but for me it makes everything clearer. Some of the difficulties the authors have - to my mind - comes from avoiding rigorous treatment of the probability parts of their arguments:
Let $X : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R}^p,\mathcal{B}(\mathbf{R}^p)\bigr)$ and $Y : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$ be random variables (there's no need for them not to be on the same underlying probability space, so we may as well do it like this). Define the expected prediction error as
$$
EPE(f) = \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\Bigr].
$$
Aside: Recall that given some other random variable $Z : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$, we have that $\mathbb{E}(Z |X ) : \bigl(\Omega,\mathcal{F},\mathbb{P}\bigr) \to \bigl(\mathbf{R},\mathcal{B}(\mathbf{R})\bigr)$ is a random variable of the form $\omega \mapsto G(X(\omega))$ f. When we write $\mathbb{E}(Z|X=x)$, we are evaluating the random variable $\mathbb{E}(Z |X )$ at some $\omega \in \Omega$ for which $X(\omega) = x$. And recall that the definition of the conditional expectation means that
$$
\mathbb{E}(Z) = \mathbb{E}\biggl( \mathbb{E}(Z |X ) \biggr).
$$
Also: From a rigorous perspective, there isn't really such a thing as $\mathbb{E}_X$ or $\mathbb{E}_{Y|X}$; this is just confusing: If everything is on the same probability space then "$\mathbb{E}$" means "integrate over the probability space'' and nothing else, every time.
So
\begin{align}
EPE(f) &= \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\Bigr]\\
& = \mathbb{E}\biggl(\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X \Bigr]\biggr)\\
&= \int_{\Omega} \mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X\Bigr] d\mathbb{P}(\omega)
\end{align}
By taking $Z = \bigl(Y-f(X)\bigr)^2$ in our aside above, we can see that the integrand here is of the form $G(X(\omega))$, i.e. we can write this as $\int_{\Omega} G(X(\omega)) d\mathbb{P}(\omega)$ and - using the definition of the the law $\mu_X$ of $X$ - this is equal to $\int_{\mathbf{R}^p} G(x) d\mu_X(x)$. This certainly makes it clear that to choose an $f$ which minimizes the EPE you should minimize the integrand pointwise as a function of $x$. So let's try to do that: By linearity and 'taking out what is known' (i.e. the fact that $f(X)$ is $\sigma(X)$-measurable):
\begin{align*}
\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X\Bigr] &= \mathbb{E}\bigl[ Y^2 | X\bigr] - 2\mathbb{E}\bigl[ Y f(X) | X\bigr] + \mathbb{E}\bigl[ f(X)^2 | X\bigr] \\
&= \mathbb{E}\bigl[ Y^2 | X\bigr] - 2f(X)\mathbb{E}\bigl[ Y | X\bigr] + f(X)^2 \\
&= \mathbb{E}\bigl[ Y^2 | X\bigr] - \mathbb{E}\bigl[ Y | X\bigr]^2 + \biggl(f(X) - \mathbb{E}\bigl[ Y | X\bigr] \biggr)^2
\end{align*}
Then when we evaluate both sides at some $\omega \in \Omega$ for which $X(\omega) = x$, we get
$$
\mathbb{E}\Bigl[ \bigl(Y-f(X)\bigr)^2\big| X=x\Bigr] = \mathbb{E}\bigl[ Y^2 | X=x\bigr] - \mathbb{E}\bigl[ Y | X=x\bigr]^2 + \biggl(f(x) - \mathbb{E}\bigl[ Y | X=x\bigr] \biggr)^2,
$$
and we can see that the choice of $f(x)$ which minimizes this expression is $f(x) = \mathbb{E}\bigl[ Y | X=x\bigr]$, the so-called 'regression function'
|
Expected prediction error - derivation
I found the explanation in the textbook and the other answers here (and Confusion in regression function derivation and Confused by Derivation of Regression Function) inadequate, so I decided to add m
|
7,389
|
Expected prediction error - derivation
|
I will try to explain this as per my understanding.
The main idea of the section 2.4 Statistical Decision Theory is to provide a framework for developing models(e.g. least-squares regression, k-NN).
As a first step(it is what author of this topic is asking about) in that section we consider regression function.
Idea of the step: to show that we can use conditional expectation as a linear regression function. So
$$f(x) = mx+b = \text{E}(Y|X=x)$$
where $m$ - slope, $b$ - intercept
($X$ is vector in the example of the book but I hope it doesn't confuse.)
I understand this mapping next way. Linear regression is a process to find a line closest to every point on scatter-plot. So to predict $y$ we can use expected value(or mean) of $y$ for given $x$ instead of $mx+b$.
How to prove that we are right with above assumption?
1. We need a loss function(squared error):
$$L(Y, f(X))=(Y-f(X))^2$$
Therefore the expected squared prediction error for our regression function will be:
$$EPE(f) = E(L[Y, f(x)]) = E([Y-f(X)]^2) \text{ - this is how we're getting 2.9}$$
2. Then how to derive 2.11 from 2.10 and 2.10 from 2.9. Generally we need to follow one of properties for conditional expectation
$$E(E[X|Y]) = E[X|Y = y] P(Y = y) \text{ - by law of unconscious statistician}$$
and
$$E[X|Y = y] P(Y = y) = E[X] \text{ - by partition theorem from above we get this.}$$
We can do the next steps:
2.9 to 2.10:
$EPE(f)= E([Y-f(X)]^2) = \int[y−f(x)]^2Pr(dx,dy)$ - this is by definition of expectation($E(X)=∫xf(x)dx$ for continuous case) probably except for $Pr(dx, dy)$
There are 3 parts:
$\int$ - because we're using continuous random variables
$[y−f(x)]^2$ - this is our x from definition
$Pr(dx, dy)$ - just notation for $p(x,y)dxdy$ where $p(x,y)$ is probability
2.10 to 2.11:
$$\int [y−f(x)]^2Pr(dx,dy) \text{ - 2.10 formula}$$
$$=\int[y−f(x)]^2\mathbf{p(x,y)dxdy} \text{ - from the above}$$
$$=\mathbf{\int_{x}\int_{y}}[y−f(x)]^2p(x,y)dxdy \text{ - just more precise integrals}$$
$$=\int_{x}\int_{y}[y−f(x)]^2\mathbf{p(x)p(y|x)}dxdy \text{ - by multiplication rule we got this}$$
$$=\int_{x}\mathbf{(\int_{y}[y−f(x)]^2p(y|x)dy)}p(x)dx \text{ - just regrouped members}$$
$$=\int_{x}\mathbf{(E_{Y|X}([Y−f(X)]^2|X=x))}p(x)dx \text{ - by definition of conditional expectation}$$
$$=E_{X}[E_{Y|X}([Y−f(X)]^2|X=x)] \text{ - by law of unconscious statistician we get this}$$
So $E_{X}E_{Y|X}([Y−f(X)]^2|X=x)$ is generally $E(E[Y|X])$.
3. So far we've worked on $EPE(f)$ and proved that $E([Y-f(X)]^2)$ can be represented like this $E_{X}E_{Y|X}([Y−f(X)]2|X=x)$
Then authors say that it suffices to minimize $EPE$ pointwise for $f(x)$.
$$f(x) = argmin_{c} E_{Y|X}([Y − c]^2|X) = x$$
I thought of simple notations for regression to realize what authors mean. Specifically we can minimize squared error of regression line with partial derivatives.
a. we can represent this $$SE_{line} = (y_{0}-(mx_{0}+b))^2+(y_{1}-(mx_{1}+b))^2 +...+(y_{n}-(mx_{n}+b))^2$$ like this $$SE_{line} = n\overline{y^2}-2mn\overline{yx}-2bn\overline{y}+m^2n\overline{x^2}+2mbn\overline{x}+nb^2$$ It is the same actually.
b. Then we can find partial derivatives of the above with respect of $m$(slope) and $b$(intersect) to find minima for those variables.
c. So we can use $m$ and $b$ in $mx+b$ to get predicted $y$ with minimum error.
The same idea is in the book. We want to find some $c$ to get minimum for $$E_{Y|X}([Y − c]^2|X = x)\text{ (2.12)}$$
So the best prediction of $Y$ at any point $X$ is the conditional mean(mean of $Y$'s for $X$) when the best is measured by average squared error.
Hope it helps.
|
Expected prediction error - derivation
|
I will try to explain this as per my understanding.
The main idea of the section 2.4 Statistical Decision Theory is to provide a framework for developing models(e.g. least-squares regression, k-NN).
A
|
Expected prediction error - derivation
I will try to explain this as per my understanding.
The main idea of the section 2.4 Statistical Decision Theory is to provide a framework for developing models(e.g. least-squares regression, k-NN).
As a first step(it is what author of this topic is asking about) in that section we consider regression function.
Idea of the step: to show that we can use conditional expectation as a linear regression function. So
$$f(x) = mx+b = \text{E}(Y|X=x)$$
where $m$ - slope, $b$ - intercept
($X$ is vector in the example of the book but I hope it doesn't confuse.)
I understand this mapping next way. Linear regression is a process to find a line closest to every point on scatter-plot. So to predict $y$ we can use expected value(or mean) of $y$ for given $x$ instead of $mx+b$.
How to prove that we are right with above assumption?
1. We need a loss function(squared error):
$$L(Y, f(X))=(Y-f(X))^2$$
Therefore the expected squared prediction error for our regression function will be:
$$EPE(f) = E(L[Y, f(x)]) = E([Y-f(X)]^2) \text{ - this is how we're getting 2.9}$$
2. Then how to derive 2.11 from 2.10 and 2.10 from 2.9. Generally we need to follow one of properties for conditional expectation
$$E(E[X|Y]) = E[X|Y = y] P(Y = y) \text{ - by law of unconscious statistician}$$
and
$$E[X|Y = y] P(Y = y) = E[X] \text{ - by partition theorem from above we get this.}$$
We can do the next steps:
2.9 to 2.10:
$EPE(f)= E([Y-f(X)]^2) = \int[y−f(x)]^2Pr(dx,dy)$ - this is by definition of expectation($E(X)=∫xf(x)dx$ for continuous case) probably except for $Pr(dx, dy)$
There are 3 parts:
$\int$ - because we're using continuous random variables
$[y−f(x)]^2$ - this is our x from definition
$Pr(dx, dy)$ - just notation for $p(x,y)dxdy$ where $p(x,y)$ is probability
2.10 to 2.11:
$$\int [y−f(x)]^2Pr(dx,dy) \text{ - 2.10 formula}$$
$$=\int[y−f(x)]^2\mathbf{p(x,y)dxdy} \text{ - from the above}$$
$$=\mathbf{\int_{x}\int_{y}}[y−f(x)]^2p(x,y)dxdy \text{ - just more precise integrals}$$
$$=\int_{x}\int_{y}[y−f(x)]^2\mathbf{p(x)p(y|x)}dxdy \text{ - by multiplication rule we got this}$$
$$=\int_{x}\mathbf{(\int_{y}[y−f(x)]^2p(y|x)dy)}p(x)dx \text{ - just regrouped members}$$
$$=\int_{x}\mathbf{(E_{Y|X}([Y−f(X)]^2|X=x))}p(x)dx \text{ - by definition of conditional expectation}$$
$$=E_{X}[E_{Y|X}([Y−f(X)]^2|X=x)] \text{ - by law of unconscious statistician we get this}$$
So $E_{X}E_{Y|X}([Y−f(X)]^2|X=x)$ is generally $E(E[Y|X])$.
3. So far we've worked on $EPE(f)$ and proved that $E([Y-f(X)]^2)$ can be represented like this $E_{X}E_{Y|X}([Y−f(X)]2|X=x)$
Then authors say that it suffices to minimize $EPE$ pointwise for $f(x)$.
$$f(x) = argmin_{c} E_{Y|X}([Y − c]^2|X) = x$$
I thought of simple notations for regression to realize what authors mean. Specifically we can minimize squared error of regression line with partial derivatives.
a. we can represent this $$SE_{line} = (y_{0}-(mx_{0}+b))^2+(y_{1}-(mx_{1}+b))^2 +...+(y_{n}-(mx_{n}+b))^2$$ like this $$SE_{line} = n\overline{y^2}-2mn\overline{yx}-2bn\overline{y}+m^2n\overline{x^2}+2mbn\overline{x}+nb^2$$ It is the same actually.
b. Then we can find partial derivatives of the above with respect of $m$(slope) and $b$(intersect) to find minima for those variables.
c. So we can use $m$ and $b$ in $mx+b$ to get predicted $y$ with minimum error.
The same idea is in the book. We want to find some $c$ to get minimum for $$E_{Y|X}([Y − c]^2|X = x)\text{ (2.12)}$$
So the best prediction of $Y$ at any point $X$ is the conditional mean(mean of $Y$'s for $X$) when the best is measured by average squared error.
Hope it helps.
|
Expected prediction error - derivation
I will try to explain this as per my understanding.
The main idea of the section 2.4 Statistical Decision Theory is to provide a framework for developing models(e.g. least-squares regression, k-NN).
A
|
7,390
|
Difference between binomial, negative binomial and Poisson regression
|
Only the nature of your data and your question of interest can tell you which of these regressions are best for your situation. So there are no tests that will tell you which one of these methods is the best for you. (Click on the links of the regression methods below to see some worked examples in SPSS.)
If you have a binary outcome (e.g. death/alive, sick/healthy, 1/0),
then logistic regression is appropriate.
If your outcomes are discrete counts, then Poisson regression or negative binomial regression can be used.
Remember that the Poisson distribution assumes that the mean and variance are the same. Sometimes, your data show extra variation that is greater than the mean. This situation is called overdispersion and negative binomial regression is more flexible in that regard than Poisson regression (you could still use Poisson regression in that case but the standard errors could be biased). The negative binomial distribution has one parameter more than the Poisson regression that adjusts the variance independently from the mean. In fact, the Poisson distribution is a special case of the negative binomial distribution.
|
Difference between binomial, negative binomial and Poisson regression
|
Only the nature of your data and your question of interest can tell you which of these regressions are best for your situation. So there are no tests that will tell you which one of these methods is t
|
Difference between binomial, negative binomial and Poisson regression
Only the nature of your data and your question of interest can tell you which of these regressions are best for your situation. So there are no tests that will tell you which one of these methods is the best for you. (Click on the links of the regression methods below to see some worked examples in SPSS.)
If you have a binary outcome (e.g. death/alive, sick/healthy, 1/0),
then logistic regression is appropriate.
If your outcomes are discrete counts, then Poisson regression or negative binomial regression can be used.
Remember that the Poisson distribution assumes that the mean and variance are the same. Sometimes, your data show extra variation that is greater than the mean. This situation is called overdispersion and negative binomial regression is more flexible in that regard than Poisson regression (you could still use Poisson regression in that case but the standard errors could be biased). The negative binomial distribution has one parameter more than the Poisson regression that adjusts the variance independently from the mean. In fact, the Poisson distribution is a special case of the negative binomial distribution.
|
Difference between binomial, negative binomial and Poisson regression
Only the nature of your data and your question of interest can tell you which of these regressions are best for your situation. So there are no tests that will tell you which one of these methods is t
|
7,391
|
Difference between binomial, negative binomial and Poisson regression
|
This is too long to be a comment, so I will make it an answer.
The distinction between binomial on the whole hand and Poisson and negative binomial on the other is in the nature of the data; tests are irrelevant.
There are widespread myths about the requirements for Poisson regression. Variance equal to mean is characteristic of a Poisson, but Poisson regression does not require that of the response, nor that the marginal distribution of the response be Poisson, any more than classical regression requires it to be normal (Gaussian).
Having dubious standard errors is not fatal, not least because you can get better estimates of standard errors in decent implementations of Poisson regression.
Nor does Poisson absolutely require the response to be counted. It often works well with non-negative continuous variables. For more on the underestimation (pun intended) of Poisson, see
http://blog.stata.com/tag/poisson-regression/
and its references. The Stata content of that blog entry should not stop it being of interest and use to people who don't use Stata.
It's difficult to advise well on the choice between Poisson and negative binomial regression. See if Poisson regression does a good job; otherwise consider the greater complication of negative binomial regression.
I can't advise on using SPSS. It wouldn't surprise me if you needed to use other software for flexible implementation of Poisson or negative binomial regression.
|
Difference between binomial, negative binomial and Poisson regression
|
This is too long to be a comment, so I will make it an answer.
The distinction between binomial on the whole hand and Poisson and negative binomial on the other is in the nature of the data; tests ar
|
Difference between binomial, negative binomial and Poisson regression
This is too long to be a comment, so I will make it an answer.
The distinction between binomial on the whole hand and Poisson and negative binomial on the other is in the nature of the data; tests are irrelevant.
There are widespread myths about the requirements for Poisson regression. Variance equal to mean is characteristic of a Poisson, but Poisson regression does not require that of the response, nor that the marginal distribution of the response be Poisson, any more than classical regression requires it to be normal (Gaussian).
Having dubious standard errors is not fatal, not least because you can get better estimates of standard errors in decent implementations of Poisson regression.
Nor does Poisson absolutely require the response to be counted. It often works well with non-negative continuous variables. For more on the underestimation (pun intended) of Poisson, see
http://blog.stata.com/tag/poisson-regression/
and its references. The Stata content of that blog entry should not stop it being of interest and use to people who don't use Stata.
It's difficult to advise well on the choice between Poisson and negative binomial regression. See if Poisson regression does a good job; otherwise consider the greater complication of negative binomial regression.
I can't advise on using SPSS. It wouldn't surprise me if you needed to use other software for flexible implementation of Poisson or negative binomial regression.
|
Difference between binomial, negative binomial and Poisson regression
This is too long to be a comment, so I will make it an answer.
The distinction between binomial on the whole hand and Poisson and negative binomial on the other is in the nature of the data; tests ar
|
7,392
|
Difference between binomial, negative binomial and Poisson regression
|
In SPSS Statistics, the GENLIN command handles Poisson, negative binomial and a bunch of others. (Analyze > Generalized Linear Models). It is part of the Advanced Statistics option.
|
Difference between binomial, negative binomial and Poisson regression
|
In SPSS Statistics, the GENLIN command handles Poisson, negative binomial and a bunch of others. (Analyze > Generalized Linear Models). It is part of the Advanced Statistics option.
|
Difference between binomial, negative binomial and Poisson regression
In SPSS Statistics, the GENLIN command handles Poisson, negative binomial and a bunch of others. (Analyze > Generalized Linear Models). It is part of the Advanced Statistics option.
|
Difference between binomial, negative binomial and Poisson regression
In SPSS Statistics, the GENLIN command handles Poisson, negative binomial and a bunch of others. (Analyze > Generalized Linear Models). It is part of the Advanced Statistics option.
|
7,393
|
Difference between binomial, negative binomial and Poisson regression
|
Poisson/Negative binomial can also be used with a binary outcome with offset equal to one. Of course it necessitates that the data be from a prospective design (cohort, rct, etc). Poisson or NB regression gives the more appropriate effect measure (IRR) versus odds ratio from logistic regression.
NB regression is "safer" to run than Poisson regression because even if the overdispersion parameter (alpha in Stata) is not statistically significant, the results will be exactly the same as its Poisson regression form.
|
Difference between binomial, negative binomial and Poisson regression
|
Poisson/Negative binomial can also be used with a binary outcome with offset equal to one. Of course it necessitates that the data be from a prospective design (cohort, rct, etc). Poisson or NB regres
|
Difference between binomial, negative binomial and Poisson regression
Poisson/Negative binomial can also be used with a binary outcome with offset equal to one. Of course it necessitates that the data be from a prospective design (cohort, rct, etc). Poisson or NB regression gives the more appropriate effect measure (IRR) versus odds ratio from logistic regression.
NB regression is "safer" to run than Poisson regression because even if the overdispersion parameter (alpha in Stata) is not statistically significant, the results will be exactly the same as its Poisson regression form.
|
Difference between binomial, negative binomial and Poisson regression
Poisson/Negative binomial can also be used with a binary outcome with offset equal to one. Of course it necessitates that the data be from a prospective design (cohort, rct, etc). Poisson or NB regres
|
7,394
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
To make the problem simpler, let's consider the case where the allowed values of the share of each person is discrete, e.g., integers. Equivalently, one can also imagine partitioning the "income axis" into equally spaced intervals and approximating all values falling into a given interval by the midpoint.
Denoting the total income as $X$, the $s$-th allowed value as $x_{s}$, the total number of people as $N$, and finally, the number of people with shares of $x_{s}$ as $n_{s}$, the following conditions should be satisfied:
\begin{equation}
C_{1} (\{n_{s}\})\equiv\sum_{s} n_{s} - N = 0,
\end{equation}
and
\begin{equation}
C_{2} (\{n_{s}\})\equiv \sum_{s} n_{s} x_{s} - X = 0.
\end{equation}
Notice that many different ways to divide the share can represent the same distribution. For example, if we considered dividing \$4 between two people, giving \$3 to Alice and \$1 to Bob and vice versa would both give identical distributions. As the division is random, the distribution with the maximum number of corresponding ways to divide the share has the best chance to occur.
To obtain such a distribution, one has to maximize
\begin{equation}
W(\{n_{s}\}) \equiv \frac{N!}{\prod_{s} n_{s}!},
\end{equation}
under the two constraints given above. The method of Lagrange multipliers is a canonical approach for this. Furthermore, one can choose to work with $\ln W$ instead of $W$ itself, as "$\ln$" is a monotone increasing function. That is,
\begin{equation}
\frac{\partial \ln W}{\partial n_{s}} = \lambda_{1} \frac{\partial C_{1}}{\partial n_{s}} +
\lambda_{2} \frac{\partial C_{1}}{\partial n_{s}} = \lambda_{1} + \lambda_{2} x_{s},
\end{equation}
where $\lambda_{1,2}$ are Lagrange multipliers. Notice that according to Stirling's formula,
\begin{equation}
\ln n! \approx n\ln n - n,
\end{equation}
leading to
\begin{equation}
\frac{d\ln n!}{dn} \approx \ln n.
\end{equation}
Thus,
\begin{equation}
\frac{\partial \ln W}{\partial n_{s}} \approx -\ln n_{s}.
\end{equation}
It then follows that
\begin{equation}
n_{s} \approx \exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big),
\end{equation}
which is an exponential distribution. One can obtain the values of Lagrange multipliers using the constraints. From the first constraint,
\begin{equation}
\begin{split}
N &= \sum_{s} n_{s} \approx \sum_{s} \exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big)\\
&\approx \frac{1}{\Delta x} \int_{0}^{\infty} \exp\big(-\lambda_{1} - \lambda_{2} x\big) \,\,dx\\
&=\frac{1}{\lambda_{2}\Delta x}\exp\big(-\lambda_{1}\big),
\end{split}
\end{equation}
where $\Delta x$ is the spacing between allowed values. Similarly,
\begin{equation}
\begin{split}
X &= \sum_{s} n_{s}x_{s} \approx \sum_{s} x_{s}\,\exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big)\\
&\approx \frac{1}{\Delta x} \int_{0}^{\infty} x\,\exp\big(-\lambda_{1} - \lambda_{2} x\big) \,\,dx\\
&=\frac{1}{\lambda_{2}^{2}\,\Delta x}\exp\big(-\lambda_{1}\big).
\end{split}
\end{equation}
Therefore, we have
\begin{equation}
\exp\big(-\lambda_{1}\big) = \frac{N^{2} \Delta x}{X},
\end{equation}
and
\begin{equation}
\lambda_{2} = \frac{N}{X}.
\end{equation}
That this is really a maximum, rather than a minimum or a saddle point, can be seen from the Hessian of $\ln W - \lambda_{1} C_{1} - \lambda_{2} C_{2}$. Because $C_{1,2}$ are linear in $n_{s}$, it is the same as that of $\ln W$:
\begin{equation}
\frac{\partial^{2} \ln W}{\partial n_{s}^{2}} = -\frac{1}{n_{s}} < 0,
\end{equation}
and
\begin{equation}
\frac{\partial^{2} \ln W}{\partial n_{s}\partial n_{r}} = 0 \quad (s\neq r).
\end{equation}
Hence the Hessian is concave, and what we have found is indeed a maximum.
The function $W(\{n_{s}\})$ is really the distribution of distributions. For distributions we typically observe to be close to the most probable one, $W(\{n_{s}\})$ should be narrow enough. It is seen from the Hessian that this condition amounts to $n_{s}\gg 1$. (It is also the condition that Stirling's formula is reliable.) Therefore, to actually see the exponential distribution, partitions in the income axis (corresponding to bins in OP's histogram) should be wide enough so that number of people in a partition is much greater than unity. Towards the tail, where $n_{s}$ tends to zero, this condition is always destined to fail.
Note: This is exactly how physicists understand the Boltzmann distribution in statistical mechanics. The exponential distribution is essentially exact for this case, as we consider $N\sim 10^{23}$.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
To make the problem simpler, let's consider the case where the allowed values of the share of each person is discrete, e.g., integers. Equivalently, one can also imagine partitioning the "income axis"
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
To make the problem simpler, let's consider the case where the allowed values of the share of each person is discrete, e.g., integers. Equivalently, one can also imagine partitioning the "income axis" into equally spaced intervals and approximating all values falling into a given interval by the midpoint.
Denoting the total income as $X$, the $s$-th allowed value as $x_{s}$, the total number of people as $N$, and finally, the number of people with shares of $x_{s}$ as $n_{s}$, the following conditions should be satisfied:
\begin{equation}
C_{1} (\{n_{s}\})\equiv\sum_{s} n_{s} - N = 0,
\end{equation}
and
\begin{equation}
C_{2} (\{n_{s}\})\equiv \sum_{s} n_{s} x_{s} - X = 0.
\end{equation}
Notice that many different ways to divide the share can represent the same distribution. For example, if we considered dividing \$4 between two people, giving \$3 to Alice and \$1 to Bob and vice versa would both give identical distributions. As the division is random, the distribution with the maximum number of corresponding ways to divide the share has the best chance to occur.
To obtain such a distribution, one has to maximize
\begin{equation}
W(\{n_{s}\}) \equiv \frac{N!}{\prod_{s} n_{s}!},
\end{equation}
under the two constraints given above. The method of Lagrange multipliers is a canonical approach for this. Furthermore, one can choose to work with $\ln W$ instead of $W$ itself, as "$\ln$" is a monotone increasing function. That is,
\begin{equation}
\frac{\partial \ln W}{\partial n_{s}} = \lambda_{1} \frac{\partial C_{1}}{\partial n_{s}} +
\lambda_{2} \frac{\partial C_{1}}{\partial n_{s}} = \lambda_{1} + \lambda_{2} x_{s},
\end{equation}
where $\lambda_{1,2}$ are Lagrange multipliers. Notice that according to Stirling's formula,
\begin{equation}
\ln n! \approx n\ln n - n,
\end{equation}
leading to
\begin{equation}
\frac{d\ln n!}{dn} \approx \ln n.
\end{equation}
Thus,
\begin{equation}
\frac{\partial \ln W}{\partial n_{s}} \approx -\ln n_{s}.
\end{equation}
It then follows that
\begin{equation}
n_{s} \approx \exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big),
\end{equation}
which is an exponential distribution. One can obtain the values of Lagrange multipliers using the constraints. From the first constraint,
\begin{equation}
\begin{split}
N &= \sum_{s} n_{s} \approx \sum_{s} \exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big)\\
&\approx \frac{1}{\Delta x} \int_{0}^{\infty} \exp\big(-\lambda_{1} - \lambda_{2} x\big) \,\,dx\\
&=\frac{1}{\lambda_{2}\Delta x}\exp\big(-\lambda_{1}\big),
\end{split}
\end{equation}
where $\Delta x$ is the spacing between allowed values. Similarly,
\begin{equation}
\begin{split}
X &= \sum_{s} n_{s}x_{s} \approx \sum_{s} x_{s}\,\exp\big(-\lambda_{1} - \lambda_{2} x_{s}\big)\\
&\approx \frac{1}{\Delta x} \int_{0}^{\infty} x\,\exp\big(-\lambda_{1} - \lambda_{2} x\big) \,\,dx\\
&=\frac{1}{\lambda_{2}^{2}\,\Delta x}\exp\big(-\lambda_{1}\big).
\end{split}
\end{equation}
Therefore, we have
\begin{equation}
\exp\big(-\lambda_{1}\big) = \frac{N^{2} \Delta x}{X},
\end{equation}
and
\begin{equation}
\lambda_{2} = \frac{N}{X}.
\end{equation}
That this is really a maximum, rather than a minimum or a saddle point, can be seen from the Hessian of $\ln W - \lambda_{1} C_{1} - \lambda_{2} C_{2}$. Because $C_{1,2}$ are linear in $n_{s}$, it is the same as that of $\ln W$:
\begin{equation}
\frac{\partial^{2} \ln W}{\partial n_{s}^{2}} = -\frac{1}{n_{s}} < 0,
\end{equation}
and
\begin{equation}
\frac{\partial^{2} \ln W}{\partial n_{s}\partial n_{r}} = 0 \quad (s\neq r).
\end{equation}
Hence the Hessian is concave, and what we have found is indeed a maximum.
The function $W(\{n_{s}\})$ is really the distribution of distributions. For distributions we typically observe to be close to the most probable one, $W(\{n_{s}\})$ should be narrow enough. It is seen from the Hessian that this condition amounts to $n_{s}\gg 1$. (It is also the condition that Stirling's formula is reliable.) Therefore, to actually see the exponential distribution, partitions in the income axis (corresponding to bins in OP's histogram) should be wide enough so that number of people in a partition is much greater than unity. Towards the tail, where $n_{s}$ tends to zero, this condition is always destined to fail.
Note: This is exactly how physicists understand the Boltzmann distribution in statistical mechanics. The exponential distribution is essentially exact for this case, as we consider $N\sim 10^{23}$.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
To make the problem simpler, let's consider the case where the allowed values of the share of each person is discrete, e.g., integers. Equivalently, one can also imagine partitioning the "income axis"
|
7,395
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
In fact you can prove it's not actually exponential, almost trivially:
Compute the probability that a given share is greater than $500$ million. Compare with the probability that an exponential random variable is greater than $500$ million.
However, it's not too hard to see that for your uniform-gap example that it should be close to exponential.
Consider a Poisson process - where events occur at random over along some dimension. The number of events per unit of the interval has a Poisson distribution, and the gap between events is exponential.
If you take a fixed interval then the events in a Poisson process that fall within it are uniformly distributed in the interval. See here.
[However, note that because the interval is finite, you simply can't observe larger gaps than the interval length, and gaps nearly that large will be unlikely (consider, for example, in a unit interval - if you see gaps of 0.04 and 0.01, the next gap you see can't be bigger than 0.95).]
So apart from the effect of restricting attention to a fixed interval on the distribution of the gaps (which will reduce for large $n$, the number of points in the interval), you would expect those gaps to be exponentially distributed.
Now in your code, you're dividing the unit interval by placing uniforms and then finding the gaps in successive order statistics. Here the unit interval is not time or space but represents a dimension of money (imagine the money as 50000 million cents laid out end to end, and call the distance they cover the unit interval; except here we can have fractions of a cent); we lay down $n$ marks, and that divides the interval into $n+1$ "shares". Because of the connection between the Poisson process and uniform points in an interval, the gaps in the order statistics of a uniform will tend to look exponential, as long as $n$ is not too small.
More specifically, any gap that starts in the interval placed over the Poisson process has a chance to be "censored" (effectively, cut shorter than it would otherwise have been) by running into the end of the interval.
$\hspace{1cm}$
Longer gaps are more likely to do that than shorter ones, and more gaps in the interval means the average gap length must go down -- more short gaps. This tendency to be 'cut off' will tend to affect the distribution of longer gaps more than short ones (and there's no chance any gap limited to the interval will exceed the length of the interval -- so the distribution of gap size should decrease smoothly to zero at the size of the whole interval).
In the diagram, a longish interval at the end has been cut shorter, and a relatively shorter interval at the start is also shorter. These effects bias us away from exponentiality.
(The actual distribution of the gaps between $n$ uniform order statistics is Beta(1,n). )
So we should see the distribution at large $n$ look exponential in the small values, and then less exponential at the larger values, since the density at its largest values will drop off more quickly.
Here's a simulation of the distribution of gaps for n=2:
Not very exponential.
But for n=20, it starts to look pretty close; in fact as $n$ grows large it will be well approximated by an exponential with mean $\frac{1}{n+1}$.
If that was actually exponential with mean 1/21, then $\exp(-21x)$ would be uniform... but we can see it isn't, quite:
The non-uniformity in the low values there corresponds to large values of the gaps -- which we'd expect from teh above discussion, because the effect of the "cutting off" the Poisson process to a finite interval means we don't see the largest gaps. But as you take more and more values, that goes further out into the tail, and so the result starts to look more nearly uniform. At $n=10000$, the equivalent display would be harder to distinguish from uniform - the gaps (representing shares of the money) should be very close to exponentially distributed except at the very unlikely, very very largest values.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
In fact you can prove it's not actually exponential, almost trivially:
Compute the probability that a given share is greater than $500$ million. Compare with the probability that an exponential random
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
In fact you can prove it's not actually exponential, almost trivially:
Compute the probability that a given share is greater than $500$ million. Compare with the probability that an exponential random variable is greater than $500$ million.
However, it's not too hard to see that for your uniform-gap example that it should be close to exponential.
Consider a Poisson process - where events occur at random over along some dimension. The number of events per unit of the interval has a Poisson distribution, and the gap between events is exponential.
If you take a fixed interval then the events in a Poisson process that fall within it are uniformly distributed in the interval. See here.
[However, note that because the interval is finite, you simply can't observe larger gaps than the interval length, and gaps nearly that large will be unlikely (consider, for example, in a unit interval - if you see gaps of 0.04 and 0.01, the next gap you see can't be bigger than 0.95).]
So apart from the effect of restricting attention to a fixed interval on the distribution of the gaps (which will reduce for large $n$, the number of points in the interval), you would expect those gaps to be exponentially distributed.
Now in your code, you're dividing the unit interval by placing uniforms and then finding the gaps in successive order statistics. Here the unit interval is not time or space but represents a dimension of money (imagine the money as 50000 million cents laid out end to end, and call the distance they cover the unit interval; except here we can have fractions of a cent); we lay down $n$ marks, and that divides the interval into $n+1$ "shares". Because of the connection between the Poisson process and uniform points in an interval, the gaps in the order statistics of a uniform will tend to look exponential, as long as $n$ is not too small.
More specifically, any gap that starts in the interval placed over the Poisson process has a chance to be "censored" (effectively, cut shorter than it would otherwise have been) by running into the end of the interval.
$\hspace{1cm}$
Longer gaps are more likely to do that than shorter ones, and more gaps in the interval means the average gap length must go down -- more short gaps. This tendency to be 'cut off' will tend to affect the distribution of longer gaps more than short ones (and there's no chance any gap limited to the interval will exceed the length of the interval -- so the distribution of gap size should decrease smoothly to zero at the size of the whole interval).
In the diagram, a longish interval at the end has been cut shorter, and a relatively shorter interval at the start is also shorter. These effects bias us away from exponentiality.
(The actual distribution of the gaps between $n$ uniform order statistics is Beta(1,n). )
So we should see the distribution at large $n$ look exponential in the small values, and then less exponential at the larger values, since the density at its largest values will drop off more quickly.
Here's a simulation of the distribution of gaps for n=2:
Not very exponential.
But for n=20, it starts to look pretty close; in fact as $n$ grows large it will be well approximated by an exponential with mean $\frac{1}{n+1}$.
If that was actually exponential with mean 1/21, then $\exp(-21x)$ would be uniform... but we can see it isn't, quite:
The non-uniformity in the low values there corresponds to large values of the gaps -- which we'd expect from teh above discussion, because the effect of the "cutting off" the Poisson process to a finite interval means we don't see the largest gaps. But as you take more and more values, that goes further out into the tail, and so the result starts to look more nearly uniform. At $n=10000$, the equivalent display would be harder to distinguish from uniform - the gaps (representing shares of the money) should be very close to exponentially distributed except at the very unlikely, very very largest values.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
In fact you can prove it's not actually exponential, almost trivially:
Compute the probability that a given share is greater than $500$ million. Compare with the probability that an exponential random
|
7,396
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
Let's suppose the money is infinitely divisible so we can deal with real numbers rather than integers.
Then the uniform distribution of $t=500000000$ partitioned across $n=10000$ individuals will give a marginal density for each individual $$p(x)=\frac{n-1}{t}\left(1-\frac{x}{t}\right)^{n-2}$$ for $0 \le x \le t$, and a marginal cumulative probability for each individual of $$P(X \le x)=1 - \left(1-\frac{x}{t}\right)^{n-1}.$$
If you want to apply this then use the marginal distribution to allocate a random amount $X$ to any of the individuals, then reduce $t$ to $t-X$ and $n$ to $n-1$ and repeat. Note that when $n=2$, this would give each individual a uniform marginal distribution across the remaining amount, much as one might expect; when $n=1$ you give all the remaining money to the single remaining person.
These expressions are polynomial rather than exponential, but for large $n$ you will probably find it hard to distinguish their effects from an exponential distribution with a parameter close to $\frac{n}{t}$. The distribution is asymptotically exponential because $\left(1-\frac{y}{m}\right)^{m} \to \exp(-y)$ as $m \to \infty$.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
Let's suppose the money is infinitely divisible so we can deal with real numbers rather than integers.
Then the uniform distribution of $t=500000000$ partitioned across $n=10000$ individuals will gi
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
Let's suppose the money is infinitely divisible so we can deal with real numbers rather than integers.
Then the uniform distribution of $t=500000000$ partitioned across $n=10000$ individuals will give a marginal density for each individual $$p(x)=\frac{n-1}{t}\left(1-\frac{x}{t}\right)^{n-2}$$ for $0 \le x \le t$, and a marginal cumulative probability for each individual of $$P(X \le x)=1 - \left(1-\frac{x}{t}\right)^{n-1}.$$
If you want to apply this then use the marginal distribution to allocate a random amount $X$ to any of the individuals, then reduce $t$ to $t-X$ and $n$ to $n-1$ and repeat. Note that when $n=2$, this would give each individual a uniform marginal distribution across the remaining amount, much as one might expect; when $n=1$ you give all the remaining money to the single remaining person.
These expressions are polynomial rather than exponential, but for large $n$ you will probably find it hard to distinguish their effects from an exponential distribution with a parameter close to $\frac{n}{t}$. The distribution is asymptotically exponential because $\left(1-\frac{y}{m}\right)^{m} \to \exp(-y)$ as $m \to \infty$.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
Let's suppose the money is infinitely divisible so we can deal with real numbers rather than integers.
Then the uniform distribution of $t=500000000$ partitioned across $n=10000$ individuals will gi
|
7,397
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
To say, "suppose you randomly divide 500 million in income among 10,000 people" is insufficiently specific to answer the question. There are many different random process that could be used to allocate a fixed amount of money to a fixed number of people, and each will have its own characteristics for the resulting distribution. Here are three generative processes I could think of, and the distributions of wealth each creates.
library(MASS)
w <- 500000000 #wealth
p <- 10000 #people
Method 1, posted by OP:
Choose 'p' numbers from [0,w) uniformly at random. Sort these. Append '0' to the front. Hand out dollar amounts represented by the differences between successive elements in this list.
d <- diff(c(0,sort(runif(p-1,max=w)),w)) #wealth-distribution
h <- hist(d, col="red", main="Exponential decline", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
fit <- fitdistr(d,"exponential")
curve(dexp(x, rate = fit$estimate), col = "black", type="p",
pch=16, add = TRUE)
Method 2:
Chose 'p' numbers from [0, w) uniformly at random. Consider these 'weights',
so 'w' doesn't actually matter at this stage. Normalize the weights. Hand out dollar amounts represented by the fraction of 'w' corresponding to each weight.
d <- runif(p,max=w) #weigh-distribution
d <- d/sum(d)*w #wealth-distribution
h <- hist(d, col="red", main="pretty uniform", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
Method 3:
Start with 'p' 0s. w times, add 1 to a one of them, selected uniformly at random.
d <- rep(0, p)
for( i in 1:5000000){ ## for-loops in R are terrible, but this gives the idea.
k <- floor(runif(1, max=p)) + 1
d[k] = (d[k] + 1)
}
h <- hist(d, col="red", main="kinda normalish?", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
To say, "suppose you randomly divide 500 million in income among 10,000 people" is insufficiently specific to answer the question. There are many different random process that could be used to allocat
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
To say, "suppose you randomly divide 500 million in income among 10,000 people" is insufficiently specific to answer the question. There are many different random process that could be used to allocate a fixed amount of money to a fixed number of people, and each will have its own characteristics for the resulting distribution. Here are three generative processes I could think of, and the distributions of wealth each creates.
library(MASS)
w <- 500000000 #wealth
p <- 10000 #people
Method 1, posted by OP:
Choose 'p' numbers from [0,w) uniformly at random. Sort these. Append '0' to the front. Hand out dollar amounts represented by the differences between successive elements in this list.
d <- diff(c(0,sort(runif(p-1,max=w)),w)) #wealth-distribution
h <- hist(d, col="red", main="Exponential decline", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
fit <- fitdistr(d,"exponential")
curve(dexp(x, rate = fit$estimate), col = "black", type="p",
pch=16, add = TRUE)
Method 2:
Chose 'p' numbers from [0, w) uniformly at random. Consider these 'weights',
so 'w' doesn't actually matter at this stage. Normalize the weights. Hand out dollar amounts represented by the fraction of 'w' corresponding to each weight.
d <- runif(p,max=w) #weigh-distribution
d <- d/sum(d)*w #wealth-distribution
h <- hist(d, col="red", main="pretty uniform", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
Method 3:
Start with 'p' 0s. w times, add 1 to a one of them, selected uniformly at random.
d <- rep(0, p)
for( i in 1:5000000){ ## for-loops in R are terrible, but this gives the idea.
k <- floor(runif(1, max=p)) + 1
d[k] = (d[k] + 1)
}
h <- hist(d, col="red", main="kinda normalish?", freq = FALSE, breaks = 45,
xlim = c(0, quantile(d, 0.99)))
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
To say, "suppose you randomly divide 500 million in income among 10,000 people" is insufficiently specific to answer the question. There are many different random process that could be used to allocat
|
7,398
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
Let me add something regarding your addendum.
In the continuous case, as pointed out by Glen_b and Henry, the exact PDF for the amount each person receives is
\begin{equation}
p(x) = \frac{N-1}{X}\left(1-\frac{x}{X}\right)^{N-2},
\end{equation}
where $N$ is the number of people, and $X$ is the total amount of money.
In the discrete case, assuming that there are $M$ coins to distribute, the probability for a particular person to receive $m$ coins is
\begin{equation}
p(m) = \frac{N-1}{M+1}\prod_{j=0}^{N-3}\left(1-\frac{m}{M-j}\right)^{N-2}.
\end{equation}
When $M\gg N$, two cases agree with each other. For sufficiently large $N$ and as long as we stay away from the tail, they look like exponential distributions.
In both cases, as we are sampling $N$ times from this true probability distribution, there will be error associated with the finite sample size.
However, performing the error analysis does not seem to be straightforward because different samplings in this case are not independent. They have to sum up to the total amount, and how much the first person receives affects the probability distribution for the second person, and so on.
My previous answer does not suffer from this issue, but I think it would be helpful to see how it can be resolved in this approach.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
Let me add something regarding your addendum.
In the continuous case, as pointed out by Glen_b and Henry, the exact PDF for the amount each person receives is
\begin{equation}
p(x) = \frac{N-1}{X}\lef
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
Let me add something regarding your addendum.
In the continuous case, as pointed out by Glen_b and Henry, the exact PDF for the amount each person receives is
\begin{equation}
p(x) = \frac{N-1}{X}\left(1-\frac{x}{X}\right)^{N-2},
\end{equation}
where $N$ is the number of people, and $X$ is the total amount of money.
In the discrete case, assuming that there are $M$ coins to distribute, the probability for a particular person to receive $m$ coins is
\begin{equation}
p(m) = \frac{N-1}{M+1}\prod_{j=0}^{N-3}\left(1-\frac{m}{M-j}\right)^{N-2}.
\end{equation}
When $M\gg N$, two cases agree with each other. For sufficiently large $N$ and as long as we stay away from the tail, they look like exponential distributions.
In both cases, as we are sampling $N$ times from this true probability distribution, there will be error associated with the finite sample size.
However, performing the error analysis does not seem to be straightforward because different samplings in this case are not independent. They have to sum up to the total amount, and how much the first person receives affects the probability distribution for the second person, and so on.
My previous answer does not suffer from this issue, but I think it would be helpful to see how it can be resolved in this approach.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
Let me add something regarding your addendum.
In the continuous case, as pointed out by Glen_b and Henry, the exact PDF for the amount each person receives is
\begin{equation}
p(x) = \frac{N-1}{X}\lef
|
7,399
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
|
Good theoretical analysis done by the upvoted answers.
However, here's my simple, empirical view on why the distribution is exponential.
When you distribute the money randomly, let's consider you do it one-by-one.
Let S be the original sum.
For the first man, you must choose a random amount between 0 and S. Thus, on average, you will choose S/2 and remain with S/2.
For the second man, you would choose randomly between 0 and, on average, S/2. Thus, on average, you'll choose S/4 and remain with S/4.
So, you would basically be splitting the sum in half each time (statistically speaking).
Although in a real-life example you will not have continuously halved values, this shows why one should expect the distribution to be exponential.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
|
Good theoretical analysis done by the upvoted answers.
However, here's my simple, empirical view on why the distribution is exponential.
When you distribute the money randomly, let's consider you do i
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution (of e.g. income and wealth)?
Good theoretical analysis done by the upvoted answers.
However, here's my simple, empirical view on why the distribution is exponential.
When you distribute the money randomly, let's consider you do it one-by-one.
Let S be the original sum.
For the first man, you must choose a random amount between 0 and S. Thus, on average, you will choose S/2 and remain with S/2.
For the second man, you would choose randomly between 0 and, on average, S/2. Thus, on average, you'll choose S/4 and remain with S/4.
So, you would basically be splitting the sum in half each time (statistically speaking).
Although in a real-life example you will not have continuously halved values, this shows why one should expect the distribution to be exponential.
|
How can I analytically prove that randomly dividing an amount results in an exponential distribution
Good theoretical analysis done by the upvoted answers.
However, here's my simple, empirical view on why the distribution is exponential.
When you distribute the money randomly, let's consider you do i
|
7,400
|
Proof of convergence of k-means
|
First, there are at most $k^N$ ways to partition $N$ data points into $k$ clusters; each such partition can be called a "clustering". This is a large but finite number. For each iteration of the algorithm, we produce a new clustering based only on the old clustering. Notice that
if the old clustering is the same as the new, then the next
clustering will again be the same.
If the new clustering is
different from the old then the newer one has a lower cost
Since the algorithm iterates a function whose domain is a finite set, the iteration must eventually enter a cycle. The cycle can not have length greater than $1$ because otherwise by (2) you would have some clustering which has a lower cost than itself which is impossible. Hence the cycle must have length exactly $1$. Hence k-means converges in a finite number of iterations.
|
Proof of convergence of k-means
|
First, there are at most $k^N$ ways to partition $N$ data points into $k$ clusters; each such partition can be called a "clustering". This is a large but finite number. For each iteration of the algor
|
Proof of convergence of k-means
First, there are at most $k^N$ ways to partition $N$ data points into $k$ clusters; each such partition can be called a "clustering". This is a large but finite number. For each iteration of the algorithm, we produce a new clustering based only on the old clustering. Notice that
if the old clustering is the same as the new, then the next
clustering will again be the same.
If the new clustering is
different from the old then the newer one has a lower cost
Since the algorithm iterates a function whose domain is a finite set, the iteration must eventually enter a cycle. The cycle can not have length greater than $1$ because otherwise by (2) you would have some clustering which has a lower cost than itself which is impossible. Hence the cycle must have length exactly $1$. Hence k-means converges in a finite number of iterations.
|
Proof of convergence of k-means
First, there are at most $k^N$ ways to partition $N$ data points into $k$ clusters; each such partition can be called a "clustering". This is a large but finite number. For each iteration of the algor
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.