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
30,101
What is Item Response Theory (IRT) called for continuous response?
The accepted answer does not give models where the response is bounded between [0,1]. There are IRT models for exactly the case where the response variable is continuous, but bounded in this way. For example, Samejima [1] describes exactly this case. These models are sometimes called Continuous Response Models (CRM), and the case they're addressing is sometimes called Continuous Response Format (CRF). They are the standard factor analysis setup, but add a transformation to bound the responses within an interval (in the same sense that the standard IRT takes factor analysis, and adds a link so responses will be, say, 0 or 1). Ferrando [2] has a good paper on this, and the R library estCRM looks like it can implement it (though I haven't used it!). [1]: Normal ogive model on the continuous response level in the multidimensional latent space [2]: Theoretical and Empirical Comparisons between Two Models for Continuous Item Response
What is Item Response Theory (IRT) called for continuous response?
The accepted answer does not give models where the response is bounded between [0,1]. There are IRT models for exactly the case where the response variable is continuous, but bounded in this way. For
What is Item Response Theory (IRT) called for continuous response? The accepted answer does not give models where the response is bounded between [0,1]. There are IRT models for exactly the case where the response variable is continuous, but bounded in this way. For example, Samejima [1] describes exactly this case. These models are sometimes called Continuous Response Models (CRM), and the case they're addressing is sometimes called Continuous Response Format (CRF). They are the standard factor analysis setup, but add a transformation to bound the responses within an interval (in the same sense that the standard IRT takes factor analysis, and adds a link so responses will be, say, 0 or 1). Ferrando [2] has a good paper on this, and the R library estCRM looks like it can implement it (though I haven't used it!). [1]: Normal ogive model on the continuous response level in the multidimensional latent space [2]: Theoretical and Empirical Comparisons between Two Models for Continuous Item Response
What is Item Response Theory (IRT) called for continuous response? The accepted answer does not give models where the response is bounded between [0,1]. There are IRT models for exactly the case where the response variable is continuous, but bounded in this way. For
30,102
What is Item Response Theory (IRT) called for continuous response?
I agree that the accepted answer does not point towards specifically dedicated models. See for instance: Noel, Y. & Dauvier, B. (2007). A beta item response model for continuous bounded responses, Applied Psychological Measurement, 31, 47-73. Noel, Y. (2014). A beta unfolding model for continuous bounded responses, Psychometrika, 79(4), 647-674. Verhelst N.D. (2019). Exponential Family Models for Continuous Responses. In: Veldkamp B., Sluijter C. (eds) Theoretical and Practical Advances in Computer-based Educational Measurement. Methodology of Educational Measurement and Assessment. Springer, Cham. Best, G.
What is Item Response Theory (IRT) called for continuous response?
I agree that the accepted answer does not point towards specifically dedicated models. See for instance: Noel, Y. & Dauvier, B. (2007). A beta item response model for continuous bounded responses, Ap
What is Item Response Theory (IRT) called for continuous response? I agree that the accepted answer does not point towards specifically dedicated models. See for instance: Noel, Y. & Dauvier, B. (2007). A beta item response model for continuous bounded responses, Applied Psychological Measurement, 31, 47-73. Noel, Y. (2014). A beta unfolding model for continuous bounded responses, Psychometrika, 79(4), 647-674. Verhelst N.D. (2019). Exponential Family Models for Continuous Responses. In: Veldkamp B., Sluijter C. (eds) Theoretical and Practical Advances in Computer-based Educational Measurement. Methodology of Educational Measurement and Assessment. Springer, Cham. Best, G.
What is Item Response Theory (IRT) called for continuous response? I agree that the accepted answer does not point towards specifically dedicated models. See for instance: Noel, Y. & Dauvier, B. (2007). A beta item response model for continuous bounded responses, Ap
30,103
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent?
Let $X,Y$ be random variables with variances $\sigma^{2}_{x}$ and $\sigma^{2}_{y}$, respectively. It is a fact that ${\rm var}(Z) = {\rm cov}(Z,Z)$ for any random variable $Z$. This can be checked using the definition of covariance and variance. So, the variance of $X-Y$ is $$ {\rm cov}(X-Y,X-Y) = {\rm cov}(X,X)+{\rm cov}(Y,Y)-2\cdot{\rm cov}(X,Y) $$ which follows from bilinearity of covariance. Therefore, $$ {\rm var}(X-Y) = \sigma^{2}_{x} + \sigma^{2}_{y} - 2\cdot{\rm cov}(X,Y) $$ when $X,Y$ are independent the covariance is 0 so this simplifies to $\sigma^{2}_{x} + \sigma^{2}_{y}$. So, the variance of the difference of two independent variables is the sum of the variances.
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent?
Let $X,Y$ be random variables with variances $\sigma^{2}_{x}$ and $\sigma^{2}_{y}$, respectively. It is a fact that ${\rm var}(Z) = {\rm cov}(Z,Z)$ for any random variable $Z$. This can be checked usi
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent? Let $X,Y$ be random variables with variances $\sigma^{2}_{x}$ and $\sigma^{2}_{y}$, respectively. It is a fact that ${\rm var}(Z) = {\rm cov}(Z,Z)$ for any random variable $Z$. This can be checked using the definition of covariance and variance. So, the variance of $X-Y$ is $$ {\rm cov}(X-Y,X-Y) = {\rm cov}(X,X)+{\rm cov}(Y,Y)-2\cdot{\rm cov}(X,Y) $$ which follows from bilinearity of covariance. Therefore, $$ {\rm var}(X-Y) = \sigma^{2}_{x} + \sigma^{2}_{y} - 2\cdot{\rm cov}(X,Y) $$ when $X,Y$ are independent the covariance is 0 so this simplifies to $\sigma^{2}_{x} + \sigma^{2}_{y}$. So, the variance of the difference of two independent variables is the sum of the variances.
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent? Let $X,Y$ be random variables with variances $\sigma^{2}_{x}$ and $\sigma^{2}_{y}$, respectively. It is a fact that ${\rm var}(Z) = {\rm cov}(Z,Z)$ for any random variable $Z$. This can be checked usi
30,104
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent?
If $X$ and $Y$ are independent random variables, then so are $X$ and $Z$ independent random variables where $Z = -Y$. Now, $$\text{var}(Z) = \text{var}(-Y) = (-1)^2\text{var}(Y) = \text{var}(Y)$$ and so $$\text{var}(X-Y) = \text{var}(X + (-Y)) = \text{var}(X+Z) = \text{var}(X) + \text{var}(Z) = \text{var}(X) + \text{var}(Y)$$ with nary an explicit mention of the word covariance.
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent?
If $X$ and $Y$ are independent random variables, then so are $X$ and $Z$ independent random variables where $Z = -Y$. Now, $$\text{var}(Z) = \text{var}(-Y) = (-1)^2\text{var}(Y) = \text{var}(Y)$$ an
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent? If $X$ and $Y$ are independent random variables, then so are $X$ and $Z$ independent random variables where $Z = -Y$. Now, $$\text{var}(Z) = \text{var}(-Y) = (-1)^2\text{var}(Y) = \text{var}(Y)$$ and so $$\text{var}(X-Y) = \text{var}(X + (-Y)) = \text{var}(X+Z) = \text{var}(X) + \text{var}(Z) = \text{var}(X) + \text{var}(Y)$$ with nary an explicit mention of the word covariance.
Why is the variance of $X-Y$ equal to the sum of the variances when $X,Y$ are independent? If $X$ and $Y$ are independent random variables, then so are $X$ and $Z$ independent random variables where $Z = -Y$. Now, $$\text{var}(Z) = \text{var}(-Y) = (-1)^2\text{var}(Y) = \text{var}(Y)$$ an
30,105
How do you go from paper to code?
More precisely, I still do not understand how someone goes from a research paper to e.g., an R package. Like a lot of things in life, sometimes the hardest part is just getting started. A lot of people set themselves up for failure by just, well, thinking they aren't prepared enough and are going to fail, so they effectively give up before they even try. With that said, you do have to know at least a little to get started. In the context of writing R packages based on a paper, you don't necessarily need to be comfortable with the math or theory behind the topic to get started. You might find the process of writing the package actually helps with developing that deeper understanding you eventually do want to have, and that over time you'll make changes to the package that reflect that. I actually have a very robust, user-friendly R package where I started in this situation. I have a lot of programming experience, and someone I know had this non-trivial theory he'd been developing but didn't have the ability to properly implement in a package, so he asked me to help. The details of the math and theory were mostly unfamiliar to me since my expertise is somewhere else. I didn't even know the details of creating an R package at that point. But now, after having gone through the process of creating the package, I'm at a point where I'm even able to make my own contributions and advancements to the theory and its applications. To start, what you need to do is think about what users might want in a package. What does the paper present that potential users will find useful? This does require at least a high-level understanding of what the paper is accomplishing; presumably, you wouldn't be trying to write a package for a paper if you had no idea what the paper is about. So make a list of the things that users will want. Now assign these items to function names without worrying about the details of how these functions work internally. For example, you might have one function that does a core statistical analysis, one that calculates confidence intervals, one that calculates variances, and maybe one that does a basic visualization. Next, what are the most fundamental inputs you need for these functions? There might be a lot of little things that are useful for convenience, tuning, or flexibility in the function, but these aren't important yet. What's important is just getting the basic functionality running; you can go back and deal with the finer details later so that they don't overwhelm you now. Now, what are these functions returning for values? In other words, what would a user expect or find most useful in terms of results? Part of this may end up shaping or being shaped by the previous point about inputs. If you have one function that builds on the result of another, then the input of one is going to be the output of another. So depending on the situation, you might have one function that returns simple things like a numeric or a vector, and you might have another function that returns complex things like a list or class object. Once you have a list of the functions you want, what they need for inputs, and what they produce, you now have what you need for a basic skeleton package. So start coding by creating a bunch of empty functions. Or maybe just have them print something. If you've never written a package before, this a good time to try building and installing it (locally on your computer) to make sure it works. As you work, periodically build, install, load, and test your package to make sure everything is doing what you think it is. Finally, with a skeleton package setup, you can now start digging into the mathematical/theoretical details. Your functions act as guide to help you break down this task so that you don't try to overwhelm yourself by focusing on everything at once. Just focus on one thing and work on getting the basics of the function running. You absolutely should not be worrying about performance at this point. Same goes for other things like weird corner cases with input data. You should be focused on getting things implemented in the simplest manner possible. Once everything is running and you have a better feel for everything, then you can revisit. Eventually, you will pick up a deeper understanding of what it is you're trying to accomplish with your package. You might find yourself realizing that there are functions you need that you didn't think of before, or maybe a couple of your functions need to be combined. You may even look back and realize there is a completely different way of doing things that is better. For my package, v0.1.0 (essentially a beta) and v1.0.0 (first production release) are night and day different. I completely rewrote the package from scratch for v1.0.0. v0.1.0 was great for learning, not only the math and the theory, but how my framework decisions felt both as a user and as a package maintainer. Turns out, it was clunky and unpleasant for both, and a complete overhaul was worth investing in. So don't worry about getting it perfect right away; take your time in the pre-release stage to try things, and preferably give some potential users a chance to try it and give feedback as well. I can't tell you how often other people's real-world data will expose weird corner-cases you never considered... Some additional tips: Technical debt: sometimes there are situations where there are multiple ways to do a task. Before publishing your package, you need to think ahead what these choices mean, because if you just take the easy way, you may find it costs you a ton of time later to work around. It's best to take care of this before publishing because you want to avoid breaking things for users once they start using the package. There are tons of articles on "technical debt". Spend some time reading a few of them. Maintenance burden: If you intend to create an R package, please be committed to maintaining it. A huge problem I've seen with scientific software is that many people publish software/packages as a one-off task for a publication and then let it rot, which ultimately costs others a lot of time and energy when things go wrong with the software for them. Hopefully you aren't one of them. To that end, you have to be aware of how your choices in designing the package are going to affect your time commitments later. Every little thing you add is one more thing that can break, needs to be tested, requires support for users, etc., leading to more time spent maintaining your package instead of other things you want to do. So be judicious with what you add and what you cut from the feature list; if you try to add every little convenience thing that people want, you will regret it later. The same goes for thinking about what external packages you need for your package; every dependency you add is another chance for a change someone makes in their package to break your package. For publishing an R package, please put it on CRAN. I can't tell you how many times I've looked at the GitHub repo for non-CRAN packages (with peer-reviewed publications) only to find fundamental flaws that CRAN's "annoying" policies would have prevented. Seriously, one package I looked at changed multiple default R behaviors that many other common packages implicitly depend on. Simply by loading the package, it could completely alter the behavior of other packages in a way that was completely silent with non-obvious changes in results, and could only be fixed easily by restarting R (and never loading the package again). The commands this package was using to do this are explicitly prohibited in CRAN packages. If the author had tried to publish to CRAN, they would have caught it (or maybe they did try and decided it wasn't worth the hassle to fix just to get on CRAN...) Use automated testing (for R, see the 'testthat' package). This really should be a requirement for any package. Unfortunately, just because a package has unit testing doesn't mean it's being done well. It can be a bit of an art form figuring out how to do it well. Good documentation is necessary. And I don't just mean the typical R function references. I expect most people benefit from having a variety of tutorials/vignettes explaining concepts and giving examples. Trying to write these will actually contribute to your own understanding of the math and theory, or at the very least give you confidence in what you have learned. For R, I recommend looking at the 'pkgdown' package for this; it helps you build a website for your package that's hosted as part of your package's GitHub repo. Some parting words: If you're going to write software for scientists, please keep in mind how important of a responsibility it is. If you really dedicate yourself and do it right, you could make a huge difference in the ability of many people to do their research more efficiently and effectively. But if you half-ass it or are lazy about maintaining it, you could screw a lot of people and cost them a lot of time, energy, and potentially money. Either way, you have the potential to make an out-sized impact on science that you might not normally have by just staying in your own little research bubble.
How do you go from paper to code?
More precisely, I still do not understand how someone goes from a research paper to e.g., an R package. Like a lot of things in life, sometimes the hardest part is just getting started. A lot of peop
How do you go from paper to code? More precisely, I still do not understand how someone goes from a research paper to e.g., an R package. Like a lot of things in life, sometimes the hardest part is just getting started. A lot of people set themselves up for failure by just, well, thinking they aren't prepared enough and are going to fail, so they effectively give up before they even try. With that said, you do have to know at least a little to get started. In the context of writing R packages based on a paper, you don't necessarily need to be comfortable with the math or theory behind the topic to get started. You might find the process of writing the package actually helps with developing that deeper understanding you eventually do want to have, and that over time you'll make changes to the package that reflect that. I actually have a very robust, user-friendly R package where I started in this situation. I have a lot of programming experience, and someone I know had this non-trivial theory he'd been developing but didn't have the ability to properly implement in a package, so he asked me to help. The details of the math and theory were mostly unfamiliar to me since my expertise is somewhere else. I didn't even know the details of creating an R package at that point. But now, after having gone through the process of creating the package, I'm at a point where I'm even able to make my own contributions and advancements to the theory and its applications. To start, what you need to do is think about what users might want in a package. What does the paper present that potential users will find useful? This does require at least a high-level understanding of what the paper is accomplishing; presumably, you wouldn't be trying to write a package for a paper if you had no idea what the paper is about. So make a list of the things that users will want. Now assign these items to function names without worrying about the details of how these functions work internally. For example, you might have one function that does a core statistical analysis, one that calculates confidence intervals, one that calculates variances, and maybe one that does a basic visualization. Next, what are the most fundamental inputs you need for these functions? There might be a lot of little things that are useful for convenience, tuning, or flexibility in the function, but these aren't important yet. What's important is just getting the basic functionality running; you can go back and deal with the finer details later so that they don't overwhelm you now. Now, what are these functions returning for values? In other words, what would a user expect or find most useful in terms of results? Part of this may end up shaping or being shaped by the previous point about inputs. If you have one function that builds on the result of another, then the input of one is going to be the output of another. So depending on the situation, you might have one function that returns simple things like a numeric or a vector, and you might have another function that returns complex things like a list or class object. Once you have a list of the functions you want, what they need for inputs, and what they produce, you now have what you need for a basic skeleton package. So start coding by creating a bunch of empty functions. Or maybe just have them print something. If you've never written a package before, this a good time to try building and installing it (locally on your computer) to make sure it works. As you work, periodically build, install, load, and test your package to make sure everything is doing what you think it is. Finally, with a skeleton package setup, you can now start digging into the mathematical/theoretical details. Your functions act as guide to help you break down this task so that you don't try to overwhelm yourself by focusing on everything at once. Just focus on one thing and work on getting the basics of the function running. You absolutely should not be worrying about performance at this point. Same goes for other things like weird corner cases with input data. You should be focused on getting things implemented in the simplest manner possible. Once everything is running and you have a better feel for everything, then you can revisit. Eventually, you will pick up a deeper understanding of what it is you're trying to accomplish with your package. You might find yourself realizing that there are functions you need that you didn't think of before, or maybe a couple of your functions need to be combined. You may even look back and realize there is a completely different way of doing things that is better. For my package, v0.1.0 (essentially a beta) and v1.0.0 (first production release) are night and day different. I completely rewrote the package from scratch for v1.0.0. v0.1.0 was great for learning, not only the math and the theory, but how my framework decisions felt both as a user and as a package maintainer. Turns out, it was clunky and unpleasant for both, and a complete overhaul was worth investing in. So don't worry about getting it perfect right away; take your time in the pre-release stage to try things, and preferably give some potential users a chance to try it and give feedback as well. I can't tell you how often other people's real-world data will expose weird corner-cases you never considered... Some additional tips: Technical debt: sometimes there are situations where there are multiple ways to do a task. Before publishing your package, you need to think ahead what these choices mean, because if you just take the easy way, you may find it costs you a ton of time later to work around. It's best to take care of this before publishing because you want to avoid breaking things for users once they start using the package. There are tons of articles on "technical debt". Spend some time reading a few of them. Maintenance burden: If you intend to create an R package, please be committed to maintaining it. A huge problem I've seen with scientific software is that many people publish software/packages as a one-off task for a publication and then let it rot, which ultimately costs others a lot of time and energy when things go wrong with the software for them. Hopefully you aren't one of them. To that end, you have to be aware of how your choices in designing the package are going to affect your time commitments later. Every little thing you add is one more thing that can break, needs to be tested, requires support for users, etc., leading to more time spent maintaining your package instead of other things you want to do. So be judicious with what you add and what you cut from the feature list; if you try to add every little convenience thing that people want, you will regret it later. The same goes for thinking about what external packages you need for your package; every dependency you add is another chance for a change someone makes in their package to break your package. For publishing an R package, please put it on CRAN. I can't tell you how many times I've looked at the GitHub repo for non-CRAN packages (with peer-reviewed publications) only to find fundamental flaws that CRAN's "annoying" policies would have prevented. Seriously, one package I looked at changed multiple default R behaviors that many other common packages implicitly depend on. Simply by loading the package, it could completely alter the behavior of other packages in a way that was completely silent with non-obvious changes in results, and could only be fixed easily by restarting R (and never loading the package again). The commands this package was using to do this are explicitly prohibited in CRAN packages. If the author had tried to publish to CRAN, they would have caught it (or maybe they did try and decided it wasn't worth the hassle to fix just to get on CRAN...) Use automated testing (for R, see the 'testthat' package). This really should be a requirement for any package. Unfortunately, just because a package has unit testing doesn't mean it's being done well. It can be a bit of an art form figuring out how to do it well. Good documentation is necessary. And I don't just mean the typical R function references. I expect most people benefit from having a variety of tutorials/vignettes explaining concepts and giving examples. Trying to write these will actually contribute to your own understanding of the math and theory, or at the very least give you confidence in what you have learned. For R, I recommend looking at the 'pkgdown' package for this; it helps you build a website for your package that's hosted as part of your package's GitHub repo. Some parting words: If you're going to write software for scientists, please keep in mind how important of a responsibility it is. If you really dedicate yourself and do it right, you could make a huge difference in the ability of many people to do their research more efficiently and effectively. But if you half-ass it or are lazy about maintaining it, you could screw a lot of people and cost them a lot of time, energy, and potentially money. Either way, you have the potential to make an out-sized impact on science that you might not normally have by just staying in your own little research bubble.
How do you go from paper to code? More precisely, I still do not understand how someone goes from a research paper to e.g., an R package. Like a lot of things in life, sometimes the hardest part is just getting started. A lot of peop
30,106
How do you go from paper to code?
For me, I go through the maths until I understand it (and can identify methods to make the linear algebra efficient and stable). Quite often this involves writing out the maths again in the smallest possible steps (as a LaTeX document). This is often useful as a maintenance document - if you come back to the software in a year's time, you probably won't remember exactly how it works, and a step by step mathematical derivation (with annotations that explain your problems with it) is a fast way to remember it again. Usually with programming the main difficulty is not coding (e.g. working out how to tell the computer to do something) but problem solving/understanding (working out exactly what it is you want the computer to do). The next step is to identify components of the algorithm/method that you can test individually. Don't try to implement the whole thing in one go. I quite like Heinlein's quote "when faced with a problem you do not understand, do any part of it you do understand, then look at it again". It is also a good idea to read other people's code and work out why they have implemented it in the way that they have, and to look at how the code has been structured in the case of packages that are used by other people. Documentation is also very important, if you want people to use your code, you need to make it as easy as possible, so minimise dependencies (e.g. on third party packages) make the user interface or API simple and consistent with expectations, and provide good documentation. This takes a lot of time/effort that most of us (including me) don't seem to be able to spare ;o)
How do you go from paper to code?
For me, I go through the maths until I understand it (and can identify methods to make the linear algebra efficient and stable). Quite often this involves writing out the maths again in the smallest
How do you go from paper to code? For me, I go through the maths until I understand it (and can identify methods to make the linear algebra efficient and stable). Quite often this involves writing out the maths again in the smallest possible steps (as a LaTeX document). This is often useful as a maintenance document - if you come back to the software in a year's time, you probably won't remember exactly how it works, and a step by step mathematical derivation (with annotations that explain your problems with it) is a fast way to remember it again. Usually with programming the main difficulty is not coding (e.g. working out how to tell the computer to do something) but problem solving/understanding (working out exactly what it is you want the computer to do). The next step is to identify components of the algorithm/method that you can test individually. Don't try to implement the whole thing in one go. I quite like Heinlein's quote "when faced with a problem you do not understand, do any part of it you do understand, then look at it again". It is also a good idea to read other people's code and work out why they have implemented it in the way that they have, and to look at how the code has been structured in the case of packages that are used by other people. Documentation is also very important, if you want people to use your code, you need to make it as easy as possible, so minimise dependencies (e.g. on third party packages) make the user interface or API simple and consistent with expectations, and provide good documentation. This takes a lot of time/effort that most of us (including me) don't seem to be able to spare ;o)
How do you go from paper to code? For me, I go through the maths until I understand it (and can identify methods to make the linear algebra efficient and stable). Quite often this involves writing out the maths again in the smallest
30,107
How do you go from paper to code?
To supplement Dikran Marsupial's answer, the following is an articulation of a process I use personally. This is from the perspective of coding machine learning algorithms for research, rather than from a full-blown production level software engineering perspective. Primarily, I've often found it useful to see the process of coding a machine learning algorithm from scratch as instantiating a mathematical idea: Mathematical, pre-algorithmic stage. Usually in machine learning, you use some kind of mathematical or formal principle to guide the development of your algorithm. It may be statistical e.g. maximum likelihood estimation, and most likely, involve a degree of optimisation. Usually, you will need to do a fair amount of mathematical derivation work, until you have what you need. Personally, I've found that one needs both a solid under-the-hood grasp of the mathematical principles operating here, as well as absolute security in the correctness of one's derivations. Any haziness or uncertainty at this stage will compound during implementation, when one additionally has to worry about debugging. Before proceeding to the next stage, I will often use a symbolic computing package or computer algebra system, such as Mathematica, to check all my derivations, because even a single error at this stage can lead to the extremely undesirable situation of having to search for derivation and/or debugging errors. Algorithmic. After I've checked that my mathematical derivations are watertight, with no errors, and I'm at a level where I can specify and sketch out my algorithm on paper, I proceed to drafting formal pseudocode. Similar to the above poster, I find that forcing oneself to type this up using algorithm2e in LaTeX helps in that it commits you in a way working solely with pen and paper doesn't. During this pseudo-code drafting stage, I start thinking about more implementational concerns, such as adapting my derivations to be as vectorised as possible, i.e. using as few loops as possible, or making use of linear algebra techniques as far as possible. However, the implementational concerns extend only as far as complying with basic advice and standard principles of algorithm design, but not as far as optimising the code. Implementation. Implement the pseudocode in code. The clearer your pseudocode, and the more consistent your notation, the easier this will be. Something you will probably pick for up for yourself is that it pays enormous dividends, as the above poster has stated, to ensure you are writing modular code. Split the code writing into little chunks, which you can individually test. In most cases, there will almost always be very basic sanity checks you can do. For example, if your code uses gradients, then you can use finite differencing to assess this has correctly been computed. If you are implementing an EM algorithm, your log-likelihood will monotonically increase, so any decreases are most likely coding errors, provided your derivations are correct. Optimisation. I don't want to say much about this, except that it can get deep very quickly. At this stage, you time your code, or use a whole host of numerical linear algebra, matrix computation and convex optimisation tricks to squeeze as many performance speed-ups as possible. Concerning the use of tools for debugging, I don't know much about the debugging tools in R as it's something I'm only getting to grips with. However, it looks like the RStudio debugger is similar to that of pdb in Python. In the case of Python, the PyCharm IDE is one example where I've found that tools can vastly improve the debugging process. You can walk through each line of your code as it runs, and step in, step out, do side by side evaluations, as well as keep track of all variable states at once. I personally find that the visual means of accessing all variable states at once is far superior to using doing manual command line queries using pdb. Whilst I wish I knew this earlier, I emphasise this is for consideration only, and I have no affiliation with JetBrains whatsoever. Some final things. Like most things in life, you get better through practice. There are lots of papers accompanied with code at paperswithcode.com; and there is also an ML paper reproducibility challenge also. Lastly, if you ever find that debugging is starting to grind on your soul somewhat, I've found it helps to think of the days when people used to use punch cards to implement algorithms...
How do you go from paper to code?
To supplement Dikran Marsupial's answer, the following is an articulation of a process I use personally. This is from the perspective of coding machine learning algorithms for research, rather than fr
How do you go from paper to code? To supplement Dikran Marsupial's answer, the following is an articulation of a process I use personally. This is from the perspective of coding machine learning algorithms for research, rather than from a full-blown production level software engineering perspective. Primarily, I've often found it useful to see the process of coding a machine learning algorithm from scratch as instantiating a mathematical idea: Mathematical, pre-algorithmic stage. Usually in machine learning, you use some kind of mathematical or formal principle to guide the development of your algorithm. It may be statistical e.g. maximum likelihood estimation, and most likely, involve a degree of optimisation. Usually, you will need to do a fair amount of mathematical derivation work, until you have what you need. Personally, I've found that one needs both a solid under-the-hood grasp of the mathematical principles operating here, as well as absolute security in the correctness of one's derivations. Any haziness or uncertainty at this stage will compound during implementation, when one additionally has to worry about debugging. Before proceeding to the next stage, I will often use a symbolic computing package or computer algebra system, such as Mathematica, to check all my derivations, because even a single error at this stage can lead to the extremely undesirable situation of having to search for derivation and/or debugging errors. Algorithmic. After I've checked that my mathematical derivations are watertight, with no errors, and I'm at a level where I can specify and sketch out my algorithm on paper, I proceed to drafting formal pseudocode. Similar to the above poster, I find that forcing oneself to type this up using algorithm2e in LaTeX helps in that it commits you in a way working solely with pen and paper doesn't. During this pseudo-code drafting stage, I start thinking about more implementational concerns, such as adapting my derivations to be as vectorised as possible, i.e. using as few loops as possible, or making use of linear algebra techniques as far as possible. However, the implementational concerns extend only as far as complying with basic advice and standard principles of algorithm design, but not as far as optimising the code. Implementation. Implement the pseudocode in code. The clearer your pseudocode, and the more consistent your notation, the easier this will be. Something you will probably pick for up for yourself is that it pays enormous dividends, as the above poster has stated, to ensure you are writing modular code. Split the code writing into little chunks, which you can individually test. In most cases, there will almost always be very basic sanity checks you can do. For example, if your code uses gradients, then you can use finite differencing to assess this has correctly been computed. If you are implementing an EM algorithm, your log-likelihood will monotonically increase, so any decreases are most likely coding errors, provided your derivations are correct. Optimisation. I don't want to say much about this, except that it can get deep very quickly. At this stage, you time your code, or use a whole host of numerical linear algebra, matrix computation and convex optimisation tricks to squeeze as many performance speed-ups as possible. Concerning the use of tools for debugging, I don't know much about the debugging tools in R as it's something I'm only getting to grips with. However, it looks like the RStudio debugger is similar to that of pdb in Python. In the case of Python, the PyCharm IDE is one example where I've found that tools can vastly improve the debugging process. You can walk through each line of your code as it runs, and step in, step out, do side by side evaluations, as well as keep track of all variable states at once. I personally find that the visual means of accessing all variable states at once is far superior to using doing manual command line queries using pdb. Whilst I wish I knew this earlier, I emphasise this is for consideration only, and I have no affiliation with JetBrains whatsoever. Some final things. Like most things in life, you get better through practice. There are lots of papers accompanied with code at paperswithcode.com; and there is also an ML paper reproducibility challenge also. Lastly, if you ever find that debugging is starting to grind on your soul somewhat, I've found it helps to think of the days when people used to use punch cards to implement algorithms...
How do you go from paper to code? To supplement Dikran Marsupial's answer, the following is an articulation of a process I use personally. This is from the perspective of coding machine learning algorithms for research, rather than fr
30,108
Can two different distributions have the same value of mean, variance, skewness, and kurtosis?
Xi'an's answer proved (or at least hinted a proof) that there are different distributions with the same mean, variance, skewness and kurtosis. I just want to show an example of three visually distinct discrete distributions with the same moments (mean=skewness=0, variance=1 and kurtosis=2): The code to generate them is: library(moments) n <- 1e6 x <- c(-sqrt(2), 0, +sqrt(2)) p <- c(1,2,1) mostra1 <- sample(x, size=n, prob=p, replace=TRUE) x <- c(-1.4629338416371, -0.350630832572269, 0.350630832573386, 1.46293384163564) p <- c(1, 1.3, 1.3, 1) mostra2 <- sample(x, size=n, prob=p, replace=TRUE) x <- c(-1.5049621442915, -0.457635862316285, 0.457635862316022, 1.50496214429192) p <- c(1, 1.6, 1.6, 1) mostra3 <- sample(x, size=n, prob=p, replace=TRUE) mostra <- rbind(data.frame(x=mostra1, grup="a"), data.frame(x=mostra2, grup="b"), data.frame(x=mostra3, grup="c")) aggregate(x~grup, data=mostra, mean) aggregate(x~grup, data=mostra, var) aggregate(x~grup, data=mostra, skewness) aggregate(x~grup, data=mostra, kurtosis) library(ggplot2) ggplot(mostra)+ geom_histogram(aes(x, fill=grup), bins=100)
Can two different distributions have the same value of mean, variance, skewness, and kurtosis?
Xi'an's answer proved (or at least hinted a proof) that there are different distributions with the same mean, variance, skewness and kurtosis. I just want to show an example of three visually distinct
Can two different distributions have the same value of mean, variance, skewness, and kurtosis? Xi'an's answer proved (or at least hinted a proof) that there are different distributions with the same mean, variance, skewness and kurtosis. I just want to show an example of three visually distinct discrete distributions with the same moments (mean=skewness=0, variance=1 and kurtosis=2): The code to generate them is: library(moments) n <- 1e6 x <- c(-sqrt(2), 0, +sqrt(2)) p <- c(1,2,1) mostra1 <- sample(x, size=n, prob=p, replace=TRUE) x <- c(-1.4629338416371, -0.350630832572269, 0.350630832573386, 1.46293384163564) p <- c(1, 1.3, 1.3, 1) mostra2 <- sample(x, size=n, prob=p, replace=TRUE) x <- c(-1.5049621442915, -0.457635862316285, 0.457635862316022, 1.50496214429192) p <- c(1, 1.6, 1.6, 1) mostra3 <- sample(x, size=n, prob=p, replace=TRUE) mostra <- rbind(data.frame(x=mostra1, grup="a"), data.frame(x=mostra2, grup="b"), data.frame(x=mostra3, grup="c")) aggregate(x~grup, data=mostra, mean) aggregate(x~grup, data=mostra, var) aggregate(x~grup, data=mostra, skewness) aggregate(x~grup, data=mostra, kurtosis) library(ggplot2) ggplot(mostra)+ geom_histogram(aes(x, fill=grup), bins=100)
Can two different distributions have the same value of mean, variance, skewness, and kurtosis? Xi'an's answer proved (or at least hinted a proof) that there are different distributions with the same mean, variance, skewness and kurtosis. I just want to show an example of three visually distinct
30,109
Can two different distributions have the same value of mean, variance, skewness, and kurtosis?
Take a mixture of two Normal distributions with density $$f(x|\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)= \frac{\omega}{\sqrt{2\pi}\sigma_1}\exp\{-(x-\mu_1)^2/2\sigma_1^2\}+ \frac{1-\omega}{\sqrt{2\pi}\sigma_2}\exp\{-(x-\mu_2)^2/2\sigma_2^2\}$$ This distribution has five parameters constrained by four equations \begin{align*} \mathbb{E}[X]&=\omega\mu_1+(1-\omega)\mu_2\\ \text{var}(X)&=\omega\sigma_1^2+(1-\omega)\sigma_2^2+\omega(\mu_1-\mathbb{E}[X])^2+(1-\omega)(\mu_2-\mathbb{E}[X])^2\\ \mathbb{E}[X^3]&=\ldots\\ \mathbb{E}[X^4]&=\ldots \end{align*} Assuming these equations are compatible, there is therefore an infinite number of solutions $(\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)$.
Can two different distributions have the same value of mean, variance, skewness, and kurtosis?
Take a mixture of two Normal distributions with density $$f(x|\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)= \frac{\omega}{\sqrt{2\pi}\sigma_1}\exp\{-(x-\mu_1)^2/2\sigma_1^2\}+ \frac{1-\omega}{\sqrt{2\pi}\sig
Can two different distributions have the same value of mean, variance, skewness, and kurtosis? Take a mixture of two Normal distributions with density $$f(x|\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)= \frac{\omega}{\sqrt{2\pi}\sigma_1}\exp\{-(x-\mu_1)^2/2\sigma_1^2\}+ \frac{1-\omega}{\sqrt{2\pi}\sigma_2}\exp\{-(x-\mu_2)^2/2\sigma_2^2\}$$ This distribution has five parameters constrained by four equations \begin{align*} \mathbb{E}[X]&=\omega\mu_1+(1-\omega)\mu_2\\ \text{var}(X)&=\omega\sigma_1^2+(1-\omega)\sigma_2^2+\omega(\mu_1-\mathbb{E}[X])^2+(1-\omega)(\mu_2-\mathbb{E}[X])^2\\ \mathbb{E}[X^3]&=\ldots\\ \mathbb{E}[X^4]&=\ldots \end{align*} Assuming these equations are compatible, there is therefore an infinite number of solutions $(\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)$.
Can two different distributions have the same value of mean, variance, skewness, and kurtosis? Take a mixture of two Normal distributions with density $$f(x|\mu_1,\mu_2,\sigma_1,\sigma_2,\omega)= \frac{\omega}{\sqrt{2\pi}\sigma_1}\exp\{-(x-\mu_1)^2/2\sigma_1^2\}+ \frac{1-\omega}{\sqrt{2\pi}\sig
30,110
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed]
Linear Modeling (the basics) Introduction to Time Series (important for finance and tech, where there are lots and lots of measurement occasions) Modern Statistical Prediction and Machine Learning (for the fancy new prediction stuff, also important for finance and tech)
Which of the following statistics courses are the most applicable and useful in finance/tech industr
Linear Modeling (the basics) Introduction to Time Series (important for finance and tech, where there are lots and lots of measurement occasions) Modern Statistical Prediction and Machine Learning (fo
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed] Linear Modeling (the basics) Introduction to Time Series (important for finance and tech, where there are lots and lots of measurement occasions) Modern Statistical Prediction and Machine Learning (for the fancy new prediction stuff, also important for finance and tech)
Which of the following statistics courses are the most applicable and useful in finance/tech industr Linear Modeling (the basics) Introduction to Time Series (important for finance and tech, where there are lots and lots of measurement occasions) Modern Statistical Prediction and Machine Learning (fo
30,111
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed]
I would recommend Linear Modeling and Introduction to Time Series. If you only have three electives and you decide to concentrate in actuarial science, I would take a course in survival analysis if one is available.
Which of the following statistics courses are the most applicable and useful in finance/tech industr
I would recommend Linear Modeling and Introduction to Time Series. If you only have three electives and you decide to concentrate in actuarial science, I would take a course in survival analysis if o
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed] I would recommend Linear Modeling and Introduction to Time Series. If you only have three electives and you decide to concentrate in actuarial science, I would take a course in survival analysis if one is available.
Which of the following statistics courses are the most applicable and useful in finance/tech industr I would recommend Linear Modeling and Introduction to Time Series. If you only have three electives and you decide to concentrate in actuarial science, I would take a course in survival analysis if o
30,112
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed]
Working as a Data Scientist at one of the biggest consultancies of the world I can just give my two cents which one is useful for a job like mine. All courses are cool and have applications both in research, development as well as consulting. However some courses might be more important for practical application. Disclaimer: This does not reflect the opinion of my employer and I have also only seen several departments in Germany. THE MOST USEFUL COURSES: Introduction to Time Series If you are working as a Data Scientist you will definitely make forecast occasionally. It is important that you understand patterns such as trends, unit roots, seasonalities, etc. In practice you will be facing data with different frequencies such as monthly or quartely data. Read Forecasting principle and practice in order to get an understanding of the applications of forecasting. Modern Statistical Prediction and Machine Learning This course will raise your chances of getting a highly paid job. Machine Learning is correlated with higher salaries than classical statistics. It is definitely worth knowing things such as training and test data. You will always built a model and test it. It is also due to the importance of Machine Learning that this page is called CrossValidated. hahahaha ALSO USEFUL: Linear Modeling: Theory and Applications Introduction to Econometric Analysis (Cross-enrollment between Stats & Econ) These courses seem pretty similar to me. I presume both are mainly dealing with Longitudinal Data and Pannel Data. However Most regression problems you will face as a Data Scientist deal with Time Series. I just had one project with Heckman selection modell/ Tobit regression and some small stuff where I faced Count Data and Survival Analysis. Overall classification tasks are more widespread at my company than regression tasks. You are most likely to work in a team with Mathematicians, Statisticians and Computer Scientists. They will not stick to econometric modells. Nonetheless a solid understanding of linear models and econometric analysis will help you to deal with time series and forecasting issues. It also depends on the programming language you prefer. R (and even more particularly Stata) are very handy for regression models. Python is rather useful for other tasks. As Michael Chernick already stated Microeconometric issues are widely used at insurances. If you work for in a life insurance department survival analysis will be crucial. However most data scientist do not face such tasks. You can go through this applied econometric foundation course by UCLA and reflect in how far you will face such questions in your future job. RATHER IRRELEVANT: Stochastic Processes (Random walks, discrete time Markov chains, Poisson processes) This will be hardly useful as a Data Scientist. Maybe you can face such models if you are working in a Quantitative Finance department of a bank. Game Theory Game theory is a theoretical concept which is barely directly applied in practice. In economic and psychological research it might be helpful, however it is not in the classical scope of a data scientist. Please don't hesitate to ask if I should be more specific about some courses.
Which of the following statistics courses are the most applicable and useful in finance/tech industr
Working as a Data Scientist at one of the biggest consultancies of the world I can just give my two cents which one is useful for a job like mine. All courses are cool and have applications both in re
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed] Working as a Data Scientist at one of the biggest consultancies of the world I can just give my two cents which one is useful for a job like mine. All courses are cool and have applications both in research, development as well as consulting. However some courses might be more important for practical application. Disclaimer: This does not reflect the opinion of my employer and I have also only seen several departments in Germany. THE MOST USEFUL COURSES: Introduction to Time Series If you are working as a Data Scientist you will definitely make forecast occasionally. It is important that you understand patterns such as trends, unit roots, seasonalities, etc. In practice you will be facing data with different frequencies such as monthly or quartely data. Read Forecasting principle and practice in order to get an understanding of the applications of forecasting. Modern Statistical Prediction and Machine Learning This course will raise your chances of getting a highly paid job. Machine Learning is correlated with higher salaries than classical statistics. It is definitely worth knowing things such as training and test data. You will always built a model and test it. It is also due to the importance of Machine Learning that this page is called CrossValidated. hahahaha ALSO USEFUL: Linear Modeling: Theory and Applications Introduction to Econometric Analysis (Cross-enrollment between Stats & Econ) These courses seem pretty similar to me. I presume both are mainly dealing with Longitudinal Data and Pannel Data. However Most regression problems you will face as a Data Scientist deal with Time Series. I just had one project with Heckman selection modell/ Tobit regression and some small stuff where I faced Count Data and Survival Analysis. Overall classification tasks are more widespread at my company than regression tasks. You are most likely to work in a team with Mathematicians, Statisticians and Computer Scientists. They will not stick to econometric modells. Nonetheless a solid understanding of linear models and econometric analysis will help you to deal with time series and forecasting issues. It also depends on the programming language you prefer. R (and even more particularly Stata) are very handy for regression models. Python is rather useful for other tasks. As Michael Chernick already stated Microeconometric issues are widely used at insurances. If you work for in a life insurance department survival analysis will be crucial. However most data scientist do not face such tasks. You can go through this applied econometric foundation course by UCLA and reflect in how far you will face such questions in your future job. RATHER IRRELEVANT: Stochastic Processes (Random walks, discrete time Markov chains, Poisson processes) This will be hardly useful as a Data Scientist. Maybe you can face such models if you are working in a Quantitative Finance department of a bank. Game Theory Game theory is a theoretical concept which is barely directly applied in practice. In economic and psychological research it might be helpful, however it is not in the classical scope of a data scientist. Please don't hesitate to ask if I should be more specific about some courses.
Which of the following statistics courses are the most applicable and useful in finance/tech industr Working as a Data Scientist at one of the biggest consultancies of the world I can just give my two cents which one is useful for a job like mine. All courses are cool and have applications both in re
30,113
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed]
As someone who works for a bank in a quantitative role, I disagree with the other answers. Stochastic processes are very important. A good knowledge of stochastic processes allows you to understand the intuition behind many of the other classes you mention, especially time series models. It is also a differentiater (in my experience a good knowledge of stochastic processes is rare). I would take Stochastic Processes Modern Statistical Prediction and Machine Learning Linear Modeling: Theory and Applications
Which of the following statistics courses are the most applicable and useful in finance/tech industr
As someone who works for a bank in a quantitative role, I disagree with the other answers. Stochastic processes are very important. A good knowledge of stochastic processes allows you to understand t
Which of the following statistics courses are the most applicable and useful in finance/tech industry? [closed] As someone who works for a bank in a quantitative role, I disagree with the other answers. Stochastic processes are very important. A good knowledge of stochastic processes allows you to understand the intuition behind many of the other classes you mention, especially time series models. It is also a differentiater (in my experience a good knowledge of stochastic processes is rare). I would take Stochastic Processes Modern Statistical Prediction and Machine Learning Linear Modeling: Theory and Applications
Which of the following statistics courses are the most applicable and useful in finance/tech industr As someone who works for a bank in a quantitative role, I disagree with the other answers. Stochastic processes are very important. A good knowledge of stochastic processes allows you to understand t
30,114
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori?
I am not entirely sure my answer is correct, but I would argue there is no general relationship. Here is my point: Let us study the case where the confidence interval of the variance is well-understood, viz. sampling from a normal distribution (as you indicate in the tag of the question, but not really the question itself). See the discussion here and here. A confidence interval for $\sigma^2$ follows from the pivot $T=n\hat{\sigma}^2/\sigma^2\sim\chi^2_{n-1}$, where $\hat{\sigma}^2=1/n\sum_i(X_i-\bar{X})^2$. (This is just another way of writing the possibly more familiar expression $T=(n-1)s^2/\sigma^2\sim\chi^2_{n-1}$, where $s^2=1/(n-1)\sum_i(X_i-\bar{X})^2$.) We thus have \begin{align*} 1-\alpha&=\Pr\{c_l^{n-1}<T<c_u^{n-1}\}\\ &=\Pr\left\{\frac{c_l^{n-1}}{n\hat{\sigma}^2}<\frac{1}{\sigma^2}<\frac{c_u^{n-1}}{n\hat{\sigma}^2}\right\}\\ &=\Pr\left\{\frac{n\hat{\sigma}^2}{c_u^{n-1}}<\sigma^2<\frac{n\hat{\sigma}^2}{c_l^{n-1}}\right\} \end{align*} Hence, a confidence interval is $(n\hat{\sigma}^2/c_u^{n-1},n\hat{\sigma}^2/c_l^{n-1})$. We may choose $c_l^{n-1}$ and $c_u^{n-1}$ as the quantiles $c_u^{n-1}=\chi^2_{n-1,1-\alpha/2}$ and $c_l^{n-1}=\chi^2_{n-1,\alpha/2}$. (Notice in passing that for whichever variance estimate that, as the $\chi^2$-distribution is skewed, the quantiles will yield a c.i. with the right coverage probability, but not be optimal, i.e. not be the shortest possible ones. For a confidence interval to be as short as possible, we require the density to be identical at the lower and upper end of the c.i., given some additional conditions like unimodality. I do not know if using that optimal c.i. would change things in this answer.) As explained in the links, $T'=ns_0^2/\sigma^2\sim\chi^2_n$, where $s_0^2=\frac{1}{n}\sum_i(X_i-\mu)^2$ uses the known mean. Hence, we get another valid confidence interval \begin{align*} 1-\alpha&=\Pr\{c_l^{n}<T'<c_u^{n}\}\\ &=\Pr\left\{\frac{ns_0^2}{c_u^{n}}<\sigma^2<\frac{ns_0^2}{c_l^{n}}\right\} \end{align*} Here, $c_l^{n}$ and $c_u^{n}$ will thus be quantiles from the $\chi^2_n$-distribution. The widths of the confidence intervals are $$ w_T=\frac{n\hat{\sigma}^2(c_u^{n-1}-c_l^{n-1})}{c_l^{n-1}c_u^{n-1}} $$ and $$ w_{T'}=\frac{ns_0^2(c_u^{n}-c_l^{n})}{c_l^{n}c_u^{n}} $$ The relative width is $$ \frac{w_T}{w_{T'}}=\frac{\hat{\sigma}^2}{s_0^2}\frac{c_u^{n-1}-c_l^{n-1}}{c_u^{n}-c_l^{n}}\frac{c_l^{n}c_u^{n}}{c_l^{n-1}c_u^{n-1}} $$ We know that $\hat{\sigma}^2/s_0^2\leq1$ as the sample mean minimizes the sum of squared deviations. Beyond that, I see few general results regarding the width of the interval, as I am not aware of clear-cut results how differences and products of upper and lower $\chi^2$ quantiles behave as we increase degrees of freedom by one (but see the figure below). For example, letting $$ r_n:=\frac{c_u^{n-1}-c_l^{n-1}}{c_u^{n}-c_l^{n}}\frac{c_l^{n}c_u^{n}}{c_l^{n-1}c_u^{n-1}},$$ we have $$r_{10}\approx1.226$$ for $\alpha=0.05$ and $n=10$, meaning that the c.i. based on $\hat{\sigma}^2$ will be shorter if $$ \hat{\sigma}^2\leq\frac{s_0^2}{1.226} $$ Using the code below, I ran a little simulation study suggesting that the interval based on $s_0^2$ will win most of the time. (See the link posted in Aksakal's answer for a large-sample rationalization of this result.) The probability seems to stabilize in $n$, but I am not aware of an analytical finite-sample explanation: rm(list=ls()) IntervalLengthsSigma2 <- function(n,alpha=0.05,reps=100000,mu=1) { cl_a <- qchisq(alpha/2,df = n-1) cu_a <- qchisq(1-alpha/2,df = n-1) cl_b <- qchisq(alpha/2,df = n) cu_b <- qchisq(1-alpha/2,df = n) winners02 <- rep(NA,reps) for (i in 1:reps) { x <- rnorm(n,mean=mu) xbar <- mean(x) s2 <- 1/n*sum((x-xbar)^2) s02 <- 1/n*sum((x-mu)^2) ci_a <- c(n*s2/cu_a,n*s2/cl_a) ci_b <- c(n*s02/cu_b,n*s02/cl_b) winners02[i] <- ifelse(ci_a[2]-ci_a[1]>ci_b[2]-ci_b[1],1,0) } mean(winners02) } nvalues <- matrix(seq(5,200,by=10)) plot(nvalues,apply(nvalues,1,IntervalLengthsSigma2),pch=19,col="lightblue",type="b") The next figure plots $r_n$ against $n$, revealing (as intuition would suggest) that the ratio tends to 1. As, moreover, $\bar{X}\to_p\mu$ for $n$ large, the difference between the widths of the two c.i.s will therefore vanish as $n\to\infty$. (See again the link posted in Aksakal's answer for a large-sample rationalization of this result.)
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri
I am not entirely sure my answer is correct, but I would argue there is no general relationship. Here is my point: Let us study the case where the confidence interval of the variance is well-understoo
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori? I am not entirely sure my answer is correct, but I would argue there is no general relationship. Here is my point: Let us study the case where the confidence interval of the variance is well-understood, viz. sampling from a normal distribution (as you indicate in the tag of the question, but not really the question itself). See the discussion here and here. A confidence interval for $\sigma^2$ follows from the pivot $T=n\hat{\sigma}^2/\sigma^2\sim\chi^2_{n-1}$, where $\hat{\sigma}^2=1/n\sum_i(X_i-\bar{X})^2$. (This is just another way of writing the possibly more familiar expression $T=(n-1)s^2/\sigma^2\sim\chi^2_{n-1}$, where $s^2=1/(n-1)\sum_i(X_i-\bar{X})^2$.) We thus have \begin{align*} 1-\alpha&=\Pr\{c_l^{n-1}<T<c_u^{n-1}\}\\ &=\Pr\left\{\frac{c_l^{n-1}}{n\hat{\sigma}^2}<\frac{1}{\sigma^2}<\frac{c_u^{n-1}}{n\hat{\sigma}^2}\right\}\\ &=\Pr\left\{\frac{n\hat{\sigma}^2}{c_u^{n-1}}<\sigma^2<\frac{n\hat{\sigma}^2}{c_l^{n-1}}\right\} \end{align*} Hence, a confidence interval is $(n\hat{\sigma}^2/c_u^{n-1},n\hat{\sigma}^2/c_l^{n-1})$. We may choose $c_l^{n-1}$ and $c_u^{n-1}$ as the quantiles $c_u^{n-1}=\chi^2_{n-1,1-\alpha/2}$ and $c_l^{n-1}=\chi^2_{n-1,\alpha/2}$. (Notice in passing that for whichever variance estimate that, as the $\chi^2$-distribution is skewed, the quantiles will yield a c.i. with the right coverage probability, but not be optimal, i.e. not be the shortest possible ones. For a confidence interval to be as short as possible, we require the density to be identical at the lower and upper end of the c.i., given some additional conditions like unimodality. I do not know if using that optimal c.i. would change things in this answer.) As explained in the links, $T'=ns_0^2/\sigma^2\sim\chi^2_n$, where $s_0^2=\frac{1}{n}\sum_i(X_i-\mu)^2$ uses the known mean. Hence, we get another valid confidence interval \begin{align*} 1-\alpha&=\Pr\{c_l^{n}<T'<c_u^{n}\}\\ &=\Pr\left\{\frac{ns_0^2}{c_u^{n}}<\sigma^2<\frac{ns_0^2}{c_l^{n}}\right\} \end{align*} Here, $c_l^{n}$ and $c_u^{n}$ will thus be quantiles from the $\chi^2_n$-distribution. The widths of the confidence intervals are $$ w_T=\frac{n\hat{\sigma}^2(c_u^{n-1}-c_l^{n-1})}{c_l^{n-1}c_u^{n-1}} $$ and $$ w_{T'}=\frac{ns_0^2(c_u^{n}-c_l^{n})}{c_l^{n}c_u^{n}} $$ The relative width is $$ \frac{w_T}{w_{T'}}=\frac{\hat{\sigma}^2}{s_0^2}\frac{c_u^{n-1}-c_l^{n-1}}{c_u^{n}-c_l^{n}}\frac{c_l^{n}c_u^{n}}{c_l^{n-1}c_u^{n-1}} $$ We know that $\hat{\sigma}^2/s_0^2\leq1$ as the sample mean minimizes the sum of squared deviations. Beyond that, I see few general results regarding the width of the interval, as I am not aware of clear-cut results how differences and products of upper and lower $\chi^2$ quantiles behave as we increase degrees of freedom by one (but see the figure below). For example, letting $$ r_n:=\frac{c_u^{n-1}-c_l^{n-1}}{c_u^{n}-c_l^{n}}\frac{c_l^{n}c_u^{n}}{c_l^{n-1}c_u^{n-1}},$$ we have $$r_{10}\approx1.226$$ for $\alpha=0.05$ and $n=10$, meaning that the c.i. based on $\hat{\sigma}^2$ will be shorter if $$ \hat{\sigma}^2\leq\frac{s_0^2}{1.226} $$ Using the code below, I ran a little simulation study suggesting that the interval based on $s_0^2$ will win most of the time. (See the link posted in Aksakal's answer for a large-sample rationalization of this result.) The probability seems to stabilize in $n$, but I am not aware of an analytical finite-sample explanation: rm(list=ls()) IntervalLengthsSigma2 <- function(n,alpha=0.05,reps=100000,mu=1) { cl_a <- qchisq(alpha/2,df = n-1) cu_a <- qchisq(1-alpha/2,df = n-1) cl_b <- qchisq(alpha/2,df = n) cu_b <- qchisq(1-alpha/2,df = n) winners02 <- rep(NA,reps) for (i in 1:reps) { x <- rnorm(n,mean=mu) xbar <- mean(x) s2 <- 1/n*sum((x-xbar)^2) s02 <- 1/n*sum((x-mu)^2) ci_a <- c(n*s2/cu_a,n*s2/cl_a) ci_b <- c(n*s02/cu_b,n*s02/cl_b) winners02[i] <- ifelse(ci_a[2]-ci_a[1]>ci_b[2]-ci_b[1],1,0) } mean(winners02) } nvalues <- matrix(seq(5,200,by=10)) plot(nvalues,apply(nvalues,1,IntervalLengthsSigma2),pch=19,col="lightblue",type="b") The next figure plots $r_n$ against $n$, revealing (as intuition would suggest) that the ratio tends to 1. As, moreover, $\bar{X}\to_p\mu$ for $n$ large, the difference between the widths of the two c.i.s will therefore vanish as $n\to\infty$. (See again the link posted in Aksakal's answer for a large-sample rationalization of this result.)
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri I am not entirely sure my answer is correct, but I would argue there is no general relationship. Here is my point: Let us study the case where the confidence interval of the variance is well-understoo
30,115
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori?
Let me first set up the problem. We know the population mean. This is a very important point to make in the very beginning, because without it, we'll not have a meaningful answer. I'll explain why. Let's say we have a sample and don't know the population mean. We have a usual estimator of the variance: $$\sigma=\frac{1}{n-1}sum_i(x_i-\bar x)^2$$ Now, we're told that the population mean is $\mu$. Our first instinct is to plug it into the variance estimator: $$\sigma'=\frac{1}{n}sum_i(x_i-\mu)^2$$ Notice, that it's a different estimator now! It has different denominator etc. It has a different variance itself. However, is it right to compare $Var[\sigma]$ and $Var[\sigma']$? No, it's NOT. We have to compare $Var[\sigma|E[x_i]=\mu]$ and $Var[\sigma'|E[x_i]=\mu]$. In other words we have to compare the variance of these two estimators conditional on the knowledge of the population mean! Otherwise, we'll fall into @Scortchi's paradox. When you got new information, i.e. $E[x_i]=\mu$, you have to include it in the estimate of $Var[\sigma]$! This solves @Scortchi's paradox in his comment directly. The equations that I saw so far in answers do not include the knowledge of $\mu$ into the C.I. or variance of the variance estimator $\sigma$. In @Scortchi's example knowing that $\bar x>>\mu$ would lead to a revision of C.I. of $\sigma$. Hence, my answer here follows the set up I jest described. Yes, the confidence interval would have been narrower. Philosophically, knowing mean of the population is an additional information, so the uncertainty must be smaller in this case. Example: if your distribution is Poisson, then variance is equal mean. Hence, knowing mean you know the variance too, and the confidence interval shrinks to a point. There's no interval. UPDATE: Look at this paper: "Estimating a Population Variance with Known Mean" by Zhang, 1996. He compares the standard estimate of variance $\frac{1}{n-1}\sum_i(x_i-\bar x)^2$ vs. the one using the knowledge of the population mean $\frac{1}{n}\sum_i(x_i-\mu)^2$. He comes to the same conclusion: the variance of the latter estimate is smaller than that of the former, i.e. the confidence interval of variance estimate would be narrower. He also shows that the advantage disappears when the sample size tends to infinity. I think this paper is the definitive answer to your question.
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri
Let me first set up the problem. We know the population mean. This is a very important point to make in the very beginning, because without it, we'll not have a meaningful answer. I'll explain why. Le
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori? Let me first set up the problem. We know the population mean. This is a very important point to make in the very beginning, because without it, we'll not have a meaningful answer. I'll explain why. Let's say we have a sample and don't know the population mean. We have a usual estimator of the variance: $$\sigma=\frac{1}{n-1}sum_i(x_i-\bar x)^2$$ Now, we're told that the population mean is $\mu$. Our first instinct is to plug it into the variance estimator: $$\sigma'=\frac{1}{n}sum_i(x_i-\mu)^2$$ Notice, that it's a different estimator now! It has different denominator etc. It has a different variance itself. However, is it right to compare $Var[\sigma]$ and $Var[\sigma']$? No, it's NOT. We have to compare $Var[\sigma|E[x_i]=\mu]$ and $Var[\sigma'|E[x_i]=\mu]$. In other words we have to compare the variance of these two estimators conditional on the knowledge of the population mean! Otherwise, we'll fall into @Scortchi's paradox. When you got new information, i.e. $E[x_i]=\mu$, you have to include it in the estimate of $Var[\sigma]$! This solves @Scortchi's paradox in his comment directly. The equations that I saw so far in answers do not include the knowledge of $\mu$ into the C.I. or variance of the variance estimator $\sigma$. In @Scortchi's example knowing that $\bar x>>\mu$ would lead to a revision of C.I. of $\sigma$. Hence, my answer here follows the set up I jest described. Yes, the confidence interval would have been narrower. Philosophically, knowing mean of the population is an additional information, so the uncertainty must be smaller in this case. Example: if your distribution is Poisson, then variance is equal mean. Hence, knowing mean you know the variance too, and the confidence interval shrinks to a point. There's no interval. UPDATE: Look at this paper: "Estimating a Population Variance with Known Mean" by Zhang, 1996. He compares the standard estimate of variance $\frac{1}{n-1}\sum_i(x_i-\bar x)^2$ vs. the one using the knowledge of the population mean $\frac{1}{n}\sum_i(x_i-\mu)^2$. He comes to the same conclusion: the variance of the latter estimate is smaller than that of the former, i.e. the confidence interval of variance estimate would be narrower. He also shows that the advantage disappears when the sample size tends to infinity. I think this paper is the definitive answer to your question.
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri Let me first set up the problem. We know the population mean. This is a very important point to make in the very beginning, because without it, we'll not have a meaningful answer. I'll explain why. Le
30,116
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori?
I can't comment but Aksakal's sweeping statement "knowing mean of the population is an additional information, so the uncertainty must be smaller in this case" is not self evident. In the normally distributed case, the maximum likelihood estimator of the variance when $\mu$ is unknown: $$ \frac{1}{n} \sum_{i=1}^{n} (X_i - \overline{X})^2 $$ has uniformly lower variance than $$ \frac{1}{n} \sum_{i=1}^{n} (X_i - \mu)^2 $$ for any values of $\mu, \sigma$
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri
I can't comment but Aksakal's sweeping statement "knowing mean of the population is an additional information, so the uncertainty must be smaller in this case" is not self evident. In the normally di
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori? I can't comment but Aksakal's sweeping statement "knowing mean of the population is an additional information, so the uncertainty must be smaller in this case" is not self evident. In the normally distributed case, the maximum likelihood estimator of the variance when $\mu$ is unknown: $$ \frac{1}{n} \sum_{i=1}^{n} (X_i - \overline{X})^2 $$ has uniformly lower variance than $$ \frac{1}{n} \sum_{i=1}^{n} (X_i - \mu)^2 $$ for any values of $\mu, \sigma$
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri I can't comment but Aksakal's sweeping statement "knowing mean of the population is an additional information, so the uncertainty must be smaller in this case" is not self evident. In the normally di
30,117
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori?
Extending @Cristoph Hanck's answer a little, & adapting his code … Suppose Mr A is ignorant of the true mean, or of statistics, & Mr B is ignorant of neither. It might seem odd, unfair even, that Mr A can obtain a shorter confidence interval for the variance using the pivot $T$ than Mr B using the pivot $T'$. But in the long run Mr B wins in rather a strong sense: his confidence intervals are stochastically narrower—for any width $w$ you care to specify, the proportion of Mr B's CIs narrower than $w$ is greater than the proportion of Mr A's. Collecting together the subset of cases where Mr A's CI comes out narrower shows that in these he's got lower coverage (about 91%); but he pays for it with higher coverage (about 96%) in the subset of cases where his interval comes out wider, getting the correct (95%) coverage overall. Of course Mr A doesn't know when his CI's in which subset. And a sly Mr C who knows the true mean & picks $T$ or $T'$ according to which results in the narrowest CI will eventually be exposed when his intervals fail to maintain their supposed 95% coverage. IntervalLengthsSigma2 <- function(n,alpha=0.05,reps=100000,mu=1) { cl_a <- qchisq(alpha/2,df = n-1) cu_a <- qchisq(1-alpha/2,df = n-1) cl_b <- qchisq(alpha/2,df = n) cu_b <- qchisq(1-alpha/2,df = n) winners02 <- rep(NA,reps) width.a <- rep(NA,reps) width.b <- rep(NA,reps) sigma2.in.a <- rep(NA,reps) sigma2.in.b <- rep(NA,reps) for (i in 1:reps) { x <- rnorm(n,mean=mu) xbar <- mean(x) s2 <- 1/n*sum((x-xbar)^2) s02 <- 1/n*sum((x-mu)^2) ci_a <- c(n*s2/cu_a,n*s2/cl_a) ci_b <- c(n*s02/cu_b,n*s02/cl_b) winners02[i] <- ifelse(ci_a[2]-ci_a[1]>ci_b[2]-ci_b[1],1,0) ci_a[2]-ci_a[1] -> width.a[i] ci_b[2]-ci_b[1] -> width.b[i] ifelse(ci_a[1]< 1 & ci_a[2] > 1, 1, 0) -> sigma2.in.a[i] ifelse(ci_b[1]< 1 & ci_b[2] > 1, 1, 0) -> sigma2.in.b[i] } list(n=n, width.a=width.a,width.b=width.b, sigma2.in.a=sigma2.in.a, sigma2.in.b=sigma2.in.b, winner=winners02) } # simulate for sample size of 6 IntervalLengthsSigma2(n=6) -> sim # plot empirical CDFs of CI widths for mean known & mean unknown plot(ecdf(sim$width.a), xlab="CI width", ylab="empirical CDF", sub=paste("n=",sim$n), main="") lines(ecdf(sim$width.b), col="red") legend("bottomright", lty=1, col=c("black", "red"), legend=c("mean unknown (Mr A)", "mean known (Mr B)")) # coverage with mean unknown: mean(sim$sigma2.in.a) # coverage with mean unknown when CI is narrower than with mean known: mean(sim$sigma2.in.a[sim$winner==0]) # coverage with mean unknown when CI is wider than with mean known: mean(sim$sigma2.in.a[sim$winner==1]) # coverage with mean known: mean(sim$sigma2.in.b) # coverage with mean known when CI is wider than with mean unknown: mean(sim$sigma2.in.b[sim$winner==0]) # coverage with mean known when CI is narrower than with mean unknown; mean(sim$sigma2.in.b[sim$winner==1])
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri
Extending @Cristoph Hanck's answer a little, & adapting his code … Suppose Mr A is ignorant of the true mean, or of statistics, & Mr B is ignorant of neither. It might seem odd, unfair even, that Mr A
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-priori? Extending @Cristoph Hanck's answer a little, & adapting his code … Suppose Mr A is ignorant of the true mean, or of statistics, & Mr B is ignorant of neither. It might seem odd, unfair even, that Mr A can obtain a shorter confidence interval for the variance using the pivot $T$ than Mr B using the pivot $T'$. But in the long run Mr B wins in rather a strong sense: his confidence intervals are stochastically narrower—for any width $w$ you care to specify, the proportion of Mr B's CIs narrower than $w$ is greater than the proportion of Mr A's. Collecting together the subset of cases where Mr A's CI comes out narrower shows that in these he's got lower coverage (about 91%); but he pays for it with higher coverage (about 96%) in the subset of cases where his interval comes out wider, getting the correct (95%) coverage overall. Of course Mr A doesn't know when his CI's in which subset. And a sly Mr C who knows the true mean & picks $T$ or $T'$ according to which results in the narrowest CI will eventually be exposed when his intervals fail to maintain their supposed 95% coverage. IntervalLengthsSigma2 <- function(n,alpha=0.05,reps=100000,mu=1) { cl_a <- qchisq(alpha/2,df = n-1) cu_a <- qchisq(1-alpha/2,df = n-1) cl_b <- qchisq(alpha/2,df = n) cu_b <- qchisq(1-alpha/2,df = n) winners02 <- rep(NA,reps) width.a <- rep(NA,reps) width.b <- rep(NA,reps) sigma2.in.a <- rep(NA,reps) sigma2.in.b <- rep(NA,reps) for (i in 1:reps) { x <- rnorm(n,mean=mu) xbar <- mean(x) s2 <- 1/n*sum((x-xbar)^2) s02 <- 1/n*sum((x-mu)^2) ci_a <- c(n*s2/cu_a,n*s2/cl_a) ci_b <- c(n*s02/cu_b,n*s02/cl_b) winners02[i] <- ifelse(ci_a[2]-ci_a[1]>ci_b[2]-ci_b[1],1,0) ci_a[2]-ci_a[1] -> width.a[i] ci_b[2]-ci_b[1] -> width.b[i] ifelse(ci_a[1]< 1 & ci_a[2] > 1, 1, 0) -> sigma2.in.a[i] ifelse(ci_b[1]< 1 & ci_b[2] > 1, 1, 0) -> sigma2.in.b[i] } list(n=n, width.a=width.a,width.b=width.b, sigma2.in.a=sigma2.in.a, sigma2.in.b=sigma2.in.b, winner=winners02) } # simulate for sample size of 6 IntervalLengthsSigma2(n=6) -> sim # plot empirical CDFs of CI widths for mean known & mean unknown plot(ecdf(sim$width.a), xlab="CI width", ylab="empirical CDF", sub=paste("n=",sim$n), main="") lines(ecdf(sim$width.b), col="red") legend("bottomright", lty=1, col=c("black", "red"), legend=c("mean unknown (Mr A)", "mean known (Mr B)")) # coverage with mean unknown: mean(sim$sigma2.in.a) # coverage with mean unknown when CI is narrower than with mean known: mean(sim$sigma2.in.a[sim$winner==0]) # coverage with mean unknown when CI is wider than with mean known: mean(sim$sigma2.in.a[sim$winner==1]) # coverage with mean known: mean(sim$sigma2.in.b) # coverage with mean known when CI is wider than with mean unknown: mean(sim$sigma2.in.b[sim$winner==0]) # coverage with mean known when CI is narrower than with mean unknown; mean(sim$sigma2.in.b[sim$winner==1])
Would a $(1-\alpha)100\%$ confidence interval for the variance be narrower if we knew the mean a-pri Extending @Cristoph Hanck's answer a little, & adapting his code … Suppose Mr A is ignorant of the true mean, or of statistics, & Mr B is ignorant of neither. It might seem odd, unfair even, that Mr A
30,118
Understanding $\chi^{2}$ and Cramér's $V$ results
There is a fundamental confusion here: The $p$-value you got comes from the $\chi^2$ test. It tells you the probability of getting a $\chi^2$ statistic as extreme or more extreme than yours if the null hypothesis is true. It tells you nothing about how big the effect is. On the other hand, Cramer's $V$ is a measure of effect size. It tells you how big the effect is. It tells you nothing about whether or not the effect is 'significant'. In addition, Cramer's $V$ isn't really the right measure of effect size for you, although it can be appropriate for many $\chi^2$ analyses. It assumes that neither the row variable nor the column variable is fixed. In your case, the columns are two groups that could be understood as an independent variable, whereas the rows are the number who bought or didn't (this can be thought of as a dependent variable). That is, you think of your rows and columns differently, so you want a measure of effect size that does so as well. There are generally three such measures: risk differences, risk ratios, and odds ratios. Risk differences are the easiest for people to understand, but odds ratios are arguably the best measure. For your data, those values are (notice the denominators vary between the risk ratio and the odds ratio): ## risk difference: (271/2520) - (1073839/41873457) # [1] 0.08189482 ## risk ratio: (271/2520) / (1073839/41873457) # [1] 4.19342 ## odds ratio: (271/2249) / (1073839/40799618) # [1] 4.578221
Understanding $\chi^{2}$ and Cramér's $V$ results
There is a fundamental confusion here: The $p$-value you got comes from the $\chi^2$ test. It tells you the probability of getting a $\chi^2$ statistic as extreme or more extreme than yours if the
Understanding $\chi^{2}$ and Cramér's $V$ results There is a fundamental confusion here: The $p$-value you got comes from the $\chi^2$ test. It tells you the probability of getting a $\chi^2$ statistic as extreme or more extreme than yours if the null hypothesis is true. It tells you nothing about how big the effect is. On the other hand, Cramer's $V$ is a measure of effect size. It tells you how big the effect is. It tells you nothing about whether or not the effect is 'significant'. In addition, Cramer's $V$ isn't really the right measure of effect size for you, although it can be appropriate for many $\chi^2$ analyses. It assumes that neither the row variable nor the column variable is fixed. In your case, the columns are two groups that could be understood as an independent variable, whereas the rows are the number who bought or didn't (this can be thought of as a dependent variable). That is, you think of your rows and columns differently, so you want a measure of effect size that does so as well. There are generally three such measures: risk differences, risk ratios, and odds ratios. Risk differences are the easiest for people to understand, but odds ratios are arguably the best measure. For your data, those values are (notice the denominators vary between the risk ratio and the odds ratio): ## risk difference: (271/2520) - (1073839/41873457) # [1] 0.08189482 ## risk ratio: (271/2520) / (1073839/41873457) # [1] 4.19342 ## odds ratio: (271/2249) / (1073839/40799618) # [1] 4.578221
Understanding $\chi^{2}$ and Cramér's $V$ results There is a fundamental confusion here: The $p$-value you got comes from the $\chi^2$ test. It tells you the probability of getting a $\chi^2$ statistic as extreme or more extreme than yours if the
30,119
Understanding $\chi^{2}$ and Cramér's $V$ results
You do not say how you obtained your Cramér's V statistic, and while you give the $p$-value for your $\chi^{2}$ statistic, you do not provide the value of $\chi^{2}$ itself. However, the math for Cramér's V is straightforward: $$V = \sqrt{\frac{^{\chi^2}/_n}{\min\left(\text{rows-1, cols-1}\right)}}$$ which in your case simplifies to: $$V=\sqrt{\frac{\chi^{2}}{n}}$$ By definition, the $p$-value of V is equal to the $p$-value of the corresponding $\chi^{2}$ (as you can plainly see in the edit to your question which now includes the output from the chisq.test command). Also: given your humongous sample size, it is not at all surprising that you found a significant difference. All differences are significant with a large enough sample size.
Understanding $\chi^{2}$ and Cramér's $V$ results
You do not say how you obtained your Cramér's V statistic, and while you give the $p$-value for your $\chi^{2}$ statistic, you do not provide the value of $\chi^{2}$ itself. However, the math for Cram
Understanding $\chi^{2}$ and Cramér's $V$ results You do not say how you obtained your Cramér's V statistic, and while you give the $p$-value for your $\chi^{2}$ statistic, you do not provide the value of $\chi^{2}$ itself. However, the math for Cramér's V is straightforward: $$V = \sqrt{\frac{^{\chi^2}/_n}{\min\left(\text{rows-1, cols-1}\right)}}$$ which in your case simplifies to: $$V=\sqrt{\frac{\chi^{2}}{n}}$$ By definition, the $p$-value of V is equal to the $p$-value of the corresponding $\chi^{2}$ (as you can plainly see in the edit to your question which now includes the output from the chisq.test command). Also: given your humongous sample size, it is not at all surprising that you found a significant difference. All differences are significant with a large enough sample size.
Understanding $\chi^{2}$ and Cramér's $V$ results You do not say how you obtained your Cramér's V statistic, and while you give the $p$-value for your $\chi^{2}$ statistic, you do not provide the value of $\chi^{2}$ itself. However, the math for Cram
30,120
Understanding $\chi^{2}$ and Cramér's $V$ results
When I check your work I also obtain .004 for Cramer's V. This statistic, like many in the "variance explained family," tends to be low when you have two groups of very different size. The fact that group membership (A vs. B) hardly ever varies from B means that group membership has little opportunity to explain much of the variance in the buying behaviour. For that reason, it does not seem like the most effective indicator in this situation--at least, not when used alone. There are other approaches. For example, using the common terminology of risk, the risk ratio (A to B) is 4.2. Group B shows a 76% reduction in risk. The odds ratio is 4.6. You could look into other effect size indicators such as at this starting point. But you may need to be prepared to show how your choice of indicators does not involve cherry-picking the ones most favorable to your cause.
Understanding $\chi^{2}$ and Cramér's $V$ results
When I check your work I also obtain .004 for Cramer's V. This statistic, like many in the "variance explained family," tends to be low when you have two groups of very different size. The fact that
Understanding $\chi^{2}$ and Cramér's $V$ results When I check your work I also obtain .004 for Cramer's V. This statistic, like many in the "variance explained family," tends to be low when you have two groups of very different size. The fact that group membership (A vs. B) hardly ever varies from B means that group membership has little opportunity to explain much of the variance in the buying behaviour. For that reason, it does not seem like the most effective indicator in this situation--at least, not when used alone. There are other approaches. For example, using the common terminology of risk, the risk ratio (A to B) is 4.2. Group B shows a 76% reduction in risk. The odds ratio is 4.6. You could look into other effect size indicators such as at this starting point. But you may need to be prepared to show how your choice of indicators does not involve cherry-picking the ones most favorable to your cause.
Understanding $\chi^{2}$ and Cramér's $V$ results When I check your work I also obtain .004 for Cramer's V. This statistic, like many in the "variance explained family," tends to be low when you have two groups of very different size. The fact that
30,121
When is the differential entropy negative?
Differential entropy should be considered as a measure of relative (privation of) information - not absolute. In particular, note that the differential entropy responds to a change in scale (i.e. you have a logarithm of a unitful quantity, which means that it will depend on the units you measure the axis $x$ in), which is not a concept that makes sense for a discrete information source. The inability to specify an absolute information in this context should be taken as based on the intuitive idea that the amount of information required to specify a specific value in an infinite continuum is itself infinite as you must distinguish one from amongst an infinitude of possibilities to achieve such a specification. To understand it more precisely, consider a uniform distribution where the differential entropy is zero. A simple example is precisely that which is one unit wide: $$P(x) = \begin{cases}1,\ \mbox{if $x \in [0, 1]$} \\ 0,\ \mbox{otherwise} \end{cases}$$ If you compute the differential entropy, $h$, of the above distribution, you will find it is zero since $\ln(1) = 0$ and moreover in the appropriate limit $0 \ln(0)$ "equals" 0. This corresponds to the fact you (or the agent to which the Bayesian probability $P(x)$ is specified relative to) know the position (or whatever) of the object to within exactly one unit. If you make the distribution wider, say two units, so you have even less information, then the differential entropy will be $\ln(2)$ or about 0.693. This is the same as the discrete entropy for an infinite discrete set of bins, each standing in for "a unit", or if you like, the bins between marks on a ruler and where you only report the measurement made with the ruler as a whole number of its finest ticks, now distributed uniformly among two such bins, and means we have 0.697 nats less information now about the position of the particle up to a resolution of one unit. Negative differential entropy then just means we go the other way - since we aren't working with discrete bins, we can know it "more precisely" than one bin, i.e. to an accuracy less than one unit, and thus the entropy (privation of information) will have to be less now as we are more informed, thus now less than zero. But if I switch to a finer scale, i.e. a smaller unit, then the entropy will once again exceed zero, as now we don't have enough to know it down to that fine scale. You cannot have an absolute measure because on a continuum, effectively you have an uncountable infinity of "bins" within any arbitrarily small interval, thus even a tiny interval of uncertainty is still effectively infinite information. Thus we have to get up "high into infinity" to measure the differences in entropy in realistic distributions and that is why the "bottom" of differential entropy is at $-\infty$, which is like a probability zero in a continuous probability measure, and how that such does not necessarily represent impossibility, but rather negligibility with regard to the infinitude of the sets we are considering. Or to go the other way intuitively, suppose you were treating the continuum as a set of bins - one for each point - like how you do an ordinary discrete random variable. Then with a probability distribution of $P(x) = \delta(x - a)$, i.e. a delta function at some central real number $a$, that is one bin occupied, so entropy 0, but if you now have 2 bins with probability 1/2, i.e. $P(x) = \frac{1}{2} \delta(x - a_1) + \frac{1}{2} \delta(x - a_2)$ meaning "we know the particle is at either $a_1$ exactly or $a_2$ exactly but not which", then by the usual discrete entropy formula you have entropy $0.693$ nat (or $1$ shannon using $\lg$ instead of $\ln$). But if you continue in this way, long before you reach a truly continuous distribution you will soon "top out" (after a countably infinite number of bins have been summed) using discrete entropy, saturating at positive infinity. And that is what I mean by saying that to then go up into continuous distributions, you then have to "soar up high" - effectively the integral jams in an uncountable infinity and rises your reference point far above the true baseline so you can distinguish the different infinite amounts that are "above the infinite boundary of the discrete entropy". That rise then, by symmetry, puts the baseline infinitely far below you, or at $-\infty$, and moreover due to the Archimedean nature of the real numbers, prevents you from distinguishing these finite-bin cases any more (all of them, if you check for yourself, have differential entropy $-\infty$).
When is the differential entropy negative?
Differential entropy should be considered as a measure of relative (privation of) information - not absolute. In particular, note that the differential entropy responds to a change in scale (i.e. you
When is the differential entropy negative? Differential entropy should be considered as a measure of relative (privation of) information - not absolute. In particular, note that the differential entropy responds to a change in scale (i.e. you have a logarithm of a unitful quantity, which means that it will depend on the units you measure the axis $x$ in), which is not a concept that makes sense for a discrete information source. The inability to specify an absolute information in this context should be taken as based on the intuitive idea that the amount of information required to specify a specific value in an infinite continuum is itself infinite as you must distinguish one from amongst an infinitude of possibilities to achieve such a specification. To understand it more precisely, consider a uniform distribution where the differential entropy is zero. A simple example is precisely that which is one unit wide: $$P(x) = \begin{cases}1,\ \mbox{if $x \in [0, 1]$} \\ 0,\ \mbox{otherwise} \end{cases}$$ If you compute the differential entropy, $h$, of the above distribution, you will find it is zero since $\ln(1) = 0$ and moreover in the appropriate limit $0 \ln(0)$ "equals" 0. This corresponds to the fact you (or the agent to which the Bayesian probability $P(x)$ is specified relative to) know the position (or whatever) of the object to within exactly one unit. If you make the distribution wider, say two units, so you have even less information, then the differential entropy will be $\ln(2)$ or about 0.693. This is the same as the discrete entropy for an infinite discrete set of bins, each standing in for "a unit", or if you like, the bins between marks on a ruler and where you only report the measurement made with the ruler as a whole number of its finest ticks, now distributed uniformly among two such bins, and means we have 0.697 nats less information now about the position of the particle up to a resolution of one unit. Negative differential entropy then just means we go the other way - since we aren't working with discrete bins, we can know it "more precisely" than one bin, i.e. to an accuracy less than one unit, and thus the entropy (privation of information) will have to be less now as we are more informed, thus now less than zero. But if I switch to a finer scale, i.e. a smaller unit, then the entropy will once again exceed zero, as now we don't have enough to know it down to that fine scale. You cannot have an absolute measure because on a continuum, effectively you have an uncountable infinity of "bins" within any arbitrarily small interval, thus even a tiny interval of uncertainty is still effectively infinite information. Thus we have to get up "high into infinity" to measure the differences in entropy in realistic distributions and that is why the "bottom" of differential entropy is at $-\infty$, which is like a probability zero in a continuous probability measure, and how that such does not necessarily represent impossibility, but rather negligibility with regard to the infinitude of the sets we are considering. Or to go the other way intuitively, suppose you were treating the continuum as a set of bins - one for each point - like how you do an ordinary discrete random variable. Then with a probability distribution of $P(x) = \delta(x - a)$, i.e. a delta function at some central real number $a$, that is one bin occupied, so entropy 0, but if you now have 2 bins with probability 1/2, i.e. $P(x) = \frac{1}{2} \delta(x - a_1) + \frac{1}{2} \delta(x - a_2)$ meaning "we know the particle is at either $a_1$ exactly or $a_2$ exactly but not which", then by the usual discrete entropy formula you have entropy $0.693$ nat (or $1$ shannon using $\lg$ instead of $\ln$). But if you continue in this way, long before you reach a truly continuous distribution you will soon "top out" (after a countably infinite number of bins have been summed) using discrete entropy, saturating at positive infinity. And that is what I mean by saying that to then go up into continuous distributions, you then have to "soar up high" - effectively the integral jams in an uncountable infinity and rises your reference point far above the true baseline so you can distinguish the different infinite amounts that are "above the infinite boundary of the discrete entropy". That rise then, by symmetry, puts the baseline infinitely far below you, or at $-\infty$, and moreover due to the Archimedean nature of the real numbers, prevents you from distinguishing these finite-bin cases any more (all of them, if you check for yourself, have differential entropy $-\infty$).
When is the differential entropy negative? Differential entropy should be considered as a measure of relative (privation of) information - not absolute. In particular, note that the differential entropy responds to a change in scale (i.e. you
30,122
When is the differential entropy negative?
You are just confusing $f(x)$ and $F(X)$. The density function $f(x)$ can be greater 1. It just integrates to 1. It is $F(X) \in [0, 1]$. Best
When is the differential entropy negative?
You are just confusing $f(x)$ and $F(X)$. The density function $f(x)$ can be greater 1. It just integrates to 1. It is $F(X) \in [0, 1]$. Best
When is the differential entropy negative? You are just confusing $f(x)$ and $F(X)$. The density function $f(x)$ can be greater 1. It just integrates to 1. It is $F(X) \in [0, 1]$. Best
When is the differential entropy negative? You are just confusing $f(x)$ and $F(X)$. The density function $f(x)$ can be greater 1. It just integrates to 1. It is $F(X) \in [0, 1]$. Best
30,123
Group categorical variables in glmnet
The first two arguments that glmnet() is expecting are a matrix of the predictors (x, in your case) and a vector of the response (g4, in your case). For the x matrix, it is expecting that you have already dummied out any categorical variables. In other words, glmnet() does not actually know if any of your predictors are categorical, because they have already been dummied out. If your data is in a data frame, a good way to construct the x matrix is using the model.matrix() function. It accepts formula language, will automatically exclude the response variable, and will create dummy variables for any predictors defined as factors. The family="multinomial" and type.multinomial="grouped" options refer to the response variable having more than 2 possible outcomes. You can pass in the response variable (g4) as a factor. The package authors provide a nice vignette explaining the usage of glmnet(), though it unfortunately does not give an example using model.matrix() to prepare the x matrix.
Group categorical variables in glmnet
The first two arguments that glmnet() is expecting are a matrix of the predictors (x, in your case) and a vector of the response (g4, in your case). For the x matrix, it is expecting that you have alr
Group categorical variables in glmnet The first two arguments that glmnet() is expecting are a matrix of the predictors (x, in your case) and a vector of the response (g4, in your case). For the x matrix, it is expecting that you have already dummied out any categorical variables. In other words, glmnet() does not actually know if any of your predictors are categorical, because they have already been dummied out. If your data is in a data frame, a good way to construct the x matrix is using the model.matrix() function. It accepts formula language, will automatically exclude the response variable, and will create dummy variables for any predictors defined as factors. The family="multinomial" and type.multinomial="grouped" options refer to the response variable having more than 2 possible outcomes. You can pass in the response variable (g4) as a factor. The package authors provide a nice vignette explaining the usage of glmnet(), though it unfortunately does not give an example using model.matrix() to prepare the x matrix.
Group categorical variables in glmnet The first two arguments that glmnet() is expecting are a matrix of the predictors (x, in your case) and a vector of the response (g4, in your case). For the x matrix, it is expecting that you have alr
30,124
Group categorical variables in glmnet
As justmarkham points out, you can construct the design matrix x using model.matrix. Note that you'll want to exclude the intercept, since glmnet includes one by default. You may also want to change the default contrast function, which by default leaves out one level of the each factor (treatment coding). But because of the lasso penalty, this is no longer necessary for identifiability, and in fact makes interpretation of the selected variables more complicated. To do this, set contr.Dummy <- function(contrasts, ...){ conT <- contr.treatment(contrasts=FALSE, ...) conT } options(contrasts=c(ordered='contr.Dummy', unordered='contr.Dummy')) Now, whatever levels of a factor are selected, you can think of it as suggesting that these specific levels matter, versus all the omitted levels. In machine learning, I have seen this coding referred to as one-hot encoding. Assuming that g4 has K levels, the type.multinomial="grouped" option specifies that the features of x will all enter the model simultaneously for each of the K linear predictors, as opposed to having the linear predictor for each class (in general) having its own features. glmnet does not (currently?) support grouped-type penalties of predictors (the x matrix). The package grplasso does, but is written in pure R, so is slower than glmnet, but you could give that a try.
Group categorical variables in glmnet
As justmarkham points out, you can construct the design matrix x using model.matrix. Note that you'll want to exclude the intercept, since glmnet includes one by default. You may also want to change
Group categorical variables in glmnet As justmarkham points out, you can construct the design matrix x using model.matrix. Note that you'll want to exclude the intercept, since glmnet includes one by default. You may also want to change the default contrast function, which by default leaves out one level of the each factor (treatment coding). But because of the lasso penalty, this is no longer necessary for identifiability, and in fact makes interpretation of the selected variables more complicated. To do this, set contr.Dummy <- function(contrasts, ...){ conT <- contr.treatment(contrasts=FALSE, ...) conT } options(contrasts=c(ordered='contr.Dummy', unordered='contr.Dummy')) Now, whatever levels of a factor are selected, you can think of it as suggesting that these specific levels matter, versus all the omitted levels. In machine learning, I have seen this coding referred to as one-hot encoding. Assuming that g4 has K levels, the type.multinomial="grouped" option specifies that the features of x will all enter the model simultaneously for each of the K linear predictors, as opposed to having the linear predictor for each class (in general) having its own features. glmnet does not (currently?) support grouped-type penalties of predictors (the x matrix). The package grplasso does, but is written in pure R, so is slower than glmnet, but you could give that a try.
Group categorical variables in glmnet As justmarkham points out, you can construct the design matrix x using model.matrix. Note that you'll want to exclude the intercept, since glmnet includes one by default. You may also want to change
30,125
Interpretation problems with hypothesis testing
In frequentist hypothesis testing it is meaningless to talk about "the chance that the population mean is a given number" because the population mean is a fixed but unknown value. In particular, frequentist testing does not assume that the population mean is a random variable and hence it is meaningless to talk about $P(\mu=0)$. The alternative hypothesis matters in the selection of the critical region which is the set of realizations of the test statistic that would imply a rejection of the null in favor of the alternative. For example, if you specify the alternative as $\mu >0$ then you would use a one-tailed test instead of a two-tailed test.
Interpretation problems with hypothesis testing
In frequentist hypothesis testing it is meaningless to talk about "the chance that the population mean is a given number" because the population mean is a fixed but unknown value. In particular, frequ
Interpretation problems with hypothesis testing In frequentist hypothesis testing it is meaningless to talk about "the chance that the population mean is a given number" because the population mean is a fixed but unknown value. In particular, frequentist testing does not assume that the population mean is a random variable and hence it is meaningless to talk about $P(\mu=0)$. The alternative hypothesis matters in the selection of the critical region which is the set of realizations of the test statistic that would imply a rejection of the null in favor of the alternative. For example, if you specify the alternative as $\mu >0$ then you would use a one-tailed test instead of a two-tailed test.
Interpretation problems with hypothesis testing In frequentist hypothesis testing it is meaningless to talk about "the chance that the population mean is a given number" because the population mean is a fixed but unknown value. In particular, frequ
30,126
Interpretation problems with hypothesis testing
You may reject the null hypothesis but you never accept it, you only fail to reject it. That is, you may conclude that the evidence (observations) is not sufficiently strong to reject the null hypothesis, but you do not embrace the null hypothesis and accept it. For example, in a clinical trial to test whether a certain medicine is efficacious, the null hypothesis is that the medicine is not effective. If the evidence is strong that the medicine is effective, you reject the null. If the evidence is weak, you say that there is not sufficient evidence to reject the null hypothesis. You do not declare thst the medicine is ineffective (accept the null), just that there is not enough evidence to say that it is effective (do not reject the null). In the case of a point null such as $\mu = 0$, you can say with some confidence that $\mu \neq 0$ if the evidence points that way, but in the presence of weak evidence, a savvy statistician would say that there is not sufficient evidence to conclude that $\mu \neq 0$ rather than proclaim to all the world that $\mu = 0$ as proven by the test just concluded. After all, the actual value of $\mu$ might be ever so slightly different from $\mu\ldots$
Interpretation problems with hypothesis testing
You may reject the null hypothesis but you never accept it, you only fail to reject it. That is, you may conclude that the evidence (observations) is not sufficiently strong to reject the null hypoth
Interpretation problems with hypothesis testing You may reject the null hypothesis but you never accept it, you only fail to reject it. That is, you may conclude that the evidence (observations) is not sufficiently strong to reject the null hypothesis, but you do not embrace the null hypothesis and accept it. For example, in a clinical trial to test whether a certain medicine is efficacious, the null hypothesis is that the medicine is not effective. If the evidence is strong that the medicine is effective, you reject the null. If the evidence is weak, you say that there is not sufficient evidence to reject the null hypothesis. You do not declare thst the medicine is ineffective (accept the null), just that there is not enough evidence to say that it is effective (do not reject the null). In the case of a point null such as $\mu = 0$, you can say with some confidence that $\mu \neq 0$ if the evidence points that way, but in the presence of weak evidence, a savvy statistician would say that there is not sufficient evidence to conclude that $\mu \neq 0$ rather than proclaim to all the world that $\mu = 0$ as proven by the test just concluded. After all, the actual value of $\mu$ might be ever so slightly different from $\mu\ldots$
Interpretation problems with hypothesis testing You may reject the null hypothesis but you never accept it, you only fail to reject it. That is, you may conclude that the evidence (observations) is not sufficiently strong to reject the null hypoth
30,127
Interpretation problems with hypothesis testing
When Fisher first devised what is now called hypothesis testing, he didn't have an alternative hypothesis in mind. He simply wanted to create a statistic that measured the degree of agreement between the estimate and a proposed value. He found the probability of getting a value for an estimator further away from the proposed value than the estimate from the data. The p-value is just a one-to-one transformation of the test statistic. No alternative hypothesis here. It was Neyman and Pearson that created the null and alternative hypothesis formulation and embedded it within decision theory---which of these statements should I accept? (I'm using "accept" a bit loosely here.) They wanted to find a procedure that was correct as often as possible (thus linking the concept to the frequentist notion of repeated sampling). They chose to minimize the chance of failing to reject a false null (minimize the Type II error or maximize power) for a given chance of rejecting a true null (for a given probability of a Type I error). This framework required the statement of a null hypothesis to determine the chance of rejecting a true null (which is the p-value, same as Fisher calculated) and the statement of the alternative hypothesis to find the procedure that is most powerful in detecting the alternative when it is true. Typically, we can't find a test that is the most powerful against all possible alternatives for a given null; restated, the alternative matters in the choice of the test. So you do use the alternative when you do hypothesis testing: it is baked in to the test that you choose to use in the first place.
Interpretation problems with hypothesis testing
When Fisher first devised what is now called hypothesis testing, he didn't have an alternative hypothesis in mind. He simply wanted to create a statistic that measured the degree of agreement between
Interpretation problems with hypothesis testing When Fisher first devised what is now called hypothesis testing, he didn't have an alternative hypothesis in mind. He simply wanted to create a statistic that measured the degree of agreement between the estimate and a proposed value. He found the probability of getting a value for an estimator further away from the proposed value than the estimate from the data. The p-value is just a one-to-one transformation of the test statistic. No alternative hypothesis here. It was Neyman and Pearson that created the null and alternative hypothesis formulation and embedded it within decision theory---which of these statements should I accept? (I'm using "accept" a bit loosely here.) They wanted to find a procedure that was correct as often as possible (thus linking the concept to the frequentist notion of repeated sampling). They chose to minimize the chance of failing to reject a false null (minimize the Type II error or maximize power) for a given chance of rejecting a true null (for a given probability of a Type I error). This framework required the statement of a null hypothesis to determine the chance of rejecting a true null (which is the p-value, same as Fisher calculated) and the statement of the alternative hypothesis to find the procedure that is most powerful in detecting the alternative when it is true. Typically, we can't find a test that is the most powerful against all possible alternatives for a given null; restated, the alternative matters in the choice of the test. So you do use the alternative when you do hypothesis testing: it is baked in to the test that you choose to use in the first place.
Interpretation problems with hypothesis testing When Fisher first devised what is now called hypothesis testing, he didn't have an alternative hypothesis in mind. He simply wanted to create a statistic that measured the degree of agreement between
30,128
Interpretation problems with hypothesis testing
While it is common to always write the null hypothesis using only an equals sign ($\mu=\mu_0$) in truth the null hypothesis contains all the values not included in the alternative hypothesis, so in fact if we have $H_a: \mu > \mu_0$ then the null that we are testing is really $H_0: \mu \le \mu_0$. Even the 2-tailed test null hypothesis is really that the true value of the mean is in a small interval around the claimed null value, that interval is determined by the level of rounding in the measurement and recording of the data and the precision of the computer.
Interpretation problems with hypothesis testing
While it is common to always write the null hypothesis using only an equals sign ($\mu=\mu_0$) in truth the null hypothesis contains all the values not included in the alternative hypothesis, so in fa
Interpretation problems with hypothesis testing While it is common to always write the null hypothesis using only an equals sign ($\mu=\mu_0$) in truth the null hypothesis contains all the values not included in the alternative hypothesis, so in fact if we have $H_a: \mu > \mu_0$ then the null that we are testing is really $H_0: \mu \le \mu_0$. Even the 2-tailed test null hypothesis is really that the true value of the mean is in a small interval around the claimed null value, that interval is determined by the level of rounding in the measurement and recording of the data and the precision of the computer.
Interpretation problems with hypothesis testing While it is common to always write the null hypothesis using only an equals sign ($\mu=\mu_0$) in truth the null hypothesis contains all the values not included in the alternative hypothesis, so in fa
30,129
Resources for learning about the Statistical Analysis of Financial Data
You might start with this series of lectures by Robert Shiller at Yale. He gives a good overview of the field. My favorite books on the subject: I strongly recommend starting with Statistics and Finance, by David Ruppert (the R code for the book is available). This is a great introduction and covers the basics of finance and statistics so it's appropriate as a first book. Modeling Financial Time Series with S-Plus, by Eric Zivot Analysis of Financial Time Series, by Ruey Tsay Time Series Analysis, by Jonathan D. Cryer Beyond that, you may want some general resources, and the "bible" of finance is Options, Futures, and Other Derivatives by John Hull. Lastly, in terms of some good general books, you might start with these two: A Random Walk Down Wall Street Against the Gods: The Remarkable Story of Risk
Resources for learning about the Statistical Analysis of Financial Data
You might start with this series of lectures by Robert Shiller at Yale. He gives a good overview of the field. My favorite books on the subject: I strongly recommend starting with Statistics and Fin
Resources for learning about the Statistical Analysis of Financial Data You might start with this series of lectures by Robert Shiller at Yale. He gives a good overview of the field. My favorite books on the subject: I strongly recommend starting with Statistics and Finance, by David Ruppert (the R code for the book is available). This is a great introduction and covers the basics of finance and statistics so it's appropriate as a first book. Modeling Financial Time Series with S-Plus, by Eric Zivot Analysis of Financial Time Series, by Ruey Tsay Time Series Analysis, by Jonathan D. Cryer Beyond that, you may want some general resources, and the "bible" of finance is Options, Futures, and Other Derivatives by John Hull. Lastly, in terms of some good general books, you might start with these two: A Random Walk Down Wall Street Against the Gods: The Remarkable Story of Risk
Resources for learning about the Statistical Analysis of Financial Data You might start with this series of lectures by Robert Shiller at Yale. He gives a good overview of the field. My favorite books on the subject: I strongly recommend starting with Statistics and Fin
30,130
Resources for learning about the Statistical Analysis of Financial Data
You should check out http://area51.stackexchange.com/proposals/117/quantitative-finance?referrer=b3Z9BBygZU6P1xPZSakPmQ2, they are trying to start one on stackexhange.com
Resources for learning about the Statistical Analysis of Financial Data
You should check out http://area51.stackexchange.com/proposals/117/quantitative-finance?referrer=b3Z9BBygZU6P1xPZSakPmQ2, they are trying to start one on stackexhange.com
Resources for learning about the Statistical Analysis of Financial Data You should check out http://area51.stackexchange.com/proposals/117/quantitative-finance?referrer=b3Z9BBygZU6P1xPZSakPmQ2, they are trying to start one on stackexhange.com
Resources for learning about the Statistical Analysis of Financial Data You should check out http://area51.stackexchange.com/proposals/117/quantitative-finance?referrer=b3Z9BBygZU6P1xPZSakPmQ2, they are trying to start one on stackexhange.com
30,131
Resources for learning about the Statistical Analysis of Financial Data
Ed Thorpe started the whole statistical arbitrage thing. He has a website, and some good articles. http://edwardothorp.com/ You should also read Nassim Taleb's "Fooled By Randomness". Also, go on Google Scholar and read the top articles by Markowitz, Sharpe, Fama, Modigliani. If you don't have full access, go to the nearest college and get a community library card.
Resources for learning about the Statistical Analysis of Financial Data
Ed Thorpe started the whole statistical arbitrage thing. He has a website, and some good articles. http://edwardothorp.com/ You should also read Nassim Taleb's "Fooled By Randomness". Also, go on Goog
Resources for learning about the Statistical Analysis of Financial Data Ed Thorpe started the whole statistical arbitrage thing. He has a website, and some good articles. http://edwardothorp.com/ You should also read Nassim Taleb's "Fooled By Randomness". Also, go on Google Scholar and read the top articles by Markowitz, Sharpe, Fama, Modigliani. If you don't have full access, go to the nearest college and get a community library card.
Resources for learning about the Statistical Analysis of Financial Data Ed Thorpe started the whole statistical arbitrage thing. He has a website, and some good articles. http://edwardothorp.com/ You should also read Nassim Taleb's "Fooled By Randomness". Also, go on Goog
30,132
Resources for learning about the Statistical Analysis of Financial Data
Also good is "Statistical Analysis of Financial Data in S-PLUS" by Rene A. Carmona
Resources for learning about the Statistical Analysis of Financial Data
Also good is "Statistical Analysis of Financial Data in S-PLUS" by Rene A. Carmona
Resources for learning about the Statistical Analysis of Financial Data Also good is "Statistical Analysis of Financial Data in S-PLUS" by Rene A. Carmona
Resources for learning about the Statistical Analysis of Financial Data Also good is "Statistical Analysis of Financial Data in S-PLUS" by Rene A. Carmona
30,133
Resources for learning about the Statistical Analysis of Financial Data
Check out Wilmott.com as well. It's oriented toward more advanced practitioners, but if I had to choose one person from whom to learn financial math, it would be Paul Wilmott. Brilliant but grounded.
Resources for learning about the Statistical Analysis of Financial Data
Check out Wilmott.com as well. It's oriented toward more advanced practitioners, but if I had to choose one person from whom to learn financial math, it would be Paul Wilmott. Brilliant but grounded
Resources for learning about the Statistical Analysis of Financial Data Check out Wilmott.com as well. It's oriented toward more advanced practitioners, but if I had to choose one person from whom to learn financial math, it would be Paul Wilmott. Brilliant but grounded.
Resources for learning about the Statistical Analysis of Financial Data Check out Wilmott.com as well. It's oriented toward more advanced practitioners, but if I had to choose one person from whom to learn financial math, it would be Paul Wilmott. Brilliant but grounded
30,134
Resources for learning about the Statistical Analysis of Financial Data
More from an economics perspectives I think these two sets of lecture notes are very good: http://home.datacomm.ch/paulsoderlind/Courses/OldCourses/FinEcmtAll.pdf http://personal.lse.ac.uk/mele/files/fin_eco.pdf The first provides econometric methods for analysing financial data whereas the second provides the financial economics theory behind the models being applied. They're both MSc level texts.
Resources for learning about the Statistical Analysis of Financial Data
More from an economics perspectives I think these two sets of lecture notes are very good: http://home.datacomm.ch/paulsoderlind/Courses/OldCourses/FinEcmtAll.pdf http://personal.lse.ac.uk/mele/files/
Resources for learning about the Statistical Analysis of Financial Data More from an economics perspectives I think these two sets of lecture notes are very good: http://home.datacomm.ch/paulsoderlind/Courses/OldCourses/FinEcmtAll.pdf http://personal.lse.ac.uk/mele/files/fin_eco.pdf The first provides econometric methods for analysing financial data whereas the second provides the financial economics theory behind the models being applied. They're both MSc level texts.
Resources for learning about the Statistical Analysis of Financial Data More from an economics perspectives I think these two sets of lecture notes are very good: http://home.datacomm.ch/paulsoderlind/Courses/OldCourses/FinEcmtAll.pdf http://personal.lse.ac.uk/mele/files/
30,135
Resources for learning about the Statistical Analysis of Financial Data
Oren, it is useful to define what aspects of finance you intend to tackle. Statistics is a tool when seen from the econometrics perspective (in terms of assessing the plausibility of a proposed model / theory) or can be the first or primary line of attack when seen from the machine learning side - that is you go low on the domain knowledge and rely more on constructing a feature space and applying algorithms. (However, the task of constructing a useful feature space is dependent on deep domain knowledge). To get a handle on the theoretical aspects of finance - I'd recommend say: Investment Science by Luenberger Mathematical Techniques in Finance: Tools for Incomplete Markets by Ales Cerny (perhaps a later read) Asset Pricing by Cochrane To learn how to apply statistics / econometrics coupled with the theory: Introductory Econometrics for Finance by Chris Brooks Asset Price Dynamics, Volatility, and Prediction by Stephen Taylor Econometrics of Financial Markets by Campbell, MacKinlay and Lo The books recommended above, ones by David Ruppert, Eric Zivot, Ruey Tsay are useful, however, I would recommend Chris Brooks' & Ruppert's texts first, followed by Taylor's. Paul Soderlind's notes, and Kevin Sheppard's notes (both available online) are quite good.
Resources for learning about the Statistical Analysis of Financial Data
Oren, it is useful to define what aspects of finance you intend to tackle. Statistics is a tool when seen from the econometrics perspective (in terms of assessing the plausibility of a proposed model
Resources for learning about the Statistical Analysis of Financial Data Oren, it is useful to define what aspects of finance you intend to tackle. Statistics is a tool when seen from the econometrics perspective (in terms of assessing the plausibility of a proposed model / theory) or can be the first or primary line of attack when seen from the machine learning side - that is you go low on the domain knowledge and rely more on constructing a feature space and applying algorithms. (However, the task of constructing a useful feature space is dependent on deep domain knowledge). To get a handle on the theoretical aspects of finance - I'd recommend say: Investment Science by Luenberger Mathematical Techniques in Finance: Tools for Incomplete Markets by Ales Cerny (perhaps a later read) Asset Pricing by Cochrane To learn how to apply statistics / econometrics coupled with the theory: Introductory Econometrics for Finance by Chris Brooks Asset Price Dynamics, Volatility, and Prediction by Stephen Taylor Econometrics of Financial Markets by Campbell, MacKinlay and Lo The books recommended above, ones by David Ruppert, Eric Zivot, Ruey Tsay are useful, however, I would recommend Chris Brooks' & Ruppert's texts first, followed by Taylor's. Paul Soderlind's notes, and Kevin Sheppard's notes (both available online) are quite good.
Resources for learning about the Statistical Analysis of Financial Data Oren, it is useful to define what aspects of finance you intend to tackle. Statistics is a tool when seen from the econometrics perspective (in terms of assessing the plausibility of a proposed model
30,136
Resources for learning about the Statistical Analysis of Financial Data
I like Risk and Asset Allocation by A. Meucci. This book is a bit more advanced than Ruppert's book, but still very user-friendly.
Resources for learning about the Statistical Analysis of Financial Data
I like Risk and Asset Allocation by A. Meucci. This book is a bit more advanced than Ruppert's book, but still very user-friendly.
Resources for learning about the Statistical Analysis of Financial Data I like Risk and Asset Allocation by A. Meucci. This book is a bit more advanced than Ruppert's book, but still very user-friendly.
Resources for learning about the Statistical Analysis of Financial Data I like Risk and Asset Allocation by A. Meucci. This book is a bit more advanced than Ruppert's book, but still very user-friendly.
30,137
Resources for learning about the Statistical Analysis of Financial Data
Kennedy's Guide to Econometrics is a good survey of techniques in econometrics--not detailed enough to get your hands dirty, but very good for discovering what techniques are being used.
Resources for learning about the Statistical Analysis of Financial Data
Kennedy's Guide to Econometrics is a good survey of techniques in econometrics--not detailed enough to get your hands dirty, but very good for discovering what techniques are being used.
Resources for learning about the Statistical Analysis of Financial Data Kennedy's Guide to Econometrics is a good survey of techniques in econometrics--not detailed enough to get your hands dirty, but very good for discovering what techniques are being used.
Resources for learning about the Statistical Analysis of Financial Data Kennedy's Guide to Econometrics is a good survey of techniques in econometrics--not detailed enough to get your hands dirty, but very good for discovering what techniques are being used.
30,138
Data Mining-- how to tell whether the pattern extracted is meaningful?
If you want to know that a pattern is meaningful, you need to show what it actually means. Statistical tests do not do this. Unless your data can be said to be in some sense "complete", inferences draw from the data will always be provisional. You can increase your confidence in the validity of a pattern by testing against more and more out of sample data, but that doesn't protect you from it turning out to be an artefact. The broader your range of out of sample data -- eg, in terms of how it is acquired and what sort of systematic confounding factors might exist within it -- the better the validation. Ideally, though, you need to go beyond identifying patterns and come up with a persuasive theoretical framework that explains the patterns you've found, and then test that by other, independent means. (This is called "science".)
Data Mining-- how to tell whether the pattern extracted is meaningful?
If you want to know that a pattern is meaningful, you need to show what it actually means. Statistical tests do not do this. Unless your data can be said to be in some sense "complete", inferences dra
Data Mining-- how to tell whether the pattern extracted is meaningful? If you want to know that a pattern is meaningful, you need to show what it actually means. Statistical tests do not do this. Unless your data can be said to be in some sense "complete", inferences draw from the data will always be provisional. You can increase your confidence in the validity of a pattern by testing against more and more out of sample data, but that doesn't protect you from it turning out to be an artefact. The broader your range of out of sample data -- eg, in terms of how it is acquired and what sort of systematic confounding factors might exist within it -- the better the validation. Ideally, though, you need to go beyond identifying patterns and come up with a persuasive theoretical framework that explains the patterns you've found, and then test that by other, independent means. (This is called "science".)
Data Mining-- how to tell whether the pattern extracted is meaningful? If you want to know that a pattern is meaningful, you need to show what it actually means. Statistical tests do not do this. Unless your data can be said to be in some sense "complete", inferences dra
30,139
Data Mining-- how to tell whether the pattern extracted is meaningful?
You could try: Bagging http://en.m.wikipedia.org/wiki/Bootstrap_aggregating Boosting http://en.m.wikipedia.org/wiki/Boosting Cross validation http://en.m.wikipedia.org/wiki/Cross-validation_(statistics)
Data Mining-- how to tell whether the pattern extracted is meaningful?
You could try: Bagging http://en.m.wikipedia.org/wiki/Bootstrap_aggregating Boosting http://en.m.wikipedia.org/wiki/Boosting Cross validation http://en.m.wikipedia.org/wiki/Cross-validation_(statisti
Data Mining-- how to tell whether the pattern extracted is meaningful? You could try: Bagging http://en.m.wikipedia.org/wiki/Bootstrap_aggregating Boosting http://en.m.wikipedia.org/wiki/Boosting Cross validation http://en.m.wikipedia.org/wiki/Cross-validation_(statistics)
Data Mining-- how to tell whether the pattern extracted is meaningful? You could try: Bagging http://en.m.wikipedia.org/wiki/Bootstrap_aggregating Boosting http://en.m.wikipedia.org/wiki/Boosting Cross validation http://en.m.wikipedia.org/wiki/Cross-validation_(statisti
30,140
Data Mining-- how to tell whether the pattern extracted is meaningful?
One way to test patterns in stock market data is discussed here. A similar approach would be to randomise the stock market data and identify your patterns of interest, which would obviously be devoid of any meaning due to the deliberate randomising process. These randomly generated patterns and their returns would form your null hypothesis. By statistically comparing the pattern returns in the actual data with the returns from the null hypothesis randomised data patterns you may be able to distinguish patterns which actually have some meaning or predictive value.
Data Mining-- how to tell whether the pattern extracted is meaningful?
One way to test patterns in stock market data is discussed here. A similar approach would be to randomise the stock market data and identify your patterns of interest, which would obviously be devoid
Data Mining-- how to tell whether the pattern extracted is meaningful? One way to test patterns in stock market data is discussed here. A similar approach would be to randomise the stock market data and identify your patterns of interest, which would obviously be devoid of any meaning due to the deliberate randomising process. These randomly generated patterns and their returns would form your null hypothesis. By statistically comparing the pattern returns in the actual data with the returns from the null hypothesis randomised data patterns you may be able to distinguish patterns which actually have some meaning or predictive value.
Data Mining-- how to tell whether the pattern extracted is meaningful? One way to test patterns in stock market data is discussed here. A similar approach would be to randomise the stock market data and identify your patterns of interest, which would obviously be devoid
30,141
Why Aren't "Non-Informative Priors" More Popular?
As mentioned by others in the comments, the Bayesian approach estimates slightly different things than the frequentist and the results have different interpretations. So even in cases where you could expect the results to be similar, they are not the same thing. Start with the thread What is an "uninformative prior"? Can we ever have one with truly no information?. You would learn that there's no such thing as a “non-informative prior” as each prior brings some information. The Bayesian approach would give the same result as the maximum likelihood when using improper, flat prior $p(\theta) \propto 1$, and looking at the mode of the posterior, because it's like maximizing the likelihood alone $$\begin{align} &\underset{\theta}{\operatorname{arg\,max}} \; p(X|\theta) \, p(\theta) = \\ &\underset{\theta}{\operatorname{arg\,max}} \; p(X|\theta) \times 1 \end{align}$$ But using flat priors has its own problems, like no guarantee of ending with the proper posterior distribution. So the three main reasons are: ideological (different interpretations), that the priors do bring information to the model, and that using such priors leads to different complications. There's no free lunch.
Why Aren't "Non-Informative Priors" More Popular?
As mentioned by others in the comments, the Bayesian approach estimates slightly different things than the frequentist and the results have different interpretations. So even in cases where you could
Why Aren't "Non-Informative Priors" More Popular? As mentioned by others in the comments, the Bayesian approach estimates slightly different things than the frequentist and the results have different interpretations. So even in cases where you could expect the results to be similar, they are not the same thing. Start with the thread What is an "uninformative prior"? Can we ever have one with truly no information?. You would learn that there's no such thing as a “non-informative prior” as each prior brings some information. The Bayesian approach would give the same result as the maximum likelihood when using improper, flat prior $p(\theta) \propto 1$, and looking at the mode of the posterior, because it's like maximizing the likelihood alone $$\begin{align} &\underset{\theta}{\operatorname{arg\,max}} \; p(X|\theta) \, p(\theta) = \\ &\underset{\theta}{\operatorname{arg\,max}} \; p(X|\theta) \times 1 \end{align}$$ But using flat priors has its own problems, like no guarantee of ending with the proper posterior distribution. So the three main reasons are: ideological (different interpretations), that the priors do bring information to the model, and that using such priors leads to different complications. There's no free lunch.
Why Aren't "Non-Informative Priors" More Popular? As mentioned by others in the comments, the Bayesian approach estimates slightly different things than the frequentist and the results have different interpretations. So even in cases where you could
30,142
Why Aren't "Non-Informative Priors" More Popular?
This is a hard question because there are different Bayesian philosophies, different ideas of what a prior and posterior actually mean, and I'd even say there are also different versions of frequentism. There are various issues here. Why do people still compute classical confidence intervals, and why isn't a Bayesian analysis more popular? How to interpret the results of the Bayesian analysis? Given that people do a Bayesian analysis, why aren't weakly informative priors more popular? (I don't think it makes sense to ask why non-informative priors aren't more popular given that the analysis is Bayesian, because I think they are really quite popular indeed, arguably too popular, see https://statmodeling.stat.columbia.edu/2015/05/01/general-problem-noninformatively-derived-bayesian-probabilities-tend-strong/ and the answer by @Tim.) Ad (1): I believe that the requirement to specify a prior is a major issue that many have with a Bayesian approach. One reason for this can be convenience (thinking about a prior is additional work), another can be the idea that results are supposed to be objective rather than influenced by the subjective choice of a prior. A third reason is that, even if the requirement to specify a prior is accepted, in many situations existing information is of such a kind that it is very hard to translate this into a prior, and often there are various conceivable ways of doing this, and choosing one in particular is hard to justify. Note that I'm not saying that all these are good reasons, although I believe that particularly the last reason often makes a lot of sense, and in principle comprehensive sensitivity analysis would be required, exploring the implications of the choices of different priors that may all seem realistic. Regarding subjectivity vs. objectivity, the thing is that there is also subjective impact in setting up a sampling model as frequentists do, and choices such as the confidence level. There is no way to determine these objectively from the data, and therefore the idea that only a Bayesian approach is affected by subjective choices is wrong. One may also argue that there are advantages in acknowledging necessary "non-objective" aspects of model choice rather than hiding them. For example here we argue that the ability to take into account multiple perspectives and context dependence is an advantage of an approach that requires non-objective input. On the other hand, requiring additional subjective input (the Bayesian approach requires a prior on top of the other choices) isn't advantageous if it is unclear how to choose it and how to use it in an advantageous way. A prior helps if it is clear how the information encoded in the prior can improve the analysis; otherwise it is a much harder sell. Ad (2): In the question it is stated that "credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals". I'm not so sure, and the interpretation of credible intervals depends on the specific school of Bayesian thought, and often it is ignored that there is more than one. For starters, many Bayesians believe that true frequentist distributions and true parameters do not exist, in which case an interpretation in terms of the probability that the "true parameter" is in the credible interval doesn't make much sense. There can be a long discussion about this, and some Bayesians may say that if they talk about a "true parameter" they mean something else than a true objectively existing frequentist parameter, but anyway, the Bayesian marketing claim that, as opposed to confidence intervals, "credible intervals give the users what they really want", namely probabilities regarding the true parameter, is highly problematic and not very convincing in my view. If you indeed want posterior probabilities about true frequentist parameters, a Bayesian approach will have to be based on a frequentist probability concept for the sampling distribution, and it is "philosophically" difficult then to integrate this with a non-frequentist prior, at least as long as we're not in an "empirical Bayes" situation in which there is data generating process with repetition that can be interpreted convincingly as generating the parameters. In any case, credible intervals and posterior probabilities in general are conditional on the specification of the prior, and if the prior is meaningless, so is the posterior. Therefore any prior choice needs meaningful justification and interpretation if the resulting posterior (and not, for example, only the resulting point estimator) is meant to be interpreted in terms of quantifying the "real" uncertainty. This applies to non-informative priors as well - one needs to argue why there is no information that allows a more precise choice, because otherwise the resulting quantification of uncertainty is not in line with what we actually know (which is the aim of Bayesian analysis in the first place). Ad (3): Non-informative priors are actually quite popular because there are default choices (no subjective freedom!) and because users believe (in my view wrongly) that they do not need to put effort into the specification. If you choose a weakly informative prior, of course again you have to choose and justify how exactly to do it, and this makes them less popular. In fact default choices are controversial, and arguably any supposedly non-informative choice actually implicitly also encodes some information. So I don't think that they give "best of both worlds", rather the opposite, if anything (although there are situations in which they can be well motivated). The idea is that weakly informative priors encode a certain minimum amount of key information that people can easily agree on, but leave the data lots of power to determine the inference. This may often be reasonable, but doesn't solve all the problems either, see above.
Why Aren't "Non-Informative Priors" More Popular?
This is a hard question because there are different Bayesian philosophies, different ideas of what a prior and posterior actually mean, and I'd even say there are also different versions of frequentis
Why Aren't "Non-Informative Priors" More Popular? This is a hard question because there are different Bayesian philosophies, different ideas of what a prior and posterior actually mean, and I'd even say there are also different versions of frequentism. There are various issues here. Why do people still compute classical confidence intervals, and why isn't a Bayesian analysis more popular? How to interpret the results of the Bayesian analysis? Given that people do a Bayesian analysis, why aren't weakly informative priors more popular? (I don't think it makes sense to ask why non-informative priors aren't more popular given that the analysis is Bayesian, because I think they are really quite popular indeed, arguably too popular, see https://statmodeling.stat.columbia.edu/2015/05/01/general-problem-noninformatively-derived-bayesian-probabilities-tend-strong/ and the answer by @Tim.) Ad (1): I believe that the requirement to specify a prior is a major issue that many have with a Bayesian approach. One reason for this can be convenience (thinking about a prior is additional work), another can be the idea that results are supposed to be objective rather than influenced by the subjective choice of a prior. A third reason is that, even if the requirement to specify a prior is accepted, in many situations existing information is of such a kind that it is very hard to translate this into a prior, and often there are various conceivable ways of doing this, and choosing one in particular is hard to justify. Note that I'm not saying that all these are good reasons, although I believe that particularly the last reason often makes a lot of sense, and in principle comprehensive sensitivity analysis would be required, exploring the implications of the choices of different priors that may all seem realistic. Regarding subjectivity vs. objectivity, the thing is that there is also subjective impact in setting up a sampling model as frequentists do, and choices such as the confidence level. There is no way to determine these objectively from the data, and therefore the idea that only a Bayesian approach is affected by subjective choices is wrong. One may also argue that there are advantages in acknowledging necessary "non-objective" aspects of model choice rather than hiding them. For example here we argue that the ability to take into account multiple perspectives and context dependence is an advantage of an approach that requires non-objective input. On the other hand, requiring additional subjective input (the Bayesian approach requires a prior on top of the other choices) isn't advantageous if it is unclear how to choose it and how to use it in an advantageous way. A prior helps if it is clear how the information encoded in the prior can improve the analysis; otherwise it is a much harder sell. Ad (2): In the question it is stated that "credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals". I'm not so sure, and the interpretation of credible intervals depends on the specific school of Bayesian thought, and often it is ignored that there is more than one. For starters, many Bayesians believe that true frequentist distributions and true parameters do not exist, in which case an interpretation in terms of the probability that the "true parameter" is in the credible interval doesn't make much sense. There can be a long discussion about this, and some Bayesians may say that if they talk about a "true parameter" they mean something else than a true objectively existing frequentist parameter, but anyway, the Bayesian marketing claim that, as opposed to confidence intervals, "credible intervals give the users what they really want", namely probabilities regarding the true parameter, is highly problematic and not very convincing in my view. If you indeed want posterior probabilities about true frequentist parameters, a Bayesian approach will have to be based on a frequentist probability concept for the sampling distribution, and it is "philosophically" difficult then to integrate this with a non-frequentist prior, at least as long as we're not in an "empirical Bayes" situation in which there is data generating process with repetition that can be interpreted convincingly as generating the parameters. In any case, credible intervals and posterior probabilities in general are conditional on the specification of the prior, and if the prior is meaningless, so is the posterior. Therefore any prior choice needs meaningful justification and interpretation if the resulting posterior (and not, for example, only the resulting point estimator) is meant to be interpreted in terms of quantifying the "real" uncertainty. This applies to non-informative priors as well - one needs to argue why there is no information that allows a more precise choice, because otherwise the resulting quantification of uncertainty is not in line with what we actually know (which is the aim of Bayesian analysis in the first place). Ad (3): Non-informative priors are actually quite popular because there are default choices (no subjective freedom!) and because users believe (in my view wrongly) that they do not need to put effort into the specification. If you choose a weakly informative prior, of course again you have to choose and justify how exactly to do it, and this makes them less popular. In fact default choices are controversial, and arguably any supposedly non-informative choice actually implicitly also encodes some information. So I don't think that they give "best of both worlds", rather the opposite, if anything (although there are situations in which they can be well motivated). The idea is that weakly informative priors encode a certain minimum amount of key information that people can easily agree on, but leave the data lots of power to determine the inference. This may often be reasonable, but doesn't solve all the problems either, see above.
Why Aren't "Non-Informative Priors" More Popular? This is a hard question because there are different Bayesian philosophies, different ideas of what a prior and posterior actually mean, and I'd even say there are also different versions of frequentis
30,143
Why Aren't "Non-Informative Priors" More Popular?
As has been stated well by others the simplest answer to the original question is that "flat" priors are not realistic. Imagine doing a Bayesian power simulation relating to detecting an effect quantified by an odds ratio greater than 1.0, when the prior distribution of the log OR is flat. For the first simulated experiment we might draw an odds ratio of $10^5$ and get a Bayesian power of 1.0. Not interesting or realistic. On a separate note, people frequently state that under "flat" priors Bayesian and frequentist methods are alike. This is true only in the very special case where there is a fixed sample size and one takes only one "look" at the data--at the end of the study at the planned sample size. So we need to downplay these types of comparisons (not to mention the Bayesian interpretation of the result being drastically different from the frequentist interpretation).
Why Aren't "Non-Informative Priors" More Popular?
As has been stated well by others the simplest answer to the original question is that "flat" priors are not realistic. Imagine doing a Bayesian power simulation relating to detecting an effect quant
Why Aren't "Non-Informative Priors" More Popular? As has been stated well by others the simplest answer to the original question is that "flat" priors are not realistic. Imagine doing a Bayesian power simulation relating to detecting an effect quantified by an odds ratio greater than 1.0, when the prior distribution of the log OR is flat. For the first simulated experiment we might draw an odds ratio of $10^5$ and get a Bayesian power of 1.0. Not interesting or realistic. On a separate note, people frequently state that under "flat" priors Bayesian and frequentist methods are alike. This is true only in the very special case where there is a fixed sample size and one takes only one "look" at the data--at the end of the study at the planned sample size. So we need to downplay these types of comparisons (not to mention the Bayesian interpretation of the result being drastically different from the frequentist interpretation).
Why Aren't "Non-Informative Priors" More Popular? As has been stated well by others the simplest answer to the original question is that "flat" priors are not realistic. Imagine doing a Bayesian power simulation relating to detecting an effect quant
30,144
Why Aren't "Non-Informative Priors" More Popular?
I have this controversial view that the answer to this question is actually very simple and people over-complicate it by using academic responses. I also have asked the question, "why use frequentist methods when you can just get the same answer using Bayesian methods?", and I get academic responses which are not very convincing, e.g., "because the answer depends on the prior", ect. When I ran my own simulations and use absolutely horrendous priors the MCMC sampling still converged to the correct answer, which was almost the same as using non-informative priors, and which was almost the same as using frequentist methods. So the common response that, "since your answer depends on the prior", is not a what is seen in practice. So it is really a non-answer. The only time when the prior actually does matter is when you have small amounts of data, but then, statistical analysis derived from that data is highly suspicious anyway. There are only three practical answers that make sense to me. Frequentist methods, if applicable, are much faster than MCMC. For example, you can run least-squares regression calculators on gigantic datasets and get an answer extremely quickly. However, running Stan would be too slow. Also, related to this problem, sometimes setting up an MCMC simulation might cause some sort of bugs, and then you need to figure out what those are and why it is not running. With frequentist methods it is more reliable, but again, provided that the problem can be delt with in a frequentist manner. Necessity is the mother of all invention. In the 1920s it was not possible to do Bayesian computation beyond the simplest problems. Therefore, the frequentist method was the default since it was the only way calculations could actually have been done. People are lazy. Once they learn how to do something one way, why would they then learn how to do it another way? For example, R is superior to SPSS, Stata, SAS, ect, so why do people not use R? Because they already can do it in using other software, so why put in the effort to learn something which is harder (even if better)? Pedagogical reasons. Imagine incoming freshmen in Psychology are taking their first statistics course. You cannot talk about calculus, or MCMC algorithms, or MLE with gradient descent, ect. That will confuse everyone. Instead if you teach the students some commonly used sampling distributions, and how to look up their values, then they can actually learn how to do some statistical analysis. It is similar to asking the question, for an easy intro physics class, "why do they just not teach calculus and differential equations?". Because everyone would be confused, so they teach more elementary methods so the students can still get something out the class.
Why Aren't "Non-Informative Priors" More Popular?
I have this controversial view that the answer to this question is actually very simple and people over-complicate it by using academic responses. I also have asked the question, "why use frequentist
Why Aren't "Non-Informative Priors" More Popular? I have this controversial view that the answer to this question is actually very simple and people over-complicate it by using academic responses. I also have asked the question, "why use frequentist methods when you can just get the same answer using Bayesian methods?", and I get academic responses which are not very convincing, e.g., "because the answer depends on the prior", ect. When I ran my own simulations and use absolutely horrendous priors the MCMC sampling still converged to the correct answer, which was almost the same as using non-informative priors, and which was almost the same as using frequentist methods. So the common response that, "since your answer depends on the prior", is not a what is seen in practice. So it is really a non-answer. The only time when the prior actually does matter is when you have small amounts of data, but then, statistical analysis derived from that data is highly suspicious anyway. There are only three practical answers that make sense to me. Frequentist methods, if applicable, are much faster than MCMC. For example, you can run least-squares regression calculators on gigantic datasets and get an answer extremely quickly. However, running Stan would be too slow. Also, related to this problem, sometimes setting up an MCMC simulation might cause some sort of bugs, and then you need to figure out what those are and why it is not running. With frequentist methods it is more reliable, but again, provided that the problem can be delt with in a frequentist manner. Necessity is the mother of all invention. In the 1920s it was not possible to do Bayesian computation beyond the simplest problems. Therefore, the frequentist method was the default since it was the only way calculations could actually have been done. People are lazy. Once they learn how to do something one way, why would they then learn how to do it another way? For example, R is superior to SPSS, Stata, SAS, ect, so why do people not use R? Because they already can do it in using other software, so why put in the effort to learn something which is harder (even if better)? Pedagogical reasons. Imagine incoming freshmen in Psychology are taking their first statistics course. You cannot talk about calculus, or MCMC algorithms, or MLE with gradient descent, ect. That will confuse everyone. Instead if you teach the students some commonly used sampling distributions, and how to look up their values, then they can actually learn how to do some statistical analysis. It is similar to asking the question, for an easy intro physics class, "why do they just not teach calculus and differential equations?". Because everyone would be confused, so they teach more elementary methods so the students can still get something out the class.
Why Aren't "Non-Informative Priors" More Popular? I have this controversial view that the answer to this question is actually very simple and people over-complicate it by using academic responses. I also have asked the question, "why use frequentist
30,145
Why Aren't "Non-Informative Priors" More Popular?
"Credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals in the Frequentist setting" - this is true only if the prior being used in the Bayesian setting is reflective of the true state of nature. If you use a "garbage" prior, you get garbage credible intervals. If you use a non-informatibe prior, you get an interval that is only credible if the non-informative prior is a reasonable prior for the problem at hand. To put it another way, non-informative priors are not used more often because there are not that many real-world problems where non-informative priors are reasonable for the problem at hand. To put it yet another way, there is no free lunch. By the way, if you really want a true confidence iterval, you can use a set-based minimax estimate under 0-1 loss.
Why Aren't "Non-Informative Priors" More Popular?
"Credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals in the Frequentist setting" - this is true only if the prior being used in t
Why Aren't "Non-Informative Priors" More Popular? "Credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals in the Frequentist setting" - this is true only if the prior being used in the Bayesian setting is reflective of the true state of nature. If you use a "garbage" prior, you get garbage credible intervals. If you use a non-informatibe prior, you get an interval that is only credible if the non-informative prior is a reasonable prior for the problem at hand. To put it another way, non-informative priors are not used more often because there are not that many real-world problems where non-informative priors are reasonable for the problem at hand. To put it yet another way, there is no free lunch. By the way, if you really want a true confidence iterval, you can use a set-based minimax estimate under 0-1 loss.
Why Aren't "Non-Informative Priors" More Popular? "Credible Intervals in the Bayesian setting seem to have more advantageous interpretations compared to Confidence Intervals in the Frequentist setting" - this is true only if the prior being used in t
30,146
Why Aren't "Non-Informative Priors" More Popular?
If you're not using informative priors, you're not being philosophically Bayesian. If the prior doesn't represent your uncertainty before seeing the data, then your posterior doesn't represent your uncertainty after seeing the data. So all interpretational advantages, such credible intervals vs confidence intervals, are lost. In fact, you're being a frequentist ("these methods have good parameter coverage") but using tools that have traditionally been associated with Bayesian methods.
Why Aren't "Non-Informative Priors" More Popular?
If you're not using informative priors, you're not being philosophically Bayesian. If the prior doesn't represent your uncertainty before seeing the data, then your posterior doesn't represent your un
Why Aren't "Non-Informative Priors" More Popular? If you're not using informative priors, you're not being philosophically Bayesian. If the prior doesn't represent your uncertainty before seeing the data, then your posterior doesn't represent your uncertainty after seeing the data. So all interpretational advantages, such credible intervals vs confidence intervals, are lost. In fact, you're being a frequentist ("these methods have good parameter coverage") but using tools that have traditionally been associated with Bayesian methods.
Why Aren't "Non-Informative Priors" More Popular? If you're not using informative priors, you're not being philosophically Bayesian. If the prior doesn't represent your uncertainty before seeing the data, then your posterior doesn't represent your un
30,147
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
Your approach is Procrustean: when you standardized the data, you forced them to look a little more like standard Normal values than they had. After all, part of detecting a difference in distribution involves comparing their means and variances, which you have forced to be the same. As a result, you are fooling the KS test. It turns out the p-values it returns are dramatically too large, as these results of 10,000 simulated datasets (of size $50$) attest. They summarize two p-values: one obtained by applying the KS test to an iid standard Normal sample and another obtained in exactly the same way, after standardizing that sample. The red lines plot the ideal null (uniform) distribution for reference. One thought would be to correct the standardized p-value somehow. But sometimes the p-values are nearly the same because the original sample happened to be nearly standardized, anyway. On rare occasions the standardization makes the data look less like they were drawn from a standard Normal distribution: the KS test evaluates many other aspects of the distribution than its first two moments. But most often, standardization pulls the p-value up (making it harder to detect a departure from being standard Normal). Consequently, we cannot even predict the correct p-value from the incorrect one with acceptable accuracy. Here is the scatterplot of the pairs of p-values in the simulation. These considerations are sufficiently general--they appeal to no particular property of the KS test apart from its purpose--and thereby suggest similar problems would attend the use of standardization with almost any distributional test. Such simulations take little time (this requires less than a second to complete) and can be coded in minutes, so they often are worth doing when subtle questions of this kind arise. As an example of how little effort might be needed, here's R code to reproduce this simulation. n.sim <- 1e4 n <- 50 set.seed(17) X <- matrix(rnorm(n*n.sim), n) f <- function(x) ks.test(x, "pnorm")$p.value ks.1 <- apply(X, 2, f) ks.2 <- apply(scale(X), 2, f) The rest of it is a matter of post-processing the arrays of p-values in ks.1 and ks.2. For the record, here's how I did that to make the figures. # Figure 1: Histograms par(mfrow=c(1,2)) b <- seq(0, 1, by=0.05) hist(ks.1, breaks=b, freq=FALSE, col=gray(.9), main="Non-standardized", xlab="p-value") abline(h=1, lwd=2, col=hsv(0,1,3/4)) hist(ks.2, breaks=b, freq=FALSE, col=gray(.9), main="Standardized", xlab="p-value") abline(h=1, lwd=2, col=hsv(0,1,3/4)) par(mfrow=c(1,1)) # Figure 2: Scatterplot plot(ks.1, ks.2, pch=21, bg=gray(0, alpha=.05), col=gray(0, alpha=.2), cex=.5, xlab="Non-standardized p-value", ylab="Standardized p-value", asp=1)
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
Your approach is Procrustean: when you standardized the data, you forced them to look a little more like standard Normal values than they had. After all, part of detecting a difference in distribution
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? Your approach is Procrustean: when you standardized the data, you forced them to look a little more like standard Normal values than they had. After all, part of detecting a difference in distribution involves comparing their means and variances, which you have forced to be the same. As a result, you are fooling the KS test. It turns out the p-values it returns are dramatically too large, as these results of 10,000 simulated datasets (of size $50$) attest. They summarize two p-values: one obtained by applying the KS test to an iid standard Normal sample and another obtained in exactly the same way, after standardizing that sample. The red lines plot the ideal null (uniform) distribution for reference. One thought would be to correct the standardized p-value somehow. But sometimes the p-values are nearly the same because the original sample happened to be nearly standardized, anyway. On rare occasions the standardization makes the data look less like they were drawn from a standard Normal distribution: the KS test evaluates many other aspects of the distribution than its first two moments. But most often, standardization pulls the p-value up (making it harder to detect a departure from being standard Normal). Consequently, we cannot even predict the correct p-value from the incorrect one with acceptable accuracy. Here is the scatterplot of the pairs of p-values in the simulation. These considerations are sufficiently general--they appeal to no particular property of the KS test apart from its purpose--and thereby suggest similar problems would attend the use of standardization with almost any distributional test. Such simulations take little time (this requires less than a second to complete) and can be coded in minutes, so they often are worth doing when subtle questions of this kind arise. As an example of how little effort might be needed, here's R code to reproduce this simulation. n.sim <- 1e4 n <- 50 set.seed(17) X <- matrix(rnorm(n*n.sim), n) f <- function(x) ks.test(x, "pnorm")$p.value ks.1 <- apply(X, 2, f) ks.2 <- apply(scale(X), 2, f) The rest of it is a matter of post-processing the arrays of p-values in ks.1 and ks.2. For the record, here's how I did that to make the figures. # Figure 1: Histograms par(mfrow=c(1,2)) b <- seq(0, 1, by=0.05) hist(ks.1, breaks=b, freq=FALSE, col=gray(.9), main="Non-standardized", xlab="p-value") abline(h=1, lwd=2, col=hsv(0,1,3/4)) hist(ks.2, breaks=b, freq=FALSE, col=gray(.9), main="Standardized", xlab="p-value") abline(h=1, lwd=2, col=hsv(0,1,3/4)) par(mfrow=c(1,1)) # Figure 2: Scatterplot plot(ks.1, ks.2, pch=21, bg=gray(0, alpha=.05), col=gray(0, alpha=.2), cex=.5, xlab="Non-standardized p-value", ylab="Standardized p-value", asp=1)
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? Your approach is Procrustean: when you standardized the data, you forced them to look a little more like standard Normal values than they had. After all, part of detecting a difference in distribution
30,148
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
Consider the following simulation, in which the K-S test is asked whether a sample of size $n=20$ from $\mathsf{Beta}(2,2)$ is normal. Bogus variants with sample mean and variance and (similarly) standardizing with sample mean and variance are also tried. [Approximate variants of the K-S test using sample mean and SD are available.] Finally, the Shapiro-Wilk test is asked whether the beta data fit any normal distribution. (Poor power with small $n.)$ set.seed(2022) m = 10^5; pv1 = pv2 = pv3 = pv4 = numeric(m) for (i in 1:m) { x = rbeta(50, 2,2) pv1[i] = ks.test(x, pbeta, 2,2)$p.val pv2[i] = ks.test(x, pnorm, mean(x), sd(x))$p.val z = (x -mean(x))/sd(x) pv3[i] = ks.test(z, pnorm)$p.val pv4[i] = shapiro.test(x)$p.val } mean(pv1 <=.05) # aprx K-S P-val for BETA(2,2) [1] 0.05052 # power aprx same as sig level mean(pv2 <=.05) # dishonest K-S, for NORM(.5,.2236) [1] 0.00012 # power below sig. level mean(pv3 <=.05) # dishonest K-S, for standardized bets [1] 0.00012 # no power, same as above mean(pv4 <= 10) # honest Shapiro P-val [1] 0.15131 # aprx power 15% The two bogus attempts to trick the K-S test (pv2 and pv3) are dysfunctional, giving P-values below the nominal significance level of 5%. [As @whuber remarks, the 'standardization' makes the sample look 'too much' like standard normal.] About 15% of the time, the Shapiro-Wilk test correctly recognizes that the beta data [all in $(0,1)]$ are inconsistent with any normal distribution. Reference: The idea to use $\mathsf{Beta}(2,2)$ in my simulation comes from Figure 1(a) of this relevant paper.
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
Consider the following simulation, in which the K-S test is asked whether a sample of size $n=20$ from $\mathsf{Beta}(2,2)$ is normal. Bogus variants with sample mean and variance and (similarly) stan
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? Consider the following simulation, in which the K-S test is asked whether a sample of size $n=20$ from $\mathsf{Beta}(2,2)$ is normal. Bogus variants with sample mean and variance and (similarly) standardizing with sample mean and variance are also tried. [Approximate variants of the K-S test using sample mean and SD are available.] Finally, the Shapiro-Wilk test is asked whether the beta data fit any normal distribution. (Poor power with small $n.)$ set.seed(2022) m = 10^5; pv1 = pv2 = pv3 = pv4 = numeric(m) for (i in 1:m) { x = rbeta(50, 2,2) pv1[i] = ks.test(x, pbeta, 2,2)$p.val pv2[i] = ks.test(x, pnorm, mean(x), sd(x))$p.val z = (x -mean(x))/sd(x) pv3[i] = ks.test(z, pnorm)$p.val pv4[i] = shapiro.test(x)$p.val } mean(pv1 <=.05) # aprx K-S P-val for BETA(2,2) [1] 0.05052 # power aprx same as sig level mean(pv2 <=.05) # dishonest K-S, for NORM(.5,.2236) [1] 0.00012 # power below sig. level mean(pv3 <=.05) # dishonest K-S, for standardized bets [1] 0.00012 # no power, same as above mean(pv4 <= 10) # honest Shapiro P-val [1] 0.15131 # aprx power 15% The two bogus attempts to trick the K-S test (pv2 and pv3) are dysfunctional, giving P-values below the nominal significance level of 5%. [As @whuber remarks, the 'standardization' makes the sample look 'too much' like standard normal.] About 15% of the time, the Shapiro-Wilk test correctly recognizes that the beta data [all in $(0,1)]$ are inconsistent with any normal distribution. Reference: The idea to use $\mathsf{Beta}(2,2)$ in my simulation comes from Figure 1(a) of this relevant paper.
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? Consider the following simulation, in which the K-S test is asked whether a sample of size $n=20$ from $\mathsf{Beta}(2,2)$ is normal. Bogus variants with sample mean and variance and (similarly) stan
30,149
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
In general, statistical tests consist of two parts: calculating a statistic, and then finding a p-value based on that statistic. You certainly can calculate the KS statistic for a normalized sample, but where you run into trouble is calculating the p-value. The published p-value tables for KS are for running a sample against a pre-determined distribution. By standardizing the sample, you're doing something akin to p-hacking, in that you're essentially altering your null hypothesis after seeing your data (the values of the mean and standard deviation for your proposed distribution are part of the null hypothesis, and you're calculating those from the sample). I find whuber's characterization "when you standardized the data, you forced them to look a little more like standard Normal values than they had" to be possibly misleading, at least if the reader misses the "standard" part. The Shapiro-Wilk test looks at how well the sample matches any normal distribution, not just the standard normal distribution, and standardizing the data doesn't change the Shapiro-Wilk statistic. The Kolmogorov-Smirnov test, on the other hand, is comparing the sample to a particular distribution, not just to the entire class of normal distributions, and so standardization, by forcing the sample to match a particular mean and standard deviation (namely, $0$ and $1$ respectively), increases the probability of appearing to match the distribution. So if you want to do a statistical test using KS on a standardized sample, you'll have to find some source for p-values other than the standard formula. I find whuber's conclusion "we cannot even predict the correct p-value from the incorrect one with acceptable accuracy" to not be supported by the argument that precedes it in their answer, however (at least without reading more into the argument). The mere fact that using a different distribution for p-values sometimes increases the p-value and sometimes decreases it does not preclude the use of that different distribution (although there may be additional issues in this particular case that make it impractical). If your statistical test has a particular $\alpha$, then any test that has a rejection region with probability mass less than or equal to $\alpha$ is valid, albeit not necessarily useful. It is likely, however, that to calculate a p-value, you would need some metadistribution, where the actual distribution you're sampling from is modeled as being randomly chosen from some space of distributions, with some meta-probability distribution over that space. There may be some upper bound for the p-values regardless of the metadistribution, however, in which case you can use that. I'm not familiar with what work, if any, has been done establishing p-values for this case. And given that we already have the Shapiro-Wilk test, you might as well use that.
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable?
In general, statistical tests consist of two parts: calculating a statistic, and then finding a p-value based on that statistic. You certainly can calculate the KS statistic for a normalized sample, b
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? In general, statistical tests consist of two parts: calculating a statistic, and then finding a p-value based on that statistic. You certainly can calculate the KS statistic for a normalized sample, but where you run into trouble is calculating the p-value. The published p-value tables for KS are for running a sample against a pre-determined distribution. By standardizing the sample, you're doing something akin to p-hacking, in that you're essentially altering your null hypothesis after seeing your data (the values of the mean and standard deviation for your proposed distribution are part of the null hypothesis, and you're calculating those from the sample). I find whuber's characterization "when you standardized the data, you forced them to look a little more like standard Normal values than they had" to be possibly misleading, at least if the reader misses the "standard" part. The Shapiro-Wilk test looks at how well the sample matches any normal distribution, not just the standard normal distribution, and standardizing the data doesn't change the Shapiro-Wilk statistic. The Kolmogorov-Smirnov test, on the other hand, is comparing the sample to a particular distribution, not just to the entire class of normal distributions, and so standardization, by forcing the sample to match a particular mean and standard deviation (namely, $0$ and $1$ respectively), increases the probability of appearing to match the distribution. So if you want to do a statistical test using KS on a standardized sample, you'll have to find some source for p-values other than the standard formula. I find whuber's conclusion "we cannot even predict the correct p-value from the incorrect one with acceptable accuracy" to not be supported by the argument that precedes it in their answer, however (at least without reading more into the argument). The mere fact that using a different distribution for p-values sometimes increases the p-value and sometimes decreases it does not preclude the use of that different distribution (although there may be additional issues in this particular case that make it impractical). If your statistical test has a particular $\alpha$, then any test that has a rejection region with probability mass less than or equal to $\alpha$ is valid, albeit not necessarily useful. It is likely, however, that to calculate a p-value, you would need some metadistribution, where the actual distribution you're sampling from is modeled as being randomly chosen from some space of distributions, with some meta-probability distribution over that space. There may be some upper bound for the p-values regardless of the metadistribution, however, in which case you can use that. I'm not familiar with what work, if any, has been done establishing p-values for this case. And given that we already have the Shapiro-Wilk test, you might as well use that.
Is it reasonable to use the Kolmogorov-Smirnov test to assess the normality of a random variable? In general, statistical tests consist of two parts: calculating a statistic, and then finding a p-value based on that statistic. You certainly can calculate the KS statistic for a normalized sample, b
30,150
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get $E[f(X)] \approx 0$?
You does not need an approximation here. Use properties of moment generating functions, $X$ is standard normal so $X^2$ is chisquared with one df, with moment generating function $M_{X^2}(t)=\frac1{\sqrt{1-2t}}$ (for $t<1/2$.) Then note that $$\DeclareMathOperator{\E}{\mathbb{E}}M_X(t)=\E e^{t X} $$ is the definition, so that $$\E e^{-X^2}=M_{X²}(-1)=\frac1{\sqrt{1-2\cdot (-1)}}=\frac1{\sqrt{3}} $$ We can check that in R with a fast simulation (always a good idea to do a simulation check): mean( exp(-rnorm(1E6)^2) ) [1] 0.5774847 1/sqrt(3) [1] 0.5773503 Answer in comments: What about if 𝑋 was not standard normal but normal with mean $𝜇_𝑋$ and variance $𝜎^2_𝑋$. Can your approach still be used or is it specific to the case of a standard normal distribution? It can still be used. I will not give full details. First, the easy case $X \sim \mathcal{N}(0,\sigma^2)$. Then $X=(\sigma Z)^2$ with $Z$ standard normal, so in the above argument you get the argument $-\sigma^2$ in place of $-1$ for the mgf (moment generating function.) For the fully general case, see for instance Moment-generating function (MGF) of non-central chi-squared distribution and work from there.
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get
You does not need an approximation here. Use properties of moment generating functions, $X$ is standard normal so $X^2$ is chisquared with one df, with moment generating function $M_{X^2}(t)=\frac1{\s
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get $E[f(X)] \approx 0$? You does not need an approximation here. Use properties of moment generating functions, $X$ is standard normal so $X^2$ is chisquared with one df, with moment generating function $M_{X^2}(t)=\frac1{\sqrt{1-2t}}$ (for $t<1/2$.) Then note that $$\DeclareMathOperator{\E}{\mathbb{E}}M_X(t)=\E e^{t X} $$ is the definition, so that $$\E e^{-X^2}=M_{X²}(-1)=\frac1{\sqrt{1-2\cdot (-1)}}=\frac1{\sqrt{3}} $$ We can check that in R with a fast simulation (always a good idea to do a simulation check): mean( exp(-rnorm(1E6)^2) ) [1] 0.5774847 1/sqrt(3) [1] 0.5773503 Answer in comments: What about if 𝑋 was not standard normal but normal with mean $𝜇_𝑋$ and variance $𝜎^2_𝑋$. Can your approach still be used or is it specific to the case of a standard normal distribution? It can still be used. I will not give full details. First, the easy case $X \sim \mathcal{N}(0,\sigma^2)$. Then $X=(\sigma Z)^2$ with $Z$ standard normal, so in the above argument you get the argument $-\sigma^2$ in place of $-1$ for the mgf (moment generating function.) For the fully general case, see for instance Moment-generating function (MGF) of non-central chi-squared distribution and work from there.
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get You does not need an approximation here. Use properties of moment generating functions, $X$ is standard normal so $X^2$ is chisquared with one df, with moment generating function $M_{X^2}(t)=\frac1{\s
30,151
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get $E[f(X)] \approx 0$?
There's no need to "approximate" when you can derive the exact value of $\mathbb{E}[f(X)]$ . Let us apply the Law of the Unconscious Statistician (LoTUS) to obtain : \begin{align*} \mathbb{E}[f(X)] &= \int_{-\infty}^{+\infty} e^{-x^2} \cdot \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{x^2}{2}\right)~dx\\ &= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{3x^2}{2}\right)~dx\\ &= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \cdot\frac{1}{\sqrt{6z}} e^{-z}~dz\\ &= \frac{2}{2\sqrt{3\pi}} \int_0^{+\infty} e^{-z} z^{\frac{1}{2} -1} ~dz\\ &=\frac{1}{\sqrt{3\pi}}\cdot \Gamma\left(\frac{1}{2}\right)\\ &= \frac{1}{\sqrt{3\pi}}\cdot \sqrt{\pi}\\ &= \frac{1}{\sqrt{3}} \end{align*} Hope this helps. :)
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get
There's no need to "approximate" when you can derive the exact value of $\mathbb{E}[f(X)]$ . Let us apply the Law of the Unconscious Statistician (LoTUS) to obtain : \begin{align*} \mathbb{E}[f(X)] &=
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get $E[f(X)] \approx 0$? There's no need to "approximate" when you can derive the exact value of $\mathbb{E}[f(X)]$ . Let us apply the Law of the Unconscious Statistician (LoTUS) to obtain : \begin{align*} \mathbb{E}[f(X)] &= \int_{-\infty}^{+\infty} e^{-x^2} \cdot \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{x^2}{2}\right)~dx\\ &= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{3x^2}{2}\right)~dx\\ &= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \cdot\frac{1}{\sqrt{6z}} e^{-z}~dz\\ &= \frac{2}{2\sqrt{3\pi}} \int_0^{+\infty} e^{-z} z^{\frac{1}{2} -1} ~dz\\ &=\frac{1}{\sqrt{3\pi}}\cdot \Gamma\left(\frac{1}{2}\right)\\ &= \frac{1}{\sqrt{3\pi}}\cdot \sqrt{\pi}\\ &= \frac{1}{\sqrt{3}} \end{align*} Hope this helps. :)
Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get There's no need to "approximate" when you can derive the exact value of $\mathbb{E}[f(X)]$ . Let us apply the Law of the Unconscious Statistician (LoTUS) to obtain : \begin{align*} \mathbb{E}[f(X)] &=
30,152
What is the purpose of using a decision tree?
The way I see it is, it is a series of if-else. Why don't I just use if-else instead of using a decision tree? You are absolutely right. A decision tree is nothing else but a series of if-else statements. However, it is the way we interpret these statements as a tree that lets us build these rules automatically... I.e. given some input example set $(x_1, y_1), ..., (x_N, y_N)$... what is the best set of rules that describes what value $y$ has given a new input $x$? ID3 and alike lets us automatically create these rules. It is not really about the tree once built, it is about how we created it. Apart from that one hardly ever uses a decision tree alone, the reason being precisely what you say: it is a pretty simplistic model that lacks expressiveness. However, it has one big advantage over other models: One can compute a single decision tree quite fast. That means that we can come up with algorithms that train many many decision trees (boosting, aka AdaBoost and GradientBoosting) on big datasets. These collection of (usually more than 500) of these simplistic models (called forest) can then express much more complicated shapes. You could also imagine it like this: Given a 'nice' (i.e. continuous) but complicated function $f : [a,b] \to \mathbb{R}$ we could try to approximate this function using lines. If the function is complicated (like $sin(x)$ or so) then we produce a big error. However, we could combine lines in the way that we divide the interval $[a,b]$ into smaller parts $a = a_0 < a_1 < ... < a_M = b$ and on each $a_i, a_{i+1}$ we try to approximize $f|_{(a_i, a_{i+1})}$ (that is, $f$ restricted to this interval) by a line. By basic math (analysis) we can then approximate the function arbitrarily close (i.e. make an arbitrarily small error) if we take enough lines. Hence, we built up a complicated but accurate model from very simple ones. That is exactly the same idea that (for example) GradientBoosting uses: It builds a forest from very 'stupid' single decision trees.
What is the purpose of using a decision tree?
The way I see it is, it is a series of if-else. Why don't I just use if-else instead of using a decision tree? You are absolutely right. A decision tree is nothing else but a series of if-else statem
What is the purpose of using a decision tree? The way I see it is, it is a series of if-else. Why don't I just use if-else instead of using a decision tree? You are absolutely right. A decision tree is nothing else but a series of if-else statements. However, it is the way we interpret these statements as a tree that lets us build these rules automatically... I.e. given some input example set $(x_1, y_1), ..., (x_N, y_N)$... what is the best set of rules that describes what value $y$ has given a new input $x$? ID3 and alike lets us automatically create these rules. It is not really about the tree once built, it is about how we created it. Apart from that one hardly ever uses a decision tree alone, the reason being precisely what you say: it is a pretty simplistic model that lacks expressiveness. However, it has one big advantage over other models: One can compute a single decision tree quite fast. That means that we can come up with algorithms that train many many decision trees (boosting, aka AdaBoost and GradientBoosting) on big datasets. These collection of (usually more than 500) of these simplistic models (called forest) can then express much more complicated shapes. You could also imagine it like this: Given a 'nice' (i.e. continuous) but complicated function $f : [a,b] \to \mathbb{R}$ we could try to approximate this function using lines. If the function is complicated (like $sin(x)$ or so) then we produce a big error. However, we could combine lines in the way that we divide the interval $[a,b]$ into smaller parts $a = a_0 < a_1 < ... < a_M = b$ and on each $a_i, a_{i+1}$ we try to approximize $f|_{(a_i, a_{i+1})}$ (that is, $f$ restricted to this interval) by a line. By basic math (analysis) we can then approximate the function arbitrarily close (i.e. make an arbitrarily small error) if we take enough lines. Hence, we built up a complicated but accurate model from very simple ones. That is exactly the same idea that (for example) GradientBoosting uses: It builds a forest from very 'stupid' single decision trees.
What is the purpose of using a decision tree? The way I see it is, it is a series of if-else. Why don't I just use if-else instead of using a decision tree? You are absolutely right. A decision tree is nothing else but a series of if-else statem
30,153
What is the purpose of using a decision tree?
Just adding to @Fabian Werner’s answer - do you remember doing Riemann Sums rule in an intro to integration? Well that too was a set of evenly partitioned if statements which you use to calculate the area under the function. If you draw a 1D function and draw the partitions evenly what you will find is that in areas where the function has little gradient, neighboring partitions can be merged together without a great loss in accuracy. Equally, in partitions with high gradient adding more partitions will significantly improve the approximation. Any set of partitions will approximate the function but some are clearly better than others. Now, moving to CART models - we see data in the form of noisy points from this function and we are asked to approximate the function. By adding too many partitions we can overfit and essentially perform a nearest neighbor type model. To avoid this we limit the number of partitions our model can use (usually in the form of max depth and min samples per split). So now where should we place these splits? That is the question addressed by the splitting criteria. Areas with higher “complexity” should receive more splits as a rule of thumb and that is what gini, entropy, etc. endeavour to do. Making predictions are just if-else statements but in the context of machine learning that is not where the power of the model comes from. The power comes from the model's ability to trade off over and under fit in a scalable manner and can be derived in a consistent probabilistic framework with theoretical guarantees in the limit of data. Finally, if we take a similar abstracted view of ML models we can say neural networks, kernel methods, Monte Carlo approaches and many more are simply addition and multiplication. Unfortunately, that is not a very useful view of the literature.
What is the purpose of using a decision tree?
Just adding to @Fabian Werner’s answer - do you remember doing Riemann Sums rule in an intro to integration? Well that too was a set of evenly partitioned if statements which you use to calculate the
What is the purpose of using a decision tree? Just adding to @Fabian Werner’s answer - do you remember doing Riemann Sums rule in an intro to integration? Well that too was a set of evenly partitioned if statements which you use to calculate the area under the function. If you draw a 1D function and draw the partitions evenly what you will find is that in areas where the function has little gradient, neighboring partitions can be merged together without a great loss in accuracy. Equally, in partitions with high gradient adding more partitions will significantly improve the approximation. Any set of partitions will approximate the function but some are clearly better than others. Now, moving to CART models - we see data in the form of noisy points from this function and we are asked to approximate the function. By adding too many partitions we can overfit and essentially perform a nearest neighbor type model. To avoid this we limit the number of partitions our model can use (usually in the form of max depth and min samples per split). So now where should we place these splits? That is the question addressed by the splitting criteria. Areas with higher “complexity” should receive more splits as a rule of thumb and that is what gini, entropy, etc. endeavour to do. Making predictions are just if-else statements but in the context of machine learning that is not where the power of the model comes from. The power comes from the model's ability to trade off over and under fit in a scalable manner and can be derived in a consistent probabilistic framework with theoretical guarantees in the limit of data. Finally, if we take a similar abstracted view of ML models we can say neural networks, kernel methods, Monte Carlo approaches and many more are simply addition and multiplication. Unfortunately, that is not a very useful view of the literature.
What is the purpose of using a decision tree? Just adding to @Fabian Werner’s answer - do you remember doing Riemann Sums rule in an intro to integration? Well that too was a set of evenly partitioned if statements which you use to calculate the
30,154
What is the purpose of using a decision tree?
A decision tree is a partitioning of the problem domain in subsets, by means of conditions. It is usually implemented as cascaded if-then-elses. You can see it as a term that describes a complex decision logic. Decision trees are neither more efficient nor more "supportive" of machine learning than logical tests. They are logical tests. Also keep in mind that any algorithm is nothing more than a combination of arithmetic computations and tests, i.e. a (usually huge) decision tree. For completeness, let us mention that in some contexts, such as machine learning, complex decision trees are built automatically, by algorithms. But this doesn't change their nature.
What is the purpose of using a decision tree?
A decision tree is a partitioning of the problem domain in subsets, by means of conditions. It is usually implemented as cascaded if-then-elses. You can see it as a term that describes a complex decis
What is the purpose of using a decision tree? A decision tree is a partitioning of the problem domain in subsets, by means of conditions. It is usually implemented as cascaded if-then-elses. You can see it as a term that describes a complex decision logic. Decision trees are neither more efficient nor more "supportive" of machine learning than logical tests. They are logical tests. Also keep in mind that any algorithm is nothing more than a combination of arithmetic computations and tests, i.e. a (usually huge) decision tree. For completeness, let us mention that in some contexts, such as machine learning, complex decision trees are built automatically, by algorithms. But this doesn't change their nature.
What is the purpose of using a decision tree? A decision tree is a partitioning of the problem domain in subsets, by means of conditions. It is usually implemented as cascaded if-then-elses. You can see it as a term that describes a complex decis
30,155
Why is data augmentation classified as a type of regularization?
Regularization (traditionally in the context of shrinkage) adds prior knowledge to a model; a prior, literally, is specified for the parameters. Augmentation is also a form of adding prior knowledge to a model; e.g. images are rotated, which you know does not change the class label. Increasing training data (as with augmentation) decreases a model's variance. Regularization also decreases a model's variance. They do so in different ways, but ultimately both decrease regularization error. Section 5.2.2 of Goodfellow et al's Deep Learning proposes a much broader definition: Regularization is any modification we make to a learning algorithm that is intended to reduce its generalization error but not its training error. There is a tendency to asssociate regularization with shrinkage because of the term "l-p norm regularization"...perhaps "augmentation regularization" is equally valid, although it doesn't roll off the tongue.
Why is data augmentation classified as a type of regularization?
Regularization (traditionally in the context of shrinkage) adds prior knowledge to a model; a prior, literally, is specified for the parameters. Augmentation is also a form of adding prior knowledge
Why is data augmentation classified as a type of regularization? Regularization (traditionally in the context of shrinkage) adds prior knowledge to a model; a prior, literally, is specified for the parameters. Augmentation is also a form of adding prior knowledge to a model; e.g. images are rotated, which you know does not change the class label. Increasing training data (as with augmentation) decreases a model's variance. Regularization also decreases a model's variance. They do so in different ways, but ultimately both decrease regularization error. Section 5.2.2 of Goodfellow et al's Deep Learning proposes a much broader definition: Regularization is any modification we make to a learning algorithm that is intended to reduce its generalization error but not its training error. There is a tendency to asssociate regularization with shrinkage because of the term "l-p norm regularization"...perhaps "augmentation regularization" is equally valid, although it doesn't roll off the tongue.
Why is data augmentation classified as a type of regularization? Regularization (traditionally in the context of shrinkage) adds prior knowledge to a model; a prior, literally, is specified for the parameters. Augmentation is also a form of adding prior knowledge
30,156
Why is data augmentation classified as a type of regularization?
User99889 had a good answer (+1), I will add some comments to elaborate the points. The goal of regularization is reducing the Variance and increase Bias in Bias Variance Trade Off. This can be achieved in different ways, here are some examples: Increase the amount of the data, collect new data or derive new data from existing data / data augmentation. Reduce the complex of the model. For example, reduce the hidden layers or number of units in the hidden layer. Put constraints in the coefficients/parameters. For example, L1 or L2 regularization. We will further to explain why User99889 mentioned about "add prior / domain knowledge". Let use MNIST data as an example, we can create more data by using the following knowledge: If we re-scale digit, the label will not be changed If we shift digit, the label will not be changed Then, we have more data using domain knowledge and the model will have more Bias.
Why is data augmentation classified as a type of regularization?
User99889 had a good answer (+1), I will add some comments to elaborate the points. The goal of regularization is reducing the Variance and increase Bias in Bias Variance Trade Off. This can be achiev
Why is data augmentation classified as a type of regularization? User99889 had a good answer (+1), I will add some comments to elaborate the points. The goal of regularization is reducing the Variance and increase Bias in Bias Variance Trade Off. This can be achieved in different ways, here are some examples: Increase the amount of the data, collect new data or derive new data from existing data / data augmentation. Reduce the complex of the model. For example, reduce the hidden layers or number of units in the hidden layer. Put constraints in the coefficients/parameters. For example, L1 or L2 regularization. We will further to explain why User99889 mentioned about "add prior / domain knowledge". Let use MNIST data as an example, we can create more data by using the following knowledge: If we re-scale digit, the label will not be changed If we shift digit, the label will not be changed Then, we have more data using domain knowledge and the model will have more Bias.
Why is data augmentation classified as a type of regularization? User99889 had a good answer (+1), I will add some comments to elaborate the points. The goal of regularization is reducing the Variance and increase Bias in Bias Variance Trade Off. This can be achiev
30,157
Why is data augmentation classified as a type of regularization?
The objective of regularization is to improve the generalization capability of the model (in other words its ability to perform well on unseen data). Regularization can be explicit or implicit. The first case refers to techniques that can constrain the effective capacity of the model in order to reduce overfitting. Examples include adding a penalty term in standard statistical estimators such as OLS or weight decay and dropout in deep learning. In the second case (implicit regularization) instead of explicitly constraining the capacity of the model we use indirect methods. One example, is using SGD to train linear models as it always converges to a solution with a small norm (https://arxiv.org/pdf/1611.03530.pdf). Similarly, data augmentation (which has many forms e.g. adding predictors, adding artificially created data, resampling) will help the model to generalize better and is thus considered to be an implicit regularization method.
Why is data augmentation classified as a type of regularization?
The objective of regularization is to improve the generalization capability of the model (in other words its ability to perform well on unseen data). Regularization can be explicit or implicit. The fi
Why is data augmentation classified as a type of regularization? The objective of regularization is to improve the generalization capability of the model (in other words its ability to perform well on unseen data). Regularization can be explicit or implicit. The first case refers to techniques that can constrain the effective capacity of the model in order to reduce overfitting. Examples include adding a penalty term in standard statistical estimators such as OLS or weight decay and dropout in deep learning. In the second case (implicit regularization) instead of explicitly constraining the capacity of the model we use indirect methods. One example, is using SGD to train linear models as it always converges to a solution with a small norm (https://arxiv.org/pdf/1611.03530.pdf). Similarly, data augmentation (which has many forms e.g. adding predictors, adding artificially created data, resampling) will help the model to generalize better and is thus considered to be an implicit regularization method.
Why is data augmentation classified as a type of regularization? The objective of regularization is to improve the generalization capability of the model (in other words its ability to perform well on unseen data). Regularization can be explicit or implicit. The fi
30,158
Acceptance rate for Metropolis-Hastings > 0.5
The acceptance rate depends largely on the proposal distribution. If it has small variance, the ratio of the probabilities between the current point and the proposal will necessarily always be close to 1, giving a high acceptance chance. This is just because the target probability densities we typically work with are locally Lipschitz (a type of smoothness) at small scales, so the probability of two nearby points is similar (informally). If your current sample is close to the MAP value, the proposals will have less than one acceptance probability, but it can still be very close to 1. As a side note, standard practice is to tune the proposal distribution to get around a 0.2-0.25 acceptance rate. See here for a discussion of this.
Acceptance rate for Metropolis-Hastings > 0.5
The acceptance rate depends largely on the proposal distribution. If it has small variance, the ratio of the probabilities between the current point and the proposal will necessarily always be close t
Acceptance rate for Metropolis-Hastings > 0.5 The acceptance rate depends largely on the proposal distribution. If it has small variance, the ratio of the probabilities between the current point and the proposal will necessarily always be close to 1, giving a high acceptance chance. This is just because the target probability densities we typically work with are locally Lipschitz (a type of smoothness) at small scales, so the probability of two nearby points is similar (informally). If your current sample is close to the MAP value, the proposals will have less than one acceptance probability, but it can still be very close to 1. As a side note, standard practice is to tune the proposal distribution to get around a 0.2-0.25 acceptance rate. See here for a discussion of this.
Acceptance rate for Metropolis-Hastings > 0.5 The acceptance rate depends largely on the proposal distribution. If it has small variance, the ratio of the probabilities between the current point and the proposal will necessarily always be close t
30,159
Acceptance rate for Metropolis-Hastings > 0.5
An easy example of acceptance probability equal to one is when simulating from the exact target: in that case $$\dfrac{\pi(x')q(x',x)}{\pi(x)q(x,x')}=1\qquad\forall x,x'$$ While this sounds like an unrealistic example, a genuine illustration is the Gibbs sampler, which can be interpreted as a sequence of Metropolis-Hastings steps, all with probability one. A possible reason for your confusion is the potential perception of the Metropolis-Hastings algorithm as an optimisation algorithm. The algorithm spends more iterations on higher target regions but does not aim at the maximum. And while $\pi(x^\text{MAP})\ge\pi(x)$ for all $x$'s, this does not mean values with lower target values are necessarily rejected, since the proposal values $q(x^\text{MAP},x)$ and $q(x,x^\text{MAP})$ also matter.
Acceptance rate for Metropolis-Hastings > 0.5
An easy example of acceptance probability equal to one is when simulating from the exact target: in that case $$\dfrac{\pi(x')q(x',x)}{\pi(x)q(x,x')}=1\qquad\forall x,x'$$ While this sounds like an un
Acceptance rate for Metropolis-Hastings > 0.5 An easy example of acceptance probability equal to one is when simulating from the exact target: in that case $$\dfrac{\pi(x')q(x',x)}{\pi(x)q(x,x')}=1\qquad\forall x,x'$$ While this sounds like an unrealistic example, a genuine illustration is the Gibbs sampler, which can be interpreted as a sequence of Metropolis-Hastings steps, all with probability one. A possible reason for your confusion is the potential perception of the Metropolis-Hastings algorithm as an optimisation algorithm. The algorithm spends more iterations on higher target regions but does not aim at the maximum. And while $\pi(x^\text{MAP})\ge\pi(x)$ for all $x$'s, this does not mean values with lower target values are necessarily rejected, since the proposal values $q(x^\text{MAP},x)$ and $q(x,x^\text{MAP})$ also matter.
Acceptance rate for Metropolis-Hastings > 0.5 An easy example of acceptance probability equal to one is when simulating from the exact target: in that case $$\dfrac{\pi(x')q(x',x)}{\pi(x)q(x,x')}=1\qquad\forall x,x'$$ While this sounds like an un
30,160
When (and why) do Bayesians reject valid Bayesian methods? [closed]
I would like to correct an erroneous assumption in the original post, a mistake which is relatively common. The OP says: From what I have read and from answers to other questions I have asked here, maximum likelihood estimation corresponds mathematically (I don't care if it corresponds philosophically, I only care whether it corresponds mathematically) to maximum a priori estimation using a uniform prior (for those who object to this, see the note at the bottom of this question). And the note at the bottom of the post says: Two objects are equivalent in a mathematical sense if they have the same properties, irrespective of how they are constructed. [...] My objection is that, philosophy aside, maximum likelihood estimation (MLE) and maximum-a-posteriori (MAP) estimation do not have the same mathematical properties. Crucially, MLE and MAP transform differently under (nonlinear) reparametrization of the space. This happens because MLE has a "flat prior" in every parametrization, whereas MAP doesn't (the prior transforms as a probability density, so there is a Jacobian term). The definition of a mathematical object includes how the object behaves under operators such as transformation of variables (e.g., see the definition a tensor). In conclusion, MLE and MAP are not the same thing, neither philosophically nor mathematically; this is not an opinion.
When (and why) do Bayesians reject valid Bayesian methods? [closed]
I would like to correct an erroneous assumption in the original post, a mistake which is relatively common. The OP says: From what I have read and from answers to other questions I have asked here, m
When (and why) do Bayesians reject valid Bayesian methods? [closed] I would like to correct an erroneous assumption in the original post, a mistake which is relatively common. The OP says: From what I have read and from answers to other questions I have asked here, maximum likelihood estimation corresponds mathematically (I don't care if it corresponds philosophically, I only care whether it corresponds mathematically) to maximum a priori estimation using a uniform prior (for those who object to this, see the note at the bottom of this question). And the note at the bottom of the post says: Two objects are equivalent in a mathematical sense if they have the same properties, irrespective of how they are constructed. [...] My objection is that, philosophy aside, maximum likelihood estimation (MLE) and maximum-a-posteriori (MAP) estimation do not have the same mathematical properties. Crucially, MLE and MAP transform differently under (nonlinear) reparametrization of the space. This happens because MLE has a "flat prior" in every parametrization, whereas MAP doesn't (the prior transforms as a probability density, so there is a Jacobian term). The definition of a mathematical object includes how the object behaves under operators such as transformation of variables (e.g., see the definition a tensor). In conclusion, MLE and MAP are not the same thing, neither philosophically nor mathematically; this is not an opinion.
When (and why) do Bayesians reject valid Bayesian methods? [closed] I would like to correct an erroneous assumption in the original post, a mistake which is relatively common. The OP says: From what I have read and from answers to other questions I have asked here, m
30,161
When (and why) do Bayesians reject valid Bayesian methods? [closed]
Personally I am a "pragmatist" rather than a "frequentist" or a "Bayesian", so I cannot claim to speak for any camp. That said, I think the distinction you are alluding to is probably not so much MLE vs. MAP, but between point estimates vs. estimating posterior PDFs. As a scientist working in a field with sparse data and large uncertainties, I can sympathize with not wanting to put too much confidence on "best guess" results which may be misleading, resulting in overconfidence. A related practical distinction is between parametric vs. non-parametric methods. So for example I think that both Kalman filtering and Particle filtering would be accepted as Recursive Bayesian Estimation. But the Gaussian assumption of Kalman filtering (a parametric method) can give very misleading results if the posterior is not unimodal. To me these kinds of engineering examples highlight where differences are neither philosophical nor mathematical, but manifest in terms of practical results (i.e. will your autonomous vehicle crash?). For the Bayesian enthusiasts I am familiar with, this "see what works" engineering-style attitude seems to be predominant ... not sure if this is true more broadly.
When (and why) do Bayesians reject valid Bayesian methods? [closed]
Personally I am a "pragmatist" rather than a "frequentist" or a "Bayesian", so I cannot claim to speak for any camp. That said, I think the distinction you are alluding to is probably not so much MLE
When (and why) do Bayesians reject valid Bayesian methods? [closed] Personally I am a "pragmatist" rather than a "frequentist" or a "Bayesian", so I cannot claim to speak for any camp. That said, I think the distinction you are alluding to is probably not so much MLE vs. MAP, but between point estimates vs. estimating posterior PDFs. As a scientist working in a field with sparse data and large uncertainties, I can sympathize with not wanting to put too much confidence on "best guess" results which may be misleading, resulting in overconfidence. A related practical distinction is between parametric vs. non-parametric methods. So for example I think that both Kalman filtering and Particle filtering would be accepted as Recursive Bayesian Estimation. But the Gaussian assumption of Kalman filtering (a parametric method) can give very misleading results if the posterior is not unimodal. To me these kinds of engineering examples highlight where differences are neither philosophical nor mathematical, but manifest in terms of practical results (i.e. will your autonomous vehicle crash?). For the Bayesian enthusiasts I am familiar with, this "see what works" engineering-style attitude seems to be predominant ... not sure if this is true more broadly.
When (and why) do Bayesians reject valid Bayesian methods? [closed] Personally I am a "pragmatist" rather than a "frequentist" or a "Bayesian", so I cannot claim to speak for any camp. That said, I think the distinction you are alluding to is probably not so much MLE
30,162
When (and why) do Bayesians reject valid Bayesian methods? [closed]
Many people who self-describe as "Bayesians", however, seem to reject using maximum likelihood estimation under any circumstances, even though it is a special case of (mathematically) Bayesian methods, because it is a "frequentist method". Such people would be rejecting MLE as a general method for making point estimates. In particular cases where they had reason to use a uniform prior & wanted to make a maximum a posteriori estimate they wouldn't be at all bothered by the coincidence of their calculations with MLE. Apparently Bayesians also use a restricted/limited number of distributions compared to frequentists, even though those distributions would also be mathematically correct from a Bayesian viewpoint. Perhaps sometimes, to make their calculations easier, but not from any point of principle. I have the impression that there are at least two different definitions of the term Bayesian commonly in use. The first I would call "mathematically Bayesian" which encompasses all methods of statistics, since it includes parameters which are constant RVs and those which are not constant RVs. Then there is "culturally Bayesian" which rejects some "mathematically Bayesian" methods because those methods are "frequentist" (i.e. out of personal animosity to the parameter sometimes being modeled as a constant or frequency). There are certainly distinctions to be made between different approaches to Bayesian inference, but not this one. If there's a sense in which Bayesianism is more general, it's in the willingness to apply the concept of probability to epistemic uncertainty about parameter values & not just the aleatory uncertainty of the data-generating process which is all that frequentism concerns itself with. Frequentist inference is not a special case of Bayesian inference & none of the answers or comments at Is there any mathematical basis for the Bayesian vs frequentist debate? are implying that it is. If in a Bayesian approach you were to consider the parameter a constant random variable, you'd obtain the same posterior whatever the data are—& to say it's constant but you don't know what value it takes wouldn't be to say anything worth saying. The frequentist approach takes an entirely different tack & doesn't involve the calculation of posterior distributions at all.
When (and why) do Bayesians reject valid Bayesian methods? [closed]
Many people who self-describe as "Bayesians", however, seem to reject using maximum likelihood estimation under any circumstances, even though it is a special case of (mathematically) Bayesian met
When (and why) do Bayesians reject valid Bayesian methods? [closed] Many people who self-describe as "Bayesians", however, seem to reject using maximum likelihood estimation under any circumstances, even though it is a special case of (mathematically) Bayesian methods, because it is a "frequentist method". Such people would be rejecting MLE as a general method for making point estimates. In particular cases where they had reason to use a uniform prior & wanted to make a maximum a posteriori estimate they wouldn't be at all bothered by the coincidence of their calculations with MLE. Apparently Bayesians also use a restricted/limited number of distributions compared to frequentists, even though those distributions would also be mathematically correct from a Bayesian viewpoint. Perhaps sometimes, to make their calculations easier, but not from any point of principle. I have the impression that there are at least two different definitions of the term Bayesian commonly in use. The first I would call "mathematically Bayesian" which encompasses all methods of statistics, since it includes parameters which are constant RVs and those which are not constant RVs. Then there is "culturally Bayesian" which rejects some "mathematically Bayesian" methods because those methods are "frequentist" (i.e. out of personal animosity to the parameter sometimes being modeled as a constant or frequency). There are certainly distinctions to be made between different approaches to Bayesian inference, but not this one. If there's a sense in which Bayesianism is more general, it's in the willingness to apply the concept of probability to epistemic uncertainty about parameter values & not just the aleatory uncertainty of the data-generating process which is all that frequentism concerns itself with. Frequentist inference is not a special case of Bayesian inference & none of the answers or comments at Is there any mathematical basis for the Bayesian vs frequentist debate? are implying that it is. If in a Bayesian approach you were to consider the parameter a constant random variable, you'd obtain the same posterior whatever the data are—& to say it's constant but you don't know what value it takes wouldn't be to say anything worth saying. The frequentist approach takes an entirely different tack & doesn't involve the calculation of posterior distributions at all.
When (and why) do Bayesians reject valid Bayesian methods? [closed] Many people who self-describe as "Bayesians", however, seem to reject using maximum likelihood estimation under any circumstances, even though it is a special case of (mathematically) Bayesian met
30,163
Set of uncorrelated but linearly dependent variables
As @RUser4512's answer shows, uncorrelated random variables cannot be linearly dependent. But, nearly uncorrelated random variables can be linearly dependent, and one example of these is something dear to the statistician's heart. Suppose that $\{X_i\}_{i=1}^K$ is a set of $K$ uncorrelated unit-variance random variables with common mean $\mu$. Define $Y_i = X_i - \bar{X}$ where $\bar{X} = \frac 1K \sum_{i=1}^K X_i$. Then, the $Y_i$ are zero-mean random variables such that $\sum_{i=1}^K Y_i = 0$, that is, they are linearly dependent. Now, $$Y_i = \frac{K-1}{K} X_i - \frac 1K\sum_{j \neq i}X_j$$ so that $$\operatorname{var}(Y_i) = \left(\frac{K-1}{K}\right)^2+\frac{K-1}{K^2} = \frac{K-1}{K}$$ while $$\operatorname{cov}(Y_i,Y_j) = -2\left(\frac{K-1}{K}\right)\frac 1K + \frac{K-2}{K^2}= \frac{-1}{K}$$ showing that the $Y_i$ are nearly uncorrelated random variables with correlation coefficient $\displaystyle -\frac{1}{K-1}$. See also this earlier answer of mine.
Set of uncorrelated but linearly dependent variables
As @RUser4512's answer shows, uncorrelated random variables cannot be linearly dependent. But, nearly uncorrelated random variables can be linearly dependent, and one example of these is something dea
Set of uncorrelated but linearly dependent variables As @RUser4512's answer shows, uncorrelated random variables cannot be linearly dependent. But, nearly uncorrelated random variables can be linearly dependent, and one example of these is something dear to the statistician's heart. Suppose that $\{X_i\}_{i=1}^K$ is a set of $K$ uncorrelated unit-variance random variables with common mean $\mu$. Define $Y_i = X_i - \bar{X}$ where $\bar{X} = \frac 1K \sum_{i=1}^K X_i$. Then, the $Y_i$ are zero-mean random variables such that $\sum_{i=1}^K Y_i = 0$, that is, they are linearly dependent. Now, $$Y_i = \frac{K-1}{K} X_i - \frac 1K\sum_{j \neq i}X_j$$ so that $$\operatorname{var}(Y_i) = \left(\frac{K-1}{K}\right)^2+\frac{K-1}{K^2} = \frac{K-1}{K}$$ while $$\operatorname{cov}(Y_i,Y_j) = -2\left(\frac{K-1}{K}\right)\frac 1K + \frac{K-2}{K^2}= \frac{-1}{K}$$ showing that the $Y_i$ are nearly uncorrelated random variables with correlation coefficient $\displaystyle -\frac{1}{K-1}$. See also this earlier answer of mine.
Set of uncorrelated but linearly dependent variables As @RUser4512's answer shows, uncorrelated random variables cannot be linearly dependent. But, nearly uncorrelated random variables can be linearly dependent, and one example of these is something dea
30,164
Set of uncorrelated but linearly dependent variables
No. Suppose one of the $a_i$ is non zero. Without loss of generality, let's assume $a_1=1$. For $K=2$, this implies $x_1=-a_2x_2$ and $cor(x_1,x_2)=-1$. But this correlation is zero. $a_1$ must be zero as well, contradicting the existence of a linear relationship. For any $K$, $x_1=-\sum_{i>1}a_ix_i$ and $cor(x_1,x_k)=-1$. But, by you hypothesis, $cor(x_1,x_k)=0$. The $a_i$'s are zero (for $i>1$) and so must be $a_1$.
Set of uncorrelated but linearly dependent variables
No. Suppose one of the $a_i$ is non zero. Without loss of generality, let's assume $a_1=1$. For $K=2$, this implies $x_1=-a_2x_2$ and $cor(x_1,x_2)=-1$. But this correlation is zero. $a_1$ must be zer
Set of uncorrelated but linearly dependent variables No. Suppose one of the $a_i$ is non zero. Without loss of generality, let's assume $a_1=1$. For $K=2$, this implies $x_1=-a_2x_2$ and $cor(x_1,x_2)=-1$. But this correlation is zero. $a_1$ must be zero as well, contradicting the existence of a linear relationship. For any $K$, $x_1=-\sum_{i>1}a_ix_i$ and $cor(x_1,x_k)=-1$. But, by you hypothesis, $cor(x_1,x_k)=0$. The $a_i$'s are zero (for $i>1$) and so must be $a_1$.
Set of uncorrelated but linearly dependent variables No. Suppose one of the $a_i$ is non zero. Without loss of generality, let's assume $a_1=1$. For $K=2$, this implies $x_1=-a_2x_2$ and $cor(x_1,x_2)=-1$. But this correlation is zero. $a_1$ must be zer
30,165
Set of uncorrelated but linearly dependent variables
This may be cheating a bit, but if we define ‘uncorrelated’ as having a covariance of 0, the answer is yes. Let $X$ and $Y$ both be zero with probability 1. Then $\mathop{\mathrm{Cov}}(X,Y)= \mathop{\mathrm{E}}(XY)-\mathop{\mathrm{E}}(X)\mathop{\mathrm{E}}(Y)=0-0=0$ while $X+Y=0$, so $X$ and $Y$ are linearly dependent (by your definition). Though if you require that the correlation is defined, i.e. that the variances of both $X$ and $Y$ are strictly positive, it’s not possible to find variables fulfilling your criteria (see the other answers).
Set of uncorrelated but linearly dependent variables
This may be cheating a bit, but if we define ‘uncorrelated’ as having a covariance of 0, the answer is yes. Let $X$ and $Y$ both be zero with probability 1. Then $\mathop{\mathrm{Cov}}(X,Y)= \mathop{\
Set of uncorrelated but linearly dependent variables This may be cheating a bit, but if we define ‘uncorrelated’ as having a covariance of 0, the answer is yes. Let $X$ and $Y$ both be zero with probability 1. Then $\mathop{\mathrm{Cov}}(X,Y)= \mathop{\mathrm{E}}(XY)-\mathop{\mathrm{E}}(X)\mathop{\mathrm{E}}(Y)=0-0=0$ while $X+Y=0$, so $X$ and $Y$ are linearly dependent (by your definition). Though if you require that the correlation is defined, i.e. that the variances of both $X$ and $Y$ are strictly positive, it’s not possible to find variables fulfilling your criteria (see the other answers).
Set of uncorrelated but linearly dependent variables This may be cheating a bit, but if we define ‘uncorrelated’ as having a covariance of 0, the answer is yes. Let $X$ and $Y$ both be zero with probability 1. Then $\mathop{\mathrm{Cov}}(X,Y)= \mathop{\
30,166
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
No, you should not use the Mann-Whitney $U$ test in this circumstance. Here's why: Dunn's test is an appropriate post hoc test* following rejection of a Kruskal-Wallis test. If one proceeds by moving from a rejection of Kruskal-Wallis to performing ordinary pair-wise rank sum (i.e. Wilcoxon or Mann-Whitney) tests, then two problems obtain: (1) the ranks used for the pair-wise rank sum tests are not the ranks used by the Kruskal-Wallis test; and (2) the rank sum tests do not use the pooled variance implied by the Kruskal-Wallis null hypothesis. Dunn's test does not have these problems. Post hoc tests following rejection of a Kruskal-Wallis test which have been adjusted for multiple comparisons may fail to reject all pairwise tests for a given family-wise error rate or given false discovery rate corresponding to a given $\alpha$ for the omnibus test, just as with any other multiple comparison omnibus/post hoc testing scenario. Unless you have reason to believe that one group's survival time is longer or shorter than another's a priori, you should be using the two-sided tests. Dunn's test can be performed in Stata using dunntest (type net describe dunntest, from(https://www.alexisdinno.com/stata)), and in R using the dunn.test package. Also, I wonder if you might take a survival analysis approach to assessing whether and when an animal dies based on different conditions? * A few less well-known post hoc pair-wise tests to follow a rejected Kruskal-Wallis, include Conover-Iman (like Dunn, but based on the t distribution, rather than the z distribution, implemented for Stata in the conovertest package, and for R in the conover.test package), and the Dwass-Steel-Citchlow-Fligner tests.
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
No, you should not use the Mann-Whitney $U$ test in this circumstance. Here's why: Dunn's test is an appropriate post hoc test* following rejection of a Kruskal-Wallis test. If one proceeds by moving
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? No, you should not use the Mann-Whitney $U$ test in this circumstance. Here's why: Dunn's test is an appropriate post hoc test* following rejection of a Kruskal-Wallis test. If one proceeds by moving from a rejection of Kruskal-Wallis to performing ordinary pair-wise rank sum (i.e. Wilcoxon or Mann-Whitney) tests, then two problems obtain: (1) the ranks used for the pair-wise rank sum tests are not the ranks used by the Kruskal-Wallis test; and (2) the rank sum tests do not use the pooled variance implied by the Kruskal-Wallis null hypothesis. Dunn's test does not have these problems. Post hoc tests following rejection of a Kruskal-Wallis test which have been adjusted for multiple comparisons may fail to reject all pairwise tests for a given family-wise error rate or given false discovery rate corresponding to a given $\alpha$ for the omnibus test, just as with any other multiple comparison omnibus/post hoc testing scenario. Unless you have reason to believe that one group's survival time is longer or shorter than another's a priori, you should be using the two-sided tests. Dunn's test can be performed in Stata using dunntest (type net describe dunntest, from(https://www.alexisdinno.com/stata)), and in R using the dunn.test package. Also, I wonder if you might take a survival analysis approach to assessing whether and when an animal dies based on different conditions? * A few less well-known post hoc pair-wise tests to follow a rejected Kruskal-Wallis, include Conover-Iman (like Dunn, but based on the t distribution, rather than the z distribution, implemented for Stata in the conovertest package, and for R in the conover.test package), and the Dwass-Steel-Citchlow-Fligner tests.
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? No, you should not use the Mann-Whitney $U$ test in this circumstance. Here's why: Dunn's test is an appropriate post hoc test* following rejection of a Kruskal-Wallis test. If one proceeds by moving
30,167
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
A unifying generalization of Kruskal-Wallis/Wilcoxon is the proportional odds model, which admits general contrasts with either pointwise or simultaneous confidence intervals for odds ratios. This is implemented in my R rms package's orm and contrast.rms functions.
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
A unifying generalization of Kruskal-Wallis/Wilcoxon is the proportional odds model, which admits general contrasts with either pointwise or simultaneous confidence intervals for odds ratios. This is
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? A unifying generalization of Kruskal-Wallis/Wilcoxon is the proportional odds model, which admits general contrasts with either pointwise or simultaneous confidence intervals for odds ratios. This is implemented in my R rms package's orm and contrast.rms functions.
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? A unifying generalization of Kruskal-Wallis/Wilcoxon is the proportional odds model, which admits general contrasts with either pointwise or simultaneous confidence intervals for odds ratios. This is
30,168
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
You can also use the critical difference after Conover or the critical difference after Schaich and Hamerle. The former is more liberal whereas the latter is exact but lacks a bit of power. Both methods are illustrated on my website brightstat.com and brightstat's webapp also lets you calculate these critical differences and perform the post-hoc tests right away. Kruskal-Wallis on brightstat.com
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
You can also use the critical difference after Conover or the critical difference after Schaich and Hamerle. The former is more liberal whereas the latter is exact but lacks a bit of power. Both meth
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? You can also use the critical difference after Conover or the critical difference after Schaich and Hamerle. The former is more liberal whereas the latter is exact but lacks a bit of power. Both methods are illustrated on my website brightstat.com and brightstat's webapp also lets you calculate these critical differences and perform the post-hoc tests right away. Kruskal-Wallis on brightstat.com
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? You can also use the critical difference after Conover or the critical difference after Schaich and Hamerle. The former is more liberal whereas the latter is exact but lacks a bit of power. Both meth
30,169
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
If you are using SPSS, do the post-hoc Mann-Whitney with Bonferroni correction (p value divided by the number of groups).
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis?
If you are using SPSS, do the post-hoc Mann-Whitney with Bonferroni correction (p value divided by the number of groups).
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? If you are using SPSS, do the post-hoc Mann-Whitney with Bonferroni correction (p value divided by the number of groups).
Can Mann-Whitney test be used for post-hoc comparisons after Kruskal-Wallis? If you are using SPSS, do the post-hoc Mann-Whitney with Bonferroni correction (p value divided by the number of groups).
30,170
What is a Gaussian Discriminant Analysis (GDA)?
GDA, is a method for data classification commonly used when data can be approximated with a Normal distribution. As first step, you will need a training set, i.e. a bunch of data yet classified. These data are used to train your classifier, and obtain a discriminant function that will tell you to which class a data has higher probability to belong. When you have your training set you need to compute the mean $\mu$ and the standard deviation $\sigma^2$. These two variables, as you know, allow you to describe a Normal distribution. Once you have computed the Normal distribution for each class, to classify a data you will need to compute, for each one, the probability that that data belongs to it. The class with the highest probability will be chosen as the affinity class. More information about Discriminant Functions for the Normal Density can be found in textbook as Pattern Classification DUDA, HART, SOTRK or Pattern Recognition and Machine Learning BISHOP. A tutorial to GDA can also be found here Part1 and Part2
What is a Gaussian Discriminant Analysis (GDA)?
GDA, is a method for data classification commonly used when data can be approximated with a Normal distribution. As first step, you will need a training set, i.e. a bunch of data yet classified. Thes
What is a Gaussian Discriminant Analysis (GDA)? GDA, is a method for data classification commonly used when data can be approximated with a Normal distribution. As first step, you will need a training set, i.e. a bunch of data yet classified. These data are used to train your classifier, and obtain a discriminant function that will tell you to which class a data has higher probability to belong. When you have your training set you need to compute the mean $\mu$ and the standard deviation $\sigma^2$. These two variables, as you know, allow you to describe a Normal distribution. Once you have computed the Normal distribution for each class, to classify a data you will need to compute, for each one, the probability that that data belongs to it. The class with the highest probability will be chosen as the affinity class. More information about Discriminant Functions for the Normal Density can be found in textbook as Pattern Classification DUDA, HART, SOTRK or Pattern Recognition and Machine Learning BISHOP. A tutorial to GDA can also be found here Part1 and Part2
What is a Gaussian Discriminant Analysis (GDA)? GDA, is a method for data classification commonly used when data can be approximated with a Normal distribution. As first step, you will need a training set, i.e. a bunch of data yet classified. Thes
30,171
What is a Gaussian Discriminant Analysis (GDA)?
I think Andrew Ng's notes on GDA (https://web.archive.org/web/20200103035702/http://cs229.stanford.edu/notes/cs229-notes2.pdf) are the best explanation I have seen of the concept, but I want to "try to explain this for someone at a high-school level" as requested (and relate it back to Andrew's notes for those of you who care for the math). Imagine that you have two classes. Describe one class as $y=0$ and one class as $y=1$. Could be $apples$ vs $oranges$, for example. You have a datapoint $x$ that describes an observation of one of these things. An observation could be, i.e., $[price, diameter, weight, color]$. It can be a collection of any attributes that can be measured, and you can measure as many things to describe an $x$ as you like. If we measure 4 different things to describe an $x$, then we say $x$ is 4 dimensional. In general we'll call this $d$. Here's the model of GDA from Andrew's notes: In plain English this says: $p(y)$ can be described as an unfair coin-flip. For example it might be that $p(y=0) = 0.4$ and $p(y=1) = 0.6$. I.e. there's a 40% chance that things are apples and 60% chance that things are oranges, period, out there in the world. Given $y=0$ (i.e. if we can assume the thing is an apple), all the measurements in x are normally distributed with some set of parameters $\mu_0$ and $\Sigma$. $\mu_0$ is not one value - it is a $d$-dimensional vector. To define a normal distribution we need a $\mu$ for each dimension of x (mean price, mean weight, etc) and also a $d$x$d$ covariance matrix $\Sigma$ that describes how the dimensions relate to each other. Why? Because certain things might be correlated (i.e. large fruit probably weighs more). We assume that if $y=1$ (the thing is an orange), its measurements behave normally as well. Except their means are different and we describe those with $\mu_1$. We use the same $\Sigma$ though.1 Ok...after all that setup, do a thought experiment: Flip a unfair coin that determines if something is apple or orange. Then based on that result, go to Normal Distribution 0 or Normal Distribution 1, and sample a datapoint. If you repeat this many times you'll get a ton of datapoints in $d$-dimensional space. The distribution of this data, provided we have enough of it, will be "typical" of the specific model that we are generating from. (hence why his note is called "Generative Learning algorithms") But what if we do this backwards? I give you a bunch of data instead, and I tell you that it was generated in such a fashion. You could then, conversely, come back and tell me the probability on the coin, and the $\mu$s and $\Sigma$s of the two Normal distributions, that fit this data as best as possible. This backwards exercise is GDA. 1 Note that Andrew's model uses the same covariance matrix $\Sigma$ for both classes. This means that whatever my normal distribution looks like for one class - however tall/fat/slanty it is - I assume the other class' covariance matrix looks exactly like that as well. When $\Sigma$ is the same between classes, we have a special case of GDA called Linear Discriminant Analysis, because it results in a linear decision boundary (see pic below from Andrew's notes). This assumption can certainly be false, and GDA describes this exercise in the most general case, when $\Sigma$s can be different between classes.
What is a Gaussian Discriminant Analysis (GDA)?
I think Andrew Ng's notes on GDA (https://web.archive.org/web/20200103035702/http://cs229.stanford.edu/notes/cs229-notes2.pdf) are the best explanation I have seen of the concept, but I want to "try t
What is a Gaussian Discriminant Analysis (GDA)? I think Andrew Ng's notes on GDA (https://web.archive.org/web/20200103035702/http://cs229.stanford.edu/notes/cs229-notes2.pdf) are the best explanation I have seen of the concept, but I want to "try to explain this for someone at a high-school level" as requested (and relate it back to Andrew's notes for those of you who care for the math). Imagine that you have two classes. Describe one class as $y=0$ and one class as $y=1$. Could be $apples$ vs $oranges$, for example. You have a datapoint $x$ that describes an observation of one of these things. An observation could be, i.e., $[price, diameter, weight, color]$. It can be a collection of any attributes that can be measured, and you can measure as many things to describe an $x$ as you like. If we measure 4 different things to describe an $x$, then we say $x$ is 4 dimensional. In general we'll call this $d$. Here's the model of GDA from Andrew's notes: In plain English this says: $p(y)$ can be described as an unfair coin-flip. For example it might be that $p(y=0) = 0.4$ and $p(y=1) = 0.6$. I.e. there's a 40% chance that things are apples and 60% chance that things are oranges, period, out there in the world. Given $y=0$ (i.e. if we can assume the thing is an apple), all the measurements in x are normally distributed with some set of parameters $\mu_0$ and $\Sigma$. $\mu_0$ is not one value - it is a $d$-dimensional vector. To define a normal distribution we need a $\mu$ for each dimension of x (mean price, mean weight, etc) and also a $d$x$d$ covariance matrix $\Sigma$ that describes how the dimensions relate to each other. Why? Because certain things might be correlated (i.e. large fruit probably weighs more). We assume that if $y=1$ (the thing is an orange), its measurements behave normally as well. Except their means are different and we describe those with $\mu_1$. We use the same $\Sigma$ though.1 Ok...after all that setup, do a thought experiment: Flip a unfair coin that determines if something is apple or orange. Then based on that result, go to Normal Distribution 0 or Normal Distribution 1, and sample a datapoint. If you repeat this many times you'll get a ton of datapoints in $d$-dimensional space. The distribution of this data, provided we have enough of it, will be "typical" of the specific model that we are generating from. (hence why his note is called "Generative Learning algorithms") But what if we do this backwards? I give you a bunch of data instead, and I tell you that it was generated in such a fashion. You could then, conversely, come back and tell me the probability on the coin, and the $\mu$s and $\Sigma$s of the two Normal distributions, that fit this data as best as possible. This backwards exercise is GDA. 1 Note that Andrew's model uses the same covariance matrix $\Sigma$ for both classes. This means that whatever my normal distribution looks like for one class - however tall/fat/slanty it is - I assume the other class' covariance matrix looks exactly like that as well. When $\Sigma$ is the same between classes, we have a special case of GDA called Linear Discriminant Analysis, because it results in a linear decision boundary (see pic below from Andrew's notes). This assumption can certainly be false, and GDA describes this exercise in the most general case, when $\Sigma$s can be different between classes.
What is a Gaussian Discriminant Analysis (GDA)? I think Andrew Ng's notes on GDA (https://web.archive.org/web/20200103035702/http://cs229.stanford.edu/notes/cs229-notes2.pdf) are the best explanation I have seen of the concept, but I want to "try t
30,172
What is a Gaussian Discriminant Analysis (GDA)?
GDA is a form of linear distribution analysis. From a known $P(x|y)$, $$P(y|x) = \frac{P(x|y)P_{prior}(y)}{\Sigma_{g \in Y} P(x|g) P_{prior}(g) }$$ is derived through applying Bayes's. It's basically, as @ttnphns noted, used usually as a generic label for any discriminant analysis that assumes a population that shows the Gaussian distribution. For a more in-depth explanation, read Fisher's 1936 paper in the Annals of Eugenics (yes, that's really what it was called). It's a hard and unrewarding read, but it is the source of the idea (a little warning: unlike wine, papers don't get better, and this one is very confusing to read when considering that it was written in a maths lingo that didn't use ideas like 'generative distribution analysis models', so there is a degree of terminological confusion here). I hereby shamefully admit that I am mostly self-taught, and my education on GDA has mainly been from a wonderful lecture (if that's your idea of fun) by Andrew Ng of Stanford that's well worth watching (and speaks about the subject in contemporary lingo).
What is a Gaussian Discriminant Analysis (GDA)?
GDA is a form of linear distribution analysis. From a known $P(x|y)$, $$P(y|x) = \frac{P(x|y)P_{prior}(y)}{\Sigma_{g \in Y} P(x|g) P_{prior}(g) }$$ is derived through applying Bayes's. It's basically,
What is a Gaussian Discriminant Analysis (GDA)? GDA is a form of linear distribution analysis. From a known $P(x|y)$, $$P(y|x) = \frac{P(x|y)P_{prior}(y)}{\Sigma_{g \in Y} P(x|g) P_{prior}(g) }$$ is derived through applying Bayes's. It's basically, as @ttnphns noted, used usually as a generic label for any discriminant analysis that assumes a population that shows the Gaussian distribution. For a more in-depth explanation, read Fisher's 1936 paper in the Annals of Eugenics (yes, that's really what it was called). It's a hard and unrewarding read, but it is the source of the idea (a little warning: unlike wine, papers don't get better, and this one is very confusing to read when considering that it was written in a maths lingo that didn't use ideas like 'generative distribution analysis models', so there is a degree of terminological confusion here). I hereby shamefully admit that I am mostly self-taught, and my education on GDA has mainly been from a wonderful lecture (if that's your idea of fun) by Andrew Ng of Stanford that's well worth watching (and speaks about the subject in contemporary lingo).
What is a Gaussian Discriminant Analysis (GDA)? GDA is a form of linear distribution analysis. From a known $P(x|y)$, $$P(y|x) = \frac{P(x|y)P_{prior}(y)}{\Sigma_{g \in Y} P(x|g) P_{prior}(g) }$$ is derived through applying Bayes's. It's basically,
30,173
Choosing between transformations in logistic regression
The optimality criterion used by logistic regression (and many other methods) is the likelihood function. It is used to estimate $\beta$ including multiple $\beta$ representing one $X$ to achieve quadratic, cubic, and piecewise polynomial (spline) fits. It can also be used to choose from among competing transformations of $X$ but the act of choosing will not be reflected in the information matrix, so the resulting variance of $X\hat{\beta}$ will be too small, making confidence intervals not have the stated coverage probability. If you make transformation estimation an explicit goal of model fitting (and regression splines are excellent ways to do this) you will preserve all aspects of statistical inference. Depending on the sample size, a restricted (linear in both tails) cubic spline with 4 knots, requiring 3 parameters, can be a good choice.
Choosing between transformations in logistic regression
The optimality criterion used by logistic regression (and many other methods) is the likelihood function. It is used to estimate $\beta$ including multiple $\beta$ representing one $X$ to achieve qua
Choosing between transformations in logistic regression The optimality criterion used by logistic regression (and many other methods) is the likelihood function. It is used to estimate $\beta$ including multiple $\beta$ representing one $X$ to achieve quadratic, cubic, and piecewise polynomial (spline) fits. It can also be used to choose from among competing transformations of $X$ but the act of choosing will not be reflected in the information matrix, so the resulting variance of $X\hat{\beta}$ will be too small, making confidence intervals not have the stated coverage probability. If you make transformation estimation an explicit goal of model fitting (and regression splines are excellent ways to do this) you will preserve all aspects of statistical inference. Depending on the sample size, a restricted (linear in both tails) cubic spline with 4 knots, requiring 3 parameters, can be a good choice.
Choosing between transformations in logistic regression The optimality criterion used by logistic regression (and many other methods) is the likelihood function. It is used to estimate $\beta$ including multiple $\beta$ representing one $X$ to achieve qua
30,174
Choosing between transformations in logistic regression
No, in linear models the transformation is not (or ought not) be done to have maximum correlation with the dependent variable. It should be done to either a) Meet model assumptions about the residuals or b) Have a more sensible explanatory variable; that is, one that makes sense, substantively. As @Andy points out, this may not be sufficient. But, in that case, I'd then look for an alternate method of regression (see below) rather than take some weird transformation. E.g. a model such as $Y = b_0 + b_1x_1^{.21} + b_2x_2^{.73}$ is going to be a mess to explain. In logistic regression (at least, in dichotomous logistic) there are fewer assumptions (and none about the residuals, as far as I know), so only b) applies. Even for linear models, I'd favor using b). And then, if the assumptions aren't met, using some other form of regression (could be robust regression, could be a spline model, could be polynomials).
Choosing between transformations in logistic regression
No, in linear models the transformation is not (or ought not) be done to have maximum correlation with the dependent variable. It should be done to either a) Meet model assumptions about the residuals
Choosing between transformations in logistic regression No, in linear models the transformation is not (or ought not) be done to have maximum correlation with the dependent variable. It should be done to either a) Meet model assumptions about the residuals or b) Have a more sensible explanatory variable; that is, one that makes sense, substantively. As @Andy points out, this may not be sufficient. But, in that case, I'd then look for an alternate method of regression (see below) rather than take some weird transformation. E.g. a model such as $Y = b_0 + b_1x_1^{.21} + b_2x_2^{.73}$ is going to be a mess to explain. In logistic regression (at least, in dichotomous logistic) there are fewer assumptions (and none about the residuals, as far as I know), so only b) applies. Even for linear models, I'd favor using b). And then, if the assumptions aren't met, using some other form of regression (could be robust regression, could be a spline model, could be polynomials).
Choosing between transformations in logistic regression No, in linear models the transformation is not (or ought not) be done to have maximum correlation with the dependent variable. It should be done to either a) Meet model assumptions about the residuals
30,175
Choosing between transformations in logistic regression
With generalized linear modeling the mathematical measure that is minimized is called the "deviance" (-2*log-likelihood). There are several sorts of residuals that can be developed. The "deviance residuals" are the individual terms in a modestly complex expression. I think these a most understandable when applied to categorical variables. For a categorical variable using logistic regression these are just the differences between the log-odds(model) and log-odds(data), but for continuous variables they are somewhat more complex. Deviance residuals are what are minimized in the iterative process. See this description at the UCLA website for some nice plots of deviance residuals. It looks to me that analysis of "lift" is done on the scale of probabilities, rather than on the log-odds or odds scale or likelihoods. I see that Frank Harrell has offered some advice and any perceived dispute between Frank and I should be resolved by massive weighting of Frank's opinion. (My advice would be to buy Frank's RMS book.) I'm surprised he didn't offer advice to consider penalized methods and that he didn't issue a caution against over-fitting. I would think that choosing a transformation simply because it maximized "lift" would be akin to choosing models that maximized "accuracy". I know he doesn't endorse that strategy.
Choosing between transformations in logistic regression
With generalized linear modeling the mathematical measure that is minimized is called the "deviance" (-2*log-likelihood). There are several sorts of residuals that can be developed. The "deviance resi
Choosing between transformations in logistic regression With generalized linear modeling the mathematical measure that is minimized is called the "deviance" (-2*log-likelihood). There are several sorts of residuals that can be developed. The "deviance residuals" are the individual terms in a modestly complex expression. I think these a most understandable when applied to categorical variables. For a categorical variable using logistic regression these are just the differences between the log-odds(model) and log-odds(data), but for continuous variables they are somewhat more complex. Deviance residuals are what are minimized in the iterative process. See this description at the UCLA website for some nice plots of deviance residuals. It looks to me that analysis of "lift" is done on the scale of probabilities, rather than on the log-odds or odds scale or likelihoods. I see that Frank Harrell has offered some advice and any perceived dispute between Frank and I should be resolved by massive weighting of Frank's opinion. (My advice would be to buy Frank's RMS book.) I'm surprised he didn't offer advice to consider penalized methods and that he didn't issue a caution against over-fitting. I would think that choosing a transformation simply because it maximized "lift" would be akin to choosing models that maximized "accuracy". I know he doesn't endorse that strategy.
Choosing between transformations in logistic regression With generalized linear modeling the mathematical measure that is minimized is called the "deviance" (-2*log-likelihood). There are several sorts of residuals that can be developed. The "deviance resi
30,176
What does a significant intercept mean in ANOVA?
The intercept is the estimate of the dependent variable when all the independent variables are 0. So, suppose you have a model such as Income ~ Sex Then if sex is coded as 0 for men and 1 for women, the intercept is the predicted value of income for men; if it is significant, it means that income for men is significantly different from 0. In most cases, the significance of the intercept is not particularly interesting. Indeed, you can easily change the intercept by recoding the independent variable, but this has no effect on the meaning of the model.
What does a significant intercept mean in ANOVA?
The intercept is the estimate of the dependent variable when all the independent variables are 0. So, suppose you have a model such as Income ~ Sex Then if sex is coded as 0 for men and 1 for women, t
What does a significant intercept mean in ANOVA? The intercept is the estimate of the dependent variable when all the independent variables are 0. So, suppose you have a model such as Income ~ Sex Then if sex is coded as 0 for men and 1 for women, the intercept is the predicted value of income for men; if it is significant, it means that income for men is significantly different from 0. In most cases, the significance of the intercept is not particularly interesting. Indeed, you can easily change the intercept by recoding the independent variable, but this has no effect on the meaning of the model.
What does a significant intercept mean in ANOVA? The intercept is the estimate of the dependent variable when all the independent variables are 0. So, suppose you have a model such as Income ~ Sex Then if sex is coded as 0 for men and 1 for women, t
30,177
What does a significant intercept mean in ANOVA?
In contrast to R's default behavior (which indeed is to code the first level as 0), ANOVA usually uses contrast or sum-to-zero coding in which the levels of a factor a coded as deviation from 0 and the intercept represent the grand mean (or mean of the cell means, that depends). Then, a significant intercept means that the grand mean is different from 0.
What does a significant intercept mean in ANOVA?
In contrast to R's default behavior (which indeed is to code the first level as 0), ANOVA usually uses contrast or sum-to-zero coding in which the levels of a factor a coded as deviation from 0 and th
What does a significant intercept mean in ANOVA? In contrast to R's default behavior (which indeed is to code the first level as 0), ANOVA usually uses contrast or sum-to-zero coding in which the levels of a factor a coded as deviation from 0 and the intercept represent the grand mean (or mean of the cell means, that depends). Then, a significant intercept means that the grand mean is different from 0.
What does a significant intercept mean in ANOVA? In contrast to R's default behavior (which indeed is to code the first level as 0), ANOVA usually uses contrast or sum-to-zero coding in which the levels of a factor a coded as deviation from 0 and th
30,178
What does a significant intercept mean in ANOVA?
Peter Flom answer is incorrect. I don't have the reputation to comment on Peter Flom question, so I'll place my response here. Let's use the example of a factor of color that can be Red, Green, Blue. Let's pretend that these colors will correspond to an average response variable (y) of 40, 60, and 30 respectively. Now it is not commonly thought about, but ANOVA and linear regression are the actually exactly the same thing. The design matrix (the X) of the Linear model y = Xb + e would look something like this... R G B 1 1 0 0 1 0 1 0 1 0 0 1 ...however when attempting to estimating the coefficients by the derivative of the sum of square errors with respect to b (that is b = (X^T * X) ^-1 * X^T * y you will notice that X^T * X is a singular matrix. If you think about it, this makes intuitive sense. The work around for this is simple. You turn one treatment into the intercept and express all avg responses in relation to that intercept. See new design matrix below... (R) G B 1 0 0 1 1 0 1 0 1 ...now we have a design matrix where the intercept is actually the treatment Red. All average responses are now with respect to RED ie. Red = 40, Green = 20, and Blue = -10. R = R = 40 G = G + R = 20 + 40 = 60 B = B + R = -10 + 40 = 30 In other words in an ANOVA (which is really the same as a linear regression) the intercept is actually a treatment and a significant intercept means that treatment is significant. Now if you get into two way or even higher levels of ANOVA the interpretation of the intercept becomes more complex, but for a one way anova the intercept is itself a just another treatment.
What does a significant intercept mean in ANOVA?
Peter Flom answer is incorrect. I don't have the reputation to comment on Peter Flom question, so I'll place my response here. Let's use the example of a factor of color that can be Red, Green, Blue.
What does a significant intercept mean in ANOVA? Peter Flom answer is incorrect. I don't have the reputation to comment on Peter Flom question, so I'll place my response here. Let's use the example of a factor of color that can be Red, Green, Blue. Let's pretend that these colors will correspond to an average response variable (y) of 40, 60, and 30 respectively. Now it is not commonly thought about, but ANOVA and linear regression are the actually exactly the same thing. The design matrix (the X) of the Linear model y = Xb + e would look something like this... R G B 1 1 0 0 1 0 1 0 1 0 0 1 ...however when attempting to estimating the coefficients by the derivative of the sum of square errors with respect to b (that is b = (X^T * X) ^-1 * X^T * y you will notice that X^T * X is a singular matrix. If you think about it, this makes intuitive sense. The work around for this is simple. You turn one treatment into the intercept and express all avg responses in relation to that intercept. See new design matrix below... (R) G B 1 0 0 1 1 0 1 0 1 ...now we have a design matrix where the intercept is actually the treatment Red. All average responses are now with respect to RED ie. Red = 40, Green = 20, and Blue = -10. R = R = 40 G = G + R = 20 + 40 = 60 B = B + R = -10 + 40 = 30 In other words in an ANOVA (which is really the same as a linear regression) the intercept is actually a treatment and a significant intercept means that treatment is significant. Now if you get into two way or even higher levels of ANOVA the interpretation of the intercept becomes more complex, but for a one way anova the intercept is itself a just another treatment.
What does a significant intercept mean in ANOVA? Peter Flom answer is incorrect. I don't have the reputation to comment on Peter Flom question, so I'll place my response here. Let's use the example of a factor of color that can be Red, Green, Blue.
30,179
Does a stepwise approach produce the highest $R^2$ model?
You will not necessarily get the highest R$^2$ because you only compare a subset of possible models and may miss the one with the highest R$^2$ which would include all the variables.. To get that model you would need to look at all subsets. But the best model may not be the one with the highest R$^2$ because it may be that you over fit because it includes all the variables.
Does a stepwise approach produce the highest $R^2$ model?
You will not necessarily get the highest R$^2$ because you only compare a subset of possible models and may miss the one with the highest R$^2$ which would include all the variables.. To get that mod
Does a stepwise approach produce the highest $R^2$ model? You will not necessarily get the highest R$^2$ because you only compare a subset of possible models and may miss the one with the highest R$^2$ which would include all the variables.. To get that model you would need to look at all subsets. But the best model may not be the one with the highest R$^2$ because it may be that you over fit because it includes all the variables.
Does a stepwise approach produce the highest $R^2$ model? You will not necessarily get the highest R$^2$ because you only compare a subset of possible models and may miss the one with the highest R$^2$ which would include all the variables.. To get that mod
30,180
Does a stepwise approach produce the highest $R^2$ model?
Here is a counter example using randomly generated data and R: library(MASS) library(leaps) v <- matrix(0.9,11,11) diag(v) <- 1 set.seed(15) mydat <- mvrnorm(100, rep(0,11), v) mydf <- as.data.frame( mydat ) fit1 <- lm( V1 ~ 1, data=mydf ) fit2 <- lm( V1 ~ ., data=mydf ) fit <- step( fit1, formula(fit2), direction='forward' ) summary(fit)$r.squared all <- leaps(mydat[,-1], mydat[,1], method='r2') max(all$r2[ all$size==length(coef(fit)) ]) plot( all$size, all$r2 ) points( length(coef(fit)), summary(fit)$r.squared, col='red' ) whuber wanted the thought process: it is mostly a contrast between curiosity and laziness. The original post talked about having 10 predictor variables, so that is what I used. The 0.9 correlation was a nice round number with a fairly high correlation, but not too high (if it is too high then stepwise would most likely only pick up 1 or 2 predictors), I figured the best chance of finding a counter example would include a fair amount of collinearity. A more realistic example would have had various different correlations (but still a fair amount of collinearity) and a defined relationship between the predictors (or a subset of them) and the response variable. The sample size of 100 was also the 1st I tried as a nice round number (and the rule of thumb says you should have at least 10 observations per predictor). I tried the code above with seeds 1 and 2, then wrapped the whole thing in a loop and had it try different seeds sequentially. Actually it stopped at seed 3, but the difference in $R^2$ was in the 15th decimal point, so I figured that was more likely round-off error and restarted it with the comparison first rounding to 5 digits. I was pleasantly surprised that it found a difference as soon as 15. If it had not found a counter example in a reasonable amount of time I would have started tweaking things (the correlation, the sample size, etc.).
Does a stepwise approach produce the highest $R^2$ model?
Here is a counter example using randomly generated data and R: library(MASS) library(leaps) v <- matrix(0.9,11,11) diag(v) <- 1 set.seed(15) mydat <- mvrnorm(100, rep(0,11), v) mydf <- as.data.frame
Does a stepwise approach produce the highest $R^2$ model? Here is a counter example using randomly generated data and R: library(MASS) library(leaps) v <- matrix(0.9,11,11) diag(v) <- 1 set.seed(15) mydat <- mvrnorm(100, rep(0,11), v) mydf <- as.data.frame( mydat ) fit1 <- lm( V1 ~ 1, data=mydf ) fit2 <- lm( V1 ~ ., data=mydf ) fit <- step( fit1, formula(fit2), direction='forward' ) summary(fit)$r.squared all <- leaps(mydat[,-1], mydat[,1], method='r2') max(all$r2[ all$size==length(coef(fit)) ]) plot( all$size, all$r2 ) points( length(coef(fit)), summary(fit)$r.squared, col='red' ) whuber wanted the thought process: it is mostly a contrast between curiosity and laziness. The original post talked about having 10 predictor variables, so that is what I used. The 0.9 correlation was a nice round number with a fairly high correlation, but not too high (if it is too high then stepwise would most likely only pick up 1 or 2 predictors), I figured the best chance of finding a counter example would include a fair amount of collinearity. A more realistic example would have had various different correlations (but still a fair amount of collinearity) and a defined relationship between the predictors (or a subset of them) and the response variable. The sample size of 100 was also the 1st I tried as a nice round number (and the rule of thumb says you should have at least 10 observations per predictor). I tried the code above with seeds 1 and 2, then wrapped the whole thing in a loop and had it try different seeds sequentially. Actually it stopped at seed 3, but the difference in $R^2$ was in the 15th decimal point, so I figured that was more likely round-off error and restarted it with the comparison first rounding to 5 digits. I was pleasantly surprised that it found a difference as soon as 15. If it had not found a counter example in a reasonable amount of time I would have started tweaking things (the correlation, the sample size, etc.).
Does a stepwise approach produce the highest $R^2$ model? Here is a counter example using randomly generated data and R: library(MASS) library(leaps) v <- matrix(0.9,11,11) diag(v) <- 1 set.seed(15) mydat <- mvrnorm(100, rep(0,11), v) mydf <- as.data.frame
30,181
Does a stepwise approach produce the highest $R^2$ model?
If you really want to get the highest $R^2$ you have to look (as @Michael said) at all subsets. With a lot of variables, that's sometimes not feasible, and there are methods for getting close without testing every subset. One method is called (IIRC) "leaps and bounds" and is in the R package leaps. However, this will yield very biased results. p-values will be too low, coefficients biased away from 0, standard errors too small; and all by amounts that are impossible to estimate properly. Stepwise selection also has this problem. I strongly recommend against any automated variable selection method, because the worst thing about them is they stop you from thinking; or, to put it another way, a data analyst who uses automated methods is telling his/her boss to pay him/her less. If you must use an automated method, then you should separate your data into training and test sets, or possibly training, validating, and final sets.
Does a stepwise approach produce the highest $R^2$ model?
If you really want to get the highest $R^2$ you have to look (as @Michael said) at all subsets. With a lot of variables, that's sometimes not feasible, and there are methods for getting close without
Does a stepwise approach produce the highest $R^2$ model? If you really want to get the highest $R^2$ you have to look (as @Michael said) at all subsets. With a lot of variables, that's sometimes not feasible, and there are methods for getting close without testing every subset. One method is called (IIRC) "leaps and bounds" and is in the R package leaps. However, this will yield very biased results. p-values will be too low, coefficients biased away from 0, standard errors too small; and all by amounts that are impossible to estimate properly. Stepwise selection also has this problem. I strongly recommend against any automated variable selection method, because the worst thing about them is they stop you from thinking; or, to put it another way, a data analyst who uses automated methods is telling his/her boss to pay him/her less. If you must use an automated method, then you should separate your data into training and test sets, or possibly training, validating, and final sets.
Does a stepwise approach produce the highest $R^2$ model? If you really want to get the highest $R^2$ you have to look (as @Michael said) at all subsets. With a lot of variables, that's sometimes not feasible, and there are methods for getting close without
30,182
Distance metric and curse of dimensions
Some classic observations on distances in high-dimensional data: K. Beyer, J. Goldstein, R. Ramakrishnan, and U. Shaft, ICDT 1999: "When is Nearest Neighbors Meaningful?" C. C. Aggarwal, A. Hinneburg, and D. A. Keim, ICDT 2001: "On the Surprising Behavior of Distance Metrics in High Dimensional Space" A couple more recent research on this, which involves shared-nearest neighbors and hubness: M. E. Houle, H.-P. Kriegel, P. Kröger, E. Schubert and A. Zimek, SSDBM 2010: "Can Shared-Neighbor Distances Defeat the Curse of Dimensionality?" T. Bernecker, M. E. Houle, H.-P. Kriegel, P. Kröger, M. Renz, E. Schubert and A. Zimek, SSTD 2011: "Quality of Similarity Rankings in Time Series" N. Tomašev, M. Radovanović, D. Mladenić, and M. Ivanović. Adv. KDDM 2011: "The role of hubness in clustering high-dimensional data" Don't remember the others, search for "Hubness", that was their high-dimensional observation These are interesting, as they point out some popular misunderstandings about the curse of dimensionality. In essence they show that the theoretical results - which assume the data to be i.i.d. - may not be generally true for data that has more than one distribution. The curse leads to numerical problems, and a loss of discrimination within a single distribution, while it can make it even easier to differentiate two distributions that are well separated. Some of this should be rather obvious. Say you have objects which are $A_i\sim \mathcal{N}(0;1)$ i.i.d. in each dimension and another set of objects that are $B_i\sim \mathcal{N}(100;1)$ i.i.d. in each dimension. The difference between objects from two different sets will always be magnitudes larger than a distance within a single set, and the problem will even get easier with increasing dimensionality. I recommend reading this work by Houle et al., largely because it shows that by claiming "this data is high-dimensional, and because of the curse of dimensionality it cannot be analyzed" you might be making things a bit too easy. Still that is a line that is being used all over the place. "Our algorithm only works only for low dimensional data, because of the curse of dimensionality." "Our index only works for up to 10 dimensions, because of the curse of dimensionality." Yadda yadda yadda. Many of these statements apparently just show that such authors have not understood what happens at high dimensionality in their data and algorithm (or needed an excuse). Houle et al. don't completely solve the puzzle (yet? this is fairly recent), but they at least reconsider many of the popular statements. After all, if high dimensionality were this big a problem, how come that in text mining people happily use dimensionalities on the order of 10000-100000, while in other domains people give up at just 10 dimensions?!? As for the second part of your question: cosine similarity seems to suffer less from the dimensionality. Apart from that, as long as you want to differentiate different distributions, control numerical precision and do not rely on hand-chosen thresholds (as you might need to give them with lots of significant digits), classic $L_p$-Norms should still be fine. However, Cosine is also affected from the curse of dimensionality, as discussed in: M. Radovanović, A. Nanopoulos, and M. Ivanović, SIGIR 2010. "On the existence of obstinate results in vector space models."
Distance metric and curse of dimensions
Some classic observations on distances in high-dimensional data: K. Beyer, J. Goldstein, R. Ramakrishnan, and U. Shaft, ICDT 1999: "When is Nearest Neighbors Meaningful?" C. C. Aggarwal, A. Hinneburg
Distance metric and curse of dimensions Some classic observations on distances in high-dimensional data: K. Beyer, J. Goldstein, R. Ramakrishnan, and U. Shaft, ICDT 1999: "When is Nearest Neighbors Meaningful?" C. C. Aggarwal, A. Hinneburg, and D. A. Keim, ICDT 2001: "On the Surprising Behavior of Distance Metrics in High Dimensional Space" A couple more recent research on this, which involves shared-nearest neighbors and hubness: M. E. Houle, H.-P. Kriegel, P. Kröger, E. Schubert and A. Zimek, SSDBM 2010: "Can Shared-Neighbor Distances Defeat the Curse of Dimensionality?" T. Bernecker, M. E. Houle, H.-P. Kriegel, P. Kröger, M. Renz, E. Schubert and A. Zimek, SSTD 2011: "Quality of Similarity Rankings in Time Series" N. Tomašev, M. Radovanović, D. Mladenić, and M. Ivanović. Adv. KDDM 2011: "The role of hubness in clustering high-dimensional data" Don't remember the others, search for "Hubness", that was their high-dimensional observation These are interesting, as they point out some popular misunderstandings about the curse of dimensionality. In essence they show that the theoretical results - which assume the data to be i.i.d. - may not be generally true for data that has more than one distribution. The curse leads to numerical problems, and a loss of discrimination within a single distribution, while it can make it even easier to differentiate two distributions that are well separated. Some of this should be rather obvious. Say you have objects which are $A_i\sim \mathcal{N}(0;1)$ i.i.d. in each dimension and another set of objects that are $B_i\sim \mathcal{N}(100;1)$ i.i.d. in each dimension. The difference between objects from two different sets will always be magnitudes larger than a distance within a single set, and the problem will even get easier with increasing dimensionality. I recommend reading this work by Houle et al., largely because it shows that by claiming "this data is high-dimensional, and because of the curse of dimensionality it cannot be analyzed" you might be making things a bit too easy. Still that is a line that is being used all over the place. "Our algorithm only works only for low dimensional data, because of the curse of dimensionality." "Our index only works for up to 10 dimensions, because of the curse of dimensionality." Yadda yadda yadda. Many of these statements apparently just show that such authors have not understood what happens at high dimensionality in their data and algorithm (or needed an excuse). Houle et al. don't completely solve the puzzle (yet? this is fairly recent), but they at least reconsider many of the popular statements. After all, if high dimensionality were this big a problem, how come that in text mining people happily use dimensionalities on the order of 10000-100000, while in other domains people give up at just 10 dimensions?!? As for the second part of your question: cosine similarity seems to suffer less from the dimensionality. Apart from that, as long as you want to differentiate different distributions, control numerical precision and do not rely on hand-chosen thresholds (as you might need to give them with lots of significant digits), classic $L_p$-Norms should still be fine. However, Cosine is also affected from the curse of dimensionality, as discussed in: M. Radovanović, A. Nanopoulos, and M. Ivanović, SIGIR 2010. "On the existence of obstinate results in vector space models."
Distance metric and curse of dimensions Some classic observations on distances in high-dimensional data: K. Beyer, J. Goldstein, R. Ramakrishnan, and U. Shaft, ICDT 1999: "When is Nearest Neighbors Meaningful?" C. C. Aggarwal, A. Hinneburg
30,183
Distance metric and curse of dimensions
Aggarwal C. C., Hinneburg A., Keim, D. A. (2001), ”On the Surprising Behavior of Distance Metrics in High Dimensional Space” Beyer K., Goldstein J., Ramakrishnan R., Shaft U. (1999), ”When is Nearest Neighbors Meaningfull?”, ICDE Conference Procedings.
Distance metric and curse of dimensions
Aggarwal C. C., Hinneburg A., Keim, D. A. (2001), ”On the Surprising Behavior of Distance Metrics in High Dimensional Space” Beyer K., Goldstein J., Ramakrishnan R., Shaft U. (1999), ”When is Nearest
Distance metric and curse of dimensions Aggarwal C. C., Hinneburg A., Keim, D. A. (2001), ”On the Surprising Behavior of Distance Metrics in High Dimensional Space” Beyer K., Goldstein J., Ramakrishnan R., Shaft U. (1999), ”When is Nearest Neighbors Meaningfull?”, ICDE Conference Procedings.
Distance metric and curse of dimensions Aggarwal C. C., Hinneburg A., Keim, D. A. (2001), ”On the Surprising Behavior of Distance Metrics in High Dimensional Space” Beyer K., Goldstein J., Ramakrishnan R., Shaft U. (1999), ”When is Nearest
30,184
Distance metric and curse of dimensions
Also: Robert J. Durrant, Ata Kabán: When is 'nearest neighbour' meaningful: A converse theorem and implications. J. Complexity 25(4): 385-397 (2009) Ata Kabán: On the distance concentration awareness of certain data reduction techniques. Pattern Recognition 44(2): 265-277 (2011) Ata Kabán: Non-parametric detection of meaningless distances in high dimensional data. Statistics and Computing 22(2): 375-385 (2012)
Distance metric and curse of dimensions
Also: Robert J. Durrant, Ata Kabán: When is 'nearest neighbour' meaningful: A converse theorem and implications. J. Complexity 25(4): 385-397 (2009) Ata Kabán: On the distance concentration awareness
Distance metric and curse of dimensions Also: Robert J. Durrant, Ata Kabán: When is 'nearest neighbour' meaningful: A converse theorem and implications. J. Complexity 25(4): 385-397 (2009) Ata Kabán: On the distance concentration awareness of certain data reduction techniques. Pattern Recognition 44(2): 265-277 (2011) Ata Kabán: Non-parametric detection of meaningless distances in high dimensional data. Statistics and Computing 22(2): 375-385 (2012)
Distance metric and curse of dimensions Also: Robert J. Durrant, Ata Kabán: When is 'nearest neighbour' meaningful: A converse theorem and implications. J. Complexity 25(4): 385-397 (2009) Ata Kabán: On the distance concentration awareness
30,185
Resources for learning Stata
The UCLA resource listed by Stephen Turner (below) is excellent if you just want to apply methods you're already familiar with using Stata. If you're looking for textbooks which teach you statistics/econometrics while using Stata then these are solid recommendations (but it depends at what level you're looking at): Introductory Methods An Introduction to Modern Econometrics Using Stata by Chris Baum Introduction to Econometrics by Chris Dougherty Advanced/Specialised Methods Multilevel and Longitudinal Modeling Using Stata by Rabe-Hesketh and Skrondal Regression Models for Categorical Dependent Variables Using Stata by Long and Freese
Resources for learning Stata
The UCLA resource listed by Stephen Turner (below) is excellent if you just want to apply methods you're already familiar with using Stata. If you're looking for textbooks which teach you statistics/e
Resources for learning Stata The UCLA resource listed by Stephen Turner (below) is excellent if you just want to apply methods you're already familiar with using Stata. If you're looking for textbooks which teach you statistics/econometrics while using Stata then these are solid recommendations (but it depends at what level you're looking at): Introductory Methods An Introduction to Modern Econometrics Using Stata by Chris Baum Introduction to Econometrics by Chris Dougherty Advanced/Specialised Methods Multilevel and Longitudinal Modeling Using Stata by Rabe-Hesketh and Skrondal Regression Models for Categorical Dependent Variables Using Stata by Long and Freese
Resources for learning Stata The UCLA resource listed by Stephen Turner (below) is excellent if you just want to apply methods you're already familiar with using Stata. If you're looking for textbooks which teach you statistics/e
30,186
Resources for learning Stata
UCLA has the best free resources you'll find anywhere. https://stats.idre.ucla.edu/stata/
Resources for learning Stata
UCLA has the best free resources you'll find anywhere. https://stats.idre.ucla.edu/stata/
Resources for learning Stata UCLA has the best free resources you'll find anywhere. https://stats.idre.ucla.edu/stata/
Resources for learning Stata UCLA has the best free resources you'll find anywhere. https://stats.idre.ucla.edu/stata/
30,187
Resources for learning Stata
I have done very well with reading the official documentation. It is well-written, sometimes injected with humour (!) and, if you're willing to spend the time to learn Stata properly, is an absolute goldmine.
Resources for learning Stata
I have done very well with reading the official documentation. It is well-written, sometimes injected with humour (!) and, if you're willing to spend the time to learn Stata properly, is an absolute g
Resources for learning Stata I have done very well with reading the official documentation. It is well-written, sometimes injected with humour (!) and, if you're willing to spend the time to learn Stata properly, is an absolute goldmine.
Resources for learning Stata I have done very well with reading the official documentation. It is well-written, sometimes injected with humour (!) and, if you're willing to spend the time to learn Stata properly, is an absolute g
30,188
Resources for learning Stata
I have listed some resources on my Stata page. It includes links to the UCLA and Princeton tutorials, as well as a few more resources in several formats. The "Stata Guide" document, which is very much a work in progress at that stage, is my personal contribution. One of the fantastic things about Stata is the wealth of online and offline documentation, but never forget that the first resource to learn Stata is the very good set of documentation pages that you can access right away from Stata through the help command (also available online). If you prefer using books, Alan Acock's A Gentle Introduction to Stata combined with Lawrence Hamilton's Statistics with Stata will get you at a fairly high level of proficiency. You might then add a third book (like Long and Freese's excellent handbook) focused on a special research interest.
Resources for learning Stata
I have listed some resources on my Stata page. It includes links to the UCLA and Princeton tutorials, as well as a few more resources in several formats. The "Stata Guide" document, which is very much
Resources for learning Stata I have listed some resources on my Stata page. It includes links to the UCLA and Princeton tutorials, as well as a few more resources in several formats. The "Stata Guide" document, which is very much a work in progress at that stage, is my personal contribution. One of the fantastic things about Stata is the wealth of online and offline documentation, but never forget that the first resource to learn Stata is the very good set of documentation pages that you can access right away from Stata through the help command (also available online). If you prefer using books, Alan Acock's A Gentle Introduction to Stata combined with Lawrence Hamilton's Statistics with Stata will get you at a fairly high level of proficiency. You might then add a third book (like Long and Freese's excellent handbook) focused on a special research interest.
Resources for learning Stata I have listed some resources on my Stata page. It includes links to the UCLA and Princeton tutorials, as well as a few more resources in several formats. The "Stata Guide" document, which is very much
30,189
Resources for learning Stata
Alex Tabarrok posted a great list of resources here on marginalrevolution.com Gabriel Rossman shares a good introductory guide here.
Resources for learning Stata
Alex Tabarrok posted a great list of resources here on marginalrevolution.com Gabriel Rossman shares a good introductory guide here.
Resources for learning Stata Alex Tabarrok posted a great list of resources here on marginalrevolution.com Gabriel Rossman shares a good introductory guide here.
Resources for learning Stata Alex Tabarrok posted a great list of resources here on marginalrevolution.com Gabriel Rossman shares a good introductory guide here.
30,190
Resources for learning Stata
There are couple of good links with introductory material at Princeton Uni Library website.
Resources for learning Stata
There are couple of good links with introductory material at Princeton Uni Library website.
Resources for learning Stata There are couple of good links with introductory material at Princeton Uni Library website.
Resources for learning Stata There are couple of good links with introductory material at Princeton Uni Library website.
30,191
Resources for learning Stata
If you search on some keyword(s) in Stata, you will often be directed to articles in the Stata Journal. Many articles are written at an introductory or expository level and concern the language itself and how to program in Stata as well as how to use Stata for statistics, data management and graphics. Alternatively, visit the journal website directly and search for material. All articles in the Stata Journal are freely accessible online to all after 3 years from publication, so you can build up a personal collection of articles as .pdf relevant to your interests. Full disclosure: I am an Editor of the Stata Journal and an occasional contributor.
Resources for learning Stata
If you search on some keyword(s) in Stata, you will often be directed to articles in the Stata Journal. Many articles are written at an introductory or expository level and concern the language itself
Resources for learning Stata If you search on some keyword(s) in Stata, you will often be directed to articles in the Stata Journal. Many articles are written at an introductory or expository level and concern the language itself and how to program in Stata as well as how to use Stata for statistics, data management and graphics. Alternatively, visit the journal website directly and search for material. All articles in the Stata Journal are freely accessible online to all after 3 years from publication, so you can build up a personal collection of articles as .pdf relevant to your interests. Full disclosure: I am an Editor of the Stata Journal and an occasional contributor.
Resources for learning Stata If you search on some keyword(s) in Stata, you will often be directed to articles in the Stata Journal. Many articles are written at an introductory or expository level and concern the language itself
30,192
Resources for learning Stata
I recommend the Stata Press series. I'd especially recommend the Programming in Stata text as a primer to doing your own work.
Resources for learning Stata
I recommend the Stata Press series. I'd especially recommend the Programming in Stata text as a primer to doing your own work.
Resources for learning Stata I recommend the Stata Press series. I'd especially recommend the Programming in Stata text as a primer to doing your own work.
Resources for learning Stata I recommend the Stata Press series. I'd especially recommend the Programming in Stata text as a primer to doing your own work.
30,193
How do we know the true value of a parameter, in order to check estimator properties?
Phil has given a very good answer regarding the unbiasedness of the estimator. But I think your question may actually stem from another confusion: You seem to mixing up the estimate and the estimator. The estimator is a general rule how to calculate a specific value from a given sample. This sample-specific value is called the estimate. If you use the estimator $\bar X = \frac{1}{n} \sum_{i=1}^n X_i$ to estimate the unknown population mean $\mu$, then you have an unbiased estimator because $E(\bar X) = \mu$. Applying this estimator to a given sample, you get a specific value $\hat X$ (the sample mean), which is called the estimate. However, this does not mean that $\hat X = \mu$, i.e. the actually estimated mean $\hat X$ for a given sample is not necessarily equal (or even close) to the true value. To get an idea how well we estimated the true value, therefore we usually express our uncertainty of the estimate, e.g. via confidence intervals.
How do we know the true value of a parameter, in order to check estimator properties?
Phil has given a very good answer regarding the unbiasedness of the estimator. But I think your question may actually stem from another confusion: You seem to mixing up the estimate and the estimator.
How do we know the true value of a parameter, in order to check estimator properties? Phil has given a very good answer regarding the unbiasedness of the estimator. But I think your question may actually stem from another confusion: You seem to mixing up the estimate and the estimator. The estimator is a general rule how to calculate a specific value from a given sample. This sample-specific value is called the estimate. If you use the estimator $\bar X = \frac{1}{n} \sum_{i=1}^n X_i$ to estimate the unknown population mean $\mu$, then you have an unbiased estimator because $E(\bar X) = \mu$. Applying this estimator to a given sample, you get a specific value $\hat X$ (the sample mean), which is called the estimate. However, this does not mean that $\hat X = \mu$, i.e. the actually estimated mean $\hat X$ for a given sample is not necessarily equal (or even close) to the true value. To get an idea how well we estimated the true value, therefore we usually express our uncertainty of the estimate, e.g. via confidence intervals.
How do we know the true value of a parameter, in order to check estimator properties? Phil has given a very good answer regarding the unbiasedness of the estimator. But I think your question may actually stem from another confusion: You seem to mixing up the estimate and the estimator.
30,194
How do we know the true value of a parameter, in order to check estimator properties?
Yes, in any real world situation, if you know the value of the parameter, then you don't need to go about trying to estimate it. One scenario where you know the value of a parameter, and then may want to examine the behavior of a statistic (estimator), is when you are conducting a simulation to see how the statistic behaves in different circumstances. For example, you can ask a computer to, say, start with a population of observations of known distribution and known parameters. You can then make many iterations of sampling this population, using a statistic to estimate some parameter, and see how that statistic behaves in certain situations. For example, what if the sample size is small compared with when it is large ? What if the distribution is skewed compared with when it is symmetric ? ... As a non-statistician, I find this approach useful in assessing how various statistics and tests behave in different circumstances.
How do we know the true value of a parameter, in order to check estimator properties?
Yes, in any real world situation, if you know the value of the parameter, then you don't need to go about trying to estimate it. One scenario where you know the value of a parameter, and then may wan
How do we know the true value of a parameter, in order to check estimator properties? Yes, in any real world situation, if you know the value of the parameter, then you don't need to go about trying to estimate it. One scenario where you know the value of a parameter, and then may want to examine the behavior of a statistic (estimator), is when you are conducting a simulation to see how the statistic behaves in different circumstances. For example, you can ask a computer to, say, start with a population of observations of known distribution and known parameters. You can then make many iterations of sampling this population, using a statistic to estimate some parameter, and see how that statistic behaves in certain situations. For example, what if the sample size is small compared with when it is large ? What if the distribution is skewed compared with when it is symmetric ? ... As a non-statistician, I find this approach useful in assessing how various statistics and tests behave in different circumstances.
How do we know the true value of a parameter, in order to check estimator properties? Yes, in any real world situation, if you know the value of the parameter, then you don't need to go about trying to estimate it. One scenario where you know the value of a parameter, and then may wan
30,195
How do we know the true value of a parameter, in order to check estimator properties?
Consider i.i.d. sample $X_1, \ldots, X_n \sim N(\mu, 1)$. We assume that all samples are from normal distribution with mean $\mu$, which is unknown, and known variance $1$. Now, let $\bar X = \frac{1}{n} \sum_{i=1}^n X_i$. Then $E(\bar X) = \mu$. So no matter what $\mu$ is, $E(\bar X) = \mu$. It is not necessary to know what $\mu$ is.
How do we know the true value of a parameter, in order to check estimator properties?
Consider i.i.d. sample $X_1, \ldots, X_n \sim N(\mu, 1)$. We assume that all samples are from normal distribution with mean $\mu$, which is unknown, and known variance $1$. Now, let $\bar X = \frac{1}
How do we know the true value of a parameter, in order to check estimator properties? Consider i.i.d. sample $X_1, \ldots, X_n \sim N(\mu, 1)$. We assume that all samples are from normal distribution with mean $\mu$, which is unknown, and known variance $1$. Now, let $\bar X = \frac{1}{n} \sum_{i=1}^n X_i$. Then $E(\bar X) = \mu$. So no matter what $\mu$ is, $E(\bar X) = \mu$. It is not necessary to know what $\mu$ is.
How do we know the true value of a parameter, in order to check estimator properties? Consider i.i.d. sample $X_1, \ldots, X_n \sim N(\mu, 1)$. We assume that all samples are from normal distribution with mean $\mu$, which is unknown, and known variance $1$. Now, let $\bar X = \frac{1}
30,196
How do we know the true value of a parameter, in order to check estimator properties?
In practice we don't know the true value of the parameter. However, if we are to use the estimator, we have to know its properties - to be sure that it is a good one (or at least suitable/acceptable under the circumstances.) What we do usually assume to know is the underlying statistical distribution or, at least, some kind of a model structure (in case of non-parametric estimators.)
How do we know the true value of a parameter, in order to check estimator properties?
In practice we don't know the true value of the parameter. However, if we are to use the estimator, we have to know its properties - to be sure that it is a good one (or at least suitable/acceptable u
How do we know the true value of a parameter, in order to check estimator properties? In practice we don't know the true value of the parameter. However, if we are to use the estimator, we have to know its properties - to be sure that it is a good one (or at least suitable/acceptable under the circumstances.) What we do usually assume to know is the underlying statistical distribution or, at least, some kind of a model structure (in case of non-parametric estimators.)
How do we know the true value of a parameter, in order to check estimator properties? In practice we don't know the true value of the parameter. However, if we are to use the estimator, we have to know its properties - to be sure that it is a good one (or at least suitable/acceptable u
30,197
How do we know the true value of a parameter, in order to check estimator properties?
How do we know the true value of a parameter, in order to check estimator properties? We don't know the true value and we don't know the estimator properties. One way to deal with it is that we estimate the true value of the parameter, and based on the estimate of the value, we estimate the estimator properties. This approach is used for instance with the Wald test. This uses the estimated values of the parameters to describe the properties of the estimate. This approach is an approximation and does not give an exact result. we say that an estimator is unbiased if the expected value of the estimator is the true value of the parameter we're trying to estimate. This doesn't require to know the true value. We only need to know that give any true value the expectation of the estimator is equal to that true value. If for any true value of the parameter the bias is zero, then without knowing the value of the parameter we know that the bias is zero. However, in cases when the bias is not always zero or a constant, then indeed we can not know the exact bias and we need make an estimate.
How do we know the true value of a parameter, in order to check estimator properties?
How do we know the true value of a parameter, in order to check estimator properties? We don't know the true value and we don't know the estimator properties. One way to deal with it is that we esti
How do we know the true value of a parameter, in order to check estimator properties? How do we know the true value of a parameter, in order to check estimator properties? We don't know the true value and we don't know the estimator properties. One way to deal with it is that we estimate the true value of the parameter, and based on the estimate of the value, we estimate the estimator properties. This approach is used for instance with the Wald test. This uses the estimated values of the parameters to describe the properties of the estimate. This approach is an approximation and does not give an exact result. we say that an estimator is unbiased if the expected value of the estimator is the true value of the parameter we're trying to estimate. This doesn't require to know the true value. We only need to know that give any true value the expectation of the estimator is equal to that true value. If for any true value of the parameter the bias is zero, then without knowing the value of the parameter we know that the bias is zero. However, in cases when the bias is not always zero or a constant, then indeed we can not know the exact bias and we need make an estimate.
How do we know the true value of a parameter, in order to check estimator properties? How do we know the true value of a parameter, in order to check estimator properties? We don't know the true value and we don't know the estimator properties. One way to deal with it is that we esti
30,198
Does including gender as a predictor variable mean I should use a glm function, not an lm function, in R?
A few points: The short (tl;dr) answer to your question is that the choice of linear (lm) vs generalized linear (glm) models depends on the response variable (Height_cm), not on anything having to do with the predictor variables. Since your response is continuous, you definitely should avoid the standard GLMs (Poisson, binomial/logistic) which are meant for count or proportion data. your diagnostic plots don't look that bad to me: no systematic variation in y as a function of x for residual-vs-fitted or scale-location plots; Q-Q plot is approximately a straight line; all residuals have Cook's distance < 0.5 (within innermost contour). . I suspect that the 'badness' you're referring to is the non-uniform distribution of the fitted values (x-axis in fitted-vs-residual and scale-location) plots. This is presumably happening because there is a big effect of gender (the only binary predictor I see in your data set); you can plot(Model4, col = as.numeric(Data.dat.complete$Gender)) to check this. In theory, a positive variable would be better modeled using a log-transformed response or a Gamma GLM, but when the coefficient of variation is low (standard deviation of response variables << mean of variables, say <1/3; the value is on the order of 1/8 here) then the implied probability of a negative response is very small and you probably don't need to worry about it. You may find the annotated version of the diagnostics from the performance::diagnostics() function useful (I don't agree with all of the design decisions, e.g. the fifth plot showing "normality of residuals" is redundant and less revealing than the Q-Q plot, but overall it's helpful).
Does including gender as a predictor variable mean I should use a glm function, not an lm function,
A few points: The short (tl;dr) answer to your question is that the choice of linear (lm) vs generalized linear (glm) models depends on the response variable (Height_cm), not on anything having to do
Does including gender as a predictor variable mean I should use a glm function, not an lm function, in R? A few points: The short (tl;dr) answer to your question is that the choice of linear (lm) vs generalized linear (glm) models depends on the response variable (Height_cm), not on anything having to do with the predictor variables. Since your response is continuous, you definitely should avoid the standard GLMs (Poisson, binomial/logistic) which are meant for count or proportion data. your diagnostic plots don't look that bad to me: no systematic variation in y as a function of x for residual-vs-fitted or scale-location plots; Q-Q plot is approximately a straight line; all residuals have Cook's distance < 0.5 (within innermost contour). . I suspect that the 'badness' you're referring to is the non-uniform distribution of the fitted values (x-axis in fitted-vs-residual and scale-location) plots. This is presumably happening because there is a big effect of gender (the only binary predictor I see in your data set); you can plot(Model4, col = as.numeric(Data.dat.complete$Gender)) to check this. In theory, a positive variable would be better modeled using a log-transformed response or a Gamma GLM, but when the coefficient of variation is low (standard deviation of response variables << mean of variables, say <1/3; the value is on the order of 1/8 here) then the implied probability of a negative response is very small and you probably don't need to worry about it. You may find the annotated version of the diagnostics from the performance::diagnostics() function useful (I don't agree with all of the design decisions, e.g. the fifth plot showing "normality of residuals" is redundant and less revealing than the Q-Q plot, but overall it's helpful).
Does including gender as a predictor variable mean I should use a glm function, not an lm function, A few points: The short (tl;dr) answer to your question is that the choice of linear (lm) vs generalized linear (glm) models depends on the response variable (Height_cm), not on anything having to do
30,199
How to read scientific notation output (numbers that include "e")? [duplicate]
The "e" is a symbol for base-10 scientific notation. The "e" stands for $\times 10^{\rm exponent}$. So -1.861246e-04 means $-1.861246 \times 10^{-4}$. In fixed-point notation that would be -0.0001861246. This notation is pretty standard. Even Microsoft Excel understands it, not just R.
How to read scientific notation output (numbers that include "e")? [duplicate]
The "e" is a symbol for base-10 scientific notation. The "e" stands for $\times 10^{\rm exponent}$. So -1.861246e-04 means $-1.861246 \times 10^{-4}$. In fixed-point notation that would be -0.00018612
How to read scientific notation output (numbers that include "e")? [duplicate] The "e" is a symbol for base-10 scientific notation. The "e" stands for $\times 10^{\rm exponent}$. So -1.861246e-04 means $-1.861246 \times 10^{-4}$. In fixed-point notation that would be -0.0001861246. This notation is pretty standard. Even Microsoft Excel understands it, not just R.
How to read scientific notation output (numbers that include "e")? [duplicate] The "e" is a symbol for base-10 scientific notation. The "e" stands for $\times 10^{\rm exponent}$. So -1.861246e-04 means $-1.861246 \times 10^{-4}$. In fixed-point notation that would be -0.00018612
30,200
How to read scientific notation output (numbers that include "e")? [duplicate]
I cannot yet comment so this answer will be a response to @Mark L. Stone : OP also stated that he's getting covariance matrix values in the scientific notation. Obviously the negative value must be one of the covariances. To not be completely OT I will just add that working with scientific notation to me looks a bit clunky(especially if you are publishing the results). To supress the notation in R use the command options(scipen=alpha) where alpha is the maximum number of digits for the result to be still expressed in fixed notation.
How to read scientific notation output (numbers that include "e")? [duplicate]
I cannot yet comment so this answer will be a response to @Mark L. Stone : OP also stated that he's getting covariance matrix values in the scientific notation. Obviously the negative value must be o
How to read scientific notation output (numbers that include "e")? [duplicate] I cannot yet comment so this answer will be a response to @Mark L. Stone : OP also stated that he's getting covariance matrix values in the scientific notation. Obviously the negative value must be one of the covariances. To not be completely OT I will just add that working with scientific notation to me looks a bit clunky(especially if you are publishing the results). To supress the notation in R use the command options(scipen=alpha) where alpha is the maximum number of digits for the result to be still expressed in fixed notation.
How to read scientific notation output (numbers that include "e")? [duplicate] I cannot yet comment so this answer will be a response to @Mark L. Stone : OP also stated that he's getting covariance matrix values in the scientific notation. Obviously the negative value must be o