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
31,901
How to test for presence of trend in time series?
You make assumptions about the behaviour of your trend. Without assumptions you cannot hope to ever test data. Detrending a time series is effectively modelling a time series. The most common (and often violated) assumptions you first need to make when dealing with time series are the following. $E|X_t|^2 < \infty, \quad \forall t \in \mathbb N$ $EX_t = \mu, \quad \forall t \in \mathbb N$ $\gamma(s, r) = \gamma(s + t, r + t), \quad \forall r,s,t \in \mathbb N$ The $\gamma$ in item 3 refers to the correlation function taking $s,r$ indices of the time series as arguments. Time series that comply are referred to as weakly stationary. Your data sounds like it already complies to 2. If your data doesn't get "noisier" as time go forward then it also complies to 1. Often the first step in modelling time series is transforming your data to approximately meet these assumptions, where possible. A simple means of meeting items 1,2, that works some of the time, is to difference the data (repeatedly), wherein you subtract each element of the time-series from the element preceding it. Other options include fitting polynomial regression to the data or performing regression on concatenated windows of a cyclical trends. What you're hopefully left with is a series that approximately meets these assumptions. There's still plenty of trend to be devoured by your model. Here's a function to compute $\gamma$. import numpy as np def autocorrelation(x): assert(len(x.shape) == 1) n = x.shape[0] x -= x.mean() trans = np.fft.fft(x, n=n * 2) acf = np.fft.ifft(trans * np.conjugate(trans))[:n] acf /= acf[0] return np.real(acf) Now let's look at realizations of some stationary data. import numpy as np # Make data that isn't autocorrelated x_not = np.random.normal(0, 1, 1000) # Make autocorrelated data z = np.random.normal(0, 1, 1000) x_auto = z[1:] - .8 * z[:-1] If you want an explicit test then $\frac{1.96}{\sqrt n}$, where n is the length of the time-series, is the 95% confidence bounds on null autocorrelation. You can get pretty wild with time series modelling, but this is the linear regression analog of time series. The collection of these tricks form the guts of what is known as (S)ARIMA.
How to test for presence of trend in time series?
You make assumptions about the behaviour of your trend. Without assumptions you cannot hope to ever test data. Detrending a time series is effectively modelling a time series. The most common (and oft
How to test for presence of trend in time series? You make assumptions about the behaviour of your trend. Without assumptions you cannot hope to ever test data. Detrending a time series is effectively modelling a time series. The most common (and often violated) assumptions you first need to make when dealing with time series are the following. $E|X_t|^2 < \infty, \quad \forall t \in \mathbb N$ $EX_t = \mu, \quad \forall t \in \mathbb N$ $\gamma(s, r) = \gamma(s + t, r + t), \quad \forall r,s,t \in \mathbb N$ The $\gamma$ in item 3 refers to the correlation function taking $s,r$ indices of the time series as arguments. Time series that comply are referred to as weakly stationary. Your data sounds like it already complies to 2. If your data doesn't get "noisier" as time go forward then it also complies to 1. Often the first step in modelling time series is transforming your data to approximately meet these assumptions, where possible. A simple means of meeting items 1,2, that works some of the time, is to difference the data (repeatedly), wherein you subtract each element of the time-series from the element preceding it. Other options include fitting polynomial regression to the data or performing regression on concatenated windows of a cyclical trends. What you're hopefully left with is a series that approximately meets these assumptions. There's still plenty of trend to be devoured by your model. Here's a function to compute $\gamma$. import numpy as np def autocorrelation(x): assert(len(x.shape) == 1) n = x.shape[0] x -= x.mean() trans = np.fft.fft(x, n=n * 2) acf = np.fft.ifft(trans * np.conjugate(trans))[:n] acf /= acf[0] return np.real(acf) Now let's look at realizations of some stationary data. import numpy as np # Make data that isn't autocorrelated x_not = np.random.normal(0, 1, 1000) # Make autocorrelated data z = np.random.normal(0, 1, 1000) x_auto = z[1:] - .8 * z[:-1] If you want an explicit test then $\frac{1.96}{\sqrt n}$, where n is the length of the time-series, is the 95% confidence bounds on null autocorrelation. You can get pretty wild with time series modelling, but this is the linear regression analog of time series. The collection of these tricks form the guts of what is known as (S)ARIMA.
How to test for presence of trend in time series? You make assumptions about the behaviour of your trend. Without assumptions you cannot hope to ever test data. Detrending a time series is effectively modelling a time series. The most common (and oft
31,902
How to test for presence of trend in time series?
In time series econometrics, an important task is to determine the most appropriate form of the trend in the data, not merely whether a trend exists. There are two common trend removal procedures: taking say the first difference and performing the time-trend regression (or a non-parametric alternative e.g. moving averages). The former is appropriate for I(1) (read integrated of order one) time series and the latter is appropriate for trend stationary I(0) time series. Unit root tests can be used to determine the nature of the trend (stochastic or deterministic), which will suggests the appropriate way to remove it. As stated, your question is limited to non-parametric estimation of the deterministic component of a trend-stationary process. It is quite often, in e.g. business and economics, that the observed trend is stochastic in nature. Unit root tests (and corresponding stationarity tests) are tools for determining the presence of a stochastic trend in an observed series. Tests like Phillips-Perron test can accommodate models with a fitted drift and a time trend so they may be used to discriminate between the unit root non-stationarity (stochastic trend) and stationary about a deterministic trend (of a non-stationary process). There are many good sources for further reading, but probably take a look at this theory and this practice first.
How to test for presence of trend in time series?
In time series econometrics, an important task is to determine the most appropriate form of the trend in the data, not merely whether a trend exists. There are two common trend removal procedures: ta
How to test for presence of trend in time series? In time series econometrics, an important task is to determine the most appropriate form of the trend in the data, not merely whether a trend exists. There are two common trend removal procedures: taking say the first difference and performing the time-trend regression (or a non-parametric alternative e.g. moving averages). The former is appropriate for I(1) (read integrated of order one) time series and the latter is appropriate for trend stationary I(0) time series. Unit root tests can be used to determine the nature of the trend (stochastic or deterministic), which will suggests the appropriate way to remove it. As stated, your question is limited to non-parametric estimation of the deterministic component of a trend-stationary process. It is quite often, in e.g. business and economics, that the observed trend is stochastic in nature. Unit root tests (and corresponding stationarity tests) are tools for determining the presence of a stochastic trend in an observed series. Tests like Phillips-Perron test can accommodate models with a fitted drift and a time trend so they may be used to discriminate between the unit root non-stationarity (stochastic trend) and stationary about a deterministic trend (of a non-stationary process). There are many good sources for further reading, but probably take a look at this theory and this practice first.
How to test for presence of trend in time series? In time series econometrics, an important task is to determine the most appropriate form of the trend in the data, not merely whether a trend exists. There are two common trend removal procedures: ta
31,903
Measuring distance between two empirical distributions
I think your question is essentially the same as Can I use Kolmogorov-Smirnov to compare two empirical distributions?, for which the Kolmogorov-Smirnov test is commonly used. The KS test statistic is a natural measure of the distance between two samples. For more details, please see Kolmogorov–Smirnov test on Wikipedia.
Measuring distance between two empirical distributions
I think your question is essentially the same as Can I use Kolmogorov-Smirnov to compare two empirical distributions?, for which the Kolmogorov-Smirnov test is commonly used. The KS test statistic is
Measuring distance between two empirical distributions I think your question is essentially the same as Can I use Kolmogorov-Smirnov to compare two empirical distributions?, for which the Kolmogorov-Smirnov test is commonly used. The KS test statistic is a natural measure of the distance between two samples. For more details, please see Kolmogorov–Smirnov test on Wikipedia.
Measuring distance between two empirical distributions I think your question is essentially the same as Can I use Kolmogorov-Smirnov to compare two empirical distributions?, for which the Kolmogorov-Smirnov test is commonly used. The KS test statistic is
31,904
Measuring distance between two empirical distributions
An area in statistics where this problem arises naturally is Approximate Bayesian Computation. What you actually want to do is to summarise the whole sample into "informative" statistics that can later be compared using a suitable metric: this problem is not trivial at all. I would even say that it is actually one of the "hot topics" in statistics. It is not that the method is not theoretical, it is just that there is not unique way of comparing two data sets. It usually depends on your aims and your model. If you have a model and can identify sufficient statistics for it, then, by comparing the sufficient statistics of both samples you can assess how different the information contained in each sample is. If they are very close, then the associated [likelihood functions] (http://en.wikipedia.org/wiki/Likelihood_function) would be similar, and therefore the inferences on the corresponding parameters would be similar as well.
Measuring distance between two empirical distributions
An area in statistics where this problem arises naturally is Approximate Bayesian Computation. What you actually want to do is to summarise the whole sample into "informative" statistics that can late
Measuring distance between two empirical distributions An area in statistics where this problem arises naturally is Approximate Bayesian Computation. What you actually want to do is to summarise the whole sample into "informative" statistics that can later be compared using a suitable metric: this problem is not trivial at all. I would even say that it is actually one of the "hot topics" in statistics. It is not that the method is not theoretical, it is just that there is not unique way of comparing two data sets. It usually depends on your aims and your model. If you have a model and can identify sufficient statistics for it, then, by comparing the sufficient statistics of both samples you can assess how different the information contained in each sample is. If they are very close, then the associated [likelihood functions] (http://en.wikipedia.org/wiki/Likelihood_function) would be similar, and therefore the inferences on the corresponding parameters would be similar as well.
Measuring distance between two empirical distributions An area in statistics where this problem arises naturally is Approximate Bayesian Computation. What you actually want to do is to summarise the whole sample into "informative" statistics that can late
31,905
Correlation among categories between categorical nominal variables
The "focal" association between category $i$ of one nominal variable and category $j$ of the other one is expressed by the frequency residual in the cell $ij$, as we know. If the residual is 0 then it means the frequency is what is expected when the two nominal variables are not associated. The larger the residual the greater is the association due to the overrepresented combination $ij$ in the sample. The large negative residual equivalently says of the underrepresented combination. So, frequency residual is what you want. Raw residuals are not suitable though, because they depend on the marginal totals and the overall total and the table size: the value is not standardized in any way. But SPSS can display you standardized residuals also called Pearson residuals. St. residual is the residual divided by an estimate of its standard deviation (equal to the sq. root of the expected value). St. residuals of a table have mean 0 and st. dev. 1; therefore, st. residual serves a z-value, like z-value in a distribution of a quantitative variable (actually, it is z in Poisson distribution). St. residuals are comparable between different tables of same size and the same total $N$. Chi-square statistic of a contingency table is the sum of the squared st. residuals in it. Comparing st. residuals in a table and across same-volumed tables helps identify the particular cells that contribute most to chi-square statistic. SPSS also displays adjusted residuals (= adjusted standardized residuals). Adj. residual is the residual divided by an estimate of its standard error. Interesting that adj. residual is just equal to $\sqrt{N}r_{ij}$, where $N$ is the grand total and $r_{ij}$ is the Pearson correlation (alias Phi correlation) between dummy variables corresponding to the categories $i$ and $j$ of the two nominal variables. This $r$ is exactly what you say you want to compute. Adj. residual is directly related to it. Unlike st. residual, adj. residual is also standardized wrt to the shape of the marginal distributions in the table (it takes into consideration the expected frequency not only in that cell but also in the cells outside its row and its column) and so you can directly see the strength of the tie between categories $i$ and $j$ - without worrying about whether their marginal totals are big or small relative the other categories'. Adj. residual is also like a z-score, but now it is like z of normal (not Poisson) distribution. If adj. residual is above 2 or below -2 you may conclude it is significant at p<0.05 level$^1$. Adj. residuals are still effected by $N$; $r$'s are not, but you can obtain all the $r$s from adj. residuals, following the above formula, without spending time to produce dummy variables.$^2$ In regard to your second question, about 3-way category ties - this is possible as part of the general loglinear analysis which also displays residuals. However, practical use of 3-way cell residuals is modest: 3(+)-way association measures are not easily standardized and are not easily interpretable. $^1$ In st. normal curve $1.96 \approx 2$ is the cut-point of 2.5% tail, so 5% if you consider both tails as with 2-sided alternative hypothesis. $^2$ It follows that the significance of the adjusted residual in cell $ij$ equals the significance of $r_{ij}$. Besides, if there is only 2 columns in the table and you are performing z-test of proportions between $\text {Pr}(i,1)$ and $\text {Pr}(i,2)$, column proportions for row $i$, the p-value of that test equals the significance of both (any) adj. residuals in row $i$ of the 2-column table.
Correlation among categories between categorical nominal variables
The "focal" association between category $i$ of one nominal variable and category $j$ of the other one is expressed by the frequency residual in the cell $ij$, as we know. If the residual is 0 then it
Correlation among categories between categorical nominal variables The "focal" association between category $i$ of one nominal variable and category $j$ of the other one is expressed by the frequency residual in the cell $ij$, as we know. If the residual is 0 then it means the frequency is what is expected when the two nominal variables are not associated. The larger the residual the greater is the association due to the overrepresented combination $ij$ in the sample. The large negative residual equivalently says of the underrepresented combination. So, frequency residual is what you want. Raw residuals are not suitable though, because they depend on the marginal totals and the overall total and the table size: the value is not standardized in any way. But SPSS can display you standardized residuals also called Pearson residuals. St. residual is the residual divided by an estimate of its standard deviation (equal to the sq. root of the expected value). St. residuals of a table have mean 0 and st. dev. 1; therefore, st. residual serves a z-value, like z-value in a distribution of a quantitative variable (actually, it is z in Poisson distribution). St. residuals are comparable between different tables of same size and the same total $N$. Chi-square statistic of a contingency table is the sum of the squared st. residuals in it. Comparing st. residuals in a table and across same-volumed tables helps identify the particular cells that contribute most to chi-square statistic. SPSS also displays adjusted residuals (= adjusted standardized residuals). Adj. residual is the residual divided by an estimate of its standard error. Interesting that adj. residual is just equal to $\sqrt{N}r_{ij}$, where $N$ is the grand total and $r_{ij}$ is the Pearson correlation (alias Phi correlation) between dummy variables corresponding to the categories $i$ and $j$ of the two nominal variables. This $r$ is exactly what you say you want to compute. Adj. residual is directly related to it. Unlike st. residual, adj. residual is also standardized wrt to the shape of the marginal distributions in the table (it takes into consideration the expected frequency not only in that cell but also in the cells outside its row and its column) and so you can directly see the strength of the tie between categories $i$ and $j$ - without worrying about whether their marginal totals are big or small relative the other categories'. Adj. residual is also like a z-score, but now it is like z of normal (not Poisson) distribution. If adj. residual is above 2 or below -2 you may conclude it is significant at p<0.05 level$^1$. Adj. residuals are still effected by $N$; $r$'s are not, but you can obtain all the $r$s from adj. residuals, following the above formula, without spending time to produce dummy variables.$^2$ In regard to your second question, about 3-way category ties - this is possible as part of the general loglinear analysis which also displays residuals. However, practical use of 3-way cell residuals is modest: 3(+)-way association measures are not easily standardized and are not easily interpretable. $^1$ In st. normal curve $1.96 \approx 2$ is the cut-point of 2.5% tail, so 5% if you consider both tails as with 2-sided alternative hypothesis. $^2$ It follows that the significance of the adjusted residual in cell $ij$ equals the significance of $r_{ij}$. Besides, if there is only 2 columns in the table and you are performing z-test of proportions between $\text {Pr}(i,1)$ and $\text {Pr}(i,2)$, column proportions for row $i$, the p-value of that test equals the significance of both (any) adj. residuals in row $i$ of the 2-column table.
Correlation among categories between categorical nominal variables The "focal" association between category $i$ of one nominal variable and category $j$ of the other one is expressed by the frequency residual in the cell $ij$, as we know. If the residual is 0 then it
31,906
Correlation among categories between categorical nominal variables
Directly taken from a document on bivariate statistics with SPSS that lives here: Chi-square is a useful technique because you can use it to see if there’s a relationship between two ordinal variables, two nominal variables, or between an ordinal and a nominal variable. You look at the assymp. Sig column and if it is less than .05, the relationship between the two variables is statistically significant.
Correlation among categories between categorical nominal variables
Directly taken from a document on bivariate statistics with SPSS that lives here: Chi-square is a useful technique because you can use it to see if there’s a relationship between two ordinal variab
Correlation among categories between categorical nominal variables Directly taken from a document on bivariate statistics with SPSS that lives here: Chi-square is a useful technique because you can use it to see if there’s a relationship between two ordinal variables, two nominal variables, or between an ordinal and a nominal variable. You look at the assymp. Sig column and if it is less than .05, the relationship between the two variables is statistically significant.
Correlation among categories between categorical nominal variables Directly taken from a document on bivariate statistics with SPSS that lives here: Chi-square is a useful technique because you can use it to see if there’s a relationship between two ordinal variab
31,907
Three open philosophical problems in statistics
I don't think these really are questions which can be answered conclusively. (IOW, they are, indeed, philosophical). That said... Statistics and decision making Yes, we can use statistics in decision making. However, there are limits to its applicability; IOW, one has to understand what one is doing. This is fully applicable to any theory. The meaning of probability 95% probability of rain tomorrow means that if your cost of preparing for a rain (e.g., taking the umbrella) is A and your cost of being caught in the rain unprepared (e.g., wet suit) is B, then you should take the umbrella with you iff A < 0.95 * B. Do people understand probability? No, people do not understand much, least of all probability. Kahneman and Tversky have shown that human intuition is flawed on many levels, but intuition and understanding are not identical, and I would argue that people understand even less than they intuit. To what extent are Salsburg's problems really problems for modern statistics? Nil. I don't think anyone cares about these issues except for philosophers and those in a philosophical mood. Have we made any progress towards finding resolutions to these problems? Everyone who cares has a resolution. My personal resolution is above.
Three open philosophical problems in statistics
I don't think these really are questions which can be answered conclusively. (IOW, they are, indeed, philosophical). That said... Statistics and decision making Yes, we can use statistics in decision
Three open philosophical problems in statistics I don't think these really are questions which can be answered conclusively. (IOW, they are, indeed, philosophical). That said... Statistics and decision making Yes, we can use statistics in decision making. However, there are limits to its applicability; IOW, one has to understand what one is doing. This is fully applicable to any theory. The meaning of probability 95% probability of rain tomorrow means that if your cost of preparing for a rain (e.g., taking the umbrella) is A and your cost of being caught in the rain unprepared (e.g., wet suit) is B, then you should take the umbrella with you iff A < 0.95 * B. Do people understand probability? No, people do not understand much, least of all probability. Kahneman and Tversky have shown that human intuition is flawed on many levels, but intuition and understanding are not identical, and I would argue that people understand even less than they intuit. To what extent are Salsburg's problems really problems for modern statistics? Nil. I don't think anyone cares about these issues except for philosophers and those in a philosophical mood. Have we made any progress towards finding resolutions to these problems? Everyone who cares has a resolution. My personal resolution is above.
Three open philosophical problems in statistics I don't think these really are questions which can be answered conclusively. (IOW, they are, indeed, philosophical). That said... Statistics and decision making Yes, we can use statistics in decision
31,908
Three open philosophical problems in statistics
Can we use statistics/probability to make decisions? Of course we can, the way in which we should go about this is by choosing the course of action that minimises our expected loss. In this case, all lottery numbers are equally likely to come up; if all provide the same prize, then the expected loss is the same for any number, so it doesn't matter which we choose. If we also have the option not to play the lottery, that would probably be the course of action we should take as it will minimise our expected loss assuming that the lottery makes a profit for somebody (or at least covers the cost of running the lottery). Of course this is just common sense and is consistent with logic, and could be expressed in purely probabilistic terms. It seems to me that the question arises from a rather limited view of how statistics can be used to make decisions, it doesn't have to be done with quasi-Fisherian hypothesis tests. I would suggest that Jaynes book on Probability theory goes a fair way to addressing points (2) and (3), probabilities can represent objective measures of plausibility without them being "personal probabilities", but I expect @probabilityislogic can explain that better than I can.
Three open philosophical problems in statistics
Can we use statistics/probability to make decisions? Of course we can, the way in which we should go about this is by choosing the course of action that minimises our expected loss. In this case, al
Three open philosophical problems in statistics Can we use statistics/probability to make decisions? Of course we can, the way in which we should go about this is by choosing the course of action that minimises our expected loss. In this case, all lottery numbers are equally likely to come up; if all provide the same prize, then the expected loss is the same for any number, so it doesn't matter which we choose. If we also have the option not to play the lottery, that would probably be the course of action we should take as it will minimise our expected loss assuming that the lottery makes a profit for somebody (or at least covers the cost of running the lottery). Of course this is just common sense and is consistent with logic, and could be expressed in purely probabilistic terms. It seems to me that the question arises from a rather limited view of how statistics can be used to make decisions, it doesn't have to be done with quasi-Fisherian hypothesis tests. I would suggest that Jaynes book on Probability theory goes a fair way to addressing points (2) and (3), probabilities can represent objective measures of plausibility without them being "personal probabilities", but I expect @probabilityislogic can explain that better than I can.
Three open philosophical problems in statistics Can we use statistics/probability to make decisions? Of course we can, the way in which we should go about this is by choosing the course of action that minimises our expected loss. In this case, al
31,909
Checking whether a density is exponential family
You've put your finger on the crux of the matter, and indeed the result is fairly obvious, but the logic seems a little off. The method described below repeatedly uses logarithms and differentiation to make the problem progressively simpler, until it becomes utterly trivial. By definition, $f$ is the PDF for an exponential family when its logarithm can be written as a sum of something in terms of the parameter ($a$) only, something else in terms of the data ($y$) only, and something else that is a product of a function of $a$ and a function of $y$. This means you are free to ignore any factors that clearly depend only on the parameter or only on the data. In this case it's obvious $\frac{4}{1+4a}$ depends only on $a$, so we may ignore it. The issue is with $y+a$. We need to prove there cannot exist "nice" functions $\eta$ and $T$ such that $\log(y+a) = \eta(a) T(y)$ plus some function of $a$ alone plus some other function of $y$ alone. That "plus" part is annoying, but we can kill it off by differentiating first with respect to $a$ (the derivative of any function of $y$ alone will be zero) and then with respect to $y$ (the derivative of a function of $a$ alone will be zero). Upon negating both sides (to make the left hand side positive) this gives $$-\frac{\partial^2}{\partial a\partial y}\log(y+a) = \frac{1}{(a+y)^2} = -\eta'(a)T'(y).$$ I want to take logarithms to simplify the right hand side (which, being equal to the left hand side, is always positive). Assuming $\eta'$ and $T'$ are both continuous will guarantee there are some intervals of values for $a$ and for $y$ in which either $-\eta'(a)\gt 0$ and $T'(y)\gt 0$ or else $\eta'(a)\gt 0$ and $-T'(y)\gt 0$. This means we indeed can split the right hand side into two positive factors, allowing the logarithm to be applied. Doing so yields $$-2\log(a+y) = \log\frac{1}{(a+y)^2} = \log\left(-\eta'(a)T'(y)\right) = \log(-\eta'(a)) + \log(T'(y))$$ (or else a comparable expression with a few minus signs thrown in). Now we play the same game: in either case, differentiating both sides with respect to both $a$ and $y$ yields $$\frac{2}{(a+y)^2} = 0,$$ an impossibility. Looking back, this approach had to assume both $\eta$ and $T$ have second derivatives within some intervals of their arguments. The analysis can be done along the same lines using finite differences to weaken those assumptions, but it's probably not worth the bother.
Checking whether a density is exponential family
You've put your finger on the crux of the matter, and indeed the result is fairly obvious, but the logic seems a little off. The method described below repeatedly uses logarithms and differentiation
Checking whether a density is exponential family You've put your finger on the crux of the matter, and indeed the result is fairly obvious, but the logic seems a little off. The method described below repeatedly uses logarithms and differentiation to make the problem progressively simpler, until it becomes utterly trivial. By definition, $f$ is the PDF for an exponential family when its logarithm can be written as a sum of something in terms of the parameter ($a$) only, something else in terms of the data ($y$) only, and something else that is a product of a function of $a$ and a function of $y$. This means you are free to ignore any factors that clearly depend only on the parameter or only on the data. In this case it's obvious $\frac{4}{1+4a}$ depends only on $a$, so we may ignore it. The issue is with $y+a$. We need to prove there cannot exist "nice" functions $\eta$ and $T$ such that $\log(y+a) = \eta(a) T(y)$ plus some function of $a$ alone plus some other function of $y$ alone. That "plus" part is annoying, but we can kill it off by differentiating first with respect to $a$ (the derivative of any function of $y$ alone will be zero) and then with respect to $y$ (the derivative of a function of $a$ alone will be zero). Upon negating both sides (to make the left hand side positive) this gives $$-\frac{\partial^2}{\partial a\partial y}\log(y+a) = \frac{1}{(a+y)^2} = -\eta'(a)T'(y).$$ I want to take logarithms to simplify the right hand side (which, being equal to the left hand side, is always positive). Assuming $\eta'$ and $T'$ are both continuous will guarantee there are some intervals of values for $a$ and for $y$ in which either $-\eta'(a)\gt 0$ and $T'(y)\gt 0$ or else $\eta'(a)\gt 0$ and $-T'(y)\gt 0$. This means we indeed can split the right hand side into two positive factors, allowing the logarithm to be applied. Doing so yields $$-2\log(a+y) = \log\frac{1}{(a+y)^2} = \log\left(-\eta'(a)T'(y)\right) = \log(-\eta'(a)) + \log(T'(y))$$ (or else a comparable expression with a few minus signs thrown in). Now we play the same game: in either case, differentiating both sides with respect to both $a$ and $y$ yields $$\frac{2}{(a+y)^2} = 0,$$ an impossibility. Looking back, this approach had to assume both $\eta$ and $T$ have second derivatives within some intervals of their arguments. The analysis can be done along the same lines using finite differences to weaken those assumptions, but it's probably not worth the bother.
Checking whether a density is exponential family You've put your finger on the crux of the matter, and indeed the result is fairly obvious, but the logic seems a little off. The method described below repeatedly uses logarithms and differentiation
31,910
Checking whether a density is exponential family
It will be in exponential family if it can be written in $fh(x)e^{ηT(x)-A(η)}$(with another conditions ) . Let $g(x,η)=ηT(x)-A(η)$. Now for any 4 data points $x_1,x_2,x_3,x_4$ in the sample space $ \frac{(g(x1,η)-g(x2,η))}{(g(x3,η)-g(x4,η))}$= $\frac{(T(x1)-T(x2))}{(T(x3) - T(x4))}$ , which is free of η. Now here $f(y;a)= 4\frac{y+a}{(4a+1)}$ = $4 e^( ln(y+a)-ln(4a+1) )$. Take $g(x,η)=ln(y+a)-ln(4a+1)$. So $\frac{(g(x1,η)-g(x2,η))}{(g(x3,η)-g(x4,η))}$=$\frac{(ln(y1+a)-ln(y2+a))}{(ln(y3+a)-ln(y4+a))}$ - which is not free of a . so $f(y;a)$ does not belong to Exponential family .
Checking whether a density is exponential family
It will be in exponential family if it can be written in $fh(x)e^{ηT(x)-A(η)}$(with another conditions ) . Let $g(x,η)=ηT(x)-A(η)$. Now for any 4 data points $x_1,x_2,x_3,x_4$ in the sample space $
Checking whether a density is exponential family It will be in exponential family if it can be written in $fh(x)e^{ηT(x)-A(η)}$(with another conditions ) . Let $g(x,η)=ηT(x)-A(η)$. Now for any 4 data points $x_1,x_2,x_3,x_4$ in the sample space $ \frac{(g(x1,η)-g(x2,η))}{(g(x3,η)-g(x4,η))}$= $\frac{(T(x1)-T(x2))}{(T(x3) - T(x4))}$ , which is free of η. Now here $f(y;a)= 4\frac{y+a}{(4a+1)}$ = $4 e^( ln(y+a)-ln(4a+1) )$. Take $g(x,η)=ln(y+a)-ln(4a+1)$. So $\frac{(g(x1,η)-g(x2,η))}{(g(x3,η)-g(x4,η))}$=$\frac{(ln(y1+a)-ln(y2+a))}{(ln(y3+a)-ln(y4+a))}$ - which is not free of a . so $f(y;a)$ does not belong to Exponential family .
Checking whether a density is exponential family It will be in exponential family if it can be written in $fh(x)e^{ηT(x)-A(η)}$(with another conditions ) . Let $g(x,η)=ηT(x)-A(η)$. Now for any 4 data points $x_1,x_2,x_3,x_4$ in the sample space $
31,911
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
The question characterizes logistic regression as $$\text{logit}(y) = \beta_0 + \beta_1 x + \varepsilon$$ and proposes to fit this model using least squares. It points out that because $y$ is a binary ($0$-$1$) variable, $\text{logit}(y)$ is undefined (or should be considered infinite), which is--to say the least--problematic! The resolution of this conundrum is to avoid taking the logit of $y$ but instead apply its inverse, the logistic function $$f(x) = \frac{1}{1 + \exp(-x)},$$ to the right hand side. Because $y$ on the left hand side still is a random variable with possible outcomes $0$ and $1$, it must be a Bernoulli variable: that is, what we need to know about it is the chance that $y=1$, written $\Pr(y=1).$ Therefore we make another attempt in the form $$\Pr(y=1) = f(\beta_0 + \beta_1 x).$$ This is an example of a generalized linear model. Its parameters $\beta_0$ and $\beta_1$ are typically (but not necessarily) found using Maximum Likelihood. To understand this better, many people find it instructive to create synthetic datasets according to this model (instead of analyzing actual data, where the true model is unknown). We will look at how that might be coded in R, which is well suited to expressing and simulating statistical models. First, though, let's inspect its results. The data are shown as jittered points (they have been randomly shifted slightly in the horizontal direction to resolve overlaps). The true underlying probability function is plotted in solid red. The probability function fit using Maximum Likliehood is plotted in dashed gray. You can see that where the red curve is high--which means the chance of $y=1$ is high--most of the data are $1$'s, whereas where the red curve drops to low levels, most of the data are $0$'s. The height of the curve stipulates the chance that the response will be a $1$. In logistic regression, the curve usually has the sigmoidal shape of the logistic function, while the data are always either at $y=1$ or $y=0$. Reading over the code, which is written for expressive clarity, will help make these descriptions precise. # # Synthesize some data. # set.seed(17) # Allows results to be reproduced exactly n <- 8 # Number of distinct x values k <- 4 # Number of independent obs's for each x x <- rep(1:n, 4) # Independent values beta <- c(3, -1) # True parameters logistic <- function(x) 1 / (1 + exp(-x)) probability <- function(x, b) logistic(b[1] + b[2]*x) y <- rbinom(n*k, size=1, prob=probability(x, beta)) # Simulated data # # Fit the data using a logistic regression. # summary(fit <- glm(y ~ x, family=binomial(link="logit"))) # # Plot the data, the true underlying probability function, and the fitted one. # jitter <- runif(n*k, -1/3, 1/3) # Displaces points to resolve overlaps plot(x+jitter, y, type="p", xlab="x", ylab="y", main="Data with true and fitted models") curve(probability(x, beta), col="Red", lwd=2, add=TRUE) curve(probability(x, coef(fit)), col="Gray", lwd=2, lty=2, add=TRUE)
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
The question characterizes logistic regression as $$\text{logit}(y) = \beta_0 + \beta_1 x + \varepsilon$$ and proposes to fit this model using least squares. It points out that because $y$ is a binar
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression The question characterizes logistic regression as $$\text{logit}(y) = \beta_0 + \beta_1 x + \varepsilon$$ and proposes to fit this model using least squares. It points out that because $y$ is a binary ($0$-$1$) variable, $\text{logit}(y)$ is undefined (or should be considered infinite), which is--to say the least--problematic! The resolution of this conundrum is to avoid taking the logit of $y$ but instead apply its inverse, the logistic function $$f(x) = \frac{1}{1 + \exp(-x)},$$ to the right hand side. Because $y$ on the left hand side still is a random variable with possible outcomes $0$ and $1$, it must be a Bernoulli variable: that is, what we need to know about it is the chance that $y=1$, written $\Pr(y=1).$ Therefore we make another attempt in the form $$\Pr(y=1) = f(\beta_0 + \beta_1 x).$$ This is an example of a generalized linear model. Its parameters $\beta_0$ and $\beta_1$ are typically (but not necessarily) found using Maximum Likelihood. To understand this better, many people find it instructive to create synthetic datasets according to this model (instead of analyzing actual data, where the true model is unknown). We will look at how that might be coded in R, which is well suited to expressing and simulating statistical models. First, though, let's inspect its results. The data are shown as jittered points (they have been randomly shifted slightly in the horizontal direction to resolve overlaps). The true underlying probability function is plotted in solid red. The probability function fit using Maximum Likliehood is plotted in dashed gray. You can see that where the red curve is high--which means the chance of $y=1$ is high--most of the data are $1$'s, whereas where the red curve drops to low levels, most of the data are $0$'s. The height of the curve stipulates the chance that the response will be a $1$. In logistic regression, the curve usually has the sigmoidal shape of the logistic function, while the data are always either at $y=1$ or $y=0$. Reading over the code, which is written for expressive clarity, will help make these descriptions precise. # # Synthesize some data. # set.seed(17) # Allows results to be reproduced exactly n <- 8 # Number of distinct x values k <- 4 # Number of independent obs's for each x x <- rep(1:n, 4) # Independent values beta <- c(3, -1) # True parameters logistic <- function(x) 1 / (1 + exp(-x)) probability <- function(x, b) logistic(b[1] + b[2]*x) y <- rbinom(n*k, size=1, prob=probability(x, beta)) # Simulated data # # Fit the data using a logistic regression. # summary(fit <- glm(y ~ x, family=binomial(link="logit"))) # # Plot the data, the true underlying probability function, and the fitted one. # jitter <- runif(n*k, -1/3, 1/3) # Displaces points to resolve overlaps plot(x+jitter, y, type="p", xlab="x", ylab="y", main="Data with true and fitted models") curve(probability(x, beta), col="Red", lwd=2, add=TRUE) curve(probability(x, coef(fit)), col="Gray", lwd=2, lty=2, add=TRUE)
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression The question characterizes logistic regression as $$\text{logit}(y) = \beta_0 + \beta_1 x + \varepsilon$$ and proposes to fit this model using least squares. It points out that because $y$ is a binar
31,912
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
The answer is that you do use the log odds ratio for the regression, but the equation for "p" instead which has values of 0 or 1 in the sample. The regression equation is estimated via iteratively reweighted least squares (IRLS). The method can be found here Manually calculating logistic regression coefficient
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
The answer is that you do use the log odds ratio for the regression, but the equation for "p" instead which has values of 0 or 1 in the sample. The regression equation is estimated via iteratively rew
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression The answer is that you do use the log odds ratio for the regression, but the equation for "p" instead which has values of 0 or 1 in the sample. The regression equation is estimated via iteratively reweighted least squares (IRLS). The method can be found here Manually calculating logistic regression coefficient
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression The answer is that you do use the log odds ratio for the regression, but the equation for "p" instead which has values of 0 or 1 in the sample. The regression equation is estimated via iteratively rew
31,913
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
You got logistic regression kind of backwards (see whuber's comment on your question). True, the logit of 1 is infinity. But that's ok, because at no stage do you take the logit of the observed p's. Consider standard regression, for simplicity using a single x variable: y = b0 + b1*x Logistic regression means that y is not interpreted as the response proportions (the p's), but rather as the logit of the response proportions. So let's say a p = 1. Because its logit is infinity, with finite b0 and b1, the logistic regression will never exactly predict it except asymptotically as x approaches infinity. With the observed proportion of 1, the logistic regression for that x can however predict a very high probability (but again, never as high as 1), say .99. Then, the probability of observing a proportion of 1 for a limited number of trials can easily be large. So when logistic regression corresponds to maximizing the likelihood, the probability of that data point given the model can be high. So, a proportion of 1 need not be more influential (to "drive the regression to always have infinite slope") than any other proportion. This is also true for other sigmoidal-link regression types such as probit.
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression
You got logistic regression kind of backwards (see whuber's comment on your question). True, the logit of 1 is infinity. But that's ok, because at no stage do you take the logit of the observed p's. C
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression You got logistic regression kind of backwards (see whuber's comment on your question). True, the logit of 1 is infinity. But that's ok, because at no stage do you take the logit of the observed p's. Consider standard regression, for simplicity using a single x variable: y = b0 + b1*x Logistic regression means that y is not interpreted as the response proportions (the p's), but rather as the logit of the response proportions. So let's say a p = 1. Because its logit is infinity, with finite b0 and b1, the logistic regression will never exactly predict it except asymptotically as x approaches infinity. With the observed proportion of 1, the logistic regression for that x can however predict a very high probability (but again, never as high as 1), say .99. Then, the probability of observing a proportion of 1 for a limited number of trials can easily be large. So when logistic regression corresponds to maximizing the likelihood, the probability of that data point given the model can be high. So, a proportion of 1 need not be more influential (to "drive the regression to always have infinite slope") than any other proportion. This is also true for other sigmoidal-link regression types such as probit.
When y= 1, logit is infinity. How can you regress that? Yet somehow, that's logistic regression You got logistic regression kind of backwards (see whuber's comment on your question). True, the logit of 1 is infinity. But that's ok, because at no stage do you take the logit of the observed p's. C
31,914
What is the implication of unit root of MA?
To elaborate on some of the above points, consider differencing a process following a deterministic trend $y_t=a+bt+\epsilon_t$. $\Delta y_t$ is not invertible, as $\Delta y_t=bt-b(t-1)+\Delta\epsilon_t=b+\Delta\epsilon_t$. This is an $MA(1)$ with a unit root, and hence not invertible. This is because first differencing is the "wrong" detrending scheme for a trend stationary process. Also, we have that the long-run variance of an $MA(1)$ process can be written as $$ J=\sigma^2(1+\theta)^2, $$ as \begin{eqnarray*} J &=& \sum_{j=-\infty}^{\infty}\gamma_j \\ &=& \gamma_0 + 2 \sum_{j=1}^{\infty}\gamma_j \\ &=& \gamma_0 + 2 \gamma_1 + 0\\ &=& \sigma^2(1 + \theta^2) + 2 \theta \sigma^2\\ &=& \sigma^2(1 + \theta^2 + 2\theta)\\ &=& \sigma^2(1 + \theta)^2 \end{eqnarray*} We have $J=0$ for $\theta=-1$, so an $MA(1)$ with a unit root. This is a problem for example because the long-run variance is asymptotic variance of the sample mean, $$ \sqrt{T}(\bar{Y}_T-\mu)\to_d N\Biggl(0,\sum_{j=-\infty}^{\infty}\gamma_j\Biggr), $$ which is for instance used for standard errors - which should not be zero.
What is the implication of unit root of MA?
To elaborate on some of the above points, consider differencing a process following a deterministic trend $y_t=a+bt+\epsilon_t$. $\Delta y_t$ is not invertible, as $\Delta y_t=bt-b(t-1)+\Delta\epsilo
What is the implication of unit root of MA? To elaborate on some of the above points, consider differencing a process following a deterministic trend $y_t=a+bt+\epsilon_t$. $\Delta y_t$ is not invertible, as $\Delta y_t=bt-b(t-1)+\Delta\epsilon_t=b+\Delta\epsilon_t$. This is an $MA(1)$ with a unit root, and hence not invertible. This is because first differencing is the "wrong" detrending scheme for a trend stationary process. Also, we have that the long-run variance of an $MA(1)$ process can be written as $$ J=\sigma^2(1+\theta)^2, $$ as \begin{eqnarray*} J &=& \sum_{j=-\infty}^{\infty}\gamma_j \\ &=& \gamma_0 + 2 \sum_{j=1}^{\infty}\gamma_j \\ &=& \gamma_0 + 2 \gamma_1 + 0\\ &=& \sigma^2(1 + \theta^2) + 2 \theta \sigma^2\\ &=& \sigma^2(1 + \theta^2 + 2\theta)\\ &=& \sigma^2(1 + \theta)^2 \end{eqnarray*} We have $J=0$ for $\theta=-1$, so an $MA(1)$ with a unit root. This is a problem for example because the long-run variance is asymptotic variance of the sample mean, $$ \sqrt{T}(\bar{Y}_T-\mu)\to_d N\Biggl(0,\sum_{j=-\infty}^{\infty}\gamma_j\Biggr), $$ which is for instance used for standard errors - which should not be zero.
What is the implication of unit root of MA? To elaborate on some of the above points, consider differencing a process following a deterministic trend $y_t=a+bt+\epsilon_t$. $\Delta y_t$ is not invertible, as $\Delta y_t=bt-b(t-1)+\Delta\epsilo
31,915
What is the implication of unit root of MA?
If the roots of the MA process indicate a violation this can be due to a variety of causes; Over-differencing of Y Redundancy of the AR and MA structure Omitted deterministic variables ( Pulses/Level Shifts/Seasonal Pulses/Local time trends Incorrect Power Transformation Changes in parameters over time Changes in error variance over time Omission of user-specified causal variables Hope this helps ...why model identification is not " a walk in the woods " and shouldn't be accomplished using simp[le-minded AIC/BIC tests but rather aggressively/comprehensively formulated.
What is the implication of unit root of MA?
If the roots of the MA process indicate a violation this can be due to a variety of causes; Over-differencing of Y Redundancy of the AR and MA structure Omitted deterministic variables ( Pulses/Level
What is the implication of unit root of MA? If the roots of the MA process indicate a violation this can be due to a variety of causes; Over-differencing of Y Redundancy of the AR and MA structure Omitted deterministic variables ( Pulses/Level Shifts/Seasonal Pulses/Local time trends Incorrect Power Transformation Changes in parameters over time Changes in error variance over time Omission of user-specified causal variables Hope this helps ...why model identification is not " a walk in the woods " and shouldn't be accomplished using simp[le-minded AIC/BIC tests but rather aggressively/comprehensively formulated.
What is the implication of unit root of MA? If the roots of the MA process indicate a violation this can be due to a variety of causes; Over-differencing of Y Redundancy of the AR and MA structure Omitted deterministic variables ( Pulses/Level
31,916
What is the implication of unit root of MA?
I think if you are sure that the process is ARMA, then the MA part doesn't affect the stationarity. But if you are not sure of that, unit root tests of the MA part may suggest that it's "likely" that the process as specified is not actually ARMA (and so you would want to integrate it).
What is the implication of unit root of MA?
I think if you are sure that the process is ARMA, then the MA part doesn't affect the stationarity. But if you are not sure of that, unit root tests of the MA part may suggest that it's "likely" that
What is the implication of unit root of MA? I think if you are sure that the process is ARMA, then the MA part doesn't affect the stationarity. But if you are not sure of that, unit root tests of the MA part may suggest that it's "likely" that the process as specified is not actually ARMA (and so you would want to integrate it).
What is the implication of unit root of MA? I think if you are sure that the process is ARMA, then the MA part doesn't affect the stationarity. But if you are not sure of that, unit root tests of the MA part may suggest that it's "likely" that
31,917
What is the fastest method for determining collinearity degree?
The condition number is the statistic you want to look at. It's an exhaustive measure of colinearity of your design space and much cheaper to compute than the VIF. The formula is: $$2\log\left(\frac{d_1(X_s)}{d_p(X_s)}\right) (1)$$ where $d_p$ ($d_1$) is the smallest (largest) singular value of $X_s$ and $X_s$ are the centred, re-scaled variables. Reading your comment: this is what I was suspecting. To compute the condition # you don't need all 100e6 data points. Just samples, randomly, in the order of 100e3 (by experimenting with simulated datasets you can convince yourself that to get reliable results you should target about 5*k, where k is the # of non collinear variables so even 100e3 is very large already). That should already give you a pretty good idea what variables are causing collinearity. Also, you have specialized algorithm to compute the first and last few singular values and the last few singular vector only. There are algorithms do get these w/o computing the full SVD of $X$ (SVD-S). However, I don't know if these are implemented in R so to make the example below accessible I'll just use a small example and the classical SVD from R. A high condition number (typically when the ratio (1) is larger than 10) tells you that $X_s'X_s$ is ill-conditioned, that there are components that can be re-written as (near) linear combination of the other variables. Below I give a brief (small scale) example of how SVD can be used to uncover such relations. n<-100 p<-20 #non-ill conditioned part of the dataset. x<-matrix(rnorm(n*p),nc=p) x<-scale(x) #introduce a variable that causes x to be #ill conditioned. y<-x%*%c(rnorm(3),rep(0,p))[1:p] y<-scale(y) x<-cbind(x,y) p<-ncol(x) A<-svd(x,nu=0) #x is ill-conditioned: this ratio is larger #than 10. (step 1) 2*log(A$d[1]/A$d[p]) #check what is causing it: (step 2) round(A$v[,ncol(A$v)],2) #you can write the last variable as (.23*x_1+.5*x_2-.45*x_3)/(-.7) [1] #here the relation is exact because: min(A$d) #is 0. if min(A$d)>0 then this gives you how much there is noise #there is arround [1]. #so I remove the last variable. (step 3) x<-x[,-ncol(x)] #no more ill-condition. 2*log(A$d[1]/A$d[p-1]) This is for the linear algebra of the problem when there is a single variable causing the ill-regression. In most case you will have more than one (near) exact relationship and you will have to repeat steps 1 through 3. In practice, the computational specifics will depend on how clever is the approach you use to solve the SVD problem. You can make yourself an idea of how many exact relationships there are in your dataset by computing $$2\log\left(\frac{d_1(X_s)}{d_j(X_s)}\right)$$ for all $j$'s. To do this you only need the singular values which you can get at cost $O(p^2)$
What is the fastest method for determining collinearity degree?
The condition number is the statistic you want to look at. It's an exhaustive measure of colinearity of your design space and much cheaper to compute than the VIF. The formula is: $$2\log\left(\frac{d
What is the fastest method for determining collinearity degree? The condition number is the statistic you want to look at. It's an exhaustive measure of colinearity of your design space and much cheaper to compute than the VIF. The formula is: $$2\log\left(\frac{d_1(X_s)}{d_p(X_s)}\right) (1)$$ where $d_p$ ($d_1$) is the smallest (largest) singular value of $X_s$ and $X_s$ are the centred, re-scaled variables. Reading your comment: this is what I was suspecting. To compute the condition # you don't need all 100e6 data points. Just samples, randomly, in the order of 100e3 (by experimenting with simulated datasets you can convince yourself that to get reliable results you should target about 5*k, where k is the # of non collinear variables so even 100e3 is very large already). That should already give you a pretty good idea what variables are causing collinearity. Also, you have specialized algorithm to compute the first and last few singular values and the last few singular vector only. There are algorithms do get these w/o computing the full SVD of $X$ (SVD-S). However, I don't know if these are implemented in R so to make the example below accessible I'll just use a small example and the classical SVD from R. A high condition number (typically when the ratio (1) is larger than 10) tells you that $X_s'X_s$ is ill-conditioned, that there are components that can be re-written as (near) linear combination of the other variables. Below I give a brief (small scale) example of how SVD can be used to uncover such relations. n<-100 p<-20 #non-ill conditioned part of the dataset. x<-matrix(rnorm(n*p),nc=p) x<-scale(x) #introduce a variable that causes x to be #ill conditioned. y<-x%*%c(rnorm(3),rep(0,p))[1:p] y<-scale(y) x<-cbind(x,y) p<-ncol(x) A<-svd(x,nu=0) #x is ill-conditioned: this ratio is larger #than 10. (step 1) 2*log(A$d[1]/A$d[p]) #check what is causing it: (step 2) round(A$v[,ncol(A$v)],2) #you can write the last variable as (.23*x_1+.5*x_2-.45*x_3)/(-.7) [1] #here the relation is exact because: min(A$d) #is 0. if min(A$d)>0 then this gives you how much there is noise #there is arround [1]. #so I remove the last variable. (step 3) x<-x[,-ncol(x)] #no more ill-condition. 2*log(A$d[1]/A$d[p-1]) This is for the linear algebra of the problem when there is a single variable causing the ill-regression. In most case you will have more than one (near) exact relationship and you will have to repeat steps 1 through 3. In practice, the computational specifics will depend on how clever is the approach you use to solve the SVD problem. You can make yourself an idea of how many exact relationships there are in your dataset by computing $$2\log\left(\frac{d_1(X_s)}{d_j(X_s)}\right)$$ for all $j$'s. To do this you only need the singular values which you can get at cost $O(p^2)$
What is the fastest method for determining collinearity degree? The condition number is the statistic you want to look at. It's an exhaustive measure of colinearity of your design space and much cheaper to compute than the VIF. The formula is: $$2\log\left(\frac{d
31,918
EFA clearly supports one-factor, measure is internally consistent, but CFA has poor fit?
That's pretty normal. CFA is a much more stringent criterion than EFA. EFA attempts to describe your data, but CFA tests if the model is correct. One reason for non-convergence is low average correlations (but then I'd expect RMSEA to be better). The chi-square test is essentially a test that your residuals are equal to zero, and RMSEA, TLI and CFI are transformations of the test. Fit is always going to be better in a two factor solution than a one factor solution (they're nested). Some more questions: What was your sample size? What's the average correlation? What's chi-square and df, what's the chi-square of the null model? Should you add correlated errors? Perhaps, but when you do that you are introducing additional factors. With a fit like this you might need to add a lot, and then you end up with a mess - it's best if they are justified in some way. For example, your second and third items are about intrusive thoughts - that could be a justification.
EFA clearly supports one-factor, measure is internally consistent, but CFA has poor fit?
That's pretty normal. CFA is a much more stringent criterion than EFA. EFA attempts to describe your data, but CFA tests if the model is correct. One reason for non-convergence is low average correla
EFA clearly supports one-factor, measure is internally consistent, but CFA has poor fit? That's pretty normal. CFA is a much more stringent criterion than EFA. EFA attempts to describe your data, but CFA tests if the model is correct. One reason for non-convergence is low average correlations (but then I'd expect RMSEA to be better). The chi-square test is essentially a test that your residuals are equal to zero, and RMSEA, TLI and CFI are transformations of the test. Fit is always going to be better in a two factor solution than a one factor solution (they're nested). Some more questions: What was your sample size? What's the average correlation? What's chi-square and df, what's the chi-square of the null model? Should you add correlated errors? Perhaps, but when you do that you are introducing additional factors. With a fit like this you might need to add a lot, and then you end up with a mess - it's best if they are justified in some way. For example, your second and third items are about intrusive thoughts - that could be a justification.
EFA clearly supports one-factor, measure is internally consistent, but CFA has poor fit? That's pretty normal. CFA is a much more stringent criterion than EFA. EFA attempts to describe your data, but CFA tests if the model is correct. One reason for non-convergence is low average correla
31,919
Standardized residuals in R's lm output
If you look at the code for plot.lm (by typing stats:::plot.lm), you see these snippets in there (the comments are mine; they're not in the original): r <- residuals(x) # <--- r contains residuals ... if (any(show[2L:6L])) { s <- if (inherits(x, "rlm")) x$s else if (isGlm) sqrt(summary(x)$dispersion) else sqrt(deviance(x)/df.residual(x)) #<---- value of s hii <- lm.influence(x, do.coef = FALSE)$hat #<---- value of hii ... r.w <- if (is.null(w)) r #<-- r.w for unweighted regression else sqrt(w) * r rs <- dropInf(r.w/(s * sqrt(1 - hii)), hii) # <-- std. residual in plots So - if you don't use weights - the code clearly defines its standardized residuals to be the internally studentized residuals defined here: http://en.wikipedia.org/wiki/Studentized_residual#How_to_studentize which is to say: $${\widehat{\varepsilon}_i\over \widehat{\sigma} \sqrt{1-h_{ii}\ }}$$ (where $\widehat{\sigma}^2={1 \over n-m}\sum_{j=1}^n \widehat{\varepsilon}_j^{\,2}$, and $m$ is the column dimension of $X$).
Standardized residuals in R's lm output
If you look at the code for plot.lm (by typing stats:::plot.lm), you see these snippets in there (the comments are mine; they're not in the original): r <- residuals(x)
Standardized residuals in R's lm output If you look at the code for plot.lm (by typing stats:::plot.lm), you see these snippets in there (the comments are mine; they're not in the original): r <- residuals(x) # <--- r contains residuals ... if (any(show[2L:6L])) { s <- if (inherits(x, "rlm")) x$s else if (isGlm) sqrt(summary(x)$dispersion) else sqrt(deviance(x)/df.residual(x)) #<---- value of s hii <- lm.influence(x, do.coef = FALSE)$hat #<---- value of hii ... r.w <- if (is.null(w)) r #<-- r.w for unweighted regression else sqrt(w) * r rs <- dropInf(r.w/(s * sqrt(1 - hii)), hii) # <-- std. residual in plots So - if you don't use weights - the code clearly defines its standardized residuals to be the internally studentized residuals defined here: http://en.wikipedia.org/wiki/Studentized_residual#How_to_studentize which is to say: $${\widehat{\varepsilon}_i\over \widehat{\sigma} \sqrt{1-h_{ii}\ }}$$ (where $\widehat{\sigma}^2={1 \over n-m}\sum_{j=1}^n \widehat{\varepsilon}_j^{\,2}$, and $m$ is the column dimension of $X$).
Standardized residuals in R's lm output If you look at the code for plot.lm (by typing stats:::plot.lm), you see these snippets in there (the comments are mine; they're not in the original): r <- residuals(x)
31,920
Standardized residuals in R's lm output
standardized (or studentized) residuals are the residuals divided by their standard deviations. Standard deviation for residuals in a regression model can vary by a great deal from point to point, so it often makes sense to standardized them by their standard deviation in order to make comparisons more meaningful.
Standardized residuals in R's lm output
standardized (or studentized) residuals are the residuals divided by their standard deviations. Standard deviation for residuals in a regression model can vary by a great deal from point to point, so
Standardized residuals in R's lm output standardized (or studentized) residuals are the residuals divided by their standard deviations. Standard deviation for residuals in a regression model can vary by a great deal from point to point, so it often makes sense to standardized them by their standard deviation in order to make comparisons more meaningful.
Standardized residuals in R's lm output standardized (or studentized) residuals are the residuals divided by their standard deviations. Standard deviation for residuals in a regression model can vary by a great deal from point to point, so
31,921
What are the use cases related to cluster analysis of different distance metrics?
Be careful when mixing arbitrary distance functions with k-means. K-means does not use Euclidean distance. That is a common misconception. K-means assigns points so that the variance contribution is minimized. I.e. $(x_i - \mu_i)^2$ for all dimensions $i$. But if you sum up all these contributions, you get squared Euclidean distance, and since $\sqrt{}$ is monotone, you can just as well assign to the closest neighbor by Euclidean distance (not computing the square roots is faster, though). The bigger issue when mixing k-means with other distance functions actually is the mean. The way k-means updates the mean works for variance. I.e. the mean is the best estimation to minimize total variance. But that does not imply it will be the best estimation for minimizing an arbitrary other distance function! (see e.g. this counter-example, where the mean is suboptimal for EMD, and counter-example for absolute pearson correlation) Usually, in situations where you would want to use a different distance function than Euclidean distance - for example because of high dimensionality or discrete data - you will not want to use k-means for the very same reasons. For example, because the mean does not make much sense if you have sparse vectors, or binary vectors (because it won't be binary). For other distance functions, have a look at k-medoids.
What are the use cases related to cluster analysis of different distance metrics?
Be careful when mixing arbitrary distance functions with k-means. K-means does not use Euclidean distance. That is a common misconception. K-means assigns points so that the variance contribution is m
What are the use cases related to cluster analysis of different distance metrics? Be careful when mixing arbitrary distance functions with k-means. K-means does not use Euclidean distance. That is a common misconception. K-means assigns points so that the variance contribution is minimized. I.e. $(x_i - \mu_i)^2$ for all dimensions $i$. But if you sum up all these contributions, you get squared Euclidean distance, and since $\sqrt{}$ is monotone, you can just as well assign to the closest neighbor by Euclidean distance (not computing the square roots is faster, though). The bigger issue when mixing k-means with other distance functions actually is the mean. The way k-means updates the mean works for variance. I.e. the mean is the best estimation to minimize total variance. But that does not imply it will be the best estimation for minimizing an arbitrary other distance function! (see e.g. this counter-example, where the mean is suboptimal for EMD, and counter-example for absolute pearson correlation) Usually, in situations where you would want to use a different distance function than Euclidean distance - for example because of high dimensionality or discrete data - you will not want to use k-means for the very same reasons. For example, because the mean does not make much sense if you have sparse vectors, or binary vectors (because it won't be binary). For other distance functions, have a look at k-medoids.
What are the use cases related to cluster analysis of different distance metrics? Be careful when mixing arbitrary distance functions with k-means. K-means does not use Euclidean distance. That is a common misconception. K-means assigns points so that the variance contribution is m
31,922
Can the bias introduced by lasso change the sign of a coefficient?
Yes, the sign of a coefficient can change. For a reference, in the original paper of Tibshirani (1995) it says that the signs of the LASSO estimate and the least squares solution may be different (p270 last paragraph).
Can the bias introduced by lasso change the sign of a coefficient?
Yes, the sign of a coefficient can change. For a reference, in the original paper of Tibshirani (1995) it says that the signs of the LASSO estimate and the least squares solution may be different (p27
Can the bias introduced by lasso change the sign of a coefficient? Yes, the sign of a coefficient can change. For a reference, in the original paper of Tibshirani (1995) it says that the signs of the LASSO estimate and the least squares solution may be different (p270 last paragraph).
Can the bias introduced by lasso change the sign of a coefficient? Yes, the sign of a coefficient can change. For a reference, in the original paper of Tibshirani (1995) it says that the signs of the LASSO estimate and the least squares solution may be different (p27
31,923
Estimator for an incidence rate
I propose modeling cancer occurrence as a Poisson process. Multiple events (appearance of tumors) are possible within the same individual over the time period of observation. If $\lambda$ is the rate of tumor appearance by year, the probability of 0 events is $e^{-\lambda}$, and the probability of 1 event or more is $p=1-e^{-\lambda}$. You follow $n$ individuals during a year. The number of individuals with 1 event or more is $X \sim \mathrm{Bin}(n,p)$. The expected number is $E(X) = np = n(1-e^{-\lambda})$. Now you observe $x$ events and want to estimate $\lambda$. First estimate $\hat p = {x\over n}$, then $\hat \lambda = - \log\left(1 - {x \over n}\right) \approx {x\over n} + {x^2 \over 2 n^2}$. By invariance of maximum-likelihood estimators, $\hat \lambda$ is the MLE of $\lambda$. Your estimator is ${ x/n \over 1 - x/2n} \approx {x\over n} + {x^2 \over 2 n^2}$. The difference between the two estimators is about $x^3/6n^3$, which is very small if $x/n$ is small. I guess this provides some justification, even if some other modeling could possibly lead directly to your estimator.
Estimator for an incidence rate
I propose modeling cancer occurrence as a Poisson process. Multiple events (appearance of tumors) are possible within the same individual over the time period of observation. If $\lambda$ is the rate
Estimator for an incidence rate I propose modeling cancer occurrence as a Poisson process. Multiple events (appearance of tumors) are possible within the same individual over the time period of observation. If $\lambda$ is the rate of tumor appearance by year, the probability of 0 events is $e^{-\lambda}$, and the probability of 1 event or more is $p=1-e^{-\lambda}$. You follow $n$ individuals during a year. The number of individuals with 1 event or more is $X \sim \mathrm{Bin}(n,p)$. The expected number is $E(X) = np = n(1-e^{-\lambda})$. Now you observe $x$ events and want to estimate $\lambda$. First estimate $\hat p = {x\over n}$, then $\hat \lambda = - \log\left(1 - {x \over n}\right) \approx {x\over n} + {x^2 \over 2 n^2}$. By invariance of maximum-likelihood estimators, $\hat \lambda$ is the MLE of $\lambda$. Your estimator is ${ x/n \over 1 - x/2n} \approx {x\over n} + {x^2 \over 2 n^2}$. The difference between the two estimators is about $x^3/6n^3$, which is very small if $x/n$ is small. I guess this provides some justification, even if some other modeling could possibly lead directly to your estimator.
Estimator for an incidence rate I propose modeling cancer occurrence as a Poisson process. Multiple events (appearance of tumors) are possible within the same individual over the time period of observation. If $\lambda$ is the rate
31,924
Estimator for an incidence rate
Assuming diagnoses of cancer are uniformly spread across the year, the persons who are diagnosed are exposed to the risk of being diagnosed for (on average) half a year before that diagnosis. Your link mentions the assumption of occurrence at the half-way point in the observation period but not where it comes from - which is just the assumption of uniformity. This assumption isn't always reasonable, and there are times when it can make a substantive difference. I'd recommend being aware of the assumption every time you use the formula, because you should consider its suitability and if it isn't suitable, whether it is likely to have a substantive impact on the estimate (in which case, a better assumption about the occurrence should be investigated)
Estimator for an incidence rate
Assuming diagnoses of cancer are uniformly spread across the year, the persons who are diagnosed are exposed to the risk of being diagnosed for (on average) half a year before that diagnosis. Your lin
Estimator for an incidence rate Assuming diagnoses of cancer are uniformly spread across the year, the persons who are diagnosed are exposed to the risk of being diagnosed for (on average) half a year before that diagnosis. Your link mentions the assumption of occurrence at the half-way point in the observation period but not where it comes from - which is just the assumption of uniformity. This assumption isn't always reasonable, and there are times when it can make a substantive difference. I'd recommend being aware of the assumption every time you use the formula, because you should consider its suitability and if it isn't suitable, whether it is likely to have a substantive impact on the estimate (in which case, a better assumption about the occurrence should be investigated)
Estimator for an incidence rate Assuming diagnoses of cancer are uniformly spread across the year, the persons who are diagnosed are exposed to the risk of being diagnosed for (on average) half a year before that diagnosis. Your lin
31,925
Why does the model change when using relevel?
Suppose the factor conditions has levels A,B,C and you regress your response variable y on conditions using mod <- lm(y ~ conditions). Now summary(mod) returns the mean of the reference level of conditions (say A) and the difference in means between conditions B and A and the difference between conditions C and A (reported respectively as (Intercept), conditions:B, and conditions:C). If you conditions <- relevel(conditions, ref = 'B') and re-reun the linear model, now you'll get the mean of B, the difference between A and B, and the difference between C and B. Naturally, p-values might change and printed estimates too. It does not mean there is a problem with your data. It does not mean your data necessarily fail an assumption of the linear model. The fit is the same and you have simply changed what information gets printed out because you have changed the reference level and are using treatment contrasts. You can get the same linear hypothesis tests using the original mod. As far as what to report, in many fields, it is customary to report whether there was a statistically significant effect of conditions (using the output of anova(mod)) and to report to the full regression output in a table (using whatever reference levels you'd like). Norms for how and whether to report tests of A vs. B (for example) vary by field. Take a close look at good papers in your field.
Why does the model change when using relevel?
Suppose the factor conditions has levels A,B,C and you regress your response variable y on conditions using mod <- lm(y ~ conditions). Now summary(mod) returns the mean of the reference level of condi
Why does the model change when using relevel? Suppose the factor conditions has levels A,B,C and you regress your response variable y on conditions using mod <- lm(y ~ conditions). Now summary(mod) returns the mean of the reference level of conditions (say A) and the difference in means between conditions B and A and the difference between conditions C and A (reported respectively as (Intercept), conditions:B, and conditions:C). If you conditions <- relevel(conditions, ref = 'B') and re-reun the linear model, now you'll get the mean of B, the difference between A and B, and the difference between C and B. Naturally, p-values might change and printed estimates too. It does not mean there is a problem with your data. It does not mean your data necessarily fail an assumption of the linear model. The fit is the same and you have simply changed what information gets printed out because you have changed the reference level and are using treatment contrasts. You can get the same linear hypothesis tests using the original mod. As far as what to report, in many fields, it is customary to report whether there was a statistically significant effect of conditions (using the output of anova(mod)) and to report to the full regression output in a table (using whatever reference levels you'd like). Norms for how and whether to report tests of A vs. B (for example) vary by field. Take a close look at good papers in your field.
Why does the model change when using relevel? Suppose the factor conditions has levels A,B,C and you regress your response variable y on conditions using mod <- lm(y ~ conditions). Now summary(mod) returns the mean of the reference level of condi
31,926
Problems with a simulation study of the repeated experiments explanation of a 95% confidence interval - where am I going wrong?
You're not going wrong. It simply isn't possible to construct a confidence interval for a binomial proportion which always has coverage of exactly 95% due to the discrete nature of the outcome. The Clopper-Pearson ('exact') interval is guaranteed to have coverage of at least 95%. Other intervals have coverage closer to 95% on average, when averaged over the true proportion. I tend to favour the Jeffreys interval myself, as it has coverage close to 95% on average and (unlike the Wilson score interval) approximately equal coverage in both tails. With only a small change in the code in the question, we can compute the exact coverage without simulation. p <- 0.3 n <- 1000 # Normal test CI <- sapply(0:n, function(m) prop.test(m,n)$conf.int[1:2]) caught.you <- which(CI[1,] <= p & p <= CI[2,]) coverage.pr <- sum(dbinom(caught.you - 1, n, p)) # Clopper-Pearson CI <- sapply(0:n, function(m) binom.test(m,n)$conf.int[1:2]) caught.you.again <- which(CI[1,] <= p & p <= CI[2,]) coverage.cp <- sum(dbinom(caught.you.again - 1, n, p)) This yields the following output. > coverage.pr [1] 0.9508569 > coverage.cp [1] 0.9546087
Problems with a simulation study of the repeated experiments explanation of a 95% confidence interva
You're not going wrong. It simply isn't possible to construct a confidence interval for a binomial proportion which always has coverage of exactly 95% due to the discrete nature of the outcome. The Cl
Problems with a simulation study of the repeated experiments explanation of a 95% confidence interval - where am I going wrong? You're not going wrong. It simply isn't possible to construct a confidence interval for a binomial proportion which always has coverage of exactly 95% due to the discrete nature of the outcome. The Clopper-Pearson ('exact') interval is guaranteed to have coverage of at least 95%. Other intervals have coverage closer to 95% on average, when averaged over the true proportion. I tend to favour the Jeffreys interval myself, as it has coverage close to 95% on average and (unlike the Wilson score interval) approximately equal coverage in both tails. With only a small change in the code in the question, we can compute the exact coverage without simulation. p <- 0.3 n <- 1000 # Normal test CI <- sapply(0:n, function(m) prop.test(m,n)$conf.int[1:2]) caught.you <- which(CI[1,] <= p & p <= CI[2,]) coverage.pr <- sum(dbinom(caught.you - 1, n, p)) # Clopper-Pearson CI <- sapply(0:n, function(m) binom.test(m,n)$conf.int[1:2]) caught.you.again <- which(CI[1,] <= p & p <= CI[2,]) coverage.cp <- sum(dbinom(caught.you.again - 1, n, p)) This yields the following output. > coverage.pr [1] 0.9508569 > coverage.cp [1] 0.9546087
Problems with a simulation study of the repeated experiments explanation of a 95% confidence interva You're not going wrong. It simply isn't possible to construct a confidence interval for a binomial proportion which always has coverage of exactly 95% due to the discrete nature of the outcome. The Cl
31,927
Do inputs to a Neural Network need to be in [-1,1]?
You can normalize the values so that you use, for example, $$\frac{AP - AP_0}{AP_1-AP_0}$$ where $AP$ is the current air pressure, $AP_0$ is the air pressure value you want sent to $0$, and $AP_1$ is the air pressure value you want sent to $1$. It is ok if your inputs occasionally go a bit outside $[-1,1]$. It is dangerous if an input is usually small, but has some occasional extreme values. Then it might be better to split the input into more than one input value, or to remove the outliers and accept that the neural network has a restricted context of applicability. Rescaling so that the outliers are between $-1$ and $1$ won't fix the problem.
Do inputs to a Neural Network need to be in [-1,1]?
You can normalize the values so that you use, for example, $$\frac{AP - AP_0}{AP_1-AP_0}$$ where $AP$ is the current air pressure, $AP_0$ is the air pressure value you want sent to $0$, and $AP_1$ i
Do inputs to a Neural Network need to be in [-1,1]? You can normalize the values so that you use, for example, $$\frac{AP - AP_0}{AP_1-AP_0}$$ where $AP$ is the current air pressure, $AP_0$ is the air pressure value you want sent to $0$, and $AP_1$ is the air pressure value you want sent to $1$. It is ok if your inputs occasionally go a bit outside $[-1,1]$. It is dangerous if an input is usually small, but has some occasional extreme values. Then it might be better to split the input into more than one input value, or to remove the outliers and accept that the neural network has a restricted context of applicability. Rescaling so that the outliers are between $-1$ and $1$ won't fix the problem.
Do inputs to a Neural Network need to be in [-1,1]? You can normalize the values so that you use, for example, $$\frac{AP - AP_0}{AP_1-AP_0}$$ where $AP$ is the current air pressure, $AP_0$ is the air pressure value you want sent to $0$, and $AP_1$ i
31,928
Is sample homogeneity an assumption of regression analysis?
The sample is typically assumed to be homogeneous in the sense that the error terms $\epsilon_i$ in the equation $y_i=\beta_0+\beta_1x_1+\beta_2x_2+\ldots+\epsilon_i$ satisify the following conditions: All have mean zero: $\rm E(\epsilon_i)=0$ for all $i$, Are uncorrelationed: $\rm Cov(\epsilon_i,\epsilon_j)=0$ for $i\neq j$, All have the same variance: $\rm Cov(\epsilon_i)=\sigma^2$ for all $i$. These are known as the Gauss-Markov conditions and ensures that the ordinary least squares estimator performs well (unbiasedness, best linear unbiased estimator...). Note that these conditions can be satisfied even if you have observations from different groups. Oftentimes, that is however not the case. If there are differences in mean between the groups, the first and second conditions are violated. If there are correlations within the groups, the second condition is violated. If the groups differ in variance, the third is violated. Violation of the Gauss-Markov conditions can cause all sorts of problems. For some of the consequences of non-constant variance, see the Wikipedia page on heteroscedasticity. Transformations can be useful when the third condition isn't met, but if the different groups cause problems with conditions one and two, it seems more reasonable to add a group dummy variable or to use ANCOVA.
Is sample homogeneity an assumption of regression analysis?
The sample is typically assumed to be homogeneous in the sense that the error terms $\epsilon_i$ in the equation $y_i=\beta_0+\beta_1x_1+\beta_2x_2+\ldots+\epsilon_i$ satisify the following conditions
Is sample homogeneity an assumption of regression analysis? The sample is typically assumed to be homogeneous in the sense that the error terms $\epsilon_i$ in the equation $y_i=\beta_0+\beta_1x_1+\beta_2x_2+\ldots+\epsilon_i$ satisify the following conditions: All have mean zero: $\rm E(\epsilon_i)=0$ for all $i$, Are uncorrelationed: $\rm Cov(\epsilon_i,\epsilon_j)=0$ for $i\neq j$, All have the same variance: $\rm Cov(\epsilon_i)=\sigma^2$ for all $i$. These are known as the Gauss-Markov conditions and ensures that the ordinary least squares estimator performs well (unbiasedness, best linear unbiased estimator...). Note that these conditions can be satisfied even if you have observations from different groups. Oftentimes, that is however not the case. If there are differences in mean between the groups, the first and second conditions are violated. If there are correlations within the groups, the second condition is violated. If the groups differ in variance, the third is violated. Violation of the Gauss-Markov conditions can cause all sorts of problems. For some of the consequences of non-constant variance, see the Wikipedia page on heteroscedasticity. Transformations can be useful when the third condition isn't met, but if the different groups cause problems with conditions one and two, it seems more reasonable to add a group dummy variable or to use ANCOVA.
Is sample homogeneity an assumption of regression analysis? The sample is typically assumed to be homogeneous in the sense that the error terms $\epsilon_i$ in the equation $y_i=\beta_0+\beta_1x_1+\beta_2x_2+\ldots+\epsilon_i$ satisify the following conditions
31,929
Does it matter how you sample a population?
A simple way to verify that the method matters is to choose particular probabilities for types of marbles, and calculate the chance of each subset according to some methods. This can't prove that the method doesn't matter, though. Suppose there are $3$ types and the chances of each type are $1/2$, $1/4$, and $1/4$, respectively. Suppose you are choosing $2$ types of marbles. Suppose after choosing a marble, you ignore the rest of the kind. The chance you get $\lbrace v_2,v_3\rbrace$ is $2*1/4*1/3 = 1/6$. Suppose you reject pairs with repeated types. The chance of $\lbrace v_2,v_3\rbrace$ is $$\frac{2*1/4*1/4}{2*1/4*1/4 + 2*1/2*1/4 + 2*1/2*1/4} = \frac{1/8}{1/8 + 1/4 + 1/4} = 1/5.$$ Since these are different, the method the machine uses matters. Rejecting pairs with repeated types tends to weight the pairs with common types less. Two of the methods you mention are equivalent. Ignoring the rest of its kind after picking a marble is the same as picking until you have $q$ different types.
Does it matter how you sample a population?
A simple way to verify that the method matters is to choose particular probabilities for types of marbles, and calculate the chance of each subset according to some methods. This can't prove that the
Does it matter how you sample a population? A simple way to verify that the method matters is to choose particular probabilities for types of marbles, and calculate the chance of each subset according to some methods. This can't prove that the method doesn't matter, though. Suppose there are $3$ types and the chances of each type are $1/2$, $1/4$, and $1/4$, respectively. Suppose you are choosing $2$ types of marbles. Suppose after choosing a marble, you ignore the rest of the kind. The chance you get $\lbrace v_2,v_3\rbrace$ is $2*1/4*1/3 = 1/6$. Suppose you reject pairs with repeated types. The chance of $\lbrace v_2,v_3\rbrace$ is $$\frac{2*1/4*1/4}{2*1/4*1/4 + 2*1/2*1/4 + 2*1/2*1/4} = \frac{1/8}{1/8 + 1/4 + 1/4} = 1/5.$$ Since these are different, the method the machine uses matters. Rejecting pairs with repeated types tends to weight the pairs with common types less. Two of the methods you mention are equivalent. Ignoring the rest of its kind after picking a marble is the same as picking until you have $q$ different types.
Does it matter how you sample a population? A simple way to verify that the method matters is to choose particular probabilities for types of marbles, and calculate the chance of each subset according to some methods. This can't prove that the
31,930
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a log-likelihood function using optim in R?
The mle function from the stats4 package is a wrapper of optim, which makes it quite easy to produce profile likelihood computations. See help("profile,mle-method", package = "stats4") for more information.
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a
The mle function from the stats4 package is a wrapper of optim, which makes it quite easy to produce profile likelihood computations. See help("profile,mle-method", package = "stats4") for more inform
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a log-likelihood function using optim in R? The mle function from the stats4 package is a wrapper of optim, which makes it quite easy to produce profile likelihood computations. See help("profile,mle-method", package = "stats4") for more information.
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a The mle function from the stats4 package is a wrapper of optim, which makes it quite easy to produce profile likelihood computations. See help("profile,mle-method", package = "stats4") for more inform
31,931
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a log-likelihood function using optim in R?
There is the ProfileLikelihood package if you use nlme. Personally, I have not managed to use it. Using the lme4a or lmeEigen package there is a profile() function which exactly aims to do what you want. Try something like that to install these packages: install.packages("lme4a",repos="http://lme4.r-forge.r-project.org/repos") or go to the website to get the zip archive. Similarly and unfortunately, I have not managed to use it :) Maybe we should wait for an update of lme4. The method is detailed in the draft of Douglas Bates' book EDIT: Cool ! The profile() function for lmer models is now available in the latest version of lme4, to be installed by typing: install.packages("lme4",repos="http://r-forge.r-project.org")
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a
There is the ProfileLikelihood package if you use nlme. Personally, I have not managed to use it. Using the lme4a or lmeEigen package there is a profile() function which exactly aims to do what you w
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a log-likelihood function using optim in R? There is the ProfileLikelihood package if you use nlme. Personally, I have not managed to use it. Using the lme4a or lmeEigen package there is a profile() function which exactly aims to do what you want. Try something like that to install these packages: install.packages("lme4a",repos="http://lme4.r-forge.r-project.org/repos") or go to the website to get the zip archive. Similarly and unfortunately, I have not managed to use it :) Maybe we should wait for an update of lme4. The method is detailed in the draft of Douglas Bates' book EDIT: Cool ! The profile() function for lmer models is now available in the latest version of lme4, to be installed by typing: install.packages("lme4",repos="http://r-forge.r-project.org")
How can I estimate 95% confidence intervals using profiling for parameters estimated by maximising a There is the ProfileLikelihood package if you use nlme. Personally, I have not managed to use it. Using the lme4a or lmeEigen package there is a profile() function which exactly aims to do what you w
31,932
How to test for normality in a 2x2 ANOVA?
Most statistics packages have ways of saving residuals from your model. Using GLM - UNIVARIATE in SPSS you can save residuals. This will add a variable to your data file representing the residual for each observation. Once you have your residuals you can then examine them to see whether they are normally distributed, homoscedastic, and so on. For example, you could use a formal normality test on your residual variable or perhaps more appropriately, you could plot the residuals to check for any major departures from normality. If you want to examine homoscedasticity, you could get a plot that looked at the residuals by group. For a basic between subjects factorial ANOVA, where homogeneity of variance holds, normality within cells means normality of residuals because your model in ANOVA is to predict group means. Thus, the residual is just the difference between group means and observed data. Response to comments below: Residuals are defined relative to your model predictions. In this case your model predictions are your cell means. It is a more generalisable way of thinking about assumption testing if you focus on plotting the residuals rather than plotting individual cell means, even if in this particular case, they are basically the same. For example, if you add a covariate (ANCOVA), residuals would be more appropriate to examine than distributions within cells. For purposes of examining normality, standardised and unstandardised residuals will provide the same answer. Standardised residuals can be useful when you are trying to identify data that is poorly modelled by the data (i.e., an outlier). Homogeneity of variance and homoscedasticity mean the same thing as far as I'm aware. Once again, it is common to examine this assumption by comparing the variances across groups/cells. In your case, whether you calculate variance in residuals for each cell or based on the raw data in each cell, you will get the same values. However, you can also plot residuals on the y-axis and predicted values on the x-axis. This is a more generalisable approach as it is also applicable to other situations such as where you add covariates or you are doing multiple regression. A point was raised below that when you have heteroscedasticity (i.e., within cell variance varies between cells in the population) and normally distributed residuals within cells, the resulting distribution of all residuals would be non-normal. The result would be a mixture distribution of variables with mean of zero and different variances with proportions relative to cell sizes. The resulting distribution will have no zero skew, but would presumably have some amount of kurtosis. If you divide residuals by their corresponding within-cell standard deviation, then you could remove the effect heteroscedasticity; plotting the residuals that result would provide an overall test of whether residuals are normally distributed independent of any heteroscedasticity.
How to test for normality in a 2x2 ANOVA?
Most statistics packages have ways of saving residuals from your model. Using GLM - UNIVARIATE in SPSS you can save residuals. This will add a variable to your data file representing the residual for
How to test for normality in a 2x2 ANOVA? Most statistics packages have ways of saving residuals from your model. Using GLM - UNIVARIATE in SPSS you can save residuals. This will add a variable to your data file representing the residual for each observation. Once you have your residuals you can then examine them to see whether they are normally distributed, homoscedastic, and so on. For example, you could use a formal normality test on your residual variable or perhaps more appropriately, you could plot the residuals to check for any major departures from normality. If you want to examine homoscedasticity, you could get a plot that looked at the residuals by group. For a basic between subjects factorial ANOVA, where homogeneity of variance holds, normality within cells means normality of residuals because your model in ANOVA is to predict group means. Thus, the residual is just the difference between group means and observed data. Response to comments below: Residuals are defined relative to your model predictions. In this case your model predictions are your cell means. It is a more generalisable way of thinking about assumption testing if you focus on plotting the residuals rather than plotting individual cell means, even if in this particular case, they are basically the same. For example, if you add a covariate (ANCOVA), residuals would be more appropriate to examine than distributions within cells. For purposes of examining normality, standardised and unstandardised residuals will provide the same answer. Standardised residuals can be useful when you are trying to identify data that is poorly modelled by the data (i.e., an outlier). Homogeneity of variance and homoscedasticity mean the same thing as far as I'm aware. Once again, it is common to examine this assumption by comparing the variances across groups/cells. In your case, whether you calculate variance in residuals for each cell or based on the raw data in each cell, you will get the same values. However, you can also plot residuals on the y-axis and predicted values on the x-axis. This is a more generalisable approach as it is also applicable to other situations such as where you add covariates or you are doing multiple regression. A point was raised below that when you have heteroscedasticity (i.e., within cell variance varies between cells in the population) and normally distributed residuals within cells, the resulting distribution of all residuals would be non-normal. The result would be a mixture distribution of variables with mean of zero and different variances with proportions relative to cell sizes. The resulting distribution will have no zero skew, but would presumably have some amount of kurtosis. If you divide residuals by their corresponding within-cell standard deviation, then you could remove the effect heteroscedasticity; plotting the residuals that result would provide an overall test of whether residuals are normally distributed independent of any heteroscedasticity.
How to test for normality in a 2x2 ANOVA? Most statistics packages have ways of saving residuals from your model. Using GLM - UNIVARIATE in SPSS you can save residuals. This will add a variable to your data file representing the residual for
31,933
How to test for normality in a 2x2 ANOVA?
Despite many introductory textbooks stressing it, you do not need Normality. With a modest sample size and the same variance within each of the groups, i.e. homoskedasticity, ANOVA will provide accurate inference on the differences in mean response between the groups. If there is reason to suspect non-constant variance - and there may well be - then heteroskedasticity-consistent standard errors can be used. These properties are extensions of those that are well-known for the t-test; with constant variance you can use the "plain vanilla" t-test, regardless of Normality (a result known to Fisher, way back) and with non-constant variance the unequal variance also works fine without Normality. The unequal variance version is equivalent to the Wald test that uses heteroskedasticity-consistent standard errors.
How to test for normality in a 2x2 ANOVA?
Despite many introductory textbooks stressing it, you do not need Normality. With a modest sample size and the same variance within each of the groups, i.e. homoskedasticity, ANOVA will provide accura
How to test for normality in a 2x2 ANOVA? Despite many introductory textbooks stressing it, you do not need Normality. With a modest sample size and the same variance within each of the groups, i.e. homoskedasticity, ANOVA will provide accurate inference on the differences in mean response between the groups. If there is reason to suspect non-constant variance - and there may well be - then heteroskedasticity-consistent standard errors can be used. These properties are extensions of those that are well-known for the t-test; with constant variance you can use the "plain vanilla" t-test, regardless of Normality (a result known to Fisher, way back) and with non-constant variance the unequal variance also works fine without Normality. The unequal variance version is equivalent to the Wald test that uses heteroskedasticity-consistent standard errors.
How to test for normality in a 2x2 ANOVA? Despite many introductory textbooks stressing it, you do not need Normality. With a modest sample size and the same variance within each of the groups, i.e. homoskedasticity, ANOVA will provide accura
31,934
Bootstrap vs numerical integration
The bootstrap works remarkably well. If you want to estimate the mean, variance and some not-too-extreme quantiles of the distribution of some low-dimensional $\hat\theta(Y)$, a few hundred to a few thousand re-samples will make the Monte Carlo error negligible, for many realistic problems. As a happy by-product, it also gives you a sample of $\hat\theta(Y^*)$, that can be used for diagnostic procedures, if desired, and it's not too difficult to get acceptably-good measures of how big the Monte Carlo errors actually are. Fitting a regression model e.g. a thousand times over is (today) not a big deal, either in terms of CPU time or coding effort. In contrast, numerical integration (excluding Monte Carlo methods) can be difficult to code - you'd have to decide how to split the sample space, for example, which is a non-trivial task. These methods also don't give the diagnostics, and the accuracy with which they estimate the true integral is notoriously hard to assess. To do most of what the bootstrap does, but quicker, take a look at Generalized Method of Moments - for inference based on regression models (and much else) you can think of it as a quick, accurate approximation to what the non-parametric bootstrap would give.
Bootstrap vs numerical integration
The bootstrap works remarkably well. If you want to estimate the mean, variance and some not-too-extreme quantiles of the distribution of some low-dimensional $\hat\theta(Y)$, a few hundred to a few t
Bootstrap vs numerical integration The bootstrap works remarkably well. If you want to estimate the mean, variance and some not-too-extreme quantiles of the distribution of some low-dimensional $\hat\theta(Y)$, a few hundred to a few thousand re-samples will make the Monte Carlo error negligible, for many realistic problems. As a happy by-product, it also gives you a sample of $\hat\theta(Y^*)$, that can be used for diagnostic procedures, if desired, and it's not too difficult to get acceptably-good measures of how big the Monte Carlo errors actually are. Fitting a regression model e.g. a thousand times over is (today) not a big deal, either in terms of CPU time or coding effort. In contrast, numerical integration (excluding Monte Carlo methods) can be difficult to code - you'd have to decide how to split the sample space, for example, which is a non-trivial task. These methods also don't give the diagnostics, and the accuracy with which they estimate the true integral is notoriously hard to assess. To do most of what the bootstrap does, but quicker, take a look at Generalized Method of Moments - for inference based on regression models (and much else) you can think of it as a quick, accurate approximation to what the non-parametric bootstrap would give.
Bootstrap vs numerical integration The bootstrap works remarkably well. If you want to estimate the mean, variance and some not-too-extreme quantiles of the distribution of some low-dimensional $\hat\theta(Y)$, a few hundred to a few t
31,935
Bootstrap vs numerical integration
The simulation most often used in bootstrapping for the numerical computation of the variance could in principle be replaced by an exact computation or an alternative approximation of the integral. One should, however, be aware that a "brute-force" simulation as an alternative to other numerical integration techniques is actually a good idea. The answer to the question "Wouldn't it result in much higher precision for the same computational time?" is no. But why is that so? The thing is that standard numerical integration in high-dimensions scales badly with the dimension. If you are to divide the space into regular grid points, say, with $r$ grid points in each coordinate, you end up with $r^n$ grid points in total. The approximation achieved by simulation (know as Monte Carlo integration) can be viewed as a clever choice of function evaluations. Instead of time consuming grid evaluations we only evaluate the function we integrate at selected points. The error is, due to the random nature of the selected points, random, but can usually be controlled by the central limit theorem. There are other methods such as quasi-Monte Carlo integration, that I know virtually nothing about, that make clever function evaluations based on quasi-random numbers instead of the pseudo-random numbers that we use for ordinary Monte Carlo integration.
Bootstrap vs numerical integration
The simulation most often used in bootstrapping for the numerical computation of the variance could in principle be replaced by an exact computation or an alternative approximation of the integral. On
Bootstrap vs numerical integration The simulation most often used in bootstrapping for the numerical computation of the variance could in principle be replaced by an exact computation or an alternative approximation of the integral. One should, however, be aware that a "brute-force" simulation as an alternative to other numerical integration techniques is actually a good idea. The answer to the question "Wouldn't it result in much higher precision for the same computational time?" is no. But why is that so? The thing is that standard numerical integration in high-dimensions scales badly with the dimension. If you are to divide the space into regular grid points, say, with $r$ grid points in each coordinate, you end up with $r^n$ grid points in total. The approximation achieved by simulation (know as Monte Carlo integration) can be viewed as a clever choice of function evaluations. Instead of time consuming grid evaluations we only evaluate the function we integrate at selected points. The error is, due to the random nature of the selected points, random, but can usually be controlled by the central limit theorem. There are other methods such as quasi-Monte Carlo integration, that I know virtually nothing about, that make clever function evaluations based on quasi-random numbers instead of the pseudo-random numbers that we use for ordinary Monte Carlo integration.
Bootstrap vs numerical integration The simulation most often used in bootstrapping for the numerical computation of the variance could in principle be replaced by an exact computation or an alternative approximation of the integral. On
31,936
Can a repeated measures-design be non-temporal in nature?
Traditionally, yes, your design can be treated as a repeated-measures design where you treat person as a unit of repeated observation and you treat the pictures in each category as homogenous replications of one another, collapsing them to a mean and treating category as a within-Ss variable. However, as Peter Flom notes, it's possible (likely?) that the intra-category variability in your pictures is worth accounting for, in which case you will want to move to a mixed effects modelling context where you will treat category as a fixed effect and both person and category token as crossed random effects. See Baayen et al 2008 for explanation.
Can a repeated measures-design be non-temporal in nature?
Traditionally, yes, your design can be treated as a repeated-measures design where you treat person as a unit of repeated observation and you treat the pictures in each category as homogenous replicat
Can a repeated measures-design be non-temporal in nature? Traditionally, yes, your design can be treated as a repeated-measures design where you treat person as a unit of repeated observation and you treat the pictures in each category as homogenous replications of one another, collapsing them to a mean and treating category as a within-Ss variable. However, as Peter Flom notes, it's possible (likely?) that the intra-category variability in your pictures is worth accounting for, in which case you will want to move to a mixed effects modelling context where you will treat category as a fixed effect and both person and category token as crossed random effects. See Baayen et al 2008 for explanation.
Can a repeated measures-design be non-temporal in nature? Traditionally, yes, your design can be treated as a repeated-measures design where you treat person as a unit of repeated observation and you treat the pictures in each category as homogenous replicat
31,937
How to perform genetic-algorithm variable selection in R for SVM input variables?
My advice would be to not do this. The theoretical advantages of the SVM that avoid over-fitting apply only to the determination of the lagrange multipliers (the parameters of the model). As soon as you start performing feature selection, those advantages are essentially lost, as there is little theory that covers model selection or feature selection, and you are highly likely to over-fit the feature selection criterion, especially if you search really hard using a GA. If feature selection is important, I would use something like LASSO, LARS or Elastic net, where the feature selection arises via reguarisation, where the feature selection is more constrained, so there are fewer effective degrees of freedom, and less over-fitting. Note a key advantage of the SVM is that is is an approximate implementation of a generalisation bound which is independent of the dimensionality of the feature space, which suggests that feature selection perhaps shouldn't necessarily be expected to improve performance, and if there is a defficiency in the selection prcess (e.g. over-fitting the selection criterion) it may well make things worse!
How to perform genetic-algorithm variable selection in R for SVM input variables?
My advice would be to not do this. The theoretical advantages of the SVM that avoid over-fitting apply only to the determination of the lagrange multipliers (the parameters of the model). As soon as
How to perform genetic-algorithm variable selection in R for SVM input variables? My advice would be to not do this. The theoretical advantages of the SVM that avoid over-fitting apply only to the determination of the lagrange multipliers (the parameters of the model). As soon as you start performing feature selection, those advantages are essentially lost, as there is little theory that covers model selection or feature selection, and you are highly likely to over-fit the feature selection criterion, especially if you search really hard using a GA. If feature selection is important, I would use something like LASSO, LARS or Elastic net, where the feature selection arises via reguarisation, where the feature selection is more constrained, so there are fewer effective degrees of freedom, and less over-fitting. Note a key advantage of the SVM is that is is an approximate implementation of a generalisation bound which is independent of the dimensionality of the feature space, which suggests that feature selection perhaps shouldn't necessarily be expected to improve performance, and if there is a defficiency in the selection prcess (e.g. over-fitting the selection criterion) it may well make things worse!
How to perform genetic-algorithm variable selection in R for SVM input variables? My advice would be to not do this. The theoretical advantages of the SVM that avoid over-fitting apply only to the determination of the lagrange multipliers (the parameters of the model). As soon as
31,938
How to perform genetic-algorithm variable selection in R for SVM input variables?
In the end I have ended up using the 'genalg' package on R. It means converting the winning chromosome from a binary format to represent the variables in my data, but this is relatively trivial once the GA has run. Let me know if you'd like any further details.
How to perform genetic-algorithm variable selection in R for SVM input variables?
In the end I have ended up using the 'genalg' package on R. It means converting the winning chromosome from a binary format to represent the variables in my data, but this is relatively trivial once
How to perform genetic-algorithm variable selection in R for SVM input variables? In the end I have ended up using the 'genalg' package on R. It means converting the winning chromosome from a binary format to represent the variables in my data, but this is relatively trivial once the GA has run. Let me know if you'd like any further details.
How to perform genetic-algorithm variable selection in R for SVM input variables? In the end I have ended up using the 'genalg' package on R. It means converting the winning chromosome from a binary format to represent the variables in my data, but this is relatively trivial once
31,939
Cross correlation vs mutual information
Cross correlation assumes a linear relationship between 2 sets of data. Whereas mutual information only assumes that one value of one dataset says something about the value of the other dataset. So mutual information makes much weaker assumptions. A traditional problem solved with mutual information is aligning (registration) of two types of medical images, for example an ultrasound and a x-ray image. (typically, the types of images are called modalities, so the problem is named multi-modal image registration). For both X-ray and ultrasound, a specific material, say bone, leads to a certain 'brightness' in the image. Whereas some materials lead to a bright x-ray and ultrasound image, for other materials (e.g. fat) it might be the opposite, one is bright, the other is dark. Therefore, it is not the case that bright parts of the X-ray image are also bright parts of the ultrasound. Therefore, mutual information is still a useful criterion for aligning the images, but cross correlation is not.
Cross correlation vs mutual information
Cross correlation assumes a linear relationship between 2 sets of data. Whereas mutual information only assumes that one value of one dataset says something about the value of the other dataset. So mu
Cross correlation vs mutual information Cross correlation assumes a linear relationship between 2 sets of data. Whereas mutual information only assumes that one value of one dataset says something about the value of the other dataset. So mutual information makes much weaker assumptions. A traditional problem solved with mutual information is aligning (registration) of two types of medical images, for example an ultrasound and a x-ray image. (typically, the types of images are called modalities, so the problem is named multi-modal image registration). For both X-ray and ultrasound, a specific material, say bone, leads to a certain 'brightness' in the image. Whereas some materials lead to a bright x-ray and ultrasound image, for other materials (e.g. fat) it might be the opposite, one is bright, the other is dark. Therefore, it is not the case that bright parts of the X-ray image are also bright parts of the ultrasound. Therefore, mutual information is still a useful criterion for aligning the images, but cross correlation is not.
Cross correlation vs mutual information Cross correlation assumes a linear relationship between 2 sets of data. Whereas mutual information only assumes that one value of one dataset says something about the value of the other dataset. So mu
31,940
Cross correlation vs mutual information
Cross correlation is used in time-frequency analysis and is a inner product with a lag-parameter obtained between two functions varying over time, where one function is evaluated at time $t$ and the other is evaluated at time $lag+t$. The cross-correlation theorem relates cross-correlation to the fourier transform of the individual functions, and hence a cros-correlation evaluated in a time domain is connected by this theorem to the spectral properties/frequency domain of the individual functions. Analogues to this exist in other areas like analyzing spatial data for example.
Cross correlation vs mutual information
Cross correlation is used in time-frequency analysis and is a inner product with a lag-parameter obtained between two functions varying over time, where one function is evaluated at time $t$ and the
Cross correlation vs mutual information Cross correlation is used in time-frequency analysis and is a inner product with a lag-parameter obtained between two functions varying over time, where one function is evaluated at time $t$ and the other is evaluated at time $lag+t$. The cross-correlation theorem relates cross-correlation to the fourier transform of the individual functions, and hence a cros-correlation evaluated in a time domain is connected by this theorem to the spectral properties/frequency domain of the individual functions. Analogues to this exist in other areas like analyzing spatial data for example.
Cross correlation vs mutual information Cross correlation is used in time-frequency analysis and is a inner product with a lag-parameter obtained between two functions varying over time, where one function is evaluated at time $t$ and the
31,941
What are ways to deal with circular covariates (e.g. with a GAM)?
There are two ways of dealing with circular variables, one hacky method would be to manually duplicate your data set on either side of the boundary conditions but the more elegant solution I think would be to use the built-in spline basis functions with periodic boundary conditions ! For example: bs="cc" specifies a cyclic cubic regression splines (see cyclic.cubic.spline). i.e. a penalized cubic regression splines whose ends match, up to second derivative. Splines on the sphere bs="sos". These are two dimensional splines on a sphere. Arguments are latitude and longitude, and they are the analogue of thin plate splines for the sphere. Useful for data sampled over a large portion of the globe, when isotropy is appropriate. See Spherical.Spline for details. bs="cp" gives a cyclic version of a P-spline
What are ways to deal with circular covariates (e.g. with a GAM)?
There are two ways of dealing with circular variables, one hacky method would be to manually duplicate your data set on either side of the boundary conditions but the more elegant solution I think wou
What are ways to deal with circular covariates (e.g. with a GAM)? There are two ways of dealing with circular variables, one hacky method would be to manually duplicate your data set on either side of the boundary conditions but the more elegant solution I think would be to use the built-in spline basis functions with periodic boundary conditions ! For example: bs="cc" specifies a cyclic cubic regression splines (see cyclic.cubic.spline). i.e. a penalized cubic regression splines whose ends match, up to second derivative. Splines on the sphere bs="sos". These are two dimensional splines on a sphere. Arguments are latitude and longitude, and they are the analogue of thin plate splines for the sphere. Useful for data sampled over a large portion of the globe, when isotropy is appropriate. See Spherical.Spline for details. bs="cp" gives a cyclic version of a P-spline
What are ways to deal with circular covariates (e.g. with a GAM)? There are two ways of dealing with circular variables, one hacky method would be to manually duplicate your data set on either side of the boundary conditions but the more elegant solution I think wou
31,942
What are ways to deal with circular covariates (e.g. with a GAM)?
You might want to look into Gill and Hangartner (2010). Circular Data in Political Science and How to Handle It. They talk about various models for circular/clock/seasonal data, and Jeff Gill provides R code for the paper which you can look into for inspiration. There should be a presentation version of this material which would weave the methodology and R code together.
What are ways to deal with circular covariates (e.g. with a GAM)?
You might want to look into Gill and Hangartner (2010). Circular Data in Political Science and How to Handle It. They talk about various models for circular/clock/seasonal data, and Jeff Gill provides
What are ways to deal with circular covariates (e.g. with a GAM)? You might want to look into Gill and Hangartner (2010). Circular Data in Political Science and How to Handle It. They talk about various models for circular/clock/seasonal data, and Jeff Gill provides R code for the paper which you can look into for inspiration. There should be a presentation version of this material which would weave the methodology and R code together.
What are ways to deal with circular covariates (e.g. with a GAM)? You might want to look into Gill and Hangartner (2010). Circular Data in Political Science and How to Handle It. They talk about various models for circular/clock/seasonal data, and Jeff Gill provides
31,943
How to test for differences between medians of multiple Likert items?
I find the mean to be a much more useful indicator of central tendency of Likert items than the median. I have elaborated on my argument here on a question asking about whether to use the mean or median for likert items. A recap of some of these reasons: The mean is more informative; the median is too gross for Likert items. For example, the median of 1 1 3 3 3 is the same as 3 3 3 5 5 (i.e., 3) but the mean reflects the difference. Likert items are often phrased in ways where the equal distance between categories assumption is a useful starting point. Even if individual responses are discrete, the group level measurement approaches continuity (with 500 people and a 5 point scale, the value of your mean could take on 500 * 4 + 1 = 2001 different values) There is little argument that a percentage is a useful summary in yes-no type questions (e.g., voting). This is just the mean where responses have been coded 0 and 1. Treating a 5 point likert scale as 1 2 3 4 5 seems almost as natural to me. Other plausible scalings of the Likert items probably wont change inferences substantively regarding whether differences between means exist (but you can check this). If you are persuaded that the mean is the appropriate measure of central tendency, then you would want to structure your hypothesis tests so that they test for differences between means. A paired sample t-test would allow for a pair-wise comparison of means, but there would be issues around the accuracy of p-values given the discrete and non-normal error distribution. Nonetheless, adopting a non-parametric approach is not a solution, because it changes the hypothesis. I would expect that the paired sample t-test would be fairly robust at least for typicaly Likert item means that avoid either extreme on the scale, but I don't have any simulation studies on hand.
How to test for differences between medians of multiple Likert items?
I find the mean to be a much more useful indicator of central tendency of Likert items than the median. I have elaborated on my argument here on a question asking about whether to use the mean or medi
How to test for differences between medians of multiple Likert items? I find the mean to be a much more useful indicator of central tendency of Likert items than the median. I have elaborated on my argument here on a question asking about whether to use the mean or median for likert items. A recap of some of these reasons: The mean is more informative; the median is too gross for Likert items. For example, the median of 1 1 3 3 3 is the same as 3 3 3 5 5 (i.e., 3) but the mean reflects the difference. Likert items are often phrased in ways where the equal distance between categories assumption is a useful starting point. Even if individual responses are discrete, the group level measurement approaches continuity (with 500 people and a 5 point scale, the value of your mean could take on 500 * 4 + 1 = 2001 different values) There is little argument that a percentage is a useful summary in yes-no type questions (e.g., voting). This is just the mean where responses have been coded 0 and 1. Treating a 5 point likert scale as 1 2 3 4 5 seems almost as natural to me. Other plausible scalings of the Likert items probably wont change inferences substantively regarding whether differences between means exist (but you can check this). If you are persuaded that the mean is the appropriate measure of central tendency, then you would want to structure your hypothesis tests so that they test for differences between means. A paired sample t-test would allow for a pair-wise comparison of means, but there would be issues around the accuracy of p-values given the discrete and non-normal error distribution. Nonetheless, adopting a non-parametric approach is not a solution, because it changes the hypothesis. I would expect that the paired sample t-test would be fairly robust at least for typicaly Likert item means that avoid either extreme on the scale, but I don't have any simulation studies on hand.
How to test for differences between medians of multiple Likert items? I find the mean to be a much more useful indicator of central tendency of Likert items than the median. I have elaborated on my argument here on a question asking about whether to use the mean or medi
31,944
How to test for differences between medians of multiple Likert items?
Generally, I agree with Jeromy's arguments that the mean is a reasonable statistic for Likert scales. What could speak for the median, is that the median is a much more robust measure of location as it protects against outliers (it has the highest possible breakdown point of 50%). However, as Likert scales are bounded scales, the possibility of extreme outliers is very low (only if your data is extremely skewed). Furthermore, the median usually trims too much from the data, so you could consider using trimmed means instead. An amount of 20% trimming usually is recommended [1]. If you want to calculate a paired test of the difference of medians, I would recommend to compare the means using a percentile bootstrap method (this is the only method for comparing medians that works well in the case of tied values, see Wilcox, 2005 [1]). In the WRS package for R, there is a function called trimpb2 which does this calculation for two independent samples (you can also calculate a p value for trimmend means with that function). In your case, however, you need to compare dependent groups. In this case, you can also do a bias-adjusted percentile bootstrap method [2]. Note, however, that the difference of the medians of the marginal distributions is not the same as looking at the median of the difference scores. The first answers the question 'How does the typical response from the first group differ from the second' and is performed by the WRS function rmmcppb. The second answers the question 'What is the typical difference score' and is performed by the WRS function rmmcppbd. [1] Wilcox, R. R. (2005). Introduction to robust estimation and hypothesis testing. San Diego: Academic Press. [2] Wilcox, R. R. (2006). Pairwise comparisons of dependent groups based on medians. Computational Statistics & Data Analysis, 50, 2933-2941. doi:10.1016/j.csda.2005.04.017
How to test for differences between medians of multiple Likert items?
Generally, I agree with Jeromy's arguments that the mean is a reasonable statistic for Likert scales. What could speak for the median, is that the median is a much more robust measure of location as
How to test for differences between medians of multiple Likert items? Generally, I agree with Jeromy's arguments that the mean is a reasonable statistic for Likert scales. What could speak for the median, is that the median is a much more robust measure of location as it protects against outliers (it has the highest possible breakdown point of 50%). However, as Likert scales are bounded scales, the possibility of extreme outliers is very low (only if your data is extremely skewed). Furthermore, the median usually trims too much from the data, so you could consider using trimmed means instead. An amount of 20% trimming usually is recommended [1]. If you want to calculate a paired test of the difference of medians, I would recommend to compare the means using a percentile bootstrap method (this is the only method for comparing medians that works well in the case of tied values, see Wilcox, 2005 [1]). In the WRS package for R, there is a function called trimpb2 which does this calculation for two independent samples (you can also calculate a p value for trimmend means with that function). In your case, however, you need to compare dependent groups. In this case, you can also do a bias-adjusted percentile bootstrap method [2]. Note, however, that the difference of the medians of the marginal distributions is not the same as looking at the median of the difference scores. The first answers the question 'How does the typical response from the first group differ from the second' and is performed by the WRS function rmmcppb. The second answers the question 'What is the typical difference score' and is performed by the WRS function rmmcppbd. [1] Wilcox, R. R. (2005). Introduction to robust estimation and hypothesis testing. San Diego: Academic Press. [2] Wilcox, R. R. (2006). Pairwise comparisons of dependent groups based on medians. Computational Statistics & Data Analysis, 50, 2933-2941. doi:10.1016/j.csda.2005.04.017
How to test for differences between medians of multiple Likert items? Generally, I agree with Jeromy's arguments that the mean is a reasonable statistic for Likert scales. What could speak for the median, is that the median is a much more robust measure of location as
31,945
How to test for differences between medians of multiple Likert items?
One option for comparing medians is permutation tests. However, if you are comparing the answers 2 questions that were filled out by the same set of people (paired data) then you might also want to look at McNemar's test and the variations on it. To exapnd a bit, the idea of the McNemar test (and extensions of it) is to look at a matrix with the counts of how many respondents chose the combinations, so an idividual would contribute to the count in the cell whose column is determined by their answer to question 1 and row is determined by their answer to question 2 (table or crosstable commands create the matrix). The pattern in this matrix will probably be more informative than a simple mean or median. The diagonal represents people who responded the same to the 2 questions, the upper triangle are those that responded higher on the 1st question than the 2nd question, and the lower triangle the difference. The distance from the diagonal indicates how different the 2 answers were. Variations on the McNemar test look at whether the counts in the 2 triangles are different, or if the matrix is symmetric. To take into account the ordinal (vs. nominal) nature of the data the distance from the diagonal is taken into account. Just looking at the patterns in the table may be enough for your purposes, but if you need a formal test, then you can either go with the suggested tests, or do some form of permutation test (exactly how depends on what you are looking for or trying to show).
How to test for differences between medians of multiple Likert items?
One option for comparing medians is permutation tests. However, if you are comparing the answers 2 questions that were filled out by the same set of people (paired data) then you might also want to l
How to test for differences between medians of multiple Likert items? One option for comparing medians is permutation tests. However, if you are comparing the answers 2 questions that were filled out by the same set of people (paired data) then you might also want to look at McNemar's test and the variations on it. To exapnd a bit, the idea of the McNemar test (and extensions of it) is to look at a matrix with the counts of how many respondents chose the combinations, so an idividual would contribute to the count in the cell whose column is determined by their answer to question 1 and row is determined by their answer to question 2 (table or crosstable commands create the matrix). The pattern in this matrix will probably be more informative than a simple mean or median. The diagonal represents people who responded the same to the 2 questions, the upper triangle are those that responded higher on the 1st question than the 2nd question, and the lower triangle the difference. The distance from the diagonal indicates how different the 2 answers were. Variations on the McNemar test look at whether the counts in the 2 triangles are different, or if the matrix is symmetric. To take into account the ordinal (vs. nominal) nature of the data the distance from the diagonal is taken into account. Just looking at the patterns in the table may be enough for your purposes, but if you need a formal test, then you can either go with the suggested tests, or do some form of permutation test (exactly how depends on what you are looking for or trying to show).
How to test for differences between medians of multiple Likert items? One option for comparing medians is permutation tests. However, if you are comparing the answers 2 questions that were filled out by the same set of people (paired data) then you might also want to l
31,946
Question about independence assumption for ANOVA, t-test, and non-parametric tests
First. Observations in two groups should be independent means that the two groups consist of different individuals, not the same individuals measured twice or specially matched individuals (such as siblings). When you have two independent groups, your data look as follows: id group characteristic 1 1 3.4 2 1 1.6 3 1 2.8 4 2 0.9 5 2 5.3 6 2 5.0 In contrast, when your 2 groups are paired (related) you normally enter your data as if you have just one group, two measures: id characteristic measure1 measure2 1 3.4 0.9 2 1.6 5.3 3 2.8 5.0 All observations (even in the same group) should be independent. This is also true and it means that each row of the data (see above data examples) was included in the sample independently of other rows: observation with id=1 is sampled independently from observation id=2 or id=3. Second. They are the same. T-test for independent groups can be treated as a particular case of one-way ANOVA for independent groups. Third. There are many different nonparametric tests. The Wilcoxon test you are talking about is a two paired-samples test, thus, it needs non-independent groups (with independent observations within groups). The non-parametric test for two independent groups is called Mann-Whitney test (and rarely called Wilcoxon test, too).
Question about independence assumption for ANOVA, t-test, and non-parametric tests
First. Observations in two groups should be independent means that the two groups consist of different individuals, not the same individuals measured twice or specially matched individuals (such as si
Question about independence assumption for ANOVA, t-test, and non-parametric tests First. Observations in two groups should be independent means that the two groups consist of different individuals, not the same individuals measured twice or specially matched individuals (such as siblings). When you have two independent groups, your data look as follows: id group characteristic 1 1 3.4 2 1 1.6 3 1 2.8 4 2 0.9 5 2 5.3 6 2 5.0 In contrast, when your 2 groups are paired (related) you normally enter your data as if you have just one group, two measures: id characteristic measure1 measure2 1 3.4 0.9 2 1.6 5.3 3 2.8 5.0 All observations (even in the same group) should be independent. This is also true and it means that each row of the data (see above data examples) was included in the sample independently of other rows: observation with id=1 is sampled independently from observation id=2 or id=3. Second. They are the same. T-test for independent groups can be treated as a particular case of one-way ANOVA for independent groups. Third. There are many different nonparametric tests. The Wilcoxon test you are talking about is a two paired-samples test, thus, it needs non-independent groups (with independent observations within groups). The non-parametric test for two independent groups is called Mann-Whitney test (and rarely called Wilcoxon test, too).
Question about independence assumption for ANOVA, t-test, and non-parametric tests First. Observations in two groups should be independent means that the two groups consist of different individuals, not the same individuals measured twice or specially matched individuals (such as si
31,947
Coding an interaction between a nominal and a continuous predictor for logistic regression in MATLAB
The easiest way, IMO, is to build the design matrix yourself, as glmfit accepts either a matrix of raw (observed) values or a design matrix. Coding an interaction term isn't that much difficult once you wrote the full model. Let's say we have two predictors, $x$ (continuous) and $g$ (categorical, with three unordered levels, say $g={1,2,3}$). Using Wilkinson's notation, we would write this model as y ~ x + g + x:g, neglecting the left-hand side (for a binomial outcome, we would use a logit link function). We only need two dummy vectors to code the g levels (as present/absent for a particular observation), so we will have 5 regression coefficients, plus an intercept term. This can be summarized as $$\beta_0 + \beta_1\cdot x +\beta_2\cdot\mathbb{I}_{g=2} +\beta_3\cdot\mathbb{I}_{g=3} + \beta_4\cdot x\times\mathbb{I}_{g=2} + \beta_5\cdot x\times\mathbb{I}_{g=3},$$ where $\mathbb{I}$ stands for an indicator matrix coding the level of $g$. In Matlab, using the online example, I would do as follows: x = [2100 2300 2500 2700 2900 3100 3300 3500 3700 3900 4100 4300]'; g = [1 1 1 1 2 2 2 2 3 3 3 3]'; gcat = dummyvar(g); gcat = gcat(:,2:3); % remove the first column X = [x gcat x.*gcat(:,1) x.*gcat(:,2)]; n = [48 42 31 34 31 21 23 23 21 16 17 21]'; y = [1 2 0 3 8 8 14 17 19 15 17 21]'; [b, dev, stats] = glmfit(X, [y n], 'binomial', 'link', 'probit'); I didn't include a column of ones for the intercept as it is included by default. The design matrix looks like 2100 0 0 0 0 2300 0 0 0 0 2500 0 0 0 0 2700 0 0 0 0 2900 1 0 2900 0 3100 1 0 3100 0 3300 1 0 3300 0 3500 1 0 3500 0 3700 0 1 0 3700 3900 0 1 0 3900 4100 0 1 0 4100 4300 0 1 0 4300 and you can see that the interaction terms are just coded as the product of x with the corresponding column of g (g=2 and g=3, since we don't need the first level). The results are given below, as coefficients, standard errors, statistic and p-value (from stats structure): int. -3.8929 2.0251 -1.9223 0.0546 x 0.0009 0.0008 1.0663 0.2863 g2 -3.2125 2.7622 -1.1630 0.2448 g3 -5.7745 7.5542 -0.7644 0.4446 x:g2 0.0013 0.0010 1.3122 0.1894 x:g3 0.0021 0.0021 0.9882 0.3230 Now, testing the interaction can be done by computing the difference in deviance from the full model above and a reduced model (omitting the interaction term, that is the last two columns of the design matrix). This can be done manually, or using the lratiotest function which provides Likelihood ratio hypothesis test. The deviance for the full model is 4.3122 (dev), while for the model without interaction it is 6.4200 (I used glmfit(X(:,1:3), [y n], 'binomial', 'link', 'probit');), and the associated LR test has two degrees of freedom (the difference in the number of parameters between the two models). As the scaled deviance is just two times the log-likelihood for GLMs, we can use [H, pValue, Ratio, CriticalValue] = lratiotest(4.3122/2, 6.4200/2, 2) where the statistic is distributed as a $\chi^2$ with 2 df (the critical value is then 5.9915, seechi2inv(0.95, 2)). The output indicates a non-significant result: We cannot conclude to the existence of an interaction between x and g in the observed sample. I guess you can wrap up the above steps in a convenient function of your choice. (Note that the LR test might be done by hand in very few commands!) I checked those results against R output, which is given next. Here is the R code: x <- c(2100,2300,2500,2700,2900,3100,3300,3500,3700,3900,4100,4300) g <- gl(3, 4) n <- c(48,42,31,34,31,21,23,23,21,16,17,21) y <- c(1,2,0,3,8,8,14,17,19,15,17,21) f <- cbind(y, n-y) ~ x*g model.matrix(f) # will be model.frame() for glm() m1 <- glm(f, family=binomial("probit")) summary(m1) Here are the results, for the coefficients in the full model, Call: glm(formula = f, family = binomial("probit")) Deviance Residuals: Min 1Q Median 3Q Max -1.7124 -0.1192 0.1494 0.3036 0.5585 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -3.892859 2.025096 -1.922 0.0546 . x 0.000884 0.000829 1.066 0.2863 g2 -3.212494 2.762155 -1.163 0.2448 g3 -5.774400 7.553615 -0.764 0.4446 x:g2 0.001335 0.001017 1.312 0.1894 x:g3 0.002061 0.002086 0.988 0.3230 For the comparison of the two nested models, I used the following commands: m0 <- update(m1, . ~ . -x:g) anova(m1,m0) which yields the following "deviance table": Analysis of Deviance Table Model 1: cbind(y, n - y) ~ x + g Model 2: cbind(y, n - y) ~ x * g Resid. Df Resid. Dev Df Deviance 1 8 6.4200 2 6 4.3122 2 2.1078
Coding an interaction between a nominal and a continuous predictor for logistic regression in MATLAB
The easiest way, IMO, is to build the design matrix yourself, as glmfit accepts either a matrix of raw (observed) values or a design matrix. Coding an interaction term isn't that much difficult once y
Coding an interaction between a nominal and a continuous predictor for logistic regression in MATLAB The easiest way, IMO, is to build the design matrix yourself, as glmfit accepts either a matrix of raw (observed) values or a design matrix. Coding an interaction term isn't that much difficult once you wrote the full model. Let's say we have two predictors, $x$ (continuous) and $g$ (categorical, with three unordered levels, say $g={1,2,3}$). Using Wilkinson's notation, we would write this model as y ~ x + g + x:g, neglecting the left-hand side (for a binomial outcome, we would use a logit link function). We only need two dummy vectors to code the g levels (as present/absent for a particular observation), so we will have 5 regression coefficients, plus an intercept term. This can be summarized as $$\beta_0 + \beta_1\cdot x +\beta_2\cdot\mathbb{I}_{g=2} +\beta_3\cdot\mathbb{I}_{g=3} + \beta_4\cdot x\times\mathbb{I}_{g=2} + \beta_5\cdot x\times\mathbb{I}_{g=3},$$ where $\mathbb{I}$ stands for an indicator matrix coding the level of $g$. In Matlab, using the online example, I would do as follows: x = [2100 2300 2500 2700 2900 3100 3300 3500 3700 3900 4100 4300]'; g = [1 1 1 1 2 2 2 2 3 3 3 3]'; gcat = dummyvar(g); gcat = gcat(:,2:3); % remove the first column X = [x gcat x.*gcat(:,1) x.*gcat(:,2)]; n = [48 42 31 34 31 21 23 23 21 16 17 21]'; y = [1 2 0 3 8 8 14 17 19 15 17 21]'; [b, dev, stats] = glmfit(X, [y n], 'binomial', 'link', 'probit'); I didn't include a column of ones for the intercept as it is included by default. The design matrix looks like 2100 0 0 0 0 2300 0 0 0 0 2500 0 0 0 0 2700 0 0 0 0 2900 1 0 2900 0 3100 1 0 3100 0 3300 1 0 3300 0 3500 1 0 3500 0 3700 0 1 0 3700 3900 0 1 0 3900 4100 0 1 0 4100 4300 0 1 0 4300 and you can see that the interaction terms are just coded as the product of x with the corresponding column of g (g=2 and g=3, since we don't need the first level). The results are given below, as coefficients, standard errors, statistic and p-value (from stats structure): int. -3.8929 2.0251 -1.9223 0.0546 x 0.0009 0.0008 1.0663 0.2863 g2 -3.2125 2.7622 -1.1630 0.2448 g3 -5.7745 7.5542 -0.7644 0.4446 x:g2 0.0013 0.0010 1.3122 0.1894 x:g3 0.0021 0.0021 0.9882 0.3230 Now, testing the interaction can be done by computing the difference in deviance from the full model above and a reduced model (omitting the interaction term, that is the last two columns of the design matrix). This can be done manually, or using the lratiotest function which provides Likelihood ratio hypothesis test. The deviance for the full model is 4.3122 (dev), while for the model without interaction it is 6.4200 (I used glmfit(X(:,1:3), [y n], 'binomial', 'link', 'probit');), and the associated LR test has two degrees of freedom (the difference in the number of parameters between the two models). As the scaled deviance is just two times the log-likelihood for GLMs, we can use [H, pValue, Ratio, CriticalValue] = lratiotest(4.3122/2, 6.4200/2, 2) where the statistic is distributed as a $\chi^2$ with 2 df (the critical value is then 5.9915, seechi2inv(0.95, 2)). The output indicates a non-significant result: We cannot conclude to the existence of an interaction between x and g in the observed sample. I guess you can wrap up the above steps in a convenient function of your choice. (Note that the LR test might be done by hand in very few commands!) I checked those results against R output, which is given next. Here is the R code: x <- c(2100,2300,2500,2700,2900,3100,3300,3500,3700,3900,4100,4300) g <- gl(3, 4) n <- c(48,42,31,34,31,21,23,23,21,16,17,21) y <- c(1,2,0,3,8,8,14,17,19,15,17,21) f <- cbind(y, n-y) ~ x*g model.matrix(f) # will be model.frame() for glm() m1 <- glm(f, family=binomial("probit")) summary(m1) Here are the results, for the coefficients in the full model, Call: glm(formula = f, family = binomial("probit")) Deviance Residuals: Min 1Q Median 3Q Max -1.7124 -0.1192 0.1494 0.3036 0.5585 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -3.892859 2.025096 -1.922 0.0546 . x 0.000884 0.000829 1.066 0.2863 g2 -3.212494 2.762155 -1.163 0.2448 g3 -5.774400 7.553615 -0.764 0.4446 x:g2 0.001335 0.001017 1.312 0.1894 x:g3 0.002061 0.002086 0.988 0.3230 For the comparison of the two nested models, I used the following commands: m0 <- update(m1, . ~ . -x:g) anova(m1,m0) which yields the following "deviance table": Analysis of Deviance Table Model 1: cbind(y, n - y) ~ x + g Model 2: cbind(y, n - y) ~ x * g Resid. Df Resid. Dev Df Deviance 1 8 6.4200 2 6 4.3122 2 2.1078
Coding an interaction between a nominal and a continuous predictor for logistic regression in MATLAB The easiest way, IMO, is to build the design matrix yourself, as glmfit accepts either a matrix of raw (observed) values or a design matrix. Coding an interaction term isn't that much difficult once y
31,948
Fitting multivariate linear mixed model in R
Fitting multivariate models with lme4 or nlmeis a bit fiddly, but solutions can be found in this document by Ben Bolker. Else if you want to stay in a frequentist framework, the mcglm package can handle multivariate models, even with non-normal distributions. A detailed tutorial should be published soon. If you are not familiar with design matrices, designing the matrix of random effects can be a bit tricky though. In a Bayesian framework, the MCMCglmm package is also very good at modelling multivariate traits incl. non-normal distributions, and handles random effects in a simpler way than mcglm does. Its use for multivariate models is also well described by Ben Bolker. But you first have to make yourself familiar with Markov chain Monte Carlo, as well as with the principles of Bayesian statistics. So either way, there might be a slow learning curve at the beginning, depending on your familiarity with either methods!
Fitting multivariate linear mixed model in R
Fitting multivariate models with lme4 or nlmeis a bit fiddly, but solutions can be found in this document by Ben Bolker. Else if you want to stay in a frequentist framework, the mcglm package can hand
Fitting multivariate linear mixed model in R Fitting multivariate models with lme4 or nlmeis a bit fiddly, but solutions can be found in this document by Ben Bolker. Else if you want to stay in a frequentist framework, the mcglm package can handle multivariate models, even with non-normal distributions. A detailed tutorial should be published soon. If you are not familiar with design matrices, designing the matrix of random effects can be a bit tricky though. In a Bayesian framework, the MCMCglmm package is also very good at modelling multivariate traits incl. non-normal distributions, and handles random effects in a simpler way than mcglm does. Its use for multivariate models is also well described by Ben Bolker. But you first have to make yourself familiar with Markov chain Monte Carlo, as well as with the principles of Bayesian statistics. So either way, there might be a slow learning curve at the beginning, depending on your familiarity with either methods!
Fitting multivariate linear mixed model in R Fitting multivariate models with lme4 or nlmeis a bit fiddly, but solutions can be found in this document by Ben Bolker. Else if you want to stay in a frequentist framework, the mcglm package can hand
31,949
Fitting multivariate linear mixed model in R
Try the R package nlme You can find some examples, theory and further documentation in: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-models.pdf The nlme package is able to calculate pooled estimates [or the so called BLUP= best linear unbiased predictor]. Once you've downloaded the package, type in R console: help(predict.lme) For more information, look at page 17 in Fox's paper. There you can find an example on how to pool information across subjects. Hope this helps :)
Fitting multivariate linear mixed model in R
Try the R package nlme You can find some examples, theory and further documentation in: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-models.pdf The nlme package is able to cal
Fitting multivariate linear mixed model in R Try the R package nlme You can find some examples, theory and further documentation in: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-models.pdf The nlme package is able to calculate pooled estimates [or the so called BLUP= best linear unbiased predictor]. Once you've downloaded the package, type in R console: help(predict.lme) For more information, look at page 17 in Fox's paper. There you can find an example on how to pool information across subjects. Hope this helps :)
Fitting multivariate linear mixed model in R Try the R package nlme You can find some examples, theory and further documentation in: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-models.pdf The nlme package is able to cal
31,950
Testing difference between two (adjusted) r^2
As whuber stated this actually is a case of nested models, and hence one can apply a likelihood-ratio test. Because it is still not exactly clear what models you are specifying I will just rewrite them in this example; So model 1 can be: $Y = a_1 + B_{11}(X) + B_{12}(W) + B_{13}(Z) + e_1$ And model 2 can be (I ignore the division by 2, but this action has no consequence for your question): $Y = a_2 + B_{21}(X) + B_{22}(W+Z) + e_2$ Which can be rewritten as: $Y = a_2 + B_{21}(X) + B_{22}(W) + B_{22}(Z)+ e_2$ And hence model 2 is a specific case of model 1 in which $B_{12}$ and $B_{13}$ are equal. One can use the likelihood-ratio test between these two models to assign a p-value to the fit of model 1 compared to model 2. There are good reasons in practice to do this, especially if the correlation between W and Z are quite large (multicollinearity). As I stated previously, whether you divide by two does not matter for testing the fit of the models, although if it is easier to interpret $\frac{W+Z}{2}$ then $W+Z$ by all means use the average of the two variables. Model fit statistics (such as Mallow's CP already mentioned by bill_080, and other examples are AIC and BIC), are frequently used to assess non-nested models. Those statistics do not follow known distributions (like the log-likelihood does, Chi-square) and hence the differences in those statistics between models can not be given a p-value.
Testing difference between two (adjusted) r^2
As whuber stated this actually is a case of nested models, and hence one can apply a likelihood-ratio test. Because it is still not exactly clear what models you are specifying I will just rewrite the
Testing difference between two (adjusted) r^2 As whuber stated this actually is a case of nested models, and hence one can apply a likelihood-ratio test. Because it is still not exactly clear what models you are specifying I will just rewrite them in this example; So model 1 can be: $Y = a_1 + B_{11}(X) + B_{12}(W) + B_{13}(Z) + e_1$ And model 2 can be (I ignore the division by 2, but this action has no consequence for your question): $Y = a_2 + B_{21}(X) + B_{22}(W+Z) + e_2$ Which can be rewritten as: $Y = a_2 + B_{21}(X) + B_{22}(W) + B_{22}(Z)+ e_2$ And hence model 2 is a specific case of model 1 in which $B_{12}$ and $B_{13}$ are equal. One can use the likelihood-ratio test between these two models to assign a p-value to the fit of model 1 compared to model 2. There are good reasons in practice to do this, especially if the correlation between W and Z are quite large (multicollinearity). As I stated previously, whether you divide by two does not matter for testing the fit of the models, although if it is easier to interpret $\frac{W+Z}{2}$ then $W+Z$ by all means use the average of the two variables. Model fit statistics (such as Mallow's CP already mentioned by bill_080, and other examples are AIC and BIC), are frequently used to assess non-nested models. Those statistics do not follow known distributions (like the log-likelihood does, Chi-square) and hence the differences in those statistics between models can not be given a p-value.
Testing difference between two (adjusted) r^2 As whuber stated this actually is a case of nested models, and hence one can apply a likelihood-ratio test. Because it is still not exactly clear what models you are specifying I will just rewrite the
31,951
Testing difference between two (adjusted) r^2
Take a look at Mallow's Cp: Mallow's Cp Here's a related question: Is there a way to optimize regression according to a specific criterion?
Testing difference between two (adjusted) r^2
Take a look at Mallow's Cp: Mallow's Cp Here's a related question: Is there a way to optimize regression according to a specific criterion?
Testing difference between two (adjusted) r^2 Take a look at Mallow's Cp: Mallow's Cp Here's a related question: Is there a way to optimize regression according to a specific criterion?
Testing difference between two (adjusted) r^2 Take a look at Mallow's Cp: Mallow's Cp Here's a related question: Is there a way to optimize regression according to a specific criterion?
31,952
Testing difference between two (adjusted) r^2
Given the setup in Andy W answer, if one estimates the model $Y = a_3 + B_{31}(X) + B_{32}(W+Z) + B_{33}(Z) + e_3$ the test associated with $B_{33}$ gives you the test that model 1 is different from model 2. The reason is that $B_{33}$ is exactly (a part from the sign) the difference between $B_{12}$ and $B_{13}$. Thus, if their difference is not significant, keeping W and Z in the model (model 1) does not help in terms of variance explained as compared with combining them in one variable (model 2). If $B_{33}$ is significant, model 1 is better.
Testing difference between two (adjusted) r^2
Given the setup in Andy W answer, if one estimates the model $Y = a_3 + B_{31}(X) + B_{32}(W+Z) + B_{33}(Z) + e_3$ the test associated with $B_{33}$ gives you the test that model 1 is different from
Testing difference between two (adjusted) r^2 Given the setup in Andy W answer, if one estimates the model $Y = a_3 + B_{31}(X) + B_{32}(W+Z) + B_{33}(Z) + e_3$ the test associated with $B_{33}$ gives you the test that model 1 is different from model 2. The reason is that $B_{33}$ is exactly (a part from the sign) the difference between $B_{12}$ and $B_{13}$. Thus, if their difference is not significant, keeping W and Z in the model (model 1) does not help in terms of variance explained as compared with combining them in one variable (model 2). If $B_{33}$ is significant, model 1 is better.
Testing difference between two (adjusted) r^2 Given the setup in Andy W answer, if one estimates the model $Y = a_3 + B_{31}(X) + B_{32}(W+Z) + B_{33}(Z) + e_3$ the test associated with $B_{33}$ gives you the test that model 1 is different from
31,953
What's the probability that a bookmaker is mispricing odds on soccer games?
The answer to your question depends intricately on what information and assumptions you are going to use. This is because the result of a game is an extraordinarily complicated process. It can become arbitrarily complicated depending on what information you have about: Players in the particular team - perhaps even particular combinations of players may be relevant. Players in other teams Past history of the league How stable the team's players are - do players keep getting selected and dropped, or is it the same 11. The time that you place your bet (during the game? before? how much before? what info is lost from betting before to betting on the day?) some other relevant feature of soccer which I have omitted. The odds that a book-maker gives are not a reflection of the book-makers odds. which is impossible if they are probabilities. A book-maker will adjust the odds down when someone bets on a draw, and adjust them up when someone bets on a non-draw. Thus, the odds are a reflection of the gamblers (who use that book-maker) odds as a whole. So it is not the bookmaker who is miss-pricing per se, it is the gambling collective - or the "average gambler". Now if you are willing to assume that whatever "causal mechanism" is resulting in a draw remains constant across the season (reasonable? probably not...), then a simple mathematical problem is obtained (but note there is no reason for this to be "more right" than some other simplifying assumption). To remind us that this is the assumption being used, an $A$ will be put on the conditioning side of the probabilities. Under this assumption the binomial distribution applies: $$P(\text{k Draws in n matches}|\theta,A)={n \choose k}\theta^{k}(1-\theta)^{n-k}$$ And we want to calculate the following $$P(\text{next match is a draw}|\text{k Draws in n matches},A)$$ $$=\int_{0}^{1}P(\text{next match is a draw}|\theta,A)P(\theta|\text{k Draws in n matches},A)d\theta$$ where $$P(\theta|\text{k Draws in n matches},A)=P(\theta|A)\frac{P(\text{k Draws in n matches}|\theta,A)}{P(\text{k Draws in n matches}|A)}$$ is the posterior for $\theta$. Now in this case, it is fairly obvious that it is possible for a draw to happen, and also possible for it to not happen, so a uniform prior is appropriate (unless there is extra information we wish to include beyond the results of the season) and we set $P(\theta|A)=1$. The posterior is then given by a beta distribution (where $B(\alpha,\beta)$ is the beta function) $$P(\theta|\text{k Draws in n matches},A)=\frac{\theta^{k}(1-\theta)^{n-k}}{B(k+1,n-k+1)}$$ Given $\theta$ and $A$ the probability that the next match is a draw is just $\theta$ so the integral becomes: $$\int_{0}^{1}\theta \frac{\theta^{k}(1-\theta)^{n-k}}{B(k+1,n-k+1)}d\theta=\frac{B(k+2,n-k+1)}{B(k+1,n-k+1)}=\frac{k+1}{n+2}$$ and hence the probability is just: $$P(\text{next match is a draw}|\text{k Draws in n matches},A)=\frac{k+1}{n+2}$$ But note that it depends on $A$ - the assumptions that were made. Call the "priced odds" a probability conditional on some other unknown complex information, say $B$. So if the published odds are different to the the above fraction, then this says that $A$ and $B$ lead to different conclusions, so both can't be right about the "true outcome" (but both can be right conditional on the assumptions each made). THE KILLER BLOW This example showed that the answer to your question boiled down to deciding if $A$ was "more accurate" than $B$ in describing the mechanics of the soccer game. This will happen regardless of what the proposition $A$ happens to be. We will always boil down to the question of asking "whose assumptions are right, the gambling collective's or mine?" This last question is a basically unanswerable question until you know exactly what the proposition $B$ consists of (or at least some key features of it). For how can you compare something that is known with something that is not? UPDATE: An actual answer :) As @whuber has cheekily pointed out, I haven't actually given an expected value here - so this part simply completes that part of my answer. If one was to assume that $A$ is true with priced odds of $Q$, then you would expect, in the next game to receive $$Q\times P(\text{next match is a draw}|\text{k Draws in n matches},A)-1$$ $$=Q\times \frac{k+1}{n+2}-1=\frac{Q(k+1)-n-2}{n+2}$$ Now if you assume that the value of $Q$ is based on the same model as yours then we can predict exactly how $Q$ will change into the future. Suppose $Q$ was based on a different prior to the uniform one, say $Beta(\alpha_Q,\beta_Q)$, then the corresponding probability is $$P(\text{next match is a draw}|\text{k Draws in n matches},A_Q)=\frac{k+\alpha_Q}{n+\alpha_Q+\beta_Q}$$ with expected return of $$\frac{Q(k+\alpha_Q)-n-\alpha_Q-\beta_Q}{n+\alpha_Q+\beta_Q}$$ Now if we make the "prior weight" $\alpha_Q+\beta_Q = \frac{N}{2}$ where $N$ is the length of the season (this will allow the "miss-pricing" to continue into the remainder of the season) and set the expected return to zero we get: $$\alpha_Q=\frac{2n+N}{2Q}-k$$ (NOTE: unless this is the actual model, $\alpha_Q$ will depend on when this calculation was done, as it depends on $n,k,Q$ which will vary over time). Now we are able to predict how $Q$ will be adjusted into the future, it will add $1$ to the denominator for each match, and $1$ to the numerator if the match was a draw. So the expected odds after the first match are: $$(1+\frac{n+\beta_Q-k+1}{k+\alpha_Q})\frac{n-k+\beta_Q}{n+\alpha_Q+\beta_Q}+(1+\frac{n+\beta_Q-k}{k+\alpha_Q+1})\frac{k+\alpha_Q}{n+\alpha_Q+\beta_Q}$$ $$=1+\frac{n+\beta_Q-k}{k+\alpha_Q}\left(1+\frac{2}{(2n+N)(k+\alpha_Q+1)}\right)\approx 1+\frac{n+\beta_Q-k}{k+\alpha_Q}$$ That is the odds won't change much over the season. Using this approximation, we get the expected return over the remainder of the season as: $$(N-n)\frac{Q(k+1)-n-2}{n+2}$$ But remember that this is based on the overly simplistic model of a draw (note: this does not necessarily mean that it will be a "crap" predictor). There can be no unique answer to your question, because there has been no specified model, and no specified prior information (e.g. how many people use this bookie? what is the bookie's turnover? how will my bets influence the odds they price?). The only thing which has been specified is the data from one season, and that for "some unspecified model" the probabilities are inconsistent with those implied by the odds pricing.
What's the probability that a bookmaker is mispricing odds on soccer games?
The answer to your question depends intricately on what information and assumptions you are going to use. This is because the result of a game is an extraordinarily complicated process. It can becom
What's the probability that a bookmaker is mispricing odds on soccer games? The answer to your question depends intricately on what information and assumptions you are going to use. This is because the result of a game is an extraordinarily complicated process. It can become arbitrarily complicated depending on what information you have about: Players in the particular team - perhaps even particular combinations of players may be relevant. Players in other teams Past history of the league How stable the team's players are - do players keep getting selected and dropped, or is it the same 11. The time that you place your bet (during the game? before? how much before? what info is lost from betting before to betting on the day?) some other relevant feature of soccer which I have omitted. The odds that a book-maker gives are not a reflection of the book-makers odds. which is impossible if they are probabilities. A book-maker will adjust the odds down when someone bets on a draw, and adjust them up when someone bets on a non-draw. Thus, the odds are a reflection of the gamblers (who use that book-maker) odds as a whole. So it is not the bookmaker who is miss-pricing per se, it is the gambling collective - or the "average gambler". Now if you are willing to assume that whatever "causal mechanism" is resulting in a draw remains constant across the season (reasonable? probably not...), then a simple mathematical problem is obtained (but note there is no reason for this to be "more right" than some other simplifying assumption). To remind us that this is the assumption being used, an $A$ will be put on the conditioning side of the probabilities. Under this assumption the binomial distribution applies: $$P(\text{k Draws in n matches}|\theta,A)={n \choose k}\theta^{k}(1-\theta)^{n-k}$$ And we want to calculate the following $$P(\text{next match is a draw}|\text{k Draws in n matches},A)$$ $$=\int_{0}^{1}P(\text{next match is a draw}|\theta,A)P(\theta|\text{k Draws in n matches},A)d\theta$$ where $$P(\theta|\text{k Draws in n matches},A)=P(\theta|A)\frac{P(\text{k Draws in n matches}|\theta,A)}{P(\text{k Draws in n matches}|A)}$$ is the posterior for $\theta$. Now in this case, it is fairly obvious that it is possible for a draw to happen, and also possible for it to not happen, so a uniform prior is appropriate (unless there is extra information we wish to include beyond the results of the season) and we set $P(\theta|A)=1$. The posterior is then given by a beta distribution (where $B(\alpha,\beta)$ is the beta function) $$P(\theta|\text{k Draws in n matches},A)=\frac{\theta^{k}(1-\theta)^{n-k}}{B(k+1,n-k+1)}$$ Given $\theta$ and $A$ the probability that the next match is a draw is just $\theta$ so the integral becomes: $$\int_{0}^{1}\theta \frac{\theta^{k}(1-\theta)^{n-k}}{B(k+1,n-k+1)}d\theta=\frac{B(k+2,n-k+1)}{B(k+1,n-k+1)}=\frac{k+1}{n+2}$$ and hence the probability is just: $$P(\text{next match is a draw}|\text{k Draws in n matches},A)=\frac{k+1}{n+2}$$ But note that it depends on $A$ - the assumptions that were made. Call the "priced odds" a probability conditional on some other unknown complex information, say $B$. So if the published odds are different to the the above fraction, then this says that $A$ and $B$ lead to different conclusions, so both can't be right about the "true outcome" (but both can be right conditional on the assumptions each made). THE KILLER BLOW This example showed that the answer to your question boiled down to deciding if $A$ was "more accurate" than $B$ in describing the mechanics of the soccer game. This will happen regardless of what the proposition $A$ happens to be. We will always boil down to the question of asking "whose assumptions are right, the gambling collective's or mine?" This last question is a basically unanswerable question until you know exactly what the proposition $B$ consists of (or at least some key features of it). For how can you compare something that is known with something that is not? UPDATE: An actual answer :) As @whuber has cheekily pointed out, I haven't actually given an expected value here - so this part simply completes that part of my answer. If one was to assume that $A$ is true with priced odds of $Q$, then you would expect, in the next game to receive $$Q\times P(\text{next match is a draw}|\text{k Draws in n matches},A)-1$$ $$=Q\times \frac{k+1}{n+2}-1=\frac{Q(k+1)-n-2}{n+2}$$ Now if you assume that the value of $Q$ is based on the same model as yours then we can predict exactly how $Q$ will change into the future. Suppose $Q$ was based on a different prior to the uniform one, say $Beta(\alpha_Q,\beta_Q)$, then the corresponding probability is $$P(\text{next match is a draw}|\text{k Draws in n matches},A_Q)=\frac{k+\alpha_Q}{n+\alpha_Q+\beta_Q}$$ with expected return of $$\frac{Q(k+\alpha_Q)-n-\alpha_Q-\beta_Q}{n+\alpha_Q+\beta_Q}$$ Now if we make the "prior weight" $\alpha_Q+\beta_Q = \frac{N}{2}$ where $N$ is the length of the season (this will allow the "miss-pricing" to continue into the remainder of the season) and set the expected return to zero we get: $$\alpha_Q=\frac{2n+N}{2Q}-k$$ (NOTE: unless this is the actual model, $\alpha_Q$ will depend on when this calculation was done, as it depends on $n,k,Q$ which will vary over time). Now we are able to predict how $Q$ will be adjusted into the future, it will add $1$ to the denominator for each match, and $1$ to the numerator if the match was a draw. So the expected odds after the first match are: $$(1+\frac{n+\beta_Q-k+1}{k+\alpha_Q})\frac{n-k+\beta_Q}{n+\alpha_Q+\beta_Q}+(1+\frac{n+\beta_Q-k}{k+\alpha_Q+1})\frac{k+\alpha_Q}{n+\alpha_Q+\beta_Q}$$ $$=1+\frac{n+\beta_Q-k}{k+\alpha_Q}\left(1+\frac{2}{(2n+N)(k+\alpha_Q+1)}\right)\approx 1+\frac{n+\beta_Q-k}{k+\alpha_Q}$$ That is the odds won't change much over the season. Using this approximation, we get the expected return over the remainder of the season as: $$(N-n)\frac{Q(k+1)-n-2}{n+2}$$ But remember that this is based on the overly simplistic model of a draw (note: this does not necessarily mean that it will be a "crap" predictor). There can be no unique answer to your question, because there has been no specified model, and no specified prior information (e.g. how many people use this bookie? what is the bookie's turnover? how will my bets influence the odds they price?). The only thing which has been specified is the data from one season, and that for "some unspecified model" the probabilities are inconsistent with those implied by the odds pricing.
What's the probability that a bookmaker is mispricing odds on soccer games? The answer to your question depends intricately on what information and assumptions you are going to use. This is because the result of a game is an extraordinarily complicated process. It can becom
31,954
What's the probability that a bookmaker is mispricing odds on soccer games?
Bookmakers use an overround so they don't actually care what the result is because they win whatever. That is why you never meet a poor bookie. If a bookmaker is mispricing draws your ability to make profit would depend on the odds the bookmaker was offering and whether the profits generated would cover the times you lose.
What's the probability that a bookmaker is mispricing odds on soccer games?
Bookmakers use an overround so they don't actually care what the result is because they win whatever. That is why you never meet a poor bookie. If a bookmaker is mispricing draws your ability to make
What's the probability that a bookmaker is mispricing odds on soccer games? Bookmakers use an overround so they don't actually care what the result is because they win whatever. That is why you never meet a poor bookie. If a bookmaker is mispricing draws your ability to make profit would depend on the odds the bookmaker was offering and whether the profits generated would cover the times you lose.
What's the probability that a bookmaker is mispricing odds on soccer games? Bookmakers use an overround so they don't actually care what the result is because they win whatever. That is why you never meet a poor bookie. If a bookmaker is mispricing draws your ability to make
31,955
How to choose number of lags in ARCH models using ARCH LM test?
Arch LM tests whether coefficients in the regression: $$a_t^2=\alpha_0+\alpha_1 a_{t-1}^2+...+\alpha_p a_{t-p}^2+e_t$$ are zero, where $a_t$ is either observed series which we want to test for ARCH effects. So the null hypothesis is $$\alpha_1=...=\alpha_p=0$$ If hypothesis is accepted then we can say that series have no ARCH effects. If it is rejected then one or more coefficients are non zero and we say that there are ARCH effects. Here we have classical regression problem of joint hypotheses versus individual hypothesis. When more regressors are included the regression is jointly insignificant, although a few regressors seem to be significant. All the introductory books about regression usually have chapter dedicated to this. The key motive is that joint hypotheses take into account all the interactions, when individual hypotheses do not. So in this case the statistic with few lags do not take into account the effects of more lags. When statistical tests give conflicting results, for me it is an indication that data should be reexamined. Statistical tests usually have certain assumptions, which data may violate. In your case if we look at the graph of the series, we see a lot of zeroes. So this is not an ordinary time series and I would hesitate to use plain ARCH model.
How to choose number of lags in ARCH models using ARCH LM test?
Arch LM tests whether coefficients in the regression: $$a_t^2=\alpha_0+\alpha_1 a_{t-1}^2+...+\alpha_p a_{t-p}^2+e_t$$ are zero, where $a_t$ is either observed series which we want to test for ARCH ef
How to choose number of lags in ARCH models using ARCH LM test? Arch LM tests whether coefficients in the regression: $$a_t^2=\alpha_0+\alpha_1 a_{t-1}^2+...+\alpha_p a_{t-p}^2+e_t$$ are zero, where $a_t$ is either observed series which we want to test for ARCH effects. So the null hypothesis is $$\alpha_1=...=\alpha_p=0$$ If hypothesis is accepted then we can say that series have no ARCH effects. If it is rejected then one or more coefficients are non zero and we say that there are ARCH effects. Here we have classical regression problem of joint hypotheses versus individual hypothesis. When more regressors are included the regression is jointly insignificant, although a few regressors seem to be significant. All the introductory books about regression usually have chapter dedicated to this. The key motive is that joint hypotheses take into account all the interactions, when individual hypotheses do not. So in this case the statistic with few lags do not take into account the effects of more lags. When statistical tests give conflicting results, for me it is an indication that data should be reexamined. Statistical tests usually have certain assumptions, which data may violate. In your case if we look at the graph of the series, we see a lot of zeroes. So this is not an ordinary time series and I would hesitate to use plain ARCH model.
How to choose number of lags in ARCH models using ARCH LM test? Arch LM tests whether coefficients in the regression: $$a_t^2=\alpha_0+\alpha_1 a_{t-1}^2+...+\alpha_p a_{t-p}^2+e_t$$ are zero, where $a_t$ is either observed series which we want to test for ARCH ef
31,956
Calculating and interpreting effect sizes for interaction terms
Looking into classic old texts (like Geoffrey Keppel's Design and Analysis: A Researcher's Handbook and Fredric Wolf's Meta-Analysis: Quantitative Methods for Research Synthesis), I've seen several options, including omega, phi, and the square of each. But most widely interpretable and simplest to obtain from most software packages' output is the incremental contribution that the interaction makes to r-squared. Partial eta squared (explained variance not shared with any other predictor in the model) is another option, and in fact for an interaction tested in a sequential model, it should be the same as the increment in r-squared. I realize I'm not answering your question about specifically using F and df; if that is that essential to you maybe others can address it. Wolf shows how to convert F to r for the 2-group case only, and I'm not the strongest when it comes to formulas.
Calculating and interpreting effect sizes for interaction terms
Looking into classic old texts (like Geoffrey Keppel's Design and Analysis: A Researcher's Handbook and Fredric Wolf's Meta-Analysis: Quantitative Methods for Research Synthesis), I've seen several o
Calculating and interpreting effect sizes for interaction terms Looking into classic old texts (like Geoffrey Keppel's Design and Analysis: A Researcher's Handbook and Fredric Wolf's Meta-Analysis: Quantitative Methods for Research Synthesis), I've seen several options, including omega, phi, and the square of each. But most widely interpretable and simplest to obtain from most software packages' output is the incremental contribution that the interaction makes to r-squared. Partial eta squared (explained variance not shared with any other predictor in the model) is another option, and in fact for an interaction tested in a sequential model, it should be the same as the increment in r-squared. I realize I'm not answering your question about specifically using F and df; if that is that essential to you maybe others can address it. Wolf shows how to convert F to r for the 2-group case only, and I'm not the strongest when it comes to formulas.
Calculating and interpreting effect sizes for interaction terms Looking into classic old texts (like Geoffrey Keppel's Design and Analysis: A Researcher's Handbook and Fredric Wolf's Meta-Analysis: Quantitative Methods for Research Synthesis), I've seen several o
31,957
Calculating and interpreting effect sizes for interaction terms
Yes, an effect size for an interaction can be computed, though I don't think I know any measures of effect size that you can compute simply from the F and df values; usually you need various sums-of-squares values to do the computations. If you have the raw data, the "ezANOVA" function in the "ez" package for R will give you generalized eta square, a measure of effect size that, unlike partial-eta square, generalizes across design types (eg. within-Ss designs vs between-Ss designs).
Calculating and interpreting effect sizes for interaction terms
Yes, an effect size for an interaction can be computed, though I don't think I know any measures of effect size that you can compute simply from the F and df values; usually you need various sums-of-s
Calculating and interpreting effect sizes for interaction terms Yes, an effect size for an interaction can be computed, though I don't think I know any measures of effect size that you can compute simply from the F and df values; usually you need various sums-of-squares values to do the computations. If you have the raw data, the "ezANOVA" function in the "ez" package for R will give you generalized eta square, a measure of effect size that, unlike partial-eta square, generalizes across design types (eg. within-Ss designs vs between-Ss designs).
Calculating and interpreting effect sizes for interaction terms Yes, an effect size for an interaction can be computed, though I don't think I know any measures of effect size that you can compute simply from the F and df values; usually you need various sums-of-s
31,958
Making square-root of covariance matrix positive-definite (Matlab)
Here is code I've used in the past (using the SVD approach). I know you said you've tried it already, but it has always worked for me so I thought I'd post it to see if it was helpful. function [sigma] = validateCovMatrix(sig) % [sigma] = validateCovMatrix(sig) % % -- INPUT -- % sig: sample covariance matrix % % -- OUTPUT -- % sigma: positive-definite covariance matrix % EPS = 10^-6; ZERO = 10^-10; sigma = sig; [r err] = cholcov(sigma, 0); if (err ~= 0) % the covariance matrix is not positive definite! [v d] = eig(sigma); % set any of the eigenvalues that are <= 0 to some small positive value for n = 1:size(d,1) if (d(n, n) <= ZERO) d(n, n) = EPS; end end % recompose the covariance matrix, now it should be positive definite. sigma = v*d*v'; [r err] = cholcov(sigma, 0); if (err ~= 0) disp('ERROR!'); end end
Making square-root of covariance matrix positive-definite (Matlab)
Here is code I've used in the past (using the SVD approach). I know you said you've tried it already, but it has always worked for me so I thought I'd post it to see if it was helpful. function [sigm
Making square-root of covariance matrix positive-definite (Matlab) Here is code I've used in the past (using the SVD approach). I know you said you've tried it already, but it has always worked for me so I thought I'd post it to see if it was helpful. function [sigma] = validateCovMatrix(sig) % [sigma] = validateCovMatrix(sig) % % -- INPUT -- % sig: sample covariance matrix % % -- OUTPUT -- % sigma: positive-definite covariance matrix % EPS = 10^-6; ZERO = 10^-10; sigma = sig; [r err] = cholcov(sigma, 0); if (err ~= 0) % the covariance matrix is not positive definite! [v d] = eig(sigma); % set any of the eigenvalues that are <= 0 to some small positive value for n = 1:size(d,1) if (d(n, n) <= ZERO) d(n, n) = EPS; end end % recompose the covariance matrix, now it should be positive definite. sigma = v*d*v'; [r err] = cholcov(sigma, 0); if (err ~= 0) disp('ERROR!'); end end
Making square-root of covariance matrix positive-definite (Matlab) Here is code I've used in the past (using the SVD approach). I know you said you've tried it already, but it has always worked for me so I thought I'd post it to see if it was helpful. function [sigm
31,959
Making square-root of covariance matrix positive-definite (Matlab)
in Matlab: help cholupdate I get CHOLUPDATE Rank 1 update to Cholesky factorization. If R = CHOL(A) is the original Cholesky factorization of A, then R1 = CHOLUPDATE(R,X) returns the upper triangular Cholesky factor of A + X*X', where X is a column vector of appropriate length. CHOLUPDATE uses only the diagonal and upper triangle of R. The lower triangle of R is ignored. R1 = CHOLUPDATE(R,X,'+') is the same as R1 = CHOLUPDATE(R,X). R1 = CHOLUPDATE(R,X,'-') returns the Cholesky factor of A - X*X'. An error message reports when R is not a valid Cholesky factor or when the downdated matrix is not positive definite and so does not have a Cholesky factorization. [R1,p] = CHOLUPDATE(R,X,'-') will not return an error message. If p is 0 then R1 is the Cholesky factor of A - X*X'. If p is greater than 0, then R1 is the Cholesky factor of the original A. If p is 1 then CHOLUPDATE failed because the downdated matrix is not positive definite. If p is 2, CHOLUPDATE failed because the upper triangle of R was not a valid Cholesky factor. CHOLUPDATE works only for full matrices. See also chol.
Making square-root of covariance matrix positive-definite (Matlab)
in Matlab: help cholupdate I get CHOLUPDATE Rank 1 update to Cholesky factorization. If R = CHOL(A) is the original Cholesky factorization of A, then R1 = CHOLUPDATE(R,X) returns the upper t
Making square-root of covariance matrix positive-definite (Matlab) in Matlab: help cholupdate I get CHOLUPDATE Rank 1 update to Cholesky factorization. If R = CHOL(A) is the original Cholesky factorization of A, then R1 = CHOLUPDATE(R,X) returns the upper triangular Cholesky factor of A + X*X', where X is a column vector of appropriate length. CHOLUPDATE uses only the diagonal and upper triangle of R. The lower triangle of R is ignored. R1 = CHOLUPDATE(R,X,'+') is the same as R1 = CHOLUPDATE(R,X). R1 = CHOLUPDATE(R,X,'-') returns the Cholesky factor of A - X*X'. An error message reports when R is not a valid Cholesky factor or when the downdated matrix is not positive definite and so does not have a Cholesky factorization. [R1,p] = CHOLUPDATE(R,X,'-') will not return an error message. If p is 0 then R1 is the Cholesky factor of A - X*X'. If p is greater than 0, then R1 is the Cholesky factor of the original A. If p is 1 then CHOLUPDATE failed because the downdated matrix is not positive definite. If p is 2, CHOLUPDATE failed because the upper triangle of R was not a valid Cholesky factor. CHOLUPDATE works only for full matrices. See also chol.
Making square-root of covariance matrix positive-definite (Matlab) in Matlab: help cholupdate I get CHOLUPDATE Rank 1 update to Cholesky factorization. If R = CHOL(A) is the original Cholesky factorization of A, then R1 = CHOLUPDATE(R,X) returns the upper t
31,960
Making square-root of covariance matrix positive-definite (Matlab)
One alternative way to compute the Cholesky factorisation is by fixing the diagonal elements of S to 1, and then introducing a diagonal matrix D, with positive elements. This avoids the need to take square roots when doing the computations, which can cause problems when dealing with "small" numbers (i.e. numbers small enough so that the rounding which occurs due to floating point operations matters). The wikipedia page has what this adjusted algorithm looks like. So instead of $P=SS^T$ you get $P=RDR^T$ with $S=RD^{\frac{1}{2}}$ Hope this helps!
Making square-root of covariance matrix positive-definite (Matlab)
One alternative way to compute the Cholesky factorisation is by fixing the diagonal elements of S to 1, and then introducing a diagonal matrix D, with positive elements. This avoids the need to take s
Making square-root of covariance matrix positive-definite (Matlab) One alternative way to compute the Cholesky factorisation is by fixing the diagonal elements of S to 1, and then introducing a diagonal matrix D, with positive elements. This avoids the need to take square roots when doing the computations, which can cause problems when dealing with "small" numbers (i.e. numbers small enough so that the rounding which occurs due to floating point operations matters). The wikipedia page has what this adjusted algorithm looks like. So instead of $P=SS^T$ you get $P=RDR^T$ with $S=RD^{\frac{1}{2}}$ Hope this helps!
Making square-root of covariance matrix positive-definite (Matlab) One alternative way to compute the Cholesky factorisation is by fixing the diagonal elements of S to 1, and then introducing a diagonal matrix D, with positive elements. This avoids the need to take s
31,961
Making square-root of covariance matrix positive-definite (Matlab)
Effectively the Cholesky factorization can fail when your matrix is not "really" positif definite. Two cases appears, or you have a negative eingen value, or your smallest eingen value is positive, but close to zero. The second case must theorically give a solution, but numerically difficult. If have just intuitive add a small constant to the diagonal of my matrix for solving the problem. But this way is not rigourous because it modify slightly the solution. If you must to compute a really hight accuracy solution, try some research on modified Cholesky factorization.
Making square-root of covariance matrix positive-definite (Matlab)
Effectively the Cholesky factorization can fail when your matrix is not "really" positif definite. Two cases appears, or you have a negative eingen value, or your smallest eingen value is positive, bu
Making square-root of covariance matrix positive-definite (Matlab) Effectively the Cholesky factorization can fail when your matrix is not "really" positif definite. Two cases appears, or you have a negative eingen value, or your smallest eingen value is positive, but close to zero. The second case must theorically give a solution, but numerically difficult. If have just intuitive add a small constant to the diagonal of my matrix for solving the problem. But this way is not rigourous because it modify slightly the solution. If you must to compute a really hight accuracy solution, try some research on modified Cholesky factorization.
Making square-root of covariance matrix positive-definite (Matlab) Effectively the Cholesky factorization can fail when your matrix is not "really" positif definite. Two cases appears, or you have a negative eingen value, or your smallest eingen value is positive, bu
31,962
Making square-root of covariance matrix positive-definite (Matlab)
If you try to estimate with P not positive definite you are asking for problems and chalenging algorithms, you should avoid this situation. If your problem is numeric : P is positive definite but the numerical eigenvalue are too small - try a new scalling for your states If you problem is indeed non positive definite - try different set of state variables. I hope the advis eis not too late Regards, Zeev
Making square-root of covariance matrix positive-definite (Matlab)
If you try to estimate with P not positive definite you are asking for problems and chalenging algorithms, you should avoid this situation. If your problem is numeric : P is positive definite but the
Making square-root of covariance matrix positive-definite (Matlab) If you try to estimate with P not positive definite you are asking for problems and chalenging algorithms, you should avoid this situation. If your problem is numeric : P is positive definite but the numerical eigenvalue are too small - try a new scalling for your states If you problem is indeed non positive definite - try different set of state variables. I hope the advis eis not too late Regards, Zeev
Making square-root of covariance matrix positive-definite (Matlab) If you try to estimate with P not positive definite you are asking for problems and chalenging algorithms, you should avoid this situation. If your problem is numeric : P is positive definite but the
31,963
Assessing significance of correlation
Yes, you can get a $p$-value for testing the null hypothesis that the Pearson correlation is zero. See http://en.wikipedia.org/wiki/Pearson%27s_correlation#Inference.
Assessing significance of correlation
Yes, you can get a $p$-value for testing the null hypothesis that the Pearson correlation is zero. See http://en.wikipedia.org/wiki/Pearson%27s_correlation#Inference.
Assessing significance of correlation Yes, you can get a $p$-value for testing the null hypothesis that the Pearson correlation is zero. See http://en.wikipedia.org/wiki/Pearson%27s_correlation#Inference.
Assessing significance of correlation Yes, you can get a $p$-value for testing the null hypothesis that the Pearson correlation is zero. See http://en.wikipedia.org/wiki/Pearson%27s_correlation#Inference.
31,964
Assessing significance of correlation
As an alternative, this beautiful paper (a bit technical/mathsy, so beware) allows you to test for any correlation (not just $\rho=0$) using a Non-informative Bayesian Decision Theoretic approach.
Assessing significance of correlation
As an alternative, this beautiful paper (a bit technical/mathsy, so beware) allows you to test for any correlation (not just $\rho=0$) using a Non-informative Bayesian Decision Theoretic approach.
Assessing significance of correlation As an alternative, this beautiful paper (a bit technical/mathsy, so beware) allows you to test for any correlation (not just $\rho=0$) using a Non-informative Bayesian Decision Theoretic approach.
Assessing significance of correlation As an alternative, this beautiful paper (a bit technical/mathsy, so beware) allows you to test for any correlation (not just $\rho=0$) using a Non-informative Bayesian Decision Theoretic approach.
31,965
R-square from rpart model
The advantage of R is that most of the time you can easily access the source code. So in your case, start with > rsq.rpart (without parenthesis) to see what the function actually does. The $R^2$ values are obtained as tmp <- printcp(fit) rsq.val <- 1-tmp[,c(3,4)] where for each row (aka, No. splits) we have the "apparent" and "relative" (wrt. cross-validation) statistics.
R-square from rpart model
The advantage of R is that most of the time you can easily access the source code. So in your case, start with > rsq.rpart (without parenthesis) to see what the function actually does. The $R^2$ valu
R-square from rpart model The advantage of R is that most of the time you can easily access the source code. So in your case, start with > rsq.rpart (without parenthesis) to see what the function actually does. The $R^2$ values are obtained as tmp <- printcp(fit) rsq.val <- 1-tmp[,c(3,4)] where for each row (aka, No. splits) we have the "apparent" and "relative" (wrt. cross-validation) statistics.
R-square from rpart model The advantage of R is that most of the time you can easily access the source code. So in your case, start with > rsq.rpart (without parenthesis) to see what the function actually does. The $R^2$ valu
31,966
Yates continuity correction for 2 x 2 contingency tables
Yates' correction results in tests that are more conservative as with Fisher's "exact" tests. Here is an online tutorial on the use of Yates’s continuity correction, by Stefanescu et al, which clearly points to various flaws of systematic correction for continuity (pp. 4-6). Quoting Agresti (CDA 2002), "Yates (1934) mentioned that Fisher suggested the hypergeometric to him for an exact test", which led to the continuity-corrected version of the $\chi^2$. Agresti also indicated that Fisher's test is a good alternative now that computers can do it even for large samples (p. 103). Now, the point is that choosing a test really depends on the question that is asked and the assumptions that are made by each of them (e.g., in the case of the Fisher's test we assume that margins are fixed). In your case, Fisher test and corrected $\chi^2$ agree and yield $p$-value above 5%. In the case of the ordinary $\chi^2$, if $p$-values are computed using a Monte Carlo approach (see simulate.p.value), then it fails to reach significance too. Other useful references dealing with small sample size issues and the overuse of Fisher's test, include: I. Campbell, Chi-squared and Fisher–Irwin tests of two-by-two tables with small sample recommendations, Statistics in Medicine 26(19): 3661–3675, 2007. Mark G. Haviland, Yates's correction for continuity and the analysis of 2 × 2 contingency tables, Statistics in Medicine 9(4): 363–367, 1990.
Yates continuity correction for 2 x 2 contingency tables
Yates' correction results in tests that are more conservative as with Fisher's "exact" tests. Here is an online tutorial on the use of Yates’s continuity correction, by Stefanescu et al, which clearl
Yates continuity correction for 2 x 2 contingency tables Yates' correction results in tests that are more conservative as with Fisher's "exact" tests. Here is an online tutorial on the use of Yates’s continuity correction, by Stefanescu et al, which clearly points to various flaws of systematic correction for continuity (pp. 4-6). Quoting Agresti (CDA 2002), "Yates (1934) mentioned that Fisher suggested the hypergeometric to him for an exact test", which led to the continuity-corrected version of the $\chi^2$. Agresti also indicated that Fisher's test is a good alternative now that computers can do it even for large samples (p. 103). Now, the point is that choosing a test really depends on the question that is asked and the assumptions that are made by each of them (e.g., in the case of the Fisher's test we assume that margins are fixed). In your case, Fisher test and corrected $\chi^2$ agree and yield $p$-value above 5%. In the case of the ordinary $\chi^2$, if $p$-values are computed using a Monte Carlo approach (see simulate.p.value), then it fails to reach significance too. Other useful references dealing with small sample size issues and the overuse of Fisher's test, include: I. Campbell, Chi-squared and Fisher–Irwin tests of two-by-two tables with small sample recommendations, Statistics in Medicine 26(19): 3661–3675, 2007. Mark G. Haviland, Yates's correction for continuity and the analysis of 2 × 2 contingency tables, Statistics in Medicine 9(4): 363–367, 1990.
Yates continuity correction for 2 x 2 contingency tables Yates' correction results in tests that are more conservative as with Fisher's "exact" tests. Here is an online tutorial on the use of Yates’s continuity correction, by Stefanescu et al, which clearl
31,967
Yates continuity correction for 2 x 2 contingency tables
If you have counts low enough that the Yates Correction is a worry (as in your example), you probably should be using Fisher's exact test. Otherwise, I recommend that after you use the chi-square test on a 2x2 table, you confirm your test with a log odds-ratio z-test.
Yates continuity correction for 2 x 2 contingency tables
If you have counts low enough that the Yates Correction is a worry (as in your example), you probably should be using Fisher's exact test. Otherwise, I recommend that after you use the chi-square tes
Yates continuity correction for 2 x 2 contingency tables If you have counts low enough that the Yates Correction is a worry (as in your example), you probably should be using Fisher's exact test. Otherwise, I recommend that after you use the chi-square test on a 2x2 table, you confirm your test with a log odds-ratio z-test.
Yates continuity correction for 2 x 2 contingency tables If you have counts low enough that the Yates Correction is a worry (as in your example), you probably should be using Fisher's exact test. Otherwise, I recommend that after you use the chi-square tes
31,968
Multi-way nonparametric anova
The vegan package implements permutation testing for distance based ANOVA, which should work with multi-way, repeated measures data.
Multi-way nonparametric anova
The vegan package implements permutation testing for distance based ANOVA, which should work with multi-way, repeated measures data.
Multi-way nonparametric anova The vegan package implements permutation testing for distance based ANOVA, which should work with multi-way, repeated measures data.
Multi-way nonparametric anova The vegan package implements permutation testing for distance based ANOVA, which should work with multi-way, repeated measures data.
31,969
Multi-way nonparametric anova
Tukey's Median Polish is implemented in R as medpolish {stats}. See Chapter 6 in Venables and Ripley
Multi-way nonparametric anova
Tukey's Median Polish is implemented in R as medpolish {stats}. See Chapter 6 in Venables and Ripley
Multi-way nonparametric anova Tukey's Median Polish is implemented in R as medpolish {stats}. See Chapter 6 in Venables and Ripley
Multi-way nonparametric anova Tukey's Median Polish is implemented in R as medpolish {stats}. See Chapter 6 in Venables and Ripley
31,970
Multi-way nonparametric anova
You might check out the ezBoot() function in the ez package for bootstrapping confidence intervals on your effects of interest.
Multi-way nonparametric anova
You might check out the ezBoot() function in the ez package for bootstrapping confidence intervals on your effects of interest.
Multi-way nonparametric anova You might check out the ezBoot() function in the ez package for bootstrapping confidence intervals on your effects of interest.
Multi-way nonparametric anova You might check out the ezBoot() function in the ez package for bootstrapping confidence intervals on your effects of interest.
31,971
Multi-way nonparametric anova
Pierre Legendre has some Code on his homepage: nest.anova.perm.R (D. Borcard and P. Legendre): Nested anova with permutation tests (main factor and one nested factor, balanced design).
Multi-way nonparametric anova
Pierre Legendre has some Code on his homepage: nest.anova.perm.R (D. Borcard and P. Legendre): Nested anova with permutation tests (main factor and one nested factor, balanced design).
Multi-way nonparametric anova Pierre Legendre has some Code on his homepage: nest.anova.perm.R (D. Borcard and P. Legendre): Nested anova with permutation tests (main factor and one nested factor, balanced design).
Multi-way nonparametric anova Pierre Legendre has some Code on his homepage: nest.anova.perm.R (D. Borcard and P. Legendre): Nested anova with permutation tests (main factor and one nested factor, balanced design).
31,972
Product of beta distributions
According to the abstract of this paper, The density function of products of random beta variables is a Meijer $G$-function which is expressible in closed form when the parameters are integers. However, I imagine the closed form requires a great deal of combinatorial calculation and hence would not be practically useful. The slow numerical algorithm you mentioned is probably faster. This paper may be more useful since it does not require integer parameters. The distribution of product of independent beta random variables with application to multivariate analysis I haven't read the paper, but the abstract sounds promising.
Product of beta distributions
According to the abstract of this paper, The density function of products of random beta variables is a Meijer $G$-function which is expressible in closed form when the parameters are integers. Howe
Product of beta distributions According to the abstract of this paper, The density function of products of random beta variables is a Meijer $G$-function which is expressible in closed form when the parameters are integers. However, I imagine the closed form requires a great deal of combinatorial calculation and hence would not be practically useful. The slow numerical algorithm you mentioned is probably faster. This paper may be more useful since it does not require integer parameters. The distribution of product of independent beta random variables with application to multivariate analysis I haven't read the paper, but the abstract sounds promising.
Product of beta distributions According to the abstract of this paper, The density function of products of random beta variables is a Meijer $G$-function which is expressible in closed form when the parameters are integers. Howe
31,973
Estimating latent performance potential based on a sequence of observations
You need to perform an isotonic (i.e. monotonic non decreasing) nonparametric regression (see page 6 of this document for an example), then use $\hat{E}(y|x)+ \delta \hat{\sigma}(y|x)$ with $\delta>0$ as the upper potential. There are many packages that will do that in R. I like this one for its simplicity. Isotonic nonparametric is simply your regular scatterplot smoother with the added prior that more $x$ cannot decrease smoothed $y$ (i.e. drug dose vs effects). From the first comment below your design includes a $k$-vector dummy variable $z$ (controling for injury,running style) and a continous variable $x$ (days), assuming that $y$ (latent performance) is given by: $E(y|x,z)=m(x)+\alpha z+\delta$ where $m(x)$ is a monotone scatterplot smoother, $\delta>0$ is known and $\alpha\in \mathbb{R}^k$. This types of model can be estimated by isotonic GAM (see this paper implemented here). Edit: i changed the link to the paper, (the old link was pointing to a derivative of the method by the same author).
Estimating latent performance potential based on a sequence of observations
You need to perform an isotonic (i.e. monotonic non decreasing) nonparametric regression (see page 6 of this document for an example), then use $\hat{E}(y|x)+ \delta \hat{\sigma}(y|x)$ with $\delta>0$
Estimating latent performance potential based on a sequence of observations You need to perform an isotonic (i.e. monotonic non decreasing) nonparametric regression (see page 6 of this document for an example), then use $\hat{E}(y|x)+ \delta \hat{\sigma}(y|x)$ with $\delta>0$ as the upper potential. There are many packages that will do that in R. I like this one for its simplicity. Isotonic nonparametric is simply your regular scatterplot smoother with the added prior that more $x$ cannot decrease smoothed $y$ (i.e. drug dose vs effects). From the first comment below your design includes a $k$-vector dummy variable $z$ (controling for injury,running style) and a continous variable $x$ (days), assuming that $y$ (latent performance) is given by: $E(y|x,z)=m(x)+\alpha z+\delta$ where $m(x)$ is a monotone scatterplot smoother, $\delta>0$ is known and $\alpha\in \mathbb{R}^k$. This types of model can be estimated by isotonic GAM (see this paper implemented here). Edit: i changed the link to the paper, (the old link was pointing to a derivative of the method by the same author).
Estimating latent performance potential based on a sequence of observations You need to perform an isotonic (i.e. monotonic non decreasing) nonparametric regression (see page 6 of this document for an example), then use $\hat{E}(y|x)+ \delta \hat{\sigma}(y|x)$ with $\delta>0$
31,974
Estimating latent performance potential based on a sequence of observations
Just a guess. First I would explore transformations of the data, such as converting time to speed or acceleration. Then I would consider the log of that, since it obviously won't be negative. Then, since you are interested in the asymptote, I would try fitting (by least squares) a simple exponential to the transformed data, with time t being the x axis, and log-transformed speed (or acceleration) being the y axis. See how that works in predicting new measurements as time increases. A possible alternative to an an exponential function would be a Michaelis-Menten type of hyperbola. Actually, I would strongly consider a mixed-effect population approach first (as with NONMEM), because each individual may not show enough information to evaluate different models. If you want to go Bayesian, you could use WinBugs, and provide any prior distribution you want to the parameters of the exponential function. The book I found useful is Gilks, Richardson, Spiegelhalter, "Markov Chain Monte Carlo in Practice", Chapman & Hall, 1996.
Estimating latent performance potential based on a sequence of observations
Just a guess. First I would explore transformations of the data, such as converting time to speed or acceleration. Then I would consider the log of that, since it obviously won't be negative. Then, si
Estimating latent performance potential based on a sequence of observations Just a guess. First I would explore transformations of the data, such as converting time to speed or acceleration. Then I would consider the log of that, since it obviously won't be negative. Then, since you are interested in the asymptote, I would try fitting (by least squares) a simple exponential to the transformed data, with time t being the x axis, and log-transformed speed (or acceleration) being the y axis. See how that works in predicting new measurements as time increases. A possible alternative to an an exponential function would be a Michaelis-Menten type of hyperbola. Actually, I would strongly consider a mixed-effect population approach first (as with NONMEM), because each individual may not show enough information to evaluate different models. If you want to go Bayesian, you could use WinBugs, and provide any prior distribution you want to the parameters of the exponential function. The book I found useful is Gilks, Richardson, Spiegelhalter, "Markov Chain Monte Carlo in Practice", Chapman & Hall, 1996.
Estimating latent performance potential based on a sequence of observations Just a guess. First I would explore transformations of the data, such as converting time to speed or acceleration. Then I would consider the log of that, since it obviously won't be negative. Then, si
31,975
Estimating latent performance potential based on a sequence of observations
One could view the recorded times as biased estimates of the runner's latent ability. Many factors would cause the time to be worse than the latent best time, such as a bad start, headwind, a stumble, mis-judgement of pace, etc, while very few would cause the recorded times to be better than the latent best, such as a strong tailwind or running downhill. I am not terribly familiar with regression with biased errors, but apparently one can use the gamma family when performing GLM regression; one would use time as the dependent variable and observed times as the dependent variable.
Estimating latent performance potential based on a sequence of observations
One could view the recorded times as biased estimates of the runner's latent ability. Many factors would cause the time to be worse than the latent best time, such as a bad start, headwind, a stumble,
Estimating latent performance potential based on a sequence of observations One could view the recorded times as biased estimates of the runner's latent ability. Many factors would cause the time to be worse than the latent best time, such as a bad start, headwind, a stumble, mis-judgement of pace, etc, while very few would cause the recorded times to be better than the latent best, such as a strong tailwind or running downhill. I am not terribly familiar with regression with biased errors, but apparently one can use the gamma family when performing GLM regression; one would use time as the dependent variable and observed times as the dependent variable.
Estimating latent performance potential based on a sequence of observations One could view the recorded times as biased estimates of the runner's latent ability. Many factors would cause the time to be worse than the latent best time, such as a bad start, headwind, a stumble,
31,976
What are pivot tables, and how can they be helpful in analyzing data?
A pivot-table is a tool to dynamically show a slice and group multivariate data in tabular form. For example, when we have the following data structure Region Year Product Sales US 2008 Phones 125 EU 2008 Phones 352 US 2008 Mouses 52 EU 2008 Mouses 65 US 2009 Phones 140 EU 2009 Phones 320 US 2009 Mouses 60 EU 2009 Mouses 100 A pivot table can for example display a table with the sum of all products with in the rows the years and in the columns the regions. All dimensions of the table can be switched easily. Also the data fields shown can be changed. This is called pivoting. The tool is useful in exploratory data analyses. Because it is a dynamic tool, it can be used to visually detect patterns and outliers etc. Most spreadsheet applications have support for this kind of tables. An image from wikipedia:
What are pivot tables, and how can they be helpful in analyzing data?
A pivot-table is a tool to dynamically show a slice and group multivariate data in tabular form. For example, when we have the following data structure Region Year Product Sales US 2008 Phon
What are pivot tables, and how can they be helpful in analyzing data? A pivot-table is a tool to dynamically show a slice and group multivariate data in tabular form. For example, when we have the following data structure Region Year Product Sales US 2008 Phones 125 EU 2008 Phones 352 US 2008 Mouses 52 EU 2008 Mouses 65 US 2009 Phones 140 EU 2009 Phones 320 US 2009 Mouses 60 EU 2009 Mouses 100 A pivot table can for example display a table with the sum of all products with in the rows the years and in the columns the regions. All dimensions of the table can be switched easily. Also the data fields shown can be changed. This is called pivoting. The tool is useful in exploratory data analyses. Because it is a dynamic tool, it can be used to visually detect patterns and outliers etc. Most spreadsheet applications have support for this kind of tables. An image from wikipedia:
What are pivot tables, and how can they be helpful in analyzing data? A pivot-table is a tool to dynamically show a slice and group multivariate data in tabular form. For example, when we have the following data structure Region Year Product Sales US 2008 Phon
31,977
What are "poor finite sample properties"?
In the context of hypothesis tests, poor finite sample properties usually mean that the actual rejection rate of the test differs from the nominal one. Recall that the nominal one is the level at which you are testing, often 5%. That means that you expect to reject 5% of all correct null hypotheses. If the actual rejection frequency differs from the nominal one, we have what is known as a size distortion. Often, this distortion arises because we compute critical values for our test based on asymptotic considerations (often, the central limit theorem), i.e., an asymptotic distribution of the test statistic under the null (typically because, except in special cases, the finite sample distribution of the test statistic is not known or not tractable). That is, the distribution that the test statistic would follow if the null is true and if we have infinitely many observations. Clearly, in practice, we don't, so the statistic will follow its (unknown) finite sample distribution. [So the answer to your question is basically yes, many dummies will lead to a low effective sample size (a.k.a. eat up degrees of freedom) - there no such thing as a unique threshold for "small" sample sizes. E.g., in problems with many parameters, such as long regressions, more data is needed for good inference than in simpler problems.] Hence, its quantiles will differ from the quantiles of the asymptotic distribution, where the latter are used to get critical values. Thus, the test statistic will not exceed the critical value (i.e., reject) as often as expected from the nominal level. Here is a simple example (a little Monte Carlo study that simulates the actual rejection rate of a test): mean(replicate(10000, abs(t.test(rchisq(10, df=1)-1)$statistic) > qnorm(.975))) What does the code do? It simulates 10 r.v.s from a (very skewed and) demeaned $\chi^2_1$-distribution (recall that the mean of a $\chi^2_k$ distribution is $k$, so that subtracting 1 here produces a mean zero distribution) finds the usual t-statistic for the (correct) null that the expected value of the distribution from which we sample is zero (that is what t.test does without specifying further options) checks if the (absolute value of the) test statistic is larger than the 5%-critical value of a two-sided t-test (qnorm(.975)) (hence, if we reject at nominal level 5%) based on the normal distribution that the t-statistic follows asymptotically (see e.g. Is there a version of the central limit theorem which lets me replace Var(X) with the sample variance?), it does that 10,000 times, producing 1s for rejections and 0s for acceptances and takes an average to produce a finite-sample rejection rate. Depending on the seed, this code will return values of around 0.17, where, if the test had good finite-sample properties, we would see 0.05. In other words, instead of rejecting every 20th correct null hypothesis, as one might think it does based on the nominal level, it rejects every 6th, thus leading us to reject the null (quite far) too often. [In practice, information such as the one used here that we sample from a certain distribution is not available, so that we will not easily be able to work with more accurate critical values. If I had run the code with, say, draws from a symmetric mean-zero such as a t-distribution with small degrees of freedom, we would have still seen some size distortion, but much less.] [Is a size distortion that leads to rejecting too infrequently bad, too - after all, it leads to a smaller type I-error rate? I'd say yes, because rejection rates do not change discontinuously at the margin of null and alternative - hence, if you reject too infrequently if the null is true, you'll also reject less frequently when it is false, i.e., you'll have low power.] If you replace 10 in the code with, say, 1000, you will get values much closer to the nominal level 0.05, illustrating that the problem is a finite-sample one. Trying this for different $n$ would produce something like this: n <- c(10,20,50,100,200,500,1000,10000) mcn <- lapply(n, function(i) mean(replicate(10000, abs(t.test(rchisq(i, df=1)-1)$statistic) > qnorm(.975)))) plot(n, unlist(mcn), type="o", col="salmon", lwd=2, ylim=c(0,0.2), ylab="rejection rate") abline(h=0.05, lty=2)
What are "poor finite sample properties"?
In the context of hypothesis tests, poor finite sample properties usually mean that the actual rejection rate of the test differs from the nominal one. Recall that the nominal one is the level at whic
What are "poor finite sample properties"? In the context of hypothesis tests, poor finite sample properties usually mean that the actual rejection rate of the test differs from the nominal one. Recall that the nominal one is the level at which you are testing, often 5%. That means that you expect to reject 5% of all correct null hypotheses. If the actual rejection frequency differs from the nominal one, we have what is known as a size distortion. Often, this distortion arises because we compute critical values for our test based on asymptotic considerations (often, the central limit theorem), i.e., an asymptotic distribution of the test statistic under the null (typically because, except in special cases, the finite sample distribution of the test statistic is not known or not tractable). That is, the distribution that the test statistic would follow if the null is true and if we have infinitely many observations. Clearly, in practice, we don't, so the statistic will follow its (unknown) finite sample distribution. [So the answer to your question is basically yes, many dummies will lead to a low effective sample size (a.k.a. eat up degrees of freedom) - there no such thing as a unique threshold for "small" sample sizes. E.g., in problems with many parameters, such as long regressions, more data is needed for good inference than in simpler problems.] Hence, its quantiles will differ from the quantiles of the asymptotic distribution, where the latter are used to get critical values. Thus, the test statistic will not exceed the critical value (i.e., reject) as often as expected from the nominal level. Here is a simple example (a little Monte Carlo study that simulates the actual rejection rate of a test): mean(replicate(10000, abs(t.test(rchisq(10, df=1)-1)$statistic) > qnorm(.975))) What does the code do? It simulates 10 r.v.s from a (very skewed and) demeaned $\chi^2_1$-distribution (recall that the mean of a $\chi^2_k$ distribution is $k$, so that subtracting 1 here produces a mean zero distribution) finds the usual t-statistic for the (correct) null that the expected value of the distribution from which we sample is zero (that is what t.test does without specifying further options) checks if the (absolute value of the) test statistic is larger than the 5%-critical value of a two-sided t-test (qnorm(.975)) (hence, if we reject at nominal level 5%) based on the normal distribution that the t-statistic follows asymptotically (see e.g. Is there a version of the central limit theorem which lets me replace Var(X) with the sample variance?), it does that 10,000 times, producing 1s for rejections and 0s for acceptances and takes an average to produce a finite-sample rejection rate. Depending on the seed, this code will return values of around 0.17, where, if the test had good finite-sample properties, we would see 0.05. In other words, instead of rejecting every 20th correct null hypothesis, as one might think it does based on the nominal level, it rejects every 6th, thus leading us to reject the null (quite far) too often. [In practice, information such as the one used here that we sample from a certain distribution is not available, so that we will not easily be able to work with more accurate critical values. If I had run the code with, say, draws from a symmetric mean-zero such as a t-distribution with small degrees of freedom, we would have still seen some size distortion, but much less.] [Is a size distortion that leads to rejecting too infrequently bad, too - after all, it leads to a smaller type I-error rate? I'd say yes, because rejection rates do not change discontinuously at the margin of null and alternative - hence, if you reject too infrequently if the null is true, you'll also reject less frequently when it is false, i.e., you'll have low power.] If you replace 10 in the code with, say, 1000, you will get values much closer to the nominal level 0.05, illustrating that the problem is a finite-sample one. Trying this for different $n$ would produce something like this: n <- c(10,20,50,100,200,500,1000,10000) mcn <- lapply(n, function(i) mean(replicate(10000, abs(t.test(rchisq(i, df=1)-1)$statistic) > qnorm(.975)))) plot(n, unlist(mcn), type="o", col="salmon", lwd=2, ylim=c(0,0.2), ylab="rejection rate") abline(h=0.05, lty=2)
What are "poor finite sample properties"? In the context of hypothesis tests, poor finite sample properties usually mean that the actual rejection rate of the test differs from the nominal one. Recall that the nominal one is the level at whic
31,978
Does a sufficient statistic imply the existence of a conjugate prior?
If there exists a finite dimensional conjugate family, $$\mathfrak F=\{\pi(\cdot|\alpha)\,;\ \alpha\in A\}$$ with $\dim(A)=d$, this means that, for any $\alpha\in A$, there exists a mapping $\tilde\alpha_n\,:\mathfrak X^n \mapsto A$ such that $$\pi(\theta|x_{1:n},\alpha)\propto f_n(x_{1:n}|\theta)\pi(\theta|\alpha) \propto \pi(\theta|\tilde\alpha_n(x_{1:n}))$$ Hence, for an arbitrary $\alpha$, $$f_n(x_{1:n}|\theta) = \pi(\theta|\tilde\alpha_n(x_{1:n})) m_\alpha(x) \pi(\theta|\alpha)^{-1}$$ factorises into a function of $\theta$ and $\tilde\alpha_n(x_{1:n})$ and a function of $x$ that does not depend on $\theta$. This implies that $\tilde\alpha_n(x_{1:n})$ is a sufficient statistic when $\Theta$ is restricted to the support of $\pi(\cdot|\alpha)$. Furthermore, assuming $\alpha$ and $\alpha^\prime$ are such that the supports of $\pi(\cdot|\alpha)$ and of $\pi(\cdot|\alpha^\prime)$ intersect, each posterior is a function of both its summary statistic (e.g., attached with $\alpha$) and of the other (e.g., attached with $\alpha^\prime$), which means they must be functions of one another (i.e., in bijection), I believe, leading to a potential conclusion that is independent from the support. Considering the converse implication, and assuming iid data, if there exists a sufficient statistic of fixed dimension for all (large enough) $n$'s, $t_n\,:\mathfrak X^n \mapsto \mathbb R^d$, then by the factorisation theorem, $$f(x_{1:n}|\theta) = \tilde {f_n}(t_n(x_{1:n})|\theta)\times m_n(x_{1:n})$$ which implies that, for any prior $\pi(\cdot)$, the posterior satisfies $$\pi(\theta|x_{1:n})\propto \tilde {f_n}(t_n(x_{1:n})|\theta)\times \pi(\theta)$$ For a given distribution density $\pi_0(\cdot)$ over $\Theta$, the family of priors $$\mathfrak F=\{ \tilde \pi(\theta)\propto \tilde {f_n}(t_n(x_{1:n})|\theta) \pi_0(\theta)\,;\ n\in \mathbb N, x_{1:n}\in\mathfrak X^n\}$$ where the $x_{1:n}$'s are pseudo-observations of size $n$ indexing the prior distributions, is conjugate since, if the prior writes $$\tilde \pi(\theta)\propto \tilde {f_n}(t_n(x_{1:n})|\theta) \pi_0(\theta)$$ the posterior associated with the observations $y_{1:m}$ writes $$\tilde \pi(\theta|y_{1:m})\propto \tilde {f_m}(t_m(y_{1:m})|\theta)\tilde {f_n}(t_n(x_{1:n})|\theta)\pi_0(\theta)\propto \tilde {f}_{n+m}(t_{n+m}(z_{1:(n+m)})|\theta)\pi_0(\theta) $$ where $z_{1:(n+m)}=(x_{1:n},y_{1:m})$.
Does a sufficient statistic imply the existence of a conjugate prior?
If there exists a finite dimensional conjugate family, $$\mathfrak F=\{\pi(\cdot|\alpha)\,;\ \alpha\in A\}$$ with $\dim(A)=d$, this means that, for any $\alpha\in A$, there exists a mapping $\tilde\al
Does a sufficient statistic imply the existence of a conjugate prior? If there exists a finite dimensional conjugate family, $$\mathfrak F=\{\pi(\cdot|\alpha)\,;\ \alpha\in A\}$$ with $\dim(A)=d$, this means that, for any $\alpha\in A$, there exists a mapping $\tilde\alpha_n\,:\mathfrak X^n \mapsto A$ such that $$\pi(\theta|x_{1:n},\alpha)\propto f_n(x_{1:n}|\theta)\pi(\theta|\alpha) \propto \pi(\theta|\tilde\alpha_n(x_{1:n}))$$ Hence, for an arbitrary $\alpha$, $$f_n(x_{1:n}|\theta) = \pi(\theta|\tilde\alpha_n(x_{1:n})) m_\alpha(x) \pi(\theta|\alpha)^{-1}$$ factorises into a function of $\theta$ and $\tilde\alpha_n(x_{1:n})$ and a function of $x$ that does not depend on $\theta$. This implies that $\tilde\alpha_n(x_{1:n})$ is a sufficient statistic when $\Theta$ is restricted to the support of $\pi(\cdot|\alpha)$. Furthermore, assuming $\alpha$ and $\alpha^\prime$ are such that the supports of $\pi(\cdot|\alpha)$ and of $\pi(\cdot|\alpha^\prime)$ intersect, each posterior is a function of both its summary statistic (e.g., attached with $\alpha$) and of the other (e.g., attached with $\alpha^\prime$), which means they must be functions of one another (i.e., in bijection), I believe, leading to a potential conclusion that is independent from the support. Considering the converse implication, and assuming iid data, if there exists a sufficient statistic of fixed dimension for all (large enough) $n$'s, $t_n\,:\mathfrak X^n \mapsto \mathbb R^d$, then by the factorisation theorem, $$f(x_{1:n}|\theta) = \tilde {f_n}(t_n(x_{1:n})|\theta)\times m_n(x_{1:n})$$ which implies that, for any prior $\pi(\cdot)$, the posterior satisfies $$\pi(\theta|x_{1:n})\propto \tilde {f_n}(t_n(x_{1:n})|\theta)\times \pi(\theta)$$ For a given distribution density $\pi_0(\cdot)$ over $\Theta$, the family of priors $$\mathfrak F=\{ \tilde \pi(\theta)\propto \tilde {f_n}(t_n(x_{1:n})|\theta) \pi_0(\theta)\,;\ n\in \mathbb N, x_{1:n}\in\mathfrak X^n\}$$ where the $x_{1:n}$'s are pseudo-observations of size $n$ indexing the prior distributions, is conjugate since, if the prior writes $$\tilde \pi(\theta)\propto \tilde {f_n}(t_n(x_{1:n})|\theta) \pi_0(\theta)$$ the posterior associated with the observations $y_{1:m}$ writes $$\tilde \pi(\theta|y_{1:m})\propto \tilde {f_m}(t_m(y_{1:m})|\theta)\tilde {f_n}(t_n(x_{1:n})|\theta)\pi_0(\theta)\propto \tilde {f}_{n+m}(t_{n+m}(z_{1:(n+m)})|\theta)\pi_0(\theta) $$ where $z_{1:(n+m)}=(x_{1:n},y_{1:m})$.
Does a sufficient statistic imply the existence of a conjugate prior? If there exists a finite dimensional conjugate family, $$\mathfrak F=\{\pi(\cdot|\alpha)\,;\ \alpha\in A\}$$ with $\dim(A)=d$, this means that, for any $\alpha\in A$, there exists a mapping $\tilde\al
31,979
How should two cross-validated logistic regression models be compared?
As these are nested logistic regression models there is no doubt that Frank Harrell's comment shows how to proceed: do the standard likelihood ratio test on the 2 models,* based on all of the data, to determine whether adding the third predictor improves performance. That has a well established theoretical basis, is more sensitive for detecting model differences than AUC, and it doesn't inherently require cross validation. Cross validation or bootstrapping to evaluate model optimism and calibration would certainly help bolster your case that your modeling approach is correct, but the emphasis shouldn't be on AUC. There's no harm in showing how much the AUC changes, but that should be a secondary consideration. The validate function in Harrell's rms package provides several measures of model quality based on bootstrapping or cross validation, including a Dxy rank-correlation value (both original and optimism-corrected) that can be transformed into an AUC value. *I'm a bit worried that you seem to be including so few predictors in your model. Logistic regression can have an omitted-variable bias if a predictor associated with outcome is left out of the model. Unlike linear regression, the omitted predictor doesn't even need to be correlated with the included predictors to get biased estimates. That's not to say you should be overfitting, but there are usually so many clinical variables associated with some condition or outcome that only including 2 or 3 would tend to be risky.
How should two cross-validated logistic regression models be compared?
As these are nested logistic regression models there is no doubt that Frank Harrell's comment shows how to proceed: do the standard likelihood ratio test on the 2 models,* based on all of the data, to
How should two cross-validated logistic regression models be compared? As these are nested logistic regression models there is no doubt that Frank Harrell's comment shows how to proceed: do the standard likelihood ratio test on the 2 models,* based on all of the data, to determine whether adding the third predictor improves performance. That has a well established theoretical basis, is more sensitive for detecting model differences than AUC, and it doesn't inherently require cross validation. Cross validation or bootstrapping to evaluate model optimism and calibration would certainly help bolster your case that your modeling approach is correct, but the emphasis shouldn't be on AUC. There's no harm in showing how much the AUC changes, but that should be a secondary consideration. The validate function in Harrell's rms package provides several measures of model quality based on bootstrapping or cross validation, including a Dxy rank-correlation value (both original and optimism-corrected) that can be transformed into an AUC value. *I'm a bit worried that you seem to be including so few predictors in your model. Logistic regression can have an omitted-variable bias if a predictor associated with outcome is left out of the model. Unlike linear regression, the omitted predictor doesn't even need to be correlated with the included predictors to get biased estimates. That's not to say you should be overfitting, but there are usually so many clinical variables associated with some condition or outcome that only including 2 or 3 would tend to be risky.
How should two cross-validated logistic regression models be compared? As these are nested logistic regression models there is no doubt that Frank Harrell's comment shows how to proceed: do the standard likelihood ratio test on the 2 models,* based on all of the data, to
31,980
How should two cross-validated logistic regression models be compared?
Instead of averaging AUCs per fold you can calculate two ROC curve per iteration for Model_A and Model_B (since every instance is exactly predicted once in k-fold CV). To calculate whether the addition of a biomarker results in a model with significantly different AUC you can use DeLong's test. Here, I wouldn't use the median of the p-values - a simple count will do (e.g: around 5 significant p-values out of 100 times 10-fold CV can be explained by chance and indicate no improvement in model performance). Different approaches to "combine" your p-values are mentioned in "Statistical Methods for Meta-Analysis" by Larry V. Hedges and Ingram Olkin. If you are using Python and want to use DeLong's test, this blog post might be helpful (altough still in draft): https://biasedml.com/roc-comparison/
How should two cross-validated logistic regression models be compared?
Instead of averaging AUCs per fold you can calculate two ROC curve per iteration for Model_A and Model_B (since every instance is exactly predicted once in k-fold CV). To calculate whether the additio
How should two cross-validated logistic regression models be compared? Instead of averaging AUCs per fold you can calculate two ROC curve per iteration for Model_A and Model_B (since every instance is exactly predicted once in k-fold CV). To calculate whether the addition of a biomarker results in a model with significantly different AUC you can use DeLong's test. Here, I wouldn't use the median of the p-values - a simple count will do (e.g: around 5 significant p-values out of 100 times 10-fold CV can be explained by chance and indicate no improvement in model performance). Different approaches to "combine" your p-values are mentioned in "Statistical Methods for Meta-Analysis" by Larry V. Hedges and Ingram Olkin. If you are using Python and want to use DeLong's test, this blog post might be helpful (altough still in draft): https://biasedml.com/roc-comparison/
How should two cross-validated logistic regression models be compared? Instead of averaging AUCs per fold you can calculate two ROC curve per iteration for Model_A and Model_B (since every instance is exactly predicted once in k-fold CV). To calculate whether the additio
31,981
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance?
I like to think of it in a similar way but with slightly different differential equations. (edit: below I managed to make it also intuitive for $\phi'(x) = -x \phi(x)$) Case: heat equation $$\frac{d}{dt} \left[ \frac{1}{\sqrt{t}} \phi(x/\sqrt{t}) \right]= 0.5 \frac{d^2}{dx^2} \left[ \frac{1}{\sqrt{t}} \phi(x/\sqrt{t}) \right]$$ This is how I actually like to see the normal distribution and the central limit theorem. The sum of variables which is in the limit like a diffusion process (which follows a differential equation) For a random walk where the steps are some variable $X_i$ with unit variance and zero mean then you get that the distribution function is approaching a scaled normal distribution $$P \left( \sum_{i=1}^t X_i = x\right) \approx \frac{1}{\sqrt{t}} \phi \left(x/\sqrt{t}\right) = f(x,t)$$ The change of this function can be seen as a bit simultaneously as the differential function for Brownian motion and is like a wave spreading out in time following the equation: $$\frac{\partial}{\partial t} f(x,t) = \frac{\partial^2}{\partial x^2} f(x,t)$$ See also https://en.m.wikipedia.org/wiki/Normal_distribution#Exact_normality Case: $\mathbf{\phi(x) +x\phi'(x)+ \phi''(x) =0}$ Now when we divide by $t$ $${P\left(\frac{\sum_{i=1}^t X_i }{t}= x\right) }\approx \phi\left({x}\right) = g(x,t)$$ and we could describe it as some scaled random walk like: if $Z_t = Z_{t-1} + X_t$ then for $Y_t = Z_t/\sqrt{t}$ $$Y_t -Y_{t-1} = - Y_{t-1} \frac{\sqrt{t-1}-\sqrt{t}}{\sqrt{t}} + X_t \frac{1}{\sqrt{t}}$$ which you could see as shrinking the current value by a factor and adding a variable $X_t$ scaled with some factor determined by $t$. Then in the limit the change of $\frac{\partial}{\partial t} g(x,t)$ should balance these two processes $$ \frac{\partial g(x,t)}{\partial t} = \underbrace{ a g(x,t) }_{\substack{ \text{shrinking}\\ \text{moves values up} }} +\underbrace{ \overbrace{x}^{ \substack{ \llap{\text{further }} \rlap{\text{away the}} \\ \llap{\text{shrinking }} \rlap{\text{is stronger}}\\ \, }} \frac{\partial g(x,t)}{\partial x}}_{ \substack{ \text{shrinking} \\ \text{shifts/squeezes the function} }} + \underbrace{ c \frac{\partial^2 g(x,t) }{\partial x^2 }}_{\text{diffusion}}=0$$ And the normal function is the function that such that the derivative of time (which is now expressed in terms of derivatives of space only) is zero. So in this way we can relate intuitively $\phi(x) +x\phi'(x)+ \phi''(x) =0$ to a diffusion process with shrinking where the function remains unchanged. Case: $\mathbf{x \phi(x) + \phi'(x) =0}$ This case is relatively similar to the one above. The shrinking of the formula can be related to a flux that is pulling the density to the inside. The flux is the product of the amount of mass (which is moving) and the speed of the mass (which relates to the distance) $$ \text{flux}_\text{shrinking} = -x \phi(x)$$ The diffusion can be related to a flux that is related to the slope of the function. If at some point there is more density to one direction than the other then the convolution/diffusion will cause some density to flow donwards on the slope. $$ \text{flux}_\text{diffusion} = -\phi'(x)$$ When these two fluxes are opposite then there is no net flux and the function remains stable. So that is how you could view the relationship $\phi'(x) = -x\phi(x)$ I have made a computation to make the above intuitive idea more clear. In the computation I compute 1000 points according to some random distribution. And then I transform each point by scaling it with a factor $(1-c)$ and I am adding a centered Bernoulli variable to it with a factor $\sqrt{2c-c^2}$. This transformation will turn over time the distribution into a stable situation where the effect of the scaling is equal to the effect of the addition of the Bernoulli variable. Below I have made two sketches for the intuition behind the terms in the differential equation. (It is not a rigid derivation and one should go from the difference equations to differential and take the limit to very all linearizing the function, and also one could generalize the variable that is added, and represents the diffusion, which is now just a Bernoulli distributed variable. But I guess that in this way it is more intuitive and captures the essence more clearly) # to plot points in the distribution histpoints <- function(x, min, max) { counts <- rep(0, length(min:max)) y <- rep(0,length(x)) for (i in 1:length(x)) { bin <- ceiling(x[i]-min) counts[bin] <- counts[bin]+1 y[i] <- counts[bin] } points(x,y, pch = 21, col = 1, bg = 1, cex = 0.4) counts } # transforming the points by # - scaling/shrinking # - and adding a Bernoulli variable convertpoints <- function(x,c,var = 25) { x <- x * (1-c) # scaling x <- x + sqrt(2*c-c^2) * (-1+2*rbinom(length(x), size = 1, prob = 0.5))*sqrt(var) # adding noise term return(x) } # make 2000 points according to some funny distribution set.seed(1) start <- seq(-20,20,0.01) x <- sample(start, 1000, replace = TRUE, prob = 20+start^2-(20^-2+20^-3)*start^4) # plot initial histogram layout(matrix(1:8,4)) par(mar=c(3,1,2,1)) hist(x, breaks = c(-40:40), xlim=c(-25,25), ylim = c(0,80), main = "begin", xlab = "", yaxt = "n", ylab = "", xaxt = "n") bins <- histpoints(x,-30,30) for (j in 1:7) { for (i in 1:(100)) { x <- convertpoints(x,0.003) } #plot transformed hist(x, breaks = c(-40:40), xlim=c(-25,25), ylim = c(0,80), main = paste0("after ",j*100," transforms"), xlab = "", yaxt = "n", ylab = "", xaxt = "n") bins <- histpoints(x,-30,30) }
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance?
I like to think of it in a similar way but with slightly different differential equations. (edit: below I managed to make it also intuitive for $\phi'(x) = -x \phi(x)$) Case: heat equation $$\frac{d}{
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance? I like to think of it in a similar way but with slightly different differential equations. (edit: below I managed to make it also intuitive for $\phi'(x) = -x \phi(x)$) Case: heat equation $$\frac{d}{dt} \left[ \frac{1}{\sqrt{t}} \phi(x/\sqrt{t}) \right]= 0.5 \frac{d^2}{dx^2} \left[ \frac{1}{\sqrt{t}} \phi(x/\sqrt{t}) \right]$$ This is how I actually like to see the normal distribution and the central limit theorem. The sum of variables which is in the limit like a diffusion process (which follows a differential equation) For a random walk where the steps are some variable $X_i$ with unit variance and zero mean then you get that the distribution function is approaching a scaled normal distribution $$P \left( \sum_{i=1}^t X_i = x\right) \approx \frac{1}{\sqrt{t}} \phi \left(x/\sqrt{t}\right) = f(x,t)$$ The change of this function can be seen as a bit simultaneously as the differential function for Brownian motion and is like a wave spreading out in time following the equation: $$\frac{\partial}{\partial t} f(x,t) = \frac{\partial^2}{\partial x^2} f(x,t)$$ See also https://en.m.wikipedia.org/wiki/Normal_distribution#Exact_normality Case: $\mathbf{\phi(x) +x\phi'(x)+ \phi''(x) =0}$ Now when we divide by $t$ $${P\left(\frac{\sum_{i=1}^t X_i }{t}= x\right) }\approx \phi\left({x}\right) = g(x,t)$$ and we could describe it as some scaled random walk like: if $Z_t = Z_{t-1} + X_t$ then for $Y_t = Z_t/\sqrt{t}$ $$Y_t -Y_{t-1} = - Y_{t-1} \frac{\sqrt{t-1}-\sqrt{t}}{\sqrt{t}} + X_t \frac{1}{\sqrt{t}}$$ which you could see as shrinking the current value by a factor and adding a variable $X_t$ scaled with some factor determined by $t$. Then in the limit the change of $\frac{\partial}{\partial t} g(x,t)$ should balance these two processes $$ \frac{\partial g(x,t)}{\partial t} = \underbrace{ a g(x,t) }_{\substack{ \text{shrinking}\\ \text{moves values up} }} +\underbrace{ \overbrace{x}^{ \substack{ \llap{\text{further }} \rlap{\text{away the}} \\ \llap{\text{shrinking }} \rlap{\text{is stronger}}\\ \, }} \frac{\partial g(x,t)}{\partial x}}_{ \substack{ \text{shrinking} \\ \text{shifts/squeezes the function} }} + \underbrace{ c \frac{\partial^2 g(x,t) }{\partial x^2 }}_{\text{diffusion}}=0$$ And the normal function is the function that such that the derivative of time (which is now expressed in terms of derivatives of space only) is zero. So in this way we can relate intuitively $\phi(x) +x\phi'(x)+ \phi''(x) =0$ to a diffusion process with shrinking where the function remains unchanged. Case: $\mathbf{x \phi(x) + \phi'(x) =0}$ This case is relatively similar to the one above. The shrinking of the formula can be related to a flux that is pulling the density to the inside. The flux is the product of the amount of mass (which is moving) and the speed of the mass (which relates to the distance) $$ \text{flux}_\text{shrinking} = -x \phi(x)$$ The diffusion can be related to a flux that is related to the slope of the function. If at some point there is more density to one direction than the other then the convolution/diffusion will cause some density to flow donwards on the slope. $$ \text{flux}_\text{diffusion} = -\phi'(x)$$ When these two fluxes are opposite then there is no net flux and the function remains stable. So that is how you could view the relationship $\phi'(x) = -x\phi(x)$ I have made a computation to make the above intuitive idea more clear. In the computation I compute 1000 points according to some random distribution. And then I transform each point by scaling it with a factor $(1-c)$ and I am adding a centered Bernoulli variable to it with a factor $\sqrt{2c-c^2}$. This transformation will turn over time the distribution into a stable situation where the effect of the scaling is equal to the effect of the addition of the Bernoulli variable. Below I have made two sketches for the intuition behind the terms in the differential equation. (It is not a rigid derivation and one should go from the difference equations to differential and take the limit to very all linearizing the function, and also one could generalize the variable that is added, and represents the diffusion, which is now just a Bernoulli distributed variable. But I guess that in this way it is more intuitive and captures the essence more clearly) # to plot points in the distribution histpoints <- function(x, min, max) { counts <- rep(0, length(min:max)) y <- rep(0,length(x)) for (i in 1:length(x)) { bin <- ceiling(x[i]-min) counts[bin] <- counts[bin]+1 y[i] <- counts[bin] } points(x,y, pch = 21, col = 1, bg = 1, cex = 0.4) counts } # transforming the points by # - scaling/shrinking # - and adding a Bernoulli variable convertpoints <- function(x,c,var = 25) { x <- x * (1-c) # scaling x <- x + sqrt(2*c-c^2) * (-1+2*rbinom(length(x), size = 1, prob = 0.5))*sqrt(var) # adding noise term return(x) } # make 2000 points according to some funny distribution set.seed(1) start <- seq(-20,20,0.01) x <- sample(start, 1000, replace = TRUE, prob = 20+start^2-(20^-2+20^-3)*start^4) # plot initial histogram layout(matrix(1:8,4)) par(mar=c(3,1,2,1)) hist(x, breaks = c(-40:40), xlim=c(-25,25), ylim = c(0,80), main = "begin", xlab = "", yaxt = "n", ylab = "", xaxt = "n") bins <- histpoints(x,-30,30) for (j in 1:7) { for (i in 1:(100)) { x <- convertpoints(x,0.003) } #plot transformed hist(x, breaks = c(-40:40), xlim=c(-25,25), ylim = c(0,80), main = paste0("after ",j*100," transforms"), xlab = "", yaxt = "n", ylab = "", xaxt = "n") bins <- histpoints(x,-30,30) }
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance? I like to think of it in a similar way but with slightly different differential equations. (edit: below I managed to make it also intuitive for $\phi'(x) = -x \phi(x)$) Case: heat equation $$\frac{d}{
31,982
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance?
That differential equation is how Gauss arrived at the normal distribution in 1809. Gauss wanted to rationalize the choice of the average as an estimator of a location parameter. He imposed the following conditions for the distribution of errors: The density function $\phi(x)$ is differentiable. $\phi(-x) = \phi(x)$. $\phi(x)$ is maximum at $x=0$. Given multiple measurements of the same quantity corrupted by additive i.i.d. errors, the most likely value of the quantity is the average of the measurements. From these conditions, he obtained the differential equation $\phi'(x) = -hx \phi(x)$ from which the normal pdf follows (recognizing $h$ as the precision parameter). You can find the full derivation (in modern notation) in "The Evolution of the Normal Distribution" by Saul Stahl.
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance?
That differential equation is how Gauss arrived at the normal distribution in 1809. Gauss wanted to rationalize the choice of the average as an estimator of a location parameter. He imposed the follow
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance? That differential equation is how Gauss arrived at the normal distribution in 1809. Gauss wanted to rationalize the choice of the average as an estimator of a location parameter. He imposed the following conditions for the distribution of errors: The density function $\phi(x)$ is differentiable. $\phi(-x) = \phi(x)$. $\phi(x)$ is maximum at $x=0$. Given multiple measurements of the same quantity corrupted by additive i.i.d. errors, the most likely value of the quantity is the average of the measurements. From these conditions, he obtained the differential equation $\phi'(x) = -hx \phi(x)$ from which the normal pdf follows (recognizing $h$ as the precision parameter). You can find the full derivation (in modern notation) in "The Evolution of the Normal Distribution" by Saul Stahl.
Does this interpretation $\phi'(x)=-x\phi(x)$ of the normal distribution have any significance? That differential equation is how Gauss arrived at the normal distribution in 1809. Gauss wanted to rationalize the choice of the average as an estimator of a location parameter. He imposed the follow
31,983
Can stats regarding the Coronavirus outbreak tell us anything at all?
Don't let the perfect be the enemy of the good Many of the issues you have raised are perfectly reasonable concerns. Having said that, it is important to distinguish between cases where reported data is wrong, versus cases where reported data is correct, but is limited in its usage due to the omission of other relevant information. The latter case is really quite ubiquitous in statistical analysis, since it is very rare that we have all the data we would ideally like to have. In such circumstances, it is also important not to make the perfect the enemy of the good by presuming that the absence of a comprehensive dataset on every variable we would like to know about precludes any reasonable inferences being made from the data we have. The main comprehensive public dataset we have available for the COVID-19 virus is the data held and updated by the John Hopkins Coronavirus Resource Centre at John Hopkins University. This is the repository of data that is being used for the vast majority of media reports and data visualisations on the spread of COVID-19. The database has data on confirmed infections, recoveries, and deaths, plus GIS data on where these occurred. The data is sourced from the WHO and various national health departments, and it is being updated frequently. It is certainly true that there are a lot of other things we would ideally like to have data about, to assist in understanding the path and severity of the virus. As you have suggested, it would be wonderful if we could also obtain a comprehensive dataset on all the tests that have actually been conducted (including the negative results), and the characteristics of all the affected patients, including their age, sex, and health factors. At this early stage it is probably overly ambitious to expect all of this data to have been collected and collated, but hopefully the various health departments of the world will eventually be able to bring some of this data together. Health departments cannot legally disclose health information on particular patients in a way that would make them identifiable, so it is an extremely complex task to collate this type of data if the goal is to make it available for public analysis. No doubt there will be some efforts to obtain and collate more detailed data, but it will be a difficult task. When interpreting limited data, it is desirable to describe that data in a way that makes it clear how it was collected, and this collection mechanism forms a caveat on analysis. Thus, we can refer to the reported numbers of infections, recoveries, deaths, etc., from each of the reporting countries, while noting that there may be disparities from these figures to the actual true numbers. Most health departments around the world are set up so that they can obtain these figures with reasonable accuracy, so that large diparities between reported figures and the true values are unlikely, except in the case of countries that make a deliberate effort to suppress this information. Notwithstanding the lack of the ideal data you would like, from the reported data there are certainly some things that we can reasonably infer. For most countries, the data is likely to be a reasonably representation of the number of infected, recovered, and dead patients out of those who have been properly tested. (Of course, I take some of the data, such as the recent numbers from China, with a large degree of scepticism.) It is also likely that there are other infected and recovered people who have not been tested, and who therefore do not form part of the reported statistics. Even so, this data gives us a pretty good look at growth rates for the infection in various cities and countries around the world, which allows us to see where the virus has progresssed most rapidly, and where it has been relatively contained. These numbers also allow some attempt at extrapolation, which allows health authorities to make predictions on the likely number of cases at future dates, and the health burden this will create in different places. Your question appears to assert that most of these trends are likely to be "wrong" due to the absence of data on other factors such as total testing and patient health. In my view, that is not the correct way to look at it. Rather, the reported trends may be correct, in the limited descriptive sense, but there may still be underlying non-reported factors that would give reason to anticipate future changes in those trends. Personally, I am extremely impressed at how rapidly these various organisations have coordinated a large data collation and made public online platforms reporting on the infection and updating it frequently. I can log on every day and see updated graphical information showing the progression of the infection in virtually any city or country in the world! The data may not be perfect, but I would think it would bear enough of a resemblance to reality to be valuable information. I think the effort is quite amazing, and it far past what we could do even ten years ago.
Can stats regarding the Coronavirus outbreak tell us anything at all?
Don't let the perfect be the enemy of the good Many of the issues you have raised are perfectly reasonable concerns. Having said that, it is important to distinguish between cases where reported data
Can stats regarding the Coronavirus outbreak tell us anything at all? Don't let the perfect be the enemy of the good Many of the issues you have raised are perfectly reasonable concerns. Having said that, it is important to distinguish between cases where reported data is wrong, versus cases where reported data is correct, but is limited in its usage due to the omission of other relevant information. The latter case is really quite ubiquitous in statistical analysis, since it is very rare that we have all the data we would ideally like to have. In such circumstances, it is also important not to make the perfect the enemy of the good by presuming that the absence of a comprehensive dataset on every variable we would like to know about precludes any reasonable inferences being made from the data we have. The main comprehensive public dataset we have available for the COVID-19 virus is the data held and updated by the John Hopkins Coronavirus Resource Centre at John Hopkins University. This is the repository of data that is being used for the vast majority of media reports and data visualisations on the spread of COVID-19. The database has data on confirmed infections, recoveries, and deaths, plus GIS data on where these occurred. The data is sourced from the WHO and various national health departments, and it is being updated frequently. It is certainly true that there are a lot of other things we would ideally like to have data about, to assist in understanding the path and severity of the virus. As you have suggested, it would be wonderful if we could also obtain a comprehensive dataset on all the tests that have actually been conducted (including the negative results), and the characteristics of all the affected patients, including their age, sex, and health factors. At this early stage it is probably overly ambitious to expect all of this data to have been collected and collated, but hopefully the various health departments of the world will eventually be able to bring some of this data together. Health departments cannot legally disclose health information on particular patients in a way that would make them identifiable, so it is an extremely complex task to collate this type of data if the goal is to make it available for public analysis. No doubt there will be some efforts to obtain and collate more detailed data, but it will be a difficult task. When interpreting limited data, it is desirable to describe that data in a way that makes it clear how it was collected, and this collection mechanism forms a caveat on analysis. Thus, we can refer to the reported numbers of infections, recoveries, deaths, etc., from each of the reporting countries, while noting that there may be disparities from these figures to the actual true numbers. Most health departments around the world are set up so that they can obtain these figures with reasonable accuracy, so that large diparities between reported figures and the true values are unlikely, except in the case of countries that make a deliberate effort to suppress this information. Notwithstanding the lack of the ideal data you would like, from the reported data there are certainly some things that we can reasonably infer. For most countries, the data is likely to be a reasonably representation of the number of infected, recovered, and dead patients out of those who have been properly tested. (Of course, I take some of the data, such as the recent numbers from China, with a large degree of scepticism.) It is also likely that there are other infected and recovered people who have not been tested, and who therefore do not form part of the reported statistics. Even so, this data gives us a pretty good look at growth rates for the infection in various cities and countries around the world, which allows us to see where the virus has progresssed most rapidly, and where it has been relatively contained. These numbers also allow some attempt at extrapolation, which allows health authorities to make predictions on the likely number of cases at future dates, and the health burden this will create in different places. Your question appears to assert that most of these trends are likely to be "wrong" due to the absence of data on other factors such as total testing and patient health. In my view, that is not the correct way to look at it. Rather, the reported trends may be correct, in the limited descriptive sense, but there may still be underlying non-reported factors that would give reason to anticipate future changes in those trends. Personally, I am extremely impressed at how rapidly these various organisations have coordinated a large data collation and made public online platforms reporting on the infection and updating it frequently. I can log on every day and see updated graphical information showing the progression of the infection in virtually any city or country in the world! The data may not be perfect, but I would think it would bear enough of a resemblance to reality to be valuable information. I think the effort is quite amazing, and it far past what we could do even ten years ago.
Can stats regarding the Coronavirus outbreak tell us anything at all? Don't let the perfect be the enemy of the good Many of the issues you have raised are perfectly reasonable concerns. Having said that, it is important to distinguish between cases where reported data
31,984
Why does R refer to the distribution family as an "error distribution" in the context of generalized linear models?
Presumably this nomenclature is chosen simply to draw an analogy between the GLM and linear regression. You are correct that this term is not strictly accurate, since the family of distributions chosen for the GLM is not actually the distribution of an "error" quantity in the model. One can construct quantities in the GLM that are essentially measures of the "error" in each individual observation (the best being the underlying deviance errors for which the deviance residuals are an estimator). While the distribution of these "errors" is affected by specification of the family of distributions used in the GLM, they have their own distribution.
Why does R refer to the distribution family as an "error distribution" in the context of generalized
Presumably this nomenclature is chosen simply to draw an analogy between the GLM and linear regression. You are correct that this term is not strictly accurate, since the family of distributions chos
Why does R refer to the distribution family as an "error distribution" in the context of generalized linear models? Presumably this nomenclature is chosen simply to draw an analogy between the GLM and linear regression. You are correct that this term is not strictly accurate, since the family of distributions chosen for the GLM is not actually the distribution of an "error" quantity in the model. One can construct quantities in the GLM that are essentially measures of the "error" in each individual observation (the best being the underlying deviance errors for which the deviance residuals are an estimator). While the distribution of these "errors" is affected by specification of the family of distributions used in the GLM, they have their own distribution.
Why does R refer to the distribution family as an "error distribution" in the context of generalized Presumably this nomenclature is chosen simply to draw an analogy between the GLM and linear regression. You are correct that this term is not strictly accurate, since the family of distributions chos
31,985
Omitted variable bias vs. Multicollinearity
Usually, you would not care about both of them simultaneously. Depending on the goal of your analysis (say, description vs. prediction vs. causal inference), you would care about at most one of them. Description$\color{red}{^*}$ Multicollinearity (MC) is just a fact to be mentioned, just one of the characteristics of the data to report. The notion of omitted variable bias (OVB) does not apply to descriptive modelling. (See the definition of OVB in the Wikipedia quote provided below.) In contrast to causal modelling, the causal notion of relevance of variables does not apply for description. You can freely choose the variables you are interested in describing probabilistically (e.g. in the form of a regression) and you evaluate your model w.r.t. the chosen set of variables, not variables not chosen. Prediction MC and OVB are largely irrelevant as you are not interested in model coefficients per se, only in predictions. Causal modelling / causal inference You may care about both MC and OVB at once when attempting to do causal inference. I will argue that you should actually worry about the OVB but not MC. OVB results from a faulty model, not from the characteristics of the underlying phenomenon. You can remedy it by changing the model. Meanwhile, imperfect MC can very well arise in a well specified model as a characteristic of the underlying phenomenon. Given the well specified model and the data that you have, there is no sound escape from MC. In that sense you should just acknowledge it and the resulting uncertainty in your parameter estimates and inference. $\color{red}{^*}$I am not 100% sure about the definition of description / descriptive modelling. In this answer, I take description to constitute probabilistic modelling of data, e.g. joint, conditional and marginal distributions and their specific features. In contrast to causal modelling, description focuses on probabilistic but not causal relationships between variables. Edit to respond to feedback by @LSC: In defence of my statement that OVB is largely irrelevant for prediction, let us first see what OVB is. According to Wikipedia, In statistics, omitted-variable bias (OVB) occurs when a statistical model leaves out one or more relevant variables. The bias results in the model attributing the effect of the missing variables to the estimated effects of the included variables. More specifically, OVB is the bias that appears in the estimates of parameters in a regression analysis, when the assumed specification is incorrect in that it omits an independent variable that is a determinant of the dependent variable and correlated with one or more of the included independent variables. In prediction, we do not care about the estimated effects but rather accurate predictions. Hence, my statement above should become obvious. Regarding the statement OVB will necessarily introduce bias into the estimation process and can screw with predictions by @LSC. This is tangential to my points because I did not discuss the effect of omitting a variable on prediction. I only discussed the relevance of omitted variable bias for prediction. The two are not the same. I agree that omitting a variable does affect prediction under imperfect MC. While this would not be called OVB (see the Wikipedia quote above for what OVB typically means), this is a real issue. The question is, how important is that under MC? I will argue, not so much. Under MC, the information set of all the regressors vs. the reduced set without one regressor are close. As a consequence, the loss of predictive accuracy from omitting a regressor is small, and the loss shrinks with the degree of MC. This should come as no surprise. We are routinely omitting regressors in predictive models so as to exploit the bias-variance trade-off. Also, the linear prediction is unbiased w.r.t. the reduced information set, and as I mentioned above, that information set is close to the full information set under MC. The coefficient estimators are also predictively consistent; see "T-consistency vs P-consistency" for a related point.
Omitted variable bias vs. Multicollinearity
Usually, you would not care about both of them simultaneously. Depending on the goal of your analysis (say, description vs. prediction vs. causal inference), you would care about at most one of them.
Omitted variable bias vs. Multicollinearity Usually, you would not care about both of them simultaneously. Depending on the goal of your analysis (say, description vs. prediction vs. causal inference), you would care about at most one of them. Description$\color{red}{^*}$ Multicollinearity (MC) is just a fact to be mentioned, just one of the characteristics of the data to report. The notion of omitted variable bias (OVB) does not apply to descriptive modelling. (See the definition of OVB in the Wikipedia quote provided below.) In contrast to causal modelling, the causal notion of relevance of variables does not apply for description. You can freely choose the variables you are interested in describing probabilistically (e.g. in the form of a regression) and you evaluate your model w.r.t. the chosen set of variables, not variables not chosen. Prediction MC and OVB are largely irrelevant as you are not interested in model coefficients per se, only in predictions. Causal modelling / causal inference You may care about both MC and OVB at once when attempting to do causal inference. I will argue that you should actually worry about the OVB but not MC. OVB results from a faulty model, not from the characteristics of the underlying phenomenon. You can remedy it by changing the model. Meanwhile, imperfect MC can very well arise in a well specified model as a characteristic of the underlying phenomenon. Given the well specified model and the data that you have, there is no sound escape from MC. In that sense you should just acknowledge it and the resulting uncertainty in your parameter estimates and inference. $\color{red}{^*}$I am not 100% sure about the definition of description / descriptive modelling. In this answer, I take description to constitute probabilistic modelling of data, e.g. joint, conditional and marginal distributions and their specific features. In contrast to causal modelling, description focuses on probabilistic but not causal relationships between variables. Edit to respond to feedback by @LSC: In defence of my statement that OVB is largely irrelevant for prediction, let us first see what OVB is. According to Wikipedia, In statistics, omitted-variable bias (OVB) occurs when a statistical model leaves out one or more relevant variables. The bias results in the model attributing the effect of the missing variables to the estimated effects of the included variables. More specifically, OVB is the bias that appears in the estimates of parameters in a regression analysis, when the assumed specification is incorrect in that it omits an independent variable that is a determinant of the dependent variable and correlated with one or more of the included independent variables. In prediction, we do not care about the estimated effects but rather accurate predictions. Hence, my statement above should become obvious. Regarding the statement OVB will necessarily introduce bias into the estimation process and can screw with predictions by @LSC. This is tangential to my points because I did not discuss the effect of omitting a variable on prediction. I only discussed the relevance of omitted variable bias for prediction. The two are not the same. I agree that omitting a variable does affect prediction under imperfect MC. While this would not be called OVB (see the Wikipedia quote above for what OVB typically means), this is a real issue. The question is, how important is that under MC? I will argue, not so much. Under MC, the information set of all the regressors vs. the reduced set without one regressor are close. As a consequence, the loss of predictive accuracy from omitting a regressor is small, and the loss shrinks with the degree of MC. This should come as no surprise. We are routinely omitting regressors in predictive models so as to exploit the bias-variance trade-off. Also, the linear prediction is unbiased w.r.t. the reduced information set, and as I mentioned above, that information set is close to the full information set under MC. The coefficient estimators are also predictively consistent; see "T-consistency vs P-consistency" for a related point.
Omitted variable bias vs. Multicollinearity Usually, you would not care about both of them simultaneously. Depending on the goal of your analysis (say, description vs. prediction vs. causal inference), you would care about at most one of them.
31,986
Omitted variable bias vs. Multicollinearity
If your goal is inference, multicollinearity is problematic. Consider multiple linear regression where the beta parameters help us estimate the increase or decrease in Y for a unit increase in X1, all other variables held constant. Multicollinearity has the effect of inflating the standard errors of the beta parameters, making such inferences less reliable. Specifically, the variances of the model coefficients become very large so that small changes in the data can precipitate erratic changes in model parameters. If the purpose of the regression model is to investigate associations, multicollinearity among the predictor variables can obscure the computation and identification of key independent effects of collinear predictor variables on the outcome variable because of the overlapping information they share. (source) However, multicollinearity does not prevent good, reliable predictions in the scope of the model. In general, multicollinearity is acceptable when the goal is prediction, but if multicollinearity is present, it is something you should disclose and it affects the uncertainty surrounding your model estimates. Be aware that perfect multicollinearity actually leads to a situation in which an infinite number of fitted regression models is possible. The VIF (variance inflation factor) is one rule-of-thumb for how much multicollinearity we can tolerate in inference. In a model with perfect multicollinearity, your regression coefficients are indeterminate and their standard errors are infinite (source).
Omitted variable bias vs. Multicollinearity
If your goal is inference, multicollinearity is problematic. Consider multiple linear regression where the beta parameters help us estimate the increase or decrease in Y for a unit increase in X1, all
Omitted variable bias vs. Multicollinearity If your goal is inference, multicollinearity is problematic. Consider multiple linear regression where the beta parameters help us estimate the increase or decrease in Y for a unit increase in X1, all other variables held constant. Multicollinearity has the effect of inflating the standard errors of the beta parameters, making such inferences less reliable. Specifically, the variances of the model coefficients become very large so that small changes in the data can precipitate erratic changes in model parameters. If the purpose of the regression model is to investigate associations, multicollinearity among the predictor variables can obscure the computation and identification of key independent effects of collinear predictor variables on the outcome variable because of the overlapping information they share. (source) However, multicollinearity does not prevent good, reliable predictions in the scope of the model. In general, multicollinearity is acceptable when the goal is prediction, but if multicollinearity is present, it is something you should disclose and it affects the uncertainty surrounding your model estimates. Be aware that perfect multicollinearity actually leads to a situation in which an infinite number of fitted regression models is possible. The VIF (variance inflation factor) is one rule-of-thumb for how much multicollinearity we can tolerate in inference. In a model with perfect multicollinearity, your regression coefficients are indeterminate and their standard errors are infinite (source).
Omitted variable bias vs. Multicollinearity If your goal is inference, multicollinearity is problematic. Consider multiple linear regression where the beta parameters help us estimate the increase or decrease in Y for a unit increase in X1, all
31,987
Why is it hard for a neural network to learn the identity function?
For a single example, the network takes a 784-element vector as its input. So rephrasing the problem in OP's post, they wish to learn the function $$ f(x) = Ix $$ where $I$ is the $784\times 784$ identity matrix. Perfect fit is impossible with this model The 1-layer network probably has an easier time because instead of attempting to "line up" four weight matrices through four nonlinearities, it only has to line up one, i.e. it is easier to find an approximation in $W_1, b_1$ for $$ Ix = g(W_1 x+b_1). $$ But even the simple expression $Ix = g(W_1 x+b_1)$ should be an obvious warning that attempting to find a perfect fit is a fool's errand, because it is trying to approximate a linear function with a nonlinear function. In particular, because of how ReLUs are defined, any $x<0$ is set to 0, so this model will never achieve 0 error when any elements of $x$ are negative. The UAT is an approximation theorem Indeed, for any choice of nonlinear activation $g$, I can find an $x$ for which the error is positive. So then the interesting question becomes "Can we fit a model so that the error is at most $\epsilon$ for $x$ in some interval $\mathcal{I}$?" And this statement of the problem is more-or-less compatible with the caveats of the UAT. It also points us in a more profitable direction: instead of seeking 0 error, we wish to find minimal error when the inputs are in some interval. In other words, theorems about neural networks don't guarantee that you can achieve 0 error, they guarantee that you can bound error for inputs in some interval (subject to some terms and conditions). The UAT doesn't comment on whether it's easy to train any particular network. Actually finding the weights and biases which achieve the minimum error is a very challenging problem. In particular, we don't have much reason to believe that the choice of initialization, optimizer, learning rate and number of epochs, etc. in this code snippet are best for this task. This optimization problem is hard A four-layer network with ReLU activations $g(x)=\max\{0, x\}$ is given by $$ h(x)=g(W_4g(W_3g(W_2g(W_1x+b_1)+b_2)+b_3)+b_4). $$ So what you seek in your question is solutions $W_i, b_i$ such that $$ Ix = g(W_4g(W_3g(W_2g(W_1x+b_1)+b_2)+b_3)+b_4) $$ for all $x$, where $W_i, b_i$ are have appropriate shape. This doesn't look particularly friendly to try and solve. Indeed, in light of my remarks about the UAT, we will have to restate this to bound the error and focus on an interval of inputs. Even if we restate the problem in this way, it is still challenging from the perspective of gradient descent because of the dying ReLU phenomenon, the weaknesses of gradient descent, and the poor conditioning of the optimization task due to the scale of the inputs. Tuning a neural network is the greater part of using neural networks. If you don't want to spend a lot of time changing hyper-paremters, then you should use a different model.
Why is it hard for a neural network to learn the identity function?
For a single example, the network takes a 784-element vector as its input. So rephrasing the problem in OP's post, they wish to learn the function $$ f(x) = Ix $$ where $I$ is the $784\times 784$ iden
Why is it hard for a neural network to learn the identity function? For a single example, the network takes a 784-element vector as its input. So rephrasing the problem in OP's post, they wish to learn the function $$ f(x) = Ix $$ where $I$ is the $784\times 784$ identity matrix. Perfect fit is impossible with this model The 1-layer network probably has an easier time because instead of attempting to "line up" four weight matrices through four nonlinearities, it only has to line up one, i.e. it is easier to find an approximation in $W_1, b_1$ for $$ Ix = g(W_1 x+b_1). $$ But even the simple expression $Ix = g(W_1 x+b_1)$ should be an obvious warning that attempting to find a perfect fit is a fool's errand, because it is trying to approximate a linear function with a nonlinear function. In particular, because of how ReLUs are defined, any $x<0$ is set to 0, so this model will never achieve 0 error when any elements of $x$ are negative. The UAT is an approximation theorem Indeed, for any choice of nonlinear activation $g$, I can find an $x$ for which the error is positive. So then the interesting question becomes "Can we fit a model so that the error is at most $\epsilon$ for $x$ in some interval $\mathcal{I}$?" And this statement of the problem is more-or-less compatible with the caveats of the UAT. It also points us in a more profitable direction: instead of seeking 0 error, we wish to find minimal error when the inputs are in some interval. In other words, theorems about neural networks don't guarantee that you can achieve 0 error, they guarantee that you can bound error for inputs in some interval (subject to some terms and conditions). The UAT doesn't comment on whether it's easy to train any particular network. Actually finding the weights and biases which achieve the minimum error is a very challenging problem. In particular, we don't have much reason to believe that the choice of initialization, optimizer, learning rate and number of epochs, etc. in this code snippet are best for this task. This optimization problem is hard A four-layer network with ReLU activations $g(x)=\max\{0, x\}$ is given by $$ h(x)=g(W_4g(W_3g(W_2g(W_1x+b_1)+b_2)+b_3)+b_4). $$ So what you seek in your question is solutions $W_i, b_i$ such that $$ Ix = g(W_4g(W_3g(W_2g(W_1x+b_1)+b_2)+b_3)+b_4) $$ for all $x$, where $W_i, b_i$ are have appropriate shape. This doesn't look particularly friendly to try and solve. Indeed, in light of my remarks about the UAT, we will have to restate this to bound the error and focus on an interval of inputs. Even if we restate the problem in this way, it is still challenging from the perspective of gradient descent because of the dying ReLU phenomenon, the weaknesses of gradient descent, and the poor conditioning of the optimization task due to the scale of the inputs. Tuning a neural network is the greater part of using neural networks. If you don't want to spend a lot of time changing hyper-paremters, then you should use a different model.
Why is it hard for a neural network to learn the identity function? For a single example, the network takes a 784-element vector as its input. So rephrasing the problem in OP's post, they wish to learn the function $$ f(x) = Ix $$ where $I$ is the $784\times 784$ iden
31,988
Spearman $\rho$ as a function of Pearson $r$
I think I found the answer. In Pearson's "On further methods of determining correlation" (1907) he derives the expression: $$ r=2 \sin \Big(\frac{\pi}{6}\rho\Big), $$ which implies, $$ \rho= \frac{6}{\pi} \sin^{-1} \frac{r}{2}. $$ This made me realize that for the bivariate normal case, $r$ and $\rho$ are, as a rule of thumb, near identical. I would still be curious if anyone has an answer for more exotic distributions but that is a separate question.
Spearman $\rho$ as a function of Pearson $r$
I think I found the answer. In Pearson's "On further methods of determining correlation" (1907) he derives the expression: $$ r=2 \sin \Big(\frac{\pi}{6}\rho\Big), $$ which implies, $$ \rho= \frac{6}{
Spearman $\rho$ as a function of Pearson $r$ I think I found the answer. In Pearson's "On further methods of determining correlation" (1907) he derives the expression: $$ r=2 \sin \Big(\frac{\pi}{6}\rho\Big), $$ which implies, $$ \rho= \frac{6}{\pi} \sin^{-1} \frac{r}{2}. $$ This made me realize that for the bivariate normal case, $r$ and $\rho$ are, as a rule of thumb, near identical. I would still be curious if anyone has an answer for more exotic distributions but that is a separate question.
Spearman $\rho$ as a function of Pearson $r$ I think I found the answer. In Pearson's "On further methods of determining correlation" (1907) he derives the expression: $$ r=2 \sin \Big(\frac{\pi}{6}\rho\Big), $$ which implies, $$ \rho= \frac{6}{
31,989
How are Bayes factors actually Bayesian?
While I have written rather extensively on the limitations of the Bayes factor as a mean to conduct model comparison, the first point is that indeed it is not the Bayesian answer to the testing question Which of model $M_1$ or model $M_2$ is the true model? when evaluated with the Neyman-Pearson loss function. The proper Bayesian answer is the model with the largest posterior probability. When using other loss functions, the proper Bayesian answer is the posterior probability itself. Historically, the Bayes factor has been defended by Jeffreys (circa 1939) as providing a more objective answer than the posterior probability, as it evacuates the impact of the prior weights of the models $M_1$ and $M_2$, which can be deemed as failing to take advantage of the Bayesian formalism, but truly reflects the immense uncertainty in setting such weights. On the second point, it is well-documented that Bayes factors are providing a natural penalisation for complexity by integrating out over a larger space, as opposed to likelihood ratios that exploit the best fits under both models. The Bayes factor is often seen as a quasi-automatic Occam's razor for this reason, which is also why the Bayesian information criterion (BIC) $$\mathrm{BIC} = {\log(n)k - 2\log(L({\hat \theta}))}$$ is used by non-Bayesians as well.
How are Bayes factors actually Bayesian?
While I have written rather extensively on the limitations of the Bayes factor as a mean to conduct model comparison, the first point is that indeed it is not the Bayesian answer to the testing questi
How are Bayes factors actually Bayesian? While I have written rather extensively on the limitations of the Bayes factor as a mean to conduct model comparison, the first point is that indeed it is not the Bayesian answer to the testing question Which of model $M_1$ or model $M_2$ is the true model? when evaluated with the Neyman-Pearson loss function. The proper Bayesian answer is the model with the largest posterior probability. When using other loss functions, the proper Bayesian answer is the posterior probability itself. Historically, the Bayes factor has been defended by Jeffreys (circa 1939) as providing a more objective answer than the posterior probability, as it evacuates the impact of the prior weights of the models $M_1$ and $M_2$, which can be deemed as failing to take advantage of the Bayesian formalism, but truly reflects the immense uncertainty in setting such weights. On the second point, it is well-documented that Bayes factors are providing a natural penalisation for complexity by integrating out over a larger space, as opposed to likelihood ratios that exploit the best fits under both models. The Bayes factor is often seen as a quasi-automatic Occam's razor for this reason, which is also why the Bayesian information criterion (BIC) $$\mathrm{BIC} = {\log(n)k - 2\log(L({\hat \theta}))}$$ is used by non-Bayesians as well.
How are Bayes factors actually Bayesian? While I have written rather extensively on the limitations of the Bayes factor as a mean to conduct model comparison, the first point is that indeed it is not the Bayesian answer to the testing questi
31,990
How are Bayes factors actually Bayesian?
The issue is that while a Bayes factor, assuming equal prior probability of the competing hypotheses, is a likelihood ratio, it's not the likelihood ratio you think it is. Here, the likelihood of $M_1$ is $$ p(data|M_1) = \int p(data|M_1, \theta_1) p(\theta_1|M_1) d\theta_1. $$ The trick you were missing that directly answers both parts 1) and 2) is that what we mean in this context when we say the likelihood of the data given model 1 incorporates the prior on the parameters -- the only (potential) prior information we (often) throw out is that we are just assuming (typically) that the hypotheses are a priori equally likely. In other words, you were conflating $p(data|M_1)$ with $p(data|M_1, \theta_1)$.
How are Bayes factors actually Bayesian?
The issue is that while a Bayes factor, assuming equal prior probability of the competing hypotheses, is a likelihood ratio, it's not the likelihood ratio you think it is. Here, the likelihood of $M_1
How are Bayes factors actually Bayesian? The issue is that while a Bayes factor, assuming equal prior probability of the competing hypotheses, is a likelihood ratio, it's not the likelihood ratio you think it is. Here, the likelihood of $M_1$ is $$ p(data|M_1) = \int p(data|M_1, \theta_1) p(\theta_1|M_1) d\theta_1. $$ The trick you were missing that directly answers both parts 1) and 2) is that what we mean in this context when we say the likelihood of the data given model 1 incorporates the prior on the parameters -- the only (potential) prior information we (often) throw out is that we are just assuming (typically) that the hypotheses are a priori equally likely. In other words, you were conflating $p(data|M_1)$ with $p(data|M_1, \theta_1)$.
How are Bayes factors actually Bayesian? The issue is that while a Bayes factor, assuming equal prior probability of the competing hypotheses, is a likelihood ratio, it's not the likelihood ratio you think it is. Here, the likelihood of $M_1
31,991
Writing PCA as a special kind of auto-encoder
Orthogonality of the components is not something that you can back-propagate. You would have to change the optimization to include a step that also enforces orthogonality after each update. This is expensive, and the result may not be everywhere differentiable. (This is discussed in passing in "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift", Sergey Ioffe and Christian Szegedy) However, you can use a linear auto-encoder to discover a basis that spans the principle components, or a non-linear auto-encoder to have a similar analogue to nonlinear PCA. More information can be found in "From Principal Subspaces to Principal Components with Linear Autoencoders" by Elad Plaut. The auto-encoder is an effective unsupervised learning model which is widely used in deep learning. It is well known that an auto-encoder with a single fully-connected hidden layer, a linear activation function and a squared error cost function trains weights that span the same subspace as the one spanned by the principal component loading vectors, but that they are not identical to the loading vectors. In this paper, we show how to recover the loading vectors from the auto-encoder weights. "Loss Landscapes of Regularized Linear Autoencoders" by Daniel Kunin, Jonathan M. Bloom, Aleksandrina Goeva, Cotton Seed develops this idea further. Autoencoders are a deep learning model for representation learning. When trained to minimize the Euclidean distance between the data and its reconstruction, linear autoencoders (LAEs) learn the subspace spanned by the top principal directions but cannot learn the principal directions themselves. In this paper, we prove that $L_2$-regularized LAEs learn the principal directions as the left singular vectors of the decoder, providing an extremely simple and scalable algorithm for rank-$k$ SVD. More generally, we consider LAEs with (i) no regularization, (ii) regularization of the composition of the encoder and decoder, and (iii) regularization of the encoder and decoder separately. We relate the minimum of (iii) to the MAP estimate of probabilistic PCA and show that for all critical points the encoder and decoder are transposes. Building on topological intuition, we smoothly parameterize the critical manifolds for all three losses via a novel unified framework and illustrate these results empirically. Overall, this work clarifies the relationship between autoencoders and Bayesian models and between regularization and orthogonality.
Writing PCA as a special kind of auto-encoder
Orthogonality of the components is not something that you can back-propagate. You would have to change the optimization to include a step that also enforces orthogonality after each update. This is ex
Writing PCA as a special kind of auto-encoder Orthogonality of the components is not something that you can back-propagate. You would have to change the optimization to include a step that also enforces orthogonality after each update. This is expensive, and the result may not be everywhere differentiable. (This is discussed in passing in "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift", Sergey Ioffe and Christian Szegedy) However, you can use a linear auto-encoder to discover a basis that spans the principle components, or a non-linear auto-encoder to have a similar analogue to nonlinear PCA. More information can be found in "From Principal Subspaces to Principal Components with Linear Autoencoders" by Elad Plaut. The auto-encoder is an effective unsupervised learning model which is widely used in deep learning. It is well known that an auto-encoder with a single fully-connected hidden layer, a linear activation function and a squared error cost function trains weights that span the same subspace as the one spanned by the principal component loading vectors, but that they are not identical to the loading vectors. In this paper, we show how to recover the loading vectors from the auto-encoder weights. "Loss Landscapes of Regularized Linear Autoencoders" by Daniel Kunin, Jonathan M. Bloom, Aleksandrina Goeva, Cotton Seed develops this idea further. Autoencoders are a deep learning model for representation learning. When trained to minimize the Euclidean distance between the data and its reconstruction, linear autoencoders (LAEs) learn the subspace spanned by the top principal directions but cannot learn the principal directions themselves. In this paper, we prove that $L_2$-regularized LAEs learn the principal directions as the left singular vectors of the decoder, providing an extremely simple and scalable algorithm for rank-$k$ SVD. More generally, we consider LAEs with (i) no regularization, (ii) regularization of the composition of the encoder and decoder, and (iii) regularization of the encoder and decoder separately. We relate the minimum of (iii) to the MAP estimate of probabilistic PCA and show that for all critical points the encoder and decoder are transposes. Building on topological intuition, we smoothly parameterize the critical manifolds for all three losses via a novel unified framework and illustrate these results empirically. Overall, this work clarifies the relationship between autoencoders and Bayesian models and between regularization and orthogonality.
Writing PCA as a special kind of auto-encoder Orthogonality of the components is not something that you can back-propagate. You would have to change the optimization to include a step that also enforces orthogonality after each update. This is ex
31,992
Why is cross entropy not a common evaluation metric for model performance?
I always use (test) cross-entropy under cross-validation to assess the performance of a classification model. It's far more robust than accuracy on small datasets (because accuracy isn't "smooth"), and far more meaningful than accuracy (although perhaps not than precision and recall) when classes are imbalanced. However, the problem with cross-entropy, is that it doesn't live on any objective scale, it's a very relative metric. You can compare the performance of XGBoost Vs a Neural Network on a given data set and the one with a lower cross-entropy (or higher test log-likelihood) is the better model. Saying that "XGBoost gets a cross-entropy of X on problem A and a cross-entropy of Y on problem B" is harder to interpret. In general, from an information theoretic point of view, binary classification with balanced classes is a "harder" problem than binary classification with a 90/10 class imbalance, as you have less information to start with (more mathematically compare $0.1\ln 0.1 + 0.9 \ln 0.9$ to $2\cdot 0.5\ln 0.5$). If you're trying to gauge to what extent your classifier is performing well for two different problems, with different class balances, you have the competing effects that perhaps one problem's features contain more information about the target variable, but the other problem is just easier to solve. For that reason, you wouldn't get an academic paper (I hope anyway) which says, "we used a neural network to approach this problem for the first and got a cross-entropy of X". It would however be legit to say "usually people use neural networks to approach this problem and get a cross-entropy of X, but we used XGBoost and got a cross-entropy of Y", because then you're comparing two classifiers on the same problem
Why is cross entropy not a common evaluation metric for model performance?
I always use (test) cross-entropy under cross-validation to assess the performance of a classification model. It's far more robust than accuracy on small datasets (because accuracy isn't "smooth"), an
Why is cross entropy not a common evaluation metric for model performance? I always use (test) cross-entropy under cross-validation to assess the performance of a classification model. It's far more robust than accuracy on small datasets (because accuracy isn't "smooth"), and far more meaningful than accuracy (although perhaps not than precision and recall) when classes are imbalanced. However, the problem with cross-entropy, is that it doesn't live on any objective scale, it's a very relative metric. You can compare the performance of XGBoost Vs a Neural Network on a given data set and the one with a lower cross-entropy (or higher test log-likelihood) is the better model. Saying that "XGBoost gets a cross-entropy of X on problem A and a cross-entropy of Y on problem B" is harder to interpret. In general, from an information theoretic point of view, binary classification with balanced classes is a "harder" problem than binary classification with a 90/10 class imbalance, as you have less information to start with (more mathematically compare $0.1\ln 0.1 + 0.9 \ln 0.9$ to $2\cdot 0.5\ln 0.5$). If you're trying to gauge to what extent your classifier is performing well for two different problems, with different class balances, you have the competing effects that perhaps one problem's features contain more information about the target variable, but the other problem is just easier to solve. For that reason, you wouldn't get an academic paper (I hope anyway) which says, "we used a neural network to approach this problem for the first and got a cross-entropy of X". It would however be legit to say "usually people use neural networks to approach this problem and get a cross-entropy of X, but we used XGBoost and got a cross-entropy of Y", because then you're comparing two classifiers on the same problem
Why is cross entropy not a common evaluation metric for model performance? I always use (test) cross-entropy under cross-validation to assess the performance of a classification model. It's far more robust than accuracy on small datasets (because accuracy isn't "smooth"), an
31,993
Why is cross entropy not a common evaluation metric for model performance?
Cross entropy value might range from 0 to infinity depending on the dataset. It is not ancored between 0 and 1. I guess comparing peformance between diferent models and datasets might therefore be a problem.
Why is cross entropy not a common evaluation metric for model performance?
Cross entropy value might range from 0 to infinity depending on the dataset. It is not ancored between 0 and 1. I guess comparing peformance between diferent models and datasets might therefore be a
Why is cross entropy not a common evaluation metric for model performance? Cross entropy value might range from 0 to infinity depending on the dataset. It is not ancored between 0 and 1. I guess comparing peformance between diferent models and datasets might therefore be a problem.
Why is cross entropy not a common evaluation metric for model performance? Cross entropy value might range from 0 to infinity depending on the dataset. It is not ancored between 0 and 1. I guess comparing peformance between diferent models and datasets might therefore be a
31,994
How can we interpret a neural network with sgd from a Bayesian perspective?
I think you would be interested in "Stochastic Gradient Descent as Approximate Bayesian Inference" by Stephan Mandt, Matthew D. Hoffman, David M. Blei. Stochastic Gradient Descent with a constant learning rate (constant SGD) simulates a Markov chain with a stationary distribution. With this perspective, we derive several new results. (1) We show that constant SGD can be used as an approximate Bayesian posterior inference algorithm. Specifically, we show how to adjust the tuning parameters of constant SGD to best match the stationary distribution to a posterior, minimizing the Kullback-Leibler divergence between these two distributions. (2) We demonstrate that constant SGD gives rise to a new variational EM algorithm that optimizes hyperparameters in complex probabilistic models. (3) We also propose SGD with momentum for sampling and show how to adjust the damping coefficient accordingly. (4) We analyze MCMC algorithms. For Langevin Dynamics and Stochastic Gradient Fisher Scoring, we quantify the approximation errors due to finite learning rates. Finally (5), we use the stochastic process perspective to give a short proof of why Polyak averaging is optimal. Based on this idea, we propose a scalable approximate MCMC algorithm, the Averaged Stochastic Gradient Sampler. Some additional relevant literature: Radford M. Neal was active in Bayesian inference and neural networks in the "first wave" of NN research in the 1990s. He published several articles and the book Bayesian Learning for Neural Networks. Sergios Theodoridis' Machine Learning: A Bayesian and Optimization Perspective is a truly massive tome (about 1000 pages) and includes a chapter on neural networks and deep learning. This paper crossed my desk recently: "Bayesian Neural Networks" by Vikram Mullachery, Aniruddh Khera, Amir Husain This paper describes and discusses Bayesian Neural Network (BNN). The paper showcases a few different applications of them for classification and regression problems. BNNs are comprised of a Probabilistic Model and a Neural Network. The intent of such a design is to combine the strengths of Neural Networks and Stochastic modeling. Neural Networks exhibit continuous function approximator capabilities. Stochastic models allow direct specification of a model with known interaction between parameters to generate data. During the prediction phase, stochastic models generate a complete posterior distribution and produce probabilistic guarantees on the predictions. Thus BNNs are a unique combination of neural network and stochastic models with the stochastic model forming the core of this integration. BNNs can then produce probabilistic guarantees on it's predictions and also generate the distribution of parameters that it has learnt from the observations. That means, in the parameter space, one can deduce the nature and shape of the neural network's learnt parameters. These two characteristics makes them highly attractive to theoreticians as well as practitioners. Recently there has been a lot of activity in this area, with the advent of numerous probabilistic programming libraries such as: PyMC3, Edward, Stan etc. Further this area is rapidly gaining ground as a standard machine learning approach for numerous problems
How can we interpret a neural network with sgd from a Bayesian perspective?
I think you would be interested in "Stochastic Gradient Descent as Approximate Bayesian Inference" by Stephan Mandt, Matthew D. Hoffman, David M. Blei. Stochastic Gradient Descent with a constant le
How can we interpret a neural network with sgd from a Bayesian perspective? I think you would be interested in "Stochastic Gradient Descent as Approximate Bayesian Inference" by Stephan Mandt, Matthew D. Hoffman, David M. Blei. Stochastic Gradient Descent with a constant learning rate (constant SGD) simulates a Markov chain with a stationary distribution. With this perspective, we derive several new results. (1) We show that constant SGD can be used as an approximate Bayesian posterior inference algorithm. Specifically, we show how to adjust the tuning parameters of constant SGD to best match the stationary distribution to a posterior, minimizing the Kullback-Leibler divergence between these two distributions. (2) We demonstrate that constant SGD gives rise to a new variational EM algorithm that optimizes hyperparameters in complex probabilistic models. (3) We also propose SGD with momentum for sampling and show how to adjust the damping coefficient accordingly. (4) We analyze MCMC algorithms. For Langevin Dynamics and Stochastic Gradient Fisher Scoring, we quantify the approximation errors due to finite learning rates. Finally (5), we use the stochastic process perspective to give a short proof of why Polyak averaging is optimal. Based on this idea, we propose a scalable approximate MCMC algorithm, the Averaged Stochastic Gradient Sampler. Some additional relevant literature: Radford M. Neal was active in Bayesian inference and neural networks in the "first wave" of NN research in the 1990s. He published several articles and the book Bayesian Learning for Neural Networks. Sergios Theodoridis' Machine Learning: A Bayesian and Optimization Perspective is a truly massive tome (about 1000 pages) and includes a chapter on neural networks and deep learning. This paper crossed my desk recently: "Bayesian Neural Networks" by Vikram Mullachery, Aniruddh Khera, Amir Husain This paper describes and discusses Bayesian Neural Network (BNN). The paper showcases a few different applications of them for classification and regression problems. BNNs are comprised of a Probabilistic Model and a Neural Network. The intent of such a design is to combine the strengths of Neural Networks and Stochastic modeling. Neural Networks exhibit continuous function approximator capabilities. Stochastic models allow direct specification of a model with known interaction between parameters to generate data. During the prediction phase, stochastic models generate a complete posterior distribution and produce probabilistic guarantees on the predictions. Thus BNNs are a unique combination of neural network and stochastic models with the stochastic model forming the core of this integration. BNNs can then produce probabilistic guarantees on it's predictions and also generate the distribution of parameters that it has learnt from the observations. That means, in the parameter space, one can deduce the nature and shape of the neural network's learnt parameters. These two characteristics makes them highly attractive to theoreticians as well as practitioners. Recently there has been a lot of activity in this area, with the advent of numerous probabilistic programming libraries such as: PyMC3, Edward, Stan etc. Further this area is rapidly gaining ground as a standard machine learning approach for numerous problems
How can we interpret a neural network with sgd from a Bayesian perspective? I think you would be interested in "Stochastic Gradient Descent as Approximate Bayesian Inference" by Stephan Mandt, Matthew D. Hoffman, David M. Blei. Stochastic Gradient Descent with a constant le
31,995
How can we interpret a neural network with sgd from a Bayesian perspective?
The Bayesian approach to probabilistic problems often uses graphical models like: $X \sim F(Y)$ $Y \sim G(Z)$ $Z \sim H$ Where one set of observations has a distribution conditional on another. This is most$\dagger$ of what you need for neural networks (survey). For example the model above could describe a single layer network where $Y$ was the activation in the hidden layer, $X$ the observations, and $Z$ a latent class. We'd just be 'hiding' some non-linear transformations in $F$, $G$ etc. It's worth bearing in mind that neural networks $\neq$ gradient descent. Gradient descent is just a particularly effective way of fitting the models. A Bayesian inference technique which leverages the same tools is Variational Bayes. Although there are sampling approaches (HMC, SGLD etc etc.) that can also make use of gradient information. So the difference is that in a Bayesian approach you also get some information about the distribution of your model parameters in addition to a point estimate of them. This could help, e.g. in problems where a peturbation to the parameters would cause a reclassification of an observation which would affect your decision making. $\dagger$ the question arises of how to do things like max pooling, drop out and so forth. Many of these operations have Bayesian analogues in the form of particular distributions or transformations.
How can we interpret a neural network with sgd from a Bayesian perspective?
The Bayesian approach to probabilistic problems often uses graphical models like: $X \sim F(Y)$ $Y \sim G(Z)$ $Z \sim H$ Where one set of observations has a distribution conditional on another. This i
How can we interpret a neural network with sgd from a Bayesian perspective? The Bayesian approach to probabilistic problems often uses graphical models like: $X \sim F(Y)$ $Y \sim G(Z)$ $Z \sim H$ Where one set of observations has a distribution conditional on another. This is most$\dagger$ of what you need for neural networks (survey). For example the model above could describe a single layer network where $Y$ was the activation in the hidden layer, $X$ the observations, and $Z$ a latent class. We'd just be 'hiding' some non-linear transformations in $F$, $G$ etc. It's worth bearing in mind that neural networks $\neq$ gradient descent. Gradient descent is just a particularly effective way of fitting the models. A Bayesian inference technique which leverages the same tools is Variational Bayes. Although there are sampling approaches (HMC, SGLD etc etc.) that can also make use of gradient information. So the difference is that in a Bayesian approach you also get some information about the distribution of your model parameters in addition to a point estimate of them. This could help, e.g. in problems where a peturbation to the parameters would cause a reclassification of an observation which would affect your decision making. $\dagger$ the question arises of how to do things like max pooling, drop out and so forth. Many of these operations have Bayesian analogues in the form of particular distributions or transformations.
How can we interpret a neural network with sgd from a Bayesian perspective? The Bayesian approach to probabilistic problems often uses graphical models like: $X \sim F(Y)$ $Y \sim G(Z)$ $Z \sim H$ Where one set of observations has a distribution conditional on another. This i
31,996
How can we interpret a neural network with sgd from a Bayesian perspective?
The simple, almost generic, answer to such question is that the difference is that Bayesians define models in probabilistic terms, so the parameters are considered as random variables and they assume priors for such parameters. In classical setting, your model has some parameters and you are using some kind of optimization to find such parameters that best fit your data. In neural networks this is done almost exclusively by starting with some randomly initialized parameters and then using some variant of gradient descent to update the parameters, so that the loss is minimized. In Bayesian setting, instead of point estimates of the parameters, we want to estimate the distributions of the parameters, because we consider them to be random variables. This is done by starting with some a priori distributions assumed for the parameters, that are updated using Bayes theorem when confronted with data. This is usually done either with some kind of optimization, or by Markov Chain Monte Carlo sampling (simulating draws from the posterior distribution). So gradient descent is an optimization algorithm, while Bayesian approach is about defining the models differently (see also this comparison of maximum likelihood and gradient descent). Using gradient descent to minimize some kind of loss function does not have much to do with Bayesian approach because it does not consider any priors.
How can we interpret a neural network with sgd from a Bayesian perspective?
The simple, almost generic, answer to such question is that the difference is that Bayesians define models in probabilistic terms, so the parameters are considered as random variables and they assume
How can we interpret a neural network with sgd from a Bayesian perspective? The simple, almost generic, answer to such question is that the difference is that Bayesians define models in probabilistic terms, so the parameters are considered as random variables and they assume priors for such parameters. In classical setting, your model has some parameters and you are using some kind of optimization to find such parameters that best fit your data. In neural networks this is done almost exclusively by starting with some randomly initialized parameters and then using some variant of gradient descent to update the parameters, so that the loss is minimized. In Bayesian setting, instead of point estimates of the parameters, we want to estimate the distributions of the parameters, because we consider them to be random variables. This is done by starting with some a priori distributions assumed for the parameters, that are updated using Bayes theorem when confronted with data. This is usually done either with some kind of optimization, or by Markov Chain Monte Carlo sampling (simulating draws from the posterior distribution). So gradient descent is an optimization algorithm, while Bayesian approach is about defining the models differently (see also this comparison of maximum likelihood and gradient descent). Using gradient descent to minimize some kind of loss function does not have much to do with Bayesian approach because it does not consider any priors.
How can we interpret a neural network with sgd from a Bayesian perspective? The simple, almost generic, answer to such question is that the difference is that Bayesians define models in probabilistic terms, so the parameters are considered as random variables and they assume
31,997
Combining Z Scores by Weighted Average. Sanity Check Please?
The concept you're calling 'exceptionality' is simply a combined variable (via a weighted average) from two or more variables standardized to a Z-score. If there were a way of observing 'exceptionality' as sampled data, you could potentially fit a (standardized) multiple regression with your variables to find the best weights to use. Let's consider two random variables $A$ and $B$, which are standardized to $Z_A$ and $Z_B$ respectively (meaning each follows a standard normal distribution, i.e. mean of 0 and variance of 1). The weighted average of $Z_A$ and $Z_B$, where $w_A$ and $w_B$ are the respective weights for $Z_A$ and $Z_B$, is then: $$ W = \frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B $$ Note that $w_A$ and $w_B$ are constants, whereas $Z_A$ and $Z_B$ are random variables. Therefore, the expected value of $W$ is as follows: $$ \text{E}(W) = \frac{w_A}{w_A+w_B} \cdot \text{E}(Z_A) + \frac{w_B}{w_A+w_B} \cdot \text{E}(Z_B) = 0 $$ The variance of $W$, assuming the independence of $Z_A$ and $Z_B$, is: $$ \text{Var}(W) = \left(\frac{w_A}{w_A+w_B}\right)^2 \cdot \text{Var}(Z_A) + \left(\frac{w_B}{w_A+w_B}\right)^2 \cdot \text{Var}(Z_B) \\ = \left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2 $$ The variance of $W$, depending on the discrepancy between weights $w_A$ and $w_B$, must fall inside the interval $[.5,1)$. Although the mean is 0, because the variance is not 1, $W$ does not follow a standard normal distribution and therefore cannot be treated as a $Z$-score. To make inferences like "a value of $W$ (the weight-averaged Z-scores) $= 1$ is greater than ~84% of observations" would involve having to standardize by dividing $W$ by its standard deviation. Therefore, the Z-score of $W$ becomes: $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2}} $$ A value of $1$ for $Z_W$ would indicate that it's greater than ~84% of observations of $Z_W$. Please let me know if you have any follow-up questions.
Combining Z Scores by Weighted Average. Sanity Check Please?
The concept you're calling 'exceptionality' is simply a combined variable (via a weighted average) from two or more variables standardized to a Z-score. If there were a way of observing 'exceptionali
Combining Z Scores by Weighted Average. Sanity Check Please? The concept you're calling 'exceptionality' is simply a combined variable (via a weighted average) from two or more variables standardized to a Z-score. If there were a way of observing 'exceptionality' as sampled data, you could potentially fit a (standardized) multiple regression with your variables to find the best weights to use. Let's consider two random variables $A$ and $B$, which are standardized to $Z_A$ and $Z_B$ respectively (meaning each follows a standard normal distribution, i.e. mean of 0 and variance of 1). The weighted average of $Z_A$ and $Z_B$, where $w_A$ and $w_B$ are the respective weights for $Z_A$ and $Z_B$, is then: $$ W = \frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B $$ Note that $w_A$ and $w_B$ are constants, whereas $Z_A$ and $Z_B$ are random variables. Therefore, the expected value of $W$ is as follows: $$ \text{E}(W) = \frac{w_A}{w_A+w_B} \cdot \text{E}(Z_A) + \frac{w_B}{w_A+w_B} \cdot \text{E}(Z_B) = 0 $$ The variance of $W$, assuming the independence of $Z_A$ and $Z_B$, is: $$ \text{Var}(W) = \left(\frac{w_A}{w_A+w_B}\right)^2 \cdot \text{Var}(Z_A) + \left(\frac{w_B}{w_A+w_B}\right)^2 \cdot \text{Var}(Z_B) \\ = \left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2 $$ The variance of $W$, depending on the discrepancy between weights $w_A$ and $w_B$, must fall inside the interval $[.5,1)$. Although the mean is 0, because the variance is not 1, $W$ does not follow a standard normal distribution and therefore cannot be treated as a $Z$-score. To make inferences like "a value of $W$ (the weight-averaged Z-scores) $= 1$ is greater than ~84% of observations" would involve having to standardize by dividing $W$ by its standard deviation. Therefore, the Z-score of $W$ becomes: $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2}} $$ A value of $1$ for $Z_W$ would indicate that it's greater than ~84% of observations of $Z_W$. Please let me know if you have any follow-up questions.
Combining Z Scores by Weighted Average. Sanity Check Please? The concept you're calling 'exceptionality' is simply a combined variable (via a weighted average) from two or more variables standardized to a Z-score. If there were a way of observing 'exceptionali
31,998
Combining Z Scores by Weighted Average. Sanity Check Please?
You need to take the square root in the denominator in rpatel's answer. $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2}} $$ The variance of this quantity equals 1.
Combining Z Scores by Weighted Average. Sanity Check Please?
You need to take the square root in the denominator in rpatel's answer. $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\
Combining Z Scores by Weighted Average. Sanity Check Please? You need to take the square root in the denominator in rpatel's answer. $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\frac{w_B}{w_A+w_B}\right)^2}} $$ The variance of this quantity equals 1.
Combining Z Scores by Weighted Average. Sanity Check Please? You need to take the square root in the denominator in rpatel's answer. $$ Z_W = \frac{\frac{w_A}{w_A+w_B} \cdot Z_A + \frac{w_B}{w_A+w_B} \cdot Z_B}{\sqrt{\left(\frac{w_A}{w_A+w_B}\right)^2 + \left(\
31,999
Gradient descent or not for simple linear regression
Linear regression is commonly used as a way to introduce the concept of gradient descent. QR factorization is the most common strategy. SVD and Cholesky factorization are other options. See Do we need gradient descent to find the coefficients of a linear regression model In particular, note that the equations that you have written can evince poor numerical conditioning and/or be expensive to compute. QR factorization is less susceptible to conditioning issues (but not immune) and is not too expensive. Neural networks are the most prominent example of applied use of gradient descent, but it is far from the only example. Another example of a problem that requires iterative updates is logistic regression, which does not allow for direct solutions, so typically Newton-Raphson is used. (But GD or its variants might also be used.)
Gradient descent or not for simple linear regression
Linear regression is commonly used as a way to introduce the concept of gradient descent. QR factorization is the most common strategy. SVD and Cholesky factorization are other options. See Do we nee
Gradient descent or not for simple linear regression Linear regression is commonly used as a way to introduce the concept of gradient descent. QR factorization is the most common strategy. SVD and Cholesky factorization are other options. See Do we need gradient descent to find the coefficients of a linear regression model In particular, note that the equations that you have written can evince poor numerical conditioning and/or be expensive to compute. QR factorization is less susceptible to conditioning issues (but not immune) and is not too expensive. Neural networks are the most prominent example of applied use of gradient descent, but it is far from the only example. Another example of a problem that requires iterative updates is logistic regression, which does not allow for direct solutions, so typically Newton-Raphson is used. (But GD or its variants might also be used.)
Gradient descent or not for simple linear regression Linear regression is commonly used as a way to introduce the concept of gradient descent. QR factorization is the most common strategy. SVD and Cholesky factorization are other options. See Do we nee
32,000
Is neural network able to learn from zero inputs?
You should not confuse a zero value in a node in the input layer (can very well affect the connected nodes to it) with a connection with weight zero (does not affect the node at the end of the connection). He is talking about the former and you seem to have misunderstood it as the second thing. Since with enough layers and nodes a neural network can approximate arbitrarily complex transformations, it can eventually figure out that zeros should be treated totally differently than any other values. In that sense the statement is right, if no observed value can ever be zero. Of course you could use any other value that cannot ever occur in the data. Of course, there may be the question of whether this is the most efficient approach and if you could do some quite good imputation first, that may be a good idea if your training set is quite small. E.g. the neural net may need a lot of training data to learn how to deal with such missing data and it could be problematic if there is no or hardly any missing data in the training data, but then the neural net encounters this in practice. In that case things could go severly wrong - e.g. if the neural net has learnt a somewhat linear relationship between e.g. property size (input) and property value (what we are trying to predict) and in the training data property size was always at least 200 square meters, then I would not want to know what a neural net would predict if you code an unknown property size as 0 (perhaps close to zero value for the property, perhaps a negative value perhaps some quite low positive number, who knows...). On the other hand, if you training data is massively large and any possible missingness occurs in a good number of cases, then this may well no longer be an issue.
Is neural network able to learn from zero inputs?
You should not confuse a zero value in a node in the input layer (can very well affect the connected nodes to it) with a connection with weight zero (does not affect the node at the end of the connect
Is neural network able to learn from zero inputs? You should not confuse a zero value in a node in the input layer (can very well affect the connected nodes to it) with a connection with weight zero (does not affect the node at the end of the connection). He is talking about the former and you seem to have misunderstood it as the second thing. Since with enough layers and nodes a neural network can approximate arbitrarily complex transformations, it can eventually figure out that zeros should be treated totally differently than any other values. In that sense the statement is right, if no observed value can ever be zero. Of course you could use any other value that cannot ever occur in the data. Of course, there may be the question of whether this is the most efficient approach and if you could do some quite good imputation first, that may be a good idea if your training set is quite small. E.g. the neural net may need a lot of training data to learn how to deal with such missing data and it could be problematic if there is no or hardly any missing data in the training data, but then the neural net encounters this in practice. In that case things could go severly wrong - e.g. if the neural net has learnt a somewhat linear relationship between e.g. property size (input) and property value (what we are trying to predict) and in the training data property size was always at least 200 square meters, then I would not want to know what a neural net would predict if you code an unknown property size as 0 (perhaps close to zero value for the property, perhaps a negative value perhaps some quite low positive number, who knows...). On the other hand, if you training data is massively large and any possible missingness occurs in a good number of cases, then this may well no longer be an issue.
Is neural network able to learn from zero inputs? You should not confuse a zero value in a node in the input layer (can very well affect the connected nodes to it) with a connection with weight zero (does not affect the node at the end of the connect