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
13,501
Is building a multiclass classifier better than several binary ones?
Some methods deal well with multiclass, Random Forests, MLPs for example. If you don't want to go that way, then it is possible that ECOC may well out perform 1-vs-All for your problem, only testing will tell.
Is building a multiclass classifier better than several binary ones?
Some methods deal well with multiclass, Random Forests, MLPs for example. If you don't want to go that way, then it is possible that ECOC may well out perform 1-vs-All for your problem, only testing w
Is building a multiclass classifier better than several binary ones? Some methods deal well with multiclass, Random Forests, MLPs for example. If you don't want to go that way, then it is possible that ECOC may well out perform 1-vs-All for your problem, only testing will tell.
Is building a multiclass classifier better than several binary ones? Some methods deal well with multiclass, Random Forests, MLPs for example. If you don't want to go that way, then it is possible that ECOC may well out perform 1-vs-All for your problem, only testing w
13,502
How can I estimate unique occurrence counts from a random sampling of data?
Here is a whole paper about the problem, with a summary of various approaches. It's called Distinct Value Estimation in the literature. If I had to do this myself, without having read fancy papers, I'd do this. In building language models, one often has to estimate the probability of observing a previously unknown word, given a bunch of text. A pretty good approach at solving this problem for language models in particular is to use the number of words that occurred exactly once, divided by the total number of tokens. It's called the Good Turing Estimate. Let u1 be the number of values that occurred exactly once in a sample of m items. P[new item next] ~= u1 / m. Let u be the number of unique items in your sample of size m. If you mistakenly assume that the 'new item next' rate didn't decrease as you got more data, then using Good Turing, you'll have total uniq set of size s ~= u + u1 / m * (s - m) This has some nasty behavior as u1 becomes really small, but that might not be a problem for you in practice.
How can I estimate unique occurrence counts from a random sampling of data?
Here is a whole paper about the problem, with a summary of various approaches. It's called Distinct Value Estimation in the literature. If I had to do this myself, without having read fancy papers, I
How can I estimate unique occurrence counts from a random sampling of data? Here is a whole paper about the problem, with a summary of various approaches. It's called Distinct Value Estimation in the literature. If I had to do this myself, without having read fancy papers, I'd do this. In building language models, one often has to estimate the probability of observing a previously unknown word, given a bunch of text. A pretty good approach at solving this problem for language models in particular is to use the number of words that occurred exactly once, divided by the total number of tokens. It's called the Good Turing Estimate. Let u1 be the number of values that occurred exactly once in a sample of m items. P[new item next] ~= u1 / m. Let u be the number of unique items in your sample of size m. If you mistakenly assume that the 'new item next' rate didn't decrease as you got more data, then using Good Turing, you'll have total uniq set of size s ~= u + u1 / m * (s - m) This has some nasty behavior as u1 becomes really small, but that might not be a problem for you in practice.
How can I estimate unique occurrence counts from a random sampling of data? Here is a whole paper about the problem, with a summary of various approaches. It's called Distinct Value Estimation in the literature. If I had to do this myself, without having read fancy papers, I
13,503
How can I estimate unique occurrence counts from a random sampling of data?
There is a python package estndv for this task. For example, your sample is [1,1,1,3,5,5,12] and the original large set has 100000 values: from estndv import ndvEstimator estimator = ndvEstimator() ndv = estimator.sample_predict(S=[1,1,1,3,5,5,12], N=100000) ndv is the estimated number of unique/distinct values for the large set. This method achieves the best results on sampled-based estimation for the number of unique values, see the paper: https://vldb.org/pvldb/vol15/p272-wu.pdf
How can I estimate unique occurrence counts from a random sampling of data?
There is a python package estndv for this task. For example, your sample is [1,1,1,3,5,5,12] and the original large set has 100000 values: from estndv import ndvEstimator estimator = ndvEstimator() nd
How can I estimate unique occurrence counts from a random sampling of data? There is a python package estndv for this task. For example, your sample is [1,1,1,3,5,5,12] and the original large set has 100000 values: from estndv import ndvEstimator estimator = ndvEstimator() ndv = estimator.sample_predict(S=[1,1,1,3,5,5,12], N=100000) ndv is the estimated number of unique/distinct values for the large set. This method achieves the best results on sampled-based estimation for the number of unique values, see the paper: https://vldb.org/pvldb/vol15/p272-wu.pdf
How can I estimate unique occurrence counts from a random sampling of data? There is a python package estndv for this task. For example, your sample is [1,1,1,3,5,5,12] and the original large set has 100000 values: from estndv import ndvEstimator estimator = ndvEstimator() nd
13,504
How can I estimate unique occurrence counts from a random sampling of data?
The simulation strategy Collect m random samples of size n from the set S. For each of the m samples, compute the number u of unique values and divide by n to normalize. From the simulated distribution of normalized u, compute summary statistics of interest (e.g., mean, variance, interquartile range). Multiply the simulated mean of normalized u by the cardinality of S to estimate the number of unique values. The greater are m and n, the more closely your simulated mean will match the true number of unique values.
How can I estimate unique occurrence counts from a random sampling of data?
The simulation strategy Collect m random samples of size n from the set S. For each of the m samples, compute the number u of unique values and divide by n to normalize. From the simulated distributio
How can I estimate unique occurrence counts from a random sampling of data? The simulation strategy Collect m random samples of size n from the set S. For each of the m samples, compute the number u of unique values and divide by n to normalize. From the simulated distribution of normalized u, compute summary statistics of interest (e.g., mean, variance, interquartile range). Multiply the simulated mean of normalized u by the cardinality of S to estimate the number of unique values. The greater are m and n, the more closely your simulated mean will match the true number of unique values.
How can I estimate unique occurrence counts from a random sampling of data? The simulation strategy Collect m random samples of size n from the set S. For each of the m samples, compute the number u of unique values and divide by n to normalize. From the simulated distributio
13,505
How can I estimate unique occurrence counts from a random sampling of data?
Here's an implementation for pandas: import math import numpy as np from collections import Counter def estimate_uniqueness(df, col, r=10000, n=None): """ Draws a sample of size r from column col from dataframe df and returns an estimate for the number of unique values given a population size of n """ n = n or df.shape[0] sample = df[col][np.random.randint(0, n, r)] counts = sample.value_counts() fis = Counter(counts) estimate = math.sqrt(n / r) * fis[1] + sum([fis[x] for x in fis if x > 1]) return estimate Relies on Section 2 and 4 of this paper: http://ftp.cse.buffalo.edu/users/azhang/disc/disc01/cd1/out/papers/pods/towardsestimatimosur.pdf
How can I estimate unique occurrence counts from a random sampling of data?
Here's an implementation for pandas: import math import numpy as np from collections import Counter def estimate_uniqueness(df, col, r=10000, n=None): """ Draws a sample of size r from column col
How can I estimate unique occurrence counts from a random sampling of data? Here's an implementation for pandas: import math import numpy as np from collections import Counter def estimate_uniqueness(df, col, r=10000, n=None): """ Draws a sample of size r from column col from dataframe df and returns an estimate for the number of unique values given a population size of n """ n = n or df.shape[0] sample = df[col][np.random.randint(0, n, r)] counts = sample.value_counts() fis = Counter(counts) estimate = math.sqrt(n / r) * fis[1] + sum([fis[x] for x in fis if x > 1]) return estimate Relies on Section 2 and 4 of this paper: http://ftp.cse.buffalo.edu/users/azhang/disc/disc01/cd1/out/papers/pods/towardsestimatimosur.pdf
How can I estimate unique occurrence counts from a random sampling of data? Here's an implementation for pandas: import math import numpy as np from collections import Counter def estimate_uniqueness(df, col, r=10000, n=None): """ Draws a sample of size r from column col
13,506
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I finally found a way and documented it on my blog here. There is comparison of several frameworks and then also one implementation in Keras.
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I finally found a way and documented it on my blog here. There is comparison of several frameworks and then also one implementation in Keras.
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I finally found a way and documented it on my blog here. There is comparison of several frameworks and then also one implementation in Keras.
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I finally found a way and documented it on my blog here. There is comparison of several frameworks and then also one implementation in Keras.
13,507
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I would suggest the following: Theano is really powerful but yes the cod can be difficult sometimes to start with I would suggest you to check out breze: https://github.com/breze-no-salt/breze/blob/master/notebooks/recurrent-networks/RNNs%20for%20Piano%20music.ipynb which is slightly easier to be understood and has an LSTM module as well. Furthermore, an intresting choice is autograd by Harvards, which does automatic symbolic differentiation of numpy functions https://github.com/HIPS/autograd/blob/master/examples/lstm.py and therefore you can easily understand whats going on. I'm a python fan but this is my personal preference. Have you considered using Torch7 is the most user-friendly framework for neural networks and is also used by Google Deepmind and Facebook AI? You can check this very interesting blog post about RNNs http://karpathy.github.io/2015/05/21/rnn-effectiveness/. Additionally, an LSTM implementation is available in the github repo of the post, while an alternative is the rnn package https://github.com/Element-Research/rnn.
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I would suggest the following: Theano is really powerful but yes the cod can be difficult sometimes to start with I would suggest you to check out breze: https://github.com/breze-no-salt/breze/blob/
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I would suggest the following: Theano is really powerful but yes the cod can be difficult sometimes to start with I would suggest you to check out breze: https://github.com/breze-no-salt/breze/blob/master/notebooks/recurrent-networks/RNNs%20for%20Piano%20music.ipynb which is slightly easier to be understood and has an LSTM module as well. Furthermore, an intresting choice is autograd by Harvards, which does automatic symbolic differentiation of numpy functions https://github.com/HIPS/autograd/blob/master/examples/lstm.py and therefore you can easily understand whats going on. I'm a python fan but this is my personal preference. Have you considered using Torch7 is the most user-friendly framework for neural networks and is also used by Google Deepmind and Facebook AI? You can check this very interesting blog post about RNNs http://karpathy.github.io/2015/05/21/rnn-effectiveness/. Additionally, an LSTM implementation is available in the github repo of the post, while an alternative is the rnn package https://github.com/Element-Research/rnn.
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I would suggest the following: Theano is really powerful but yes the cod can be difficult sometimes to start with I would suggest you to check out breze: https://github.com/breze-no-salt/breze/blob/
13,508
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I have tested LSTM predicting some time sequence with Theano. I found that for some smooth curve, it can be predicted properly. However for some zigzag curve . It's hard to predict. The detailed article are as below: Predict Time Sequence with LSTM The predicted result can be shown as follow:
Using RNN (LSTM) for predicting the timeseries vectors (Theano)
I have tested LSTM predicting some time sequence with Theano. I found that for some smooth curve, it can be predicted properly. However for some zigzag curve . It's hard to predict. The detailed artic
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I have tested LSTM predicting some time sequence with Theano. I found that for some smooth curve, it can be predicted properly. However for some zigzag curve . It's hard to predict. The detailed article are as below: Predict Time Sequence with LSTM The predicted result can be shown as follow:
Using RNN (LSTM) for predicting the timeseries vectors (Theano) I have tested LSTM predicting some time sequence with Theano. I found that for some smooth curve, it can be predicted properly. However for some zigzag curve . It's hard to predict. The detailed artic
13,509
What is the difference between conditioning on regressors vs. treating them as fixed?
Here I am on thin ice but let me try: I have a feeling (please comment!) that a main difference between statistics and econometrics is that in statistics we tend to consider the regressors as fixed, hence the terminology design matrix which obviously comes from design of experiments, where the supposition is that we are first choosing and then fixing the explanatory variables. But for most data sets, most situations, this is a bad fit. We are really observing the explanatory variables, and in that sense they stand at the same footing as the response variables, they are both determined by some random process outside our control. By considering the $x$'s as "fixed", we decide not to consider a lot of problems which that might cause. By considering the regressors as stochastic, on the other hand, as econometricians tend to do, we open the possibility of modeling which try to consider such problems. A short list of problems we then might consider, and incorporate into the modeling, is: measurement errors in the regressors. correlations between regressors and error terms. lagged response as regressor, see Inclusion of lagged dependent variable in regression. ... Probably, that should be done much more frequently that it is done today? Another point of view is that models are only approximations and inference should admit that. The very interesting paper The Conspiracy of Random Predictors and Model Violations against Classical Inference in Regression by A. Buja et.al. takes this point of view and argues that nonlinearities (not modeled explicitely) destroys the ancillarity argument given below. EDIT I will try to flesh out an argument for conditioning on regressors somewhat more formally. Let $(Y,X)$ be a random vector, and interest is in regression $Y$ on $X$, where regression is taken to mean the conditional expectation of $Y$ on $X$. Under multinormal assumptions that will be a linear function, but our arguments do not depend on that. We start with factoring the joint density in the usual way $$ f(y,x) = f(y\mid x) f(x) $$ but those functions are not known so we use a parameterized model $$ f(y,x; \theta, \psi)=f_\theta(y \mid x) f_\psi(x) $$ where $\theta$ parameterizes the conditional distribution and $\psi$ the marginal distribution of $X$. In the normal linear model we can have $\theta=(\beta, \sigma^2)$ but that is not assumed. The full parameter space of $(\theta,\psi)$ is $\Theta \times \Psi$, a Cartesian product, and the two parameters have no part in common. This can be interpreted as a factorization of the statistical experiment, (or of the data generation process, DGP), first $X$ is generated according to $f_\psi(x)$, and as a second step, $Y$ is generated according to the conditional density $f_\theta(y \mid X=x)$. Note that the first step does not use any knowledge about $\theta$, that enters only in the second step. The statistic $X$ is ancillary for $\theta$, see https://en.wikipedia.org/wiki/Ancillary_statistic. But, depending on the results of the first step, the second step could be more or less informative about $\theta$. If the distribution given by $f_\psi(x)$ have very low variance, say, the observed $x$'s will be concentrated in a small region, so it will be more difficult to estimate $\theta$. So, the first part of this two-step experiment determines the precision with which $\theta$ can be estimated. Therefore it is natural to condition on $X=x$ in inference about the regression parameters. That is the conditionality argument, and the outline above makes clear its assumptions. In designed experiments its assumption will mostly hold, often with observational data not. Some examples of problems will be: regression with lagged responses as predictors. Conditioning on the predictors in this case will also condition on the response! (I will add more examples). One book which discusses this problems in a lot of detail is Information and exponential families: In statistical theory by O. E Barndorff-Nielsen. See especially chapter 4. The author says the separation logic in this situation is however seldom explicated but gives the following references: R A Fisher (1956) Statistical Methods and Scientific Inference $\S 4.3$ and Sverdrup (1966) The present state of the decision theory and the Neyman-Pearson theory.
What is the difference between conditioning on regressors vs. treating them as fixed?
Here I am on thin ice but let me try: I have a feeling (please comment!) that a main difference between statistics and econometrics is that in statistics we tend to consider the regressors as fixed,
What is the difference between conditioning on regressors vs. treating them as fixed? Here I am on thin ice but let me try: I have a feeling (please comment!) that a main difference between statistics and econometrics is that in statistics we tend to consider the regressors as fixed, hence the terminology design matrix which obviously comes from design of experiments, where the supposition is that we are first choosing and then fixing the explanatory variables. But for most data sets, most situations, this is a bad fit. We are really observing the explanatory variables, and in that sense they stand at the same footing as the response variables, they are both determined by some random process outside our control. By considering the $x$'s as "fixed", we decide not to consider a lot of problems which that might cause. By considering the regressors as stochastic, on the other hand, as econometricians tend to do, we open the possibility of modeling which try to consider such problems. A short list of problems we then might consider, and incorporate into the modeling, is: measurement errors in the regressors. correlations between regressors and error terms. lagged response as regressor, see Inclusion of lagged dependent variable in regression. ... Probably, that should be done much more frequently that it is done today? Another point of view is that models are only approximations and inference should admit that. The very interesting paper The Conspiracy of Random Predictors and Model Violations against Classical Inference in Regression by A. Buja et.al. takes this point of view and argues that nonlinearities (not modeled explicitely) destroys the ancillarity argument given below. EDIT I will try to flesh out an argument for conditioning on regressors somewhat more formally. Let $(Y,X)$ be a random vector, and interest is in regression $Y$ on $X$, where regression is taken to mean the conditional expectation of $Y$ on $X$. Under multinormal assumptions that will be a linear function, but our arguments do not depend on that. We start with factoring the joint density in the usual way $$ f(y,x) = f(y\mid x) f(x) $$ but those functions are not known so we use a parameterized model $$ f(y,x; \theta, \psi)=f_\theta(y \mid x) f_\psi(x) $$ where $\theta$ parameterizes the conditional distribution and $\psi$ the marginal distribution of $X$. In the normal linear model we can have $\theta=(\beta, \sigma^2)$ but that is not assumed. The full parameter space of $(\theta,\psi)$ is $\Theta \times \Psi$, a Cartesian product, and the two parameters have no part in common. This can be interpreted as a factorization of the statistical experiment, (or of the data generation process, DGP), first $X$ is generated according to $f_\psi(x)$, and as a second step, $Y$ is generated according to the conditional density $f_\theta(y \mid X=x)$. Note that the first step does not use any knowledge about $\theta$, that enters only in the second step. The statistic $X$ is ancillary for $\theta$, see https://en.wikipedia.org/wiki/Ancillary_statistic. But, depending on the results of the first step, the second step could be more or less informative about $\theta$. If the distribution given by $f_\psi(x)$ have very low variance, say, the observed $x$'s will be concentrated in a small region, so it will be more difficult to estimate $\theta$. So, the first part of this two-step experiment determines the precision with which $\theta$ can be estimated. Therefore it is natural to condition on $X=x$ in inference about the regression parameters. That is the conditionality argument, and the outline above makes clear its assumptions. In designed experiments its assumption will mostly hold, often with observational data not. Some examples of problems will be: regression with lagged responses as predictors. Conditioning on the predictors in this case will also condition on the response! (I will add more examples). One book which discusses this problems in a lot of detail is Information and exponential families: In statistical theory by O. E Barndorff-Nielsen. See especially chapter 4. The author says the separation logic in this situation is however seldom explicated but gives the following references: R A Fisher (1956) Statistical Methods and Scientific Inference $\S 4.3$ and Sverdrup (1966) The present state of the decision theory and the Neyman-Pearson theory.
What is the difference between conditioning on regressors vs. treating them as fixed? Here I am on thin ice but let me try: I have a feeling (please comment!) that a main difference between statistics and econometrics is that in statistics we tend to consider the regressors as fixed,
13,510
What is the difference between conditioning on regressors vs. treating them as fixed?
+1 to Kjetil b halvorsen. His answers are enlightening and this one is no exception. I do think that there is something additional to be contributed here because the question asks about "treating regressors as fixed" (as in a hypothetical intervention to use Pearl's language) but also touches on "fixing the regressors" (as in a real design experiment). This is where it gets confusing. Let's distinguish between 3 different paradigms: You design an experiment. You will set the level of fertilizer to either 1, 2, 3 units (this is the regressor) and then observe the yield (this is the outcome variable). This is a REAL experiment. You performed it. The regressor in this case is non-random because you determined how much fertilizer to put on each plot and not the roll of a dice or some other random experiment. You have an observational dataset on yield and fertilizer and you are not sure how yield was assigned to the plots, so you cannot assume that it was assigned randomly. You are interested in $E[$yield|fertilizer$=3]-E[$yield|fertilizer$=2]$. This amounts to a filtering of your dataset to the plots that were assigned 3 units of fertilizer and calculating their average yield then filtering the dataset to the plots that were assigned 2 units of fertilizer and calculating their average yield and then take the difference of the 2 averages. In this case conditioning amounts to filtering. It is key to note that this is not the causal effect of increasing fertilizer from 2 to 3. It is just a summary of your existing dataset. You have an observational dataset on yield and fertilizer and you do know that plots in sunnier areas were applied more fertilizer and your knowledge of agriculture tells you that more sun translates into a higher yield. Suppose that nothing else determined jointly both how the fertilizer was assigned and the outcome, so that you can assume that your causal DAG is complete and correct. Suppose you are interested in the causal effect of fertilizer on yield when the amount of fertilizer was increased from 2 to 3. Using Judea Pearl's do operator this question can be equivalently written as: $$E[yield|do(fertilizer=3)]-E[yield|do(fertilizer=2)]$$ In words, this question asks for the difference in the average yield if we performed a hypothetical experiment in which we first assigned every plot 2 units of fertilizer and computed the average yield, then applied every plot 3 units of fertilizer and computer the average yield and then took the difference between these 2 averages. To answer this question we'll have to condition Y=yield on both X=fertilizer and Z=sunniness of the plot. In the 3rd case, you are imagining an alternative world, different that reality; you are imagining something counterfactual. This is where you imagine a world in which the level of the regressor had been fixed to a particular value. In the 2nd case, you accept/observe the reality as is and want to summarize it. The regressor is random and you condition on it to get a summary of your filtered dataset. In the 1st case you create the reality. You fix the regressors in the real world and will have to get some dust on your boots as well because you are actually performing the experiment. That is not quite correct. When regressors are deterministic/non-random, yes they are not random variables. However, the OLS estimators are still very much random variables because they are linear combinations of $Y_i$, and the $Y_i$ are random variables (even if all regressors are deterministic) because $\epsilon_i$ are random variables. Yes, when x is non-random: $$E[Y|x]=\beta_0+\beta_1x+E[\epsilon|x]=\beta_0+\beta_1x+E[\epsilon]=E[Y]$$ but when X is random: $$E[Y|X]=\beta_0+\beta_1X+E[\epsilon|X]\not=\beta_0+\beta_1E[X]+E[\epsilon]=E[Y]$$ This is a key difference.
What is the difference between conditioning on regressors vs. treating them as fixed?
+1 to Kjetil b halvorsen. His answers are enlightening and this one is no exception. I do think that there is something additional to be contributed here because the question asks about "treating regr
What is the difference between conditioning on regressors vs. treating them as fixed? +1 to Kjetil b halvorsen. His answers are enlightening and this one is no exception. I do think that there is something additional to be contributed here because the question asks about "treating regressors as fixed" (as in a hypothetical intervention to use Pearl's language) but also touches on "fixing the regressors" (as in a real design experiment). This is where it gets confusing. Let's distinguish between 3 different paradigms: You design an experiment. You will set the level of fertilizer to either 1, 2, 3 units (this is the regressor) and then observe the yield (this is the outcome variable). This is a REAL experiment. You performed it. The regressor in this case is non-random because you determined how much fertilizer to put on each plot and not the roll of a dice or some other random experiment. You have an observational dataset on yield and fertilizer and you are not sure how yield was assigned to the plots, so you cannot assume that it was assigned randomly. You are interested in $E[$yield|fertilizer$=3]-E[$yield|fertilizer$=2]$. This amounts to a filtering of your dataset to the plots that were assigned 3 units of fertilizer and calculating their average yield then filtering the dataset to the plots that were assigned 2 units of fertilizer and calculating their average yield and then take the difference of the 2 averages. In this case conditioning amounts to filtering. It is key to note that this is not the causal effect of increasing fertilizer from 2 to 3. It is just a summary of your existing dataset. You have an observational dataset on yield and fertilizer and you do know that plots in sunnier areas were applied more fertilizer and your knowledge of agriculture tells you that more sun translates into a higher yield. Suppose that nothing else determined jointly both how the fertilizer was assigned and the outcome, so that you can assume that your causal DAG is complete and correct. Suppose you are interested in the causal effect of fertilizer on yield when the amount of fertilizer was increased from 2 to 3. Using Judea Pearl's do operator this question can be equivalently written as: $$E[yield|do(fertilizer=3)]-E[yield|do(fertilizer=2)]$$ In words, this question asks for the difference in the average yield if we performed a hypothetical experiment in which we first assigned every plot 2 units of fertilizer and computed the average yield, then applied every plot 3 units of fertilizer and computer the average yield and then took the difference between these 2 averages. To answer this question we'll have to condition Y=yield on both X=fertilizer and Z=sunniness of the plot. In the 3rd case, you are imagining an alternative world, different that reality; you are imagining something counterfactual. This is where you imagine a world in which the level of the regressor had been fixed to a particular value. In the 2nd case, you accept/observe the reality as is and want to summarize it. The regressor is random and you condition on it to get a summary of your filtered dataset. In the 1st case you create the reality. You fix the regressors in the real world and will have to get some dust on your boots as well because you are actually performing the experiment. That is not quite correct. When regressors are deterministic/non-random, yes they are not random variables. However, the OLS estimators are still very much random variables because they are linear combinations of $Y_i$, and the $Y_i$ are random variables (even if all regressors are deterministic) because $\epsilon_i$ are random variables. Yes, when x is non-random: $$E[Y|x]=\beta_0+\beta_1x+E[\epsilon|x]=\beta_0+\beta_1x+E[\epsilon]=E[Y]$$ but when X is random: $$E[Y|X]=\beta_0+\beta_1X+E[\epsilon|X]\not=\beta_0+\beta_1E[X]+E[\epsilon]=E[Y]$$ This is a key difference.
What is the difference between conditioning on regressors vs. treating them as fixed? +1 to Kjetil b halvorsen. His answers are enlightening and this one is no exception. I do think that there is something additional to be contributed here because the question asks about "treating regr
13,511
How and when to use the Bonferroni adjustment
The Bonferroni adjustment will always provide strong control of the family-wise error rate. This means that, whatever the nature and number of the tests, or the relationships between them, if their assumptions are met, it will ensure that the probability of having even one erroneous significant result among all tests is at most $\alpha$, your original error level. It is therefore always available. Whether it is appropriate to use it (as opposed to another method or perhaps no adjustment at all) depends on your objectives, the standards of your discipline and the availability of better methods for your specific situation. At the very least, you should probably consider the Holm-Bonferroni method, which is just as general but less conservative. Regarding your example, since you are performing several tests, you are increasing the family-wise error rate (the probability of rejecting at least one null hypothesis erroneously). If you only perform one test on each half, many adjustments would be possible including Hommel's method or methods controlling the false discovery rate (which is different from the family-wise error rate). If you conduct a test on the whole data set followed by several sub-tests, the tests are no longer independent so some methods are no longer appropriate. As I said before, Bonferroni is in any case always available and guaranteed to work as advertised (but also to be very conservative…). You could also just ignore the whole issue. Formally, the family-wise error rate is higher but with only two tests it's still not so bad. You could also start with a test on the whole data set, treated as the main outcome, followed by sub-tests for different groups, uncorrected because they are understood as secondary outcomes or ancillary hypotheses. If you consider many demographic variables in that way (as opposed to just planning to test for gender differences from the get go or perhaps a more systematic modeling approach), the problem becomes more serious with a significant risk of “data dredging” (one difference comes out significant by chance allowing you to rescue an inconclusive experiment with some nice story about the demographic variable to boot whereas in fact nothing really happened) and you should definitely consider some form of adjustment for multiple testing. The logic remains the same with X different hypotheses (testing X hypotheses twice – one on each half of the data set – entails a higher family-wise error rate than testing X hypotheses only once and you should probably adjust for that).
How and when to use the Bonferroni adjustment
The Bonferroni adjustment will always provide strong control of the family-wise error rate. This means that, whatever the nature and number of the tests, or the relationships between them, if their as
How and when to use the Bonferroni adjustment The Bonferroni adjustment will always provide strong control of the family-wise error rate. This means that, whatever the nature and number of the tests, or the relationships between them, if their assumptions are met, it will ensure that the probability of having even one erroneous significant result among all tests is at most $\alpha$, your original error level. It is therefore always available. Whether it is appropriate to use it (as opposed to another method or perhaps no adjustment at all) depends on your objectives, the standards of your discipline and the availability of better methods for your specific situation. At the very least, you should probably consider the Holm-Bonferroni method, which is just as general but less conservative. Regarding your example, since you are performing several tests, you are increasing the family-wise error rate (the probability of rejecting at least one null hypothesis erroneously). If you only perform one test on each half, many adjustments would be possible including Hommel's method or methods controlling the false discovery rate (which is different from the family-wise error rate). If you conduct a test on the whole data set followed by several sub-tests, the tests are no longer independent so some methods are no longer appropriate. As I said before, Bonferroni is in any case always available and guaranteed to work as advertised (but also to be very conservative…). You could also just ignore the whole issue. Formally, the family-wise error rate is higher but with only two tests it's still not so bad. You could also start with a test on the whole data set, treated as the main outcome, followed by sub-tests for different groups, uncorrected because they are understood as secondary outcomes or ancillary hypotheses. If you consider many demographic variables in that way (as opposed to just planning to test for gender differences from the get go or perhaps a more systematic modeling approach), the problem becomes more serious with a significant risk of “data dredging” (one difference comes out significant by chance allowing you to rescue an inconclusive experiment with some nice story about the demographic variable to boot whereas in fact nothing really happened) and you should definitely consider some form of adjustment for multiple testing. The logic remains the same with X different hypotheses (testing X hypotheses twice – one on each half of the data set – entails a higher family-wise error rate than testing X hypotheses only once and you should probably adjust for that).
How and when to use the Bonferroni adjustment The Bonferroni adjustment will always provide strong control of the family-wise error rate. This means that, whatever the nature and number of the tests, or the relationships between them, if their as
13,512
How and when to use the Bonferroni adjustment
I was looking at the same issue and found a text in the book: A copy of the relevant chapter is freely available here: http://www.utdallas.edu/~herve/Abdi-Bonferroni2007-pretty.pdf it discusses how the Bonferonni correction can be applied in different circumstances (i.e. independent and non-independent tests) and briefly mentions some alternatives. It also mentions that, when the number of comparisons you test becomes large, the test may become too conservative and no longer allows you to find anything significant (if you were to do 10 comparisons you'd have to to $α[PT]= 1-(1-0.05)^(1/10) = 0.0051$, for 20 tests that's 0.002, etc.) To be fair, I have looked at many different economic/ econometric articles for my current research project and in that limited experience I haven't come across many articles applying such corrections when comparing 2-5 tests.
How and when to use the Bonferroni adjustment
I was looking at the same issue and found a text in the book: A copy of the relevant chapter is freely available here: http://www.utdallas.edu/~herve/Abdi-Bonferroni2007-pretty.pdf it discusses how th
How and when to use the Bonferroni adjustment I was looking at the same issue and found a text in the book: A copy of the relevant chapter is freely available here: http://www.utdallas.edu/~herve/Abdi-Bonferroni2007-pretty.pdf it discusses how the Bonferonni correction can be applied in different circumstances (i.e. independent and non-independent tests) and briefly mentions some alternatives. It also mentions that, when the number of comparisons you test becomes large, the test may become too conservative and no longer allows you to find anything significant (if you were to do 10 comparisons you'd have to to $α[PT]= 1-(1-0.05)^(1/10) = 0.0051$, for 20 tests that's 0.002, etc.) To be fair, I have looked at many different economic/ econometric articles for my current research project and in that limited experience I haven't come across many articles applying such corrections when comparing 2-5 tests.
How and when to use the Bonferroni adjustment I was looking at the same issue and found a text in the book: A copy of the relevant chapter is freely available here: http://www.utdallas.edu/~herve/Abdi-Bonferroni2007-pretty.pdf it discusses how th
13,513
How and when to use the Bonferroni adjustment
You must remember that medical data and scientific data are irreconcilably different in that heteroscedastic medical data is never experimental unlike homoscedastic biological data. Recall also that many discussions on role of power testing and Bonferroni type corrections involve only speculations on the nature of unknowable alternate distribtions. Setting beta in a power calculation is an arbitrary procedure. None of the medical statisticians advertise this. Second, if there is autocorrelation of (within) data samples the Central Limit Theorem has been violated and Normal based Gaussian testing is not valid. Third, recall that the Normal Distribution is becoming outmoded in the sense that many medical phenomena are fractal based distributions that possess neither finite means and/or finite variances (Cauchy-type distributions) and require fractal resistant statistical analyses. Carrying out any post-hoc anslysis drpending on what you find during early analysis is improper. Finally, between-subject bijectivity is not necessarily valid and the conditions for Bonferroni corrections are important elements to be uniquely teased out during a priori Experimental Design only. Nigel T. James. MB BChir, (UK medical degrees), MSc (in Applied Statistics).
How and when to use the Bonferroni adjustment
You must remember that medical data and scientific data are irreconcilably different in that heteroscedastic medical data is never experimental unlike homoscedastic biological data. Recall also that m
How and when to use the Bonferroni adjustment You must remember that medical data and scientific data are irreconcilably different in that heteroscedastic medical data is never experimental unlike homoscedastic biological data. Recall also that many discussions on role of power testing and Bonferroni type corrections involve only speculations on the nature of unknowable alternate distribtions. Setting beta in a power calculation is an arbitrary procedure. None of the medical statisticians advertise this. Second, if there is autocorrelation of (within) data samples the Central Limit Theorem has been violated and Normal based Gaussian testing is not valid. Third, recall that the Normal Distribution is becoming outmoded in the sense that many medical phenomena are fractal based distributions that possess neither finite means and/or finite variances (Cauchy-type distributions) and require fractal resistant statistical analyses. Carrying out any post-hoc anslysis drpending on what you find during early analysis is improper. Finally, between-subject bijectivity is not necessarily valid and the conditions for Bonferroni corrections are important elements to be uniquely teased out during a priori Experimental Design only. Nigel T. James. MB BChir, (UK medical degrees), MSc (in Applied Statistics).
How and when to use the Bonferroni adjustment You must remember that medical data and scientific data are irreconcilably different in that heteroscedastic medical data is never experimental unlike homoscedastic biological data. Recall also that m
13,514
Does BIC try to find a true model?
The Information Criterion by Schwarz (1978) was designed with the feature that it asymptotically chooses the model with the higher posterior odds, i.e. the model with the higher likelihood given the data under equal priors. So roughly $$ \frac{p(M_1|y)}{p(M_2|y)} > 1 \overset{A}{\sim} SIC(M_1) < SIC(M_2) $$ where $\overset{A}{\sim}$ denotes "asymptotically equivalent" and $p(M_j|y)$ is the posterior of model $j$ given data $y$. I do not see how this result would depend on model 1 being true (is there even a true model in a Bayesian framework?). What I think is responsible for the confusion is that the SIC has the other nice feature that, under certain conditions, it will asymptotically select the "true" model if the latter is within the model universe. Both AIC and SIC are special cases of the criterion $$ IC(k) = -\frac{2}{T} \mathcal{l}(\hat{\theta};y) + k g(T) $$ where $\mathcal{l}(\hat{\theta};y)$ is the log likelihood of the parameter estimates $\hat{\theta}$, $k$ is the number of parameters and $T$ is the sample size. When the model universe consists of linear, Gaussian models, it can be shown that we need: $$ g(T) \to 0 \; \text{as} \;\infty $$ for the IC not to select a model that is smaller than the true model with probability one and $$ Tg(T) \to \infty \; \text{as} \;\infty $$ for the IC not to select a model that is larger than the true model with probability one. We have that $$ g_{AIC}(T) = \frac{2}{T},\;\; g_{SIC}(T) = \frac{\ln{T}}{T} $$ So SIC fulfills both conditions while AIC fulfills the first, but not the second condition. For a very accessible exposition of these features and a discussion of practical implications, see Chapter 6 of this book. Elliott, G. and A. Timmermann (2016, April). Economic Forecasting. Princeton University Press. Schwarz, Gideon. "Estimating the dimension of a model." The annals of statistics 6.2 (1978): 461-464.
Does BIC try to find a true model?
The Information Criterion by Schwarz (1978) was designed with the feature that it asymptotically chooses the model with the higher posterior odds, i.e. the model with the higher likelihood given the d
Does BIC try to find a true model? The Information Criterion by Schwarz (1978) was designed with the feature that it asymptotically chooses the model with the higher posterior odds, i.e. the model with the higher likelihood given the data under equal priors. So roughly $$ \frac{p(M_1|y)}{p(M_2|y)} > 1 \overset{A}{\sim} SIC(M_1) < SIC(M_2) $$ where $\overset{A}{\sim}$ denotes "asymptotically equivalent" and $p(M_j|y)$ is the posterior of model $j$ given data $y$. I do not see how this result would depend on model 1 being true (is there even a true model in a Bayesian framework?). What I think is responsible for the confusion is that the SIC has the other nice feature that, under certain conditions, it will asymptotically select the "true" model if the latter is within the model universe. Both AIC and SIC are special cases of the criterion $$ IC(k) = -\frac{2}{T} \mathcal{l}(\hat{\theta};y) + k g(T) $$ where $\mathcal{l}(\hat{\theta};y)$ is the log likelihood of the parameter estimates $\hat{\theta}$, $k$ is the number of parameters and $T$ is the sample size. When the model universe consists of linear, Gaussian models, it can be shown that we need: $$ g(T) \to 0 \; \text{as} \;\infty $$ for the IC not to select a model that is smaller than the true model with probability one and $$ Tg(T) \to \infty \; \text{as} \;\infty $$ for the IC not to select a model that is larger than the true model with probability one. We have that $$ g_{AIC}(T) = \frac{2}{T},\;\; g_{SIC}(T) = \frac{\ln{T}}{T} $$ So SIC fulfills both conditions while AIC fulfills the first, but not the second condition. For a very accessible exposition of these features and a discussion of practical implications, see Chapter 6 of this book. Elliott, G. and A. Timmermann (2016, April). Economic Forecasting. Princeton University Press. Schwarz, Gideon. "Estimating the dimension of a model." The annals of statistics 6.2 (1978): 461-464.
Does BIC try to find a true model? The Information Criterion by Schwarz (1978) was designed with the feature that it asymptotically chooses the model with the higher posterior odds, i.e. the model with the higher likelihood given the d
13,515
Intuition for moments about the mean of a distribution?
There is a good reason for these definitions, which becomes clearer when you look at the general form for moments of standardised random variables. To answer this question, first consider the general form of the $k$th standardised central moment:$^\dagger$ $$\phi_k = \mathbb{E} \Bigg[ \Bigg( \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg)^k \text{ } \Bigg].$$ The first two standardised central moments are the values $\phi_1=0$ and $\phi_2=1$, which hold for all distributions for which the above quantity is well-defined. Hence, we can consider the non-trivial standardised central moments that occur for values $k \geqslant 3$. To facilitate our analysis we define: $$\begin{equation} \begin{aligned} \phi_k^+ &= \mathbb{E} \Bigg[ \Bigg| \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg|^k \text{ } \Bigg| X > \mathbb{E}[X] \Bigg] \cdot \mathbb{P}(X > \mathbb{E}[X]), \\[8pt] \phi_k^- &= \mathbb{E} \Bigg[ \Bigg| \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg|^k \text{ } \Bigg| X < \mathbb{E}[X] \Bigg] \cdot \mathbb{P}(X < \mathbb{E}[X]). \end{aligned} \end{equation}$$ These are non-negative quantities that give the $k$th absolute power of the standardised random variable conditional on it being above or below its expected value. We will now decompose the standardised central moment into these parts. Odd values of $k$ measure the skew in the tails: For any odd value of $k \geqslant 3$ we have an odd power in the moment equation and so we can write the standardised central moment as $\phi_k = \phi_k^+ - \phi_k^-$. From this form we see that the standardised central moment gives us the difference between the $k$th absolute power of the standardised random variable, conditional on it being above or below its mean respectively. Thus, for any odd power $k \geqslant 3$ we will get a measure that gives positive values if the expected absolute power of the standardised random variable is higher for values above the mean than for values below the mean, and gives negative values if the expected absolute power is lower for values above the mean than for values below the mean. Any of these quantities could reasonably be regarded as a measure of a type of "skewness", with higher powers giving greater relative weight to values that are far from the mean. Since this phenomenon occurs for every odd power $k \geqslant 3$, the natural choice for an archetypal measure of "skewness" is to define $\phi_3$ as the skewness. (The higher-order odd moments $k=5,7,9,...$ are sometimes called measures of "hyperskewness".)This is a lower standardised central moment than the higher odd powers, and it is natural to explore lower-order moments before consideration of higher-order moments. In statistics we have adopted the convention of referring to this standardised central moment as the skewness, since it is the lowest standardised central moment that measures this aspect of the distribution. (The higher odd powers also measure types of skewness, but with greater and greater emphasis on values far from the mean; these are sometimes called measures of "hyperskewness".) Even values of $k$ measure fatness of tails: For any even value of $k \geqslant 3$ we have an even power in the moment equation and so we can write the standardised central moment as $\phi_k = \phi_k^+ + \phi_k^-$. From this form we see that the standardised central moment gives us the sum of the $k$th absolute power of the standardised random variable, conditional on it being above or below its mean respectively. Thus, for any even power $k \geqslant 3$ we will get a measure that gives non-negative values, with higher values occurring if the tails of the distribution of the standardised random variable are fatter. Note that this is a result with respect to the standardised random variable, and so a change in scale (changing the variance) has no effect on this measure. Rather, it is effectively a measure of the fatness of the tails, after standardising for the variance of the distribution. Any of these quantities could reasonably be regarded as a measure of a type of "kurtosis", with higher powers giving greater relative weight to values that are far from the mean. Since this phenomenon occurs for every even power $k \geqslant 3$, the natural choice for an archetypal measure of kurtosis is to define $\phi_4$ as the kurtosis. This is a lower standardised central moment than the higher even powers, and it is natural to explore lower-order moments before consideration of higher-order moments. In statistics we have adopted the convention of referring to this standardised central moment as the "kurtosis", since it is the lowest standardised central moment that measures this aspect of the distribution. (The higher even powers also measure types of kurtosis, but with greater and greater emphasis on values far from the mean; these are sometimes called measures of "hyperkurtosis".) $^\dagger$ This equation is well defined for any distribution whose first two moments exist, and which has non-zero variance. We will assume that the distribution of interest falls in this class for the rest of the analysis.
Intuition for moments about the mean of a distribution?
There is a good reason for these definitions, which becomes clearer when you look at the general form for moments of standardised random variables. To answer this question, first consider the general
Intuition for moments about the mean of a distribution? There is a good reason for these definitions, which becomes clearer when you look at the general form for moments of standardised random variables. To answer this question, first consider the general form of the $k$th standardised central moment:$^\dagger$ $$\phi_k = \mathbb{E} \Bigg[ \Bigg( \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg)^k \text{ } \Bigg].$$ The first two standardised central moments are the values $\phi_1=0$ and $\phi_2=1$, which hold for all distributions for which the above quantity is well-defined. Hence, we can consider the non-trivial standardised central moments that occur for values $k \geqslant 3$. To facilitate our analysis we define: $$\begin{equation} \begin{aligned} \phi_k^+ &= \mathbb{E} \Bigg[ \Bigg| \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg|^k \text{ } \Bigg| X > \mathbb{E}[X] \Bigg] \cdot \mathbb{P}(X > \mathbb{E}[X]), \\[8pt] \phi_k^- &= \mathbb{E} \Bigg[ \Bigg| \frac{X - \mathbb{E}[X]}{\mathbb{S}[X]} \Bigg|^k \text{ } \Bigg| X < \mathbb{E}[X] \Bigg] \cdot \mathbb{P}(X < \mathbb{E}[X]). \end{aligned} \end{equation}$$ These are non-negative quantities that give the $k$th absolute power of the standardised random variable conditional on it being above or below its expected value. We will now decompose the standardised central moment into these parts. Odd values of $k$ measure the skew in the tails: For any odd value of $k \geqslant 3$ we have an odd power in the moment equation and so we can write the standardised central moment as $\phi_k = \phi_k^+ - \phi_k^-$. From this form we see that the standardised central moment gives us the difference between the $k$th absolute power of the standardised random variable, conditional on it being above or below its mean respectively. Thus, for any odd power $k \geqslant 3$ we will get a measure that gives positive values if the expected absolute power of the standardised random variable is higher for values above the mean than for values below the mean, and gives negative values if the expected absolute power is lower for values above the mean than for values below the mean. Any of these quantities could reasonably be regarded as a measure of a type of "skewness", with higher powers giving greater relative weight to values that are far from the mean. Since this phenomenon occurs for every odd power $k \geqslant 3$, the natural choice for an archetypal measure of "skewness" is to define $\phi_3$ as the skewness. (The higher-order odd moments $k=5,7,9,...$ are sometimes called measures of "hyperskewness".)This is a lower standardised central moment than the higher odd powers, and it is natural to explore lower-order moments before consideration of higher-order moments. In statistics we have adopted the convention of referring to this standardised central moment as the skewness, since it is the lowest standardised central moment that measures this aspect of the distribution. (The higher odd powers also measure types of skewness, but with greater and greater emphasis on values far from the mean; these are sometimes called measures of "hyperskewness".) Even values of $k$ measure fatness of tails: For any even value of $k \geqslant 3$ we have an even power in the moment equation and so we can write the standardised central moment as $\phi_k = \phi_k^+ + \phi_k^-$. From this form we see that the standardised central moment gives us the sum of the $k$th absolute power of the standardised random variable, conditional on it being above or below its mean respectively. Thus, for any even power $k \geqslant 3$ we will get a measure that gives non-negative values, with higher values occurring if the tails of the distribution of the standardised random variable are fatter. Note that this is a result with respect to the standardised random variable, and so a change in scale (changing the variance) has no effect on this measure. Rather, it is effectively a measure of the fatness of the tails, after standardising for the variance of the distribution. Any of these quantities could reasonably be regarded as a measure of a type of "kurtosis", with higher powers giving greater relative weight to values that are far from the mean. Since this phenomenon occurs for every even power $k \geqslant 3$, the natural choice for an archetypal measure of kurtosis is to define $\phi_4$ as the kurtosis. This is a lower standardised central moment than the higher even powers, and it is natural to explore lower-order moments before consideration of higher-order moments. In statistics we have adopted the convention of referring to this standardised central moment as the "kurtosis", since it is the lowest standardised central moment that measures this aspect of the distribution. (The higher even powers also measure types of kurtosis, but with greater and greater emphasis on values far from the mean; these are sometimes called measures of "hyperkurtosis".) $^\dagger$ This equation is well defined for any distribution whose first two moments exist, and which has non-zero variance. We will assume that the distribution of interest falls in this class for the rest of the analysis.
Intuition for moments about the mean of a distribution? There is a good reason for these definitions, which becomes clearer when you look at the general form for moments of standardised random variables. To answer this question, first consider the general
13,516
Intuition for moments about the mean of a distribution?
Similar question What's so 'moment' about 'moments' of a probability distribution? I gave a physical answer to that which addressed moments. "Angular acceleration is the derivative of angular velocity, which is the derivative of angle with respect to time, i.e., $ \dfrac{d\omega}{dt}=\alpha,\,\dfrac{d\theta}{dt}=\omega$. Consider that the second moment is analogous to torque applied to a circular motion, or if you will an acceleration/deceleration (also second derivative) of that circular (i.e., angular, $\theta$) motion. Similarly, the third moment would be a rate of change of torque, and so on and so forth for yet higher moments to make rates of change of rates of change of rates of change, i.e., sequential derivatives of circular motion...." See the link as this is perhaps easier to visualize this with physical examples. Skewness is easier to understand than kurtosis. A negative skewness is a heavier left tail (or further negative direction outlier) than on the right and positive skewness the opposite. Wikipedia cites Westfall (2014) and implies that high kurtosis arises either for random variables that have far outliers or for density functions with one or two heavy tails while claiming that any central tendency of data or density has relatively little effect on the kurtosis value. Low values of kurtosis would imply the opposite, i.e., a lack of $x$-axis outliers and the relative lightness of both tails.
Intuition for moments about the mean of a distribution?
Similar question What's so 'moment' about 'moments' of a probability distribution? I gave a physical answer to that which addressed moments. "Angular acceleration is the derivative of angular velocity
Intuition for moments about the mean of a distribution? Similar question What's so 'moment' about 'moments' of a probability distribution? I gave a physical answer to that which addressed moments. "Angular acceleration is the derivative of angular velocity, which is the derivative of angle with respect to time, i.e., $ \dfrac{d\omega}{dt}=\alpha,\,\dfrac{d\theta}{dt}=\omega$. Consider that the second moment is analogous to torque applied to a circular motion, or if you will an acceleration/deceleration (also second derivative) of that circular (i.e., angular, $\theta$) motion. Similarly, the third moment would be a rate of change of torque, and so on and so forth for yet higher moments to make rates of change of rates of change of rates of change, i.e., sequential derivatives of circular motion...." See the link as this is perhaps easier to visualize this with physical examples. Skewness is easier to understand than kurtosis. A negative skewness is a heavier left tail (or further negative direction outlier) than on the right and positive skewness the opposite. Wikipedia cites Westfall (2014) and implies that high kurtosis arises either for random variables that have far outliers or for density functions with one or two heavy tails while claiming that any central tendency of data or density has relatively little effect on the kurtosis value. Low values of kurtosis would imply the opposite, i.e., a lack of $x$-axis outliers and the relative lightness of both tails.
Intuition for moments about the mean of a distribution? Similar question What's so 'moment' about 'moments' of a probability distribution? I gave a physical answer to that which addressed moments. "Angular acceleration is the derivative of angular velocity
13,517
Root finding for stochastic function
You might find the following references useful: Pasupathy, R.and Kim, S. (2011) The stochastic root-finding problem: Overview, solutions, and open questions. ACM Transactions on Modeling and Computer Simulation, 21(3). [DOI] [preprint] Waeber, R. (2013) Probabilistic Bisection Search for Stochastic Root-Finding. Ph.D dissertation, Cornell University, Ithaca. [pdf]
Root finding for stochastic function
You might find the following references useful: Pasupathy, R.and Kim, S. (2011) The stochastic root-finding problem: Overview, solutions, and open questions. ACM Transactions on Modeling and Computer
Root finding for stochastic function You might find the following references useful: Pasupathy, R.and Kim, S. (2011) The stochastic root-finding problem: Overview, solutions, and open questions. ACM Transactions on Modeling and Computer Simulation, 21(3). [DOI] [preprint] Waeber, R. (2013) Probabilistic Bisection Search for Stochastic Root-Finding. Ph.D dissertation, Cornell University, Ithaca. [pdf]
Root finding for stochastic function You might find the following references useful: Pasupathy, R.and Kim, S. (2011) The stochastic root-finding problem: Overview, solutions, and open questions. ACM Transactions on Modeling and Computer
13,518
Law of total variance as Pythagorean theorem
I assume that you are comfortable with regarding the right-angled triangle as meaning that $E[Y\mid X]$ and $Y - E[Y\mid X]$ are uncorrelated random variables. For uncorrelated random variables $A$ and $B$, $$\operatorname{var}(A+B) = \operatorname{var}(A) + \operatorname{var}(B),\tag{1}$$ and so if we set $A = Y - E[Y\mid X]$ and $B = E[Y\mid X]$ so that $A+B = Y$, we get that $$\operatorname{var}(Y) = \operatorname{var}(Y-E[Y\mid X]) + \operatorname{var}(E[Y\mid X]).\tag{2}$$ It remains to show that $\operatorname{var}(Y-E[Y\mid X])$ is the same as $E[\operatorname{var}(Y\mid X)]$ so that we can re-state $(2)$ as $$\operatorname{var}(Y) = E[\operatorname{var}(Y\mid X)] + \operatorname{var}(E[Y\mid X])\tag{3}$$ which is the total variance formula. It is well-known that the expected value of the random variable $E[Y\mid X]$ is$E[Y]$, that is, $E\biggr[E[Y\mid X]\biggr] = E[Y]$. So we see that $$E[A] = E\biggr[Y - E[Y\mid X]\biggr] = E[Y] - E\biggr[E[Y\mid X]\biggr] = 0,$$ from which it follows that $\operatorname{var}(A) = E[A^2]$, that is, $$\operatorname{var}(Y-E[Y\mid X]) = E\left[(Y-E[Y\mid X])^2\right].\tag{4}$$ Let $C$ denote the random variable $(Y-E[Y\mid X])^2$ so that we can write that $$\operatorname{var}(Y-E[Y\mid X]) = E[C].\tag{5}$$ But, $E[C] = E\biggr[E[C\mid X]\biggr]$ where $E[C\mid X] = E\biggr[(Y-E[Y\mid X])^2{\bigr\vert} X\biggr].$ Now, given that $X = x$, the conditional distribution of $Y$ has mean $E[Y\mid X=x]$ and so $$E\biggr[(Y-E[Y\mid X=x])^2{\bigr\vert} X=x\biggr] = \operatorname{var}(Y\mid X = x).$$ In other words, $E[C\mid X = x] = \operatorname{var}(Y\mid X = x)$ so that the random variable $E[C\mid X]$ is just $\operatorname{var}(Y\mid X)$. Hence, $$E[C] = E\biggr[E[C\mid X]\biggr] = E[\operatorname{var}(Y\mid X)], \tag{6}$$ which upon substitution into $(5)$ shows that $$\operatorname{var}(Y-E[Y\mid X]) = E[\operatorname{var}(Y\mid X)].$$ This makes the right side of $(2)$ exactly what we need and so we have proved the total variance formula $(3)$.
Law of total variance as Pythagorean theorem
I assume that you are comfortable with regarding the right-angled triangle as meaning that $E[Y\mid X]$ and $Y - E[Y\mid X]$ are uncorrelated random variables. For uncorrelated random variables $A$ an
Law of total variance as Pythagorean theorem I assume that you are comfortable with regarding the right-angled triangle as meaning that $E[Y\mid X]$ and $Y - E[Y\mid X]$ are uncorrelated random variables. For uncorrelated random variables $A$ and $B$, $$\operatorname{var}(A+B) = \operatorname{var}(A) + \operatorname{var}(B),\tag{1}$$ and so if we set $A = Y - E[Y\mid X]$ and $B = E[Y\mid X]$ so that $A+B = Y$, we get that $$\operatorname{var}(Y) = \operatorname{var}(Y-E[Y\mid X]) + \operatorname{var}(E[Y\mid X]).\tag{2}$$ It remains to show that $\operatorname{var}(Y-E[Y\mid X])$ is the same as $E[\operatorname{var}(Y\mid X)]$ so that we can re-state $(2)$ as $$\operatorname{var}(Y) = E[\operatorname{var}(Y\mid X)] + \operatorname{var}(E[Y\mid X])\tag{3}$$ which is the total variance formula. It is well-known that the expected value of the random variable $E[Y\mid X]$ is$E[Y]$, that is, $E\biggr[E[Y\mid X]\biggr] = E[Y]$. So we see that $$E[A] = E\biggr[Y - E[Y\mid X]\biggr] = E[Y] - E\biggr[E[Y\mid X]\biggr] = 0,$$ from which it follows that $\operatorname{var}(A) = E[A^2]$, that is, $$\operatorname{var}(Y-E[Y\mid X]) = E\left[(Y-E[Y\mid X])^2\right].\tag{4}$$ Let $C$ denote the random variable $(Y-E[Y\mid X])^2$ so that we can write that $$\operatorname{var}(Y-E[Y\mid X]) = E[C].\tag{5}$$ But, $E[C] = E\biggr[E[C\mid X]\biggr]$ where $E[C\mid X] = E\biggr[(Y-E[Y\mid X])^2{\bigr\vert} X\biggr].$ Now, given that $X = x$, the conditional distribution of $Y$ has mean $E[Y\mid X=x]$ and so $$E\biggr[(Y-E[Y\mid X=x])^2{\bigr\vert} X=x\biggr] = \operatorname{var}(Y\mid X = x).$$ In other words, $E[C\mid X = x] = \operatorname{var}(Y\mid X = x)$ so that the random variable $E[C\mid X]$ is just $\operatorname{var}(Y\mid X)$. Hence, $$E[C] = E\biggr[E[C\mid X]\biggr] = E[\operatorname{var}(Y\mid X)], \tag{6}$$ which upon substitution into $(5)$ shows that $$\operatorname{var}(Y-E[Y\mid X]) = E[\operatorname{var}(Y\mid X)].$$ This makes the right side of $(2)$ exactly what we need and so we have proved the total variance formula $(3)$.
Law of total variance as Pythagorean theorem I assume that you are comfortable with regarding the right-angled triangle as meaning that $E[Y\mid X]$ and $Y - E[Y\mid X]$ are uncorrelated random variables. For uncorrelated random variables $A$ an
13,519
Law of total variance as Pythagorean theorem
Statement: The Pythagorean theorem says, for any elements $T_1$ and $T_2$ of an inner-product space with finite norms such that $\langle T_1,T_2\rangle = 0$, $$ ||T_1+T_2||^2 = ||T_1||^2 + ||T_2||^2 \tag{1}. $$ Or in other words, for orthogonal vectors, the squared length of the sum is the sum of the squared lengths. Our Case: In our case $T_1 = E(Y|X)$ and $T_2 = Y - E[Y|X]$ are random variables, the squared norm is $||T_i||^2 = E[T_i^2]$ and the inner product $\langle T_1,T_2\rangle = E[T_1T_2]$. Translating $(1)$ into statistical language gives us: $$ E[Y^2] = E[\{E(Y|X)\}^2] + E[(Y - E[Y|X])^2] \tag{2}, $$ because $E[T_1T_2] = \operatorname{Cov}(T_1,T_2) = 0$. We can make this look more like your stated Law of Total Variance if we change $(2)$ by... 1. Subtract $(E[Y])^2$ from both sides, making the left hand side $\operatorname{Var}[Y]$, Noting on the right hand side that $E[\{E(Y|X)\}^2] - (E[Y])^2 = \operatorname{Var}(E[Y|X])$, Noting that $ E[(Y - E[Y|X])^2] = E[E\{(Y - E[Y|X])^2|X\}]= E[\operatorname{Var}(Y|X)]$. For details about these three bullet points see @DilipSarwate's post. He explains this all in much more detail than I do.
Law of total variance as Pythagorean theorem
Statement: The Pythagorean theorem says, for any elements $T_1$ and $T_2$ of an inner-product space with finite norms such that $\langle T_1,T_2\rangle = 0$, $$ ||T_1+T_2||^2 = ||T_1||^2 + ||T_2||^2 \
Law of total variance as Pythagorean theorem Statement: The Pythagorean theorem says, for any elements $T_1$ and $T_2$ of an inner-product space with finite norms such that $\langle T_1,T_2\rangle = 0$, $$ ||T_1+T_2||^2 = ||T_1||^2 + ||T_2||^2 \tag{1}. $$ Or in other words, for orthogonal vectors, the squared length of the sum is the sum of the squared lengths. Our Case: In our case $T_1 = E(Y|X)$ and $T_2 = Y - E[Y|X]$ are random variables, the squared norm is $||T_i||^2 = E[T_i^2]$ and the inner product $\langle T_1,T_2\rangle = E[T_1T_2]$. Translating $(1)$ into statistical language gives us: $$ E[Y^2] = E[\{E(Y|X)\}^2] + E[(Y - E[Y|X])^2] \tag{2}, $$ because $E[T_1T_2] = \operatorname{Cov}(T_1,T_2) = 0$. We can make this look more like your stated Law of Total Variance if we change $(2)$ by... 1. Subtract $(E[Y])^2$ from both sides, making the left hand side $\operatorname{Var}[Y]$, Noting on the right hand side that $E[\{E(Y|X)\}^2] - (E[Y])^2 = \operatorname{Var}(E[Y|X])$, Noting that $ E[(Y - E[Y|X])^2] = E[E\{(Y - E[Y|X])^2|X\}]= E[\operatorname{Var}(Y|X)]$. For details about these three bullet points see @DilipSarwate's post. He explains this all in much more detail than I do.
Law of total variance as Pythagorean theorem Statement: The Pythagorean theorem says, for any elements $T_1$ and $T_2$ of an inner-product space with finite norms such that $\langle T_1,T_2\rangle = 0$, $$ ||T_1+T_2||^2 = ||T_1||^2 + ||T_2||^2 \
13,520
Clustering 1D data
The K-means algorithm and the EM algorithm are going to be pretty similar for 1D clustering. In K-means you start with a guess where the means are and assign each point to the cluster with the closest mean, then you recompute the means (and variances) based on current assignments of points, then update the assigment of points, then update the means ... In EM you would also start with a guess where the means are, then you compute the expected value of the assignments (essentially the probability of each point being in each cluster), then you update the estimated means (and variances) using the expected values as weights, then compute new expected values, then compute new means, ... The primary difference is that the assignment of points to clusters in K-means is an all or nothing, where EM gives proportions/probability of group membership (one point may be seen as having 80% probability of being in group A, 18% probability of being in group B, and 2% probability of being in group C). If there is a lot of seperation between the groups then the 2 methods are going to give pretty similar results. But if there is a fair amount of overlap then the EM will probably give more meaningful results (even more if the variance/standard deviation is of interest). But if all you care about is assigning group membership without caring about the parameters, then K-means is probably simpler. Why not do both and see how different the answers are? if they are similar then go with the simpler one, if they are different then decide on comparing the grouping to the data and outside knowledge.
Clustering 1D data
The K-means algorithm and the EM algorithm are going to be pretty similar for 1D clustering. In K-means you start with a guess where the means are and assign each point to the cluster with the closest
Clustering 1D data The K-means algorithm and the EM algorithm are going to be pretty similar for 1D clustering. In K-means you start with a guess where the means are and assign each point to the cluster with the closest mean, then you recompute the means (and variances) based on current assignments of points, then update the assigment of points, then update the means ... In EM you would also start with a guess where the means are, then you compute the expected value of the assignments (essentially the probability of each point being in each cluster), then you update the estimated means (and variances) using the expected values as weights, then compute new expected values, then compute new means, ... The primary difference is that the assignment of points to clusters in K-means is an all or nothing, where EM gives proportions/probability of group membership (one point may be seen as having 80% probability of being in group A, 18% probability of being in group B, and 2% probability of being in group C). If there is a lot of seperation between the groups then the 2 methods are going to give pretty similar results. But if there is a fair amount of overlap then the EM will probably give more meaningful results (even more if the variance/standard deviation is of interest). But if all you care about is assigning group membership without caring about the parameters, then K-means is probably simpler. Why not do both and see how different the answers are? if they are similar then go with the simpler one, if they are different then decide on comparing the grouping to the data and outside knowledge.
Clustering 1D data The K-means algorithm and the EM algorithm are going to be pretty similar for 1D clustering. In K-means you start with a guess where the means are and assign each point to the cluster with the closest
13,521
Clustering 1D data
EM is better than k-means in terms of results. K-means, however, has a faster run-time. They will produce similar results if the standard deviation/covariance matrices are approximately equal. If you suspect this is true, use k-means. DBSCAN is used when the data is non-gaussian. If you are using 1-dimensional data, this is generally not applicable, as a gaussian approximation is typically valid in 1 dimension.
Clustering 1D data
EM is better than k-means in terms of results. K-means, however, has a faster run-time. They will produce similar results if the standard deviation/covariance matrices are approximately equal. If you
Clustering 1D data EM is better than k-means in terms of results. K-means, however, has a faster run-time. They will produce similar results if the standard deviation/covariance matrices are approximately equal. If you suspect this is true, use k-means. DBSCAN is used when the data is non-gaussian. If you are using 1-dimensional data, this is generally not applicable, as a gaussian approximation is typically valid in 1 dimension.
Clustering 1D data EM is better than k-means in terms of results. K-means, however, has a faster run-time. They will produce similar results if the standard deviation/covariance matrices are approximately equal. If you
13,522
Clustering 1D data
Another simple way is to basically use sorting of the 1D array: i.e. iterate over each point and get the values which are at a minimum distance from it in both the positive and the negative directions. For example: data = [1,2,3,4,5,6,7,8,9,10,12] k = 5 for a in data: print {'group': sorted(k, key=lambda n: abs(n-a))[0:k], 'point': a} will give out: {'group': [1, 2, 3, 4, 5], 'point': 1} {'group': [2, 1, 3, 4, 5], 'point': 2} {'group': [3, 2, 4, 1, 5], 'point': 3} {'group': [4, 3, 5, 2, 6], 'point': 4} {'group': [5, 4, 6, 3, 7], 'point': 5} {'group': [6, 5, 7, 4, 8], 'point': 6} {'group': [7, 6, 8, 5, 9], 'point': 7} {'group': [8, 7, 9, 6, 10], 'point': 8} {'group': [9, 8, 10, 7, 6], 'point': 9} {'group': [10, 9, 8, 12, 7], 'point': 10} {'group': [12, 10, 9, 8, 7], 'point': 12} Which points, that the items close to a particular point are basically under its group. The only thing to ponder upon in this technique is the variable k, which is the fixed size of the cluster :-).
Clustering 1D data
Another simple way is to basically use sorting of the 1D array: i.e. iterate over each point and get the values which are at a minimum distance from it in both the positive and the negative directions
Clustering 1D data Another simple way is to basically use sorting of the 1D array: i.e. iterate over each point and get the values which are at a minimum distance from it in both the positive and the negative directions. For example: data = [1,2,3,4,5,6,7,8,9,10,12] k = 5 for a in data: print {'group': sorted(k, key=lambda n: abs(n-a))[0:k], 'point': a} will give out: {'group': [1, 2, 3, 4, 5], 'point': 1} {'group': [2, 1, 3, 4, 5], 'point': 2} {'group': [3, 2, 4, 1, 5], 'point': 3} {'group': [4, 3, 5, 2, 6], 'point': 4} {'group': [5, 4, 6, 3, 7], 'point': 5} {'group': [6, 5, 7, 4, 8], 'point': 6} {'group': [7, 6, 8, 5, 9], 'point': 7} {'group': [8, 7, 9, 6, 10], 'point': 8} {'group': [9, 8, 10, 7, 6], 'point': 9} {'group': [10, 9, 8, 12, 7], 'point': 10} {'group': [12, 10, 9, 8, 7], 'point': 12} Which points, that the items close to a particular point are basically under its group. The only thing to ponder upon in this technique is the variable k, which is the fixed size of the cluster :-).
Clustering 1D data Another simple way is to basically use sorting of the 1D array: i.e. iterate over each point and get the values which are at a minimum distance from it in both the positive and the negative directions
13,523
Clustering 1D data
If there is only one variable, no need for clustering. You can easily group your observations based on the variable's distribution. Or am I missing some points here?
Clustering 1D data
If there is only one variable, no need for clustering. You can easily group your observations based on the variable's distribution. Or am I missing some points here?
Clustering 1D data If there is only one variable, no need for clustering. You can easily group your observations based on the variable's distribution. Or am I missing some points here?
Clustering 1D data If there is only one variable, no need for clustering. You can easily group your observations based on the variable's distribution. Or am I missing some points here?
13,524
Input format for response in binomial glm in R
There's no statistical reason to prefer one to the other, besides conceptual clarity. Although the reported deviance values are different, these differences are completely due to the saturated model. So any comparison using relative deviance between models is unaffected, since the saturated model log-likelihood cancels. I think it's useful to go through the explicit deviance calculation. The deviance of a model is 2*(LL(Saturated Model) - LL(Model)). Suppose you have $i$ different cells, where $n_i$ is the number of observations in cell $i$, $p_i$ is the model prediction for all observations in cell $i$, and $y_{ij}$ is the observed value (0 or 1) for the $j$-th observation in cell $i$. Long Form The log likelihood of the (proposed or null) model is $$\sum_i\sum_j\left(\log(p_i)y_{ij} + \log(1 - p_i)(1 - y_{ij})\right)$$ and the log likelihood of the saturated model is $$\sum_i\sum_j \left(\log(y_{ij})y_{ij} + \log(1 - y_{ij})(1-y_{ij})\right).$$ This is equal to 0, because $y_{ij}$ is either 0 or 1. Note $\log(0)$ is undefined, but for convenience please read $0\log(0)$ as shorthand for $\lim_{x \to 0^+}x\log(x)$, which is 0. Short form (weighted) Note that a binomial distribution can't actually take non-integer values, but we can nonetheless calculate a "log likelihood" by using the fraction of observed successes in each cell as the response, and weighting each summand in the log-likelihood calculation by the number of observations in that cell. $$\sum_in_i \left(\log(p_i)\sum_jy_{ij}/n_i + \log(1 - p_i)(1 - \sum_j(y_{ij}/n_i)\right)$$ This is exactly equal to the model deviance we calculated above, which you can see by pulling in the sum over $j$ in the long form equation as far as possible. Meanwhile the saturated deviance is different. Since we no longer have 0-1 responses, even with one parameter per observation we can't get exactly 0. Instead the saturated model log-likelihood is $$\sum_i n_i\left(\log(\sum_jy_{ij}/n_i)\sum_jy_{ij}/n_i + \log(1 - \sum_jy_{ij}/n_i)(1-\sum_jy_{ij}/n_i)\right).$$ In your example, you can verify that twice this amount is the difference between the reported null and residual deviance values for both models. ni = dfShort$nReps yavg = dfShort$mortalityP sum.terms <-ni*(log(yavg)*yavg + log(1 - yavg)*(1 - yavg)) # Need to handle NaN when yavg is exactly 0 sum.terms[1] <- log(1 - yavg[1])*(1 - yavg[1]) 2*sum(sum.terms) fitShortP$deviance - fitLong$deviance
Input format for response in binomial glm in R
There's no statistical reason to prefer one to the other, besides conceptual clarity. Although the reported deviance values are different, these differences are completely due to the saturated model.
Input format for response in binomial glm in R There's no statistical reason to prefer one to the other, besides conceptual clarity. Although the reported deviance values are different, these differences are completely due to the saturated model. So any comparison using relative deviance between models is unaffected, since the saturated model log-likelihood cancels. I think it's useful to go through the explicit deviance calculation. The deviance of a model is 2*(LL(Saturated Model) - LL(Model)). Suppose you have $i$ different cells, where $n_i$ is the number of observations in cell $i$, $p_i$ is the model prediction for all observations in cell $i$, and $y_{ij}$ is the observed value (0 or 1) for the $j$-th observation in cell $i$. Long Form The log likelihood of the (proposed or null) model is $$\sum_i\sum_j\left(\log(p_i)y_{ij} + \log(1 - p_i)(1 - y_{ij})\right)$$ and the log likelihood of the saturated model is $$\sum_i\sum_j \left(\log(y_{ij})y_{ij} + \log(1 - y_{ij})(1-y_{ij})\right).$$ This is equal to 0, because $y_{ij}$ is either 0 or 1. Note $\log(0)$ is undefined, but for convenience please read $0\log(0)$ as shorthand for $\lim_{x \to 0^+}x\log(x)$, which is 0. Short form (weighted) Note that a binomial distribution can't actually take non-integer values, but we can nonetheless calculate a "log likelihood" by using the fraction of observed successes in each cell as the response, and weighting each summand in the log-likelihood calculation by the number of observations in that cell. $$\sum_in_i \left(\log(p_i)\sum_jy_{ij}/n_i + \log(1 - p_i)(1 - \sum_j(y_{ij}/n_i)\right)$$ This is exactly equal to the model deviance we calculated above, which you can see by pulling in the sum over $j$ in the long form equation as far as possible. Meanwhile the saturated deviance is different. Since we no longer have 0-1 responses, even with one parameter per observation we can't get exactly 0. Instead the saturated model log-likelihood is $$\sum_i n_i\left(\log(\sum_jy_{ij}/n_i)\sum_jy_{ij}/n_i + \log(1 - \sum_jy_{ij}/n_i)(1-\sum_jy_{ij}/n_i)\right).$$ In your example, you can verify that twice this amount is the difference between the reported null and residual deviance values for both models. ni = dfShort$nReps yavg = dfShort$mortalityP sum.terms <-ni*(log(yavg)*yavg + log(1 - yavg)*(1 - yavg)) # Need to handle NaN when yavg is exactly 0 sum.terms[1] <- log(1 - yavg[1])*(1 - yavg[1]) 2*sum(sum.terms) fitShortP$deviance - fitLong$deviance
Input format for response in binomial glm in R There's no statistical reason to prefer one to the other, besides conceptual clarity. Although the reported deviance values are different, these differences are completely due to the saturated model.
13,525
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
An ordered logit model is more appropriate as you have a dependent variable which is a ranking, 7 is better than 4 for instance. So there is a clear order. This allows you to obtain a probability for each bin. There are few assumptions that you need to take into account. You can have a look here. One of the assumptions underlying ordinal logistic (and ordinal probit) regression is that the relationship between each pair of outcome groups is the same. In other words, ordinal logistic regression assumes that the coefficients that describe the relationship between, say, the lowest versus all higher categories of the response variable are the same as those that describe the relationship between the next lowest category and all higher categories, etc. This is called the proportional odds assumption or the parallel regression assumption. Some code: library("MASS") ## fit ordered logit model and store results 'm' m <- polr(Y ~ X1 + X2 + X3, data = dat, Hess=TRUE) ## view a summary of the model summary(m) You can have further explanations here, here,here or here. Keep in mind that you will need to transform your coefficients to odds ratio and then to probabilities to have a clear interpretation in terms of probabilities. In a straightforward (and simplistic manner) you can compute these by: $exp(\beta_{i})=Odds Ratio$ $\frac{exp(\beta_{1})}{\sum exp(\beta_{i})} = Probability$ (Don't want to be too technical)
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
An ordered logit model is more appropriate as you have a dependent variable which is a ranking, 7 is better than 4 for instance. So there is a clear order. This allows you to obtain a probability for
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) An ordered logit model is more appropriate as you have a dependent variable which is a ranking, 7 is better than 4 for instance. So there is a clear order. This allows you to obtain a probability for each bin. There are few assumptions that you need to take into account. You can have a look here. One of the assumptions underlying ordinal logistic (and ordinal probit) regression is that the relationship between each pair of outcome groups is the same. In other words, ordinal logistic regression assumes that the coefficients that describe the relationship between, say, the lowest versus all higher categories of the response variable are the same as those that describe the relationship between the next lowest category and all higher categories, etc. This is called the proportional odds assumption or the parallel regression assumption. Some code: library("MASS") ## fit ordered logit model and store results 'm' m <- polr(Y ~ X1 + X2 + X3, data = dat, Hess=TRUE) ## view a summary of the model summary(m) You can have further explanations here, here,here or here. Keep in mind that you will need to transform your coefficients to odds ratio and then to probabilities to have a clear interpretation in terms of probabilities. In a straightforward (and simplistic manner) you can compute these by: $exp(\beta_{i})=Odds Ratio$ $\frac{exp(\beta_{1})}{\sum exp(\beta_{i})} = Probability$ (Don't want to be too technical)
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) An ordered logit model is more appropriate as you have a dependent variable which is a ranking, 7 is better than 4 for instance. So there is a clear order. This allows you to obtain a probability for
13,526
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
I would like to provide another view to the problem: In real world, it is less likely to encounter the this question, because what to do is depending on business needs. The essential question in real world is what to do after getting the prediction? Suppose business wants to trash "low quality" wine. Then, we need some definition of "how bad is bad" (say quality below $2$). With the definition, binary logistic regression should be used, because the decision is binary. (trash or keep, there is nothing in middle). Suppose business wants to select some fine wine to send to three types restaurants. Then, multi-class classification will be needed. In sum, I want to argue that what to do is really depending on the needs after getting the prediction, instead of just looking at the attribute of the response variable.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
I would like to provide another view to the problem: In real world, it is less likely to encounter the this question, because what to do is depending on business needs. The essential question in real
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) I would like to provide another view to the problem: In real world, it is less likely to encounter the this question, because what to do is depending on business needs. The essential question in real world is what to do after getting the prediction? Suppose business wants to trash "low quality" wine. Then, we need some definition of "how bad is bad" (say quality below $2$). With the definition, binary logistic regression should be used, because the decision is binary. (trash or keep, there is nothing in middle). Suppose business wants to select some fine wine to send to three types restaurants. Then, multi-class classification will be needed. In sum, I want to argue that what to do is really depending on the needs after getting the prediction, instead of just looking at the attribute of the response variable.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) I would like to provide another view to the problem: In real world, it is less likely to encounter the this question, because what to do is depending on business needs. The essential question in real
13,527
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
Although an ordered logit model (as detailed by @adrian1121) would be most appropriate in terms of model assumptions, I think multiple linear regression has some advantages as well. Ease of interpretation. Linear models are easier to interpret than ordered logit models. Stakeholder comfort. Users of the model may be more comfortable with linear regression because they are more likely to know what it is. More parsimonious (simpler). The simpler model may perform just as well, see related topic. The fact that most of the responses are between 3-8, suggests to me that a linear model may perform suitably for your needs. I'm not saying it's "better", but it may be a more practical approach.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
Although an ordered logit model (as detailed by @adrian1121) would be most appropriate in terms of model assumptions, I think multiple linear regression has some advantages as well. Ease of interpret
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) Although an ordered logit model (as detailed by @adrian1121) would be most appropriate in terms of model assumptions, I think multiple linear regression has some advantages as well. Ease of interpretation. Linear models are easier to interpret than ordered logit models. Stakeholder comfort. Users of the model may be more comfortable with linear regression because they are more likely to know what it is. More parsimonious (simpler). The simpler model may perform just as well, see related topic. The fact that most of the responses are between 3-8, suggests to me that a linear model may perform suitably for your needs. I'm not saying it's "better", but it may be a more practical approach.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) Although an ordered logit model (as detailed by @adrian1121) would be most appropriate in terms of model assumptions, I think multiple linear regression has some advantages as well. Ease of interpret
13,528
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
In principle ordered logit model seems appropriate, but 10 (or even 7) categories is quite a lot. 1/ Eventually would it make sense to do some re-coding (e.g., ratings 1-4 would be merged into 1 single modality, say "low rating")? 2/ What is the distribution of the ratings? If pretty well normally distributed, then a linear regression would do a good job (see linear probability model). 3/ Otherwise I would go for something completely different called "beta regression" - A 11-points rating scale is something pretty detailed compared to classical 5-points scale - I think it would be acceptable to consider the rating scale as an "intensity" scale where 0 = Null and 1 = Full/Perfect - By doing this you would basically assume that your scale is interval type (rather than ordinal one), but to me it sounds acceptable.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
In principle ordered logit model seems appropriate, but 10 (or even 7) categories is quite a lot. 1/ Eventually would it make sense to do some re-coding (e.g., ratings 1-4 would be merged into 1 sin
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) In principle ordered logit model seems appropriate, but 10 (or even 7) categories is quite a lot. 1/ Eventually would it make sense to do some re-coding (e.g., ratings 1-4 would be merged into 1 single modality, say "low rating")? 2/ What is the distribution of the ratings? If pretty well normally distributed, then a linear regression would do a good job (see linear probability model). 3/ Otherwise I would go for something completely different called "beta regression" - A 11-points rating scale is something pretty detailed compared to classical 5-points scale - I think it would be acceptable to consider the rating scale as an "intensity" scale where 0 = Null and 1 = Full/Perfect - By doing this you would basically assume that your scale is interval type (rather than ordinal one), but to me it sounds acceptable.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) In principle ordered logit model seems appropriate, but 10 (or even 7) categories is quite a lot. 1/ Eventually would it make sense to do some re-coding (e.g., ratings 1-4 would be merged into 1 sin
13,529
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
I am not a specialist of logistic regression, but I would say that you want to use multinomial because of your discrete dependent variable. A linear regression could output coefficients that can be extrapolated out of the possible boundaries of your dependent variable (i.e an increase of independent variable would lead to a dependent variable out of your boundary for the given regression coefficient). The multinomial regression will gives the different probabilities for the differents outcomes of your dependent variable (i.e the coefficient of your regression will give you how they increase their probability to give a better score, without the score beeing out of bounds).
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
I am not a specialist of logistic regression, but I would say that you want to use multinomial because of your discrete dependent variable. A linear regression could output coefficients that can be e
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) I am not a specialist of logistic regression, but I would say that you want to use multinomial because of your discrete dependent variable. A linear regression could output coefficients that can be extrapolated out of the possible boundaries of your dependent variable (i.e an increase of independent variable would lead to a dependent variable out of your boundary for the given regression coefficient). The multinomial regression will gives the different probabilities for the differents outcomes of your dependent variable (i.e the coefficient of your regression will give you how they increase their probability to give a better score, without the score beeing out of bounds).
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) I am not a specialist of logistic regression, but I would say that you want to use multinomial because of your discrete dependent variable. A linear regression could output coefficients that can be e
13,530
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
Another possibility is to use a Random Forest. There are two ways to measure the "importance" of a variable under a Random Forest: Permutation: the importance of input variable $X_j$ is proportional to the average increase in error rate cause by randomly shuffling that variable. Randomly shuffling $X_j$ destroys the relationship between $X_j$ and $Y$, as well as all the other $X$s. Node impurity: the importance of input variable $X_j$ is proportional to the total decrease in node impurity due to splitting on $X_j$ across all trees. Random Forests are also amenable to a type of data visualization called a "partial dependence plot". See this in-depth tutorial for more detail. Partial dependence and permutation importance are not specific to Random Forest models, but their popularity grew along with the popularity of Random Forests because of how efficient it is to compute them for Random Forest models.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10)
Another possibility is to use a Random Forest. There are two ways to measure the "importance" of a variable under a Random Forest: Permutation: the importance of input variable $X_j$ is proportional
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) Another possibility is to use a Random Forest. There are two ways to measure the "importance" of a variable under a Random Forest: Permutation: the importance of input variable $X_j$ is proportional to the average increase in error rate cause by randomly shuffling that variable. Randomly shuffling $X_j$ destroys the relationship between $X_j$ and $Y$, as well as all the other $X$s. Node impurity: the importance of input variable $X_j$ is proportional to the total decrease in node impurity due to splitting on $X_j$ across all trees. Random Forests are also amenable to a type of data visualization called a "partial dependence plot". See this in-depth tutorial for more detail. Partial dependence and permutation importance are not specific to Random Forest models, but their popularity grew along with the popularity of Random Forests because of how efficient it is to compute them for Random Forest models.
Linear regression or ordinal logistic regression to predict wine rating (from 0 and 10) Another possibility is to use a Random Forest. There are two ways to measure the "importance" of a variable under a Random Forest: Permutation: the importance of input variable $X_j$ is proportional
13,531
is scaling data [0,1] necessary when batch normalization is used?
As mentioned, it's best to use [-1, 1] min-max scaling or zero-mean, unit-variance standardization. Scaling your data into [0, 1] will result in slow learning. To answer your question: Yes, you should still standardize your inputs to a network that uses Batch Normalization. This will ensure that inputs to the first layer have zero mean and come from the same distribution, while Batch Normalization on subsequent layers will ensure that inputs to those layers have zero mean in expectation and that their distributions do not drift over time. The reasons that we want zero mean and stable input distribution are discussed further in Section 4.3 of Efficient BackProp.
is scaling data [0,1] necessary when batch normalization is used?
As mentioned, it's best to use [-1, 1] min-max scaling or zero-mean, unit-variance standardization. Scaling your data into [0, 1] will result in slow learning. To answer your question: Yes, you should
is scaling data [0,1] necessary when batch normalization is used? As mentioned, it's best to use [-1, 1] min-max scaling or zero-mean, unit-variance standardization. Scaling your data into [0, 1] will result in slow learning. To answer your question: Yes, you should still standardize your inputs to a network that uses Batch Normalization. This will ensure that inputs to the first layer have zero mean and come from the same distribution, while Batch Normalization on subsequent layers will ensure that inputs to those layers have zero mean in expectation and that their distributions do not drift over time. The reasons that we want zero mean and stable input distribution are discussed further in Section 4.3 of Efficient BackProp.
is scaling data [0,1] necessary when batch normalization is used? As mentioned, it's best to use [-1, 1] min-max scaling or zero-mean, unit-variance standardization. Scaling your data into [0, 1] will result in slow learning. To answer your question: Yes, you should
13,532
is scaling data [0,1] necessary when batch normalization is used?
In this case scaling data would only influence the first layer of your network. Also if you are scaling your input it's better to scale it to [-1, 1], but it's best to scale it to 0 mean and 1 variance (since your weights are probably initialized to expect such distribution). Not that it's going to make a huge difference anyway.
is scaling data [0,1] necessary when batch normalization is used?
In this case scaling data would only influence the first layer of your network. Also if you are scaling your input it's better to scale it to [-1, 1], but it's best to scale it to 0 mean and 1 varianc
is scaling data [0,1] necessary when batch normalization is used? In this case scaling data would only influence the first layer of your network. Also if you are scaling your input it's better to scale it to [-1, 1], but it's best to scale it to 0 mean and 1 variance (since your weights are probably initialized to expect such distribution). Not that it's going to make a huge difference anyway.
is scaling data [0,1] necessary when batch normalization is used? In this case scaling data would only influence the first layer of your network. Also if you are scaling your input it's better to scale it to [-1, 1], but it's best to scale it to 0 mean and 1 varianc
13,533
How exactly to compute Deep Q-Learning Loss Function?
After reviewing the equations a few more times. I think the correct loss is the following: $$\mathcal{L} = (11.1 - 4.3)^2$$ My reasoning is that the q-learning update rule for the general case is only updating the q-value for a specific $state,action$ pair. $$Q(s,a) = r + \gamma \max_{a*}Q(s',a*)$$ This equation means that the update happens only for one specific $state,action$ pair and for the neural q-network that means the loss is calculated only for one specific output unit which corresponds to a specific $action$. In the example provided $Q(s,a) = 4.3$ and the $target$ is $r + \gamma \max_{a*}Q(s',a*) = 11.1$.
How exactly to compute Deep Q-Learning Loss Function?
After reviewing the equations a few more times. I think the correct loss is the following: $$\mathcal{L} = (11.1 - 4.3)^2$$ My reasoning is that the q-learning update rule for the general case is onl
How exactly to compute Deep Q-Learning Loss Function? After reviewing the equations a few more times. I think the correct loss is the following: $$\mathcal{L} = (11.1 - 4.3)^2$$ My reasoning is that the q-learning update rule for the general case is only updating the q-value for a specific $state,action$ pair. $$Q(s,a) = r + \gamma \max_{a*}Q(s',a*)$$ This equation means that the update happens only for one specific $state,action$ pair and for the neural q-network that means the loss is calculated only for one specific output unit which corresponds to a specific $action$. In the example provided $Q(s,a) = 4.3$ and the $target$ is $r + \gamma \max_{a*}Q(s',a*) = 11.1$.
How exactly to compute Deep Q-Learning Loss Function? After reviewing the equations a few more times. I think the correct loss is the following: $$\mathcal{L} = (11.1 - 4.3)^2$$ My reasoning is that the q-learning update rule for the general case is onl
13,534
How exactly to compute Deep Q-Learning Loss Function?
TLDR: Probably won't matter unless you have a large action space. If your loss function is MSE, then the calculated loss is half of the term specific loss (if action space = 2). This may matter if your action space is large and may slow down training since the slope of the loss function is reduced by a factor equal to the action space of your problem. next_q = self.model.predict(next_obss) next_q[np.where(dones)] = np.zeros([self.action_shape]) qs = self.model.predict(obss) qs[range(len(qs)), actions] = rewards + GAMMA * np.max(next_q, axis=1) h = self.model.fit(obss, qs, verbose=0) As you mentioned, only the q values which correspond to the current action performed are updated. Therefore, the loss numerator remains constant. Assuming an action space of 2( possible values: {0,1}). L = 1/2[ Q - Q_old ]^2 # Capital implying Vector L = 1/2[ (q_0 - q_old_0)^2 + (q_1 - q_old_1)^2] If the selected action was 1 then the 0th value remains unchanged therefore, it cancels out and vice versa. Thus, all the terms cancel out except for the action currently performed. However, the denominator would keep increasing as per the action space. For an action space of n = 2, MSE(Q(s)) = 1/n * (squared error for Q(s,a))
How exactly to compute Deep Q-Learning Loss Function?
TLDR: Probably won't matter unless you have a large action space. If your loss function is MSE, then the calculated loss is half of the term specific loss (if action space = 2). This may matter if you
How exactly to compute Deep Q-Learning Loss Function? TLDR: Probably won't matter unless you have a large action space. If your loss function is MSE, then the calculated loss is half of the term specific loss (if action space = 2). This may matter if your action space is large and may slow down training since the slope of the loss function is reduced by a factor equal to the action space of your problem. next_q = self.model.predict(next_obss) next_q[np.where(dones)] = np.zeros([self.action_shape]) qs = self.model.predict(obss) qs[range(len(qs)), actions] = rewards + GAMMA * np.max(next_q, axis=1) h = self.model.fit(obss, qs, verbose=0) As you mentioned, only the q values which correspond to the current action performed are updated. Therefore, the loss numerator remains constant. Assuming an action space of 2( possible values: {0,1}). L = 1/2[ Q - Q_old ]^2 # Capital implying Vector L = 1/2[ (q_0 - q_old_0)^2 + (q_1 - q_old_1)^2] If the selected action was 1 then the 0th value remains unchanged therefore, it cancels out and vice versa. Thus, all the terms cancel out except for the action currently performed. However, the denominator would keep increasing as per the action space. For an action space of n = 2, MSE(Q(s)) = 1/n * (squared error for Q(s,a))
How exactly to compute Deep Q-Learning Loss Function? TLDR: Probably won't matter unless you have a large action space. If your loss function is MSE, then the calculated loss is half of the term specific loss (if action space = 2). This may matter if you
13,535
Use of standard error of bootstrap distribution
There are several problems in this question. First, there is the question of whether bootstrapped averages will be sensible estimators even when some of the individual bootstrapped estimators are not computable (lack of convergence, non-existence of solutions). Second, given that the bootstrapped estimators are sensible, there is a question of how to obtain confidence intervals or perhaps just standard errors for these estimates. The idea of averaging bootstrapped estimates is closely related to, if not actually the same as, bootstrap aggregation, or bagging, used in machine learning to improve prediction performance of weak predictors. See ESL, Section 8.7. In certain cases $-$ also for estimating parameters $-$ the averaging of bootstrap estimates may reduce the variance of the resulting estimator compared to just using the estimator on the original data set. The purpose in the question is, however, to produce estimates even in cases where the algorithm for computing the estimates may fail occasionally or where the estimator is occasionally undefined. As a general approach there is a problem: Averaging bootstrapped estimates while blindly throwing away the bootstrapped samples for which the estimates are not computable will in general give biased results. How severe the general problem is depends on several things. For instance, how frequently the estimate is not computable and whether the conditional distribution of the sample given that the estimate is not computable differs from the conditional distribution of the sample given that the estimate is computable. I would not recommend to use the method. For the second part of the question we need a little notation. If $X$ denotes our original data set, $\hat{\theta}$ our estimator (assume for simplicity it is real valued and allowed to take the value NA) such that $\hat{\theta}(X)$ is the estimate for the original data set, and $Y$ denotes a single bootstrapped sample then the bootstrap averaging is effectively computing the estimator $$\tilde{\theta}(X) = E(\hat{\theta}(Y) \mid X, A(X))$$ where $A(X)$ denotes the event, depending on $X$, upon which $\hat{\theta}(Y) \neq \text{NA}$. That is, we compute the conditional expectation of the estimator on a bootstrapped sample $-$ conditioning on the original sample $X$ and the event, $A(X)$, that the estimator is computable for the bootstrapped sample. The actual bootstrap computation is a sampling based approximation of $\tilde{\theta}(X)$. The suggestion in the question is to compute the empirical standard deviation of the bootstrapped estimators, which is an estimate of the standard deviation of $\hat{\theta}(Y)$ conditionally on $X$ and $A(X)$. The desired standard deviation, the standard error, is the standard deviation of $\tilde{\theta}(X)$. You can't get the latter from the former. I see no other obvious and general way than to use a second layer of bootstrapping for obtaining a reliable estimate of the standard error. The discussion on the estimation of the standard error is independent of how the conditioning on $A(X)$ affects the bias of the estimator $\tilde{\theta}(X)$. If the effect is severe then even with correct estimates of the standard error, a confidence interval will be misleading. Edit: The very nice paper Estimation and Accuracy After Model Selection by Efron gives a general method for estimating the standard error of a bagged estimator without using a second layer of bootstrapping. The paper does not deal explicitly with estimators that are occasionally not computable.
Use of standard error of bootstrap distribution
There are several problems in this question. First, there is the question of whether bootstrapped averages will be sensible estimators even when some of the individual bootstrapped estimators are not
Use of standard error of bootstrap distribution There are several problems in this question. First, there is the question of whether bootstrapped averages will be sensible estimators even when some of the individual bootstrapped estimators are not computable (lack of convergence, non-existence of solutions). Second, given that the bootstrapped estimators are sensible, there is a question of how to obtain confidence intervals or perhaps just standard errors for these estimates. The idea of averaging bootstrapped estimates is closely related to, if not actually the same as, bootstrap aggregation, or bagging, used in machine learning to improve prediction performance of weak predictors. See ESL, Section 8.7. In certain cases $-$ also for estimating parameters $-$ the averaging of bootstrap estimates may reduce the variance of the resulting estimator compared to just using the estimator on the original data set. The purpose in the question is, however, to produce estimates even in cases where the algorithm for computing the estimates may fail occasionally or where the estimator is occasionally undefined. As a general approach there is a problem: Averaging bootstrapped estimates while blindly throwing away the bootstrapped samples for which the estimates are not computable will in general give biased results. How severe the general problem is depends on several things. For instance, how frequently the estimate is not computable and whether the conditional distribution of the sample given that the estimate is not computable differs from the conditional distribution of the sample given that the estimate is computable. I would not recommend to use the method. For the second part of the question we need a little notation. If $X$ denotes our original data set, $\hat{\theta}$ our estimator (assume for simplicity it is real valued and allowed to take the value NA) such that $\hat{\theta}(X)$ is the estimate for the original data set, and $Y$ denotes a single bootstrapped sample then the bootstrap averaging is effectively computing the estimator $$\tilde{\theta}(X) = E(\hat{\theta}(Y) \mid X, A(X))$$ where $A(X)$ denotes the event, depending on $X$, upon which $\hat{\theta}(Y) \neq \text{NA}$. That is, we compute the conditional expectation of the estimator on a bootstrapped sample $-$ conditioning on the original sample $X$ and the event, $A(X)$, that the estimator is computable for the bootstrapped sample. The actual bootstrap computation is a sampling based approximation of $\tilde{\theta}(X)$. The suggestion in the question is to compute the empirical standard deviation of the bootstrapped estimators, which is an estimate of the standard deviation of $\hat{\theta}(Y)$ conditionally on $X$ and $A(X)$. The desired standard deviation, the standard error, is the standard deviation of $\tilde{\theta}(X)$. You can't get the latter from the former. I see no other obvious and general way than to use a second layer of bootstrapping for obtaining a reliable estimate of the standard error. The discussion on the estimation of the standard error is independent of how the conditioning on $A(X)$ affects the bias of the estimator $\tilde{\theta}(X)$. If the effect is severe then even with correct estimates of the standard error, a confidence interval will be misleading. Edit: The very nice paper Estimation and Accuracy After Model Selection by Efron gives a general method for estimating the standard error of a bagged estimator without using a second layer of bootstrapping. The paper does not deal explicitly with estimators that are occasionally not computable.
Use of standard error of bootstrap distribution There are several problems in this question. First, there is the question of whether bootstrapped averages will be sensible estimators even when some of the individual bootstrapped estimators are not
13,536
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics?
To my knowledge there is no deeper reason, apart from the fact that a lot of the people who took ANNs beyond the Perceptron stage were physicists. Apart from the mentioned benefits, this particular choice has more advantages. As mentioned, it has a single parameter that determines the output behaviour. Which in turn can be optimized or tuned in itself. In short, it is a very handy and well known function that achieves a kind of 'regularization', in the sense that even the largest input values are restricted. Of course there are many other possible functions that fulfill the same requirements, but they are less well known in the world of physics. And most of the time, they are harder to use.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther
To my knowledge there is no deeper reason, apart from the fact that a lot of the people who took ANNs beyond the Perceptron stage were physicists. Apart from the mentioned benefits, this particular ch
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics? To my knowledge there is no deeper reason, apart from the fact that a lot of the people who took ANNs beyond the Perceptron stage were physicists. Apart from the mentioned benefits, this particular choice has more advantages. As mentioned, it has a single parameter that determines the output behaviour. Which in turn can be optimized or tuned in itself. In short, it is a very handy and well known function that achieves a kind of 'regularization', in the sense that even the largest input values are restricted. Of course there are many other possible functions that fulfill the same requirements, but they are less well known in the world of physics. And most of the time, they are harder to use.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther To my knowledge there is no deeper reason, apart from the fact that a lot of the people who took ANNs beyond the Perceptron stage were physicists. Apart from the mentioned benefits, this particular ch
13,537
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics?
the softmax function is also used in discrete choice modelling, it is same as the logit model, if u assume there is a utility function associated with each class, and the utility function equals to the output of neural network + an error term following the Gumbel distribution, the probability of belonging to a class equals to the softmax function with neural network as input. See: https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf there is alternatives to the logit model, such as the probit model, where the error term is assumed to follow standard normal distribution, which is a better assumption. however, the likelihood would be intractable and is computational expensive to solve, therefore not commonly used in neural network
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther
the softmax function is also used in discrete choice modelling, it is same as the logit model, if u assume there is a utility function associated with each class, and the utility function equals to th
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics? the softmax function is also used in discrete choice modelling, it is same as the logit model, if u assume there is a utility function associated with each class, and the utility function equals to the output of neural network + an error term following the Gumbel distribution, the probability of belonging to a class equals to the softmax function with neural network as input. See: https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf there is alternatives to the logit model, such as the probit model, where the error term is assumed to follow standard normal distribution, which is a better assumption. however, the likelihood would be intractable and is computational expensive to solve, therefore not commonly used in neural network
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther the softmax function is also used in discrete choice modelling, it is same as the logit model, if u assume there is a utility function associated with each class, and the utility function equals to th
13,538
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics?
Yes. There is a connection, one that is articulated in the following paper: Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One. Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, Kevin Swersky. ICLR 2020. In particular, we can think of neural networks with softmax as inspired by an energy-based formulation, and in particular, by a Boltzmann distribution. Basically, we try to fit a Boltzmann distribution to the data, and then use that construct a classifier. The paper suggests that we should think about neural networks as follows: we should think of them as a way of defining an energy-based model for estimating the joint probability $p(x,y)$, via the formula $$p(x,y) = c \cdot e^{f(x)[y]},$$ where here $f(x)[y]$ represents the logit output for class $y$, when neural network $f$ is given input $x$, and $c$ is an appropriate normalizing constant. This is basically a way to parametrize the probability distribution $p(x,y)$ in a learnable way: the problem of learning a classifier is to learn a function $f$ so that $c \cdot e^{f(x)[y]}$ is a good approximation to the true joint distribution $p(x,y)$. Notice that this formula means that we are approximating $p(x,y)$ by a Boltzmann distribution. In particular, the Boltzmann distribution would be $p(x,y) = c \cdot e^{-\epsilon_{x,y}/(kT)}$. Here we take the special case of $kT=1$. Moreover, we use the neural network to predict the appropriate $\epsilon_{x,y}$ values: in particular, we define $\epsilon_{x,y}$ to be the logit value produced by the neural network. Given this definition, we can now use this to build a discriminative classifier. In particular, we can calculate $$\begin{align*} p(y|x) &= {p(x,y) \over p(x)}\\ &={p(x,y) \over \sum_{y'} p(x,y')}\\ &={c \cdot e^{f(x)[y]} \over \sum_{y'} c \cdot e^{f(x)[y']}}\\ &={e^{f(x)[y]} \over \sum_{y'} e^{f(x)[y']}} \end{align*}$$ Looking closely, we see that the latter expression is exactly the softmax applied to the logits $f(x)$. Therefore, using this energy-based approach to fitting the distribution $p(x,y)$ yields exactly the same result as constructing a neural network that ends with a softmax layer. It's just two different ways to look at the same thing. Hopefully this now makes clear the connection. See the paper above for more details and discussion.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther
Yes. There is a connection, one that is articulated in the following paper: Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One. Will Grathwohl, Kuan-Chieh Wang, Jörn-
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics? Yes. There is a connection, one that is articulated in the following paper: Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One. Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, Kevin Swersky. ICLR 2020. In particular, we can think of neural networks with softmax as inspired by an energy-based formulation, and in particular, by a Boltzmann distribution. Basically, we try to fit a Boltzmann distribution to the data, and then use that construct a classifier. The paper suggests that we should think about neural networks as follows: we should think of them as a way of defining an energy-based model for estimating the joint probability $p(x,y)$, via the formula $$p(x,y) = c \cdot e^{f(x)[y]},$$ where here $f(x)[y]$ represents the logit output for class $y$, when neural network $f$ is given input $x$, and $c$ is an appropriate normalizing constant. This is basically a way to parametrize the probability distribution $p(x,y)$ in a learnable way: the problem of learning a classifier is to learn a function $f$ so that $c \cdot e^{f(x)[y]}$ is a good approximation to the true joint distribution $p(x,y)$. Notice that this formula means that we are approximating $p(x,y)$ by a Boltzmann distribution. In particular, the Boltzmann distribution would be $p(x,y) = c \cdot e^{-\epsilon_{x,y}/(kT)}$. Here we take the special case of $kT=1$. Moreover, we use the neural network to predict the appropriate $\epsilon_{x,y}$ values: in particular, we define $\epsilon_{x,y}$ to be the logit value produced by the neural network. Given this definition, we can now use this to build a discriminative classifier. In particular, we can calculate $$\begin{align*} p(y|x) &= {p(x,y) \over p(x)}\\ &={p(x,y) \over \sum_{y'} p(x,y')}\\ &={c \cdot e^{f(x)[y]} \over \sum_{y'} c \cdot e^{f(x)[y']}}\\ &={e^{f(x)[y]} \over \sum_{y'} e^{f(x)[y']}} \end{align*}$$ Looking closely, we see that the latter expression is exactly the softmax applied to the logits $f(x)$. Therefore, using this energy-based approach to fitting the distribution $p(x,y)$ yields exactly the same result as constructing a neural network that ends with a softmax layer. It's just two different ways to look at the same thing. Hopefully this now makes clear the connection. See the paper above for more details and discussion.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther Yes. There is a connection, one that is articulated in the following paper: Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One. Will Grathwohl, Kuan-Chieh Wang, Jörn-
13,539
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics?
Here is an academic paper published in the Journal of Statistical Physics by various physicists at MIT: https://dspace.mit.edu/handle/1721.1/135715. The paper discusses the relation of the softmax function to statistical physics. The authors claim that the relation between the Boltzmann distribution from thermodynamics and machine learning is deep.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther
Here is an academic paper published in the Journal of Statistical Physics by various physicists at MIT: https://dspace.mit.edu/handle/1721.1/135715. The paper discusses the relation of the softmax fun
How deep is the connection between the softmax function in ML and the Boltzmann distribution in thermodynamics? Here is an academic paper published in the Journal of Statistical Physics by various physicists at MIT: https://dspace.mit.edu/handle/1721.1/135715. The paper discusses the relation of the softmax function to statistical physics. The authors claim that the relation between the Boltzmann distribution from thermodynamics and machine learning is deep.
How deep is the connection between the softmax function in ML and the Boltzmann distribution in ther Here is an academic paper published in the Journal of Statistical Physics by various physicists at MIT: https://dspace.mit.edu/handle/1721.1/135715. The paper discusses the relation of the softmax fun
13,540
R: glm function with family = "binomial" and "weight" specification
Your example is merely causing rounding error in R. Large weights don't perform well in glm. It's true that scaling w by virtually any smaller number, like 100, leads to same estimates as the unscaled w. If you want more reliable behavior with the weights arguments, try using the svyglm function from the survey package. See here: > svyglm(Y~1, design=svydesign(ids=~1, weights=~w, data=data.frame(w=w*1000, Y=Y)), family=binomial) Independent Sampling design (with replacement) svydesign(ids = ~1, weights = ~w, data = data.frame(w = w * 1000, Y = Y)) Call: svyglm(formula = Y ~ 1, design = svydesign(ids = ~1, weights = ~w2, data = data.frame(w2 = w * 1000, Y = Y)), family = binomial) Coefficients: (Intercept) -2.197 Degrees of Freedom: 3 Total (i.e. Null); 3 Residual Null Deviance: 2.601 Residual Deviance: 2.601 AIC: 2.843
R: glm function with family = "binomial" and "weight" specification
Your example is merely causing rounding error in R. Large weights don't perform well in glm. It's true that scaling w by virtually any smaller number, like 100, leads to same estimates as the unscaled
R: glm function with family = "binomial" and "weight" specification Your example is merely causing rounding error in R. Large weights don't perform well in glm. It's true that scaling w by virtually any smaller number, like 100, leads to same estimates as the unscaled w. If you want more reliable behavior with the weights arguments, try using the svyglm function from the survey package. See here: > svyglm(Y~1, design=svydesign(ids=~1, weights=~w, data=data.frame(w=w*1000, Y=Y)), family=binomial) Independent Sampling design (with replacement) svydesign(ids = ~1, weights = ~w, data = data.frame(w = w * 1000, Y = Y)) Call: svyglm(formula = Y ~ 1, design = svydesign(ids = ~1, weights = ~w2, data = data.frame(w2 = w * 1000, Y = Y)), family = binomial) Coefficients: (Intercept) -2.197 Degrees of Freedom: 3 Total (i.e. Null); 3 Residual Null Deviance: 2.601 Residual Deviance: 2.601 AIC: 2.843
R: glm function with family = "binomial" and "weight" specification Your example is merely causing rounding error in R. Large weights don't perform well in glm. It's true that scaling w by virtually any smaller number, like 100, leads to same estimates as the unscaled
13,541
R: glm function with family = "binomial" and "weight" specification
I think it comes down to the initial values that is used in glm.fit from the family$initialize which makes the method divergere. As far as I know, glm.fit solve the problem by forming a QR-decomposition of $\sqrt{W}X$ where $X$ is the design matrix and $\sqrt{W}$ is a diagonal with square roots of the entries as described here. That is, uses a Newton–Raphson method. The relevant $intialize code is: if (NCOL(y) == 1) { if (is.factor(y)) y <- y != levels(y)[1L] n <- rep.int(1, nobs) y[weights == 0] <- 0 if (any(y < 0 | y > 1)) stop("y values must be 0 <= y <= 1") mustart <- (weights * y + 0.5)/(weights + 1) m <- weights * y if (any(abs(m - round(m)) > 0.001)) warning("non-integer #successes in a binomial glm!") } Here is a simplified version of glm.fit which shows my point > ##### > # setup > y <- matrix(c(1,0,0,0), ncol = 1) > weights <- 1:nrow(y) * 1000 > nobs <- length(y) > family <- binomial() > X <- matrix(rep(1, nobs), ncol = 1) # design matrix used later > > # set mu start as with family$initialize > if (NCOL(y) == 1) { + n <- rep.int(1, nobs) + y[weights == 0] <- 0 + mustart <- (weights * y + 0.5)/(weights + 1) + m <- weights * y + if (any(abs(m - round(m)) > 0.001)) + warning("non-integer #successes in a binomial glm!") + } > > mustart # starting value [,1] [1,] 0.9995004995 [2,] 0.0002498751 [3,] 0.0001666111 [4,] 0.0001249688 > (eta <- family$linkfun(mustart)) [,1] [1,] 7.601402 [2,] -8.294300 [3,] -8.699681 [4,] -8.987322 > > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] -5.098297 > (eta <- .coef * X) [,1] [1,] -5.098297 [2,] -5.098297 [3,] -5.098297 [4,] -5.098297 > > # repeat a few times from "start loop to fit" We can repeat the last part two more times to see that Newton-Raphson method diverges: > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] 10.47049 > (eta <- .coef * X) [,1] [1,] 10.47049 [2,] 10.47049 [3,] 10.47049 [4,] 10.47049 > > > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] -31723.76 > (eta <- .coef * X) [,1] [1,] -31723.76 [2,] -31723.76 [3,] -31723.76 [4,] -31723.76 This does not happen if you start with weights <- 1:nrow(y) or say weights <- 1:nrow(y) * 100. Notice that you can avoid divergence by setting the mustart argument. E.g. do > glm(Y ~ 1,weights = w * 1000, family = binomial, mustart = rep(0.5, 4)) Call: glm(formula = Y ~ 1, family = binomial, weights = w * 1000, mustart = rep(0.5, 4)) Coefficients: (Intercept) -2.197 Degrees of Freedom: 3 Total (i.e. Null); 3 Residual Null Deviance: 6502 Residual Deviance: 6502 AIC: 6504
R: glm function with family = "binomial" and "weight" specification
I think it comes down to the initial values that is used in glm.fit from the family$initialize which makes the method divergere. As far as I know, glm.fit solve the problem by forming a QR-decompositi
R: glm function with family = "binomial" and "weight" specification I think it comes down to the initial values that is used in glm.fit from the family$initialize which makes the method divergere. As far as I know, glm.fit solve the problem by forming a QR-decomposition of $\sqrt{W}X$ where $X$ is the design matrix and $\sqrt{W}$ is a diagonal with square roots of the entries as described here. That is, uses a Newton–Raphson method. The relevant $intialize code is: if (NCOL(y) == 1) { if (is.factor(y)) y <- y != levels(y)[1L] n <- rep.int(1, nobs) y[weights == 0] <- 0 if (any(y < 0 | y > 1)) stop("y values must be 0 <= y <= 1") mustart <- (weights * y + 0.5)/(weights + 1) m <- weights * y if (any(abs(m - round(m)) > 0.001)) warning("non-integer #successes in a binomial glm!") } Here is a simplified version of glm.fit which shows my point > ##### > # setup > y <- matrix(c(1,0,0,0), ncol = 1) > weights <- 1:nrow(y) * 1000 > nobs <- length(y) > family <- binomial() > X <- matrix(rep(1, nobs), ncol = 1) # design matrix used later > > # set mu start as with family$initialize > if (NCOL(y) == 1) { + n <- rep.int(1, nobs) + y[weights == 0] <- 0 + mustart <- (weights * y + 0.5)/(weights + 1) + m <- weights * y + if (any(abs(m - round(m)) > 0.001)) + warning("non-integer #successes in a binomial glm!") + } > > mustart # starting value [,1] [1,] 0.9995004995 [2,] 0.0002498751 [3,] 0.0001666111 [4,] 0.0001249688 > (eta <- family$linkfun(mustart)) [,1] [1,] 7.601402 [2,] -8.294300 [3,] -8.699681 [4,] -8.987322 > > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] -5.098297 > (eta <- .coef * X) [,1] [1,] -5.098297 [2,] -5.098297 [3,] -5.098297 [4,] -5.098297 > > # repeat a few times from "start loop to fit" We can repeat the last part two more times to see that Newton-Raphson method diverges: > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] 10.47049 > (eta <- .coef * X) [,1] [1,] 10.47049 [2,] 10.47049 [3,] 10.47049 [4,] 10.47049 > > > ##### > # Start loop to fit > mu <- family$linkinv(eta) > mu_eta <- family$mu.eta(eta) > z <- drop(eta + (y - mu) / mu_eta) > w <- drop(sqrt(weights * mu_eta^2 / family$variance(mu = mu))) > > # code is simpler here as (X^T W X) is a scalar > X_w <- X * w > (.coef <- drop(crossprod(X_w)^-1 * ((w * z) %*% X_w))) [1] -31723.76 > (eta <- .coef * X) [,1] [1,] -31723.76 [2,] -31723.76 [3,] -31723.76 [4,] -31723.76 This does not happen if you start with weights <- 1:nrow(y) or say weights <- 1:nrow(y) * 100. Notice that you can avoid divergence by setting the mustart argument. E.g. do > glm(Y ~ 1,weights = w * 1000, family = binomial, mustart = rep(0.5, 4)) Call: glm(formula = Y ~ 1, family = binomial, weights = w * 1000, mustart = rep(0.5, 4)) Coefficients: (Intercept) -2.197 Degrees of Freedom: 3 Total (i.e. Null); 3 Residual Null Deviance: 6502 Residual Deviance: 6502 AIC: 6504
R: glm function with family = "binomial" and "weight" specification I think it comes down to the initial values that is used in glm.fit from the family$initialize which makes the method divergere. As far as I know, glm.fit solve the problem by forming a QR-decompositi
13,542
Difference between Randomization test and Permutation test
There is quite a bit of overlap and the most common form of the permutation test is a form of a randomization test. Some purists consider the true permutation test to be based on every possible permutation of the data. But in practice we sample from the set of all possible permutations and so that is a randomization test. There are also bootstrap tests, if we don't find every possible bootstrap sample but rather sample from the possible set (what is usually done) then this is also a randomization test (but not a permutation test).
Difference between Randomization test and Permutation test
There is quite a bit of overlap and the most common form of the permutation test is a form of a randomization test. Some purists consider the true permutation test to be based on every possible perm
Difference between Randomization test and Permutation test There is quite a bit of overlap and the most common form of the permutation test is a form of a randomization test. Some purists consider the true permutation test to be based on every possible permutation of the data. But in practice we sample from the set of all possible permutations and so that is a randomization test. There are also bootstrap tests, if we don't find every possible bootstrap sample but rather sample from the possible set (what is usually done) then this is also a randomization test (but not a permutation test).
Difference between Randomization test and Permutation test There is quite a bit of overlap and the most common form of the permutation test is a form of a randomization test. Some purists consider the true permutation test to be based on every possible perm
13,543
Definition and Convergence of Iteratively Reweighted Least Squares
As for your first question, one should define "standard", or acknowledge that a "canonical model" has been gradually established. As a comment indicated, it appears at least that the way you use IRWLS is rather standard. As for your second question, "contraction mapping in probability" could be linked (however informally) to convergence of "recursive stochastic algorithms". From what I read, there is a huge literature on the subject mainly in Engineering. In Economics, we use a tiny bit of it, especially the seminal works of Lennart Ljung -the first paper was Ljung (1977)- which showed that the convergence (or not) of a recursive stochastic algorithm can be determined by the stability (or not) of a related ordinary differential equation. (what follows has been re-worked after a fruitful discussion with the OP in the comments) Convergence I will use as reference Saber Elaydi "An Introduction to Difference Equations", 2005, 3d ed. The analysis is conditional on some given data sample, so the $x's$ are treated as fixed. The first-order condition for the minimization of the objective function, viewed as a recursive function in $m$, $$m(k+1) = \sum_{i=1}^{N} v_i[m(k)] x_i, \;\; v_i[m(k)] \equiv \frac{w_i[m(k)]}{ \sum_{i=1}^{N} w_i[m(k)]} \qquad [1]$$ has a fixed point (the argmin of the objective function). By Theorem 1.13 pp 27-28 of Elaydi, if the first derivative with respect to $m$ of the RHS of $[1]$, evaluated at the fixed point $m^*$, denote it $A'(m^*)$, is smaller than unity in absolute value, then $m^*$ is asymptotically stable (AS). More over by Theorem 4.3 p.179 we have that this also implies that the fixed point is uniformly AS (UAS). "Asymptotically stable" means that for some range of values around the fixed point, a neighborhood $(m^* \pm \gamma)$, not necessarily small in size, the fixed point is attractive , and so if the algorithm gives values in this neighborhood, it will converge. The property being "uniform", means that the boundary of this neighborhood, and hence its size, is independent of the initial value of the algorithm. The fixed point becomes globally UAS, if $\gamma = \infty$. So in our case, if we prove that $$|A'(m^*)|\equiv \left|\sum_{i=1}^{N} \frac{\partial v_i(m^*)}{\partial m}x_i\right| <1 \qquad [2]$$ we have proven the UAS property, but without global convergence. Then we can either try to establish that the neighborhood of attraction is in fact the whole extended real numbers, or, that the specific starting value the OP uses as mentioned in the comments (and it is standard in IRLS methodology), i.e. the sample mean of the $x$'s, $\bar x$, always belongs to the neighborhood of attraction of the fixed point. We calculate the derivative $$\frac{\partial v_i(m^*)}{\partial m} = \frac {\frac{\partial w_i(m^*)}{\partial m}\sum_{i=1}^{N} w_i(m^*)-w_i(m^*)\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}}{\left(\sum_{i=1}^{N} w_i(m^*)\right)^2}$$ $$=\frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\frac{\partial w_i(m^*)}{\partial m}-v_i(m^*)\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right]$$ Then $$A'(m^*) = \frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}x_i-\left(\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right)\sum_{i=1}^{N}v_i(m^*)x_i\right]$$ $$=\frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}x_i-\left(\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right)m^*\right]$$ and $$|A'(m^*)| <1 \Rightarrow \left|\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}(x_i-m^*)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right| \qquad [3]$$ we have $$\begin{align}\frac{\partial w_i(m^*)}{\partial m} = &\frac{-\rho''(|x_i-m^*|)\cdot \frac {x_i-m^*}{|x_i-m^*|}|x_i-m^*|+\frac {x_i-m^*}{|x_i-m^*|}\rho'(|x_i-m^*|)}{|x_i-m^*|^2} \\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^3}\rho'(|x_i-m^*|) - \rho''(|x_i-m^*|)\cdot \frac {x_i-m^*}{|x_i-m^*|^2} \\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[\frac {\rho'(|x_i-m^*|)}{|x_i-m^*|}-\rho''(|x_i-m^*|)\right]\\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[w_i(m^*)-\rho''(|x_i-m^*|)\right] \end{align}$$ Inserting this into $[3]$ we have $$\left|\sum_{i=1}^{N}\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[w_i(m^*)-\rho''(|x_i-m^*|)\right](x_i-m^*)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right|$$ $$\Rightarrow \left|\sum_{i=1}^{N}w_i(m^*)-\sum_{i=1}^{N}\rho''(|x_i-m^*|)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right| \qquad [4]$$ This is the condition that must be satisfied for the fixed point to be UAS. Since in our case the penalty function is convex, the sums involved are positive. So condition $[4]$ is equivalent to $$\sum_{i=1}^{N}\rho''(|x_i-m^*|) < 2\sum_{i=1}^{N}w_i(m^*) \qquad [5]$$ If $\rho(|x_i-m|)$ is Hubert's loss function, then we have a quadratic ($q$) and a linear ($l$) branch, $$\rho(|x_i-m|)=\cases{ (1/2)|x_i- m|^2 \qquad\;\;\;\; |x_i-m|\leq \delta \\ \\ \delta\big(|x_i-m|-\delta/2\big) \qquad |x_i-m|> \delta}$$ and $$\rho'(|x_i-m|)=\cases{ |x_i- m| \qquad |x_i-m|\leq \delta \\ \\ \delta \qquad \qquad \;\;\;\; |x_i-m|> \delta}$$ $$\rho''(|x_i-m|)=\cases{ 1\qquad |x_i-m|\leq \delta \\ \\ 0 \qquad |x_i-m|> \delta} $$ $$\cases{ w_{i,q}(m) =1\qquad \qquad \qquad |x_i-m|\leq \delta \\ \\ w_{i,l}(m) =\frac {\delta}{|x_i-m|} <1 \qquad |x_i-m|> \delta} $$ Since we do not know how many of the $|x_i-m^*|$'s place us in the quadratic branch and how many in the linear, we decompose condition $[5]$ as ($N_q + N_l = N$) $$\sum_{i=1}^{N_q}\rho_q''+\sum_{i=1}^{N_l}\rho_l'' < 2\left[\sum_{i=1}^{N_q}w_{i,q} +\sum_{i=1}^{N_l}w_{i,l}\right]$$ $$\Rightarrow N_q + 0 < 2\left[N_q +\sum_{i=1}^{N_l}w_{i,l}\right] \Rightarrow 0 < N_q+2\sum_{i=1}^{N_l}w_{i,l}$$ which holds. So for the Huber loss function the fixed point of the algorithm is uniformly asymptotically stable, irrespective of the $x$'s. We note that the first derivative is smaller than unity in absolute value for any $m$, not just the fixed point. What we should do now is either prove that the UAS property is also global, or that, if $m(0) = \bar x$ then $m(0)$ belongs to the neighborhood of attraction of $m^*$.
Definition and Convergence of Iteratively Reweighted Least Squares
As for your first question, one should define "standard", or acknowledge that a "canonical model" has been gradually established. As a comment indicated, it appears at least that the way you use IRWLS
Definition and Convergence of Iteratively Reweighted Least Squares As for your first question, one should define "standard", or acknowledge that a "canonical model" has been gradually established. As a comment indicated, it appears at least that the way you use IRWLS is rather standard. As for your second question, "contraction mapping in probability" could be linked (however informally) to convergence of "recursive stochastic algorithms". From what I read, there is a huge literature on the subject mainly in Engineering. In Economics, we use a tiny bit of it, especially the seminal works of Lennart Ljung -the first paper was Ljung (1977)- which showed that the convergence (or not) of a recursive stochastic algorithm can be determined by the stability (or not) of a related ordinary differential equation. (what follows has been re-worked after a fruitful discussion with the OP in the comments) Convergence I will use as reference Saber Elaydi "An Introduction to Difference Equations", 2005, 3d ed. The analysis is conditional on some given data sample, so the $x's$ are treated as fixed. The first-order condition for the minimization of the objective function, viewed as a recursive function in $m$, $$m(k+1) = \sum_{i=1}^{N} v_i[m(k)] x_i, \;\; v_i[m(k)] \equiv \frac{w_i[m(k)]}{ \sum_{i=1}^{N} w_i[m(k)]} \qquad [1]$$ has a fixed point (the argmin of the objective function). By Theorem 1.13 pp 27-28 of Elaydi, if the first derivative with respect to $m$ of the RHS of $[1]$, evaluated at the fixed point $m^*$, denote it $A'(m^*)$, is smaller than unity in absolute value, then $m^*$ is asymptotically stable (AS). More over by Theorem 4.3 p.179 we have that this also implies that the fixed point is uniformly AS (UAS). "Asymptotically stable" means that for some range of values around the fixed point, a neighborhood $(m^* \pm \gamma)$, not necessarily small in size, the fixed point is attractive , and so if the algorithm gives values in this neighborhood, it will converge. The property being "uniform", means that the boundary of this neighborhood, and hence its size, is independent of the initial value of the algorithm. The fixed point becomes globally UAS, if $\gamma = \infty$. So in our case, if we prove that $$|A'(m^*)|\equiv \left|\sum_{i=1}^{N} \frac{\partial v_i(m^*)}{\partial m}x_i\right| <1 \qquad [2]$$ we have proven the UAS property, but without global convergence. Then we can either try to establish that the neighborhood of attraction is in fact the whole extended real numbers, or, that the specific starting value the OP uses as mentioned in the comments (and it is standard in IRLS methodology), i.e. the sample mean of the $x$'s, $\bar x$, always belongs to the neighborhood of attraction of the fixed point. We calculate the derivative $$\frac{\partial v_i(m^*)}{\partial m} = \frac {\frac{\partial w_i(m^*)}{\partial m}\sum_{i=1}^{N} w_i(m^*)-w_i(m^*)\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}}{\left(\sum_{i=1}^{N} w_i(m^*)\right)^2}$$ $$=\frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\frac{\partial w_i(m^*)}{\partial m}-v_i(m^*)\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right]$$ Then $$A'(m^*) = \frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}x_i-\left(\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right)\sum_{i=1}^{N}v_i(m^*)x_i\right]$$ $$=\frac 1{\sum_{i=1}^{N} w_i(m^*)}\cdot\left[\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}x_i-\left(\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}\right)m^*\right]$$ and $$|A'(m^*)| <1 \Rightarrow \left|\sum_{i=1}^{N}\frac{\partial w_i(m^*)}{\partial m}(x_i-m^*)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right| \qquad [3]$$ we have $$\begin{align}\frac{\partial w_i(m^*)}{\partial m} = &\frac{-\rho''(|x_i-m^*|)\cdot \frac {x_i-m^*}{|x_i-m^*|}|x_i-m^*|+\frac {x_i-m^*}{|x_i-m^*|}\rho'(|x_i-m^*|)}{|x_i-m^*|^2} \\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^3}\rho'(|x_i-m^*|) - \rho''(|x_i-m^*|)\cdot \frac {x_i-m^*}{|x_i-m^*|^2} \\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[\frac {\rho'(|x_i-m^*|)}{|x_i-m^*|}-\rho''(|x_i-m^*|)\right]\\ \\ &=\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[w_i(m^*)-\rho''(|x_i-m^*|)\right] \end{align}$$ Inserting this into $[3]$ we have $$\left|\sum_{i=1}^{N}\frac {x_i-m^*}{|x_i-m^*|^2}\cdot \left[w_i(m^*)-\rho''(|x_i-m^*|)\right](x_i-m^*)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right|$$ $$\Rightarrow \left|\sum_{i=1}^{N}w_i(m^*)-\sum_{i=1}^{N}\rho''(|x_i-m^*|)\right| < \left|\sum_{i=1}^{N} w_i(m^*)\right| \qquad [4]$$ This is the condition that must be satisfied for the fixed point to be UAS. Since in our case the penalty function is convex, the sums involved are positive. So condition $[4]$ is equivalent to $$\sum_{i=1}^{N}\rho''(|x_i-m^*|) < 2\sum_{i=1}^{N}w_i(m^*) \qquad [5]$$ If $\rho(|x_i-m|)$ is Hubert's loss function, then we have a quadratic ($q$) and a linear ($l$) branch, $$\rho(|x_i-m|)=\cases{ (1/2)|x_i- m|^2 \qquad\;\;\;\; |x_i-m|\leq \delta \\ \\ \delta\big(|x_i-m|-\delta/2\big) \qquad |x_i-m|> \delta}$$ and $$\rho'(|x_i-m|)=\cases{ |x_i- m| \qquad |x_i-m|\leq \delta \\ \\ \delta \qquad \qquad \;\;\;\; |x_i-m|> \delta}$$ $$\rho''(|x_i-m|)=\cases{ 1\qquad |x_i-m|\leq \delta \\ \\ 0 \qquad |x_i-m|> \delta} $$ $$\cases{ w_{i,q}(m) =1\qquad \qquad \qquad |x_i-m|\leq \delta \\ \\ w_{i,l}(m) =\frac {\delta}{|x_i-m|} <1 \qquad |x_i-m|> \delta} $$ Since we do not know how many of the $|x_i-m^*|$'s place us in the quadratic branch and how many in the linear, we decompose condition $[5]$ as ($N_q + N_l = N$) $$\sum_{i=1}^{N_q}\rho_q''+\sum_{i=1}^{N_l}\rho_l'' < 2\left[\sum_{i=1}^{N_q}w_{i,q} +\sum_{i=1}^{N_l}w_{i,l}\right]$$ $$\Rightarrow N_q + 0 < 2\left[N_q +\sum_{i=1}^{N_l}w_{i,l}\right] \Rightarrow 0 < N_q+2\sum_{i=1}^{N_l}w_{i,l}$$ which holds. So for the Huber loss function the fixed point of the algorithm is uniformly asymptotically stable, irrespective of the $x$'s. We note that the first derivative is smaller than unity in absolute value for any $m$, not just the fixed point. What we should do now is either prove that the UAS property is also global, or that, if $m(0) = \bar x$ then $m(0)$ belongs to the neighborhood of attraction of $m^*$.
Definition and Convergence of Iteratively Reweighted Least Squares As for your first question, one should define "standard", or acknowledge that a "canonical model" has been gradually established. As a comment indicated, it appears at least that the way you use IRWLS
13,544
Definition and Convergence of Iteratively Reweighted Least Squares
Is this the standard IRLS algorithm? IRLS algorithms can be generally said to find/approach a solution to a minimization problem by using an iterative process that generates a sequence of solutions to a weighted least squares problem. There is no standard, but your approach seems to fit this general description. What is maybe atypical, different, is that a lot IRLS problems have a different cost function or distance measure. A common case is when the cost function is a $\ell_1$, $\ell_\infty$, or other $\ell_p$ norm instead of a general function $\rho$, and the functions in which the approximation is to be found can be multidimensional and non-linear (replacing your $m$ with a non-linear function of regressor variables and unknown parameters). Convergence seems to work in practice, but I have a few concerns about it. I've yet to see a proof of it. Convergence will depend on the function $\rho(z)$ and convexity is not sufficient. A counter example is when $\rho(z) = z^p$ with $p>3$. That will make the weights as following (where $z$ is the difference $x-m$) $$w(z) = \frac{pz^{p-1}}{z} = pz^{p-2}$$ The rate at which the weights increase is larger for the points further away. So a change of $m$ will shift the values $z_i$ and make the weights of the furthest point larger and make the weight of that point more important in the next itteration. The solution will diverge and end up switching back and forth between two points. Below is an example when your cost function is a power of 4. You see that the algorithm does not converge. In addition the example show the convergence for an alternative algorithm (in fact, it is the first printed IRLS algorithm from 1961 by Lawson which is described in The Lawson Algorithm and Extensions Rice and Usow 1968) layout(matrix(1:4,2)) set.seed(1) xi = runif(10)*20-10 xi new_weights = function(wi) { m = sum(wi*xi) ri = xi-m wi = ri^2/sum(ri^2) } new_weights_lawson = function(wi) { m = sum(wi*xi) ri = abs(xi-m) wi = (wi*ri)^(2/3)/sum((wi*ri)^(2/3)) } #### itterated reweight wi = rep(0.1,10) ### start mv = sum(wi*xi) for (i in 1:30) { wi = new_weights(wi) mv = c(mv,sum(wi*xi)) } plot(mv, type = "l", main = expression(w[i+1,j] == over("|"*r[i,j]*"|"^(p-2), sum("|"*r[i,j]*"|"^(p-2),j=1,n)))) #### itterated reweight lwawson wi = rep(0.1,10) ### start mv = sum(wi*xi) for (i in 1:30) { wi = new_weights_lawson(wi) mv = c(mv,sum(wi*xi)) } plot(mv, type = "l", main = expression(w[i+1,j] == over("|"*w[i,j]*r[i,j]*"|"^((p-2)/(p-1)), sum("|"*w[i,j]*r[i,j]*"|"^((p-2)/(p-1)),j=1,n)))) cost = function(m) { ri = abs(xi-m) cost = sum(ri^4) } cost = Vectorize(cost) m = seq(0.6,0.8,0.001) plot(m,cost(m), type = "l") Some doodle Here is some doodling and graph that I used while figuring out what is going on set.seed(1) ### cost function Cost = function(x) { if (x>0) { 0.1*1/3*x^3 } else { 1/1.5*abs(x)^1.5 } } Cost = Vectorize(Cost) ### derivative of cost function dCost = function(x) { if (x>0) { 0.1*x^2 } else { -abs(x)^0.5 } } dCost = Vectorize(dCost) ### cost as function of m costm = function(m) { sum(Cost(xi-m)) } costm = Vectorize(costm) ### compute the map from old m to new m solvem = function(m) { w = dCost(xi-m)/(xi-m) mn = sum(w*xi)/sum(w) mn } solvem = Vectorize(solvem) layout(matrix(1:4,2)) x = seq(-10,10,0.01) dJ = dCost(x) plot(x,dJ, type = "l", xlab = "xi-m", main = "derivative of cost function") xi = runif(10)*20-10 dJi = dCost(xi) points(xi,dJi, pch = 20) m = seq(-10,10,0.001) mn = solvem(m) plot(m,costm(m) , main = "cost as function of m") plot(m,mn, type = "l", main = "mapping of old to new m", xlab = "old m", ylab = "new m") lines(c(-10,10),c(-10,10), col = 2) sel = which.min(costm(m)) lines(c(-10,10),c(10,-10)+2*m[sel], col = 2) plot(x,dCost(x)/x, type = "l", xlab = "z", main = "weights as function of z = x-m", ylab = "dCost(z)/z") m[sel] xi min(costm(m))
Definition and Convergence of Iteratively Reweighted Least Squares
Is this the standard IRLS algorithm? IRLS algorithms can be generally said to find/approach a solution to a minimization problem by using an iterative process that generates a sequence of solutions t
Definition and Convergence of Iteratively Reweighted Least Squares Is this the standard IRLS algorithm? IRLS algorithms can be generally said to find/approach a solution to a minimization problem by using an iterative process that generates a sequence of solutions to a weighted least squares problem. There is no standard, but your approach seems to fit this general description. What is maybe atypical, different, is that a lot IRLS problems have a different cost function or distance measure. A common case is when the cost function is a $\ell_1$, $\ell_\infty$, or other $\ell_p$ norm instead of a general function $\rho$, and the functions in which the approximation is to be found can be multidimensional and non-linear (replacing your $m$ with a non-linear function of regressor variables and unknown parameters). Convergence seems to work in practice, but I have a few concerns about it. I've yet to see a proof of it. Convergence will depend on the function $\rho(z)$ and convexity is not sufficient. A counter example is when $\rho(z) = z^p$ with $p>3$. That will make the weights as following (where $z$ is the difference $x-m$) $$w(z) = \frac{pz^{p-1}}{z} = pz^{p-2}$$ The rate at which the weights increase is larger for the points further away. So a change of $m$ will shift the values $z_i$ and make the weights of the furthest point larger and make the weight of that point more important in the next itteration. The solution will diverge and end up switching back and forth between two points. Below is an example when your cost function is a power of 4. You see that the algorithm does not converge. In addition the example show the convergence for an alternative algorithm (in fact, it is the first printed IRLS algorithm from 1961 by Lawson which is described in The Lawson Algorithm and Extensions Rice and Usow 1968) layout(matrix(1:4,2)) set.seed(1) xi = runif(10)*20-10 xi new_weights = function(wi) { m = sum(wi*xi) ri = xi-m wi = ri^2/sum(ri^2) } new_weights_lawson = function(wi) { m = sum(wi*xi) ri = abs(xi-m) wi = (wi*ri)^(2/3)/sum((wi*ri)^(2/3)) } #### itterated reweight wi = rep(0.1,10) ### start mv = sum(wi*xi) for (i in 1:30) { wi = new_weights(wi) mv = c(mv,sum(wi*xi)) } plot(mv, type = "l", main = expression(w[i+1,j] == over("|"*r[i,j]*"|"^(p-2), sum("|"*r[i,j]*"|"^(p-2),j=1,n)))) #### itterated reweight lwawson wi = rep(0.1,10) ### start mv = sum(wi*xi) for (i in 1:30) { wi = new_weights_lawson(wi) mv = c(mv,sum(wi*xi)) } plot(mv, type = "l", main = expression(w[i+1,j] == over("|"*w[i,j]*r[i,j]*"|"^((p-2)/(p-1)), sum("|"*w[i,j]*r[i,j]*"|"^((p-2)/(p-1)),j=1,n)))) cost = function(m) { ri = abs(xi-m) cost = sum(ri^4) } cost = Vectorize(cost) m = seq(0.6,0.8,0.001) plot(m,cost(m), type = "l") Some doodle Here is some doodling and graph that I used while figuring out what is going on set.seed(1) ### cost function Cost = function(x) { if (x>0) { 0.1*1/3*x^3 } else { 1/1.5*abs(x)^1.5 } } Cost = Vectorize(Cost) ### derivative of cost function dCost = function(x) { if (x>0) { 0.1*x^2 } else { -abs(x)^0.5 } } dCost = Vectorize(dCost) ### cost as function of m costm = function(m) { sum(Cost(xi-m)) } costm = Vectorize(costm) ### compute the map from old m to new m solvem = function(m) { w = dCost(xi-m)/(xi-m) mn = sum(w*xi)/sum(w) mn } solvem = Vectorize(solvem) layout(matrix(1:4,2)) x = seq(-10,10,0.01) dJ = dCost(x) plot(x,dJ, type = "l", xlab = "xi-m", main = "derivative of cost function") xi = runif(10)*20-10 dJi = dCost(xi) points(xi,dJi, pch = 20) m = seq(-10,10,0.001) mn = solvem(m) plot(m,costm(m) , main = "cost as function of m") plot(m,mn, type = "l", main = "mapping of old to new m", xlab = "old m", ylab = "new m") lines(c(-10,10),c(-10,10), col = 2) sel = which.min(costm(m)) lines(c(-10,10),c(10,-10)+2*m[sel], col = 2) plot(x,dCost(x)/x, type = "l", xlab = "z", main = "weights as function of z = x-m", ylab = "dCost(z)/z") m[sel] xi min(costm(m))
Definition and Convergence of Iteratively Reweighted Least Squares Is this the standard IRLS algorithm? IRLS algorithms can be generally said to find/approach a solution to a minimization problem by using an iterative process that generates a sequence of solutions t
13,545
Semi-supervised learning, active learning and deep learning for classification
It seems as if deep learning might be very interesting for you. This is a very recent field of deep connectionist models which are pretrained in an unsupervised way and fine tuned afterwards with supervision. The fine tuning requires a much less samples than the pretraining. To wet your tongue, I recommend [Semantig Hashing Salakhutdinov, Hinton. Have a look at the codes this finds for distinct documents of the Reuters corpus: (unsupervised!) If you need some code implemented, check out deeplearning.net. I don't believe there are out of the box solutions, though.
Semi-supervised learning, active learning and deep learning for classification
It seems as if deep learning might be very interesting for you. This is a very recent field of deep connectionist models which are pretrained in an unsupervised way and fine tuned afterwards with supe
Semi-supervised learning, active learning and deep learning for classification It seems as if deep learning might be very interesting for you. This is a very recent field of deep connectionist models which are pretrained in an unsupervised way and fine tuned afterwards with supervision. The fine tuning requires a much less samples than the pretraining. To wet your tongue, I recommend [Semantig Hashing Salakhutdinov, Hinton. Have a look at the codes this finds for distinct documents of the Reuters corpus: (unsupervised!) If you need some code implemented, check out deeplearning.net. I don't believe there are out of the box solutions, though.
Semi-supervised learning, active learning and deep learning for classification It seems as if deep learning might be very interesting for you. This is a very recent field of deep connectionist models which are pretrained in an unsupervised way and fine tuned afterwards with supe
13,546
Semi-supervised learning, active learning and deep learning for classification
Isabelle Guyon (and colleagues) organised a challenge on active learning a while back, the proceedings are published here (open access). This has the advantage of being quite practical and you can directly compare the performances of different approaches under an unbiased (in a colloquial sense) protocol (random selection of patterns is surprisingly hard to beat).
Semi-supervised learning, active learning and deep learning for classification
Isabelle Guyon (and colleagues) organised a challenge on active learning a while back, the proceedings are published here (open access). This has the advantage of being quite practical and you can di
Semi-supervised learning, active learning and deep learning for classification Isabelle Guyon (and colleagues) organised a challenge on active learning a while back, the proceedings are published here (open access). This has the advantage of being quite practical and you can directly compare the performances of different approaches under an unbiased (in a colloquial sense) protocol (random selection of patterns is surprisingly hard to beat).
Semi-supervised learning, active learning and deep learning for classification Isabelle Guyon (and colleagues) organised a challenge on active learning a while back, the proceedings are published here (open access). This has the advantage of being quite practical and you can di
13,547
Semi-supervised learning, active learning and deep learning for classification
Here is a nice list of libraries. http://www.infoworld.com/article/2608742/predictive-analytics/5-ways-to-add-machine-learning-to-java--javascript--and-more.html
Semi-supervised learning, active learning and deep learning for classification
Here is a nice list of libraries. http://www.infoworld.com/article/2608742/predictive-analytics/5-ways-to-add-machine-learning-to-java--javascript--and-more.html
Semi-supervised learning, active learning and deep learning for classification Here is a nice list of libraries. http://www.infoworld.com/article/2608742/predictive-analytics/5-ways-to-add-machine-learning-to-java--javascript--and-more.html
Semi-supervised learning, active learning and deep learning for classification Here is a nice list of libraries. http://www.infoworld.com/article/2608742/predictive-analytics/5-ways-to-add-machine-learning-to-java--javascript--and-more.html
13,548
Why are Gaussian Processes valid statistical models for time series forecasting?
Some relevant concepts may come along in the question Why does including latitude and longitude in a GAM account for spatial autocorrelation? If you use Gaussian processing in regression then you include the trend in the model definition $y(t) = f(t,\theta) + \epsilon(t)$ where those errors are $\epsilon(t) \sim \mathcal{N}(0,{\Sigma})$ with $\Sigma$ depending on some function of the distance between points. In the case of your data, CO2 levels, it might be that the periodic component is more systematic than just noise with a periodic correlation, which means you might be better of by incorporating it into the model Demonstration using the DiceKriging model in R. The first image shows a fit of the trend line $y(t) = \beta_0 + \beta_1 t + \beta_2 t^2 +\beta_3 \sin(2 \pi t) + \beta_4 \sin(2 \pi t)$. The 95% confidence interval is much smaller than compared with the arima image. But note that the residual term is also very small and there are a lot of datapoints. For comparison three other fits are made. A simpler (linear) model with less datapoints is fit. Here you can see the effect of the error in the trend line causing the prediction confidence interval to increase when extrapolating further away (this confidence interval is also only as much correct as the model is correct). An ordinary least squares model. You can see that it provides more or less the same confidence interval as the Gaussian process model An ordinary Kriging model. This is a gaussian process without the trend included. The predicted values will be equal to the mean when you extrapolate far away. The error estimate is large because the residual terms (data-mean) are large. library(DiceKriging) library(datasets) # data y <- as.numeric(co2) x <- c(1:length(y))/12 # design-matrix # the model is a linear sum of x, x^2, sin(2*pi*x), and cos(2*pi*x) xm <- cbind(rep(1,length(x)),x, x^2, sin(2*pi*x), cos(2*pi*x)) colnames(xm) <- c("i","x","x2","sin","cos") # fitting non-stationary Gaussian processes epsilon <- 10^-3 fit1 <- km(formula= ~x+x2+sin+cos, design = as.data.frame(xm[,-1]), response = as.data.frame(y), covtype="matern3_2", nugget=epsilon) # fitting simpler model and with less data (5 years) epsilon <- 10^-3 fit2 <- km(formula= ~x, design = data.frame(x=x[120:180]), response = data.frame(y=y[120:180]), covtype="matern3_2", nugget=epsilon) # fitting OLS fit3 <- lm(y~1+x+x2+sin+cos, data = as.data.frame(cbind(y,xm))) # ordinary kriging epsilon <- 10^-3 fit4 <- km(formula= ~1, design = data.frame(x=x), response = data.frame(y=y), covtype="matern3_2", nugget=epsilon) # predictions and errors newx <- seq(0,80,1/12/4) newxm <- cbind(rep(1,length(newx)),newx, newx^2, sin(2*pi*newx), cos(2*pi*newx)) colnames(newxm) <- c("i","x","x2","sin","cos") # using the type="UK" 'universal kriging' in the predict function # makes the prediction for the SE take into account the variance of model parameter estimates newy1 <- predict(fit1, type="UK", newdata = as.data.frame(newxm[,-1])) newy2 <- predict(fit2, type="UK", newdata = data.frame(x=newx)) newy3 <- predict(fit3, interval = "confidence", newdata = as.data.frame(x=newxm)) newy4 <- predict(fit4, type="UK", newdata = data.frame(x=newx)) # plotting plot(1959-1/24+newx, newy1$mean, col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy1$lower95), newy1$upper95), col = rgb(0,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.3, col=1, bg="white") title("Gausian process with polynomial + trigonometric function for trend") # plotting plot(1959-1/24+newx, newy2$mean, col = 2, type = "l", xlim = c(1959, 2010), ylim=c(300, 380), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy2$lower95), newy2$upper95), col = rgb(1,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.5, col=1, bg="white") points(1959-1/24+x[120:180], y[120:180], pch=21, cex=0.5, col=1, bg=2) title("Gausian process with linear function for trend") # plotting plot(1959-1/24+newx, newy3[,1], col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy3[,2]), newy3[,3]), col = rgb(0,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.3, col=1, bg="white") title("Ordinory linear regression with polynomial + trigonometric function for trend") # plotting plot(1959-1/24+newx, newy4$mean, col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy4$lower95), newy4$upper95), col = rgb(0,0,0,0.3), border = NA, lwd=0.01) points(1959-1/24+x, y, pch=21, cex=0.5, col=1, bg="white") title("ordinary kriging")
Why are Gaussian Processes valid statistical models for time series forecasting?
Some relevant concepts may come along in the question Why does including latitude and longitude in a GAM account for spatial autocorrelation? If you use Gaussian processing in regression then you incl
Why are Gaussian Processes valid statistical models for time series forecasting? Some relevant concepts may come along in the question Why does including latitude and longitude in a GAM account for spatial autocorrelation? If you use Gaussian processing in regression then you include the trend in the model definition $y(t) = f(t,\theta) + \epsilon(t)$ where those errors are $\epsilon(t) \sim \mathcal{N}(0,{\Sigma})$ with $\Sigma$ depending on some function of the distance between points. In the case of your data, CO2 levels, it might be that the periodic component is more systematic than just noise with a periodic correlation, which means you might be better of by incorporating it into the model Demonstration using the DiceKriging model in R. The first image shows a fit of the trend line $y(t) = \beta_0 + \beta_1 t + \beta_2 t^2 +\beta_3 \sin(2 \pi t) + \beta_4 \sin(2 \pi t)$. The 95% confidence interval is much smaller than compared with the arima image. But note that the residual term is also very small and there are a lot of datapoints. For comparison three other fits are made. A simpler (linear) model with less datapoints is fit. Here you can see the effect of the error in the trend line causing the prediction confidence interval to increase when extrapolating further away (this confidence interval is also only as much correct as the model is correct). An ordinary least squares model. You can see that it provides more or less the same confidence interval as the Gaussian process model An ordinary Kriging model. This is a gaussian process without the trend included. The predicted values will be equal to the mean when you extrapolate far away. The error estimate is large because the residual terms (data-mean) are large. library(DiceKriging) library(datasets) # data y <- as.numeric(co2) x <- c(1:length(y))/12 # design-matrix # the model is a linear sum of x, x^2, sin(2*pi*x), and cos(2*pi*x) xm <- cbind(rep(1,length(x)),x, x^2, sin(2*pi*x), cos(2*pi*x)) colnames(xm) <- c("i","x","x2","sin","cos") # fitting non-stationary Gaussian processes epsilon <- 10^-3 fit1 <- km(formula= ~x+x2+sin+cos, design = as.data.frame(xm[,-1]), response = as.data.frame(y), covtype="matern3_2", nugget=epsilon) # fitting simpler model and with less data (5 years) epsilon <- 10^-3 fit2 <- km(formula= ~x, design = data.frame(x=x[120:180]), response = data.frame(y=y[120:180]), covtype="matern3_2", nugget=epsilon) # fitting OLS fit3 <- lm(y~1+x+x2+sin+cos, data = as.data.frame(cbind(y,xm))) # ordinary kriging epsilon <- 10^-3 fit4 <- km(formula= ~1, design = data.frame(x=x), response = data.frame(y=y), covtype="matern3_2", nugget=epsilon) # predictions and errors newx <- seq(0,80,1/12/4) newxm <- cbind(rep(1,length(newx)),newx, newx^2, sin(2*pi*newx), cos(2*pi*newx)) colnames(newxm) <- c("i","x","x2","sin","cos") # using the type="UK" 'universal kriging' in the predict function # makes the prediction for the SE take into account the variance of model parameter estimates newy1 <- predict(fit1, type="UK", newdata = as.data.frame(newxm[,-1])) newy2 <- predict(fit2, type="UK", newdata = data.frame(x=newx)) newy3 <- predict(fit3, interval = "confidence", newdata = as.data.frame(x=newxm)) newy4 <- predict(fit4, type="UK", newdata = data.frame(x=newx)) # plotting plot(1959-1/24+newx, newy1$mean, col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy1$lower95), newy1$upper95), col = rgb(0,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.3, col=1, bg="white") title("Gausian process with polynomial + trigonometric function for trend") # plotting plot(1959-1/24+newx, newy2$mean, col = 2, type = "l", xlim = c(1959, 2010), ylim=c(300, 380), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy2$lower95), newy2$upper95), col = rgb(1,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.5, col=1, bg="white") points(1959-1/24+x[120:180], y[120:180], pch=21, cex=0.5, col=1, bg=2) title("Gausian process with linear function for trend") # plotting plot(1959-1/24+newx, newy3[,1], col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy3[,2]), newy3[,3]), col = rgb(0,0,0,0.3), border = NA) points(1959-1/24+x, y, pch=21, cex=0.3, col=1, bg="white") title("Ordinory linear regression with polynomial + trigonometric function for trend") # plotting plot(1959-1/24+newx, newy4$mean, col = 1, type = "l", xlim = c(1959, 2039), ylim=c(300, 480), xlab = "time [years]", ylab = "atmospheric CO2 [ppm]") polygon(c(rev(1959-1/24+newx), 1959-1/24+newx), c(rev(newy4$lower95), newy4$upper95), col = rgb(0,0,0,0.3), border = NA, lwd=0.01) points(1959-1/24+x, y, pch=21, cex=0.5, col=1, bg="white") title("ordinary kriging")
Why are Gaussian Processes valid statistical models for time series forecasting? Some relevant concepts may come along in the question Why does including latitude and longitude in a GAM account for spatial autocorrelation? If you use Gaussian processing in regression then you incl
13,549
Why are Gaussian Processes valid statistical models for time series forecasting?
One of the main assumptions for GP is that data should be stationary. Your data has a clear trend therefore it is not stationary. The correct way to use GP in time series (and in any other type of data) is that first you remove some obvious trends, then apply GP over the residual.
Why are Gaussian Processes valid statistical models for time series forecasting?
One of the main assumptions for GP is that data should be stationary. Your data has a clear trend therefore it is not stationary. The correct way to use GP in time series (and in any other type of dat
Why are Gaussian Processes valid statistical models for time series forecasting? One of the main assumptions for GP is that data should be stationary. Your data has a clear trend therefore it is not stationary. The correct way to use GP in time series (and in any other type of data) is that first you remove some obvious trends, then apply GP over the residual.
Why are Gaussian Processes valid statistical models for time series forecasting? One of the main assumptions for GP is that data should be stationary. Your data has a clear trend therefore it is not stationary. The correct way to use GP in time series (and in any other type of dat
13,550
Is it better to do exploratory data analysis on the training dataset only?
I'd recommend having a look at "7.10.2 The Wrong and Right Way to Do Cross-validation" in http://statweb.stanford.edu/~tibs/ElemStatLearn/printings/ESLII_print10.pdf. The authors give an example in which someone does the following: Screen the predictors: find a subset of “good” predictors that show fairly strong (univariate) correlation with the class labels Using just this subset of predictors, build a multivariate classifier. Use cross-validation to estimate the unknown tuning parameters and to estimate the prediction error of the final model This sounds very similar to doing EDA on all (i.e. training plus test) of your data and using the EDA to select "good" predictors. The authors explain why this is problematic: the cross-validated error rate will be artificially low, which might mislead you into thinking you've found a good model.
Is it better to do exploratory data analysis on the training dataset only?
I'd recommend having a look at "7.10.2 The Wrong and Right Way to Do Cross-validation" in http://statweb.stanford.edu/~tibs/ElemStatLearn/printings/ESLII_print10.pdf. The authors give an example in wh
Is it better to do exploratory data analysis on the training dataset only? I'd recommend having a look at "7.10.2 The Wrong and Right Way to Do Cross-validation" in http://statweb.stanford.edu/~tibs/ElemStatLearn/printings/ESLII_print10.pdf. The authors give an example in which someone does the following: Screen the predictors: find a subset of “good” predictors that show fairly strong (univariate) correlation with the class labels Using just this subset of predictors, build a multivariate classifier. Use cross-validation to estimate the unknown tuning parameters and to estimate the prediction error of the final model This sounds very similar to doing EDA on all (i.e. training plus test) of your data and using the EDA to select "good" predictors. The authors explain why this is problematic: the cross-validated error rate will be artificially low, which might mislead you into thinking you've found a good model.
Is it better to do exploratory data analysis on the training dataset only? I'd recommend having a look at "7.10.2 The Wrong and Right Way to Do Cross-validation" in http://statweb.stanford.edu/~tibs/ElemStatLearn/printings/ESLII_print10.pdf. The authors give an example in wh
13,551
Is it better to do exploratory data analysis on the training dataset only?
So you want to identify independent variables that have an effect on your dependent variable? Then, both of your approaches are actually not really recommendable. After having defined your research question, you should develop your theory. That is to say, that using the literature, you should identify variables which should have an effect (you should be able to explain the reason).
Is it better to do exploratory data analysis on the training dataset only?
So you want to identify independent variables that have an effect on your dependent variable? Then, both of your approaches are actually not really recommendable. After having defined your research q
Is it better to do exploratory data analysis on the training dataset only? So you want to identify independent variables that have an effect on your dependent variable? Then, both of your approaches are actually not really recommendable. After having defined your research question, you should develop your theory. That is to say, that using the literature, you should identify variables which should have an effect (you should be able to explain the reason).
Is it better to do exploratory data analysis on the training dataset only? So you want to identify independent variables that have an effect on your dependent variable? Then, both of your approaches are actually not really recommendable. After having defined your research q
13,552
Is it better to do exploratory data analysis on the training dataset only?
Applying EDA on test data is wrong. Training is the process of looking into the correct answers to create the best model. This process it not just limited to running code on training data. Using information from EDA to decide which model to use, to tweak parameters, and so forth is part of the training process and hence should not be allowed access to test data. So to be true to yourself, use test data only to check your model's performance. Also, if you realize the model doesn't perform well during testing and then you go back to adjusting your model, then that is not good either. Instead, split your training data into two. Use one for training and another to test and tweak your model(s). See What is the difference between test set and validation set?
Is it better to do exploratory data analysis on the training dataset only?
Applying EDA on test data is wrong. Training is the process of looking into the correct answers to create the best model. This process it not just limited to running code on training data. Using infor
Is it better to do exploratory data analysis on the training dataset only? Applying EDA on test data is wrong. Training is the process of looking into the correct answers to create the best model. This process it not just limited to running code on training data. Using information from EDA to decide which model to use, to tweak parameters, and so forth is part of the training process and hence should not be allowed access to test data. So to be true to yourself, use test data only to check your model's performance. Also, if you realize the model doesn't perform well during testing and then you go back to adjusting your model, then that is not good either. Instead, split your training data into two. Use one for training and another to test and tweak your model(s). See What is the difference between test set and validation set?
Is it better to do exploratory data analysis on the training dataset only? Applying EDA on test data is wrong. Training is the process of looking into the correct answers to create the best model. This process it not just limited to running code on training data. Using infor
13,553
Is it better to do exploratory data analysis on the training dataset only?
After the paragraph of this answer. Hastie further explains p.245: "Here is the correct way to carry out cross-validation in this example: Divide the samples into K cross-validation folds (groups) at random. For each fold k = 1, 2, . . . , K (a) Find a subset of “good” predictors that show fairly strong (univariate) correlation with the class labels, using all of the samples except those in fold k. (b) Using just this subset of predictors, build a multivariate classifier, using all of the samples except those in fold k. (c) Use the classifier to predict the class labels for the samples in fold k."
Is it better to do exploratory data analysis on the training dataset only?
After the paragraph of this answer. Hastie further explains p.245: "Here is the correct way to carry out cross-validation in this example: Divide the samples into K cross-validation folds (groups) a
Is it better to do exploratory data analysis on the training dataset only? After the paragraph of this answer. Hastie further explains p.245: "Here is the correct way to carry out cross-validation in this example: Divide the samples into K cross-validation folds (groups) at random. For each fold k = 1, 2, . . . , K (a) Find a subset of “good” predictors that show fairly strong (univariate) correlation with the class labels, using all of the samples except those in fold k. (b) Using just this subset of predictors, build a multivariate classifier, using all of the samples except those in fold k. (c) Use the classifier to predict the class labels for the samples in fold k."
Is it better to do exploratory data analysis on the training dataset only? After the paragraph of this answer. Hastie further explains p.245: "Here is the correct way to carry out cross-validation in this example: Divide the samples into K cross-validation folds (groups) a
13,554
Is it better to do exploratory data analysis on the training dataset only?
You do EDA on the entire data set. For instance, if you're using leave-one-out cross validation, how would you do EDA only on a training data set? In this case every observation is training and holdout at least once. So, no, you form your understanding of the data on the entire sample. If you're in the industrial set up, it's even more evident. You're expected to show the trends and general description of the data to the stakeholders in the firm, and you do that on the entire sample.
Is it better to do exploratory data analysis on the training dataset only?
You do EDA on the entire data set. For instance, if you're using leave-one-out cross validation, how would you do EDA only on a training data set? In this case every observation is training and holdou
Is it better to do exploratory data analysis on the training dataset only? You do EDA on the entire data set. For instance, if you're using leave-one-out cross validation, how would you do EDA only on a training data set? In this case every observation is training and holdout at least once. So, no, you form your understanding of the data on the entire sample. If you're in the industrial set up, it's even more evident. You're expected to show the trends and general description of the data to the stakeholders in the firm, and you do that on the entire sample.
Is it better to do exploratory data analysis on the training dataset only? You do EDA on the entire data set. For instance, if you're using leave-one-out cross validation, how would you do EDA only on a training data set? In this case every observation is training and holdou
13,555
Is there any required amount of variance captured by PCA in order to do later analyses?
Regarding your particular questions: Is there any required value of how much variance should be captured by PCA to be valid? No, there is not (to my best of knowledge). I firmly believe that there is no single value you can use; no magic threshold of the captured variance percentage. The Cangelosi and Goriely's article : Component retention in principal component analysis with application to cDNA microarray data gives a rather nice overview of half a dozen standard rules of thumb to detect the number of components in a study. (Scree plot, Proportion of total variance explained, Average eigenvalue rule, Log-eigenvalue diagram, etc.) As rules of thumb I would not strongly rely on any of them. Is it not dependent on the domain knowledge and methodology in use? Ideally it should be dependent but you need to be careful how you word it and what you mean. For example: In Acoustics there is the notion of Just Noticeable Difference (JND). Assume you are analyzing an acoustics sample and a particular PC has physical-scale variation well below that JND threshold. Nobody can readily argue that for an Acoustics application you should have included that PC. You would be analyzing inaudible noise. There might be some reasons to include this PC but these reasons need to be presented not the other way around. Are they notions similar to JND for RT-qPCR analysis? Similarly, if a component looks like 9th order Legendre polynomial and you have strong evidence that your sample consists of single Gaussian bumps you have good reasons to believe you are again modeling irrelevant variation. What are these orthogonal modes of variation showing? What is "wrong" with the 3rd PC in your case for example? The fact that you say "These 3 clusters turned out to be very relevant to the problem in question" is not really a strong argument. You might simple data dredge (which is a bad thing). There are other techniques, eg. Isomaps and locally-linear embedding, which are pretty cool too, why not use those? Why did you choose PCA specifically? The consistency of your findings with other findings is more important, especially if these finding are considered well-established. Dig deeper on this. Try to see if your results agree with PCA findings from other studies. Can anybody judge on the merit of the whole analysis just based on the mere value of the explained variance? In general one should not do that. Do not think that your reviewer is a bastard or anything like that though; 48% is indeed a small percentage to retain without presenting reasonable justifications.
Is there any required amount of variance captured by PCA in order to do later analyses?
Regarding your particular questions: Is there any required value of how much variance should be captured by PCA to be valid? No, there is not (to my best of knowledge). I firmly believe that there
Is there any required amount of variance captured by PCA in order to do later analyses? Regarding your particular questions: Is there any required value of how much variance should be captured by PCA to be valid? No, there is not (to my best of knowledge). I firmly believe that there is no single value you can use; no magic threshold of the captured variance percentage. The Cangelosi and Goriely's article : Component retention in principal component analysis with application to cDNA microarray data gives a rather nice overview of half a dozen standard rules of thumb to detect the number of components in a study. (Scree plot, Proportion of total variance explained, Average eigenvalue rule, Log-eigenvalue diagram, etc.) As rules of thumb I would not strongly rely on any of them. Is it not dependent on the domain knowledge and methodology in use? Ideally it should be dependent but you need to be careful how you word it and what you mean. For example: In Acoustics there is the notion of Just Noticeable Difference (JND). Assume you are analyzing an acoustics sample and a particular PC has physical-scale variation well below that JND threshold. Nobody can readily argue that for an Acoustics application you should have included that PC. You would be analyzing inaudible noise. There might be some reasons to include this PC but these reasons need to be presented not the other way around. Are they notions similar to JND for RT-qPCR analysis? Similarly, if a component looks like 9th order Legendre polynomial and you have strong evidence that your sample consists of single Gaussian bumps you have good reasons to believe you are again modeling irrelevant variation. What are these orthogonal modes of variation showing? What is "wrong" with the 3rd PC in your case for example? The fact that you say "These 3 clusters turned out to be very relevant to the problem in question" is not really a strong argument. You might simple data dredge (which is a bad thing). There are other techniques, eg. Isomaps and locally-linear embedding, which are pretty cool too, why not use those? Why did you choose PCA specifically? The consistency of your findings with other findings is more important, especially if these finding are considered well-established. Dig deeper on this. Try to see if your results agree with PCA findings from other studies. Can anybody judge on the merit of the whole analysis just based on the mere value of the explained variance? In general one should not do that. Do not think that your reviewer is a bastard or anything like that though; 48% is indeed a small percentage to retain without presenting reasonable justifications.
Is there any required amount of variance captured by PCA in order to do later analyses? Regarding your particular questions: Is there any required value of how much variance should be captured by PCA to be valid? No, there is not (to my best of knowledge). I firmly believe that there
13,556
Why do we use term “population” instead of “Data-generating process”?
There are certainly already many contexts where statisticians do refer to a process rather than a population when discussing statistical analysis (e.g., when discussing a time-series process, stochastic process, etc.). Formally, a stochastic process is a set of random variables with a common domain, indexed over some set of values. This includes time-series, sequences of random variables, etc. The concept is general enough to encompass most situations where we have a set of random variables that are of interest in a statistical problem, and so statistics already has a sufficiently well-developed language to refer to hypothesised stochastic "processes", and also refer to actual "populations" of things. Whilst statisticians do refer to and model "processes", these are abstractions that are formed by considering infinite sequences (or continuums) of random variables, and so they involve hypothesising quantities that are not all observable. The term "data-generating process" is itself problematic (and not as helpful as the existing terminology of a "stochastic process"), and I see no reason that its wide deployment would add greater understanding to statistics. Specifically, by referring to the generation of "data" this terminology pre-empts the question of what quantities are actually observed or observable. (Imagine a situation in which you want to refer to a "DGP" but then stipulate that some aspect of that process is not directly observable. Is it still appropriate to call the values in that process "data" if they are not observable?) In any case, setting aside the terminology, I see deeper problems in your approach, which go back to base issues in philosophy and the formulation of research questions. Existents vs processes in empirical research: I see a number of premises in your view that strike me as problematic, and appear to me to misunderstand the goal of most empirical research that uses statistics. When we undertake empirical research, we often want to know about relationships between things that exist in reality, not hypothesised "processes" that exist only in our models (i.e., as mathematical abstractions from reality). Indeed, in sampling problems it is usually the case that we merely wish to estimate some aspect of the distribution of some quantity pertaining to a finite population. In this context, when we refer to a "population" of interest, we are merely designating a set of things that are of interest to us in a particular research problem. Consequently, if we are presently interested in all the people currently living in the USA, we would call this group the "population" (or the "population of interest"). However, if we are interested only in the people currently living in Maine, then we would call this smaller group the "population". In each case, it does not matter whether the population can be considered as only part of a larger group --- if it is the group of interest in the present problem then we will designate it as the "population". (I note that statistical texts often engage in a slight equivocation between the population of objects of interest, and the measurements of interest pertaining to those objects. For example, an analysis on the height of people might at various times refer to the set of people as "the population" but then refer to the corresponding set of height measurements as "the population". This is a shorthand that allows statisticians to get directly to describing a set of numbers of interest.) Your philosophical approach here is at odds with this objective. You seem to be adopting a kind of Platonic view of the world, in which real-world entities are considered to be less real than some hypothesised "data-generating process" that (presumptively) generated the world. For example, in regard to the idea of referring to all the people on Earth as a "population", you claim that "...it is probably wrong, since world population is just one of hypothetical repeated random samples from DGP". This bears a substantial similarity to Plato's theory of forms, where Plato regarded observation of the world to be a mere imperfect observation of eternal Forms. In my view, a much better approach is the Aristotelian view that the things in reality exist, and we abstract from them to form our concepts. (This is a simplification of Aristotle, but you get the basic idea.)$^\dagger$ If you would like to get into literature on this issue, I think you will find that it goes deeper into the territory of philosophy (specifically metaphysics and epistemology), rather than the field of statistics. Essentially, your views here are about the broader issue of whether the things existing in reality are the proper objects of relevance to human knowledge, or whether (contrarily) they are merely an epiphenomenon of some broader hypothesised "process" that is the proper object of human inference. This is a philosophical question that has been a major part of the history of Western philosophy going back to Plato and Aristotle, so there is an enormous literature that could potentially shed light on this. I hope that this answer will set you off on the interesting journey into the field of epistemology. For present purposes, you might wish to take a practical view that also considers the objectives that researchers set for themselves in their research. Ask yourself: would researchers generally prefer to know about properties of the people living on Earth, or would they prefer to try to find out about your (hypothesised) "hypothetical repeated random samples" of people who might have lived on Earth instead of us? $^\dagger$ To avoid any possible confusion among those lacking historical knowledge, please note that these are not real quotes from Plato and Aristotle --- I have merely taken poetic license to liken their philosophical positions to the present issue.
Why do we use term “population” instead of “Data-generating process”?
There are certainly already many contexts where statisticians do refer to a process rather than a population when discussing statistical analysis (e.g., when discussing a time-series process, stochast
Why do we use term “population” instead of “Data-generating process”? There are certainly already many contexts where statisticians do refer to a process rather than a population when discussing statistical analysis (e.g., when discussing a time-series process, stochastic process, etc.). Formally, a stochastic process is a set of random variables with a common domain, indexed over some set of values. This includes time-series, sequences of random variables, etc. The concept is general enough to encompass most situations where we have a set of random variables that are of interest in a statistical problem, and so statistics already has a sufficiently well-developed language to refer to hypothesised stochastic "processes", and also refer to actual "populations" of things. Whilst statisticians do refer to and model "processes", these are abstractions that are formed by considering infinite sequences (or continuums) of random variables, and so they involve hypothesising quantities that are not all observable. The term "data-generating process" is itself problematic (and not as helpful as the existing terminology of a "stochastic process"), and I see no reason that its wide deployment would add greater understanding to statistics. Specifically, by referring to the generation of "data" this terminology pre-empts the question of what quantities are actually observed or observable. (Imagine a situation in which you want to refer to a "DGP" but then stipulate that some aspect of that process is not directly observable. Is it still appropriate to call the values in that process "data" if they are not observable?) In any case, setting aside the terminology, I see deeper problems in your approach, which go back to base issues in philosophy and the formulation of research questions. Existents vs processes in empirical research: I see a number of premises in your view that strike me as problematic, and appear to me to misunderstand the goal of most empirical research that uses statistics. When we undertake empirical research, we often want to know about relationships between things that exist in reality, not hypothesised "processes" that exist only in our models (i.e., as mathematical abstractions from reality). Indeed, in sampling problems it is usually the case that we merely wish to estimate some aspect of the distribution of some quantity pertaining to a finite population. In this context, when we refer to a "population" of interest, we are merely designating a set of things that are of interest to us in a particular research problem. Consequently, if we are presently interested in all the people currently living in the USA, we would call this group the "population" (or the "population of interest"). However, if we are interested only in the people currently living in Maine, then we would call this smaller group the "population". In each case, it does not matter whether the population can be considered as only part of a larger group --- if it is the group of interest in the present problem then we will designate it as the "population". (I note that statistical texts often engage in a slight equivocation between the population of objects of interest, and the measurements of interest pertaining to those objects. For example, an analysis on the height of people might at various times refer to the set of people as "the population" but then refer to the corresponding set of height measurements as "the population". This is a shorthand that allows statisticians to get directly to describing a set of numbers of interest.) Your philosophical approach here is at odds with this objective. You seem to be adopting a kind of Platonic view of the world, in which real-world entities are considered to be less real than some hypothesised "data-generating process" that (presumptively) generated the world. For example, in regard to the idea of referring to all the people on Earth as a "population", you claim that "...it is probably wrong, since world population is just one of hypothetical repeated random samples from DGP". This bears a substantial similarity to Plato's theory of forms, where Plato regarded observation of the world to be a mere imperfect observation of eternal Forms. In my view, a much better approach is the Aristotelian view that the things in reality exist, and we abstract from them to form our concepts. (This is a simplification of Aristotle, but you get the basic idea.)$^\dagger$ If you would like to get into literature on this issue, I think you will find that it goes deeper into the territory of philosophy (specifically metaphysics and epistemology), rather than the field of statistics. Essentially, your views here are about the broader issue of whether the things existing in reality are the proper objects of relevance to human knowledge, or whether (contrarily) they are merely an epiphenomenon of some broader hypothesised "process" that is the proper object of human inference. This is a philosophical question that has been a major part of the history of Western philosophy going back to Plato and Aristotle, so there is an enormous literature that could potentially shed light on this. I hope that this answer will set you off on the interesting journey into the field of epistemology. For present purposes, you might wish to take a practical view that also considers the objectives that researchers set for themselves in their research. Ask yourself: would researchers generally prefer to know about properties of the people living on Earth, or would they prefer to try to find out about your (hypothesised) "hypothetical repeated random samples" of people who might have lived on Earth instead of us? $^\dagger$ To avoid any possible confusion among those lacking historical knowledge, please note that these are not real quotes from Plato and Aristotle --- I have merely taken poetic license to liken their philosophical positions to the present issue.
Why do we use term “population” instead of “Data-generating process”? There are certainly already many contexts where statisticians do refer to a process rather than a population when discussing statistical analysis (e.g., when discussing a time-series process, stochast
13,557
What kinds of statistical problems are likely to benefit from quantum computing?
About quantum computing Quantum computing makes use of superposition and entanglement. Superposition means that the state of a system is a collection of multiple states that are superposed. Intuitively you can see this as quantum computing being based on wave mechanics and the state of the system is a wave. For waves we can imagine multiple waves being on top of each other. The superposition allows manipulations of multiple (superposed) waves at once in a single operation. Entanglement means that the states of multiple components in the system are linked by a single wave equation/function. For instance when two elections are created in a single event then the sum of their spins (one must be up; the other must be down) might be linked due to conservation rules (similar like conservation of energy or momentum). The big philosophical deal with entanglement is in wave function collapse. It occurs when a measurement of the state of the wave function is made (which breaks down the superposed state into a single state). The philosophical "problem" is that the event of wave function collapse instantaneously collapses the state of all entangled components over a large distance In addition there is a problem about the interpretation of this wave function collapse (and this is more related to the superposition). The wave function collapse is not something that follows from other basic principles/mechanisms, based on which we can get an intuitive grasp. It is more like some axiom or some base principle. For quantum computing it does not matter. It just works. But the human mind feels like there should be something more behind this collapse. It feels a bit, flimsy. The wave function collapse is our current day 'atom' that we try to split into parts. The entanglement allows the exponential increase in the number of states that are modeled by the superposed wave functions. The power of quantum computing The power of quantum computing lies in the combination of superposition and entanglement. The $n$ entangled quantum bits create $2^n$ different states for the system that are superposed on each other. The superposition allows us to manipulate (make computations with) all of those $2^n$ states simultaneously. The contrast with non-quantum computing is that you would have to repeat the computations $2^n$ times for each state separately. No free lunch Note that this is not a free lunch. A quantum computer is not deterministic but instead will give a different answer each time according to some distribution. We can manipulate multiple superposed waves made out of the entangled bits at the same time. But we cannot know the state/amplitude of all those superposed waves. Once we read out the state of the system we only get to read one single state out of all superposed states in the system. This is the wave function collapse when the multiple superposed waves turn into the wave of a single state. The behavior of this collapse is probabilistic. The probability to observe/collapse a particular state will depend on the wave function. The algorithms for quantum computing are made in such a way to start with a wave that encodes the $2^n$ states with more or less equal probability. Due to the manipulations/computations, the algorithm ends up with the states that are close to the solution as the ones that are most likely to be observed. What sort of benefits? Basic computations There are several basic algebraic manipulations that quantum computing can speed up. All of the statistics that are using such manipulations will benefit from quantum computing. Basically, quantum computing is able to reduce the number of computations by applying simultaneous computations. For instance, in computing a discrete Fourier transform with $2^n$ components, the quantum algorithm can use $n$ bits that encode these $2^n$ components, and by the manipulations, on those $n$ bits you effectively are doing manipulations on the $2^n$ components. Which problems? The problems that will most benefit from this simultaneous computation are large-scale problems that are currently limited by computational power (and that can be parallelized). For instance, machine learning problems, Monte Carlo simulations, or problems with a large dimensionality. The first two of these three are also nondeterministic (reducing the weak point of a quantum computer) and are like the quantum computer making approximations by using an estimate based on luck. Maybe you could better ask which kinds of (computation-heavy) statistical problems are not gonna benefit from quantum computing? There's probably not gonna be much.
What kinds of statistical problems are likely to benefit from quantum computing?
About quantum computing Quantum computing makes use of superposition and entanglement. Superposition means that the state of a system is a collection of multiple states that are superposed. Intuitive
What kinds of statistical problems are likely to benefit from quantum computing? About quantum computing Quantum computing makes use of superposition and entanglement. Superposition means that the state of a system is a collection of multiple states that are superposed. Intuitively you can see this as quantum computing being based on wave mechanics and the state of the system is a wave. For waves we can imagine multiple waves being on top of each other. The superposition allows manipulations of multiple (superposed) waves at once in a single operation. Entanglement means that the states of multiple components in the system are linked by a single wave equation/function. For instance when two elections are created in a single event then the sum of their spins (one must be up; the other must be down) might be linked due to conservation rules (similar like conservation of energy or momentum). The big philosophical deal with entanglement is in wave function collapse. It occurs when a measurement of the state of the wave function is made (which breaks down the superposed state into a single state). The philosophical "problem" is that the event of wave function collapse instantaneously collapses the state of all entangled components over a large distance In addition there is a problem about the interpretation of this wave function collapse (and this is more related to the superposition). The wave function collapse is not something that follows from other basic principles/mechanisms, based on which we can get an intuitive grasp. It is more like some axiom or some base principle. For quantum computing it does not matter. It just works. But the human mind feels like there should be something more behind this collapse. It feels a bit, flimsy. The wave function collapse is our current day 'atom' that we try to split into parts. The entanglement allows the exponential increase in the number of states that are modeled by the superposed wave functions. The power of quantum computing The power of quantum computing lies in the combination of superposition and entanglement. The $n$ entangled quantum bits create $2^n$ different states for the system that are superposed on each other. The superposition allows us to manipulate (make computations with) all of those $2^n$ states simultaneously. The contrast with non-quantum computing is that you would have to repeat the computations $2^n$ times for each state separately. No free lunch Note that this is not a free lunch. A quantum computer is not deterministic but instead will give a different answer each time according to some distribution. We can manipulate multiple superposed waves made out of the entangled bits at the same time. But we cannot know the state/amplitude of all those superposed waves. Once we read out the state of the system we only get to read one single state out of all superposed states in the system. This is the wave function collapse when the multiple superposed waves turn into the wave of a single state. The behavior of this collapse is probabilistic. The probability to observe/collapse a particular state will depend on the wave function. The algorithms for quantum computing are made in such a way to start with a wave that encodes the $2^n$ states with more or less equal probability. Due to the manipulations/computations, the algorithm ends up with the states that are close to the solution as the ones that are most likely to be observed. What sort of benefits? Basic computations There are several basic algebraic manipulations that quantum computing can speed up. All of the statistics that are using such manipulations will benefit from quantum computing. Basically, quantum computing is able to reduce the number of computations by applying simultaneous computations. For instance, in computing a discrete Fourier transform with $2^n$ components, the quantum algorithm can use $n$ bits that encode these $2^n$ components, and by the manipulations, on those $n$ bits you effectively are doing manipulations on the $2^n$ components. Which problems? The problems that will most benefit from this simultaneous computation are large-scale problems that are currently limited by computational power (and that can be parallelized). For instance, machine learning problems, Monte Carlo simulations, or problems with a large dimensionality. The first two of these three are also nondeterministic (reducing the weak point of a quantum computer) and are like the quantum computer making approximations by using an estimate based on luck. Maybe you could better ask which kinds of (computation-heavy) statistical problems are not gonna benefit from quantum computing? There's probably not gonna be much.
What kinds of statistical problems are likely to benefit from quantum computing? About quantum computing Quantum computing makes use of superposition and entanglement. Superposition means that the state of a system is a collection of multiple states that are superposed. Intuitive
13,558
What kinds of statistical problems are likely to benefit from quantum computing?
Brute force methods are most likely to benefit because of what quantum computing is. Why? One possible physical explanation of the path of a pitched baseball is that all possible quantum paths are automatically explored and the least energy expenditure path, i.e., the path of least resistance available, is chosen, and all that is done without having to build a calculator; the calculations are ineffable. Generalizing; nature can be viewed as a quantum calculator. Thus those problems that are similar, the ones that do optimization, like regression minimization of some criterion be that goodness of fit or other (goodness of fit is, in some cases, ill-posed) are the ones that will benefit. BTW, the intermediate steps; the iterations, in optimization would not be calculated, only the final result, just like when a baseball pitch occurs. That is, only the actual path of the baseball occurs, the alternative paths are automatically excluded. One difference between a statistical implementation and a physical event is, however, that the error of the statistical calculation can be made as small as desired by arbitrarily increasing the precision, (e.g., to 65 decimal places), and this is not typically achievable physically. For example, even a pitching machine will not throw a baseball in an exactly duplicated pathway.
What kinds of statistical problems are likely to benefit from quantum computing?
Brute force methods are most likely to benefit because of what quantum computing is. Why? One possible physical explanation of the path of a pitched baseball is that all possible quantum paths are aut
What kinds of statistical problems are likely to benefit from quantum computing? Brute force methods are most likely to benefit because of what quantum computing is. Why? One possible physical explanation of the path of a pitched baseball is that all possible quantum paths are automatically explored and the least energy expenditure path, i.e., the path of least resistance available, is chosen, and all that is done without having to build a calculator; the calculations are ineffable. Generalizing; nature can be viewed as a quantum calculator. Thus those problems that are similar, the ones that do optimization, like regression minimization of some criterion be that goodness of fit or other (goodness of fit is, in some cases, ill-posed) are the ones that will benefit. BTW, the intermediate steps; the iterations, in optimization would not be calculated, only the final result, just like when a baseball pitch occurs. That is, only the actual path of the baseball occurs, the alternative paths are automatically excluded. One difference between a statistical implementation and a physical event is, however, that the error of the statistical calculation can be made as small as desired by arbitrarily increasing the precision, (e.g., to 65 decimal places), and this is not typically achievable physically. For example, even a pitching machine will not throw a baseball in an exactly duplicated pathway.
What kinds of statistical problems are likely to benefit from quantum computing? Brute force methods are most likely to benefit because of what quantum computing is. Why? One possible physical explanation of the path of a pitched baseball is that all possible quantum paths are aut
13,559
What kinds of statistical problems are likely to benefit from quantum computing?
I liked the answer above on baseball. But I would be cautious about what quantum computing might do well. It seems like it might do very well at things like cracking cryptographic schemes and the like: being able to superimpose all solutions and then collapse onto the actual one might go quite fast. But in the 1980s - which was a very long time ago - there was a very high-profile company named Thinking Machines. See this article: https://en.wikipedia.org/wiki/Thinking_Machines_Corporation The whole idea had a whiff of quantum computing. It utilized a n-dimensional hypercube arrangement. Imagine, if you will, four (very simple) microprocessors connected in a square. Each could do a computation, then share the result with the processor before it (counterclockwise), after it (clockwise), or opposite it (across). Next imagine 8 processors in a cube that can expand that concept to three dimensions (each processor can now share its output with one or more of 7 others: 3 along a vertex of the cube; three across the face of a square the processor was part of, and one diagonal in 3-space). Now take this up, to maybe 64 processors in a 6-dimensional hypercube. This was one of the hottest ideas of the time (along with the dedicated, 34 bit Lisp machine that Symbolics put out, and the slightly bizarre cache-only memory system put out by Kendall Square Research - both have wikipedia pages worth reading). The problem was that there was precisely one, and only one algorithm that actually worked well on the TM architecture: a Fast Fourier Transform using what was called the "Perfect Shuffle Algorithm". It was a genius insight into how to use a binary mask technique, the bespoke algorithm, and the architecture to parallel process an FFT in a brilliantly clever and fast way. But I don't think they ever found another single use for it. (see this related question: https://cs.stackexchange.com/questions/10572/perfect-shuffle-in-parallel-processing) I have been around long enough to realize that technologies that seem brilliant and powerful often end up to not solve a problem (or enough problems) to make them useful. There were lots of brilliant ideas at the time: TM, Symbolics, KSR, as well as Tandem (gone) and Stratus (amazingly, still alive). Everyone thought these companies - at least some of them - would take over the world and revolutionize computing. But, instead, we got FaceBook.
What kinds of statistical problems are likely to benefit from quantum computing?
I liked the answer above on baseball. But I would be cautious about what quantum computing might do well. It seems like it might do very well at things like cracking cryptographic schemes and the lik
What kinds of statistical problems are likely to benefit from quantum computing? I liked the answer above on baseball. But I would be cautious about what quantum computing might do well. It seems like it might do very well at things like cracking cryptographic schemes and the like: being able to superimpose all solutions and then collapse onto the actual one might go quite fast. But in the 1980s - which was a very long time ago - there was a very high-profile company named Thinking Machines. See this article: https://en.wikipedia.org/wiki/Thinking_Machines_Corporation The whole idea had a whiff of quantum computing. It utilized a n-dimensional hypercube arrangement. Imagine, if you will, four (very simple) microprocessors connected in a square. Each could do a computation, then share the result with the processor before it (counterclockwise), after it (clockwise), or opposite it (across). Next imagine 8 processors in a cube that can expand that concept to three dimensions (each processor can now share its output with one or more of 7 others: 3 along a vertex of the cube; three across the face of a square the processor was part of, and one diagonal in 3-space). Now take this up, to maybe 64 processors in a 6-dimensional hypercube. This was one of the hottest ideas of the time (along with the dedicated, 34 bit Lisp machine that Symbolics put out, and the slightly bizarre cache-only memory system put out by Kendall Square Research - both have wikipedia pages worth reading). The problem was that there was precisely one, and only one algorithm that actually worked well on the TM architecture: a Fast Fourier Transform using what was called the "Perfect Shuffle Algorithm". It was a genius insight into how to use a binary mask technique, the bespoke algorithm, and the architecture to parallel process an FFT in a brilliantly clever and fast way. But I don't think they ever found another single use for it. (see this related question: https://cs.stackexchange.com/questions/10572/perfect-shuffle-in-parallel-processing) I have been around long enough to realize that technologies that seem brilliant and powerful often end up to not solve a problem (or enough problems) to make them useful. There were lots of brilliant ideas at the time: TM, Symbolics, KSR, as well as Tandem (gone) and Stratus (amazingly, still alive). Everyone thought these companies - at least some of them - would take over the world and revolutionize computing. But, instead, we got FaceBook.
What kinds of statistical problems are likely to benefit from quantum computing? I liked the answer above on baseball. But I would be cautious about what quantum computing might do well. It seems like it might do very well at things like cracking cryptographic schemes and the lik
13,560
What kinds of statistical problems are likely to benefit from quantum computing?
What kinds of statistical problems are likely to benefit from quantum computing? On page 645 of "Physical Chemistry: Concepts and Theory" Kenneth S. Schmitz explains: Quantum effects become important when the de Broglie wavelength becomes comparable to, or is greater than, the dimensions of the particle. When this occurs the wave functions can overlap, giving different properties of the system. Macroscopic systems can be analyzed by classical methods, as that Wikipedia page explains: More refined consideration distinguishes classical and quantum mechanics on the basis that classical mechanics fails to recognize that matter and energy cannot be divided into infinitesimally small parcels, so that ultimately fine division reveals irreducibly granular features. The criterion of fineness is whether or not the interactions are described in terms of Planck's constant. Roughly speaking, classical mechanics considers particles in mathematically idealized terms even as fine as geometrical points with no magnitude, still having their finite masses. Classical mechanics also considers mathematically idealized extended materials as geometrically continuously substantial. Such idealizations are useful for most everyday calculations, but may fail entirely for molecules, atoms, photons, and other elementary particles. In many ways, classical mechanics can be considered a mainly macroscopic theory. On the much smaller scale of atoms and molecules, classical mechanics may fail, and the interactions of particles are then described by quantum mechanics.     For example, will quantum computers provide more ubiquitous true random number generation? No. You don't need a computer to generate a true random number, and using a quantum computer to do so would be a huge waste of resources with no improvement in randomness. ID Quantique has available SoCs, stand-alone, and PCIe cards for sale for from U\$1200 to U\$3500. It's a little more than photons travelling through a semi-transparent mirror, but has sufficient quantum random properties to pass AIS 31 ("Functionality classes and evaluation methodology for true (physical) random number generator - Version 3.1 Sept 29 2001" .PDF). This is how they describe their method: Quantis is a physical random number generator exploiting an elementary quantum optics process. Photons – light particles – are sent one by one onto a semi-transparent mirror and detected. These exclusive events (reflection – transmission) are associated to “0” – “1” bit values. This enables us to guarantee a truly unbiased and unpredictable system. A faster (1 Gbit/s) system is offered by QuintessenceLabs. Their quantum random number generator “qStream” is compliant with NIST SP 800-90A and meets the requirements of the draft NIST SP 800 90B and C. It uses Esaki tunnel diodes. Their products are new and pricing is not yet publicly available. Also available are systems from Comscire for several hundred to a couple of thousand dollars. Their PCQNG and post-quantum RNG methods and patents are explained on their website. Quantum Numbers Corp. has developed a chip sized device to quickly (1 Gbit/s) produce quantum random numbers which they claim will be available soon. What about computationally cheap pseudorandom number generation? If you mean "computationally cheap" as in few instructions and rapid execution = yes. If you mean that any computer is an inexpensive means to generate true random numbers = no. Any property implemented QRNG won't produce pseudo random numbers. Will quantum computing help accelerate Markov Chain Monte Carlo (MCMC) convergence, or ensure upper bounds on convergence time? I'll let someone else take a crack at that for now. Will there be quantum algorithms for other sampling-based estimators? Probably. Please edit and improve this Wiki answer.
What kinds of statistical problems are likely to benefit from quantum computing?
What kinds of statistical problems are likely to benefit from quantum computing? On page 645 of "Physical Chemistry: Concepts and Theory" Kenneth S. Schmitz explains: Quantum effects become importan
What kinds of statistical problems are likely to benefit from quantum computing? What kinds of statistical problems are likely to benefit from quantum computing? On page 645 of "Physical Chemistry: Concepts and Theory" Kenneth S. Schmitz explains: Quantum effects become important when the de Broglie wavelength becomes comparable to, or is greater than, the dimensions of the particle. When this occurs the wave functions can overlap, giving different properties of the system. Macroscopic systems can be analyzed by classical methods, as that Wikipedia page explains: More refined consideration distinguishes classical and quantum mechanics on the basis that classical mechanics fails to recognize that matter and energy cannot be divided into infinitesimally small parcels, so that ultimately fine division reveals irreducibly granular features. The criterion of fineness is whether or not the interactions are described in terms of Planck's constant. Roughly speaking, classical mechanics considers particles in mathematically idealized terms even as fine as geometrical points with no magnitude, still having their finite masses. Classical mechanics also considers mathematically idealized extended materials as geometrically continuously substantial. Such idealizations are useful for most everyday calculations, but may fail entirely for molecules, atoms, photons, and other elementary particles. In many ways, classical mechanics can be considered a mainly macroscopic theory. On the much smaller scale of atoms and molecules, classical mechanics may fail, and the interactions of particles are then described by quantum mechanics.     For example, will quantum computers provide more ubiquitous true random number generation? No. You don't need a computer to generate a true random number, and using a quantum computer to do so would be a huge waste of resources with no improvement in randomness. ID Quantique has available SoCs, stand-alone, and PCIe cards for sale for from U\$1200 to U\$3500. It's a little more than photons travelling through a semi-transparent mirror, but has sufficient quantum random properties to pass AIS 31 ("Functionality classes and evaluation methodology for true (physical) random number generator - Version 3.1 Sept 29 2001" .PDF). This is how they describe their method: Quantis is a physical random number generator exploiting an elementary quantum optics process. Photons – light particles – are sent one by one onto a semi-transparent mirror and detected. These exclusive events (reflection – transmission) are associated to “0” – “1” bit values. This enables us to guarantee a truly unbiased and unpredictable system. A faster (1 Gbit/s) system is offered by QuintessenceLabs. Their quantum random number generator “qStream” is compliant with NIST SP 800-90A and meets the requirements of the draft NIST SP 800 90B and C. It uses Esaki tunnel diodes. Their products are new and pricing is not yet publicly available. Also available are systems from Comscire for several hundred to a couple of thousand dollars. Their PCQNG and post-quantum RNG methods and patents are explained on their website. Quantum Numbers Corp. has developed a chip sized device to quickly (1 Gbit/s) produce quantum random numbers which they claim will be available soon. What about computationally cheap pseudorandom number generation? If you mean "computationally cheap" as in few instructions and rapid execution = yes. If you mean that any computer is an inexpensive means to generate true random numbers = no. Any property implemented QRNG won't produce pseudo random numbers. Will quantum computing help accelerate Markov Chain Monte Carlo (MCMC) convergence, or ensure upper bounds on convergence time? I'll let someone else take a crack at that for now. Will there be quantum algorithms for other sampling-based estimators? Probably. Please edit and improve this Wiki answer.
What kinds of statistical problems are likely to benefit from quantum computing? What kinds of statistical problems are likely to benefit from quantum computing? On page 645 of "Physical Chemistry: Concepts and Theory" Kenneth S. Schmitz explains: Quantum effects become importan
13,561
Extreme learning machine: what's it all about?
Your intuition about the use of ELM for high dimensional problems is correct, I have some results on this, which I am preparing for publication. For many practical problems, the data are not very non-linear and the ELM does fairly well, but there will always be datasets where the curse of dimensionality means that the chance of finding a good basis function with curvature just where you need it becomes rather small, even with many basis vectors. I personally would use something like a least-squares support vector machine (or a radial basis function network) and try and choose the basis vectors from those in the training set in a greedy manner (see e.g. my paper, but there were other/better approaches that were published at around the same time, e.g. in the very good book by Scholkopf and Smola on "Learning with Kernels"). I think it is better to compute an approximate solution to the exact problem, rather than an exact solution to an approximate problem, and kernel machines have a better theoretical underpinning (for a fixed kernel ;o).
Extreme learning machine: what's it all about?
Your intuition about the use of ELM for high dimensional problems is correct, I have some results on this, which I am preparing for publication. For many practical problems, the data are not very non
Extreme learning machine: what's it all about? Your intuition about the use of ELM for high dimensional problems is correct, I have some results on this, which I am preparing for publication. For many practical problems, the data are not very non-linear and the ELM does fairly well, but there will always be datasets where the curse of dimensionality means that the chance of finding a good basis function with curvature just where you need it becomes rather small, even with many basis vectors. I personally would use something like a least-squares support vector machine (or a radial basis function network) and try and choose the basis vectors from those in the training set in a greedy manner (see e.g. my paper, but there were other/better approaches that were published at around the same time, e.g. in the very good book by Scholkopf and Smola on "Learning with Kernels"). I think it is better to compute an approximate solution to the exact problem, rather than an exact solution to an approximate problem, and kernel machines have a better theoretical underpinning (for a fixed kernel ;o).
Extreme learning machine: what's it all about? Your intuition about the use of ELM for high dimensional problems is correct, I have some results on this, which I am preparing for publication. For many practical problems, the data are not very non
13,562
Extreme learning machine: what's it all about?
The ELM "learns" from the data by analytically solving for the output weights. Thus the larger the data that is fed into the network will produce better results. However this also requires more numbers of hidden nodes. If the ELM is trained with little or no error, when given a new set of input, it is unable to produce the correct output. The main advantage of ELM over traditional neural net such a back propagation is its fast training time. Most of the computation time is spent on solving the output layer weight as mentioned in Huang paper.
Extreme learning machine: what's it all about?
The ELM "learns" from the data by analytically solving for the output weights. Thus the larger the data that is fed into the network will produce better results. However this also requires more number
Extreme learning machine: what's it all about? The ELM "learns" from the data by analytically solving for the output weights. Thus the larger the data that is fed into the network will produce better results. However this also requires more numbers of hidden nodes. If the ELM is trained with little or no error, when given a new set of input, it is unable to produce the correct output. The main advantage of ELM over traditional neural net such a back propagation is its fast training time. Most of the computation time is spent on solving the output layer weight as mentioned in Huang paper.
Extreme learning machine: what's it all about? The ELM "learns" from the data by analytically solving for the output weights. Thus the larger the data that is fed into the network will produce better results. However this also requires more number
13,563
Choosing between loss functions for binary classification
The state-of-the-art reference on the matter is [1]. Essentially, it shows that all the loss functions you specify will converge to the Bayes classifier, with fast rates. Choosing between these for finite samples can be driven by several different arguments: If you want to recover event probabilities (and not only classifications), then the logistic log-loss, or any other generalized linear model (Probit regression, complementary-log-log regression,...) is a natural candidate. If you are aiming only at classification, SVM may be a preferred choice, since it targets only observations at the classification buondary, and ignores distant observation, thus alleviating the impact of the truthfulness of the assumed linear model. If you do not have many observations, then the advantage in 2 may be a disadvantage. There may be computational differences: both in the stated optimization problem, and in the particular implementation you are using. Bottom line- you can simply try them all and pick the best performer. [1] Bartlett, Peter L, Michael I Jordan, and Jon D McAuliffe. “Convexity, Classification, and Risk Bounds.” Journal of the American Statistical Association 101, no. 473 (March 2006): 138–56. doi:10.1198/016214505000000907.
Choosing between loss functions for binary classification
The state-of-the-art reference on the matter is [1]. Essentially, it shows that all the loss functions you specify will converge to the Bayes classifier, with fast rates. Choosing between these for
Choosing between loss functions for binary classification The state-of-the-art reference on the matter is [1]. Essentially, it shows that all the loss functions you specify will converge to the Bayes classifier, with fast rates. Choosing between these for finite samples can be driven by several different arguments: If you want to recover event probabilities (and not only classifications), then the logistic log-loss, or any other generalized linear model (Probit regression, complementary-log-log regression,...) is a natural candidate. If you are aiming only at classification, SVM may be a preferred choice, since it targets only observations at the classification buondary, and ignores distant observation, thus alleviating the impact of the truthfulness of the assumed linear model. If you do not have many observations, then the advantage in 2 may be a disadvantage. There may be computational differences: both in the stated optimization problem, and in the particular implementation you are using. Bottom line- you can simply try them all and pick the best performer. [1] Bartlett, Peter L, Michael I Jordan, and Jon D McAuliffe. “Convexity, Classification, and Risk Bounds.” Journal of the American Statistical Association 101, no. 473 (March 2006): 138–56. doi:10.1198/016214505000000907.
Choosing between loss functions for binary classification The state-of-the-art reference on the matter is [1]. Essentially, it shows that all the loss functions you specify will converge to the Bayes classifier, with fast rates. Choosing between these for
13,564
Is there a Bayesian interpretation of linear regression with simultaneous L1 and L2 regularization (aka elastic net)?
Ben's comment is likely sufficient, but I provide some more references one of which is from before the paper Ben referenced. A Bayesian elastic net representation was proposed by Kyung et. al. in their Section 3.1. Although the prior for the regression coefficient $\beta$ was correct, the authors incorrectly wrote down the mixture representation. A corrected Bayesian model for the elastic net was recently proposed by Roy and Chakraborty (their Equation 6). The authors also go on to present an appropriate Gibbs sampler to sample from the posterior distribution, and show that the Gibbs sampler converges to the stationary distribution at a geometric rate. For this reason, these references might turn out to be useful, in addition to the Hans paper.
Is there a Bayesian interpretation of linear regression with simultaneous L1 and L2 regularization (
Ben's comment is likely sufficient, but I provide some more references one of which is from before the paper Ben referenced. A Bayesian elastic net representation was proposed by Kyung et. al. in thei
Is there a Bayesian interpretation of linear regression with simultaneous L1 and L2 regularization (aka elastic net)? Ben's comment is likely sufficient, but I provide some more references one of which is from before the paper Ben referenced. A Bayesian elastic net representation was proposed by Kyung et. al. in their Section 3.1. Although the prior for the regression coefficient $\beta$ was correct, the authors incorrectly wrote down the mixture representation. A corrected Bayesian model for the elastic net was recently proposed by Roy and Chakraborty (their Equation 6). The authors also go on to present an appropriate Gibbs sampler to sample from the posterior distribution, and show that the Gibbs sampler converges to the stationary distribution at a geometric rate. For this reason, these references might turn out to be useful, in addition to the Hans paper.
Is there a Bayesian interpretation of linear regression with simultaneous L1 and L2 regularization ( Ben's comment is likely sufficient, but I provide some more references one of which is from before the paper Ben referenced. A Bayesian elastic net representation was proposed by Kyung et. al. in thei
13,565
Effect size to Wilcoxon signed rank test?
If you don't have ties, I would report the proportion of after values that are less than the corresponding before values. If you do have ties, you could report the proportion of after values that are less than before out of the total number of non-tied pairs, or report all three proportions (<, =, >) and perhaps the sum of whichever two were more meaningful. For example, you could say '33% had less fear of statistics, 57% were unchanged, and 10% had more fear after the course such that 90% were the same as or better than before'. Generally speaking, a hypothesis test will output a p-value that can be used to make a decision about whether or not to reject the null hypothesis while controlling for the type I error rate. The p-value, however, conflates the size of the effect with our amount of clarity that it is inconsistent with the null (in essence, how much data the test had access to). An effect size generally tries to extract the $N$ so as to isolate the magnitude of the effect. That line of reasoning illuminates the rationale behind dividing $z$ by $\sqrt N$. However, a major consideration with effect size measures is interpretability. Most commonly that consideration plays out in choosing between a raw effect size or a standardized effect size. (I suppose we could call $z/\sqrt N$ a standardized effect size, for what that's worth.) At any rate, my guess is that reporting $z/\sqrt N$ won't give people a quick, straightforward intuition into your effect. There is another wrinkle, though. While you want an estimate of the size of the overall effect, people typically use the Wilcoxon signed rank test with data that are only ordinal. That is, where they don't trust that the data can reliably indicate the magnitude of the shift within a student, but only that a shift occurred. That brings me to the proportion improved discussed above. On the other hand, if you do trust that the values are intrinsically meaningful (e.g., you only used the signed rank test for its robustness to normality and outliers), you could just use a raw mean or median difference, or the standardized mean difference as a measure of effect.
Effect size to Wilcoxon signed rank test?
If you don't have ties, I would report the proportion of after values that are less than the corresponding before values. If you do have ties, you could report the proportion of after values that ar
Effect size to Wilcoxon signed rank test? If you don't have ties, I would report the proportion of after values that are less than the corresponding before values. If you do have ties, you could report the proportion of after values that are less than before out of the total number of non-tied pairs, or report all three proportions (<, =, >) and perhaps the sum of whichever two were more meaningful. For example, you could say '33% had less fear of statistics, 57% were unchanged, and 10% had more fear after the course such that 90% were the same as or better than before'. Generally speaking, a hypothesis test will output a p-value that can be used to make a decision about whether or not to reject the null hypothesis while controlling for the type I error rate. The p-value, however, conflates the size of the effect with our amount of clarity that it is inconsistent with the null (in essence, how much data the test had access to). An effect size generally tries to extract the $N$ so as to isolate the magnitude of the effect. That line of reasoning illuminates the rationale behind dividing $z$ by $\sqrt N$. However, a major consideration with effect size measures is interpretability. Most commonly that consideration plays out in choosing between a raw effect size or a standardized effect size. (I suppose we could call $z/\sqrt N$ a standardized effect size, for what that's worth.) At any rate, my guess is that reporting $z/\sqrt N$ won't give people a quick, straightforward intuition into your effect. There is another wrinkle, though. While you want an estimate of the size of the overall effect, people typically use the Wilcoxon signed rank test with data that are only ordinal. That is, where they don't trust that the data can reliably indicate the magnitude of the shift within a student, but only that a shift occurred. That brings me to the proportion improved discussed above. On the other hand, if you do trust that the values are intrinsically meaningful (e.g., you only used the signed rank test for its robustness to normality and outliers), you could just use a raw mean or median difference, or the standardized mean difference as a measure of effect.
Effect size to Wilcoxon signed rank test? If you don't have ties, I would report the proportion of after values that are less than the corresponding before values. If you do have ties, you could report the proportion of after values that ar
13,566
Effect size to Wilcoxon signed rank test?
Without knowing what kind of data were being assessed it's very hard to give good advice here. And really, that's all you can get. There's just no such thing as a best measure of effect size for questions like this... maybe ever. The effect sizes mentioned in the question are all standardized effect sizes. But it's entirely possible that the means or medians of the original measures are just fine. For example, if you're measuring how long it takes for a manufacturing process to complete then the difference in times should be a perfectly reasonable effect size. Any changes in process, future measurements, measurements across systems, and measurements across factories, will all be in time. Maybe you want the mean or maybe you want the median, or even mode, but the first thing you need to do is look at the actual measurement scale and see if the effect size there is reasonable to interpret and strongly connected to the measure. To assist in thinking about that, effects that should be standardized are things that are measured more indirectly and in many ways. For example, psychological scales can vary over time and in many ways and attempt to get at an underlying variable that is not directly being assessed. In those cases you want standardized effect sizes. With standardized effect sizes the critical issue is not just which to use but what they mean. As you imply in your question, you also don't know what they mean and that's the critical thing. If you don't know what the standardized effect is then you can't report it correctly, interpret it correctly, or use it correctly. Further, if there are a variety of ways you'd like to discuss the data there is absolutely nothing stopping you from reporting more than one effect size. You can discuss your data in terms of linear relationship, like with product moment correlation, or in terms of relationship between the ranks with Spearman r and differences between those or just provide all the info in the table. There's nothing wrong with that at all. But more than anything you're going to have to decide what you want your results to mean. That's something that can't be answered from the information given and might require far more info and domain specific knowledge than is reasonable for a question in this kind of forum. And always think meta-analytically about how you're reporting effects. Will people in the future be able to take the results I'm reporting and integrate them with others? Perhaps there's a standard in your field for these things. Perhaps you selected a non-parametric test primarily because you don't trust the conclusions others have made about underlying distributions and you want to be more conservative in your assumptions in a field that primarily uses parametric tests. In that case there's nothing wrong with additionally providing an effect size typically used with the parametric tests. These and many other issues need to be considered when thinking about how you place your finding in a larger literature of similar research. Typically good descriptive stats solve these problems. So that's the primary advice. I have a few additional comments. If you want your effect size to be strongly related to the test you did then the Z based recommendation is obviously best. Your standardized effect size will mean the same thing as the test. But as soon as you're not doing that then there's nothing wrong with using most anything else, even something like Cohen's d that's associated with parametric tests. There is no assumption of normality for calculating means, standard deviations, or d scores. In fact, there are weaker assumptions than for the recommended correlation coefficient. And always report good descriptive measures. Again, descriptive measures have no assumptions you'd be violating but keep in mind their substantive meaning. You report descriptive stats that say something about your data you want to say and means and medians say different things. If you want to discuss repeated measures versus independent design effect sizes then that's really a whole new question.
Effect size to Wilcoxon signed rank test?
Without knowing what kind of data were being assessed it's very hard to give good advice here. And really, that's all you can get. There's just no such thing as a best measure of effect size for quest
Effect size to Wilcoxon signed rank test? Without knowing what kind of data were being assessed it's very hard to give good advice here. And really, that's all you can get. There's just no such thing as a best measure of effect size for questions like this... maybe ever. The effect sizes mentioned in the question are all standardized effect sizes. But it's entirely possible that the means or medians of the original measures are just fine. For example, if you're measuring how long it takes for a manufacturing process to complete then the difference in times should be a perfectly reasonable effect size. Any changes in process, future measurements, measurements across systems, and measurements across factories, will all be in time. Maybe you want the mean or maybe you want the median, or even mode, but the first thing you need to do is look at the actual measurement scale and see if the effect size there is reasonable to interpret and strongly connected to the measure. To assist in thinking about that, effects that should be standardized are things that are measured more indirectly and in many ways. For example, psychological scales can vary over time and in many ways and attempt to get at an underlying variable that is not directly being assessed. In those cases you want standardized effect sizes. With standardized effect sizes the critical issue is not just which to use but what they mean. As you imply in your question, you also don't know what they mean and that's the critical thing. If you don't know what the standardized effect is then you can't report it correctly, interpret it correctly, or use it correctly. Further, if there are a variety of ways you'd like to discuss the data there is absolutely nothing stopping you from reporting more than one effect size. You can discuss your data in terms of linear relationship, like with product moment correlation, or in terms of relationship between the ranks with Spearman r and differences between those or just provide all the info in the table. There's nothing wrong with that at all. But more than anything you're going to have to decide what you want your results to mean. That's something that can't be answered from the information given and might require far more info and domain specific knowledge than is reasonable for a question in this kind of forum. And always think meta-analytically about how you're reporting effects. Will people in the future be able to take the results I'm reporting and integrate them with others? Perhaps there's a standard in your field for these things. Perhaps you selected a non-parametric test primarily because you don't trust the conclusions others have made about underlying distributions and you want to be more conservative in your assumptions in a field that primarily uses parametric tests. In that case there's nothing wrong with additionally providing an effect size typically used with the parametric tests. These and many other issues need to be considered when thinking about how you place your finding in a larger literature of similar research. Typically good descriptive stats solve these problems. So that's the primary advice. I have a few additional comments. If you want your effect size to be strongly related to the test you did then the Z based recommendation is obviously best. Your standardized effect size will mean the same thing as the test. But as soon as you're not doing that then there's nothing wrong with using most anything else, even something like Cohen's d that's associated with parametric tests. There is no assumption of normality for calculating means, standard deviations, or d scores. In fact, there are weaker assumptions than for the recommended correlation coefficient. And always report good descriptive measures. Again, descriptive measures have no assumptions you'd be violating but keep in mind their substantive meaning. You report descriptive stats that say something about your data you want to say and means and medians say different things. If you want to discuss repeated measures versus independent design effect sizes then that's really a whole new question.
Effect size to Wilcoxon signed rank test? Without knowing what kind of data were being assessed it's very hard to give good advice here. And really, that's all you can get. There's just no such thing as a best measure of effect size for quest
13,567
Drawing n intervals uniformly randomly, probability that at least one interval overlaps with all others
This post answers the question and outlines partial progress toward proving it correct. For $n=1$, the answer trivially is $1$. For all larger $n$, it is (surprisingly) always $2/3$. To see why, first observe that the question can be generalized to any continuous distribution $F$ (in place of the uniform distribution). The process by which the $n$ intervals are generated amounts to drawing $2n$ iid variates $X_1, X_2, \ldots, X_{2n}$ from $F$ and forming the intervals $$[\min(X_1,X_2), \max(X_1,X_2)], \ldots, [\min(X_{2n-1}, X_{2n}), \max(X_{2n-1}, X_{2n})].$$ Because all $2n$ of the $X_i$ are independent, they are exchangeable. This means the solution would be the same if we were randomly to permute all of them. Let us therefore condition on the order statistics obtained by sorting the $X_i$: $$X_{(1)} \lt X_{(2)} \lt \cdots \lt X_{(2n)}$$ (where, because $F$ is continuous, there is zero chance that any two will be equal). The $n$ intervals are formed by selecting a random permutation $\sigma\in\mathfrak{S}_{2n}$ and connecting them in pairs $$[\min(X_{\sigma(1)},X_{\sigma(2)}), \max(X_{\sigma(1)},X_{\sigma(2)})], \ldots, [\min(X_{\sigma(2n-1)}, X_{\sigma(2n)}), \max(X_{\sigma(2n-1)}, X_{\sigma(2n)})].$$ Whether any two of these overlap or not does not depend on the values of the $X_{(i)}$, because overlapping is preserved by any any monotonic transformation $f:\mathbb{R}\to\mathbb{R}$ and there are such transformations that send $X_{(i)}$ to $i$. Thus, without any loss of generality, we may take $X_{(i)}=i$ and the question becomes: Let the set $\{1,2,\ldots, 2n-1, 2n\}$ be partitioned into $n$ disjoint doubletons. Any two of them, $\{l_1,r_1\}$ and $\{l_2,r_2\}$ (with $l_i \lt r_i$), overlap when $r_1 \gt l_2$ and $r_2 \gt l_1$. Say that a partition is "good" when at least one of its elements overlaps all the others (and otherwise is "bad"). As a function of $n$, what is the proportion of good partitions? To illustrate, consider the case $n=2$. There are three partitions, $$\color{gray}{\{\{1,2\},\{3,4\}\}},\ \color{red}{\{\{1,4\},\{2,3\}\}},\ \color{red}{\{\{1,3\},\{2,4\}\}},$$ of which the two good ones (the second and third) have been colored red. Thus the answer in the case $n=2$ is $2/3$. We may graph such partitions $\{\{l_i,r_i\},\,i=1,2,\ldots,n\}$ by plotting the points $\{1,2,\ldots,2n\}$ on a number line and drawing line segments between each $l_i$ and $r_i$, offsetting them slightly to resolve visual overlaps. Here are plots of the preceding three partitions, in the same order with the same coloring: From now on, in order to fit such plots easily in this format, I will turn them sideways. For instance, here are the $15$ partitions for $n=3$, once again with the good ones colored red: Ten are good, so the answer for $n=3$ is $10/15=2/3$. The first interesting situation occurs when $n=4$. Now, for the first time, it is possible for the union of the intervals to span $1$ through $2n$ without any single one of them intersecting the others. An example is $\{\{1,3\},\{2,5\},\{4,7\},\{6,8\}\}$. The union of the line segments runs unbroken from $1$ to $8$ but this is not a good partition. Nevertheless, $70$ of the $105$ partitions are good and the proportion remains $2/3$. The number of partitions increases rapidly with $n$: it equals $1\cdot 3\cdot 5 \cdots \cdot 2n-1 = (2n)!/(2^nn!)$. Exhaustive enumeration of all possibilities through $n=7$ continues to yield $2/3$ as the answer. Monte-Carlo simulations through $n=100$ (using $10000$ iterations in each) show no significant deviations from $2/3$. I am convinced there is a clever, simple way to demonstrate there is always a $2:1$ ratio of good to bad partitions, but I have not found one. A proof is available through careful integration (using the original uniform distribution of the $X_i$), but it is rather involved and unenlightening.
Drawing n intervals uniformly randomly, probability that at least one interval overlaps with all oth
This post answers the question and outlines partial progress toward proving it correct. For $n=1$, the answer trivially is $1$. For all larger $n$, it is (surprisingly) always $2/3$. To see why, firs
Drawing n intervals uniformly randomly, probability that at least one interval overlaps with all others This post answers the question and outlines partial progress toward proving it correct. For $n=1$, the answer trivially is $1$. For all larger $n$, it is (surprisingly) always $2/3$. To see why, first observe that the question can be generalized to any continuous distribution $F$ (in place of the uniform distribution). The process by which the $n$ intervals are generated amounts to drawing $2n$ iid variates $X_1, X_2, \ldots, X_{2n}$ from $F$ and forming the intervals $$[\min(X_1,X_2), \max(X_1,X_2)], \ldots, [\min(X_{2n-1}, X_{2n}), \max(X_{2n-1}, X_{2n})].$$ Because all $2n$ of the $X_i$ are independent, they are exchangeable. This means the solution would be the same if we were randomly to permute all of them. Let us therefore condition on the order statistics obtained by sorting the $X_i$: $$X_{(1)} \lt X_{(2)} \lt \cdots \lt X_{(2n)}$$ (where, because $F$ is continuous, there is zero chance that any two will be equal). The $n$ intervals are formed by selecting a random permutation $\sigma\in\mathfrak{S}_{2n}$ and connecting them in pairs $$[\min(X_{\sigma(1)},X_{\sigma(2)}), \max(X_{\sigma(1)},X_{\sigma(2)})], \ldots, [\min(X_{\sigma(2n-1)}, X_{\sigma(2n)}), \max(X_{\sigma(2n-1)}, X_{\sigma(2n)})].$$ Whether any two of these overlap or not does not depend on the values of the $X_{(i)}$, because overlapping is preserved by any any monotonic transformation $f:\mathbb{R}\to\mathbb{R}$ and there are such transformations that send $X_{(i)}$ to $i$. Thus, without any loss of generality, we may take $X_{(i)}=i$ and the question becomes: Let the set $\{1,2,\ldots, 2n-1, 2n\}$ be partitioned into $n$ disjoint doubletons. Any two of them, $\{l_1,r_1\}$ and $\{l_2,r_2\}$ (with $l_i \lt r_i$), overlap when $r_1 \gt l_2$ and $r_2 \gt l_1$. Say that a partition is "good" when at least one of its elements overlaps all the others (and otherwise is "bad"). As a function of $n$, what is the proportion of good partitions? To illustrate, consider the case $n=2$. There are three partitions, $$\color{gray}{\{\{1,2\},\{3,4\}\}},\ \color{red}{\{\{1,4\},\{2,3\}\}},\ \color{red}{\{\{1,3\},\{2,4\}\}},$$ of which the two good ones (the second and third) have been colored red. Thus the answer in the case $n=2$ is $2/3$. We may graph such partitions $\{\{l_i,r_i\},\,i=1,2,\ldots,n\}$ by plotting the points $\{1,2,\ldots,2n\}$ on a number line and drawing line segments between each $l_i$ and $r_i$, offsetting them slightly to resolve visual overlaps. Here are plots of the preceding three partitions, in the same order with the same coloring: From now on, in order to fit such plots easily in this format, I will turn them sideways. For instance, here are the $15$ partitions for $n=3$, once again with the good ones colored red: Ten are good, so the answer for $n=3$ is $10/15=2/3$. The first interesting situation occurs when $n=4$. Now, for the first time, it is possible for the union of the intervals to span $1$ through $2n$ without any single one of them intersecting the others. An example is $\{\{1,3\},\{2,5\},\{4,7\},\{6,8\}\}$. The union of the line segments runs unbroken from $1$ to $8$ but this is not a good partition. Nevertheless, $70$ of the $105$ partitions are good and the proportion remains $2/3$. The number of partitions increases rapidly with $n$: it equals $1\cdot 3\cdot 5 \cdots \cdot 2n-1 = (2n)!/(2^nn!)$. Exhaustive enumeration of all possibilities through $n=7$ continues to yield $2/3$ as the answer. Monte-Carlo simulations through $n=100$ (using $10000$ iterations in each) show no significant deviations from $2/3$. I am convinced there is a clever, simple way to demonstrate there is always a $2:1$ ratio of good to bad partitions, but I have not found one. A proof is available through careful integration (using the original uniform distribution of the $X_i$), but it is rather involved and unenlightening.
Drawing n intervals uniformly randomly, probability that at least one interval overlaps with all oth This post answers the question and outlines partial progress toward proving it correct. For $n=1$, the answer trivially is $1$. For all larger $n$, it is (surprisingly) always $2/3$. To see why, firs
13,568
Tutorials for feature engineering
I would say experience -- basic ideas are: to fit how classifiers work; giving a geometry problem to a tree, oversized dimension to a kNN and interval data to an SVM are not a good ideas remove as much nonlinearities as possible; expecting that some classifier will do Fourier analysis inside is rather naive (even if, it will waste a lot of complexity there) make features generic to all objects so that some sampling in the chain won't knock them out check previous works -- often transformation used for visualisation or testing similar types of data is already tuned to uncover interesting aspects avoid unstable, optimizing transformations like PCA which may lead to overfitting experiment a lot
Tutorials for feature engineering
I would say experience -- basic ideas are: to fit how classifiers work; giving a geometry problem to a tree, oversized dimension to a kNN and interval data to an SVM are not a good ideas remove as mu
Tutorials for feature engineering I would say experience -- basic ideas are: to fit how classifiers work; giving a geometry problem to a tree, oversized dimension to a kNN and interval data to an SVM are not a good ideas remove as much nonlinearities as possible; expecting that some classifier will do Fourier analysis inside is rather naive (even if, it will waste a lot of complexity there) make features generic to all objects so that some sampling in the chain won't knock them out check previous works -- often transformation used for visualisation or testing similar types of data is already tuned to uncover interesting aspects avoid unstable, optimizing transformations like PCA which may lead to overfitting experiment a lot
Tutorials for feature engineering I would say experience -- basic ideas are: to fit how classifiers work; giving a geometry problem to a tree, oversized dimension to a kNN and interval data to an SVM are not a good ideas remove as mu
13,569
Tutorials for feature engineering
There is a book from O'Reilly called "Feature Engineering for Machine Learning" by Zheng et al. I read the book and it covers different types of data (e.g categorical, text...) and describes different aspects of feature engineering that go with it. This includes things like normalization of data, feature selection, tf-idf in text.
Tutorials for feature engineering
There is a book from O'Reilly called "Feature Engineering for Machine Learning" by Zheng et al. I read the book and it covers different types of data (e.g categorical, text...) and describes different
Tutorials for feature engineering There is a book from O'Reilly called "Feature Engineering for Machine Learning" by Zheng et al. I read the book and it covers different types of data (e.g categorical, text...) and describes different aspects of feature engineering that go with it. This includes things like normalization of data, feature selection, tf-idf in text.
Tutorials for feature engineering There is a book from O'Reilly called "Feature Engineering for Machine Learning" by Zheng et al. I read the book and it covers different types of data (e.g categorical, text...) and describes different
13,570
Train vs Test Error Gap and its relationship to Overfitting : Reconciling conflicting advice
I do not think this is conflicting advice. What we are really interested in is good out-of-sample performance, not in reducing the gap between training and test set performance. If the test set performance is representative of out-of-sample performance (i.e. the test set is large enough, uncontaminated and is a representative sample of the data our model will be applied to), then as long as we get good performance on the test set we are not overfitting, regardless of the gap. Often, however, if there is a large gap, it may indicate that we could get better test set performance with more regularization/introducing more bias to the model. But that does not mean that a smaller gap means a better model; it's just that if we have a small or no gap between training and test set performance, we know we are definitely not overfitting so adding regularization/introducing more bias to the model will not help.
Train vs Test Error Gap and its relationship to Overfitting : Reconciling conflicting advice
I do not think this is conflicting advice. What we are really interested in is good out-of-sample performance, not in reducing the gap between training and test set performance. If the test set perfor
Train vs Test Error Gap and its relationship to Overfitting : Reconciling conflicting advice I do not think this is conflicting advice. What we are really interested in is good out-of-sample performance, not in reducing the gap between training and test set performance. If the test set performance is representative of out-of-sample performance (i.e. the test set is large enough, uncontaminated and is a representative sample of the data our model will be applied to), then as long as we get good performance on the test set we are not overfitting, regardless of the gap. Often, however, if there is a large gap, it may indicate that we could get better test set performance with more regularization/introducing more bias to the model. But that does not mean that a smaller gap means a better model; it's just that if we have a small or no gap between training and test set performance, we know we are definitely not overfitting so adding regularization/introducing more bias to the model will not help.
Train vs Test Error Gap and its relationship to Overfitting : Reconciling conflicting advice I do not think this is conflicting advice. What we are really interested in is good out-of-sample performance, not in reducing the gap between training and test set performance. If the test set perfor
13,571
How do I interpret the covariance matrix from a curve fit?
As a clarification, the variable pcov from scipy.optimize.curve_fit is the estimated covariance of the parameter estimate, that is loosely speaking, given the data and a model, how much information is there in the data to determine the value of a parameter in the given model. So it does not really tell you if the chosen model is good or not. See also this. The problem what is a good model is indeed a hard problem. As argued by statisticians All models are wrong, but some are useful So the criteria to use in comparison of different models depends on what you want to achieve. For instance, if you want a curve that is the "close as possible" to the data, you could select a model which gives the smallest residual. In your case it would be the model func and the estimated parameters popt that has the lowest value when computing numpy.linalg.norm(y-func(x, *popt)) However, if you select a model with more parameters, the residual will automatically decrease, at the cost of higher model complexity. So then it comes back to what the goal is of the model.
How do I interpret the covariance matrix from a curve fit?
As a clarification, the variable pcov from scipy.optimize.curve_fit is the estimated covariance of the parameter estimate, that is loosely speaking, given the data and a model, how much information i
How do I interpret the covariance matrix from a curve fit? As a clarification, the variable pcov from scipy.optimize.curve_fit is the estimated covariance of the parameter estimate, that is loosely speaking, given the data and a model, how much information is there in the data to determine the value of a parameter in the given model. So it does not really tell you if the chosen model is good or not. See also this. The problem what is a good model is indeed a hard problem. As argued by statisticians All models are wrong, but some are useful So the criteria to use in comparison of different models depends on what you want to achieve. For instance, if you want a curve that is the "close as possible" to the data, you could select a model which gives the smallest residual. In your case it would be the model func and the estimated parameters popt that has the lowest value when computing numpy.linalg.norm(y-func(x, *popt)) However, if you select a model with more parameters, the residual will automatically decrease, at the cost of higher model complexity. So then it comes back to what the goal is of the model.
How do I interpret the covariance matrix from a curve fit? As a clarification, the variable pcov from scipy.optimize.curve_fit is the estimated covariance of the parameter estimate, that is loosely speaking, given the data and a model, how much information i
13,572
When would we use tantiles and the medial, rather than quantiles and the median?
This is really a comment, but too long for a comment. It is trying to clarify the definition of "tantile" (in the $p=0.5$ case which is analogous to the median). Let $X$ be a (for simplicity) absolutely continuous random variable with density function $f(x)$. We assume that the expectation $\mu= \mathbb E X$ does exist, that is the integral $\mu=\int_{-\infty}^\infty x f(x)\; dx $ converges. Define, analogously with the cumulative distribution function, a "cumulative expectation function" (I have never seen such a concept, does it have an official name?) by $$ G(t) = \int_{-\infty}^t x f(x) \; dx $$ Then the "tantile" is the solution $t^*$ of the equation $G(t^*) = \mu/2$. Is this interpretation correct? Is this what was intended? To return to the original question, in the context of an income distribution, the tantile is the value of income such that half of total income is for people with above that income, and half of total income is for people with below that income. EDIT These quantities ( function $G(t)$ above) are related to various risk measures used in some financial literature, such as "expected shortfall". Have a look at the paper A J Ostaszewski & M B Gietzmann: "Value Creation with Dye's Disclosure Option: Optimal Risk-Shielding with an Upper Tailed Disclosure Strategy" (may 2006), especially around page 15, where they define something they call "Hemi-mean" which is related to $G(t)$ above, also "expected shortfall relative to $t$ and also known as $first lower partial moment". It would be interesting to look into these connections ... Another term used for this idea is "partial expectation". See for instance https://math.stackexchange.com/questions/1080530/the-partial-expectation-mathbbex-xk-for-an-alpha-stable-distributed-r and use google! Also, the book Kotz & Kleiber:"Statistical Size Distributions in Economics and Actuarial Science" give relevant information, on page 22 they define (Here $X>0$) $$ F_k(x) = \frac1{E X^k} \int_0^x t^k f(t)\; dt $$ which is "the $k$th-moment distribution", note that $G(t)=\mu F_1(t)$ so is basically the first-moment distribution. They refer to Champernowne (1974) who calls $F_1$ the "income curve", and denotes the underlying cdf $F$ by $F_0$. In terms of the first moment distribution the Lorenz curve can be given as $$ \{(u, L(u))\} = \{(u,v)\colon u=F(x),v=F_1(x); x\ge 0\} $$
When would we use tantiles and the medial, rather than quantiles and the median?
This is really a comment, but too long for a comment. It is trying to clarify the definition of "tantile" (in the $p=0.5$ case which is analogous to the median). Let $X$ be a (for simplicity) absolute
When would we use tantiles and the medial, rather than quantiles and the median? This is really a comment, but too long for a comment. It is trying to clarify the definition of "tantile" (in the $p=0.5$ case which is analogous to the median). Let $X$ be a (for simplicity) absolutely continuous random variable with density function $f(x)$. We assume that the expectation $\mu= \mathbb E X$ does exist, that is the integral $\mu=\int_{-\infty}^\infty x f(x)\; dx $ converges. Define, analogously with the cumulative distribution function, a "cumulative expectation function" (I have never seen such a concept, does it have an official name?) by $$ G(t) = \int_{-\infty}^t x f(x) \; dx $$ Then the "tantile" is the solution $t^*$ of the equation $G(t^*) = \mu/2$. Is this interpretation correct? Is this what was intended? To return to the original question, in the context of an income distribution, the tantile is the value of income such that half of total income is for people with above that income, and half of total income is for people with below that income. EDIT These quantities ( function $G(t)$ above) are related to various risk measures used in some financial literature, such as "expected shortfall". Have a look at the paper A J Ostaszewski & M B Gietzmann: "Value Creation with Dye's Disclosure Option: Optimal Risk-Shielding with an Upper Tailed Disclosure Strategy" (may 2006), especially around page 15, where they define something they call "Hemi-mean" which is related to $G(t)$ above, also "expected shortfall relative to $t$ and also known as $first lower partial moment". It would be interesting to look into these connections ... Another term used for this idea is "partial expectation". See for instance https://math.stackexchange.com/questions/1080530/the-partial-expectation-mathbbex-xk-for-an-alpha-stable-distributed-r and use google! Also, the book Kotz & Kleiber:"Statistical Size Distributions in Economics and Actuarial Science" give relevant information, on page 22 they define (Here $X>0$) $$ F_k(x) = \frac1{E X^k} \int_0^x t^k f(t)\; dt $$ which is "the $k$th-moment distribution", note that $G(t)=\mu F_1(t)$ so is basically the first-moment distribution. They refer to Champernowne (1974) who calls $F_1$ the "income curve", and denotes the underlying cdf $F$ by $F_0$. In terms of the first moment distribution the Lorenz curve can be given as $$ \{(u, L(u))\} = \{(u,v)\colon u=F(x),v=F_1(x); x\ge 0\} $$
When would we use tantiles and the medial, rather than quantiles and the median? This is really a comment, but too long for a comment. It is trying to clarify the definition of "tantile" (in the $p=0.5$ case which is analogous to the median). Let $X$ be a (for simplicity) absolute
13,573
When would we use tantiles and the medial, rather than quantiles and the median?
If you draw a Lorenz curve of sorted cumulative incomes, you might get something like this (copied from Wikipedia). Real Lorenz curves are not as symmetric, and those for wealth are more extreme than those for income. To find the median income, you might split the horizontal axis in half, as with the thick red line below (it looks more to the left than halfway but that is an optical illusion). This does not actually tell you the median, since the axes are percentages, but if you rescale the horizontal axis to people and the vertical axis to dollars or koruna or whatever, then the tangent to the curve (or the discrete equivalent step) at the median point is the median income. Similarly you can find other quantiles in the same way by putting the vertical line in a different position. To find the medial income, you might split the vertical axis in half, as with the thick purple line below. (It looks higher than halfway but that too is an optical illusion.) Again rescaling the axes and looking at the tangent or step will give you the medial income. Similarly you can find other tantiles in the same way by putting the horizontal line in a different position. Clearly the sorting process in constructing the curve will make the medial income greater than or equal to the median income. You might want to do this if your aim was to suggest that a small proportion of the population has half the total income (perhaps arguing either they pay a lot of tax and should not be charged more, or that there is gross income inequality which should be addressed by more progressive taxes).
When would we use tantiles and the medial, rather than quantiles and the median?
If you draw a Lorenz curve of sorted cumulative incomes, you might get something like this (copied from Wikipedia). Real Lorenz curves are not as symmetric, and those for wealth are more extreme than
When would we use tantiles and the medial, rather than quantiles and the median? If you draw a Lorenz curve of sorted cumulative incomes, you might get something like this (copied from Wikipedia). Real Lorenz curves are not as symmetric, and those for wealth are more extreme than those for income. To find the median income, you might split the horizontal axis in half, as with the thick red line below (it looks more to the left than halfway but that is an optical illusion). This does not actually tell you the median, since the axes are percentages, but if you rescale the horizontal axis to people and the vertical axis to dollars or koruna or whatever, then the tangent to the curve (or the discrete equivalent step) at the median point is the median income. Similarly you can find other quantiles in the same way by putting the vertical line in a different position. To find the medial income, you might split the vertical axis in half, as with the thick purple line below. (It looks higher than halfway but that too is an optical illusion.) Again rescaling the axes and looking at the tangent or step will give you the medial income. Similarly you can find other tantiles in the same way by putting the horizontal line in a different position. Clearly the sorting process in constructing the curve will make the medial income greater than or equal to the median income. You might want to do this if your aim was to suggest that a small proportion of the population has half the total income (perhaps arguing either they pay a lot of tax and should not be charged more, or that there is gross income inequality which should be addressed by more progressive taxes).
When would we use tantiles and the medial, rather than quantiles and the median? If you draw a Lorenz curve of sorted cumulative incomes, you might get something like this (copied from Wikipedia). Real Lorenz curves are not as symmetric, and those for wealth are more extreme than
13,574
RNN vs Kalman filter : learning the underlying dynamics?
Yes indeed they are related because both are used to predict $y_{n}$ and $s_{n}$ at time step n based on some current observation $x_{n}$ and state $s_{n-1}$ i.e. they both represent a function $F$ such that $$F(x_{n}, s_{n-1}) = (y_{n}, s_{n})$$ The advantage of the RNN over Kalman filter is that the RNN architecture can be arbitrarily complex (number of layers and neurons) and its parameters are learnt, whereas the algorithm (including its parameters) of Kalman filter is fixed. Recurrent Neural Networks are more general than Kalman filter. One could actually train a RNN to simulate a Kalman filter. Neural nets are kind of black box models and weights and activations are very often not interpretable (above all in the deeper layers). In the end neural nets are only optimized to make the best predictions and not to have "interpretable" parameters. Nowadays if you work on time series, have enough data and want the best accuracy, RNN is the preferred approach.
RNN vs Kalman filter : learning the underlying dynamics?
Yes indeed they are related because both are used to predict $y_{n}$ and $s_{n}$ at time step n based on some current observation $x_{n}$ and state $s_{n-1}$ i.e. they both represent a function $F$ su
RNN vs Kalman filter : learning the underlying dynamics? Yes indeed they are related because both are used to predict $y_{n}$ and $s_{n}$ at time step n based on some current observation $x_{n}$ and state $s_{n-1}$ i.e. they both represent a function $F$ such that $$F(x_{n}, s_{n-1}) = (y_{n}, s_{n})$$ The advantage of the RNN over Kalman filter is that the RNN architecture can be arbitrarily complex (number of layers and neurons) and its parameters are learnt, whereas the algorithm (including its parameters) of Kalman filter is fixed. Recurrent Neural Networks are more general than Kalman filter. One could actually train a RNN to simulate a Kalman filter. Neural nets are kind of black box models and weights and activations are very often not interpretable (above all in the deeper layers). In the end neural nets are only optimized to make the best predictions and not to have "interpretable" parameters. Nowadays if you work on time series, have enough data and want the best accuracy, RNN is the preferred approach.
RNN vs Kalman filter : learning the underlying dynamics? Yes indeed they are related because both are used to predict $y_{n}$ and $s_{n}$ at time step n based on some current observation $x_{n}$ and state $s_{n-1}$ i.e. they both represent a function $F$ su
13,575
RNN vs Kalman filter : learning the underlying dynamics?
As you say, the difference is the activation functions. The usual purpose of a Kalman filter is used to model an intrinsically linear process, where the observations are subject to additive noise. You can get away with using a Kalman filter if there are slow deviation from linearity, but not if the process is strongly non-linear. By contrast, neural nets get extra power by using a non-linear activation function. (Without it, stacking extra layers would never give a non-linear model.) So they are suitable for modelling non-linear processes, at least within the convex cover of the training set. The asymptotic behaviour of a neural net is decided by the activation function, not by the training data. That is why the Universal Approximation Theorem has the condition "... on compact support". This isn't very surpising - no finite training set contains evidence about asymptotic behaviour.
RNN vs Kalman filter : learning the underlying dynamics?
As you say, the difference is the activation functions. The usual purpose of a Kalman filter is used to model an intrinsically linear process, where the observations are subject to additive noise. You
RNN vs Kalman filter : learning the underlying dynamics? As you say, the difference is the activation functions. The usual purpose of a Kalman filter is used to model an intrinsically linear process, where the observations are subject to additive noise. You can get away with using a Kalman filter if there are slow deviation from linearity, but not if the process is strongly non-linear. By contrast, neural nets get extra power by using a non-linear activation function. (Without it, stacking extra layers would never give a non-linear model.) So they are suitable for modelling non-linear processes, at least within the convex cover of the training set. The asymptotic behaviour of a neural net is decided by the activation function, not by the training data. That is why the Universal Approximation Theorem has the condition "... on compact support". This isn't very surpising - no finite training set contains evidence about asymptotic behaviour.
RNN vs Kalman filter : learning the underlying dynamics? As you say, the difference is the activation functions. The usual purpose of a Kalman filter is used to model an intrinsically linear process, where the observations are subject to additive noise. You
13,576
RNN vs Kalman filter : learning the underlying dynamics?
They replace the kalman gain calculations by a RNN on this paper if you're still interested.
RNN vs Kalman filter : learning the underlying dynamics?
They replace the kalman gain calculations by a RNN on this paper if you're still interested.
RNN vs Kalman filter : learning the underlying dynamics? They replace the kalman gain calculations by a RNN on this paper if you're still interested.
RNN vs Kalman filter : learning the underlying dynamics? They replace the kalman gain calculations by a RNN on this paper if you're still interested.
13,577
RNN vs Kalman filter : learning the underlying dynamics?
I'll substitute linear Gaussian state space model for Kalman filter here. Similarities they both model time series they both have a hidden/latent "state" or "layer" process for which there is no data the observed dependent sequence depends/conditions on the above process the hidden/latent state/layer can depend on independent predictors/inputs/covariates/exogenous variables, etc. they both have parameters that (usually) must be learned/estimated Differences RNN have nonlinear activation functions while linear Gaussian state space models have linear state equations and observation equations Linear Gaussian state space models have additive noise terms while RNN's do not Misconceptions RNNs are a class of models and Kalman filters are an algorithm. This makes comparison between the two misleading. Kalman filters assume the parameters of the time series model are known, but that does not mean the models they are used on--linear Gaussian state space models--cannot have their parameters estimated/learned--they usually are, and the Kalman filter's likelihood evaluations can be used in an optimization or sampling-based strategy. I have little experience with RNNs, but I tend to think that the last item in the "Differences" category is the most important. For example, RNNs such as long short term memory (LSTM) models and gated recurrent units (GRUs) have "forget gates" that describe how the hidden layer "forgets" its past values deterministically. On the other hand, a state space model's "forgetting" is random. In my very humble opinion, I think this probably explains why RNNs are used a lot for non-noisy data such as text data, while lgSSMs are used on data that is "more random" such as financial returns. To be completely truthful, though, again, I don't have much experience with RNNs, so I don't claim this with any certainty. The linear/nonlinear distinction is not so important. State space models can have nonlinear state and observation/emission equations and indeed frequently do. When this happens, though, you can't use the Kalman filter anymore, but there are many other approximate filtering techniques. Regarding the other answer supposing that RNNs are "arbitrarily complex"--that reminds me of a Tweet I read a while back: https://twitter.com/sirbayes/status/1537177495866327040?s=20&t=eJ8U-Az5Tn_P0vH1afKLAw I have a hard time engaging in this debate, myself, though.
RNN vs Kalman filter : learning the underlying dynamics?
I'll substitute linear Gaussian state space model for Kalman filter here. Similarities they both model time series they both have a hidden/latent "state" or "layer" process for which there is no data
RNN vs Kalman filter : learning the underlying dynamics? I'll substitute linear Gaussian state space model for Kalman filter here. Similarities they both model time series they both have a hidden/latent "state" or "layer" process for which there is no data the observed dependent sequence depends/conditions on the above process the hidden/latent state/layer can depend on independent predictors/inputs/covariates/exogenous variables, etc. they both have parameters that (usually) must be learned/estimated Differences RNN have nonlinear activation functions while linear Gaussian state space models have linear state equations and observation equations Linear Gaussian state space models have additive noise terms while RNN's do not Misconceptions RNNs are a class of models and Kalman filters are an algorithm. This makes comparison between the two misleading. Kalman filters assume the parameters of the time series model are known, but that does not mean the models they are used on--linear Gaussian state space models--cannot have their parameters estimated/learned--they usually are, and the Kalman filter's likelihood evaluations can be used in an optimization or sampling-based strategy. I have little experience with RNNs, but I tend to think that the last item in the "Differences" category is the most important. For example, RNNs such as long short term memory (LSTM) models and gated recurrent units (GRUs) have "forget gates" that describe how the hidden layer "forgets" its past values deterministically. On the other hand, a state space model's "forgetting" is random. In my very humble opinion, I think this probably explains why RNNs are used a lot for non-noisy data such as text data, while lgSSMs are used on data that is "more random" such as financial returns. To be completely truthful, though, again, I don't have much experience with RNNs, so I don't claim this with any certainty. The linear/nonlinear distinction is not so important. State space models can have nonlinear state and observation/emission equations and indeed frequently do. When this happens, though, you can't use the Kalman filter anymore, but there are many other approximate filtering techniques. Regarding the other answer supposing that RNNs are "arbitrarily complex"--that reminds me of a Tweet I read a while back: https://twitter.com/sirbayes/status/1537177495866327040?s=20&t=eJ8U-Az5Tn_P0vH1afKLAw I have a hard time engaging in this debate, myself, though.
RNN vs Kalman filter : learning the underlying dynamics? I'll substitute linear Gaussian state space model for Kalman filter here. Similarities they both model time series they both have a hidden/latent "state" or "layer" process for which there is no data
13,578
confidence intervals' coverage with regularized estimates
There is a recent paper which address precisely your question (if you want to perform regression on your data, as I understand) and, luckily, provides expressions which are easy to calculate (Confidence Intervals and Hypothesis Testing for High-Dimensional Regression). Also, you may be interested in the recent work by Peter Bühlmann on that very topic. But I believe that the first paper provides you with what you are looking for, and the contents are easier to digest (I am not an statistician either).
confidence intervals' coverage with regularized estimates
There is a recent paper which address precisely your question (if you want to perform regression on your data, as I understand) and, luckily, provides expressions which are easy to calculate (Confiden
confidence intervals' coverage with regularized estimates There is a recent paper which address precisely your question (if you want to perform regression on your data, as I understand) and, luckily, provides expressions which are easy to calculate (Confidence Intervals and Hypothesis Testing for High-Dimensional Regression). Also, you may be interested in the recent work by Peter Bühlmann on that very topic. But I believe that the first paper provides you with what you are looking for, and the contents are easier to digest (I am not an statistician either).
confidence intervals' coverage with regularized estimates There is a recent paper which address precisely your question (if you want to perform regression on your data, as I understand) and, luckily, provides expressions which are easy to calculate (Confiden
13,579
confidence intervals' coverage with regularized estimates
http://cran.r-project.org/web/packages/hdi/index.html Is this what you're looking for? Description Computes confidence intervals for the l1-norm of groups of regression parameters in a hierarchical clustering tree.
confidence intervals' coverage with regularized estimates
http://cran.r-project.org/web/packages/hdi/index.html Is this what you're looking for? Description Computes confidence intervals for the l1-norm of groups of regression parameters in a hierarchical cl
confidence intervals' coverage with regularized estimates http://cran.r-project.org/web/packages/hdi/index.html Is this what you're looking for? Description Computes confidence intervals for the l1-norm of groups of regression parameters in a hierarchical clustering tree.
confidence intervals' coverage with regularized estimates http://cran.r-project.org/web/packages/hdi/index.html Is this what you're looking for? Description Computes confidence intervals for the l1-norm of groups of regression parameters in a hierarchical cl
13,580
How can we simulate from a geometric mixture?
Well, of course there's the acceptance-rejection algorithm, which I would implement for your example as: (Initialization) For each $i$, find $A_i = \sup_x \{\Pi_{j=1}^k f_j(x)^{\alpha_j}/f_i(x)\} $. Edit reflecting Xi'an's comment below: Select the distribution $f_i$ which corresponds to the smallest $A_i$. Generate $x$ from $f_i$. Calculate $\alpha = \Pi_{i=j}^k f_j(x)^{\alpha_j} / (A_if_i(x))$. Generate $u \sim U(0,1)$. If $u \leq \alpha$, return $x$, else go to 2. Depending on the distributions, of course, you might have a very low acceptance rate. As it happens, the expected number of iterations is equal to the selected $A_i$ (assuming continuous distributions), so at least you are warned in advance.
How can we simulate from a geometric mixture?
Well, of course there's the acceptance-rejection algorithm, which I would implement for your example as: (Initialization) For each $i$, find $A_i = \sup_x \{\Pi_{j=1}^k f_j(x)^{\alpha_j}/f_i(x)\} $.
How can we simulate from a geometric mixture? Well, of course there's the acceptance-rejection algorithm, which I would implement for your example as: (Initialization) For each $i$, find $A_i = \sup_x \{\Pi_{j=1}^k f_j(x)^{\alpha_j}/f_i(x)\} $. Edit reflecting Xi'an's comment below: Select the distribution $f_i$ which corresponds to the smallest $A_i$. Generate $x$ from $f_i$. Calculate $\alpha = \Pi_{i=j}^k f_j(x)^{\alpha_j} / (A_if_i(x))$. Generate $u \sim U(0,1)$. If $u \leq \alpha$, return $x$, else go to 2. Depending on the distributions, of course, you might have a very low acceptance rate. As it happens, the expected number of iterations is equal to the selected $A_i$ (assuming continuous distributions), so at least you are warned in advance.
How can we simulate from a geometric mixture? Well, of course there's the acceptance-rejection algorithm, which I would implement for your example as: (Initialization) For each $i$, find $A_i = \sup_x \{\Pi_{j=1}^k f_j(x)^{\alpha_j}/f_i(x)\} $.
13,581
Does Stein's Paradox still hold when using the $l_1$ norm instead of the $l_2$ norm?
Stein's paradox holds for all loss functions, and even worse- admissibility w.r.t. to a particular loss function probably implies inadmissibility w.r.t to any other loss. For a formal treatment see Section 8.8 (Shrinkage Estimators) in [1]. [1] van der Vaart, A. W. Asymptotic Statistics. Cambridge, UK ; New York, NY, USA: Cambridge University Press, 1998.
Does Stein's Paradox still hold when using the $l_1$ norm instead of the $l_2$ norm?
Stein's paradox holds for all loss functions, and even worse- admissibility w.r.t. to a particular loss function probably implies inadmissibility w.r.t to any other loss. For a formal treatment see Se
Does Stein's Paradox still hold when using the $l_1$ norm instead of the $l_2$ norm? Stein's paradox holds for all loss functions, and even worse- admissibility w.r.t. to a particular loss function probably implies inadmissibility w.r.t to any other loss. For a formal treatment see Section 8.8 (Shrinkage Estimators) in [1]. [1] van der Vaart, A. W. Asymptotic Statistics. Cambridge, UK ; New York, NY, USA: Cambridge University Press, 1998.
Does Stein's Paradox still hold when using the $l_1$ norm instead of the $l_2$ norm? Stein's paradox holds for all loss functions, and even worse- admissibility w.r.t. to a particular loss function probably implies inadmissibility w.r.t to any other loss. For a formal treatment see Se
13,582
Reporting variance of the repeated k-fold cross-validation
1 and 3 seem to me as invalid since they do not take into account the dependencies between repeated runs. In other words, repeated k-fold runs are more similar to each other than real repetitions of the experiment with independent data. 2 does not take into account the dependencies between folds within the same run. I do not know about 4. A potentially relevant (and discouraging) reference is Bengio & Grandvalet, 2004, "No Unbiased Estimator of the Variance of K-Fold Cross-Validation"
Reporting variance of the repeated k-fold cross-validation
1 and 3 seem to me as invalid since they do not take into account the dependencies between repeated runs. In other words, repeated k-fold runs are more similar to each other than real repetitions of t
Reporting variance of the repeated k-fold cross-validation 1 and 3 seem to me as invalid since they do not take into account the dependencies between repeated runs. In other words, repeated k-fold runs are more similar to each other than real repetitions of the experiment with independent data. 2 does not take into account the dependencies between folds within the same run. I do not know about 4. A potentially relevant (and discouraging) reference is Bengio & Grandvalet, 2004, "No Unbiased Estimator of the Variance of K-Fold Cross-Validation"
Reporting variance of the repeated k-fold cross-validation 1 and 3 seem to me as invalid since they do not take into account the dependencies between repeated runs. In other words, repeated k-fold runs are more similar to each other than real repetitions of t
13,583
Reporting variance of the repeated k-fold cross-validation
I might be wrong (and I am open to change my mind!) but to my understanding, when we say that CV reduces variance we cannot actually see it by looking at the variance across the folds. The thing is, CV is just a techinque that improves the estimation of the performance of a (one!) model (since in the k-folds we train the same model, simply with different data). Therefore, one round of CV simply gives us one value (the mean across the folds) and we cannot say anything about variance. As far as I understood, we can introduce variance if we do more experiments. For example, let's consider repeating 10 experiments: in each experiment we run a k-fold-CV and we end up with the final estimation of, say, accuracy. This ultimately gives us 10 different values for accuracy. Now we can compute the variance accross these 10 values, call it $\sigma^2_k$. Personally, I would report this value. Note that we can do the same for the initial scenario without CV. Just compute the final metric for 10 experiments in which you do simply a 70-30 or a 60-40 split! Now we can do the same thing for other values of k and we can see how this $\sigma^2$ decreases for k=5 or k=10 with respect to the simplest case without CV.
Reporting variance of the repeated k-fold cross-validation
I might be wrong (and I am open to change my mind!) but to my understanding, when we say that CV reduces variance we cannot actually see it by looking at the variance across the folds. The thing is, C
Reporting variance of the repeated k-fold cross-validation I might be wrong (and I am open to change my mind!) but to my understanding, when we say that CV reduces variance we cannot actually see it by looking at the variance across the folds. The thing is, CV is just a techinque that improves the estimation of the performance of a (one!) model (since in the k-folds we train the same model, simply with different data). Therefore, one round of CV simply gives us one value (the mean across the folds) and we cannot say anything about variance. As far as I understood, we can introduce variance if we do more experiments. For example, let's consider repeating 10 experiments: in each experiment we run a k-fold-CV and we end up with the final estimation of, say, accuracy. This ultimately gives us 10 different values for accuracy. Now we can compute the variance accross these 10 values, call it $\sigma^2_k$. Personally, I would report this value. Note that we can do the same for the initial scenario without CV. Just compute the final metric for 10 experiments in which you do simply a 70-30 or a 60-40 split! Now we can do the same thing for other values of k and we can see how this $\sigma^2$ decreases for k=5 or k=10 with respect to the simplest case without CV.
Reporting variance of the repeated k-fold cross-validation I might be wrong (and I am open to change my mind!) but to my understanding, when we say that CV reduces variance we cannot actually see it by looking at the variance across the folds. The thing is, C
13,584
Getting started with bayesian structural models using MCMC
You might be interested in TensorFlow Probability. It has a Python API, and has been chosen to replace Theano as the PyMC3 backend at some point in the future. Tensorflow Probability can also be used for MCMC directly, and it has dedicated functionality for Bayesian structural time series modelling. There is a nice blog post which provides an introduction.
Getting started with bayesian structural models using MCMC
You might be interested in TensorFlow Probability. It has a Python API, and has been chosen to replace Theano as the PyMC3 backend at some point in the future. Tensorflow Probability can also be used
Getting started with bayesian structural models using MCMC You might be interested in TensorFlow Probability. It has a Python API, and has been chosen to replace Theano as the PyMC3 backend at some point in the future. Tensorflow Probability can also be used for MCMC directly, and it has dedicated functionality for Bayesian structural time series modelling. There is a nice blog post which provides an introduction.
Getting started with bayesian structural models using MCMC You might be interested in TensorFlow Probability. It has a Python API, and has been chosen to replace Theano as the PyMC3 backend at some point in the future. Tensorflow Probability can also be used
13,585
Howlers caused by using stepwise regression
There is more than one question being asked. The most narrow one is asking for an example of when stepwise regression has caused harm because it was perfomed stepwise. This is of course true, but can only be established unequivocally when the data used for stepwise regression is also published, and someone reanalyses it and publishes a peer reviewed correction with a published primary authors' retraction. To make accusations in any other context risks legal action, and, if we use a different data set, we could suspect that a mistake was made, but "statistics is never proving anything" and we would not be able to establish that a mistake was made; "beyond a reasonable doubt". As a point of fact, one frequently gets different results depending on whether one does stepwise elimination or stepwise buildup of a regression equation, which suggest to us that neither approach is sufficiently correct to recommend its usage. Clearly, something else is going on, and that brings us to a broader question, also asked above, but in bullet form, amounting to "What are the problems with stepwise regression, anyhow? That is the more useful question to answer and has the added benefit that I will not have a law suit filed against me for answering it. Doing it right for stepwise MLR, means using 1) physically correct units (see below), and 2) appropriate variable transformation for best correlations and error distribution type (for homoscedasticity and physicality), and 3) using all permutations of variable combinations, not step-wise, all of them, and 4) if one performs exhaustive regression diagnostics then one avoids missing high VIF (collinearity) variable combinations that would otherwise be misleading, then the reward is better regression. As promised for #1 above, we next explore the correct units for a physical system. Since good results from regression are contingent upon the correct treatment of variables, we need to be mindful of the usual dimensions of physical units and balance our equations appropriately. Also, for biological applications, an awareness and accounting for the dimensionality of allometric scaling is needed. Please read this example of physical investigation of a biologic system for how to extend the balancing of units to biology. In that paper, steps 1) through 4) above were followed and a best formula was found using extensive regression analysis namely, $GFR=k∗W^{1/4}V^{2/3}$, where $GFR$ is glomerular filtration rate, a marker of catabolism, where the units are understood using fractal geometry such that $W$, weight was a four dimensional fractal geometric construct, and V, volume, was called a Euclidean, or three dimensional variable. Then $1=\frac{1}{4} \frac{4}{3}+\frac{2}{3}$. So that the formula is dimensionally consistent with metabolism. That is not an easy statement to grasp. Consider that 1) It is generally unappreciated (unknown) that $GFR$ is a marker of metabolism. 2) Fractal geometry is only infrequently taught and the physical interpretation of the formula presented is difficult to grasp even for someone who has mathematical training.
Howlers caused by using stepwise regression
There is more than one question being asked. The most narrow one is asking for an example of when stepwise regression has caused harm because it was perfomed stepwise. This is of course true, but can
Howlers caused by using stepwise regression There is more than one question being asked. The most narrow one is asking for an example of when stepwise regression has caused harm because it was perfomed stepwise. This is of course true, but can only be established unequivocally when the data used for stepwise regression is also published, and someone reanalyses it and publishes a peer reviewed correction with a published primary authors' retraction. To make accusations in any other context risks legal action, and, if we use a different data set, we could suspect that a mistake was made, but "statistics is never proving anything" and we would not be able to establish that a mistake was made; "beyond a reasonable doubt". As a point of fact, one frequently gets different results depending on whether one does stepwise elimination or stepwise buildup of a regression equation, which suggest to us that neither approach is sufficiently correct to recommend its usage. Clearly, something else is going on, and that brings us to a broader question, also asked above, but in bullet form, amounting to "What are the problems with stepwise regression, anyhow? That is the more useful question to answer and has the added benefit that I will not have a law suit filed against me for answering it. Doing it right for stepwise MLR, means using 1) physically correct units (see below), and 2) appropriate variable transformation for best correlations and error distribution type (for homoscedasticity and physicality), and 3) using all permutations of variable combinations, not step-wise, all of them, and 4) if one performs exhaustive regression diagnostics then one avoids missing high VIF (collinearity) variable combinations that would otherwise be misleading, then the reward is better regression. As promised for #1 above, we next explore the correct units for a physical system. Since good results from regression are contingent upon the correct treatment of variables, we need to be mindful of the usual dimensions of physical units and balance our equations appropriately. Also, for biological applications, an awareness and accounting for the dimensionality of allometric scaling is needed. Please read this example of physical investigation of a biologic system for how to extend the balancing of units to biology. In that paper, steps 1) through 4) above were followed and a best formula was found using extensive regression analysis namely, $GFR=k∗W^{1/4}V^{2/3}$, where $GFR$ is glomerular filtration rate, a marker of catabolism, where the units are understood using fractal geometry such that $W$, weight was a four dimensional fractal geometric construct, and V, volume, was called a Euclidean, or three dimensional variable. Then $1=\frac{1}{4} \frac{4}{3}+\frac{2}{3}$. So that the formula is dimensionally consistent with metabolism. That is not an easy statement to grasp. Consider that 1) It is generally unappreciated (unknown) that $GFR$ is a marker of metabolism. 2) Fractal geometry is only infrequently taught and the physical interpretation of the formula presented is difficult to grasp even for someone who has mathematical training.
Howlers caused by using stepwise regression There is more than one question being asked. The most narrow one is asking for an example of when stepwise regression has caused harm because it was perfomed stepwise. This is of course true, but can
13,586
Can we see shape of normal curve somewhere in nature?
I wouldn't think any pattern of erosion or deposition on Earth would fit because skewing factors including gravity and Coriolis are always involved (rivers meander more as they age, for example, and valley floors are sort of the average of rivers). Maybe the cross section of a stalagmite, assuming the drip remained in one fairly exact central location? I would think the drips would deposit the most precipitate right where they are moving slowest, which would be at the point of impact.
Can we see shape of normal curve somewhere in nature?
I wouldn't think any pattern of erosion or deposition on Earth would fit because skewing factors including gravity and Coriolis are always involved (rivers meander more as they age, for example, and v
Can we see shape of normal curve somewhere in nature? I wouldn't think any pattern of erosion or deposition on Earth would fit because skewing factors including gravity and Coriolis are always involved (rivers meander more as they age, for example, and valley floors are sort of the average of rivers). Maybe the cross section of a stalagmite, assuming the drip remained in one fairly exact central location? I would think the drips would deposit the most precipitate right where they are moving slowest, which would be at the point of impact.
Can we see shape of normal curve somewhere in nature? I wouldn't think any pattern of erosion or deposition on Earth would fit because skewing factors including gravity and Coriolis are always involved (rivers meander more as they age, for example, and v
13,587
Can we see shape of normal curve somewhere in nature?
I thought a lot about my question and probably I found something. U-shape of many valleys imitates "reversed" normal curve. Are there any reasons why this should not be gaussian (note that water makes the valleys smooth)? Here is an example.
Can we see shape of normal curve somewhere in nature?
I thought a lot about my question and probably I found something. U-shape of many valleys imitates "reversed" normal curve. Are there any reasons why this should not be gaussian (note that water makes
Can we see shape of normal curve somewhere in nature? I thought a lot about my question and probably I found something. U-shape of many valleys imitates "reversed" normal curve. Are there any reasons why this should not be gaussian (note that water makes the valleys smooth)? Here is an example.
Can we see shape of normal curve somewhere in nature? I thought a lot about my question and probably I found something. U-shape of many valleys imitates "reversed" normal curve. Are there any reasons why this should not be gaussian (note that water makes
13,588
Can adaptive MCMC be trusted?
How do we know that adaptation is not messing up with ergodicity at a given finite time, and that a sampler is sampling from the correct distribution? If it makes sense at all, how much burn-in should one do to ensure that early adaptation is not biasing the chains? Ergodicity and bias are about asymptotic properties of the Markov chain, they tell nothing about the behaviour and distribution of the Markov chain at a given finite time. Adaptivity has nothing to do with this issue, any MCMC algorithm may produce simulations far from the target at a given finite time.
Can adaptive MCMC be trusted?
How do we know that adaptation is not messing up with ergodicity at a given finite time, and that a sampler is sampling from the correct distribution? If it makes sense at all, how much burn-in sh
Can adaptive MCMC be trusted? How do we know that adaptation is not messing up with ergodicity at a given finite time, and that a sampler is sampling from the correct distribution? If it makes sense at all, how much burn-in should one do to ensure that early adaptation is not biasing the chains? Ergodicity and bias are about asymptotic properties of the Markov chain, they tell nothing about the behaviour and distribution of the Markov chain at a given finite time. Adaptivity has nothing to do with this issue, any MCMC algorithm may produce simulations far from the target at a given finite time.
Can adaptive MCMC be trusted? How do we know that adaptation is not messing up with ergodicity at a given finite time, and that a sampler is sampling from the correct distribution? If it makes sense at all, how much burn-in sh
13,589
Fisher information in a hierarchical model
There is no closed-form analytic expression for the Fisher information for the hierarchical model you give. In practice, Fisher information can only be computed analytically for exponential family distributions. For exponential families, the log-likelihood is linear in the sufficient statistics, and the sufficient statistics have known expectations. For other distributions, the log-likelihood does not simplify in this way. Neither the Laplace distribution nor the hierarchical model are exponential family distributions, so an analytic solution will be impossible.
Fisher information in a hierarchical model
There is no closed-form analytic expression for the Fisher information for the hierarchical model you give. In practice, Fisher information can only be computed analytically for exponential family dis
Fisher information in a hierarchical model There is no closed-form analytic expression for the Fisher information for the hierarchical model you give. In practice, Fisher information can only be computed analytically for exponential family distributions. For exponential families, the log-likelihood is linear in the sufficient statistics, and the sufficient statistics have known expectations. For other distributions, the log-likelihood does not simplify in this way. Neither the Laplace distribution nor the hierarchical model are exponential family distributions, so an analytic solution will be impossible.
Fisher information in a hierarchical model There is no closed-form analytic expression for the Fisher information for the hierarchical model you give. In practice, Fisher information can only be computed analytically for exponential family dis
13,590
Fisher information in a hierarchical model
The two of the Normal and Laplace are from the exponential family. If you can write the distribution in the exponential form then the fisher information matrix is the second gradient of the log-normalizer of the exponential family.
Fisher information in a hierarchical model
The two of the Normal and Laplace are from the exponential family. If you can write the distribution in the exponential form then the fisher information matrix is the second gradient of the log-normal
Fisher information in a hierarchical model The two of the Normal and Laplace are from the exponential family. If you can write the distribution in the exponential form then the fisher information matrix is the second gradient of the log-normalizer of the exponential family.
Fisher information in a hierarchical model The two of the Normal and Laplace are from the exponential family. If you can write the distribution in the exponential form then the fisher information matrix is the second gradient of the log-normal
13,591
Anscombe-like datasets with the same box and whiskers plot (mean/std/median/MAD/min/max)
To be concrete, I'm considering the problem of creating two datasets each of which suggests a relationship but the relationship of each is different, and yet also have approximately the same: mean x mean y SD x SD y median x median y minimum x minimum y maximum x maximum y median absolute deviation from the median of x median absolute deviation from the median of y coefficients from simple linear regression of y on x Perhaps this is cheating, but one way to make this problem a lot easier is to use a dataset where the best-fitting line is the x-axis, $\operatorname{mean} y = 0$, and $\min y = -\max y$. Then we can just flip the data vertically to get something suggestive of a clearly distinct distribution but where all the above statistics are preserved. Consider, for example, \begin{array}{ccccccccccc} x & 0 & \tfrac{1}{9} & \tfrac{2}{9} & \tfrac{3}{9} & \tfrac{4}{9} & \tfrac{5}{9} & \tfrac{6}{9} & \tfrac{7}{9} & \tfrac{8}{9} & 1 \\ \hline y & -1 & -\tfrac{1}{2} & 0 & \tfrac{1}{2} & 1 & 1 & \tfrac{1}{2} & 0 & -\tfrac{1}{2} & -1 \end{array} which has a upward-V-shaped graph like this: Replace $y$ with $-y$ and you get a downward V with all the same statistics, and not just approximately, but exactly.
Anscombe-like datasets with the same box and whiskers plot (mean/std/median/MAD/min/max)
To be concrete, I'm considering the problem of creating two datasets each of which suggests a relationship but the relationship of each is different, and yet also have approximately the same: mean x
Anscombe-like datasets with the same box and whiskers plot (mean/std/median/MAD/min/max) To be concrete, I'm considering the problem of creating two datasets each of which suggests a relationship but the relationship of each is different, and yet also have approximately the same: mean x mean y SD x SD y median x median y minimum x minimum y maximum x maximum y median absolute deviation from the median of x median absolute deviation from the median of y coefficients from simple linear regression of y on x Perhaps this is cheating, but one way to make this problem a lot easier is to use a dataset where the best-fitting line is the x-axis, $\operatorname{mean} y = 0$, and $\min y = -\max y$. Then we can just flip the data vertically to get something suggestive of a clearly distinct distribution but where all the above statistics are preserved. Consider, for example, \begin{array}{ccccccccccc} x & 0 & \tfrac{1}{9} & \tfrac{2}{9} & \tfrac{3}{9} & \tfrac{4}{9} & \tfrac{5}{9} & \tfrac{6}{9} & \tfrac{7}{9} & \tfrac{8}{9} & 1 \\ \hline y & -1 & -\tfrac{1}{2} & 0 & \tfrac{1}{2} & 1 & 1 & \tfrac{1}{2} & 0 & -\tfrac{1}{2} & -1 \end{array} which has a upward-V-shaped graph like this: Replace $y$ with $-y$ and you get a downward V with all the same statistics, and not just approximately, but exactly.
Anscombe-like datasets with the same box and whiskers plot (mean/std/median/MAD/min/max) To be concrete, I'm considering the problem of creating two datasets each of which suggests a relationship but the relationship of each is different, and yet also have approximately the same: mean x
13,592
Clustering algorithms that operate on sparse data matricies [closed]
I don't use R. It is often very slow and has next to no indexing support. But software recommendations are considered off-topic anyway. Note that plenty of algorithms don't care how you store your data. If you prefer to have a sparse matrix, that should be your choice, not the algorithms choice. People that use too much R tend to get stuck in thinking in matrix operations (because that is the only way to write fast code in R). But that is a limited way of thinking. For example k-means: it doesn't care. In particular, it doesn't use pairwise distances at all. It just needs a way to compute the variance contribution; which is equivalent to computing the squared Euclidean distance. Or DBSCAN. All it needs is a "neighbor" predicate. It can work with arbitrary graphs; it's just that Euclidean distance and the Epsilon threshold is the most common way of computing the neighborhood graph it uses. P.S. Your question isn't very precise. Do you refer to sparse data matrixes or sparse similarity matrixes?
Clustering algorithms that operate on sparse data matricies [closed]
I don't use R. It is often very slow and has next to no indexing support. But software recommendations are considered off-topic anyway. Note that plenty of algorithms don't care how you store your dat
Clustering algorithms that operate on sparse data matricies [closed] I don't use R. It is often very slow and has next to no indexing support. But software recommendations are considered off-topic anyway. Note that plenty of algorithms don't care how you store your data. If you prefer to have a sparse matrix, that should be your choice, not the algorithms choice. People that use too much R tend to get stuck in thinking in matrix operations (because that is the only way to write fast code in R). But that is a limited way of thinking. For example k-means: it doesn't care. In particular, it doesn't use pairwise distances at all. It just needs a way to compute the variance contribution; which is equivalent to computing the squared Euclidean distance. Or DBSCAN. All it needs is a "neighbor" predicate. It can work with arbitrary graphs; it's just that Euclidean distance and the Epsilon threshold is the most common way of computing the neighborhood graph it uses. P.S. Your question isn't very precise. Do you refer to sparse data matrixes or sparse similarity matrixes?
Clustering algorithms that operate on sparse data matricies [closed] I don't use R. It is often very slow and has next to no indexing support. But software recommendations are considered off-topic anyway. Note that plenty of algorithms don't care how you store your dat
13,593
Simulating time-series given power and cross spectral densities
Since your signals are stationary, a simple approach would be to use white noise as a basis and filter it to fit your PSDs. A way to calculate these filter coefficients is to use linear prediction. It seems there is a python function for it, try it out: from scikits.talkbox import lpc If you'd like (I have only used the MATLAB equivalent). This is an approach used in speech processing, where formants are estimated this way.
Simulating time-series given power and cross spectral densities
Since your signals are stationary, a simple approach would be to use white noise as a basis and filter it to fit your PSDs. A way to calculate these filter coefficients is to use linear prediction. It
Simulating time-series given power and cross spectral densities Since your signals are stationary, a simple approach would be to use white noise as a basis and filter it to fit your PSDs. A way to calculate these filter coefficients is to use linear prediction. It seems there is a python function for it, try it out: from scikits.talkbox import lpc If you'd like (I have only used the MATLAB equivalent). This is an approach used in speech processing, where formants are estimated this way.
Simulating time-series given power and cross spectral densities Since your signals are stationary, a simple approach would be to use white noise as a basis and filter it to fit your PSDs. A way to calculate these filter coefficients is to use linear prediction. It
13,594
Simulating time-series given power and cross spectral densities
A bit late to the party, as usual, but I see some recentish activity so I'll my two yen. First, I can't fault the OPs attempt - it looks right to me. The discrepancies could be due to issues with finite samples, for example positive bias of signal power estimation. However, I think that there are simpler ways to generate time series from the cross spectral density matrix (CPSD, this is what the OP called covariance matrix). One parametric approach is to use the CPSD to obtain an autoregressive description and then use that to generate the time series. In matlab you can do this using the Granger causality tools (e.g. Multivaraite Granger causality toolbox, Seth, Barnett). The toolbox is very easy to use. Since the existence of the CPSD guarantees an autoregressive description this approach is exact. (for more info about the CPSD and autoregression see "Measurement of Linear Dependence and Feedback between Multiple Time Series" by Geweke, 1982, or many of the Aneil Seth + Lionel Barnett papers, to get the full picture). Potentially simpler, is noting the the CPSD can be formed by applying the fft to the auto covariance (giving the diagonal of CPSD, i.e. the signals' power) and the cross covariance (giving the off diagonal elements, i.e. the cross-power). Thus by applying the inverse fft to the CPSD we can get the autocorrelation and auto covariance. We can then use these to generate samples of our data. Hope this helps. Please leave any requests for info in the comments and I'll try to address.
Simulating time-series given power and cross spectral densities
A bit late to the party, as usual, but I see some recentish activity so I'll my two yen. First, I can't fault the OPs attempt - it looks right to me. The discrepancies could be due to issues with fin
Simulating time-series given power and cross spectral densities A bit late to the party, as usual, but I see some recentish activity so I'll my two yen. First, I can't fault the OPs attempt - it looks right to me. The discrepancies could be due to issues with finite samples, for example positive bias of signal power estimation. However, I think that there are simpler ways to generate time series from the cross spectral density matrix (CPSD, this is what the OP called covariance matrix). One parametric approach is to use the CPSD to obtain an autoregressive description and then use that to generate the time series. In matlab you can do this using the Granger causality tools (e.g. Multivaraite Granger causality toolbox, Seth, Barnett). The toolbox is very easy to use. Since the existence of the CPSD guarantees an autoregressive description this approach is exact. (for more info about the CPSD and autoregression see "Measurement of Linear Dependence and Feedback between Multiple Time Series" by Geweke, 1982, or many of the Aneil Seth + Lionel Barnett papers, to get the full picture). Potentially simpler, is noting the the CPSD can be formed by applying the fft to the auto covariance (giving the diagonal of CPSD, i.e. the signals' power) and the cross covariance (giving the off diagonal elements, i.e. the cross-power). Thus by applying the inverse fft to the CPSD we can get the autocorrelation and auto covariance. We can then use these to generate samples of our data. Hope this helps. Please leave any requests for info in the comments and I'll try to address.
Simulating time-series given power and cross spectral densities A bit late to the party, as usual, but I see some recentish activity so I'll my two yen. First, I can't fault the OPs attempt - it looks right to me. The discrepancies could be due to issues with fin
13,595
How can we bound the probability that a random variable is maximal?
You can use the multivariate Chebyshev's inequality. Two variables case For a single situation, $X_1$ vs $X_2$, I arrive at the same situation as Jochen's comment on Nov 4 2016 1) If $\mu_1 < \mu_2$ then $ P(X_1>X_2) \leq (\sigma_1^2 + \sigma_2^2)/(\mu_1-\mu_2)^2 $ (and I wonder as well about your derivation) Derivation of equation 1 using the new variable $X_1-X_2$ transforming it such that it has the mean at zero taking the absolute value applying the Chebyshev's inequality \begin{array} \\ P \left( X_1 > X_2 \right) &= P \left( X_1 - X_2 > 0 \right)\\ &= P\left( X_1 - X_2 - (\mu_1 - \mu_2) > - (\mu_1 - \mu_2)\right) \\ &\leq P\left( \vert X_1 - X_2 - (\mu_1 - \mu_2) \vert > \mu_2 - \mu_1\right) \\ &\leq \frac{\sigma_{(X_1-X_2- (\mu_1 - \mu_2))}^2}{(\mu_2 - \mu_1)^2} = \frac{\sigma_{X_1}^2+\sigma_{X_2}^2}{(\mu_2 - \mu_1)^2}\\ \end{array} Multivariate Case The inequality in equation (1) can be changed into a multivariate case by applying it to multiple transformed variables $(X_n-X_i)$ for each $i<n$ (note that these are correlated). A solution to this problem (multivariate and correlated) has been described by I. Olkin and J. W. Pratt. 'A Multivariate Tchebycheff Inequality' in the Annals of Mathematical Statistics, volume 29 pages 226-234 http://projecteuclid.org/euclid.aoms/1177706720 Note theorem 2.3 $P(\vert y_i \vert \geq k_i \sigma_i \text{ for some } i) = P(\vert x_i \vert \geq 1 \text{ for some } i) \leq \frac{(\sqrt{u} + \sqrt{(pt-u)(p-1)})^2}{p^2}$ in which $p$ the number of variables, $t=\sum k_i^{-2}$, and $u=\sum \rho_{ij}/(k_ik_j)$. Theorem 3.6 provides a tighter bound, but is less easy to calculate. Edit A sharper bound can be found using the multivariate Cantelli's inequality. That inequality is the type that you used before and provided you with the boundary $(\sigma_1^2 + \sigma_2^2)/(\sigma_1^2 + \sigma_2^2 + (\mu_1-\mu_2)^2)$ which is sharper than $(\sigma_1^2 + \sigma_2^2)/(\mu_1-\mu_2)^2$. I haven't taken the time to study the entire article, but anyway, you can find a solution here: A. W. Marshall and I. Olkin 'A One-Sided Inequality of the Chebyshev Type' in Annals of Mathematical Statistics volume 31 pp. 488-491 https://projecteuclid.org/euclid.aoms/1177705913 (later note: This inequality is for equal correlations and not sufficient help. But anyway your problem, to find the sharpest bound, is equal to the, more general, multivariate Cantelli inequality. I would be surprised if the solution does not exist)
How can we bound the probability that a random variable is maximal?
You can use the multivariate Chebyshev's inequality. Two variables case For a single situation, $X_1$ vs $X_2$, I arrive at the same situation as Jochen's comment on Nov 4 2016 1) If $\mu_1 < \mu_2$ t
How can we bound the probability that a random variable is maximal? You can use the multivariate Chebyshev's inequality. Two variables case For a single situation, $X_1$ vs $X_2$, I arrive at the same situation as Jochen's comment on Nov 4 2016 1) If $\mu_1 < \mu_2$ then $ P(X_1>X_2) \leq (\sigma_1^2 + \sigma_2^2)/(\mu_1-\mu_2)^2 $ (and I wonder as well about your derivation) Derivation of equation 1 using the new variable $X_1-X_2$ transforming it such that it has the mean at zero taking the absolute value applying the Chebyshev's inequality \begin{array} \\ P \left( X_1 > X_2 \right) &= P \left( X_1 - X_2 > 0 \right)\\ &= P\left( X_1 - X_2 - (\mu_1 - \mu_2) > - (\mu_1 - \mu_2)\right) \\ &\leq P\left( \vert X_1 - X_2 - (\mu_1 - \mu_2) \vert > \mu_2 - \mu_1\right) \\ &\leq \frac{\sigma_{(X_1-X_2- (\mu_1 - \mu_2))}^2}{(\mu_2 - \mu_1)^2} = \frac{\sigma_{X_1}^2+\sigma_{X_2}^2}{(\mu_2 - \mu_1)^2}\\ \end{array} Multivariate Case The inequality in equation (1) can be changed into a multivariate case by applying it to multiple transformed variables $(X_n-X_i)$ for each $i<n$ (note that these are correlated). A solution to this problem (multivariate and correlated) has been described by I. Olkin and J. W. Pratt. 'A Multivariate Tchebycheff Inequality' in the Annals of Mathematical Statistics, volume 29 pages 226-234 http://projecteuclid.org/euclid.aoms/1177706720 Note theorem 2.3 $P(\vert y_i \vert \geq k_i \sigma_i \text{ for some } i) = P(\vert x_i \vert \geq 1 \text{ for some } i) \leq \frac{(\sqrt{u} + \sqrt{(pt-u)(p-1)})^2}{p^2}$ in which $p$ the number of variables, $t=\sum k_i^{-2}$, and $u=\sum \rho_{ij}/(k_ik_j)$. Theorem 3.6 provides a tighter bound, but is less easy to calculate. Edit A sharper bound can be found using the multivariate Cantelli's inequality. That inequality is the type that you used before and provided you with the boundary $(\sigma_1^2 + \sigma_2^2)/(\sigma_1^2 + \sigma_2^2 + (\mu_1-\mu_2)^2)$ which is sharper than $(\sigma_1^2 + \sigma_2^2)/(\mu_1-\mu_2)^2$. I haven't taken the time to study the entire article, but anyway, you can find a solution here: A. W. Marshall and I. Olkin 'A One-Sided Inequality of the Chebyshev Type' in Annals of Mathematical Statistics volume 31 pp. 488-491 https://projecteuclid.org/euclid.aoms/1177705913 (later note: This inequality is for equal correlations and not sufficient help. But anyway your problem, to find the sharpest bound, is equal to the, more general, multivariate Cantelli inequality. I would be surprised if the solution does not exist)
How can we bound the probability that a random variable is maximal? You can use the multivariate Chebyshev's inequality. Two variables case For a single situation, $X_1$ vs $X_2$, I arrive at the same situation as Jochen's comment on Nov 4 2016 1) If $\mu_1 < \mu_2$ t
13,596
How can we bound the probability that a random variable is maximal?
I have found a theorem that might help you and will try to adjust it for your needs. Assume you have: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i}))$$ Then by Jensen's inequality (since exp(.) is a convex function), we get: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i})) \leq \mathbf{E}(exp( t \cdot \underset{1 \leq i \leq n}{max}X_{i})) = \mathbf{E}( \underset{1 \leq i \leq n}{max} \text{ }exp( t \cdot X_{i})) \leq \sum_{i=1}^{n} \mathbf{E} (exp(t \cdot X_{i}) $$ Now for $exp(t \cdot X_{i} $ you have to plug in whatever the moment generating function of your random variable $X_{i}$ is (since it is just the definition of the mgf). Then, after doing so (and potentially simplifying your term), you take this term and take the log and divide by it by t so that you get a statement about the term $\mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i})$. Then you can choose t with some arbitrary value (best so that the term is small so that the bound is tight). Then, you have a statement about the expected value of the maximum over n rvs. To get now the a statement about the probabilty that the maximum of those rv's deviates from this expected value, you can just use Markov's inequality (assuming that your rv is non-negative) or another, more specific rv, applying to your particular rv.
How can we bound the probability that a random variable is maximal?
I have found a theorem that might help you and will try to adjust it for your needs. Assume you have: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i}))$$ Then by Jensen's inequality (sin
How can we bound the probability that a random variable is maximal? I have found a theorem that might help you and will try to adjust it for your needs. Assume you have: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i}))$$ Then by Jensen's inequality (since exp(.) is a convex function), we get: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i})) \leq \mathbf{E}(exp( t \cdot \underset{1 \leq i \leq n}{max}X_{i})) = \mathbf{E}( \underset{1 \leq i \leq n}{max} \text{ }exp( t \cdot X_{i})) \leq \sum_{i=1}^{n} \mathbf{E} (exp(t \cdot X_{i}) $$ Now for $exp(t \cdot X_{i} $ you have to plug in whatever the moment generating function of your random variable $X_{i}$ is (since it is just the definition of the mgf). Then, after doing so (and potentially simplifying your term), you take this term and take the log and divide by it by t so that you get a statement about the term $\mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i})$. Then you can choose t with some arbitrary value (best so that the term is small so that the bound is tight). Then, you have a statement about the expected value of the maximum over n rvs. To get now the a statement about the probabilty that the maximum of those rv's deviates from this expected value, you can just use Markov's inequality (assuming that your rv is non-negative) or another, more specific rv, applying to your particular rv.
How can we bound the probability that a random variable is maximal? I have found a theorem that might help you and will try to adjust it for your needs. Assume you have: $$exp(t \cdot \mathbf{E}(\underset{1 \leq i \leq n}{max}X_{i}))$$ Then by Jensen's inequality (sin
13,597
R's lmer cheat sheet
What's the difference between (~1 +....) and (1 | ...) and (0 | ...) etc.? Say you have variable V1 predicted by categorical variable V2, which is treated as a random effect, and continuous variable V3, which is treated as a linear fixed effect. Using lmer syntax, simplest model (M1) is: V1 ~ (1|V2) + V3 This model will estimate: P1: A global intercept P2: Random effect intercepts for V2 (i.e. for each level of V2, that level's intercept's deviation from the global intercept) P3: A single global estimate for the effect (slope) of V3 The next most complex model (M2) is: V1 ~ (1|V2) + V3 + (0+V3|V2) This model estimates all the parameters from M1, but will additionally estimate: P4: The effect of V3 within each level of V2 (more specifically, the degree to which the V3 effect within a given level deviates from the global effect of V3), while enforcing a zero correlation between the intercept deviations and V3 effect deviations across levels of V2. This latter restriction is relaxed in a final most complex model (M3): V1 ~ (1+V3|V2) + V3 In which all parameters from M2 are estimated while allowing correlation between the intercept deviations and V3 effect deviations within levels of V2. Thus, in M3, an additional parameter is estimated: P5: The correlation between intercept deviations and V3 deviations across levels of V2 Usually model pairs like M2 and M3 are computed then compared to evaluate the evidence for correlations between fixed effects (including the global intercept). Now consider adding another fixed effect predictor, V4. The model: V1 ~ (1+V3*V4|V2) + V3*V4 would estimate: P1: A global intercept P2: A single global estimate for the effect of V3 P3: A single global estimate for the effect of V4 P4: A single global estimate for the interaction between V3 and V4 P5: Deviations of the intercept from P1 in each level of V2 P6: Deviations of the V3 effect from P2 in each level of V2 P7: Deviations of the V4 effect from P3 in each level of V2 P8: Deviations of the V3-by-V4 interaction from P4 in each level of V2 P9 Correlation between P5 and P6 across levels of V2 P10 Correlation between P5 and P7 across levels of V2 P11 Correlation between P5 and P8 across levels of V2 P12 Correlation between P6 and P7 across levels of V2 P13 Correlation between P6 and P8 across levels of V2 P14 Correlation between P7 and P8 across levels of V2 Phew, That's a lot of parameters! And I didn't even bother to list the variance parameters estimated by the model. What's more, if you have a categorical variable with more than 2 levels that you want to model as a fixed effect, instead of a single effect for that variable you will always be estimating k-1 effects (where k is the number of levels), thereby exploding the number of parameters to be estimated by the model even further.
R's lmer cheat sheet
What's the difference between (~1 +....) and (1 | ...) and (0 | ...) etc.? Say you have variable V1 predicted by categorical variable V2, which is treated as a random effect, and continuous variable
R's lmer cheat sheet What's the difference between (~1 +....) and (1 | ...) and (0 | ...) etc.? Say you have variable V1 predicted by categorical variable V2, which is treated as a random effect, and continuous variable V3, which is treated as a linear fixed effect. Using lmer syntax, simplest model (M1) is: V1 ~ (1|V2) + V3 This model will estimate: P1: A global intercept P2: Random effect intercepts for V2 (i.e. for each level of V2, that level's intercept's deviation from the global intercept) P3: A single global estimate for the effect (slope) of V3 The next most complex model (M2) is: V1 ~ (1|V2) + V3 + (0+V3|V2) This model estimates all the parameters from M1, but will additionally estimate: P4: The effect of V3 within each level of V2 (more specifically, the degree to which the V3 effect within a given level deviates from the global effect of V3), while enforcing a zero correlation between the intercept deviations and V3 effect deviations across levels of V2. This latter restriction is relaxed in a final most complex model (M3): V1 ~ (1+V3|V2) + V3 In which all parameters from M2 are estimated while allowing correlation between the intercept deviations and V3 effect deviations within levels of V2. Thus, in M3, an additional parameter is estimated: P5: The correlation between intercept deviations and V3 deviations across levels of V2 Usually model pairs like M2 and M3 are computed then compared to evaluate the evidence for correlations between fixed effects (including the global intercept). Now consider adding another fixed effect predictor, V4. The model: V1 ~ (1+V3*V4|V2) + V3*V4 would estimate: P1: A global intercept P2: A single global estimate for the effect of V3 P3: A single global estimate for the effect of V4 P4: A single global estimate for the interaction between V3 and V4 P5: Deviations of the intercept from P1 in each level of V2 P6: Deviations of the V3 effect from P2 in each level of V2 P7: Deviations of the V4 effect from P3 in each level of V2 P8: Deviations of the V3-by-V4 interaction from P4 in each level of V2 P9 Correlation between P5 and P6 across levels of V2 P10 Correlation between P5 and P7 across levels of V2 P11 Correlation between P5 and P8 across levels of V2 P12 Correlation between P6 and P7 across levels of V2 P13 Correlation between P6 and P8 across levels of V2 P14 Correlation between P7 and P8 across levels of V2 Phew, That's a lot of parameters! And I didn't even bother to list the variance parameters estimated by the model. What's more, if you have a categorical variable with more than 2 levels that you want to model as a fixed effect, instead of a single effect for that variable you will always be estimating k-1 effects (where k is the number of levels), thereby exploding the number of parameters to be estimated by the model even further.
R's lmer cheat sheet What's the difference between (~1 +....) and (1 | ...) and (0 | ...) etc.? Say you have variable V1 predicted by categorical variable V2, which is treated as a random effect, and continuous variable
13,598
R's lmer cheat sheet
The general trick is, as mentioned in another answer, is that the formula follows the form dependent ~ independent | grouping. The groupingis generally a random factor, you can include fixed factors without any grouping and you can have additional random factors without any fixed factor (an intercept-only model). A + between factors indicates no interaction, a * indicates interaction. For random factors, you have three basic variants: Intercepts only by random factor: (1 | random.factor) Slopes only by random factor: (0 + fixed.factor | random.factor) Intercepts and slopes by random factor: (1 + fixed.factor | random.factor) Note that variant 3 has the slope and the intercept calculated in the same grouping, i.e. at the same time. If we want the slope and the intercept calculated independently, i.e. without any assumed correlation between the two, we need a fourth variant: Intercept and slope, separately, by random factor: (1 | random.factor) + (0 + fixed.factor | random.factor). An alternative way to write this is using the double-bar notation fixed.factor + (fixed.factor || random.factor). There's also a nice summary in another response to this question that you should look at. If you're up to digging into the math a bit, Barr et al. (2013) summarize the lmer syntax quite nicely in their Table 1, adapted here to meet the constraints of tableless markdown. That paper dealt with psycholinguistic data, so the two random effects are Subjectand Item. Models and equivalent lme4 formula syntax: $Y_{si} = β_0 + β_{1}X_{i} + e_{si}$ N/A (Not a mixed-effects model) $Y_{si} = β_0 + S_{0s} + β_{1}X_{i} + e_{si} $ Y ∼ X+(1∣Subject) $Y_{si} = β_0 + S_{0s} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(1 + X∣Subject) $Y_{si} = β_0 + S_{0s} + I_{0i} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(1 + X∣Subject)+(1∣Item) $Y_{si} = β_0 + S_{0s} + I_{0i} + β_{1}X_{i} + e_{si}$ Y ∼ X+(1∣Subject)+(1∣Item) As (4), but $S_{0s}$, $S_{1s}$ independent Y ∼ X+(1∣Subject)+(0 + X∣ Subject)+(1∣Item) $Y_{si} = β_0 + I_{0i} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(0 + X∣Subject)+(1∣Item) References: Barr, Dale J, R. Levy, C. Scheepers und H. J. Tily (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language, 68:255– 278.
R's lmer cheat sheet
The general trick is, as mentioned in another answer, is that the formula follows the form dependent ~ independent | grouping. The groupingis generally a random factor, you can include fixed factors w
R's lmer cheat sheet The general trick is, as mentioned in another answer, is that the formula follows the form dependent ~ independent | grouping. The groupingis generally a random factor, you can include fixed factors without any grouping and you can have additional random factors without any fixed factor (an intercept-only model). A + between factors indicates no interaction, a * indicates interaction. For random factors, you have three basic variants: Intercepts only by random factor: (1 | random.factor) Slopes only by random factor: (0 + fixed.factor | random.factor) Intercepts and slopes by random factor: (1 + fixed.factor | random.factor) Note that variant 3 has the slope and the intercept calculated in the same grouping, i.e. at the same time. If we want the slope and the intercept calculated independently, i.e. without any assumed correlation between the two, we need a fourth variant: Intercept and slope, separately, by random factor: (1 | random.factor) + (0 + fixed.factor | random.factor). An alternative way to write this is using the double-bar notation fixed.factor + (fixed.factor || random.factor). There's also a nice summary in another response to this question that you should look at. If you're up to digging into the math a bit, Barr et al. (2013) summarize the lmer syntax quite nicely in their Table 1, adapted here to meet the constraints of tableless markdown. That paper dealt with psycholinguistic data, so the two random effects are Subjectand Item. Models and equivalent lme4 formula syntax: $Y_{si} = β_0 + β_{1}X_{i} + e_{si}$ N/A (Not a mixed-effects model) $Y_{si} = β_0 + S_{0s} + β_{1}X_{i} + e_{si} $ Y ∼ X+(1∣Subject) $Y_{si} = β_0 + S_{0s} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(1 + X∣Subject) $Y_{si} = β_0 + S_{0s} + I_{0i} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(1 + X∣Subject)+(1∣Item) $Y_{si} = β_0 + S_{0s} + I_{0i} + β_{1}X_{i} + e_{si}$ Y ∼ X+(1∣Subject)+(1∣Item) As (4), but $S_{0s}$, $S_{1s}$ independent Y ∼ X+(1∣Subject)+(0 + X∣ Subject)+(1∣Item) $Y_{si} = β_0 + I_{0i} + (β_{1} + S_{1s})X_i + e_{si}$ Y ∼ X+(0 + X∣Subject)+(1∣Item) References: Barr, Dale J, R. Levy, C. Scheepers und H. J. Tily (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language, 68:255– 278.
R's lmer cheat sheet The general trick is, as mentioned in another answer, is that the formula follows the form dependent ~ independent | grouping. The groupingis generally a random factor, you can include fixed factors w
13,599
R's lmer cheat sheet
The | symbol indicates a grouping factor in mixed methods. As per Pinheiro & Bates: ...The formula also designates a response and, when available, a primary covariate. It is given as response ~ primary | grouping where response is an expression for the response, primary is an expression for the primary covariate, and grouping is an expression for the grouping factor. Depending on which method you use to perform mixed methods analysis in R, you may need to create a groupedData object to be able to use the grouping in the analysis (see the nlme package for details, lme4 doesn't seem to need this). I can't speak to the way you have specified your lmer model statements because I don't know your data. However, having multiple (1|foo) in the model line is unusual from what I have seen. What are you trying to model?
R's lmer cheat sheet
The | symbol indicates a grouping factor in mixed methods. As per Pinheiro & Bates: ...The formula also designates a response and, when available, a primary covariate. It is given as response ~ prima
R's lmer cheat sheet The | symbol indicates a grouping factor in mixed methods. As per Pinheiro & Bates: ...The formula also designates a response and, when available, a primary covariate. It is given as response ~ primary | grouping where response is an expression for the response, primary is an expression for the primary covariate, and grouping is an expression for the grouping factor. Depending on which method you use to perform mixed methods analysis in R, you may need to create a groupedData object to be able to use the grouping in the analysis (see the nlme package for details, lme4 doesn't seem to need this). I can't speak to the way you have specified your lmer model statements because I don't know your data. However, having multiple (1|foo) in the model line is unusual from what I have seen. What are you trying to model?
R's lmer cheat sheet The | symbol indicates a grouping factor in mixed methods. As per Pinheiro & Bates: ...The formula also designates a response and, when available, a primary covariate. It is given as response ~ prima
13,600
Roll a die until it lands on any number other than 4. What is the probability the result is > 4?
Just solve it using algebra: \begin{aligned} P(W) &= \tfrac 2 6 + \tfrac 1 6 \cdot P(W) \\[7pt] \tfrac 5 6 \cdot P(W) &= \tfrac 2 6 \\[7pt] P(W) &= \tfrac 2 5. \end{aligned}
Roll a die until it lands on any number other than 4. What is the probability the result is > 4?
Just solve it using algebra: \begin{aligned} P(W) &= \tfrac 2 6 + \tfrac 1 6 \cdot P(W) \\[7pt] \tfrac 5 6 \cdot P(W) &= \tfrac 2 6 \\[7pt] P(W) &= \tfrac 2 5. \end{aligned}
Roll a die until it lands on any number other than 4. What is the probability the result is > 4? Just solve it using algebra: \begin{aligned} P(W) &= \tfrac 2 6 + \tfrac 1 6 \cdot P(W) \\[7pt] \tfrac 5 6 \cdot P(W) &= \tfrac 2 6 \\[7pt] P(W) &= \tfrac 2 5. \end{aligned}
Roll a die until it lands on any number other than 4. What is the probability the result is > 4? Just solve it using algebra: \begin{aligned} P(W) &= \tfrac 2 6 + \tfrac 1 6 \cdot P(W) \\[7pt] \tfrac 5 6 \cdot P(W) &= \tfrac 2 6 \\[7pt] P(W) &= \tfrac 2 5. \end{aligned}