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
33,101
Generate symmetric positive definite matrix with a pre-specified sparsity pattern
Close but no cigar for @Rodrigo de Azevedo. The solution is to use semidefinite programming to find the maximum value, $\rho_{max}$, and the minimum value (subject to being nonnegative), $\rho_{min}$, of $\rho$ such that the correlation matrix with prescribed sparsity pattern is positive semidefinite (psd). All values of $\rho$ such that $\rho_{max}\le \rho \le \rho_{max}$, will produce psd matrices (exercise for reader) Therefore, you must either choose a distribution of $\rho$ which can only take values in $[\rho_{max},\rho_{max}]$, or you must use acceptance/rejection and reject any generated values of $\rho$ which do not produce a psd matrix. Example for a 4 by 4 matrix using YALMIP under MATLAB sdpvar rho % declare rho to be a scalar variable % find maximum value of rho (by minimizing -rho) subject to prescribed matrix being psd. optimize([1 0 rho 0;0 1 rho 0;rho rho 1 rho;0 0 rho 1] >= 0,-rho) % find minimum value of rho subject to prescribed matrix being psd and rho being >= 0. optimize([[1 0 rho 0;0 1 rho 0;rho rho 1 rho;0 0 rho 1] >= 0,rho >= 0],rho) Results: maximum rho = 0.57735, minimum rho = 0. It is readily apparent that zero will be the minimum value of rho subject to rho being nonegative and the prescribed matrix being psd, regardless of dimension or sparsity pattern. Therefore, it is unnecessary to run the semidefinite optimization to find the minimum nonnegative value of $\rho$.
Generate symmetric positive definite matrix with a pre-specified sparsity pattern
Close but no cigar for @Rodrigo de Azevedo. The solution is to use semidefinite programming to find the maximum value, $\rho_{max}$, and the minimum value (subject to being nonnegative), $\rho_{min}$,
Generate symmetric positive definite matrix with a pre-specified sparsity pattern Close but no cigar for @Rodrigo de Azevedo. The solution is to use semidefinite programming to find the maximum value, $\rho_{max}$, and the minimum value (subject to being nonnegative), $\rho_{min}$, of $\rho$ such that the correlation matrix with prescribed sparsity pattern is positive semidefinite (psd). All values of $\rho$ such that $\rho_{max}\le \rho \le \rho_{max}$, will produce psd matrices (exercise for reader) Therefore, you must either choose a distribution of $\rho$ which can only take values in $[\rho_{max},\rho_{max}]$, or you must use acceptance/rejection and reject any generated values of $\rho$ which do not produce a psd matrix. Example for a 4 by 4 matrix using YALMIP under MATLAB sdpvar rho % declare rho to be a scalar variable % find maximum value of rho (by minimizing -rho) subject to prescribed matrix being psd. optimize([1 0 rho 0;0 1 rho 0;rho rho 1 rho;0 0 rho 1] >= 0,-rho) % find minimum value of rho subject to prescribed matrix being psd and rho being >= 0. optimize([[1 0 rho 0;0 1 rho 0;rho rho 1 rho;0 0 rho 1] >= 0,rho >= 0],rho) Results: maximum rho = 0.57735, minimum rho = 0. It is readily apparent that zero will be the minimum value of rho subject to rho being nonegative and the prescribed matrix being psd, regardless of dimension or sparsity pattern. Therefore, it is unnecessary to run the semidefinite optimization to find the minimum nonnegative value of $\rho$.
Generate symmetric positive definite matrix with a pre-specified sparsity pattern Close but no cigar for @Rodrigo de Azevedo. The solution is to use semidefinite programming to find the maximum value, $\rho_{max}$, and the minimum value (subject to being nonnegative), $\rho_{min}$,
33,102
Generate symmetric positive definite matrix with a pre-specified sparsity pattern
A correlation matrix is symmetric, positive semidefinite, and has $1$'s on its main diagonal. One can find a $n \times n$ correlation matrix by solving the following semidefinite program (SDP) where the objective function is arbitrary, say, the zero function $$\begin{array}{ll} \text{minimize} & \mathrm \langle \mathrm O_n, \mathrm X \rangle\\ \text{subject to} & x_{11} = x_{22} = \cdots = x_{nn} = 1\\ & \mathrm X \succeq \mathrm O_n\end{array}$$ If one has additional constraints, such as sparsity constraints $$x_{ij} = 0 \text{ for all } (i,j) \in \mathcal Z \subset [n] \times [n]$$ and non-negativity constraints, $\mathrm X \geq \mathrm O_n$, then one solves the following SDP $$\begin{array}{ll} \text{minimize} & \mathrm \langle \mathrm O_n, \mathrm X \rangle\\ \text{subject to} & x_{11} = x_{22} = \cdots = x_{nn} = 1\\ & x_{ij} = 0 \text{ for all } (i,j) \in \mathcal Z \subset [n] \times [n]\\ & \mathrm X \geq \mathrm O_n\\ & \mathrm X \succeq \mathrm O_n\end{array}$$ A $3 \times 3$ example Suppose we want to have $x_{13} = 0$ and $x_{12}, x_{23} \geq 0$. Here's a MATLAB + CVX script, cvx_begin sdp variable X(3,3) symmetric minimize( trace(zeros(3,3)*X) ) subject to % put ones on the main diagonal X(1,1)==1 X(2,2)==1 X(3,3)==1 % put a zero in the northeast and southwest corners X(1,3)==0 % impose nonnegativity X(1,2)>=0 X(2,3)>=0 % impose positive semidefiniteness X >= 0 cvx_end Running the script, Calling sedumi: 8 variables, 6 equality constraints ------------------------------------------------------------ SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003. Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500 eqs m = 6, order n = 6, dim = 12, blocks = 2 nnz(A) = 8 + 0, nnz(ADA) = 36, nnz(L) = 21 it : b*y gap delta rate t/tP* t/tD* feas cg cg prec 0 : 3.00E+000 0.000 1 : -1.18E-001 6.45E-001 0.000 0.2150 0.9000 0.9000 1.86 1 1 1.2E+000 2 : -6.89E-004 2.25E-002 0.000 0.0349 0.9900 0.9900 1.52 1 1 3.5E-001 3 : -6.48E-009 9.72E-007 0.097 0.0000 1.0000 1.0000 1.01 1 1 3.8E-006 4 : -3.05E-010 2.15E-009 0.000 0.0022 0.9990 0.9990 1.00 1 1 1.5E-007 5 : -2.93E-016 5.06E-015 0.000 0.0000 1.0000 1.0000 1.00 1 1 3.2E-013 iter seconds digits c*x b*y 5 0.3 5.8 0.0000000000e+000 -2.9302886987e-016 |Ax-b| = 1.7e-015, [Ay-c]_+ = 6.1E-016, |x|= 2.0e+000, |y|= 1.5e-015 Detailed timing (sec) Pre IPM Post 1.563E-001 2.500E-001 1.094E-001 Max-norms: ||b||=1, ||c|| = 0, Cholesky |add|=0, |skip| = 0, ||L.L|| = 1. ------------------------------------------------------------ Status: Solved Optimal value (cvx_optval): +0 Let's see what solution CVX found, >> X X = 1.0000 0.4143 0 0.4143 1.0000 0.4143 0 0.4143 1.0000 Is this matrix positive semidefinite? Positive definite? >> rank(X) ans = 3 >> eigs(X) ans = 1.5860 1.0000 0.4140 It is positive definite, as expected. We can find positive semidefinite correlation matrices by choosing a nonzero (linear) objective function.
Generate symmetric positive definite matrix with a pre-specified sparsity pattern
A correlation matrix is symmetric, positive semidefinite, and has $1$'s on its main diagonal. One can find a $n \times n$ correlation matrix by solving the following semidefinite program (SDP) where t
Generate symmetric positive definite matrix with a pre-specified sparsity pattern A correlation matrix is symmetric, positive semidefinite, and has $1$'s on its main diagonal. One can find a $n \times n$ correlation matrix by solving the following semidefinite program (SDP) where the objective function is arbitrary, say, the zero function $$\begin{array}{ll} \text{minimize} & \mathrm \langle \mathrm O_n, \mathrm X \rangle\\ \text{subject to} & x_{11} = x_{22} = \cdots = x_{nn} = 1\\ & \mathrm X \succeq \mathrm O_n\end{array}$$ If one has additional constraints, such as sparsity constraints $$x_{ij} = 0 \text{ for all } (i,j) \in \mathcal Z \subset [n] \times [n]$$ and non-negativity constraints, $\mathrm X \geq \mathrm O_n$, then one solves the following SDP $$\begin{array}{ll} \text{minimize} & \mathrm \langle \mathrm O_n, \mathrm X \rangle\\ \text{subject to} & x_{11} = x_{22} = \cdots = x_{nn} = 1\\ & x_{ij} = 0 \text{ for all } (i,j) \in \mathcal Z \subset [n] \times [n]\\ & \mathrm X \geq \mathrm O_n\\ & \mathrm X \succeq \mathrm O_n\end{array}$$ A $3 \times 3$ example Suppose we want to have $x_{13} = 0$ and $x_{12}, x_{23} \geq 0$. Here's a MATLAB + CVX script, cvx_begin sdp variable X(3,3) symmetric minimize( trace(zeros(3,3)*X) ) subject to % put ones on the main diagonal X(1,1)==1 X(2,2)==1 X(3,3)==1 % put a zero in the northeast and southwest corners X(1,3)==0 % impose nonnegativity X(1,2)>=0 X(2,3)>=0 % impose positive semidefiniteness X >= 0 cvx_end Running the script, Calling sedumi: 8 variables, 6 equality constraints ------------------------------------------------------------ SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003. Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500 eqs m = 6, order n = 6, dim = 12, blocks = 2 nnz(A) = 8 + 0, nnz(ADA) = 36, nnz(L) = 21 it : b*y gap delta rate t/tP* t/tD* feas cg cg prec 0 : 3.00E+000 0.000 1 : -1.18E-001 6.45E-001 0.000 0.2150 0.9000 0.9000 1.86 1 1 1.2E+000 2 : -6.89E-004 2.25E-002 0.000 0.0349 0.9900 0.9900 1.52 1 1 3.5E-001 3 : -6.48E-009 9.72E-007 0.097 0.0000 1.0000 1.0000 1.01 1 1 3.8E-006 4 : -3.05E-010 2.15E-009 0.000 0.0022 0.9990 0.9990 1.00 1 1 1.5E-007 5 : -2.93E-016 5.06E-015 0.000 0.0000 1.0000 1.0000 1.00 1 1 3.2E-013 iter seconds digits c*x b*y 5 0.3 5.8 0.0000000000e+000 -2.9302886987e-016 |Ax-b| = 1.7e-015, [Ay-c]_+ = 6.1E-016, |x|= 2.0e+000, |y|= 1.5e-015 Detailed timing (sec) Pre IPM Post 1.563E-001 2.500E-001 1.094E-001 Max-norms: ||b||=1, ||c|| = 0, Cholesky |add|=0, |skip| = 0, ||L.L|| = 1. ------------------------------------------------------------ Status: Solved Optimal value (cvx_optval): +0 Let's see what solution CVX found, >> X X = 1.0000 0.4143 0 0.4143 1.0000 0.4143 0 0.4143 1.0000 Is this matrix positive semidefinite? Positive definite? >> rank(X) ans = 3 >> eigs(X) ans = 1.5860 1.0000 0.4140 It is positive definite, as expected. We can find positive semidefinite correlation matrices by choosing a nonzero (linear) objective function.
Generate symmetric positive definite matrix with a pre-specified sparsity pattern A correlation matrix is symmetric, positive semidefinite, and has $1$'s on its main diagonal. One can find a $n \times n$ correlation matrix by solving the following semidefinite program (SDP) where t
33,103
SVM: Number of support vectors
The proportion of support vectors is an upper bound on the leave-one-out cross-validation error (as the decision boundary is unaffected if you leave out a non-support vector), and thus provides an indication of the generalisation performance of the classifier. However, the bound isn't necessarily very tight (or even usefully tight), so you can have a model with lots of support vectors, but a low leave-one-out error (which appears to be the case here). There are tighter (approximate) bounds, such as the Span bound, which are more useful. This commonly happens if you tune the hyper-parameters to optimise the CV error, you get a bland kernel and a small value of C (so the margin violations are not penalised very much), in which case the margin becomes very wide and there are lots of support vectors. Essentially both the kernel and regularisation parameters control capacity, and you can get a diagonal trough in the CV error as a function of the hyper-parameters because their effects are correlated and different combinations of kernel parameter and regularisation provide similarly good models. It is worth noting that as soon as you tune the hyper-parameters, e.g. via CV, the SVM no longer implements a structural risk minimisation approach as we are just tuning the hyper-parameters directly on the data with no capacity control on the hyper-parameters. Essentially the performance estimates or bounds are biased or invalidated by their direct optimisation. My advice would be to no worry about it and just be guided by the CV error (but remember that if you use CV to tune the model, you need to use nested CV to evaluate its performance). The sparsity of the SVM is a bonus, but I have found it doesn't generate sufficient sparsity to be really worthwhile (L1 regularisation provides greater sparsity). For small problems (e.g. 400 patterns) I use the LS-SVM, which is fully dense and generally performs similarly well.
SVM: Number of support vectors
The proportion of support vectors is an upper bound on the leave-one-out cross-validation error (as the decision boundary is unaffected if you leave out a non-support vector), and thus provides an ind
SVM: Number of support vectors The proportion of support vectors is an upper bound on the leave-one-out cross-validation error (as the decision boundary is unaffected if you leave out a non-support vector), and thus provides an indication of the generalisation performance of the classifier. However, the bound isn't necessarily very tight (or even usefully tight), so you can have a model with lots of support vectors, but a low leave-one-out error (which appears to be the case here). There are tighter (approximate) bounds, such as the Span bound, which are more useful. This commonly happens if you tune the hyper-parameters to optimise the CV error, you get a bland kernel and a small value of C (so the margin violations are not penalised very much), in which case the margin becomes very wide and there are lots of support vectors. Essentially both the kernel and regularisation parameters control capacity, and you can get a diagonal trough in the CV error as a function of the hyper-parameters because their effects are correlated and different combinations of kernel parameter and regularisation provide similarly good models. It is worth noting that as soon as you tune the hyper-parameters, e.g. via CV, the SVM no longer implements a structural risk minimisation approach as we are just tuning the hyper-parameters directly on the data with no capacity control on the hyper-parameters. Essentially the performance estimates or bounds are biased or invalidated by their direct optimisation. My advice would be to no worry about it and just be guided by the CV error (but remember that if you use CV to tune the model, you need to use nested CV to evaluate its performance). The sparsity of the SVM is a bonus, but I have found it doesn't generate sufficient sparsity to be really worthwhile (L1 regularisation provides greater sparsity). For small problems (e.g. 400 patterns) I use the LS-SVM, which is fully dense and generally performs similarly well.
SVM: Number of support vectors The proportion of support vectors is an upper bound on the leave-one-out cross-validation error (as the decision boundary is unaffected if you leave out a non-support vector), and thus provides an ind
33,104
Why is the standard deviation of the sample mean less than the population SD?
I find this contradictory because they said that a sample mean averages together all values in the sample, but a population mean also averages together all the values. The excerpt never says anything about the population mean. since the population has the widest range doesn't the same thing apply even more? Absolutely. If you took the mean of the entire population then it would have even less variability. But that has nothing to do with what the excerpt is talking about. So, why is the sample mean's standard deviation less than the population? This is explained in the exerpt.
Why is the standard deviation of the sample mean less than the population SD?
I find this contradictory because they said that a sample mean averages together all values in the sample, but a population mean also averages together all the values. The excerpt never says anything
Why is the standard deviation of the sample mean less than the population SD? I find this contradictory because they said that a sample mean averages together all values in the sample, but a population mean also averages together all the values. The excerpt never says anything about the population mean. since the population has the widest range doesn't the same thing apply even more? Absolutely. If you took the mean of the entire population then it would have even less variability. But that has nothing to do with what the excerpt is talking about. So, why is the sample mean's standard deviation less than the population? This is explained in the exerpt.
Why is the standard deviation of the sample mean less than the population SD? I find this contradictory because they said that a sample mean averages together all values in the sample, but a population mean also averages together all the values. The excerpt never says anything
33,105
Why is the standard deviation of the sample mean less than the population SD?
Because the mean is an arithmetic midpoint and so when you add the deviations from the mean the sum will always be zero - hence the need to square the deviations BUT the median is an ordered midpoint so the sum of the deviations will ONLY be zero in a perfectly normal distribution. Hence, when you square the deviations you will always get a bigger value for the sum of squared deviations from the median than the mean... the rest flows from there...
Why is the standard deviation of the sample mean less than the population SD?
Because the mean is an arithmetic midpoint and so when you add the deviations from the mean the sum will always be zero - hence the need to square the deviations BUT the median is an ordered midpoint
Why is the standard deviation of the sample mean less than the population SD? Because the mean is an arithmetic midpoint and so when you add the deviations from the mean the sum will always be zero - hence the need to square the deviations BUT the median is an ordered midpoint so the sum of the deviations will ONLY be zero in a perfectly normal distribution. Hence, when you square the deviations you will always get a bigger value for the sum of squared deviations from the median than the mean... the rest flows from there...
Why is the standard deviation of the sample mean less than the population SD? Because the mean is an arithmetic midpoint and so when you add the deviations from the mean the sum will always be zero - hence the need to square the deviations BUT the median is an ordered midpoint
33,106
Why is the standard deviation of the sample mean less than the population SD?
Sorry for not going into each of your question. Still I would suggest if you can understand the below concept it will be easy for you to get out of this confusion 1.Suppose the mean of any sample represents each number of the sample which is influenced largely by extreme numbers. 2.With this, observe each extreme number in any sample is now being represented by a mean of that sample which is not as extreme as the number itself. Most of the times they are suppressed in opposite direction. 3.If you do this for several samples coming out of same population, in general you will observe sample means have less variability than individual numbers because calculating mean is taming the numbers towards their sample mean and ultimately towards population mean. This is the reason standard deviation of the sample means is less than the population SD.
Why is the standard deviation of the sample mean less than the population SD?
Sorry for not going into each of your question. Still I would suggest if you can understand the below concept it will be easy for you to get out of this confusion 1.Suppose the mean of any sample repr
Why is the standard deviation of the sample mean less than the population SD? Sorry for not going into each of your question. Still I would suggest if you can understand the below concept it will be easy for you to get out of this confusion 1.Suppose the mean of any sample represents each number of the sample which is influenced largely by extreme numbers. 2.With this, observe each extreme number in any sample is now being represented by a mean of that sample which is not as extreme as the number itself. Most of the times they are suppressed in opposite direction. 3.If you do this for several samples coming out of same population, in general you will observe sample means have less variability than individual numbers because calculating mean is taming the numbers towards their sample mean and ultimately towards population mean. This is the reason standard deviation of the sample means is less than the population SD.
Why is the standard deviation of the sample mean less than the population SD? Sorry for not going into each of your question. Still I would suggest if you can understand the below concept it will be easy for you to get out of this confusion 1.Suppose the mean of any sample repr
33,107
Accounting for heteroskedasticity in lme linear mixed model?
A couple of points The use of varPower() seems incorrect. You need to pass it to the weights argument of lme(). The shape of the residuals suggests that you have a bounded outcome, with many values at or near the boundary. You could instead consider a Beta mixed effects model for a bounded outcome or mixed model for semi-continuous data.
Accounting for heteroskedasticity in lme linear mixed model?
A couple of points The use of varPower() seems incorrect. You need to pass it to the weights argument of lme(). The shape of the residuals suggests that you have a bounded outcome, with many values a
Accounting for heteroskedasticity in lme linear mixed model? A couple of points The use of varPower() seems incorrect. You need to pass it to the weights argument of lme(). The shape of the residuals suggests that you have a bounded outcome, with many values at or near the boundary. You could instead consider a Beta mixed effects model for a bounded outcome or mixed model for semi-continuous data.
Accounting for heteroskedasticity in lme linear mixed model? A couple of points The use of varPower() seems incorrect. You need to pass it to the weights argument of lme(). The shape of the residuals suggests that you have a bounded outcome, with many values a
33,108
Accounting for heteroskedasticity in lme linear mixed model?
Accounting for heteroskedasticity gives you valid SE's. It should not change your estimates enough to actually remove the heteroskedasticity. However, the heteroskedasticity from those plots seem to systematic (considering the sharp downward edge on the lower half of the plots). So, I'm guessing this is a modeling/data issue that should be fixed prior to trying to account for it.
Accounting for heteroskedasticity in lme linear mixed model?
Accounting for heteroskedasticity gives you valid SE's. It should not change your estimates enough to actually remove the heteroskedasticity. However, the heteroskedasticity from those plots seem to
Accounting for heteroskedasticity in lme linear mixed model? Accounting for heteroskedasticity gives you valid SE's. It should not change your estimates enough to actually remove the heteroskedasticity. However, the heteroskedasticity from those plots seem to systematic (considering the sharp downward edge on the lower half of the plots). So, I'm guessing this is a modeling/data issue that should be fixed prior to trying to account for it.
Accounting for heteroskedasticity in lme linear mixed model? Accounting for heteroskedasticity gives you valid SE's. It should not change your estimates enough to actually remove the heteroskedasticity. However, the heteroskedasticity from those plots seem to
33,109
Estimating number of balls by successively selecting a ball and marking it
Here is an idea. Let $\mathcal{I}$ be a finite subset of the natural numbers which will serve as the possible values for $N$. Suppose we have a prior distribution over $\mathcal{I}$. Fix a non-random positive integer $M$. Let $k$ be the random variable denoting the number of times we mark a ball in $M$ draws from the bag. The goal is to find $E(N|k)$. This will be function of $M,k$ and the prior. By Bayes rule we have $$ \begin{align} P(N=j|k) &= \frac{P(k|N=j)P(N=j)}{P(k)}\\ &= \frac{P(k|N=j)P(N=j)}{\sum_{r \in \mathcal{I}} P(k|N=r)P(N=r)} \end{align} $$ Computing $P(k|N=j)$ is a known calculation which is a variant on the coupon collectors problem. $P(k|N=j)$ is the probability that we observe $k$ distinct coupons in $M$ draws when there are $j$ coupons in total. See here for an argument for $$ P(k|N=j) = \frac{\binom{j}{k}k!S(M,k)}{j^M} $$ where $S$ denotes a stirling number of the second kind. We can then calculate $$ E(N|k) = \sum_{j \in \mathcal{I}}jP(N=j|k) $$ Below are some calculations for various $k$ and $M$. In each case we use a uniform prior on $[k,10k]$ \begin{array}{|c|c|c|} \hline M & k & E(N)\\\hline 10 & 5 & 7.99 \\ 15 & 5 & 5.60 \\ 15 & 10 & 23.69\\ 30 & 15 & 20.00\\ 30 & 20 & 39.53 \\ \hline \end{array}
Estimating number of balls by successively selecting a ball and marking it
Here is an idea. Let $\mathcal{I}$ be a finite subset of the natural numbers which will serve as the possible values for $N$. Suppose we have a prior distribution over $\mathcal{I}$. Fix a non-random
Estimating number of balls by successively selecting a ball and marking it Here is an idea. Let $\mathcal{I}$ be a finite subset of the natural numbers which will serve as the possible values for $N$. Suppose we have a prior distribution over $\mathcal{I}$. Fix a non-random positive integer $M$. Let $k$ be the random variable denoting the number of times we mark a ball in $M$ draws from the bag. The goal is to find $E(N|k)$. This will be function of $M,k$ and the prior. By Bayes rule we have $$ \begin{align} P(N=j|k) &= \frac{P(k|N=j)P(N=j)}{P(k)}\\ &= \frac{P(k|N=j)P(N=j)}{\sum_{r \in \mathcal{I}} P(k|N=r)P(N=r)} \end{align} $$ Computing $P(k|N=j)$ is a known calculation which is a variant on the coupon collectors problem. $P(k|N=j)$ is the probability that we observe $k$ distinct coupons in $M$ draws when there are $j$ coupons in total. See here for an argument for $$ P(k|N=j) = \frac{\binom{j}{k}k!S(M,k)}{j^M} $$ where $S$ denotes a stirling number of the second kind. We can then calculate $$ E(N|k) = \sum_{j \in \mathcal{I}}jP(N=j|k) $$ Below are some calculations for various $k$ and $M$. In each case we use a uniform prior on $[k,10k]$ \begin{array}{|c|c|c|} \hline M & k & E(N)\\\hline 10 & 5 & 7.99 \\ 15 & 5 & 5.60 \\ 15 & 10 & 23.69\\ 30 & 15 & 20.00\\ 30 & 20 & 39.53 \\ \hline \end{array}
Estimating number of balls by successively selecting a ball and marking it Here is an idea. Let $\mathcal{I}$ be a finite subset of the natural numbers which will serve as the possible values for $N$. Suppose we have a prior distribution over $\mathcal{I}$. Fix a non-random
33,110
Interpretation of the partial autocorrelation function for a pure MA process
The main reason for the "reversal" you are looking at when you deal with AR and MA processes, is that these processes generally have the property that they are invertible to the form of the other process (so long as the coefficients in the models are within the unit circle). So a finite AR process can be represented as an infinite MA process, and a finite MA process can be represented as an infinite AR process. For a general MA(q) process you have: $$Z_t = \Bigg( 1 - \sum_{i=1}^q \theta_i B^i \Bigg) \epsilon_t = \prod_{i=1}^q (1 - \tau_i B) \epsilon_t,$$ where $B$ is the backshift operator. If $\max|\tau_i| < 1$ (so that all the coefficients are inside the unit circle) then the process is invertible and we have: $$\epsilon_t = \prod_{i=1}^q (1 - \tau_i B)^{-1} Z_t = \prod_{i=1}^q \Bigg( \sum_{k=0}^\infty \tau_i^k B^k \Bigg) Z_t.$$ Re-arranging this expression gives the AR($\infty$) process: $$Z_t = \Bigg[ \prod_{i=1}^q \Bigg( \sum_{k=0}^\infty \tau_i^k B^k \Bigg) -1 \Bigg] Z_t + \epsilon_t.$$ Now, the PACF is giving you the conditional correlation for a given lag, conditional on knowledge of the values of the intervening times. For an AR process, this measures the autocorrelations in the process. Hence, for an invertible MA process, the PACF will measure the autocorrelations in the AR($\infty$) process that corresponds to that process. The measured PACF values will decay gradually because the AR process being measured is infinite.
Interpretation of the partial autocorrelation function for a pure MA process
The main reason for the "reversal" you are looking at when you deal with AR and MA processes, is that these processes generally have the property that they are invertible to the form of the other proc
Interpretation of the partial autocorrelation function for a pure MA process The main reason for the "reversal" you are looking at when you deal with AR and MA processes, is that these processes generally have the property that they are invertible to the form of the other process (so long as the coefficients in the models are within the unit circle). So a finite AR process can be represented as an infinite MA process, and a finite MA process can be represented as an infinite AR process. For a general MA(q) process you have: $$Z_t = \Bigg( 1 - \sum_{i=1}^q \theta_i B^i \Bigg) \epsilon_t = \prod_{i=1}^q (1 - \tau_i B) \epsilon_t,$$ where $B$ is the backshift operator. If $\max|\tau_i| < 1$ (so that all the coefficients are inside the unit circle) then the process is invertible and we have: $$\epsilon_t = \prod_{i=1}^q (1 - \tau_i B)^{-1} Z_t = \prod_{i=1}^q \Bigg( \sum_{k=0}^\infty \tau_i^k B^k \Bigg) Z_t.$$ Re-arranging this expression gives the AR($\infty$) process: $$Z_t = \Bigg[ \prod_{i=1}^q \Bigg( \sum_{k=0}^\infty \tau_i^k B^k \Bigg) -1 \Bigg] Z_t + \epsilon_t.$$ Now, the PACF is giving you the conditional correlation for a given lag, conditional on knowledge of the values of the intervening times. For an AR process, this measures the autocorrelations in the process. Hence, for an invertible MA process, the PACF will measure the autocorrelations in the AR($\infty$) process that corresponds to that process. The measured PACF values will decay gradually because the AR process being measured is infinite.
Interpretation of the partial autocorrelation function for a pure MA process The main reason for the "reversal" you are looking at when you deal with AR and MA processes, is that these processes generally have the property that they are invertible to the form of the other proc
33,111
Variance-covariance matrix for ridge regression with stochastic $\lambda$
I'm guessing that these equations are maximum likelihood solutions. The MLE of a parameter takes as its variance-covariance matrix the inverse of the second derivative of the likelihood function. What this means is that var$(\hat B)\sim∂^2L($data, $\hat B)/∂B^2$. If you include the lambda parameter, this partial derivative does not change. You introduce a covariance between B and lambda. The fact that you're optimizing lambda via cross-validation rather than MLE doesn't change the story for beta.
Variance-covariance matrix for ridge regression with stochastic $\lambda$
I'm guessing that these equations are maximum likelihood solutions. The MLE of a parameter takes as its variance-covariance matrix the inverse of the second derivative of the likelihood function. What
Variance-covariance matrix for ridge regression with stochastic $\lambda$ I'm guessing that these equations are maximum likelihood solutions. The MLE of a parameter takes as its variance-covariance matrix the inverse of the second derivative of the likelihood function. What this means is that var$(\hat B)\sim∂^2L($data, $\hat B)/∂B^2$. If you include the lambda parameter, this partial derivative does not change. You introduce a covariance between B and lambda. The fact that you're optimizing lambda via cross-validation rather than MLE doesn't change the story for beta.
Variance-covariance matrix for ridge regression with stochastic $\lambda$ I'm guessing that these equations are maximum likelihood solutions. The MLE of a parameter takes as its variance-covariance matrix the inverse of the second derivative of the likelihood function. What
33,112
Extreme Value Theory: Lognormal GEV parameters
Let $X_i \sim_{\text{i.i.d}} \text{LNorm}(\mu,\,\sigma)$ with the meaning that the r.v. $\log X_i$ is normal with mean $\mu$ and standard deviation $\sigma$. Considering $M_n := \max_{1 \leqslant i \leqslant n} X_i$, we know that there exist two sequences $a_n >0$ and $b_n$ such that $$ \tag{1} \frac{M_n - b_n}{a_n} \to \text{Gum}(0, 1) $$ where $\text{Gum}(\nu,\,\beta)$ denotes the Gumbel distribution with location $\nu$ and scale $\beta$. This means that $F_{M_n}(a_n x + b_n) \to F_{\text{Gum}}(x;\,0,\,1)$ for all $x$. Quite obviously the two sequences $a_n$ and $b_n$ depend on $\mu$ and $\sigma$, so they could be denoted as $a_n(\mu,\,\sigma)$ and $b_n(\mu,\,\sigma)$. For instance if $\mu$ is replaced by $\mu +1$ then the distribution of $X_i$ is replaced by that of $e X_i$ and the distribution of $M_n$ is replaced by that of $e M_n$, implying that $a_n$ and $b_n$ have to be replaced by $ea_n$ and $eb_n$ to maintain the same limit. Similarly if we replace $\mu$ by $0$ with $\sigma$ unchanged, $X_i$ is to be replaced by $e^{-\mu} X_i$ and then $a_n$ and $b_n$ must be replaced by $e^{-\mu} a_n$ and $e^{-\mu}b_n$. The question can be formulated as: if we use the sequences $a_n(0, 1)$ and $b_n(0, \,1)$ at the left-hand side of (1) - instead of the due $a_n(\mu,\,\sigma)$ and $b_n(\mu,\,\sigma)$ - do we get $\text{Gum}(\mu,\,\sigma)$ at the right-hand side? The answer is then no, because the parameters of the Gumbel are indeed location and scale parameters, while this is not true for the log-normal. The parameter $\sigma$ of the log-normal impacts the tail, as can be seen by the fact that the coefficient of variation increases with $\sigma$. While $\text{LNorm}(\mu,\,\sigma)$ always remains in the Gumbel domain of attraction, the sequences $a_n$ and $b_n$ must tend to $\infty$ more rapidly as $\sigma$ increases. It can be proved that we can in (1) use sequences $a_n$ and $b_n$ such that $$ b_n(\mu, \sigma) = e^\mu \, b_n(0, 1)^\sigma, \qquad a_n(\mu, \sigma) = \sigma \,(2 \log n)^{-1/2} b_n(\mu,\,\sigma), $$ see Embrechts P., Klüppelberg C. and Mikosch T. table 3.4.4 pp 155-157. If we use sequences $a_n$ and $b_n$ with a wrong $\sigma$, we will not get a non-degenerate limit for the left-hand side of (1), because the growth rates of $a_n$ and $b_n$ are then unsuitable for the tail of $X_i$.
Extreme Value Theory: Lognormal GEV parameters
Let $X_i \sim_{\text{i.i.d}} \text{LNorm}(\mu,\,\sigma)$ with the meaning that the r.v. $\log X_i$ is normal with mean $\mu$ and standard deviation $\sigma$. Considering $M_n := \max_{1 \leqslant i \l
Extreme Value Theory: Lognormal GEV parameters Let $X_i \sim_{\text{i.i.d}} \text{LNorm}(\mu,\,\sigma)$ with the meaning that the r.v. $\log X_i$ is normal with mean $\mu$ and standard deviation $\sigma$. Considering $M_n := \max_{1 \leqslant i \leqslant n} X_i$, we know that there exist two sequences $a_n >0$ and $b_n$ such that $$ \tag{1} \frac{M_n - b_n}{a_n} \to \text{Gum}(0, 1) $$ where $\text{Gum}(\nu,\,\beta)$ denotes the Gumbel distribution with location $\nu$ and scale $\beta$. This means that $F_{M_n}(a_n x + b_n) \to F_{\text{Gum}}(x;\,0,\,1)$ for all $x$. Quite obviously the two sequences $a_n$ and $b_n$ depend on $\mu$ and $\sigma$, so they could be denoted as $a_n(\mu,\,\sigma)$ and $b_n(\mu,\,\sigma)$. For instance if $\mu$ is replaced by $\mu +1$ then the distribution of $X_i$ is replaced by that of $e X_i$ and the distribution of $M_n$ is replaced by that of $e M_n$, implying that $a_n$ and $b_n$ have to be replaced by $ea_n$ and $eb_n$ to maintain the same limit. Similarly if we replace $\mu$ by $0$ with $\sigma$ unchanged, $X_i$ is to be replaced by $e^{-\mu} X_i$ and then $a_n$ and $b_n$ must be replaced by $e^{-\mu} a_n$ and $e^{-\mu}b_n$. The question can be formulated as: if we use the sequences $a_n(0, 1)$ and $b_n(0, \,1)$ at the left-hand side of (1) - instead of the due $a_n(\mu,\,\sigma)$ and $b_n(\mu,\,\sigma)$ - do we get $\text{Gum}(\mu,\,\sigma)$ at the right-hand side? The answer is then no, because the parameters of the Gumbel are indeed location and scale parameters, while this is not true for the log-normal. The parameter $\sigma$ of the log-normal impacts the tail, as can be seen by the fact that the coefficient of variation increases with $\sigma$. While $\text{LNorm}(\mu,\,\sigma)$ always remains in the Gumbel domain of attraction, the sequences $a_n$ and $b_n$ must tend to $\infty$ more rapidly as $\sigma$ increases. It can be proved that we can in (1) use sequences $a_n$ and $b_n$ such that $$ b_n(\mu, \sigma) = e^\mu \, b_n(0, 1)^\sigma, \qquad a_n(\mu, \sigma) = \sigma \,(2 \log n)^{-1/2} b_n(\mu,\,\sigma), $$ see Embrechts P., Klüppelberg C. and Mikosch T. table 3.4.4 pp 155-157. If we use sequences $a_n$ and $b_n$ with a wrong $\sigma$, we will not get a non-degenerate limit for the left-hand side of (1), because the growth rates of $a_n$ and $b_n$ are then unsuitable for the tail of $X_i$.
Extreme Value Theory: Lognormal GEV parameters Let $X_i \sim_{\text{i.i.d}} \text{LNorm}(\mu,\,\sigma)$ with the meaning that the r.v. $\log X_i$ is normal with mean $\mu$ and standard deviation $\sigma$. Considering $M_n := \max_{1 \leqslant i \l
33,113
Estimating adjusted risk ratios in binary data using Poisson regression
I don't know if you still need an answer to this question, but I have a similar problem in which I'd like to use Poisson regression. In running your code, I found that if I set up the model as model <- glm(y ~ b + x, family=binomial(logit) rather than as your Poisson regression model, the same result occurs: the estimated OR is ~1.5 as ce approaches 1. So, I'm not sure that your example provides information on a possible problem with the use of Poisson regression for binary outcomes.
Estimating adjusted risk ratios in binary data using Poisson regression
I don't know if you still need an answer to this question, but I have a similar problem in which I'd like to use Poisson regression. In running your code, I found that if I set up the model as model
Estimating adjusted risk ratios in binary data using Poisson regression I don't know if you still need an answer to this question, but I have a similar problem in which I'd like to use Poisson regression. In running your code, I found that if I set up the model as model <- glm(y ~ b + x, family=binomial(logit) rather than as your Poisson regression model, the same result occurs: the estimated OR is ~1.5 as ce approaches 1. So, I'm not sure that your example provides information on a possible problem with the use of Poisson regression for binary outcomes.
Estimating adjusted risk ratios in binary data using Poisson regression I don't know if you still need an answer to this question, but I have a similar problem in which I'd like to use Poisson regression. In running your code, I found that if I set up the model as model
33,114
Estimating adjusted risk ratios in binary data using Poisson regression
I find that using direct maximum likelihood with the proper probability function greatly improves estimation of the relative risk. You can directly specify the truncated risk function as the predicted rate for the process. Usually we use the Hessian to create CIs for the estimate. I have not explored the possibility of using that as the "B" matrix (meat) in the Huber White error and using the fitted risks to get the "A" matrix (bread)... but I suspect it could work! More feasibly you can use a bootstrap to obtain model errors which are robust to a misspecified mean-variance relationship. ## the negative log likelihood for truncated risk function negLogLik <- function(best, X, y) { pest <- pmin(1, exp(X %*% best)) -sum(dpois(x = y, lambda = pest, log=TRUE)) } set.seed(100) sim <- replicate(100, { n <- 200 X <- cbind(1, 'b'=rbinom(n, 1, 0.5), 'x'=rnorm(n)) btrue <- c(log(0.3), log(2), 1) ptrue <- pmin(1, exp(X %*% matrix(btrue))) y <- rbinom(n, 1, ptrue) ## or just take y=ptrue for immediate results nlm(f = logLik, p = c(log(mean(y)),0,0), X=X, y=y)$estimate }) rowMeans(exp(sim)) Gives: > rowMeans(exp(sim)) [1] 0.3002813 2.0680780 3.0888280 The middle coefficient gives you what you want.
Estimating adjusted risk ratios in binary data using Poisson regression
I find that using direct maximum likelihood with the proper probability function greatly improves estimation of the relative risk. You can directly specify the truncated risk function as the predicted
Estimating adjusted risk ratios in binary data using Poisson regression I find that using direct maximum likelihood with the proper probability function greatly improves estimation of the relative risk. You can directly specify the truncated risk function as the predicted rate for the process. Usually we use the Hessian to create CIs for the estimate. I have not explored the possibility of using that as the "B" matrix (meat) in the Huber White error and using the fitted risks to get the "A" matrix (bread)... but I suspect it could work! More feasibly you can use a bootstrap to obtain model errors which are robust to a misspecified mean-variance relationship. ## the negative log likelihood for truncated risk function negLogLik <- function(best, X, y) { pest <- pmin(1, exp(X %*% best)) -sum(dpois(x = y, lambda = pest, log=TRUE)) } set.seed(100) sim <- replicate(100, { n <- 200 X <- cbind(1, 'b'=rbinom(n, 1, 0.5), 'x'=rnorm(n)) btrue <- c(log(0.3), log(2), 1) ptrue <- pmin(1, exp(X %*% matrix(btrue))) y <- rbinom(n, 1, ptrue) ## or just take y=ptrue for immediate results nlm(f = logLik, p = c(log(mean(y)),0,0), X=X, y=y)$estimate }) rowMeans(exp(sim)) Gives: > rowMeans(exp(sim)) [1] 0.3002813 2.0680780 3.0888280 The middle coefficient gives you what you want.
Estimating adjusted risk ratios in binary data using Poisson regression I find that using direct maximum likelihood with the proper probability function greatly improves estimation of the relative risk. You can directly specify the truncated risk function as the predicted
33,115
Simulating Convergence in Probability to a constant
I think of $P()$ as a distribution function (a complementary one in the specific case). Since I want to use computer simulation to exhibit that things tend the way the theoretical result tells us, I need to construct the empirical distribution function of $|X_n|$, or the empirical relative frequency distribution, and then somehow show that as $n$ increases, the values of $|X_n|$ concentrate "more and more" to zero. To obtain an empirical relative frequency function, I need (much) more than one sample increasing in size, because as the sample size increases, the distribution of $|X_n|$ changes for each different $n$. So I need to generate from the distribution of the $Y_i$'s, $m$ samples "in parallel", say $m$ ranging in the thousands, each of some initial size $n$, say $n$ ranging in the tens of thousands. I need then to calculate the value of $|X_n|$ from each sample (and for the same $n$), i.e. obtain the set of values $\{|x_{1n}|, |x_{2n}|,...,|x_{mn}|\}$. These values can be used to construct an empirical relative frequency distribution. Having faith in the theoretical result, I expect that "a lot" of the values of $|X_n|$ will be "very close" to zero -but of course, not all. So in order to show that the values of $|X_n|$ do indeed march towards zero in greater and greater numbers, I would have to repeat the process, increasing the sample size to say $2n$, and show that now the concentration to zero "has increased". Obviously to show that it has increased, one should specify an empirical value for $\epsilon$. Would that be enough? Could we somehow formalize this "increase in concentration"? Could this procedure, if performed in more "sample-size increase" steps, and the one being closer to the other, provide us with some estimate about the actual rate of convergence, i.e. something like "empirical probability mass that moves below the threshold per each $n$-step" of, say, one thousand? Or, examine the value of the threshold for which, say $90$% of the probability lies below, and see how this value of $\epsilon$ gets reduced in magnitude? AN EXAMPLE Consider the $Y_i$'s to be $U(0,1)$ and so $$|X_n| = \left|\frac 1n\sum_{i=1}^nY_i - \frac 12\right|$$ We first generate $m=1,000$ samples of $n=10,000$ size each. The empirical relative frequency distribution of $|X_{10,000}|$ looks like and we note that $90.10$% of the values of $|X_{10,000}|$ are smaller then $0.0046155$. Next I increase the sample size to $n=20,000$. Now the empirical relative frequency distribution of $|X_{20,000}|$ looks like and we note that $91.80$% of the values of $|X_{20,000}|$ are below $0.0037101$. Alternatively, now $98.00$% of values fall below $0.0045217$. Would you be persuaded by such a demonstration?
Simulating Convergence in Probability to a constant
I think of $P()$ as a distribution function (a complementary one in the specific case). Since I want to use computer simulation to exhibit that things tend the way the theoretical result tells us, I n
Simulating Convergence in Probability to a constant I think of $P()$ as a distribution function (a complementary one in the specific case). Since I want to use computer simulation to exhibit that things tend the way the theoretical result tells us, I need to construct the empirical distribution function of $|X_n|$, or the empirical relative frequency distribution, and then somehow show that as $n$ increases, the values of $|X_n|$ concentrate "more and more" to zero. To obtain an empirical relative frequency function, I need (much) more than one sample increasing in size, because as the sample size increases, the distribution of $|X_n|$ changes for each different $n$. So I need to generate from the distribution of the $Y_i$'s, $m$ samples "in parallel", say $m$ ranging in the thousands, each of some initial size $n$, say $n$ ranging in the tens of thousands. I need then to calculate the value of $|X_n|$ from each sample (and for the same $n$), i.e. obtain the set of values $\{|x_{1n}|, |x_{2n}|,...,|x_{mn}|\}$. These values can be used to construct an empirical relative frequency distribution. Having faith in the theoretical result, I expect that "a lot" of the values of $|X_n|$ will be "very close" to zero -but of course, not all. So in order to show that the values of $|X_n|$ do indeed march towards zero in greater and greater numbers, I would have to repeat the process, increasing the sample size to say $2n$, and show that now the concentration to zero "has increased". Obviously to show that it has increased, one should specify an empirical value for $\epsilon$. Would that be enough? Could we somehow formalize this "increase in concentration"? Could this procedure, if performed in more "sample-size increase" steps, and the one being closer to the other, provide us with some estimate about the actual rate of convergence, i.e. something like "empirical probability mass that moves below the threshold per each $n$-step" of, say, one thousand? Or, examine the value of the threshold for which, say $90$% of the probability lies below, and see how this value of $\epsilon$ gets reduced in magnitude? AN EXAMPLE Consider the $Y_i$'s to be $U(0,1)$ and so $$|X_n| = \left|\frac 1n\sum_{i=1}^nY_i - \frac 12\right|$$ We first generate $m=1,000$ samples of $n=10,000$ size each. The empirical relative frequency distribution of $|X_{10,000}|$ looks like and we note that $90.10$% of the values of $|X_{10,000}|$ are smaller then $0.0046155$. Next I increase the sample size to $n=20,000$. Now the empirical relative frequency distribution of $|X_{20,000}|$ looks like and we note that $91.80$% of the values of $|X_{20,000}|$ are below $0.0037101$. Alternatively, now $98.00$% of values fall below $0.0045217$. Would you be persuaded by such a demonstration?
Simulating Convergence in Probability to a constant I think of $P()$ as a distribution function (a complementary one in the specific case). Since I want to use computer simulation to exhibit that things tend the way the theoretical result tells us, I n
33,116
"Better" goodness-of-fit tests than chi squared for histogram modeling?
I'm going to venture an answer to my own question after some googling. One simple approach is to use binned Poisson maximum likelihood ratios. See p. 94-96 of this page: http://www.hep.phy.cam.ac.uk/~thomson/lectures/statistics/FittingHandout.pdf The likelihood ratio converges to a $\chi^2$ distribution in the large count limit, and if you're dealing with very few counts, you should do MC simulations to determine the empirical distribution of the likelihood ratio under the hypothesis that your histogram does indeed represent a collection of samples from the model distribution. You can determine a $p$-value from this simulated likelihood ratio distribution, and the $\chi^2$ test just represents a fast analytical approximation to this which is applicable in the large count limit. All of this is nothing more than following the "perennial philosophy" of frequentist statistics: If you think something interesting happened, you should find out how often you'd expect that thing to happen by chance before you go proclaiming to the world that it's interesting. If the $p$-value shows that random effects are almost surely not responsible for the difference between your model and your observation, then your model is probably wrong.
"Better" goodness-of-fit tests than chi squared for histogram modeling?
I'm going to venture an answer to my own question after some googling. One simple approach is to use binned Poisson maximum likelihood ratios. See p. 94-96 of this page: http://www.hep.phy.cam.ac.uk/~
"Better" goodness-of-fit tests than chi squared for histogram modeling? I'm going to venture an answer to my own question after some googling. One simple approach is to use binned Poisson maximum likelihood ratios. See p. 94-96 of this page: http://www.hep.phy.cam.ac.uk/~thomson/lectures/statistics/FittingHandout.pdf The likelihood ratio converges to a $\chi^2$ distribution in the large count limit, and if you're dealing with very few counts, you should do MC simulations to determine the empirical distribution of the likelihood ratio under the hypothesis that your histogram does indeed represent a collection of samples from the model distribution. You can determine a $p$-value from this simulated likelihood ratio distribution, and the $\chi^2$ test just represents a fast analytical approximation to this which is applicable in the large count limit. All of this is nothing more than following the "perennial philosophy" of frequentist statistics: If you think something interesting happened, you should find out how often you'd expect that thing to happen by chance before you go proclaiming to the world that it's interesting. If the $p$-value shows that random effects are almost surely not responsible for the difference between your model and your observation, then your model is probably wrong.
"Better" goodness-of-fit tests than chi squared for histogram modeling? I'm going to venture an answer to my own question after some googling. One simple approach is to use binned Poisson maximum likelihood ratios. See p. 94-96 of this page: http://www.hep.phy.cam.ac.uk/~
33,117
"Better" goodness-of-fit tests than chi squared for histogram modeling?
χ^2 is a good test specifically because χ^2 is an easily-computable approximation of K-L divergence. An improvement to the χ^2 test is given by the G-Test, which uses the K-L divergence (or, equivalently, the likelihood ratio) directly. The G-test is harder to compute by hand since it involves logs instead of square roots, but with computers this really doesn't matter any more. However, the G-test (and the χ^2 test) are for testing goodness-of-fit to a prespecified model and determining whether or not you can reject it. Neither test is designed for model comparison, the task of picking the best model from a set of candidate models. While you can try to use the G-test for comparing the two models, AIC will do this job better, as you correctly pointed out. You can make bigger improvements if you move away from model selection, and instead look into Bayesian model averaging or model stacking. These can get significantly more complex, though.
"Better" goodness-of-fit tests than chi squared for histogram modeling?
χ^2 is a good test specifically because χ^2 is an easily-computable approximation of K-L divergence. An improvement to the χ^2 test is given by the G-Test, which uses the K-L divergence (or, equivalen
"Better" goodness-of-fit tests than chi squared for histogram modeling? χ^2 is a good test specifically because χ^2 is an easily-computable approximation of K-L divergence. An improvement to the χ^2 test is given by the G-Test, which uses the K-L divergence (or, equivalently, the likelihood ratio) directly. The G-test is harder to compute by hand since it involves logs instead of square roots, but with computers this really doesn't matter any more. However, the G-test (and the χ^2 test) are for testing goodness-of-fit to a prespecified model and determining whether or not you can reject it. Neither test is designed for model comparison, the task of picking the best model from a set of candidate models. While you can try to use the G-test for comparing the two models, AIC will do this job better, as you correctly pointed out. You can make bigger improvements if you move away from model selection, and instead look into Bayesian model averaging or model stacking. These can get significantly more complex, though.
"Better" goodness-of-fit tests than chi squared for histogram modeling? χ^2 is a good test specifically because χ^2 is an easily-computable approximation of K-L divergence. An improvement to the χ^2 test is given by the G-Test, which uses the K-L divergence (or, equivalen
33,118
Machine learning with weighted / complex survey data
I work for a health care company on our member satisfaction team where weights are constantly applied to match the sample to the populations of our service regions. This is very important for interpretable modeling that aims to explain magnitude of relationships between variables. We also use a lot of ML for other tasks, but it seems like you may be wondering if this is important when using machine learning for prediction. As you hinted most machine learning techniques were not developed for the purpose of explaining relationships, but for predictive purposes. While a representative sample is important, it may not be critical..until your performance tanks. If algorithms have sufficient samples to learn respondent types, they will be able to predict new respondents' class (classification) / value (regression) well. For example if you had a data set with 4 variables, height, weight, sex, and age, your algorithm of choice will learn certain types of a person based of these characteristics. Say most people in the population are female, 5'4", 35 years old, and 130 pounds (not fact, just roll with it) and we are trying to predict gender. Now say my sample has a low representation of this demographic proportionally, yet still has a high enough number (N) of this type of person. Our model has learned what that type of person looks like though that type of person is not well represented in my sample. When our model sees a new person with those characteristics it will have learned which label (gender) is most associated with said person. If our sample shows that those characteristics are more related to females than males and this matches the population then all is well. The problem arises when the sample's outcome variable does not represent the population by so much that it predicts a different class / value. So when it comes down to it, testing your predictive ML model on representative data is where you can find out if you have a problem. However, I think it would be fairly rare to sample in such a biased way that prediction would suffer greatly. If accuracy / kappa statistic / AUC is low or RMSE is high when testing then you might want to shave off those people that over-represent demographics of interest given you have enough data.
Machine learning with weighted / complex survey data
I work for a health care company on our member satisfaction team where weights are constantly applied to match the sample to the populations of our service regions. This is very important for interpre
Machine learning with weighted / complex survey data I work for a health care company on our member satisfaction team where weights are constantly applied to match the sample to the populations of our service regions. This is very important for interpretable modeling that aims to explain magnitude of relationships between variables. We also use a lot of ML for other tasks, but it seems like you may be wondering if this is important when using machine learning for prediction. As you hinted most machine learning techniques were not developed for the purpose of explaining relationships, but for predictive purposes. While a representative sample is important, it may not be critical..until your performance tanks. If algorithms have sufficient samples to learn respondent types, they will be able to predict new respondents' class (classification) / value (regression) well. For example if you had a data set with 4 variables, height, weight, sex, and age, your algorithm of choice will learn certain types of a person based of these characteristics. Say most people in the population are female, 5'4", 35 years old, and 130 pounds (not fact, just roll with it) and we are trying to predict gender. Now say my sample has a low representation of this demographic proportionally, yet still has a high enough number (N) of this type of person. Our model has learned what that type of person looks like though that type of person is not well represented in my sample. When our model sees a new person with those characteristics it will have learned which label (gender) is most associated with said person. If our sample shows that those characteristics are more related to females than males and this matches the population then all is well. The problem arises when the sample's outcome variable does not represent the population by so much that it predicts a different class / value. So when it comes down to it, testing your predictive ML model on representative data is where you can find out if you have a problem. However, I think it would be fairly rare to sample in such a biased way that prediction would suffer greatly. If accuracy / kappa statistic / AUC is low or RMSE is high when testing then you might want to shave off those people that over-represent demographics of interest given you have enough data.
Machine learning with weighted / complex survey data I work for a health care company on our member satisfaction team where weights are constantly applied to match the sample to the populations of our service regions. This is very important for interpre
33,119
Linear regression model that best suit for data with errors
Measurement error in the dependent variable Given a general linear model $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+\varepsilon\tag{1}$$ with $\varepsilon$ homosckedastic, not autocorrelated and uncorrelated with the independent variables, let $y^*$ denote the "true" variable, and $y$ its observable measure. The measurement error is defined as their difference $$e=y-y^*$$ Thus, the estimable model is: $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+e+\varepsilon\tag{2}$$ Since $y,x_1,\dots,x_k$ are observed, we can estimate the model by OLS. If the measurement error in $y$ is statistically independent of each explanatory variable, then $(e+\varepsilon)$ shares the same properties as $\varepsilon$ and the usual OLS inference procedures ($t$ statistics, etc.) are valid. However, in your case I'd expect an increasing variance of $e$. You could use: a weighted least squares estimator (e.g. Kutner et al., §11.1; Verbeek, §4.3.1-3); the OLS estimator, which is still unbiased and consistent, and heteroskedasticity-consistent standard errors, or simply Wite standard errors (Verbeek, §4.3.4). Measurement error in the independent variable Given the same linear model as above, let $x_k^*$ denote the "true" value and $x_k$ its observable measure. The measurement error is now: $$e_k=x_k-x_k^*$$ There are two main situations (Wooldridge, §4.4.2). $\text{Cov}(x_k,e_k)=0$: the measurement error is uncorrelated with the observed measure and must therefore be correlated with the unobserved variable $x^*_k$; writing $x_k^*=x_k-e_k$ and plugging this into (1): $$y=\beta_0+\beta_1x_1+\cdots+\beta_kx_k+(\varepsilon-\beta_ke_k)$$ since $\varepsilon$ and $e$ both are uncorrelated with each $x_j$, including $x_k$, measurement just increases the error variance and violates none of the OLS assumptions; $\text{Cov}(x^*_k,\eta_k)=0$: the measurement error is uncorrelated with the unobserved variable and must therefore be correlated with the observed measure $x_k$; such a correlation causes prolems and the OLS regression of $y$ on $x_1,\dots,x_k$ generally gives biased and unconsitent estimators. As far as I can guess by looking at your plot (errors centered on the "true" values of the independent variable), the first scenario could apply.
Linear regression model that best suit for data with errors
Measurement error in the dependent variable Given a general linear model $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+\varepsilon\tag{1}$$ with $\varepsilon$ homosckedastic, not autocorrelated and uncorr
Linear regression model that best suit for data with errors Measurement error in the dependent variable Given a general linear model $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+\varepsilon\tag{1}$$ with $\varepsilon$ homosckedastic, not autocorrelated and uncorrelated with the independent variables, let $y^*$ denote the "true" variable, and $y$ its observable measure. The measurement error is defined as their difference $$e=y-y^*$$ Thus, the estimable model is: $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+e+\varepsilon\tag{2}$$ Since $y,x_1,\dots,x_k$ are observed, we can estimate the model by OLS. If the measurement error in $y$ is statistically independent of each explanatory variable, then $(e+\varepsilon)$ shares the same properties as $\varepsilon$ and the usual OLS inference procedures ($t$ statistics, etc.) are valid. However, in your case I'd expect an increasing variance of $e$. You could use: a weighted least squares estimator (e.g. Kutner et al., §11.1; Verbeek, §4.3.1-3); the OLS estimator, which is still unbiased and consistent, and heteroskedasticity-consistent standard errors, or simply Wite standard errors (Verbeek, §4.3.4). Measurement error in the independent variable Given the same linear model as above, let $x_k^*$ denote the "true" value and $x_k$ its observable measure. The measurement error is now: $$e_k=x_k-x_k^*$$ There are two main situations (Wooldridge, §4.4.2). $\text{Cov}(x_k,e_k)=0$: the measurement error is uncorrelated with the observed measure and must therefore be correlated with the unobserved variable $x^*_k$; writing $x_k^*=x_k-e_k$ and plugging this into (1): $$y=\beta_0+\beta_1x_1+\cdots+\beta_kx_k+(\varepsilon-\beta_ke_k)$$ since $\varepsilon$ and $e$ both are uncorrelated with each $x_j$, including $x_k$, measurement just increases the error variance and violates none of the OLS assumptions; $\text{Cov}(x^*_k,\eta_k)=0$: the measurement error is uncorrelated with the unobserved variable and must therefore be correlated with the observed measure $x_k$; such a correlation causes prolems and the OLS regression of $y$ on $x_1,\dots,x_k$ generally gives biased and unconsitent estimators. As far as I can guess by looking at your plot (errors centered on the "true" values of the independent variable), the first scenario could apply.
Linear regression model that best suit for data with errors Measurement error in the dependent variable Given a general linear model $$y=\beta_0+\beta_1 x_1+\cdots+\beta_kx_k+\varepsilon\tag{1}$$ with $\varepsilon$ homosckedastic, not autocorrelated and uncorr
33,120
Clustering data that has mixture of continuous and categorical variables
Spend lots of time on understanding similarity on your data. Formalize your notion of similarity in a specialized similarity measure, designed for your particular data set (you will likely not be able to use an out-of-the-box similarity). Use a clustering algorithm that can use arbitrary similarites, such as hierarchical clustering, DBSCAN, affinity propagation, or spectral clustering.
Clustering data that has mixture of continuous and categorical variables
Spend lots of time on understanding similarity on your data. Formalize your notion of similarity in a specialized similarity measure, designed for your particular data set (you will likely not be able
Clustering data that has mixture of continuous and categorical variables Spend lots of time on understanding similarity on your data. Formalize your notion of similarity in a specialized similarity measure, designed for your particular data set (you will likely not be able to use an out-of-the-box similarity). Use a clustering algorithm that can use arbitrary similarites, such as hierarchical clustering, DBSCAN, affinity propagation, or spectral clustering.
Clustering data that has mixture of continuous and categorical variables Spend lots of time on understanding similarity on your data. Formalize your notion of similarity in a specialized similarity measure, designed for your particular data set (you will likely not be able
33,121
Clustering data that has mixture of continuous and categorical variables
See https://cran.r-project.org/web/packages/ClustOfVar for the R package ClustOfVar. It appears to implement some of the best available clustering methods for mixtures of variable types.
Clustering data that has mixture of continuous and categorical variables
See https://cran.r-project.org/web/packages/ClustOfVar for the R package ClustOfVar. It appears to implement some of the best available clustering methods for mixtures of variable types.
Clustering data that has mixture of continuous and categorical variables See https://cran.r-project.org/web/packages/ClustOfVar for the R package ClustOfVar. It appears to implement some of the best available clustering methods for mixtures of variable types.
Clustering data that has mixture of continuous and categorical variables See https://cran.r-project.org/web/packages/ClustOfVar for the R package ClustOfVar. It appears to implement some of the best available clustering methods for mixtures of variable types.
33,122
Comparing two distributions in Fourier space
One notable distance that can be considered in Fourier space is the maximum mean discrepancy (MMD). One first selects a positive semi-definite kernel $k : \mathcal X \times \mathcal X \to \mathbb R$ corresponding to a reproducing kernel Hilbert space (RKHS) $\mathcal H_k$. The MMD is then \begin{align} \operatorname{MMD}_k(\mathbb P, \mathbb Q) &= \sup_{f \in \mathcal H_k : \lVert f \rVert_{\mathcal H_k} \le 1} \mathbb E_{X \sim \mathbb P}[ f(X)] - \mathbb E_{Y \sim \mathbb Q}[ f(Y)] \\&= \left\lVert \mathbb E_{X \sim \mathbb P}[k(X, \cdot)] - \mathbb E_{Y \sim \mathbb Q}[k(Y, \cdot)] \right\rVert \\&= \sqrt{ \mathbb{E}_{\substack{X, X' \sim \mathbb P\\Y, Y' \sim \mathbb Q}}\left[ k(X, X') + k(Y, Y') - 2 k(X, Y) \right] } .\end{align} You might be familiar with the energy distance; that is a special case of the MMD for a particular choice of kernel. This is a proper metric for many choices of kernel, called characteristic kernels; it is always a semimetric. What does this have to do with the Fourier transform? Well, if $\mathcal X = \mathbb R^d$ and $k(x, y) = \psi(x - y)$, so that $\psi : \mathbb R^d \to \mathbb R$ is a positive-definite function, then it turns out the MMD can also be written as $$ \operatorname{MMD}_k(\mathbb P, \mathbb Q) = \sqrt{\int \left\lvert \varphi_{\mathbb P}(\omega) - \varphi_{\mathbb Q}(\omega) \right\rvert^2 \, \mathrm{d}\hat\psi(\omega)} $$ where $\varphi$ denotes the characteristic function, and $\hat\psi$ is the Fourier transform of $\psi$ in the measure sense. (It will always be a finite nonnegative measure; you can see from this definition that a translation-invariant kernel is characteristic iff its Fourier transform is everywhere positive.) For a proof, see Corollary 4 of Sriperumbudur et al., Hilbert space embeddings and metrics on probability measures, JMLR 2010. The MMD – which you can easily estimate via the third form above – thus compares distributions by the $L_2$ distance between their full characteristic functions, with frequencies weighted according to the choice of kernel. For example, the common Gaussian kernel $k(x, y) = \exp\left( -\frac{1}{2\sigma^2} \lVert x - y \rVert^2 \right)$ will weight the frequencies with a Gaussian with mean 0 and variance $1/\sigma^2$. Sometimes it's better, and sometimes computationally faster / more informative, to instead compare the characteristic functions at particular locations rather than everywhere. It turns out it's better to make a slight tweak, evaluating differences in smoothed characteristic functions at random locations: Chwialkowski et al., Fast Two-Sample Testing with Analytic Representations of Probability Measures, NeurIPS 2015. A follow-up work finds the most informative frequencies to test, rather than random: Jitkrittum et al., Interpretable Distribution Features with Maximum Testing Power, NeurIPS 2016. These are all closely connected to classical tests based on empircal characteristic functions as mentioned by kjetil in the comments.
Comparing two distributions in Fourier space
One notable distance that can be considered in Fourier space is the maximum mean discrepancy (MMD). One first selects a positive semi-definite kernel $k : \mathcal X \times \mathcal X \to \mathbb R$ c
Comparing two distributions in Fourier space One notable distance that can be considered in Fourier space is the maximum mean discrepancy (MMD). One first selects a positive semi-definite kernel $k : \mathcal X \times \mathcal X \to \mathbb R$ corresponding to a reproducing kernel Hilbert space (RKHS) $\mathcal H_k$. The MMD is then \begin{align} \operatorname{MMD}_k(\mathbb P, \mathbb Q) &= \sup_{f \in \mathcal H_k : \lVert f \rVert_{\mathcal H_k} \le 1} \mathbb E_{X \sim \mathbb P}[ f(X)] - \mathbb E_{Y \sim \mathbb Q}[ f(Y)] \\&= \left\lVert \mathbb E_{X \sim \mathbb P}[k(X, \cdot)] - \mathbb E_{Y \sim \mathbb Q}[k(Y, \cdot)] \right\rVert \\&= \sqrt{ \mathbb{E}_{\substack{X, X' \sim \mathbb P\\Y, Y' \sim \mathbb Q}}\left[ k(X, X') + k(Y, Y') - 2 k(X, Y) \right] } .\end{align} You might be familiar with the energy distance; that is a special case of the MMD for a particular choice of kernel. This is a proper metric for many choices of kernel, called characteristic kernels; it is always a semimetric. What does this have to do with the Fourier transform? Well, if $\mathcal X = \mathbb R^d$ and $k(x, y) = \psi(x - y)$, so that $\psi : \mathbb R^d \to \mathbb R$ is a positive-definite function, then it turns out the MMD can also be written as $$ \operatorname{MMD}_k(\mathbb P, \mathbb Q) = \sqrt{\int \left\lvert \varphi_{\mathbb P}(\omega) - \varphi_{\mathbb Q}(\omega) \right\rvert^2 \, \mathrm{d}\hat\psi(\omega)} $$ where $\varphi$ denotes the characteristic function, and $\hat\psi$ is the Fourier transform of $\psi$ in the measure sense. (It will always be a finite nonnegative measure; you can see from this definition that a translation-invariant kernel is characteristic iff its Fourier transform is everywhere positive.) For a proof, see Corollary 4 of Sriperumbudur et al., Hilbert space embeddings and metrics on probability measures, JMLR 2010. The MMD – which you can easily estimate via the third form above – thus compares distributions by the $L_2$ distance between their full characteristic functions, with frequencies weighted according to the choice of kernel. For example, the common Gaussian kernel $k(x, y) = \exp\left( -\frac{1}{2\sigma^2} \lVert x - y \rVert^2 \right)$ will weight the frequencies with a Gaussian with mean 0 and variance $1/\sigma^2$. Sometimes it's better, and sometimes computationally faster / more informative, to instead compare the characteristic functions at particular locations rather than everywhere. It turns out it's better to make a slight tweak, evaluating differences in smoothed characteristic functions at random locations: Chwialkowski et al., Fast Two-Sample Testing with Analytic Representations of Probability Measures, NeurIPS 2015. A follow-up work finds the most informative frequencies to test, rather than random: Jitkrittum et al., Interpretable Distribution Features with Maximum Testing Power, NeurIPS 2016. These are all closely connected to classical tests based on empircal characteristic functions as mentioned by kjetil in the comments.
Comparing two distributions in Fourier space One notable distance that can be considered in Fourier space is the maximum mean discrepancy (MMD). One first selects a positive semi-definite kernel $k : \mathcal X \times \mathcal X \to \mathbb R$ c
33,123
Survival analysis where covariates are unavailable for censored data
@jsk has the key in their comment to @Alexis' answer. The appropriate type of survival analysis to use in this case is Competing Risks. You have three possible outcomes: a) accepted, b) rejected, and c) right-censored. The key is that accepted/rejected is not a single covariate but rather are two competing risks. This is pretty easy in most statistical software. For example, in R's survival package, you simply code the event as a factor with levels censored, accepted, and rejected. (censored must be the first level, other levels are assumed to be competing risks.)
Survival analysis where covariates are unavailable for censored data
@jsk has the key in their comment to @Alexis' answer. The appropriate type of survival analysis to use in this case is Competing Risks. You have three possible outcomes: a) accepted, b) rejected, and
Survival analysis where covariates are unavailable for censored data @jsk has the key in their comment to @Alexis' answer. The appropriate type of survival analysis to use in this case is Competing Risks. You have three possible outcomes: a) accepted, b) rejected, and c) right-censored. The key is that accepted/rejected is not a single covariate but rather are two competing risks. This is pretty easy in most statistical software. For example, in R's survival package, you simply code the event as a factor with levels censored, accepted, and rejected. (censored must be the first level, other levels are assumed to be competing risks.)
Survival analysis where covariates are unavailable for censored data @jsk has the key in their comment to @Alexis' answer. The appropriate type of survival analysis to use in this case is Competing Risks. You have three possible outcomes: a) accepted, b) rejected, and
33,124
Survival analysis where covariates are unavailable for censored data
If I understand you, this is pretty standard survival analysis/event history analysis right-censoring stuff; Kaplan-Meyer, discrete-time hazard models etc. all estimate "whether and when" an event occurs while accounting for right-censoring of event occurrence (i.e your case case approval) by incorporating the shrinkage of the sample at risk of event over time due to both event occurrence and due to censoring. The Wikipedia article gives a decent intro. And you might check out Singer, J. D. and Willett, J. B. (2003). Applied longitudinal data analysis: Modeling change and event occurrence. Oxford University Press, New York, NY, which goes into detail on discrete-time event history models, and has a decent enough section on Cox proportional-hazards models.
Survival analysis where covariates are unavailable for censored data
If I understand you, this is pretty standard survival analysis/event history analysis right-censoring stuff; Kaplan-Meyer, discrete-time hazard models etc. all estimate "whether and when" an event occ
Survival analysis where covariates are unavailable for censored data If I understand you, this is pretty standard survival analysis/event history analysis right-censoring stuff; Kaplan-Meyer, discrete-time hazard models etc. all estimate "whether and when" an event occurs while accounting for right-censoring of event occurrence (i.e your case case approval) by incorporating the shrinkage of the sample at risk of event over time due to both event occurrence and due to censoring. The Wikipedia article gives a decent intro. And you might check out Singer, J. D. and Willett, J. B. (2003). Applied longitudinal data analysis: Modeling change and event occurrence. Oxford University Press, New York, NY, which goes into detail on discrete-time event history models, and has a decent enough section on Cox proportional-hazards models.
Survival analysis where covariates are unavailable for censored data If I understand you, this is pretty standard survival analysis/event history analysis right-censoring stuff; Kaplan-Meyer, discrete-time hazard models etc. all estimate "whether and when" an event occ
33,125
Fitting a time-varying coefficient DLM
What is exactly your problem? The only pitfall I found is that, apparently, fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4, fishdata.csv", header=T) reads data as integers. I had to convert them to float, x <- as.numeric(fishdata$marinefao) y <- as.numeric(fishdata$inlandfao) before I could invoke the dlm* functions.
Fitting a time-varying coefficient DLM
What is exactly your problem? The only pitfall I found is that, apparently, fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4, fishdata.csv", header=T) reads data as
Fitting a time-varying coefficient DLM What is exactly your problem? The only pitfall I found is that, apparently, fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4, fishdata.csv", header=T) reads data as integers. I had to convert them to float, x <- as.numeric(fishdata$marinefao) y <- as.numeric(fishdata$inlandfao) before I could invoke the dlm* functions.
Fitting a time-varying coefficient DLM What is exactly your problem? The only pitfall I found is that, apparently, fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4, fishdata.csv", header=T) reads data as
33,126
What are good ways of plotting distributions over time using R?
I would either use a smoother, such as: geom_smooth(method='loess') or I would subsample your data and plot only every 5 individuals, and every 10 time steps (for example). library(ggplot2) # Data looks like: # Subject Timestep Y # 1 1 0.5 # 1 2 0.6 # 1 3 0.6 # 1 4 0.7 temp=subset(data, ((as.numeric(subject)%%5)==0) & ((as.numeric(Timestep)%%10)==0)) qplot(Timestep,Y,data=temp) or both.
What are good ways of plotting distributions over time using R?
I would either use a smoother, such as: geom_smooth(method='loess') or I would subsample your data and plot only every 5 individuals, and every 10 time steps (for example). library(ggplot2) # Dat
What are good ways of plotting distributions over time using R? I would either use a smoother, such as: geom_smooth(method='loess') or I would subsample your data and plot only every 5 individuals, and every 10 time steps (for example). library(ggplot2) # Data looks like: # Subject Timestep Y # 1 1 0.5 # 1 2 0.6 # 1 3 0.6 # 1 4 0.7 temp=subset(data, ((as.numeric(subject)%%5)==0) & ((as.numeric(Timestep)%%10)==0)) qplot(Timestep,Y,data=temp) or both.
What are good ways of plotting distributions over time using R? I would either use a smoother, such as: geom_smooth(method='loess') or I would subsample your data and plot only every 5 individuals, and every 10 time steps (for example). library(ggplot2) # Dat
33,127
What are good ways of plotting distributions over time using R?
These are some great suggestions. My suggestion is to use half-violin plots as shown in http://biostat.mc.vanderbilt.edu/HmiscNew using the R Hmisc package summaryS function and lattice graphics.
What are good ways of plotting distributions over time using R?
These are some great suggestions. My suggestion is to use half-violin plots as shown in http://biostat.mc.vanderbilt.edu/HmiscNew using the R Hmisc package summaryS function and lattice graphics.
What are good ways of plotting distributions over time using R? These are some great suggestions. My suggestion is to use half-violin plots as shown in http://biostat.mc.vanderbilt.edu/HmiscNew using the R Hmisc package summaryS function and lattice graphics.
What are good ways of plotting distributions over time using R? These are some great suggestions. My suggestion is to use half-violin plots as shown in http://biostat.mc.vanderbilt.edu/HmiscNew using the R Hmisc package summaryS function and lattice graphics.
33,128
Do ensemble techniques increase VC-dimension?
It depends on the ensemble method you use. Usually the VC-dimension increases. But in the case of AdaBoost, you can find the answer here: http://www.cs.princeton.edu/courses/archive/spr08/cos511/scribe_notes/0305.pdf http://cseweb.ucsd.edu/~yfreund/papers/IntroToBoosting.pdf
Do ensemble techniques increase VC-dimension?
It depends on the ensemble method you use. Usually the VC-dimension increases. But in the case of AdaBoost, you can find the answer here: http://www.cs.princeton.edu/courses/archive/spr08/cos511/scri
Do ensemble techniques increase VC-dimension? It depends on the ensemble method you use. Usually the VC-dimension increases. But in the case of AdaBoost, you can find the answer here: http://www.cs.princeton.edu/courses/archive/spr08/cos511/scribe_notes/0305.pdf http://cseweb.ucsd.edu/~yfreund/papers/IntroToBoosting.pdf
Do ensemble techniques increase VC-dimension? It depends on the ensemble method you use. Usually the VC-dimension increases. But in the case of AdaBoost, you can find the answer here: http://www.cs.princeton.edu/courses/archive/spr08/cos511/scri
33,129
Correlation coefficient between two arrays of 2D points?
The Pyramid Match Kernel is a flexible technique for estimating a normalized correspondence strength between multidimensional point sets. It is analogous to $R^2$ in many ways (symmetric, values in $[0,1]$), and could suit your purposes.
Correlation coefficient between two arrays of 2D points?
The Pyramid Match Kernel is a flexible technique for estimating a normalized correspondence strength between multidimensional point sets. It is analogous to $R^2$ in many ways (symmetric, values in $[
Correlation coefficient between two arrays of 2D points? The Pyramid Match Kernel is a flexible technique for estimating a normalized correspondence strength between multidimensional point sets. It is analogous to $R^2$ in many ways (symmetric, values in $[0,1]$), and could suit your purposes.
Correlation coefficient between two arrays of 2D points? The Pyramid Match Kernel is a flexible technique for estimating a normalized correspondence strength between multidimensional point sets. It is analogous to $R^2$ in many ways (symmetric, values in $[
33,130
Structure of data and function call for recurrent event data with time-dependent variables
Your data formatting are correct. You have multiple records per-patient due to recurrent events and the added complexity of the drug being a time varying covariate. The output you printed using head is helpful for understanding these data. The typical approach to analyzing recurrent events as well as time varying covariates, is formatting the data to be in a "long" format where each row represents an interval of risk-covariate observations. For instance, we see patient 123 is on Drug1 alone from time 0 to time 2, then changes to take both Drug 1 and Drug 2 from time 3. At that point, they had not experienced a fall, so their observation from 0-2 is censored at that point because we do not know how much longer their fall would come if they continued to take Drug 1 alone. At time 3 they are re-entered into the cohort coded as a patient taking both drugs for 7 time-units after which they experience their first fall. They experience a second fall on the same Drug combination only 4 time-units after. The number of records is not a useful summary of cohort data. It is not surprising the number of rows is far larger than the number of patients. Instead, sum the times from start-to-stop and record it as an amount of person-time-at-risk. The cohort-denominator is useful for understanding incidence. It is useful also to summarize the raw number of patients, but bear in mind the data are in "long" format so that is less than the number of rows in your dataset. For the error, I think you may need to add 1 unit to the "stop" date. If patient 123 takes drug 1 for days 0, 1, and 2 and then starts drug 2 on day 3, then they experienced 3 days at-risk for falls on drug 1. However, 2-0 = 2 and that is not the correct denominator. What the "cluster" argument does (typically) is impose a frailty, which is a type of random intercept that accounts for what may be proportional risk differences attributable to several unmeasured risk factors. I do not often conduct analyses with frailties. You can omit the "cluster" command and interpret the outcomes as incidence ratios. You can alternately fit the cox model for the time until the first fall in all patients and interpret the hazard ratios as risk ratios. I think the frailty result should fall somewhere between these two, and I've never quite been clear what the interpretation should be.
Structure of data and function call for recurrent event data with time-dependent variables
Your data formatting are correct. You have multiple records per-patient due to recurrent events and the added complexity of the drug being a time varying covariate. The output you printed using head
Structure of data and function call for recurrent event data with time-dependent variables Your data formatting are correct. You have multiple records per-patient due to recurrent events and the added complexity of the drug being a time varying covariate. The output you printed using head is helpful for understanding these data. The typical approach to analyzing recurrent events as well as time varying covariates, is formatting the data to be in a "long" format where each row represents an interval of risk-covariate observations. For instance, we see patient 123 is on Drug1 alone from time 0 to time 2, then changes to take both Drug 1 and Drug 2 from time 3. At that point, they had not experienced a fall, so their observation from 0-2 is censored at that point because we do not know how much longer their fall would come if they continued to take Drug 1 alone. At time 3 they are re-entered into the cohort coded as a patient taking both drugs for 7 time-units after which they experience their first fall. They experience a second fall on the same Drug combination only 4 time-units after. The number of records is not a useful summary of cohort data. It is not surprising the number of rows is far larger than the number of patients. Instead, sum the times from start-to-stop and record it as an amount of person-time-at-risk. The cohort-denominator is useful for understanding incidence. It is useful also to summarize the raw number of patients, but bear in mind the data are in "long" format so that is less than the number of rows in your dataset. For the error, I think you may need to add 1 unit to the "stop" date. If patient 123 takes drug 1 for days 0, 1, and 2 and then starts drug 2 on day 3, then they experienced 3 days at-risk for falls on drug 1. However, 2-0 = 2 and that is not the correct denominator. What the "cluster" argument does (typically) is impose a frailty, which is a type of random intercept that accounts for what may be proportional risk differences attributable to several unmeasured risk factors. I do not often conduct analyses with frailties. You can omit the "cluster" command and interpret the outcomes as incidence ratios. You can alternately fit the cox model for the time until the first fall in all patients and interpret the hazard ratios as risk ratios. I think the frailty result should fall somewhere between these two, and I've never quite been clear what the interpretation should be.
Structure of data and function call for recurrent event data with time-dependent variables Your data formatting are correct. You have multiple records per-patient due to recurrent events and the added complexity of the drug being a time varying covariate. The output you printed using head
33,131
Modelling for soccer scores
The paper you are reading is implicitly using $\alpha_i$ and $\beta_i$ to refer to the attack and defense parameters as described by Maher (1982). The main difference is that Maher uses four parameters for each team (home attack, home defense, away attack and away defense) while Dixon and Coles use attack and defense parameters and another parameter to represent home advantage.
Modelling for soccer scores
The paper you are reading is implicitly using $\alpha_i$ and $\beta_i$ to refer to the attack and defense parameters as described by Maher (1982). The main difference is that Maher uses four parameter
Modelling for soccer scores The paper you are reading is implicitly using $\alpha_i$ and $\beta_i$ to refer to the attack and defense parameters as described by Maher (1982). The main difference is that Maher uses four parameters for each team (home attack, home defense, away attack and away defense) while Dixon and Coles use attack and defense parameters and another parameter to represent home advantage.
Modelling for soccer scores The paper you are reading is implicitly using $\alpha_i$ and $\beta_i$ to refer to the attack and defense parameters as described by Maher (1982). The main difference is that Maher uses four parameter
33,132
Modelling for soccer scores
The MLE for the Poisson distribution is simply: $ \lambda_{MLE}= \frac{1}{n} \sum_{i=1}^n k_i$ .. as far as reproducing their alterations to the Poisson distribution (a quick look tells me it has become both time-dependent and bivariate), I doubt anyone will do that for you. You're way better off using tools that actually make sense.
Modelling for soccer scores
The MLE for the Poisson distribution is simply: $ \lambda_{MLE}= \frac{1}{n} \sum_{i=1}^n k_i$ .. as far as reproducing their alterations to the Poisson distribution (a quick look tells me it has bec
Modelling for soccer scores The MLE for the Poisson distribution is simply: $ \lambda_{MLE}= \frac{1}{n} \sum_{i=1}^n k_i$ .. as far as reproducing their alterations to the Poisson distribution (a quick look tells me it has become both time-dependent and bivariate), I doubt anyone will do that for you. You're way better off using tools that actually make sense.
Modelling for soccer scores The MLE for the Poisson distribution is simply: $ \lambda_{MLE}= \frac{1}{n} \sum_{i=1}^n k_i$ .. as far as reproducing their alterations to the Poisson distribution (a quick look tells me it has bec
33,133
Modelling for soccer scores
You don't need bivariate Poisson. You can define your own function, and then use a generic optimization script like optim.
Modelling for soccer scores
You don't need bivariate Poisson. You can define your own function, and then use a generic optimization script like optim.
Modelling for soccer scores You don't need bivariate Poisson. You can define your own function, and then use a generic optimization script like optim.
Modelling for soccer scores You don't need bivariate Poisson. You can define your own function, and then use a generic optimization script like optim.
33,134
Modelling for soccer scores
You are feel free to refer to bivpois R package. My previous project applied diagonal bivariate poison. as you can refer to https://github.com/scibrokes/odds-modelling-and-testing-inefficiency-of-sports-bookmakers.
Modelling for soccer scores
You are feel free to refer to bivpois R package. My previous project applied diagonal bivariate poison. as you can refer to https://github.com/scibrokes/odds-modelling-and-testing-inefficiency-of-spor
Modelling for soccer scores You are feel free to refer to bivpois R package. My previous project applied diagonal bivariate poison. as you can refer to https://github.com/scibrokes/odds-modelling-and-testing-inefficiency-of-sports-bookmakers.
Modelling for soccer scores You are feel free to refer to bivpois R package. My previous project applied diagonal bivariate poison. as you can refer to https://github.com/scibrokes/odds-modelling-and-testing-inefficiency-of-spor
33,135
What is an adaptive copula?
I think adaptive in this context just means the reestimation on a rolling basis. So the parameter should not change until there is a change point. Then the true parameter increases and stays constant after it decreases again because of the second change point. The estimated parameter is evaluated compared to the true parameter: How fast does it get the change point? How fast does it adapt to the new environment?
What is an adaptive copula?
I think adaptive in this context just means the reestimation on a rolling basis. So the parameter should not change until there is a change point. Then the true parameter increases and stays constant
What is an adaptive copula? I think adaptive in this context just means the reestimation on a rolling basis. So the parameter should not change until there is a change point. Then the true parameter increases and stays constant after it decreases again because of the second change point. The estimated parameter is evaluated compared to the true parameter: How fast does it get the change point? How fast does it adapt to the new environment?
What is an adaptive copula? I think adaptive in this context just means the reestimation on a rolling basis. So the parameter should not change until there is a change point. Then the true parameter increases and stays constant
33,136
What is an adaptive copula?
It means re-estimation on a rolling basis. However, I do not understand why one would want to do this when there's perfectly good parametric dynamic copulas invented by Patton (2006) and extended by others with various forcing equations, as well as the more recent stochastic autoregressive copula (SCAR). Read here [1][www.wisostat.uni-koeln.de/Institut/.../Manner_Reznikova(2010ER).pdf‎].
What is an adaptive copula?
It means re-estimation on a rolling basis. However, I do not understand why one would want to do this when there's perfectly good parametric dynamic copulas invented by Patton (2006) and extended by o
What is an adaptive copula? It means re-estimation on a rolling basis. However, I do not understand why one would want to do this when there's perfectly good parametric dynamic copulas invented by Patton (2006) and extended by others with various forcing equations, as well as the more recent stochastic autoregressive copula (SCAR). Read here [1][www.wisostat.uni-koeln.de/Institut/.../Manner_Reznikova(2010ER).pdf‎].
What is an adaptive copula? It means re-estimation on a rolling basis. However, I do not understand why one would want to do this when there's perfectly good parametric dynamic copulas invented by Patton (2006) and extended by o
33,137
Question about inverse-variance weighting
I'm not sure whether the inverse-variance weighting formulas apply here. However I think you might compute the conditional distribution of $x$ given $a$ and $b$ by assuming that $x$, $y$, $a$ and $b$ follow a joint multivariate normal distribution. Specifically, if you assume (compatibly with what specified in the question) that \begin{equation} \left[\begin{matrix}x \\ y \\ u \\ v \end{matrix}\right] \sim N\left( \left[\begin{matrix}\mu_x \\ \mu_y \\ 0 \\ 0 \end{matrix}\right], \left[\begin{matrix} \sigma^2_x & \sigma_{xy} & 0 & 0 \\ \sigma_{xy} & \sigma^2_y & 0 & 0 \\ 0 & 0 & \phi^2_x & 0 \\ 0 & 0 & 0 & \phi^2_y \end{matrix}\right] \right) \end{equation} then, letting $a=x+u$ and $b=y+v$, you can find that \begin{equation} \left[\begin{matrix}x \\ a \\ b \end{matrix}\right] \sim N\left( \left[\begin{matrix}\mu_x \\ \mu_x \\ \mu_y \end{matrix}\right], \left[\begin{matrix} \sigma^2_x & \sigma^2_x & \sigma_{xy} \\ \sigma^2_x & \sigma^2_x + \phi^2_x & \sigma_{xy} \\ \sigma_{xy} & \sigma_{xy} & \sigma^2_y + \phi^2_y \end{matrix}\right] \right). \end{equation} (Note that in the above it is implicitly assumed that $u$ and $v$ are independent between each other and also with $x$ and $y$.) From this you could find the conditional distribution of $x$ given $a$ and $b$ using standard properties of the multivariate normal distribution (see here for example: http://en.wikipedia.org/wiki/Multivariate_normal_distribution#Conditional_distributions).
Question about inverse-variance weighting
I'm not sure whether the inverse-variance weighting formulas apply here. However I think you might compute the conditional distribution of $x$ given $a$ and $b$ by assuming that $x$, $y$, $a$ and $b$
Question about inverse-variance weighting I'm not sure whether the inverse-variance weighting formulas apply here. However I think you might compute the conditional distribution of $x$ given $a$ and $b$ by assuming that $x$, $y$, $a$ and $b$ follow a joint multivariate normal distribution. Specifically, if you assume (compatibly with what specified in the question) that \begin{equation} \left[\begin{matrix}x \\ y \\ u \\ v \end{matrix}\right] \sim N\left( \left[\begin{matrix}\mu_x \\ \mu_y \\ 0 \\ 0 \end{matrix}\right], \left[\begin{matrix} \sigma^2_x & \sigma_{xy} & 0 & 0 \\ \sigma_{xy} & \sigma^2_y & 0 & 0 \\ 0 & 0 & \phi^2_x & 0 \\ 0 & 0 & 0 & \phi^2_y \end{matrix}\right] \right) \end{equation} then, letting $a=x+u$ and $b=y+v$, you can find that \begin{equation} \left[\begin{matrix}x \\ a \\ b \end{matrix}\right] \sim N\left( \left[\begin{matrix}\mu_x \\ \mu_x \\ \mu_y \end{matrix}\right], \left[\begin{matrix} \sigma^2_x & \sigma^2_x & \sigma_{xy} \\ \sigma^2_x & \sigma^2_x + \phi^2_x & \sigma_{xy} \\ \sigma_{xy} & \sigma_{xy} & \sigma^2_y + \phi^2_y \end{matrix}\right] \right). \end{equation} (Note that in the above it is implicitly assumed that $u$ and $v$ are independent between each other and also with $x$ and $y$.) From this you could find the conditional distribution of $x$ given $a$ and $b$ using standard properties of the multivariate normal distribution (see here for example: http://en.wikipedia.org/wiki/Multivariate_normal_distribution#Conditional_distributions).
Question about inverse-variance weighting I'm not sure whether the inverse-variance weighting formulas apply here. However I think you might compute the conditional distribution of $x$ given $a$ and $b$ by assuming that $x$, $y$, $a$ and $b$
33,138
Using text mining/natural language processing tools for econometrics
I think it would benefit you to define what information you want to extract from the data. Simple keyword/regex searches may actually be very fruitful for you. I work in insurance and we use this sort of text mining quite frequently--it's arguably naive and definitely imperfect, but it is a relatively good start (or close approximation) to what we're generally interested in. But to my main point, in order to figure out whether your chosen method is appropriate, I'd recommend defining what exactly you want to extract from the data; that's the hardest part, in my opinion. It may be interesting to find the unique words within all of the strings and do a frequency of the top 1000 words or so. This may be computationally expensive (depending on your RAM/processor) but it may be interesting to look at. If I were exploring the data without much knowledge about it, this is where I'd start (others may offer different views). Hope that helps.
Using text mining/natural language processing tools for econometrics
I think it would benefit you to define what information you want to extract from the data. Simple keyword/regex searches may actually be very fruitful for you. I work in insurance and we use this sort
Using text mining/natural language processing tools for econometrics I think it would benefit you to define what information you want to extract from the data. Simple keyword/regex searches may actually be very fruitful for you. I work in insurance and we use this sort of text mining quite frequently--it's arguably naive and definitely imperfect, but it is a relatively good start (or close approximation) to what we're generally interested in. But to my main point, in order to figure out whether your chosen method is appropriate, I'd recommend defining what exactly you want to extract from the data; that's the hardest part, in my opinion. It may be interesting to find the unique words within all of the strings and do a frequency of the top 1000 words or so. This may be computationally expensive (depending on your RAM/processor) but it may be interesting to look at. If I were exploring the data without much knowledge about it, this is where I'd start (others may offer different views). Hope that helps.
Using text mining/natural language processing tools for econometrics I think it would benefit you to define what information you want to extract from the data. Simple keyword/regex searches may actually be very fruitful for you. I work in insurance and we use this sort
33,139
What is the difference between a Frequentist approach with meta-analysis and a Bayesian approach?
There are ample references on this question in statistical analysis at large, and in meta-analysis. For instance, have a look here: Dohoo I, Stryhn H, Sanchez J.Evaluation of underlying risk as a source of heterogeneity in meta-analyses: a simulation study of Bayesian and frequentist implementations of three models. Prev Vet Med. 2007 Sep 14;81(1-3):38-55. Epub 2007 May 2. Bennett MM, Crowe BJ, Price KL, Stamey JD, Seaman JW Jr.Comparison of Bayesian and frequentist meta-analytical approaches for analyzing time to event data. J Biopharm Stat. 2013;23(1):129-45. doi: 10.1080/10543406.2013.737210. Hong H, Carlin BP, Shamliyan TA, Wyman JF, Ramakrishnan R, Sainfort F, Kane RL. Comparing Bayesian and frequentist approaches for multiple outcome mixed treatment comparisons. Med Decis Making. 2013 Jul;33(5):702-14. doi: 10.1177/0272989X13481110. Epub 2013 Apr 2. Biggerstaff BJ, Tweedie RL, Mengersen KL. Passive smoking in the workplace: classical and Bayesian meta-analyses. Int Arch Occup Environ Health. 1994;66(4):269-77. The following passage from the abstract of Biggerstaff et al is particularly interesting: ...the approximations arising from classical methods appear to be non-conservative and should be used with caution. The Bayesian methods, which account more explicitly for possible inhomogeneity in studies, give slightly lower estimates again of relative risk and wider posterior credible intervals, indicating that inference from the non-Bayesian approaches might be optimistic. If you are interested in my personal opinion, Bayesian approaches are typically more flexible but more computationally or theoretically complex. In addition, the frequentist approach is based on the tricky concept of hypothesis testing and type I/II errors, whilst the Bayesian approach enables direct probability statements. Finally, Bayesian analysis forces you to explicitly acknowledge your assumptions. Anyway, I would caution against a meta-analysis in which Bayesian and frequentist approaches are quite conflicting.
What is the difference between a Frequentist approach with meta-analysis and a Bayesian approach?
There are ample references on this question in statistical analysis at large, and in meta-analysis. For instance, have a look here: Dohoo I, Stryhn H, Sanchez J.Evaluation of underlying risk as a sour
What is the difference between a Frequentist approach with meta-analysis and a Bayesian approach? There are ample references on this question in statistical analysis at large, and in meta-analysis. For instance, have a look here: Dohoo I, Stryhn H, Sanchez J.Evaluation of underlying risk as a source of heterogeneity in meta-analyses: a simulation study of Bayesian and frequentist implementations of three models. Prev Vet Med. 2007 Sep 14;81(1-3):38-55. Epub 2007 May 2. Bennett MM, Crowe BJ, Price KL, Stamey JD, Seaman JW Jr.Comparison of Bayesian and frequentist meta-analytical approaches for analyzing time to event data. J Biopharm Stat. 2013;23(1):129-45. doi: 10.1080/10543406.2013.737210. Hong H, Carlin BP, Shamliyan TA, Wyman JF, Ramakrishnan R, Sainfort F, Kane RL. Comparing Bayesian and frequentist approaches for multiple outcome mixed treatment comparisons. Med Decis Making. 2013 Jul;33(5):702-14. doi: 10.1177/0272989X13481110. Epub 2013 Apr 2. Biggerstaff BJ, Tweedie RL, Mengersen KL. Passive smoking in the workplace: classical and Bayesian meta-analyses. Int Arch Occup Environ Health. 1994;66(4):269-77. The following passage from the abstract of Biggerstaff et al is particularly interesting: ...the approximations arising from classical methods appear to be non-conservative and should be used with caution. The Bayesian methods, which account more explicitly for possible inhomogeneity in studies, give slightly lower estimates again of relative risk and wider posterior credible intervals, indicating that inference from the non-Bayesian approaches might be optimistic. If you are interested in my personal opinion, Bayesian approaches are typically more flexible but more computationally or theoretically complex. In addition, the frequentist approach is based on the tricky concept of hypothesis testing and type I/II errors, whilst the Bayesian approach enables direct probability statements. Finally, Bayesian analysis forces you to explicitly acknowledge your assumptions. Anyway, I would caution against a meta-analysis in which Bayesian and frequentist approaches are quite conflicting.
What is the difference between a Frequentist approach with meta-analysis and a Bayesian approach? There are ample references on this question in statistical analysis at large, and in meta-analysis. For instance, have a look here: Dohoo I, Stryhn H, Sanchez J.Evaluation of underlying risk as a sour
33,140
Relative variable importance with AIC
This is some further advise/discussion I was given: AIC RIW can only be calculated from a balanced candidate model set. If you have 3 variables (e.g. repro, time & WR) then the balanced set (without interactions) is repro time WR repro + time repro + WR time + WR repro + time + WR intercept only the number of models in the set is 2 to the power of the number of explanatory variables (in this case = 8) with 2-way interactions your candidate model set ALSO includes the following (i.e. in addition to those above) repro + time + repro*time repro + WR + repro*WR time + WR + time*WR repro + time + WR + repro*time repro + time + WR + repro*WR repro + time + WR + time*WR If you want the 3-way interaction, then you would ALSO add this to all of the models described above. Each variable relative importance weight is then the SUM of ALL AIC-weights from models that contain that variable. Because AIC-weights are standardized to sum to one within a candidate model set, then RIW for each variable can range from 0 to 1. Do not divide the result by the number of models it is contained in – it is the total sum. I would only use these for balanced candidate model sets; I wouldn’t use RIW for a smaller number of models. NOTE that if you include interactions, then you can only compare the RIWs of main effects with each other, and you can only compare the RIWs of interactions with each other. You cannot compare main effect RIWs with interaction RIWs (because main effects are present in more models than interactions). FYI: a strong explanatory variable will have a RIW of around 0.9, moderate effects of around 0.6-0.9, very weak effects of around 0.5-0.6 and below that, forget about it. For interactions, a strong effect could be >0.7, moderate >0.5. If you’re not using RIWs then simply look at your model table and see if you get consistent improvements in AIC when you add specific variables, and by how much. Strong effects will often give you improvements in AIC of >5, moderate 2-5 and weak 0-2. If you don’t get an improvement at all, then it isn’t explaining anything. if you don’t have a balanced candidate set, but DO have the AIC weights (which it appears you do), then you can simply use the ratios of these to determine the strength of support for one model over another. E.g. if you have model 1 with AIC-weight of 0.7 and model 2 with an AIC-weight of 0.15; then model 1 has 4.6 times more support from the data than model 2 (0.7/0.15). You can use this to assess the relative strength of variables as they go in and out of models. But you don’t NEED to do these calculations – and can simply refer the reader to the table. Especially if you have a dominant model; or a series of models at the top that all contain a particular variable. Then it is simply obvious to everyone that it is important.
Relative variable importance with AIC
This is some further advise/discussion I was given: AIC RIW can only be calculated from a balanced candidate model set. If you have 3 variables (e.g. repro, time & WR) then the balanced set (without
Relative variable importance with AIC This is some further advise/discussion I was given: AIC RIW can only be calculated from a balanced candidate model set. If you have 3 variables (e.g. repro, time & WR) then the balanced set (without interactions) is repro time WR repro + time repro + WR time + WR repro + time + WR intercept only the number of models in the set is 2 to the power of the number of explanatory variables (in this case = 8) with 2-way interactions your candidate model set ALSO includes the following (i.e. in addition to those above) repro + time + repro*time repro + WR + repro*WR time + WR + time*WR repro + time + WR + repro*time repro + time + WR + repro*WR repro + time + WR + time*WR If you want the 3-way interaction, then you would ALSO add this to all of the models described above. Each variable relative importance weight is then the SUM of ALL AIC-weights from models that contain that variable. Because AIC-weights are standardized to sum to one within a candidate model set, then RIW for each variable can range from 0 to 1. Do not divide the result by the number of models it is contained in – it is the total sum. I would only use these for balanced candidate model sets; I wouldn’t use RIW for a smaller number of models. NOTE that if you include interactions, then you can only compare the RIWs of main effects with each other, and you can only compare the RIWs of interactions with each other. You cannot compare main effect RIWs with interaction RIWs (because main effects are present in more models than interactions). FYI: a strong explanatory variable will have a RIW of around 0.9, moderate effects of around 0.6-0.9, very weak effects of around 0.5-0.6 and below that, forget about it. For interactions, a strong effect could be >0.7, moderate >0.5. If you’re not using RIWs then simply look at your model table and see if you get consistent improvements in AIC when you add specific variables, and by how much. Strong effects will often give you improvements in AIC of >5, moderate 2-5 and weak 0-2. If you don’t get an improvement at all, then it isn’t explaining anything. if you don’t have a balanced candidate set, but DO have the AIC weights (which it appears you do), then you can simply use the ratios of these to determine the strength of support for one model over another. E.g. if you have model 1 with AIC-weight of 0.7 and model 2 with an AIC-weight of 0.15; then model 1 has 4.6 times more support from the data than model 2 (0.7/0.15). You can use this to assess the relative strength of variables as they go in and out of models. But you don’t NEED to do these calculations – and can simply refer the reader to the table. Especially if you have a dominant model; or a series of models at the top that all contain a particular variable. Then it is simply obvious to everyone that it is important.
Relative variable importance with AIC This is some further advise/discussion I was given: AIC RIW can only be calculated from a balanced candidate model set. If you have 3 variables (e.g. repro, time & WR) then the balanced set (without
33,141
Relative variable importance with AIC
Two sentences down from the Page 169 quote, Brunham & Andersen (2002) explains why the ballancing is needed. Burnham and Anderson (2002), Page 169: This ballancing puts each variable on equal footing. Another words, if one variable is only in the model set once but another variable is in the model set many times, you have handicapped the variable that is under represented. For example, let's say you have 5 models and variable A was only in one model and variable B was in 4 models. Model AIC w A 12.0 0.579 B 14.5 0.166 B + C 15.0 0.129 B + C + D 16.0 0.078 B + D 17.0 0.048 Notice that Model A is clearly the best model based on AIC alone but based on relative variable importance (RIV), variable A has a RIV of 0.579 but B has a RIV of 0.421. This suggests on the face of if that variables A & B have similar relative importance but variable A was hadicapped because it was only included in one model. I have come across other cases where RIV values are adjusted by the number of models like Kittle et al. (2008) did. Looks like MuMIn does not adjust RIV by the number of models.
Relative variable importance with AIC
Two sentences down from the Page 169 quote, Brunham & Andersen (2002) explains why the ballancing is needed. Burnham and Anderson (2002), Page 169: This ballancing puts each variable on equal footi
Relative variable importance with AIC Two sentences down from the Page 169 quote, Brunham & Andersen (2002) explains why the ballancing is needed. Burnham and Anderson (2002), Page 169: This ballancing puts each variable on equal footing. Another words, if one variable is only in the model set once but another variable is in the model set many times, you have handicapped the variable that is under represented. For example, let's say you have 5 models and variable A was only in one model and variable B was in 4 models. Model AIC w A 12.0 0.579 B 14.5 0.166 B + C 15.0 0.129 B + C + D 16.0 0.078 B + D 17.0 0.048 Notice that Model A is clearly the best model based on AIC alone but based on relative variable importance (RIV), variable A has a RIV of 0.579 but B has a RIV of 0.421. This suggests on the face of if that variables A & B have similar relative importance but variable A was hadicapped because it was only included in one model. I have come across other cases where RIV values are adjusted by the number of models like Kittle et al. (2008) did. Looks like MuMIn does not adjust RIV by the number of models.
Relative variable importance with AIC Two sentences down from the Page 169 quote, Brunham & Andersen (2002) explains why the ballancing is needed. Burnham and Anderson (2002), Page 169: This ballancing puts each variable on equal footi
33,142
Rank correlation statistics comparison
The proposed question is rather complicated. As analystic already pointed out, I don't think all these measures can be compared straightforwardly, because rank correlation coefficients, Gini coefficient, and AUC (area under ROC curve) are generally defined on different domains. However, there is a very close relation between Kendall's $\tau$ and Spearman's $\rho$, the two rank correlation coefficients in the list. While the paper cohoz mentioned has demonstrated their relation empirically (Figure 3), this relation can actually be quantified theoretically. Let $\pi$ and $\sigma$ be two rankings, and $\pi(i)$ and $\sigma(i)$ be the ranks of item $i$ in $\pi$ and $\sigma$, respectively. The Kendall distance and Spearman distance between $\pi$ and $\sigma$ are defined as follows: $$ K(\pi,\sigma) = \# \lbrace \; (i,j) \, \vert \, \pi(i)>\pi(j) \text{ and } \sigma(i)<\sigma(j) \; \rbrace $$ $$ S(\pi,\sigma) = \sum_i \left( \pi(i) - \sigma(i)\right)^2 $$ We have the following relation between $K$ and $S$ following [Diaconis and Graham 1977]: $$ \frac{1}{\sqrt{n}}K(\pi,\sigma) \le S(\pi,\sigma) \le 2K(\pi,\sigma) $$ Because the rank correlation coefficients are just the normalization of the rank distances to the interval $[-1,1]$, similar inequalities can be easily derived between $\tau$ and $\rho$. In the statistical ranking literature, results are mostly represented in terms of distances rather than coefficients. Two more things: The rankings $\pi$ and $\sigma$ must be complete rankings in order to make this inequality hold. That is, they cannot be partial rankings. In case one is interested in $\tau$ and $\rho$ defined not only on rankings but on continuous random variables, the situation is more involved. Here is a related paper by Fredicks and Nelsen.
Rank correlation statistics comparison
The proposed question is rather complicated. As analystic already pointed out, I don't think all these measures can be compared straightforwardly, because rank correlation coefficients, Gini coefficie
Rank correlation statistics comparison The proposed question is rather complicated. As analystic already pointed out, I don't think all these measures can be compared straightforwardly, because rank correlation coefficients, Gini coefficient, and AUC (area under ROC curve) are generally defined on different domains. However, there is a very close relation between Kendall's $\tau$ and Spearman's $\rho$, the two rank correlation coefficients in the list. While the paper cohoz mentioned has demonstrated their relation empirically (Figure 3), this relation can actually be quantified theoretically. Let $\pi$ and $\sigma$ be two rankings, and $\pi(i)$ and $\sigma(i)$ be the ranks of item $i$ in $\pi$ and $\sigma$, respectively. The Kendall distance and Spearman distance between $\pi$ and $\sigma$ are defined as follows: $$ K(\pi,\sigma) = \# \lbrace \; (i,j) \, \vert \, \pi(i)>\pi(j) \text{ and } \sigma(i)<\sigma(j) \; \rbrace $$ $$ S(\pi,\sigma) = \sum_i \left( \pi(i) - \sigma(i)\right)^2 $$ We have the following relation between $K$ and $S$ following [Diaconis and Graham 1977]: $$ \frac{1}{\sqrt{n}}K(\pi,\sigma) \le S(\pi,\sigma) \le 2K(\pi,\sigma) $$ Because the rank correlation coefficients are just the normalization of the rank distances to the interval $[-1,1]$, similar inequalities can be easily derived between $\tau$ and $\rho$. In the statistical ranking literature, results are mostly represented in terms of distances rather than coefficients. Two more things: The rankings $\pi$ and $\sigma$ must be complete rankings in order to make this inequality hold. That is, they cannot be partial rankings. In case one is interested in $\tau$ and $\rho$ defined not only on rankings but on continuous random variables, the situation is more involved. Here is a related paper by Fredicks and Nelsen.
Rank correlation statistics comparison The proposed question is rather complicated. As analystic already pointed out, I don't think all these measures can be compared straightforwardly, because rank correlation coefficients, Gini coefficie
33,143
Conservativeness of tests based on a discrete random variables
I have never heard it suggested to use a mid p-value. This will not necessarily control your type-one error. As previously stated, the correct way to achieve a size of .05 is to perform a randomized test. However, your type one error is correct whether or not the test is randomized. In the conservative, non-randomized case, your testing procedure has a size smaller than the nominal alpha level. Since an alpha level of .05 is arbitrary anyway, it should be sufficient to report the size of the test.
Conservativeness of tests based on a discrete random variables
I have never heard it suggested to use a mid p-value. This will not necessarily control your type-one error. As previously stated, the correct way to achieve a size of .05 is to perform a randomized t
Conservativeness of tests based on a discrete random variables I have never heard it suggested to use a mid p-value. This will not necessarily control your type-one error. As previously stated, the correct way to achieve a size of .05 is to perform a randomized test. However, your type one error is correct whether or not the test is randomized. In the conservative, non-randomized case, your testing procedure has a size smaller than the nominal alpha level. Since an alpha level of .05 is arbitrary anyway, it should be sufficient to report the size of the test.
Conservativeness of tests based on a discrete random variables I have never heard it suggested to use a mid p-value. This will not necessarily control your type-one error. As previously stated, the correct way to achieve a size of .05 is to perform a randomized t
33,144
Conservativeness of tests based on a discrete random variables
One method of reducing the conservativeness of some discrete test statistics (or more generally, just getting more choices of significance level) Depending on the test, one occasionally useful approach that doesn't require randomizing is to add a tiny fraction of another reasonable statistic to break ties. For example, imagine we were testing Kendall's tau but in small-to-moderate-sized samples, it's still pretty discrete, so it's hard to achieve close to a desired significance level. For concreteness, let's say you want a level close to $\alpha = 10\%$ on a two tailed test, with $n=7$. The achievable significance levels are 6.9% or 13.6%; neither is very close to what's needed! One thing we could do is add a tiny fraction of a different statistic, one that's not perfectly correlated with the one we have; this means that many arrangements that gave statistics that were previously tied are no longer tied, even though their values are close. For example, if we use Spearman's rho to break ties, for example by looking at $0.999 \tau + 0.001 \rho$, the values are almost identical to before, but the achievable significance levels are now 8.9% and 10.9% - not perfect, but much better than before - and in this case, the statistic is still distribution free. Note that the weight on $\rho$ can be made as small as desired. Here's an illustration - the black is the ECDF of the original Kendall correlation, while the red is the 'break ties' version. I have made the relative contribution of the Spearman much larger here (a weight of 0.1) so you can see the effect more clearly: Let's zoom in on the region near the 2.5% and 5% level at the left end (one tailed, to correspond to 5% and 10% two-tailed): As we see, we can get much closer to the desired significance level this way, while retaining just about all the other desirable properties to whatever degree of nearness we wish. There are various adjustments to make the result even more Kendall-like (e.g. to set it up so the expectation of the small adjustment to the Kendall correlation at each Kendall correlation is zero, but that is rarely an issue for me). [If you really don't know which of Kendall and Spearman you wanted to use for a nonparametric correlation, a more even mix has a much more normal-looking distribution (though its a bit tricky to work its variance out if you don't work out the exact distribution - one nice feature of using a version with nearly all one or the other statistic is you can use an existing normal approximation more easily, even if it's not as nice a distribution).] This same approach for getting 'nicer' significance levels (and p-values) can work with other tests; I've seen it used with a sign test (breaking ties with an appropriately rescaled signed-rank statistic) for example.
Conservativeness of tests based on a discrete random variables
One method of reducing the conservativeness of some discrete test statistics (or more generally, just getting more choices of significance level) Depending on the test, one occasionally useful approac
Conservativeness of tests based on a discrete random variables One method of reducing the conservativeness of some discrete test statistics (or more generally, just getting more choices of significance level) Depending on the test, one occasionally useful approach that doesn't require randomizing is to add a tiny fraction of another reasonable statistic to break ties. For example, imagine we were testing Kendall's tau but in small-to-moderate-sized samples, it's still pretty discrete, so it's hard to achieve close to a desired significance level. For concreteness, let's say you want a level close to $\alpha = 10\%$ on a two tailed test, with $n=7$. The achievable significance levels are 6.9% or 13.6%; neither is very close to what's needed! One thing we could do is add a tiny fraction of a different statistic, one that's not perfectly correlated with the one we have; this means that many arrangements that gave statistics that were previously tied are no longer tied, even though their values are close. For example, if we use Spearman's rho to break ties, for example by looking at $0.999 \tau + 0.001 \rho$, the values are almost identical to before, but the achievable significance levels are now 8.9% and 10.9% - not perfect, but much better than before - and in this case, the statistic is still distribution free. Note that the weight on $\rho$ can be made as small as desired. Here's an illustration - the black is the ECDF of the original Kendall correlation, while the red is the 'break ties' version. I have made the relative contribution of the Spearman much larger here (a weight of 0.1) so you can see the effect more clearly: Let's zoom in on the region near the 2.5% and 5% level at the left end (one tailed, to correspond to 5% and 10% two-tailed): As we see, we can get much closer to the desired significance level this way, while retaining just about all the other desirable properties to whatever degree of nearness we wish. There are various adjustments to make the result even more Kendall-like (e.g. to set it up so the expectation of the small adjustment to the Kendall correlation at each Kendall correlation is zero, but that is rarely an issue for me). [If you really don't know which of Kendall and Spearman you wanted to use for a nonparametric correlation, a more even mix has a much more normal-looking distribution (though its a bit tricky to work its variance out if you don't work out the exact distribution - one nice feature of using a version with nearly all one or the other statistic is you can use an existing normal approximation more easily, even if it's not as nice a distribution).] This same approach for getting 'nicer' significance levels (and p-values) can work with other tests; I've seen it used with a sign test (breaking ties with an appropriately rescaled signed-rank statistic) for example.
Conservativeness of tests based on a discrete random variables One method of reducing the conservativeness of some discrete test statistics (or more generally, just getting more choices of significance level) Depending on the test, one occasionally useful approac
33,145
Alternatives to multinomial logistic regression
If your IIA test refuses the IIA , then you should estimate an alternative model like a nested probit or a mixed multinomial logit. As you mention, you may split you problem in two nested dichotomies: private or not, and Ngo or government. The nested approach is already available in stata whereas the mixed multinomial one can be found here: http://ideas.repec.org/a/tsj/stataj/v6y2006i2p229-245.html THe mixed mlogit approach introduces a random parameter that is common to your three categories, this way dependence across categories can be accounted for.
Alternatives to multinomial logistic regression
If your IIA test refuses the IIA , then you should estimate an alternative model like a nested probit or a mixed multinomial logit. As you mention, you may split you problem in two nested dichotomies
Alternatives to multinomial logistic regression If your IIA test refuses the IIA , then you should estimate an alternative model like a nested probit or a mixed multinomial logit. As you mention, you may split you problem in two nested dichotomies: private or not, and Ngo or government. The nested approach is already available in stata whereas the mixed multinomial one can be found here: http://ideas.repec.org/a/tsj/stataj/v6y2006i2p229-245.html THe mixed mlogit approach introduces a random parameter that is common to your three categories, this way dependence across categories can be accounted for.
Alternatives to multinomial logistic regression If your IIA test refuses the IIA , then you should estimate an alternative model like a nested probit or a mixed multinomial logit. As you mention, you may split you problem in two nested dichotomies
33,146
Choose best model between logit, probit and nls
The question of what model to use has to do with the objective of the analysis. If the objective is to develop a classifier to predict binary outcomes, then (as you can see), these three models are all approximately the same and give you approximately the same classifier. That makes it a moot point since you don't care what model develops your classifier and you might use cross validation or split sample validation to determine which model performs best in similar data. In inference, all models estimate different model parameters. All three regression models are special cases of GLMs which use a link function and a variance structure to determine the relationship between a binary outcome and (in this case) a continuous predictor. The NLS and logistic regression model use the same link function (the logit) but the NLS minimizes squared error in the fitting of the S curve where as the logistic regression is a maximum likelihood estimate of the model data under the assumption of the linear model for model probabilities and the binary distribution of observed outcomes. I can't think of a reason why we'd consider the NLS to be useful for inference. Probit regression uses a different link function which is the cumulative normal distribution function. This "tapers" faster than a logit and is often used to make inference on binary data that is observed as a binary threshold of unobserved continuous normally distributed outcomes. Empirically, the logistic regression model is used far more often for analysis of binary data since the model coefficient (odds-ratio) is easy to interpret, it is a maximum likelihood technique, and has good convergence properties.
Choose best model between logit, probit and nls
The question of what model to use has to do with the objective of the analysis. If the objective is to develop a classifier to predict binary outcomes, then (as you can see), these three models are a
Choose best model between logit, probit and nls The question of what model to use has to do with the objective of the analysis. If the objective is to develop a classifier to predict binary outcomes, then (as you can see), these three models are all approximately the same and give you approximately the same classifier. That makes it a moot point since you don't care what model develops your classifier and you might use cross validation or split sample validation to determine which model performs best in similar data. In inference, all models estimate different model parameters. All three regression models are special cases of GLMs which use a link function and a variance structure to determine the relationship between a binary outcome and (in this case) a continuous predictor. The NLS and logistic regression model use the same link function (the logit) but the NLS minimizes squared error in the fitting of the S curve where as the logistic regression is a maximum likelihood estimate of the model data under the assumption of the linear model for model probabilities and the binary distribution of observed outcomes. I can't think of a reason why we'd consider the NLS to be useful for inference. Probit regression uses a different link function which is the cumulative normal distribution function. This "tapers" faster than a logit and is often used to make inference on binary data that is observed as a binary threshold of unobserved continuous normally distributed outcomes. Empirically, the logistic regression model is used far more often for analysis of binary data since the model coefficient (odds-ratio) is easy to interpret, it is a maximum likelihood technique, and has good convergence properties.
Choose best model between logit, probit and nls The question of what model to use has to do with the objective of the analysis. If the objective is to develop a classifier to predict binary outcomes, then (as you can see), these three models are a
33,147
What model for a challenging data set? (hundreds of time series with a lot of nesting)
This is just some general suggestions you may find helpful, more a roadmap than a recipe. My instinct would be to build a Bayesian hierarchical model, because it lends itself to iterative model development - I don't think you'll find an existing model which has all the bells and whistles you're after. But this makes hypothesis testing harder, I don't know how necessary hypothesis testing is for you. It sounds like you've got a little informal model in your head about how the insects behave; you say things like "getting tired" and you know that the temperature makes the frequency higher, presumably because the animal has more energy. It sounds like you've got a little generative model in your mind about how the insects make their songs. The problem sounds way too complex to model "in one shot". I think you'll have to build something up piecemeal. I would start with some "strong simplying assumptions" - i.e., throw away most of the complexity of the dataset, with a plan to add it back in later once you've got a simple model which works. So to begin, I would do something like preprocess the sub-unit frequencies on a burst-by-burst basis into something like a (mean frequency,frequency trend) pair - do this with OLS, and just model the frequency mean and trend of a burst rather then the sub-units themselves. Or you could do (mean,trend,# of sub-units), if the number of subunits relates to how tired the insect is getting. Then build a Bayesian hierarchical model where the distribution of mean and trend of a burst is determined by the mean,trend of the recording, and this in turn is determined by the mean,trend of the location. Then add temperature in as a factor for the recording mean/trend. This simple model should allow you to to see the mean and trend of the individual bursts in a recording as determined by the temperature and the location. Try and get this to work. Then I would try to estimate the difference between mean frequency of the bursts (or trend, by dividing over the quiet time between bursts) by adding this as a variable determined by the location and recording. The next step is an AR model of the burst mean within a recording. Given some priors and some very strong assumptions about the nature of bursts (that all info is given by mean and trend), this basic model will tell you: how is the mean frequency of a burst different location by location and temp by temp how is the within-burst trend different location by location and temp by temp how is the outside-burst trend different location by location and temp by temp Once you've got something like this to work then it might be time to model the sub-units themselves and throw away the original OLS estimate. I'd look at the data at this point to get an idea of what kind of time-series model might fit, and model the parameters of the time-series model rather than (mean,trend) pairs.
What model for a challenging data set? (hundreds of time series with a lot of nesting)
This is just some general suggestions you may find helpful, more a roadmap than a recipe. My instinct would be to build a Bayesian hierarchical model, because it lends itself to iterative model devel
What model for a challenging data set? (hundreds of time series with a lot of nesting) This is just some general suggestions you may find helpful, more a roadmap than a recipe. My instinct would be to build a Bayesian hierarchical model, because it lends itself to iterative model development - I don't think you'll find an existing model which has all the bells and whistles you're after. But this makes hypothesis testing harder, I don't know how necessary hypothesis testing is for you. It sounds like you've got a little informal model in your head about how the insects behave; you say things like "getting tired" and you know that the temperature makes the frequency higher, presumably because the animal has more energy. It sounds like you've got a little generative model in your mind about how the insects make their songs. The problem sounds way too complex to model "in one shot". I think you'll have to build something up piecemeal. I would start with some "strong simplying assumptions" - i.e., throw away most of the complexity of the dataset, with a plan to add it back in later once you've got a simple model which works. So to begin, I would do something like preprocess the sub-unit frequencies on a burst-by-burst basis into something like a (mean frequency,frequency trend) pair - do this with OLS, and just model the frequency mean and trend of a burst rather then the sub-units themselves. Or you could do (mean,trend,# of sub-units), if the number of subunits relates to how tired the insect is getting. Then build a Bayesian hierarchical model where the distribution of mean and trend of a burst is determined by the mean,trend of the recording, and this in turn is determined by the mean,trend of the location. Then add temperature in as a factor for the recording mean/trend. This simple model should allow you to to see the mean and trend of the individual bursts in a recording as determined by the temperature and the location. Try and get this to work. Then I would try to estimate the difference between mean frequency of the bursts (or trend, by dividing over the quiet time between bursts) by adding this as a variable determined by the location and recording. The next step is an AR model of the burst mean within a recording. Given some priors and some very strong assumptions about the nature of bursts (that all info is given by mean and trend), this basic model will tell you: how is the mean frequency of a burst different location by location and temp by temp how is the within-burst trend different location by location and temp by temp how is the outside-burst trend different location by location and temp by temp Once you've got something like this to work then it might be time to model the sub-units themselves and throw away the original OLS estimate. I'd look at the data at this point to get an idea of what kind of time-series model might fit, and model the parameters of the time-series model rather than (mean,trend) pairs.
What model for a challenging data set? (hundreds of time series with a lot of nesting) This is just some general suggestions you may find helpful, more a roadmap than a recipe. My instinct would be to build a Bayesian hierarchical model, because it lends itself to iterative model devel
33,148
Classification with one dominant predictor
For 2-class problems, you can use the GBM package in R, which will iteratively fit classification trees to the residuals from the loss function. Unfortunately it does not yet support multi-class problems. This seems like a problem that's well suited for boosting, but I don't know of any boosting packages that support k-class problems. I think the problem is writing an appropriate loss function for the multiple classes. The glmnet packages has a multinomial loss function, perhaps you can look through it's source code for some pointers. You could try writing your own boosting algorithm, or you could turn your problem into k binary classification problems (one class vs. all other classes), fit a gbm model to each problem, and average the class probabilities from each model.
Classification with one dominant predictor
For 2-class problems, you can use the GBM package in R, which will iteratively fit classification trees to the residuals from the loss function. Unfortunately it does not yet support multi-class prob
Classification with one dominant predictor For 2-class problems, you can use the GBM package in R, which will iteratively fit classification trees to the residuals from the loss function. Unfortunately it does not yet support multi-class problems. This seems like a problem that's well suited for boosting, but I don't know of any boosting packages that support k-class problems. I think the problem is writing an appropriate loss function for the multiple classes. The glmnet packages has a multinomial loss function, perhaps you can look through it's source code for some pointers. You could try writing your own boosting algorithm, or you could turn your problem into k binary classification problems (one class vs. all other classes), fit a gbm model to each problem, and average the class probabilities from each model.
Classification with one dominant predictor For 2-class problems, you can use the GBM package in R, which will iteratively fit classification trees to the residuals from the loss function. Unfortunately it does not yet support multi-class prob
33,149
How to fairly determine winners for a regional science fair?
I think that "answer" is possibly too generous a label for my thoughts here. I love exploratory data analysis, and I am a huge boxplot fan, so that is going to be reflected in my comments.. Hi, that's a lot of scores. :) It sounds like you have at least 78 projects out of the 600 getting in the top 3 ([9+17]x3) plus the honourable mentions. Normally I would say to sample from the top and middle of each category to conduct an audit of scoring, but that would be very onerous in your case because of the numbers you have - and it's just you finalising the scoring. :) I'm hoping you might have a statistics package available to you, as I have some suggestions that you could use below. Have you looked at the spread of scores within each category? Are the top 3, or 5, or 8 projects very close for scores? That would suggest that the quality of the projects is very similar and no matter what you do, there is probably going to be at least a perception of arbitrariness around the final scores. I'm not sure how many projects each judge scores. Assuming they score a reasonable number (say >10, although the higher the better here), for each judge you could calculate the median and interquartile range for the total score given to each project they assess (you have so many attributes, it's probably not worth looking at each of them individually). Do any judges seem to be giving particularly high scores, or particularly low scores? Do any judges seem to be scoring consistently in the middle so they are possibly giving 10s, this can be shown by a comparatively small interquartile range and a total score median around the middle of the range of possible values. For the team projects, you could compare their placing on the basis of total scores, to their placing once the team deduction has been applied. Are the team deductions affecting teams that would otherwise be in the top 3? These are just suggestions to get you started. I think visualising the data along these lines would give you some good indicators about whether the placings seem fair. Update: this is an interestingly difficult problem that you have. It sounds like each individual judge doesn't assess enough projects for us to be able to come up with a weighting factor for each judge (to take account of judge bias), because we don't have enough data to be able to measure inter-rater reliability across the judges, there just isn't enough overlap for judges scoring on the same projects to do that. Did you look at the score range for the top few projects - were there clear differences between them and lower-scoring projects (natural boundaries?), how close in score were the top projects? Out of curiosity, were the judges given scoring criteria, so they had little flexibility in how to give scores on each criterion (e.g. give 1 point for providing a null hypothesis, give 1 point for providing one or more alternative hypotheses...) or were did they just know the total number of points they could award and the rest was left up to them? If they had a scoring guide, I would be more confident that the scores were reasonably accurate.
How to fairly determine winners for a regional science fair?
I think that "answer" is possibly too generous a label for my thoughts here. I love exploratory data analysis, and I am a huge boxplot fan, so that is going to be reflected in my comments.. Hi, that's
How to fairly determine winners for a regional science fair? I think that "answer" is possibly too generous a label for my thoughts here. I love exploratory data analysis, and I am a huge boxplot fan, so that is going to be reflected in my comments.. Hi, that's a lot of scores. :) It sounds like you have at least 78 projects out of the 600 getting in the top 3 ([9+17]x3) plus the honourable mentions. Normally I would say to sample from the top and middle of each category to conduct an audit of scoring, but that would be very onerous in your case because of the numbers you have - and it's just you finalising the scoring. :) I'm hoping you might have a statistics package available to you, as I have some suggestions that you could use below. Have you looked at the spread of scores within each category? Are the top 3, or 5, or 8 projects very close for scores? That would suggest that the quality of the projects is very similar and no matter what you do, there is probably going to be at least a perception of arbitrariness around the final scores. I'm not sure how many projects each judge scores. Assuming they score a reasonable number (say >10, although the higher the better here), for each judge you could calculate the median and interquartile range for the total score given to each project they assess (you have so many attributes, it's probably not worth looking at each of them individually). Do any judges seem to be giving particularly high scores, or particularly low scores? Do any judges seem to be scoring consistently in the middle so they are possibly giving 10s, this can be shown by a comparatively small interquartile range and a total score median around the middle of the range of possible values. For the team projects, you could compare their placing on the basis of total scores, to their placing once the team deduction has been applied. Are the team deductions affecting teams that would otherwise be in the top 3? These are just suggestions to get you started. I think visualising the data along these lines would give you some good indicators about whether the placings seem fair. Update: this is an interestingly difficult problem that you have. It sounds like each individual judge doesn't assess enough projects for us to be able to come up with a weighting factor for each judge (to take account of judge bias), because we don't have enough data to be able to measure inter-rater reliability across the judges, there just isn't enough overlap for judges scoring on the same projects to do that. Did you look at the score range for the top few projects - were there clear differences between them and lower-scoring projects (natural boundaries?), how close in score were the top projects? Out of curiosity, were the judges given scoring criteria, so they had little flexibility in how to give scores on each criterion (e.g. give 1 point for providing a null hypothesis, give 1 point for providing one or more alternative hypotheses...) or were did they just know the total number of points they could award and the rest was left up to them? If they had a scoring guide, I would be more confident that the scores were reasonably accurate.
How to fairly determine winners for a regional science fair? I think that "answer" is possibly too generous a label for my thoughts here. I love exploratory data analysis, and I am a huge boxplot fan, so that is going to be reflected in my comments.. Hi, that's
33,150
Split-split-plot design and lme
This comes rather late, but I think your analysis is generally correct, with 3 comments: Make sure it is ok to treat depth as random rather than fixed. I guess this depends on your definition of depth. Is it just 'topsoil' and 'subsoil' or some control levels like A1, B2, C2, etc.... A colleague of mine always recommend people creating another variable so it doesn't confuse people when the fixed and random effects have the same name. Something like lme(Variable~Sediment_ef*Hydrology_ef*Depth_ef, data=mydata, random=~1|Site/Hydrology/Depth), even if X_ef and X are identical columns. This is obviously the full model, where you might (or might not) want to reduce it to achieve parsimony.
Split-split-plot design and lme
This comes rather late, but I think your analysis is generally correct, with 3 comments: Make sure it is ok to treat depth as random rather than fixed. I guess this depends on your definition of dept
Split-split-plot design and lme This comes rather late, but I think your analysis is generally correct, with 3 comments: Make sure it is ok to treat depth as random rather than fixed. I guess this depends on your definition of depth. Is it just 'topsoil' and 'subsoil' or some control levels like A1, B2, C2, etc.... A colleague of mine always recommend people creating another variable so it doesn't confuse people when the fixed and random effects have the same name. Something like lme(Variable~Sediment_ef*Hydrology_ef*Depth_ef, data=mydata, random=~1|Site/Hydrology/Depth), even if X_ef and X are identical columns. This is obviously the full model, where you might (or might not) want to reduce it to achieve parsimony.
Split-split-plot design and lme This comes rather late, but I think your analysis is generally correct, with 3 comments: Make sure it is ok to treat depth as random rather than fixed. I guess this depends on your definition of dept
33,151
Fitting a special mixed model in R - alternatives to optim()
This isn't perhaps the solution you anticipated, but I think you could fit this model with brms (i.e. as an interface to Stan), with what it calls a 'distributional model'... see https://cran.r-project.org/web/packages/brms/vignettes/brms_distreg.html See also the overview vignette here which shows how to fit the binomial model. https://cran.r-project.org/web/packages/brms/vignettes/brms_overview.pdf
Fitting a special mixed model in R - alternatives to optim()
This isn't perhaps the solution you anticipated, but I think you could fit this model with brms (i.e. as an interface to Stan), with what it calls a 'distributional model'... see https://cran.r-projec
Fitting a special mixed model in R - alternatives to optim() This isn't perhaps the solution you anticipated, but I think you could fit this model with brms (i.e. as an interface to Stan), with what it calls a 'distributional model'... see https://cran.r-project.org/web/packages/brms/vignettes/brms_distreg.html See also the overview vignette here which shows how to fit the binomial model. https://cran.r-project.org/web/packages/brms/vignettes/brms_overview.pdf
Fitting a special mixed model in R - alternatives to optim() This isn't perhaps the solution you anticipated, but I think you could fit this model with brms (i.e. as an interface to Stan), with what it calls a 'distributional model'... see https://cran.r-projec
33,152
Memory requirements of $k$-means clustering
Algorithms like Lloyds can be implemented with $k\cdot(2\cdot d + 1)$ floating point values memory use only. MacQueens k-means algorithm should only need $k\cdot(d + 1)$ memory. However, as most users will want to know which point belongs to which cluster, almost every implementation you'll find will use $O(n+k\cdot d)$ memory. In other words, the memory use by k-means is essentially the output data size.
Memory requirements of $k$-means clustering
Algorithms like Lloyds can be implemented with $k\cdot(2\cdot d + 1)$ floating point values memory use only. MacQueens k-means algorithm should only need $k\cdot(d + 1)$ memory. However, as most users
Memory requirements of $k$-means clustering Algorithms like Lloyds can be implemented with $k\cdot(2\cdot d + 1)$ floating point values memory use only. MacQueens k-means algorithm should only need $k\cdot(d + 1)$ memory. However, as most users will want to know which point belongs to which cluster, almost every implementation you'll find will use $O(n+k\cdot d)$ memory. In other words, the memory use by k-means is essentially the output data size.
Memory requirements of $k$-means clustering Algorithms like Lloyds can be implemented with $k\cdot(2\cdot d + 1)$ floating point values memory use only. MacQueens k-means algorithm should only need $k\cdot(d + 1)$ memory. However, as most users
33,153
Memory requirements of $k$-means clustering
I recently came across a note of a scipy implementation of the k-means algorithm in scipy.cluster.vq.py Notes ----- This could be faster when number of codebooks is small, but it becomes a real memory hog when codebook is large. It requires N by M by O storage where N=number of obs, M = number of features, and O = number of codes.
Memory requirements of $k$-means clustering
I recently came across a note of a scipy implementation of the k-means algorithm in scipy.cluster.vq.py Notes ----- This could be faster when number of codebooks is small, but it becomes a real memor
Memory requirements of $k$-means clustering I recently came across a note of a scipy implementation of the k-means algorithm in scipy.cluster.vq.py Notes ----- This could be faster when number of codebooks is small, but it becomes a real memory hog when codebook is large. It requires N by M by O storage where N=number of obs, M = number of features, and O = number of codes.
Memory requirements of $k$-means clustering I recently came across a note of a scipy implementation of the k-means algorithm in scipy.cluster.vq.py Notes ----- This could be faster when number of codebooks is small, but it becomes a real memor
33,154
Approximating lognormal sum pdf (in R)
To obtain a numerical version of distribution function for moderate $N$ (say a dozen of r.vs or less), a simple approach is to compute the Discrete Fourier Transform (DFT) of each LN density, form the product and then use inverse DFT. The same grid must be used for all densities and it must be designed with some care. The computation can be done quite easily in a R function. However, do not expect to reach the remarkable precision of the classical distributions functions in R.
Approximating lognormal sum pdf (in R)
To obtain a numerical version of distribution function for moderate $N$ (say a dozen of r.vs or less), a simple approach is to compute the Discrete Fourier Transform (DFT) of each LN density, form the
Approximating lognormal sum pdf (in R) To obtain a numerical version of distribution function for moderate $N$ (say a dozen of r.vs or less), a simple approach is to compute the Discrete Fourier Transform (DFT) of each LN density, form the product and then use inverse DFT. The same grid must be used for all densities and it must be designed with some care. The computation can be done quite easily in a R function. However, do not expect to reach the remarkable precision of the classical distributions functions in R.
Approximating lognormal sum pdf (in R) To obtain a numerical version of distribution function for moderate $N$ (say a dozen of r.vs or less), a simple approach is to compute the Discrete Fourier Transform (DFT) of each LN density, form the
33,155
Correlation as a likelihood measure
I think there's a slight conceptual problem here: the likelihood is the quantity $P(x,y|\theta)$ as a function of $\theta$. But the correlation coefficient is a function of the data $x$ and $y$. The correlation coefficient is therefore by definition a "statistic" (a function of the data) and not a likelihood (a function of the parameters). To put it another way, there are values of $\theta$ for which the probability of the observed correlation would be high, and other values of $\theta$ for which the observed correlation would be low. If you have a correlated Gaussian in mind, then the observed correlation might be unlikely due to the fact that the covariance matrix was either more dependent or less dependent than would be expected from the data. (So the relationship between likelihood and $r^2$ will not even be monotonic unless $r^2=1$). Of course, the expected correlation coefficient is monotonically related to the off-diagonal term in a bivariate Gaussian, but this doesn't make $r^2$ itself a proxy for likelihood. It sounds like you're interested in a test of whether a particular correlation coefficient is likely to have been observed given that $x$ and $y$ were generated independently. For this, you might want to perform a significance test on the value of the observed $r$ or $r^2$, which will tell you how probable it is that you observed that value given a particular model of the data. The Wikipedia article on correlation coefficient inference discusses a few common tests.
Correlation as a likelihood measure
I think there's a slight conceptual problem here: the likelihood is the quantity $P(x,y|\theta)$ as a function of $\theta$. But the correlation coefficient is a function of the data $x$ and $y$. The c
Correlation as a likelihood measure I think there's a slight conceptual problem here: the likelihood is the quantity $P(x,y|\theta)$ as a function of $\theta$. But the correlation coefficient is a function of the data $x$ and $y$. The correlation coefficient is therefore by definition a "statistic" (a function of the data) and not a likelihood (a function of the parameters). To put it another way, there are values of $\theta$ for which the probability of the observed correlation would be high, and other values of $\theta$ for which the observed correlation would be low. If you have a correlated Gaussian in mind, then the observed correlation might be unlikely due to the fact that the covariance matrix was either more dependent or less dependent than would be expected from the data. (So the relationship between likelihood and $r^2$ will not even be monotonic unless $r^2=1$). Of course, the expected correlation coefficient is monotonically related to the off-diagonal term in a bivariate Gaussian, but this doesn't make $r^2$ itself a proxy for likelihood. It sounds like you're interested in a test of whether a particular correlation coefficient is likely to have been observed given that $x$ and $y$ were generated independently. For this, you might want to perform a significance test on the value of the observed $r$ or $r^2$, which will tell you how probable it is that you observed that value given a particular model of the data. The Wikipedia article on correlation coefficient inference discusses a few common tests.
Correlation as a likelihood measure I think there's a slight conceptual problem here: the likelihood is the quantity $P(x,y|\theta)$ as a function of $\theta$. But the correlation coefficient is a function of the data $x$ and $y$. The c
33,156
Correlation as a likelihood measure
I think PCA does something close to a Guassian noise model that comes close to a correlation measure in a multidimensional space.
Correlation as a likelihood measure
I think PCA does something close to a Guassian noise model that comes close to a correlation measure in a multidimensional space.
Correlation as a likelihood measure I think PCA does something close to a Guassian noise model that comes close to a correlation measure in a multidimensional space.
Correlation as a likelihood measure I think PCA does something close to a Guassian noise model that comes close to a correlation measure in a multidimensional space.
33,157
Distribution of 'unmixed' parts based on order of the mix
Observe that the random variable $i_j$ is a function of $\mathbf{Z} = (Z_1, \ldots, Z_n)$ only. For an $n$-vector, $\mathbf{z}$, we write $i_j(\mathbf{z})$ for the index of the $j$th largest coordinate. Let also $P_z(A) = P(X_1 \in A \mid Z_1 = z)$ denote the conditional distribution of $X_1$ given $Z_1$. If we break probabilities down according to the value of $i_j$ and desintegrate w.r.t. $\mathbf{Z}$ we get $$\begin{array}{rcl} P(X_{i_j} \in A) & = & \sum_{k} P(X_k \in A, i_j = k) \\ & = &\sum_k \int_{(i_j(z) = k)} P(X_k \in A \mid \mathbf{Z} = \mathbf{z}) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \sum_k \int_{(i_j(z) = k)} P(X_k \in A \mid Z_k = z_k) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \sum_k \int_{(i_j(z) = k)} P_{z_k}(A) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \int P_{z}(A) P(Z_{i_j} \in dz) \\ \end{array}$$ This argument is quite general and relies only on the stated i.i.d. assumptions, and $Z_k$ could be any given function of $(X_k, Y_k)$. Under the assumptions of normal distributions (taking $\sigma_y = 1$) and $Z_k$ being the sum, the conditional distribution of $X_1$ given $Z_1 = z$ is $$N\left(\frac{\sigma_x^2}{1+\sigma_x^2} z, \sigma_x^2\left(1 - \frac{\sigma_x^2}{1+\sigma_x^2}\right)\right)$$ and @probabilityislogic shows how to compute the distribution of $Z_{i_j}$, hence we have explicit expressions for both the distributions that enter in the last integral above. Whether the integral can be computed analytically is another question. You might be able to, but off the top of my head I can't tell if it is possible. For asymptotic analysis when $\sigma_x \to 0$ or $\sigma_x \to \infty$ it might not be necessary. The intuition behind the computation above is that this is a conditional independence argument. Given $Z_{k} = z$ the variables $X_{k}$ and $i_j$ are independent.
Distribution of 'unmixed' parts based on order of the mix
Observe that the random variable $i_j$ is a function of $\mathbf{Z} = (Z_1, \ldots, Z_n)$ only. For an $n$-vector, $\mathbf{z}$, we write $i_j(\mathbf{z})$ for the index of the $j$th largest coordinat
Distribution of 'unmixed' parts based on order of the mix Observe that the random variable $i_j$ is a function of $\mathbf{Z} = (Z_1, \ldots, Z_n)$ only. For an $n$-vector, $\mathbf{z}$, we write $i_j(\mathbf{z})$ for the index of the $j$th largest coordinate. Let also $P_z(A) = P(X_1 \in A \mid Z_1 = z)$ denote the conditional distribution of $X_1$ given $Z_1$. If we break probabilities down according to the value of $i_j$ and desintegrate w.r.t. $\mathbf{Z}$ we get $$\begin{array}{rcl} P(X_{i_j} \in A) & = & \sum_{k} P(X_k \in A, i_j = k) \\ & = &\sum_k \int_{(i_j(z) = k)} P(X_k \in A \mid \mathbf{Z} = \mathbf{z}) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \sum_k \int_{(i_j(z) = k)} P(X_k \in A \mid Z_k = z_k) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \sum_k \int_{(i_j(z) = k)} P_{z_k}(A) P(\mathbf{Z} \in d\mathbf{z}) \\ & = & \int P_{z}(A) P(Z_{i_j} \in dz) \\ \end{array}$$ This argument is quite general and relies only on the stated i.i.d. assumptions, and $Z_k$ could be any given function of $(X_k, Y_k)$. Under the assumptions of normal distributions (taking $\sigma_y = 1$) and $Z_k$ being the sum, the conditional distribution of $X_1$ given $Z_1 = z$ is $$N\left(\frac{\sigma_x^2}{1+\sigma_x^2} z, \sigma_x^2\left(1 - \frac{\sigma_x^2}{1+\sigma_x^2}\right)\right)$$ and @probabilityislogic shows how to compute the distribution of $Z_{i_j}$, hence we have explicit expressions for both the distributions that enter in the last integral above. Whether the integral can be computed analytically is another question. You might be able to, but off the top of my head I can't tell if it is possible. For asymptotic analysis when $\sigma_x \to 0$ or $\sigma_x \to \infty$ it might not be necessary. The intuition behind the computation above is that this is a conditional independence argument. Given $Z_{k} = z$ the variables $X_{k}$ and $i_j$ are independent.
Distribution of 'unmixed' parts based on order of the mix Observe that the random variable $i_j$ is a function of $\mathbf{Z} = (Z_1, \ldots, Z_n)$ only. For an $n$-vector, $\mathbf{z}$, we write $i_j(\mathbf{z})$ for the index of the $j$th largest coordinat
33,158
Distribution of 'unmixed' parts based on order of the mix
The distribution of $Z_{i_{j}}$ is not difficult, and it is given by the Beta-F compound distribution: $$p_{Z_{i_{j}}}(z)dz=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{z}{\sigma_{z}})\left[\Phi(\frac{z}{\sigma_{z}})\right]^{j-1}\left[1-\Phi(\frac{z}{\sigma_{z}})\right]^{n-j}dz$$ Where $\phi(x)$ is a standard normal PDF, and $\Phi(x)$ is a standard normal CDF, and $\sigma_{z}^{2}=\sigma_{y}^{2}+\sigma_{x}^{2}$. Now if you are given that $Y_{i_{j}}=y$, then $X_{i_{j}}$ is a 1-to-1 function of $Z_{i_{j}}$, namely $X_{i_{j}}=Z_{i_{j}}-y$. So I would think that this should be a simple application of the jacobian rule. $$p_{X_{i_{j}}|Y_{i_{j}}}(x|y)=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{x+y}{\sigma_{z}})\left[\Phi(\frac{x+y}{\sigma_{z}})\right]^{j-1}\left[1-\Phi(\frac{x+y}{\sigma_{z}})\right]^{n-j}dx$$ This seems too easy, but I think it is correct. Happy to be shown wrong.
Distribution of 'unmixed' parts based on order of the mix
The distribution of $Z_{i_{j}}$ is not difficult, and it is given by the Beta-F compound distribution: $$p_{Z_{i_{j}}}(z)dz=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{z}{\sigma_{z}})\left[
Distribution of 'unmixed' parts based on order of the mix The distribution of $Z_{i_{j}}$ is not difficult, and it is given by the Beta-F compound distribution: $$p_{Z_{i_{j}}}(z)dz=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{z}{\sigma_{z}})\left[\Phi(\frac{z}{\sigma_{z}})\right]^{j-1}\left[1-\Phi(\frac{z}{\sigma_{z}})\right]^{n-j}dz$$ Where $\phi(x)$ is a standard normal PDF, and $\Phi(x)$ is a standard normal CDF, and $\sigma_{z}^{2}=\sigma_{y}^{2}+\sigma_{x}^{2}$. Now if you are given that $Y_{i_{j}}=y$, then $X_{i_{j}}$ is a 1-to-1 function of $Z_{i_{j}}$, namely $X_{i_{j}}=Z_{i_{j}}-y$. So I would think that this should be a simple application of the jacobian rule. $$p_{X_{i_{j}}|Y_{i_{j}}}(x|y)=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{x+y}{\sigma_{z}})\left[\Phi(\frac{x+y}{\sigma_{z}})\right]^{j-1}\left[1-\Phi(\frac{x+y}{\sigma_{z}})\right]^{n-j}dx$$ This seems too easy, but I think it is correct. Happy to be shown wrong.
Distribution of 'unmixed' parts based on order of the mix The distribution of $Z_{i_{j}}$ is not difficult, and it is given by the Beta-F compound distribution: $$p_{Z_{i_{j}}}(z)dz=\frac{n!}{(j-1)!(n-j)!} \frac{1}{\sigma_{z}}\phi(\frac{z}{\sigma_{z}})\left[
33,159
Statistical project directory structure with multiple languages (e.g., R and Splus)?
I definitely wouldn't call it "best practices", but my typical project has directories R (which generally contains prepData.R, analysis.R, func.R, and figs.R, though could be these could be each split into many files and could use Sweave or asciidoc) Perl (mostly for parsing/converting data files) RawData (all original data files) Data (all processed files) Notes (generally notes from the collaborator) The R directory often contains subdirectories Figs and Rcache. Particularly important: version control! I like git.
Statistical project directory structure with multiple languages (e.g., R and Splus)?
I definitely wouldn't call it "best practices", but my typical project has directories R (which generally contains prepData.R, analysis.R, func.R, and figs.R, though could be these could be each spli
Statistical project directory structure with multiple languages (e.g., R and Splus)? I definitely wouldn't call it "best practices", but my typical project has directories R (which generally contains prepData.R, analysis.R, func.R, and figs.R, though could be these could be each split into many files and could use Sweave or asciidoc) Perl (mostly for parsing/converting data files) RawData (all original data files) Data (all processed files) Notes (generally notes from the collaborator) The R directory often contains subdirectories Figs and Rcache. Particularly important: version control! I like git.
Statistical project directory structure with multiple languages (e.g., R and Splus)? I definitely wouldn't call it "best practices", but my typical project has directories R (which generally contains prepData.R, analysis.R, func.R, and figs.R, though could be these could be each spli
33,160
Sample size for proportions in repeated measures
Let's take a stab at a first-order approximation assuming simple random sampling and a constant proportion of infection for any treatment. Assume the sample size is large enough that a normal approximation can be used in a hypothesis test on proportions so we can calculate a z statistic like so $z = \frac{p_t - p_0}{\sqrt{p_0(1-p_0)(\frac{1}{n_1}+\frac{1}{n_2})}}$ This is the sample statistic for a two-sample test, new formula vs. bleach, since we expect the effect of bleach to be random as well as the effect of the new formula. Then let $n = n_1 = n_2$, since balanced experiments have the greatest power, and use your specifications that $|p_t - p_0| \geq 0.1$, $p_0 = 0.2$. To attain a test statistic $|z| \geq 2$ (Type I error of about 5%), this works out to $n \approx 128$. This is a reasonable sample size for the normal approximation to work, but it's definitely a lower bound. I'd recommend doing a similar calculation based on the desired power for the test to control Type II error, since an underpowered design has a high probability of missing an actual effect. Once you've done all this basic spadework, start looking at the stuff whuber addresses. In particular, it's not clear from your problem statement whether the samples of poultry measured are different groups of subjects, or the same groups of subjects. If they're the same, you're into paired t test or repeated measures territory, and you need someone smarter than me to help out!
Sample size for proportions in repeated measures
Let's take a stab at a first-order approximation assuming simple random sampling and a constant proportion of infection for any treatment. Assume the sample size is large enough that a normal approxi
Sample size for proportions in repeated measures Let's take a stab at a first-order approximation assuming simple random sampling and a constant proportion of infection for any treatment. Assume the sample size is large enough that a normal approximation can be used in a hypothesis test on proportions so we can calculate a z statistic like so $z = \frac{p_t - p_0}{\sqrt{p_0(1-p_0)(\frac{1}{n_1}+\frac{1}{n_2})}}$ This is the sample statistic for a two-sample test, new formula vs. bleach, since we expect the effect of bleach to be random as well as the effect of the new formula. Then let $n = n_1 = n_2$, since balanced experiments have the greatest power, and use your specifications that $|p_t - p_0| \geq 0.1$, $p_0 = 0.2$. To attain a test statistic $|z| \geq 2$ (Type I error of about 5%), this works out to $n \approx 128$. This is a reasonable sample size for the normal approximation to work, but it's definitely a lower bound. I'd recommend doing a similar calculation based on the desired power for the test to control Type II error, since an underpowered design has a high probability of missing an actual effect. Once you've done all this basic spadework, start looking at the stuff whuber addresses. In particular, it's not clear from your problem statement whether the samples of poultry measured are different groups of subjects, or the same groups of subjects. If they're the same, you're into paired t test or repeated measures territory, and you need someone smarter than me to help out!
Sample size for proportions in repeated measures Let's take a stab at a first-order approximation assuming simple random sampling and a constant proportion of infection for any treatment. Assume the sample size is large enough that a normal approxi
33,161
Incremental learning for LOESS time series model
Let me re-formulate this into something more familiar to me. The ARIMA is an analog to PID approximation. I is integral. MA is P. the AR can be expressed as difference equations which are the D term. LOESS is an analog to least squares fitting (high-tech big brother really). So if I wanted to improve a second order model (PID) what could be done? First, I could use a Kalman Filter to update the model with a single piece of new information. I could also look at something called "gradient boosted trees". Using an analog of them, I would make a second ARIMA model whose inputs are both the raw inputs fed to the first, augmented with the errors of the first. I would consider looking at the PDF of the errors for multiple modes. If I could cluster the errors then I might want to split models, or use a Mixture model to separate the inputs into sub-models. The submodels might be better at handling the local phenomenology better than a single large-scale model. One of the questions that I have failed to ask is "what does performance mean?". If we do not have a clearly stated measure of goodness then there is no way to tell if a candidate method "improves". It seems like you want better modeling, shorter compute time, and more efficient use of information. Having ephemeris about the actual data can also inform this. If you are modeling wind, then you can know where to look for augmenting models, or find transformations for your data that are useful.
Incremental learning for LOESS time series model
Let me re-formulate this into something more familiar to me. The ARIMA is an analog to PID approximation. I is integral. MA is P. the AR can be expressed as difference equations which are the D te
Incremental learning for LOESS time series model Let me re-formulate this into something more familiar to me. The ARIMA is an analog to PID approximation. I is integral. MA is P. the AR can be expressed as difference equations which are the D term. LOESS is an analog to least squares fitting (high-tech big brother really). So if I wanted to improve a second order model (PID) what could be done? First, I could use a Kalman Filter to update the model with a single piece of new information. I could also look at something called "gradient boosted trees". Using an analog of them, I would make a second ARIMA model whose inputs are both the raw inputs fed to the first, augmented with the errors of the first. I would consider looking at the PDF of the errors for multiple modes. If I could cluster the errors then I might want to split models, or use a Mixture model to separate the inputs into sub-models. The submodels might be better at handling the local phenomenology better than a single large-scale model. One of the questions that I have failed to ask is "what does performance mean?". If we do not have a clearly stated measure of goodness then there is no way to tell if a candidate method "improves". It seems like you want better modeling, shorter compute time, and more efficient use of information. Having ephemeris about the actual data can also inform this. If you are modeling wind, then you can know where to look for augmenting models, or find transformations for your data that are useful.
Incremental learning for LOESS time series model Let me re-formulate this into something more familiar to me. The ARIMA is an analog to PID approximation. I is integral. MA is P. the AR can be expressed as difference equations which are the D te
33,162
Incremental learning for LOESS time series model
This is a different question depending on whether you are using a loess or an ARIMA model. I will answer just the loess question for now, as I suspect there are little efficiencies possible in the ARIMA case other than perhaps having a good set of starting values. A loess model works by fitting a weighted regression to different subsets of the data. Only a proportion of the data is used for each fit. So each time you refit the model having dropped off one data point at one end and added another at the opposite end, you technically only need to fit the local regressions that use the first and last point. All the local regressions in-between will be the same. Exactly how many of these un-impacted local regressions there are will depend on your smoothing parameter in the loess. You could hack whatever package you are using to fit your model so that it can take most of the local regressions from a previous fit, and only fit those that are needed at the beginning and end of the data. However, it would seem to me this was only worth doing if the cost in extra programming time was materially less than the cost in computer time of just fitting the model from scratch each 15 minutes. With only 1000 data points surely it's not such a big thing to fit the model from scratch each time.
Incremental learning for LOESS time series model
This is a different question depending on whether you are using a loess or an ARIMA model. I will answer just the loess question for now, as I suspect there are little efficiencies possible in the AR
Incremental learning for LOESS time series model This is a different question depending on whether you are using a loess or an ARIMA model. I will answer just the loess question for now, as I suspect there are little efficiencies possible in the ARIMA case other than perhaps having a good set of starting values. A loess model works by fitting a weighted regression to different subsets of the data. Only a proportion of the data is used for each fit. So each time you refit the model having dropped off one data point at one end and added another at the opposite end, you technically only need to fit the local regressions that use the first and last point. All the local regressions in-between will be the same. Exactly how many of these un-impacted local regressions there are will depend on your smoothing parameter in the loess. You could hack whatever package you are using to fit your model so that it can take most of the local regressions from a previous fit, and only fit those that are needed at the beginning and end of the data. However, it would seem to me this was only worth doing if the cost in extra programming time was materially less than the cost in computer time of just fitting the model from scratch each 15 minutes. With only 1000 data points surely it's not such a big thing to fit the model from scratch each time.
Incremental learning for LOESS time series model This is a different question depending on whether you are using a loess or an ARIMA model. I will answer just the loess question for now, as I suspect there are little efficiencies possible in the AR
33,163
Hinge loss with one-vs-all classifier
Your post seems to be mostly correct. The way that multiclass linear classifiers are set up is that an example, $x$, is classified by the hyperplane that give the highest score: $\underset{k}{\mathrm{argmax}\,} w_k \cdot x$. It doesn't matter if these scores are positive or negative. If the hinge loss for a particular example is zero, then this means that the example is correctly classified. To see this, the hinge loss will be zero when $1+w_{k}\cdot x_i<w_{y_i}\cdot x_i \;\forall k$. This is a stronger condition than $w_{k}\cdot x_i<w_{y_i}\cdot x_i \;\forall k$, which would indicate that example $i$ was correctly classified as $y_i$. The 1 in the hinge loss is related to the "margin" of the classifier. The hinge loss encourages scores from the correct class, $w_{y_i}\cdot x_i$ to not only be higher that scores from all the other classes, $w_k\cdot x_i$, but to be higher than these scores by an additive factor. We can use the value 1 for the margin because the distance of a point from a hyperplane is scaled by the magnitude of the linear weights: $\frac{w}{|w|}\cdot x$ is the distance of $x$ from the hyperplane with normal vector $w$. Since the weights are the same for all points in the dataset, it only matters that the scaling factor—1—is the same for all data points. Also, it may make things easier to understand if you parameterize the loss function as $L(x,y;w)$. You currently have the loss functions as a function of the linear margin, and this is not necessarily the case.
Hinge loss with one-vs-all classifier
Your post seems to be mostly correct. The way that multiclass linear classifiers are set up is that an example, $x$, is classified by the hyperplane that give the highest score: $\underset{k}{\mathrm{
Hinge loss with one-vs-all classifier Your post seems to be mostly correct. The way that multiclass linear classifiers are set up is that an example, $x$, is classified by the hyperplane that give the highest score: $\underset{k}{\mathrm{argmax}\,} w_k \cdot x$. It doesn't matter if these scores are positive or negative. If the hinge loss for a particular example is zero, then this means that the example is correctly classified. To see this, the hinge loss will be zero when $1+w_{k}\cdot x_i<w_{y_i}\cdot x_i \;\forall k$. This is a stronger condition than $w_{k}\cdot x_i<w_{y_i}\cdot x_i \;\forall k$, which would indicate that example $i$ was correctly classified as $y_i$. The 1 in the hinge loss is related to the "margin" of the classifier. The hinge loss encourages scores from the correct class, $w_{y_i}\cdot x_i$ to not only be higher that scores from all the other classes, $w_k\cdot x_i$, but to be higher than these scores by an additive factor. We can use the value 1 for the margin because the distance of a point from a hyperplane is scaled by the magnitude of the linear weights: $\frac{w}{|w|}\cdot x$ is the distance of $x$ from the hyperplane with normal vector $w$. Since the weights are the same for all points in the dataset, it only matters that the scaling factor—1—is the same for all data points. Also, it may make things easier to understand if you parameterize the loss function as $L(x,y;w)$. You currently have the loss functions as a function of the linear margin, and this is not necessarily the case.
Hinge loss with one-vs-all classifier Your post seems to be mostly correct. The way that multiclass linear classifiers are set up is that an example, $x$, is classified by the hyperplane that give the highest score: $\underset{k}{\mathrm{
33,164
Hinge loss with one-vs-all classifier
You are missing the binary outcome/label (that can take value of +1 and -1 for a given class) in the loss function: max(0, 1 - y*(w*x)) (see details below). Overall, I think the specification above (both the notation and the loss function) over-complicates one-vs-all - instead one could just take a particular class, construct +1/-1 outcome y as well as the corresponding data matrix X (with Nf columns and Ni rows) and parameter vector w for that class, and write the corresponding hinge loss function for a classical binary classifier for that class: sum(max(0, 1 - y*(w*x))) where the sum is over all data instances, x is a row of X that corresponds to a particular instance. One does need "1" in the hinge loss function (since y*(w*x) >= 1 corresponds to the correct model prediction as far as the loss function is concerned).
Hinge loss with one-vs-all classifier
You are missing the binary outcome/label (that can take value of +1 and -1 for a given class) in the loss function: max(0, 1 - y*(w*x)) (see details below). Overall, I think the specification above (b
Hinge loss with one-vs-all classifier You are missing the binary outcome/label (that can take value of +1 and -1 for a given class) in the loss function: max(0, 1 - y*(w*x)) (see details below). Overall, I think the specification above (both the notation and the loss function) over-complicates one-vs-all - instead one could just take a particular class, construct +1/-1 outcome y as well as the corresponding data matrix X (with Nf columns and Ni rows) and parameter vector w for that class, and write the corresponding hinge loss function for a classical binary classifier for that class: sum(max(0, 1 - y*(w*x))) where the sum is over all data instances, x is a row of X that corresponds to a particular instance. One does need "1" in the hinge loss function (since y*(w*x) >= 1 corresponds to the correct model prediction as far as the loss function is concerned).
Hinge loss with one-vs-all classifier You are missing the binary outcome/label (that can take value of +1 and -1 for a given class) in the loss function: max(0, 1 - y*(w*x)) (see details below). Overall, I think the specification above (b
33,165
Dynamic calculation of number of samples required to estimate the mean
You need to search for 'Bayesian adaptive designs'. The basic idea is as follows: You initialize the prior for the parameters of interest. Before any data collection your priors would be diffuse. As additional data comes in you re-set the prior to be the posterior that corresponds to the 'prior + data till that point in time'. Collect data. Compute the posterior based on data + priors. The posterior is then used as the prior in step 1 if you actually collect additional data. Assess whether your stopping criteria are met Stopping criteria could include something like the 95% credible interval should not be bigger than $\pm \epsilon$ units for the parameters of interest. You could also have more formal loss functions associated with the parameters of interest and compute expected loss with respect to the posterior distribution for the parameter of interest. You then repeat steps 1, 2 and 3 till your stopping criteria from step 4 are met.
Dynamic calculation of number of samples required to estimate the mean
You need to search for 'Bayesian adaptive designs'. The basic idea is as follows: You initialize the prior for the parameters of interest. Before any data collection your priors would be diffuse. As
Dynamic calculation of number of samples required to estimate the mean You need to search for 'Bayesian adaptive designs'. The basic idea is as follows: You initialize the prior for the parameters of interest. Before any data collection your priors would be diffuse. As additional data comes in you re-set the prior to be the posterior that corresponds to the 'prior + data till that point in time'. Collect data. Compute the posterior based on data + priors. The posterior is then used as the prior in step 1 if you actually collect additional data. Assess whether your stopping criteria are met Stopping criteria could include something like the 95% credible interval should not be bigger than $\pm \epsilon$ units for the parameters of interest. You could also have more formal loss functions associated with the parameters of interest and compute expected loss with respect to the posterior distribution for the parameter of interest. You then repeat steps 1, 2 and 3 till your stopping criteria from step 4 are met.
Dynamic calculation of number of samples required to estimate the mean You need to search for 'Bayesian adaptive designs'. The basic idea is as follows: You initialize the prior for the parameters of interest. Before any data collection your priors would be diffuse. As
33,166
Dynamic calculation of number of samples required to estimate the mean
You would normally want at least 30 to invoke central limit theorem (though this is somewhat arbitrary). Unlike in the case with polls etc, which are modelled using the binomial distribution, you can not determine a sample size beforehand which guarantees a level of accuracy with a Gaussian process - it depends on what residuals you get which determine the standard error. It should be noted that if you have a robust sampling strategy, you can get much more accurate results than with a much larger sample size with a poor strategy.
Dynamic calculation of number of samples required to estimate the mean
You would normally want at least 30 to invoke central limit theorem (though this is somewhat arbitrary). Unlike in the case with polls etc, which are modelled using the binomial distribution, you can
Dynamic calculation of number of samples required to estimate the mean You would normally want at least 30 to invoke central limit theorem (though this is somewhat arbitrary). Unlike in the case with polls etc, which are modelled using the binomial distribution, you can not determine a sample size beforehand which guarantees a level of accuracy with a Gaussian process - it depends on what residuals you get which determine the standard error. It should be noted that if you have a robust sampling strategy, you can get much more accurate results than with a much larger sample size with a poor strategy.
Dynamic calculation of number of samples required to estimate the mean You would normally want at least 30 to invoke central limit theorem (though this is somewhat arbitrary). Unlike in the case with polls etc, which are modelled using the binomial distribution, you can
33,167
Can someone explain the C-Index in the context of hierarchical clustering?
This may be one of the cases where there's more art than science to clustering. I would suggest that you let your clustering algorithm run for a short time before letting the C-Index calculations kick in. "Short time" may be after processing a few pairs, just when it starts to exceed 0, or some other heuristic. (After all you don't expect to stop at 1 or 2 clusters, otherwise a different separation algorithm may have been deployed.) For a book recommendation, I can suggest: Cluster Analysis by Brian Everitt, Sabine Landau, Morven Leese You can scan/search the available contents on google books to see if it might meet your needs. It's worked as a reference for me in the past.
Can someone explain the C-Index in the context of hierarchical clustering?
This may be one of the cases where there's more art than science to clustering. I would suggest that you let your clustering algorithm run for a short time before letting the C-Index calculations kic
Can someone explain the C-Index in the context of hierarchical clustering? This may be one of the cases where there's more art than science to clustering. I would suggest that you let your clustering algorithm run for a short time before letting the C-Index calculations kick in. "Short time" may be after processing a few pairs, just when it starts to exceed 0, or some other heuristic. (After all you don't expect to stop at 1 or 2 clusters, otherwise a different separation algorithm may have been deployed.) For a book recommendation, I can suggest: Cluster Analysis by Brian Everitt, Sabine Landau, Morven Leese You can scan/search the available contents on google books to see if it might meet your needs. It's worked as a reference for me in the past.
Can someone explain the C-Index in the context of hierarchical clustering? This may be one of the cases where there's more art than science to clustering. I would suggest that you let your clustering algorithm run for a short time before letting the C-Index calculations kic
33,168
Asymptotic bias of LASSO vs. none of SCAD
If you are increasing the length of the vectors, then LASSO is asymptotic unbiased because the regularisation intensity $\lambda$ decreases as the sample increases. Intuitively: You can get effectively the same asymptotic behaviour by keeping the same size of the vector length, but reduce instead the magnitude of the noise term eps. As the sample size increases the means of the validation sets get closer to the true values, and the cross validation procedure should make the LASSO a consistent estimator (get the error as small as you like by adding more data) which implies that it is also asymptotic unbiased. Possibly the bias in your example is because the glmnet algorithm has a limit for the $\lambda$. It performs in a range from $10^{-4}\lambda^\star$ to $\lambda^\star$ where $\lambda^\star$ is the smallest value for which all coefficients are non-zero.
Asymptotic bias of LASSO vs. none of SCAD
If you are increasing the length of the vectors, then LASSO is asymptotic unbiased because the regularisation intensity $\lambda$ decreases as the sample increases. Intuitively: You can get effectivel
Asymptotic bias of LASSO vs. none of SCAD If you are increasing the length of the vectors, then LASSO is asymptotic unbiased because the regularisation intensity $\lambda$ decreases as the sample increases. Intuitively: You can get effectively the same asymptotic behaviour by keeping the same size of the vector length, but reduce instead the magnitude of the noise term eps. As the sample size increases the means of the validation sets get closer to the true values, and the cross validation procedure should make the LASSO a consistent estimator (get the error as small as you like by adding more data) which implies that it is also asymptotic unbiased. Possibly the bias in your example is because the glmnet algorithm has a limit for the $\lambda$. It performs in a range from $10^{-4}\lambda^\star$ to $\lambda^\star$ where $\lambda^\star$ is the smallest value for which all coefficients are non-zero.
Asymptotic bias of LASSO vs. none of SCAD If you are increasing the length of the vectors, then LASSO is asymptotic unbiased because the regularisation intensity $\lambda$ decreases as the sample increases. Intuitively: You can get effectivel
33,169
Asymptotic bias of LASSO vs. none of SCAD
In my understanding, LASSO is asymptotically biased given fixed regularization intensity λ. However, realistically λ would not be kept fixed as the sample size grows but would rather be reduced ... reducing the bias accordingly. Taking this to the limit, it appears LASSO would not be asymptotically biased. I believe you're misunderstanding what "fixed regularization intensity" is and what impact it has. Lasso is biased because it penalizes all model coefficients with the same intensity. A large coefficient and a small coefficient are shrunk at the same rate. This biases estimates of large coefficients which should remain in the model. Under specific conditions, the bias of large coefficients is $\lambda$ (slide 2). Variable selection methods which shrink large coefficients more slowly than small coefficients avoid this problem and may produce unbiased estimates. SCAD is one example. Adaptive Lasso is another.
Asymptotic bias of LASSO vs. none of SCAD
In my understanding, LASSO is asymptotically biased given fixed regularization intensity λ. However, realistically λ would not be kept fixed as the sample size grows but would rather be reduced ... re
Asymptotic bias of LASSO vs. none of SCAD In my understanding, LASSO is asymptotically biased given fixed regularization intensity λ. However, realistically λ would not be kept fixed as the sample size grows but would rather be reduced ... reducing the bias accordingly. Taking this to the limit, it appears LASSO would not be asymptotically biased. I believe you're misunderstanding what "fixed regularization intensity" is and what impact it has. Lasso is biased because it penalizes all model coefficients with the same intensity. A large coefficient and a small coefficient are shrunk at the same rate. This biases estimates of large coefficients which should remain in the model. Under specific conditions, the bias of large coefficients is $\lambda$ (slide 2). Variable selection methods which shrink large coefficients more slowly than small coefficients avoid this problem and may produce unbiased estimates. SCAD is one example. Adaptive Lasso is another.
Asymptotic bias of LASSO vs. none of SCAD In my understanding, LASSO is asymptotically biased given fixed regularization intensity λ. However, realistically λ would not be kept fixed as the sample size grows but would rather be reduced ... re
33,170
Asymptotic bias of LASSO vs. none of SCAD
Some literature describes the unbiased nature of SCAD as "nearly unbiased" or "approximately unbiased." However, there is a difference between asymptotic unbiasedness and unbiasedness. The unbiasedness is the small-sample property of OLS estimation, while the asymptotic unbiasedness is the large-sample property of OLS estimation, that is, when the sample size $N$ tends to infinity, the parameter estimator tends to the population value. In fact, as sample size $N$ tends to infinity, the parameter estimates of both LASSO and SCAD satisfy asymptotic unbiasedness according to your simulation codes. So maybe it is more accurate to say that SCAD is estimated to be unbiased when the estimated coefficient is large than $\gamma\lambda$.
Asymptotic bias of LASSO vs. none of SCAD
Some literature describes the unbiased nature of SCAD as "nearly unbiased" or "approximately unbiased." However, there is a difference between asymptotic unbiasedness and unbiasedness. The unbiasednes
Asymptotic bias of LASSO vs. none of SCAD Some literature describes the unbiased nature of SCAD as "nearly unbiased" or "approximately unbiased." However, there is a difference between asymptotic unbiasedness and unbiasedness. The unbiasedness is the small-sample property of OLS estimation, while the asymptotic unbiasedness is the large-sample property of OLS estimation, that is, when the sample size $N$ tends to infinity, the parameter estimator tends to the population value. In fact, as sample size $N$ tends to infinity, the parameter estimates of both LASSO and SCAD satisfy asymptotic unbiasedness according to your simulation codes. So maybe it is more accurate to say that SCAD is estimated to be unbiased when the estimated coefficient is large than $\gamma\lambda$.
Asymptotic bias of LASSO vs. none of SCAD Some literature describes the unbiased nature of SCAD as "nearly unbiased" or "approximately unbiased." However, there is a difference between asymptotic unbiasedness and unbiasedness. The unbiasednes
33,171
Why not use PCA in every linear regression setting to avoid multicollinearity?
This is probably a comment rather than an answer and I'm not sure I'm getting it right. Let's try to compare the output of a linear model on two nearly colinear variables before and after PCA: set.seed(1234) x1 <- 1:10 x2 <- x1 + rnorm(n= length(x1), sd= 0.0001) # x2 is nearly colinear to x1 y <- rowMeans(cbind(x1, x2)) + rnorm(n= length(x1)) # A response variable Linear regression on raw data: summary(lm(y ~ x1 + x2)) ... Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.9351 0.7503 -1.246 0.253 x1 1428.6673 3681.8475 0.388 0.710 x2 -1427.5288 3681.8604 -0.388 0.710 Residual standard error: 1.094 on 7 degrees of freedom Multiple R-squared: 0.9281, Adjusted R-squared: 0.9076 F-statistic: 45.18 on 2 and 7 DF, p-value: 9.963e-05 Now on the principal components: pca <- prcomp(cbind(x1, x2)) pca_lm <- lm(y ~ pca$x[,1] + pca$x[,2]) summary(pca_lm) ... Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.382e+00 3.458e-01 15.562 1.09e-06 *** pca$x[, 1] 8.086e-01 8.514e-02 9.498 3.00e-05 *** pca$x[, 2] 2.020e+03 5.207e+03 0.388 0.71 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.094 on 7 degrees of freedom Multiple R-squared: 0.9281, Adjusted R-squared: 0.9076 F-statistic: 45.18 on 2 and 7 DF, p-value: 9.963e-05 Looking at adjusted R-squared, the quality of the two models is the same - as expected. Project the coefficients from model with principal components to the original scale (am I doing this right?) (pca_lm$coefficients[1] + pca_lm$coefficients[2:3]) %*% pca$rotation PC1 PC2 [1,] 1436.278 -1427.529 These are similar to the coefficients from the model on raw variables. So, in summary, there is no advantage in passing by principal components.
Why not use PCA in every linear regression setting to avoid multicollinearity?
This is probably a comment rather than an answer and I'm not sure I'm getting it right. Let's try to compare the output of a linear model on two nearly colinear variables before and after PCA: set.see
Why not use PCA in every linear regression setting to avoid multicollinearity? This is probably a comment rather than an answer and I'm not sure I'm getting it right. Let's try to compare the output of a linear model on two nearly colinear variables before and after PCA: set.seed(1234) x1 <- 1:10 x2 <- x1 + rnorm(n= length(x1), sd= 0.0001) # x2 is nearly colinear to x1 y <- rowMeans(cbind(x1, x2)) + rnorm(n= length(x1)) # A response variable Linear regression on raw data: summary(lm(y ~ x1 + x2)) ... Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.9351 0.7503 -1.246 0.253 x1 1428.6673 3681.8475 0.388 0.710 x2 -1427.5288 3681.8604 -0.388 0.710 Residual standard error: 1.094 on 7 degrees of freedom Multiple R-squared: 0.9281, Adjusted R-squared: 0.9076 F-statistic: 45.18 on 2 and 7 DF, p-value: 9.963e-05 Now on the principal components: pca <- prcomp(cbind(x1, x2)) pca_lm <- lm(y ~ pca$x[,1] + pca$x[,2]) summary(pca_lm) ... Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.382e+00 3.458e-01 15.562 1.09e-06 *** pca$x[, 1] 8.086e-01 8.514e-02 9.498 3.00e-05 *** pca$x[, 2] 2.020e+03 5.207e+03 0.388 0.71 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.094 on 7 degrees of freedom Multiple R-squared: 0.9281, Adjusted R-squared: 0.9076 F-statistic: 45.18 on 2 and 7 DF, p-value: 9.963e-05 Looking at adjusted R-squared, the quality of the two models is the same - as expected. Project the coefficients from model with principal components to the original scale (am I doing this right?) (pca_lm$coefficients[1] + pca_lm$coefficients[2:3]) %*% pca$rotation PC1 PC2 [1,] 1436.278 -1427.529 These are similar to the coefficients from the model on raw variables. So, in summary, there is no advantage in passing by principal components.
Why not use PCA in every linear regression setting to avoid multicollinearity? This is probably a comment rather than an answer and I'm not sure I'm getting it right. Let's try to compare the output of a linear model on two nearly colinear variables before and after PCA: set.see
33,172
What does the term episode mean in meta-learning?
Meta-learning conducts a meta analysis: it looks at multiple analyses (which in turn used different assumptions, datasets, and methods) and tries to explain these with some generalization or perhaps even a meta-model. This general idea has long been used by academics to try to generalize and learn about a complicated topic. In this setup, an episode would be one of the analyses plus its associated dataset and methods. Meta-learning in the machine learning community takes many datasets, methods, assumptions, and results and then builds a model to explain all of those results. Early work like Omohundro (1996) looked at episodes as samples drawn from one larger dataset with each sampled modeled. Vilalta and Drissi (2002) (in a survey of meta-learning) noted that assumptions (aka "bias") are also part of an analysis. The resulting models were then averaged or combined in some manner yielding a meta-model. More recent work like this paper by Sun et al (2017) uses a generalization of that in combining results for completely different datasets, assumptions, and models. An excellent recent survey is given by Hospedales, Antoniou, Micaelli, and Storkey (2020). From these, we can see that an episode is a tuple of (dataset, method(s), assumptions, estimated model/results) which then becomes an observation in the meta-analysis.
What does the term episode mean in meta-learning?
Meta-learning conducts a meta analysis: it looks at multiple analyses (which in turn used different assumptions, datasets, and methods) and tries to explain these with some generalization or perhaps e
What does the term episode mean in meta-learning? Meta-learning conducts a meta analysis: it looks at multiple analyses (which in turn used different assumptions, datasets, and methods) and tries to explain these with some generalization or perhaps even a meta-model. This general idea has long been used by academics to try to generalize and learn about a complicated topic. In this setup, an episode would be one of the analyses plus its associated dataset and methods. Meta-learning in the machine learning community takes many datasets, methods, assumptions, and results and then builds a model to explain all of those results. Early work like Omohundro (1996) looked at episodes as samples drawn from one larger dataset with each sampled modeled. Vilalta and Drissi (2002) (in a survey of meta-learning) noted that assumptions (aka "bias") are also part of an analysis. The resulting models were then averaged or combined in some manner yielding a meta-model. More recent work like this paper by Sun et al (2017) uses a generalization of that in combining results for completely different datasets, assumptions, and models. An excellent recent survey is given by Hospedales, Antoniou, Micaelli, and Storkey (2020). From these, we can see that an episode is a tuple of (dataset, method(s), assumptions, estimated model/results) which then becomes an observation in the meta-analysis.
What does the term episode mean in meta-learning? Meta-learning conducts a meta analysis: it looks at multiple analyses (which in turn used different assumptions, datasets, and methods) and tries to explain these with some generalization or perhaps e
33,173
What does the term episode mean in meta-learning?
In my opinion the right definition of an episode should be a batch of tasks (usually called a meta-batch). For regression if we have 100 $f_i$ from some family (e.g. sine functions) then 1 episode with a meta-batch size of size 16 should be 16 functions, each with a support set and a query set. For classification an episode is still a (meta) batch of tasks. In this case a task is a N-way K-shot classification task. e.g. 5-way, 5-shot would have 25 examples for the support set and if the Keval is 15 then 75 examples for the query set. In this case if we have meta-batch size of 16 then we sample 16 tasks, each with 25+75 examples. So a total of 16*100 examples for a meta-batch. In fact with this definition 1 episode is the same as an iteration step. When meta-batch size is 1 then a task is an episode. I can't imagine why we'd define an episode as a task, which I thought at some point. In that case we have the same word for task and episode. But an episode of learning happens fully during each iteration. Though, I'd prefer to not use this word at all since it seems redundant + RL already uses this term which adds to the confusion in my opinion.
What does the term episode mean in meta-learning?
In my opinion the right definition of an episode should be a batch of tasks (usually called a meta-batch). For regression if we have 100 $f_i$ from some family (e.g. sine functions) then 1 episode wit
What does the term episode mean in meta-learning? In my opinion the right definition of an episode should be a batch of tasks (usually called a meta-batch). For regression if we have 100 $f_i$ from some family (e.g. sine functions) then 1 episode with a meta-batch size of size 16 should be 16 functions, each with a support set and a query set. For classification an episode is still a (meta) batch of tasks. In this case a task is a N-way K-shot classification task. e.g. 5-way, 5-shot would have 25 examples for the support set and if the Keval is 15 then 75 examples for the query set. In this case if we have meta-batch size of 16 then we sample 16 tasks, each with 25+75 examples. So a total of 16*100 examples for a meta-batch. In fact with this definition 1 episode is the same as an iteration step. When meta-batch size is 1 then a task is an episode. I can't imagine why we'd define an episode as a task, which I thought at some point. In that case we have the same word for task and episode. But an episode of learning happens fully during each iteration. Though, I'd prefer to not use this word at all since it seems redundant + RL already uses this term which adds to the confusion in my opinion.
What does the term episode mean in meta-learning? In my opinion the right definition of an episode should be a batch of tasks (usually called a meta-batch). For regression if we have 100 $f_i$ from some family (e.g. sine functions) then 1 episode wit
33,174
The way PERMANOVA handling continuous explanatory variable
In my opinion, adonis2 does not treat continuous variables as categorical variables. If it does, df (degree of freedom) of a continuous variable would be the number of distinct values of the varilable minus one. But, df of continuous varialbes in adonis2 is always 1. According to a little bit similar question (posted on researchgate) that has an answer with an excerpt from an email written by J. Oksanen (a main author of package vegan), it is likely that adonis(2) performs simple linear regression when explanatory (grouping) variables are continuous. https://www.researchgate.net/post/How_ADONIS_is_calculated_for_continues_variable "Good question. I should probably change that definition. Variation explained is directly analogous to that of general linear models. With a continuous variable, it acts like simple linear regression, where each point is associated with its own "centroid" which is the best fit linear approximation." And, I think that this is the reason why df of continuous varialbes is always 1. According to a comment by J. Oksanen on a question posted at stackoverflow, "continuous variable in any (linear) model uses single df". https://stackoverflow.com/questions/53932311/why-do-i-always-get-1-for-df-when-running-adonis-function-permanova I don't have any ideas on your 2nd question.
The way PERMANOVA handling continuous explanatory variable
In my opinion, adonis2 does not treat continuous variables as categorical variables. If it does, df (degree of freedom) of a continuous variable would be the number of distinct values of the varilable
The way PERMANOVA handling continuous explanatory variable In my opinion, adonis2 does not treat continuous variables as categorical variables. If it does, df (degree of freedom) of a continuous variable would be the number of distinct values of the varilable minus one. But, df of continuous varialbes in adonis2 is always 1. According to a little bit similar question (posted on researchgate) that has an answer with an excerpt from an email written by J. Oksanen (a main author of package vegan), it is likely that adonis(2) performs simple linear regression when explanatory (grouping) variables are continuous. https://www.researchgate.net/post/How_ADONIS_is_calculated_for_continues_variable "Good question. I should probably change that definition. Variation explained is directly analogous to that of general linear models. With a continuous variable, it acts like simple linear regression, where each point is associated with its own "centroid" which is the best fit linear approximation." And, I think that this is the reason why df of continuous varialbes is always 1. According to a comment by J. Oksanen on a question posted at stackoverflow, "continuous variable in any (linear) model uses single df". https://stackoverflow.com/questions/53932311/why-do-i-always-get-1-for-df-when-running-adonis-function-permanova I don't have any ideas on your 2nd question.
The way PERMANOVA handling continuous explanatory variable In my opinion, adonis2 does not treat continuous variables as categorical variables. If it does, df (degree of freedom) of a continuous variable would be the number of distinct values of the varilable
33,175
Understanding equation used by Hastie et al
This answer is adapted from my comment above. Your understanding of the problem is correct in my opinion. You can interpret the equation as the mean squared error of the estimated coefficients of the $k$-th model compared to the true coefficients, i.e. how close the $k$-th model is from the true model in terms of coefficients estimates. As opposed to evaluating predictions, this metric will tell you how well you modelled the data-generating process.
Understanding equation used by Hastie et al
This answer is adapted from my comment above. Your understanding of the problem is correct in my opinion. You can interpret the equation as the mean squared error of the estimated coefficients of the
Understanding equation used by Hastie et al This answer is adapted from my comment above. Your understanding of the problem is correct in my opinion. You can interpret the equation as the mean squared error of the estimated coefficients of the $k$-th model compared to the true coefficients, i.e. how close the $k$-th model is from the true model in terms of coefficients estimates. As opposed to evaluating predictions, this metric will tell you how well you modelled the data-generating process.
Understanding equation used by Hastie et al This answer is adapted from my comment above. Your understanding of the problem is correct in my opinion. You can interpret the equation as the mean squared error of the estimated coefficients of the
33,176
What is the correct way to write the elastic net?
If you want to find the optimal β parameters, i.e. the ones that maximize the expression, then all three expressions are equivalent. Also, this is only the prior (or penalty) part of the elastic net expression. Obviously you need to add the linear regression part as well.
What is the correct way to write the elastic net?
If you want to find the optimal β parameters, i.e. the ones that maximize the expression, then all three expressions are equivalent. Also, this is only the prior (or penalty) part of the elastic n
What is the correct way to write the elastic net? If you want to find the optimal β parameters, i.e. the ones that maximize the expression, then all three expressions are equivalent. Also, this is only the prior (or penalty) part of the elastic net expression. Obviously you need to add the linear regression part as well.
What is the correct way to write the elastic net? If you want to find the optimal β parameters, i.e. the ones that maximize the expression, then all three expressions are equivalent. Also, this is only the prior (or penalty) part of the elastic n
33,177
Difference between extrapolation and interpolation in higher dimensions
You could define the convex hull spanning those points as the range. If the point you want to predict is outside of the convex hull, you would call it extrapolation. But what does it matter how it is called?
Difference between extrapolation and interpolation in higher dimensions
You could define the convex hull spanning those points as the range. If the point you want to predict is outside of the convex hull, you would call it extrapolation. But what does it matter how it is
Difference between extrapolation and interpolation in higher dimensions You could define the convex hull spanning those points as the range. If the point you want to predict is outside of the convex hull, you would call it extrapolation. But what does it matter how it is called?
Difference between extrapolation and interpolation in higher dimensions You could define the convex hull spanning those points as the range. If the point you want to predict is outside of the convex hull, you would call it extrapolation. But what does it matter how it is
33,178
Are there networks specialised on object detection for a single class of object?
I am currently doing a single class segmentation network to detect pixels in microscopy images. What I am doing is like one step more than what you need to do. Basically I am using FCN-8 to do pixel classification, but the first part of the model is a VGG16. I would look online for a generic Keras or other library VGG16 model, and retrain it on your dataset. This implies that you have a large enough dataset to train the model with and some time in front of you as they require a long training to be really accurate. One article that might be of help: https://alexisbcook.github.io/2017/global-average-pooling-layers-for-object-localization/
Are there networks specialised on object detection for a single class of object?
I am currently doing a single class segmentation network to detect pixels in microscopy images. What I am doing is like one step more than what you need to do. Basically I am using FCN-8 to do pixel
Are there networks specialised on object detection for a single class of object? I am currently doing a single class segmentation network to detect pixels in microscopy images. What I am doing is like one step more than what you need to do. Basically I am using FCN-8 to do pixel classification, but the first part of the model is a VGG16. I would look online for a generic Keras or other library VGG16 model, and retrain it on your dataset. This implies that you have a large enough dataset to train the model with and some time in front of you as they require a long training to be really accurate. One article that might be of help: https://alexisbcook.github.io/2017/global-average-pooling-layers-for-object-localization/
Are there networks specialised on object detection for a single class of object? I am currently doing a single class segmentation network to detect pixels in microscopy images. What I am doing is like one step more than what you need to do. Basically I am using FCN-8 to do pixel
33,179
Predicted R squared
You can do whatever you want, and if you define what you're calculating, you are on pretty solid ground. Anyone can reproduce your work or apply it in their own work and compare their results. However, the usual $R^2$ has a few nice interpretations that, ideally, I would like to maintain in a modified metric like your PRESS-based $R^2$. Proportion of variance explained A comparison of model performance to the performance of a baseline model that always predicts the mean For #1, there are issues once you move away from ordinary least squares. Linear models estimated by other methods (e.g., minimizing absolute loss, regularization) and out-of-sample testing with the OLS-fit model, and nonlinear models lack this interpretation. However, #2 can be applied to the PRESS-based $R^2$ statistic. You get the PRESS statistic by fitting a model to all but one observation and then testing it on that omitted observation. Then you do it again and again until you have omitted every observation exactly once. Do the same but fit an intercept-only model that always predicts the mean of the included points. Then do it again for another omitted point, then again and again until you have omitted every observation exactly once. Now you have the PRESS statistic for your model and the PRESS statistic of a baseline model that always guesses the mean of the training points. This seems to be exactly what you propose, so your metric would be a model comparison, just like the usual $R^2$. What people do or what software implements by default might not align with this, but I do believe this to be the right way of doing it in almost every case. This idea of comparing your model to a baseline model that always guesses the same value comes up elsewhere, such as McFadden's $R^2$.
Predicted R squared
You can do whatever you want, and if you define what you're calculating, you are on pretty solid ground. Anyone can reproduce your work or apply it in their own work and compare their results. However
Predicted R squared You can do whatever you want, and if you define what you're calculating, you are on pretty solid ground. Anyone can reproduce your work or apply it in their own work and compare their results. However, the usual $R^2$ has a few nice interpretations that, ideally, I would like to maintain in a modified metric like your PRESS-based $R^2$. Proportion of variance explained A comparison of model performance to the performance of a baseline model that always predicts the mean For #1, there are issues once you move away from ordinary least squares. Linear models estimated by other methods (e.g., minimizing absolute loss, regularization) and out-of-sample testing with the OLS-fit model, and nonlinear models lack this interpretation. However, #2 can be applied to the PRESS-based $R^2$ statistic. You get the PRESS statistic by fitting a model to all but one observation and then testing it on that omitted observation. Then you do it again and again until you have omitted every observation exactly once. Do the same but fit an intercept-only model that always predicts the mean of the included points. Then do it again for another omitted point, then again and again until you have omitted every observation exactly once. Now you have the PRESS statistic for your model and the PRESS statistic of a baseline model that always guesses the mean of the training points. This seems to be exactly what you propose, so your metric would be a model comparison, just like the usual $R^2$. What people do or what software implements by default might not align with this, but I do believe this to be the right way of doing it in almost every case. This idea of comparing your model to a baseline model that always guesses the same value comes up elsewhere, such as McFadden's $R^2$.
Predicted R squared You can do whatever you want, and if you define what you're calculating, you are on pretty solid ground. Anyone can reproduce your work or apply it in their own work and compare their results. However
33,180
Testing for symmetric distributions
If you only look at the counts of positive and negative values then you lose a ton of information, so your test will not be powerful. That also fails to test symmetry fully, since it cannot distinguish symmetric distributions from non-symmetric distributions with equal probabilities of positive and negative outcomes. Consequently your latter idea (for a two-sample Kolmogorov-Smirnov test comparing $\mathbf{s}$ and $-\mathbf{s}$) shows that you are thinking in the right direction. Whilst this is a good place to start, the specific test you are proposing has serious problems due to the fact that (a) it essentially "double-counts" the data; and (b) the two data vectors are not independent of each other. Below I will show that this leads to a non-uniform p-value under the null hypothesis. To do this, let's first program your proposed test in R. (I've added a few bells and whistles using the general methods set out here.) symmetry.test <- function(x, median = 0, exact = NULL, ...) { #Get data information DATA.NAME <- deparse(substitute(x)) xx <- x-median n <- length(x) #Implement KS test TEST <- ks.test(x = -xx, y = xx, alternative = 'two.sided', exact = exact, ...) TEST$method <- 'Symmetry test using KS test for magnitudes of sub-samples' TEST$alternative <- paste0('Sampling distribution is not symmetric around ', round(median, 4)) TEST$data.name <- paste0('Sample vector ', DATA.NAME, ' containing ', n, ' values') TEST } Now, let's try implementing this on a symmetric distribution (e.g., the standard normal distribution) and look at the resulting distribution of the p-value. I will do this by simulating $M=10^6$ random samples of size $n=100$ and computing the p-value of your test. As you can see from the histogram below, the p-value for the test is not uniform in this case. #Set parameters for simulation n <- 100 M <- 10^6 #Simulate p-values from the test (with symmetric distribution) set.seed(1) PVALS <- rep(0, M) for (i in 1:M) { DATA <- rnorm(100) TEST <- symmetry.test(DATA) PVALS[i] <- TEST$p.value } #Show histogram of p-values hist(PVALS, xlim = c(0,1), breaks = (0:100)/100, freq = FALSE, col = 'blue', main = 'Simulation of p-value from proposed test', xlab = 'p-value', ylab = 'Density') So, unfortunately your proposed test doesn't really work. If might be possible to salvage it my modifying the test somehow to take account of the deviations from standard assumptions. As a starting point, I'd suggest that it might be better to do a two-sample test comparing the vectors $\mathbf{s}_-$ and $\mathbf{s}_+$ defined by $s_i^- \equiv \max(0, -s_i)$ and $s_i^+ \equiv \max(0, s_i)$. That would ameliorate the problem of "double-counting" the data and it would greatly lessen the statistical dependence between the two vectors. Since these data vectors are "censored" you would need some non-parametric test that can handle censored data (the standard KS-test is not built for this case). If you were to develop the test in that direction, you might be able to build one that gives a uniform p-value for symmetric distributions. Of course, as a final observation, you could just use one of the standard symmetry tests in the statistical literature for the case where the median is unknown. That is the standard case of interest in the literature, and there are many existing tests that have been developed. There is a slight loss of power from failing to use the known median in your problem, but it should not make too much difference once you have a decent amount of data.
Testing for symmetric distributions
If you only look at the counts of positive and negative values then you lose a ton of information, so your test will not be powerful. That also fails to test symmetry fully, since it cannot distingui
Testing for symmetric distributions If you only look at the counts of positive and negative values then you lose a ton of information, so your test will not be powerful. That also fails to test symmetry fully, since it cannot distinguish symmetric distributions from non-symmetric distributions with equal probabilities of positive and negative outcomes. Consequently your latter idea (for a two-sample Kolmogorov-Smirnov test comparing $\mathbf{s}$ and $-\mathbf{s}$) shows that you are thinking in the right direction. Whilst this is a good place to start, the specific test you are proposing has serious problems due to the fact that (a) it essentially "double-counts" the data; and (b) the two data vectors are not independent of each other. Below I will show that this leads to a non-uniform p-value under the null hypothesis. To do this, let's first program your proposed test in R. (I've added a few bells and whistles using the general methods set out here.) symmetry.test <- function(x, median = 0, exact = NULL, ...) { #Get data information DATA.NAME <- deparse(substitute(x)) xx <- x-median n <- length(x) #Implement KS test TEST <- ks.test(x = -xx, y = xx, alternative = 'two.sided', exact = exact, ...) TEST$method <- 'Symmetry test using KS test for magnitudes of sub-samples' TEST$alternative <- paste0('Sampling distribution is not symmetric around ', round(median, 4)) TEST$data.name <- paste0('Sample vector ', DATA.NAME, ' containing ', n, ' values') TEST } Now, let's try implementing this on a symmetric distribution (e.g., the standard normal distribution) and look at the resulting distribution of the p-value. I will do this by simulating $M=10^6$ random samples of size $n=100$ and computing the p-value of your test. As you can see from the histogram below, the p-value for the test is not uniform in this case. #Set parameters for simulation n <- 100 M <- 10^6 #Simulate p-values from the test (with symmetric distribution) set.seed(1) PVALS <- rep(0, M) for (i in 1:M) { DATA <- rnorm(100) TEST <- symmetry.test(DATA) PVALS[i] <- TEST$p.value } #Show histogram of p-values hist(PVALS, xlim = c(0,1), breaks = (0:100)/100, freq = FALSE, col = 'blue', main = 'Simulation of p-value from proposed test', xlab = 'p-value', ylab = 'Density') So, unfortunately your proposed test doesn't really work. If might be possible to salvage it my modifying the test somehow to take account of the deviations from standard assumptions. As a starting point, I'd suggest that it might be better to do a two-sample test comparing the vectors $\mathbf{s}_-$ and $\mathbf{s}_+$ defined by $s_i^- \equiv \max(0, -s_i)$ and $s_i^+ \equiv \max(0, s_i)$. That would ameliorate the problem of "double-counting" the data and it would greatly lessen the statistical dependence between the two vectors. Since these data vectors are "censored" you would need some non-parametric test that can handle censored data (the standard KS-test is not built for this case). If you were to develop the test in that direction, you might be able to build one that gives a uniform p-value for symmetric distributions. Of course, as a final observation, you could just use one of the standard symmetry tests in the statistical literature for the case where the median is unknown. That is the standard case of interest in the literature, and there are many existing tests that have been developed. There is a slight loss of power from failing to use the known median in your problem, but it should not make too much difference once you have a decent amount of data.
Testing for symmetric distributions If you only look at the counts of positive and negative values then you lose a ton of information, so your test will not be powerful. That also fails to test symmetry fully, since it cannot distingui
33,181
Testing for symmetric distributions
Sort by increasing values, then by decreasing values, compute the correlation coefficient (always negative), add 1, and divide the result by 2. The final value is 0 if and only if the sample is symmetric. The maximal value is 1/2. No assumption about the value of the mean or the median is needed. There are tables of p-values for various sample sizes under the assumption of normality or of uniformity: https://arxiv.org/abs/2005.09960 (ref. to papers included). Hope it helps.
Testing for symmetric distributions
Sort by increasing values, then by decreasing values, compute the correlation coefficient (always negative), add 1, and divide the result by 2. The final value is 0 if and only if the sample is symmet
Testing for symmetric distributions Sort by increasing values, then by decreasing values, compute the correlation coefficient (always negative), add 1, and divide the result by 2. The final value is 0 if and only if the sample is symmetric. The maximal value is 1/2. No assumption about the value of the mean or the median is needed. There are tables of p-values for various sample sizes under the assumption of normality or of uniformity: https://arxiv.org/abs/2005.09960 (ref. to papers included). Hope it helps.
Testing for symmetric distributions Sort by increasing values, then by decreasing values, compute the correlation coefficient (always negative), add 1, and divide the result by 2. The final value is 0 if and only if the sample is symmet
33,182
Why use $L_2$ distance as reconstruction error for an autoencoder as opposed to $L_k$
Autoencoders can be considered in the framework of [Variational Autoencoders][1] (VAEs), which effectively generalise deterministic autoencoders, where: each data sample $x$ is mapped to a distribution $q(z|x)$ over latent space, rather than to a unique value of $z$ (as given by a deterministic encoder function) similarly, each latent representation $z$ is mapped to a distribution over the data space $p(x|z)$, e.g. a small Gaussian around a learned mean; the latent variables are fitted to a prior distribution $p(z)$ The point of considering VAEs is that they learn a proper latent variable model where terms of the loss function have a meaningful interpretation. The deterministic autoencoder can be seen as a special case of the VAE framework where: the variance of $q(z|x)$ is reduced towards 0, so that $q(z|x)$ in the limit tends/concentrates to a deterministic function of $x$; the mean square ($L_2$) loss (mentioned in the question) relates to the reconstruction term of the VAE loss function and is equivalent to assuming $p(x|z)$ is Gaussian whose mean is learned as a function of $z$; and the second (KL or regularisation) term of the VAE loss, including the prior over $z$, is dropped (so no assumed structure is imposed in the latent space). The distribution choice for $p(x|z)$ can be varied, which corresponds to different metrics in $x$-space (e.g. $L_1$ equivalent to Laplacian, etc).
Why use $L_2$ distance as reconstruction error for an autoencoder as opposed to $L_k$
Autoencoders can be considered in the framework of [Variational Autoencoders][1] (VAEs), which effectively generalise deterministic autoencoders, where: each data sample $x$ is mapped to a distributi
Why use $L_2$ distance as reconstruction error for an autoencoder as opposed to $L_k$ Autoencoders can be considered in the framework of [Variational Autoencoders][1] (VAEs), which effectively generalise deterministic autoencoders, where: each data sample $x$ is mapped to a distribution $q(z|x)$ over latent space, rather than to a unique value of $z$ (as given by a deterministic encoder function) similarly, each latent representation $z$ is mapped to a distribution over the data space $p(x|z)$, e.g. a small Gaussian around a learned mean; the latent variables are fitted to a prior distribution $p(z)$ The point of considering VAEs is that they learn a proper latent variable model where terms of the loss function have a meaningful interpretation. The deterministic autoencoder can be seen as a special case of the VAE framework where: the variance of $q(z|x)$ is reduced towards 0, so that $q(z|x)$ in the limit tends/concentrates to a deterministic function of $x$; the mean square ($L_2$) loss (mentioned in the question) relates to the reconstruction term of the VAE loss function and is equivalent to assuming $p(x|z)$ is Gaussian whose mean is learned as a function of $z$; and the second (KL or regularisation) term of the VAE loss, including the prior over $z$, is dropped (so no assumed structure is imposed in the latent space). The distribution choice for $p(x|z)$ can be varied, which corresponds to different metrics in $x$-space (e.g. $L_1$ equivalent to Laplacian, etc).
Why use $L_2$ distance as reconstruction error for an autoencoder as opposed to $L_k$ Autoencoders can be considered in the framework of [Variational Autoencoders][1] (VAEs), which effectively generalise deterministic autoencoders, where: each data sample $x$ is mapped to a distributi
33,183
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for every node?
The general idea is that both Bagging and Random Forests are methods for variance reduction. This means that they work well with estimators that have LOW BIAS and HIGH VARIANCE (estimators that overfit, to put it simply). Moreover, the averaging of the estimator works best if these are UNCORRELATED from each other. Decision trees are perfect for this job because, in particolar when fully grown, they can learn very complex interactions (therefore having low bias), but are very sensitive to the input data (high variance). Both sampling strategies have the goal of reducing the correlation between the trees, which reduces the variance of the averaged ensemble (I suggest Elements of Statistical Learning, Chap. 15 for clarifications). However, while sampling features at every node still allows the trees to see most variables (in different orders) and learn complex interactions, using a subsample for every tree greatly limits the amount of information that a single tree can learn. This means that trees grown in this fashion are going to be less deep, and with much higher bias, in particular for complex datasets. On the other hand, it is true that trees built this way will tend to be less correlated to each other, as they are often built on completely different subsets of features, but in most scenarios this will not overweight the increase in bias, therefore giving a worse performance on most use cases.
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for
The general idea is that both Bagging and Random Forests are methods for variance reduction. This means that they work well with estimators that have LOW BIAS and HIGH VARIANCE (estimators that overfi
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for every node? The general idea is that both Bagging and Random Forests are methods for variance reduction. This means that they work well with estimators that have LOW BIAS and HIGH VARIANCE (estimators that overfit, to put it simply). Moreover, the averaging of the estimator works best if these are UNCORRELATED from each other. Decision trees are perfect for this job because, in particolar when fully grown, they can learn very complex interactions (therefore having low bias), but are very sensitive to the input data (high variance). Both sampling strategies have the goal of reducing the correlation between the trees, which reduces the variance of the averaged ensemble (I suggest Elements of Statistical Learning, Chap. 15 for clarifications). However, while sampling features at every node still allows the trees to see most variables (in different orders) and learn complex interactions, using a subsample for every tree greatly limits the amount of information that a single tree can learn. This means that trees grown in this fashion are going to be less deep, and with much higher bias, in particular for complex datasets. On the other hand, it is true that trees built this way will tend to be less correlated to each other, as they are often built on completely different subsets of features, but in most scenarios this will not overweight the increase in bias, therefore giving a worse performance on most use cases.
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for The general idea is that both Bagging and Random Forests are methods for variance reduction. This means that they work well with estimators that have LOW BIAS and HIGH VARIANCE (estimators that overfi
33,184
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for every node?
In context of tidy data, one bootstraps on samples(rows) and one bootstraps on both samples(rows) and variables(columns). They, as far as I know, always bootstrap in rows. Here are the rules for "tidy" originally put forth by Hadley Wickham [1,2]: Each variable forms a column. Each observation forms a row. Each type of observational units forms a table. So the question becomes "what is the advantage of bootstrapping on columns". It gives you what bootstrapping always gives, but applied to the column space: robust characterization. when a column is important, and excluded, error is much larger and vis versa. This can add emphasis on giving higher weight to higher importance variables, and given that tree-weights are inverse to error, this can reduce the impact of less important variables. Accelerated compute: when you operate on less data, ceteris paribus, your algo runs faster. If you make each tree with 75% of the columns, then they construct faster. Update: A classic CART-model looks at the along edges of the hyper-rectangle to find the location where a binary split of the domain best improves the measure of goodness. This is the stump. It then repeats the process for every sub-parcel of the domain until stopping criteria is met. A CART-model is a weak learner. In a random forest, the parallel ensemble of CART-models, one is trying to aggregate weak learners to overcome their bias. Because there is more than one element required for an "ensemble" the ensemble can depart from classic CART and do things like bootstrap in row and column spaces. By column-wise bootstrapping, we are only looking at a subset of the axes for splitting. By row-wise bootstrapping, we are looking at a subset of points when evaluating the split metric. The value of the approach is data-dependent. Mileage varies, as always. There are, I have heard, some substantial compute-speedups to be found, but they only work if the whole column is treated as a single entity. I'm thinking about Gini importance or variance based trees. You can compute the score for the whole, and a subset, and then in O(1) get the score for the other subset. This doesn't work if you are bootstrapping on the rows(samples) but only on the columns(variables). So the trade-off made is that the rows are resampled once per tree and the columns are resampled at each split. This allows faster compute per tree, faster per split, and allows bootstrapping on both.
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for
In context of tidy data, one bootstraps on samples(rows) and one bootstraps on both samples(rows) and variables(columns). They, as far as I know, always bootstrap in rows. Here are the rules for "tid
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for every node? In context of tidy data, one bootstraps on samples(rows) and one bootstraps on both samples(rows) and variables(columns). They, as far as I know, always bootstrap in rows. Here are the rules for "tidy" originally put forth by Hadley Wickham [1,2]: Each variable forms a column. Each observation forms a row. Each type of observational units forms a table. So the question becomes "what is the advantage of bootstrapping on columns". It gives you what bootstrapping always gives, but applied to the column space: robust characterization. when a column is important, and excluded, error is much larger and vis versa. This can add emphasis on giving higher weight to higher importance variables, and given that tree-weights are inverse to error, this can reduce the impact of less important variables. Accelerated compute: when you operate on less data, ceteris paribus, your algo runs faster. If you make each tree with 75% of the columns, then they construct faster. Update: A classic CART-model looks at the along edges of the hyper-rectangle to find the location where a binary split of the domain best improves the measure of goodness. This is the stump. It then repeats the process for every sub-parcel of the domain until stopping criteria is met. A CART-model is a weak learner. In a random forest, the parallel ensemble of CART-models, one is trying to aggregate weak learners to overcome their bias. Because there is more than one element required for an "ensemble" the ensemble can depart from classic CART and do things like bootstrap in row and column spaces. By column-wise bootstrapping, we are only looking at a subset of the axes for splitting. By row-wise bootstrapping, we are looking at a subset of points when evaluating the split metric. The value of the approach is data-dependent. Mileage varies, as always. There are, I have heard, some substantial compute-speedups to be found, but they only work if the whole column is treated as a single entity. I'm thinking about Gini importance or variance based trees. You can compute the score for the whole, and a subset, and then in O(1) get the score for the other subset. This doesn't work if you are bootstrapping on the rows(samples) but only on the columns(variables). So the trade-off made is that the rows are resampled once per tree and the columns are resampled at each split. This allows faster compute per tree, faster per split, and allows bootstrapping on both.
Random forest: advantages/disadvantages of selecting randomly subset features for every tree vs for In context of tidy data, one bootstraps on samples(rows) and one bootstraps on both samples(rows) and variables(columns). They, as far as I know, always bootstrap in rows. Here are the rules for "tid
33,185
Evaluating an autoencoder: possible approaches?
PCA can be evaluated based on the variance of each principal component generated. Actually it measures the same thing as reconstruction error, but in a different way. Let's fix $k$ and put this more precisely $X$ - data matrix, $X'$ - best rank-$k$ approximation (rank-$k$ PCA). To calculate $X'$ you need to do SVD and then only take $k$ singular vectors with biggest singular values. Eckart-Young theorem then tells us that this $X'$ also minimizes Frobenius norm of $X-X'$. Frobenius norm is defined as $$\|X-X'\|_F = \sqrt{\sum_{n,m}(X_{n,m} - X'_{n,m})^2}$$ So $$\|X-X'\|_F^2 =\sum_{n,m}(X_{n,m} - X'_{n,m})^2 = \sum_{n}\|X_n - X'_n\|^2$$ The last expression is the reconstruction error. Back to evaluating PCA The above fragment just says that for fixed rank $k$ we know how to find reconstruction error. I think you mentioned the fact that you can also easily evaluate how the reconstruction changes when you vary the $k$. This is where evaluating autoencoder and PCA diverges: the latent variables of autoencoder aren't guaranteed to be orthogonal. That means you can't decompose reconstruction error as in the case of PCA. Also since the coding/decoding in autoencoders is nonlinear, you don't know how the variance in the latent space translates to variance in input space.
Evaluating an autoencoder: possible approaches?
PCA can be evaluated based on the variance of each principal component generated. Actually it measures the same thing as reconstruction error, but in a different way. Let's fix $k$ and put this more
Evaluating an autoencoder: possible approaches? PCA can be evaluated based on the variance of each principal component generated. Actually it measures the same thing as reconstruction error, but in a different way. Let's fix $k$ and put this more precisely $X$ - data matrix, $X'$ - best rank-$k$ approximation (rank-$k$ PCA). To calculate $X'$ you need to do SVD and then only take $k$ singular vectors with biggest singular values. Eckart-Young theorem then tells us that this $X'$ also minimizes Frobenius norm of $X-X'$. Frobenius norm is defined as $$\|X-X'\|_F = \sqrt{\sum_{n,m}(X_{n,m} - X'_{n,m})^2}$$ So $$\|X-X'\|_F^2 =\sum_{n,m}(X_{n,m} - X'_{n,m})^2 = \sum_{n}\|X_n - X'_n\|^2$$ The last expression is the reconstruction error. Back to evaluating PCA The above fragment just says that for fixed rank $k$ we know how to find reconstruction error. I think you mentioned the fact that you can also easily evaluate how the reconstruction changes when you vary the $k$. This is where evaluating autoencoder and PCA diverges: the latent variables of autoencoder aren't guaranteed to be orthogonal. That means you can't decompose reconstruction error as in the case of PCA. Also since the coding/decoding in autoencoders is nonlinear, you don't know how the variance in the latent space translates to variance in input space.
Evaluating an autoencoder: possible approaches? PCA can be evaluated based on the variance of each principal component generated. Actually it measures the same thing as reconstruction error, but in a different way. Let's fix $k$ and put this more
33,186
Evaluating an autoencoder: possible approaches?
Autoencoders are data-specific, which means that they will only be able to compress data similar to what they have been trained on. So, the usefulness of features that have been learned by hidden layers could be used for evaluating the efficacy of the method. For this reason, I think one way to evaluate an autoencoder efficacy in dimensionality reduction is cutting the output of the middle hidden layer and compare the accuracy/performance of your desired algorithm by this reduced data rather than using original data.
Evaluating an autoencoder: possible approaches?
Autoencoders are data-specific, which means that they will only be able to compress data similar to what they have been trained on. So, the usefulness of features that have been learned by hidden laye
Evaluating an autoencoder: possible approaches? Autoencoders are data-specific, which means that they will only be able to compress data similar to what they have been trained on. So, the usefulness of features that have been learned by hidden layers could be used for evaluating the efficacy of the method. For this reason, I think one way to evaluate an autoencoder efficacy in dimensionality reduction is cutting the output of the middle hidden layer and compare the accuracy/performance of your desired algorithm by this reduced data rather than using original data.
Evaluating an autoencoder: possible approaches? Autoencoders are data-specific, which means that they will only be able to compress data similar to what they have been trained on. So, the usefulness of features that have been learned by hidden laye
33,187
Evaluating an autoencoder: possible approaches?
AutoEncoders are essentially regression, so you could calculate the $R^2 = 1-\frac{SSE}{SST}$, where $SST=\sum_i (x_i-\bar x)^2$ and $SSE$ is the reconstruction loss (sum, not mean). This metric has an upper bound of 1 for perfect reconstruction but doesn't have a lower bound (as the network outputs can be worse than the mean, in case of bad "learning"). You could maybe (at your own risk) interpret a positive score as a percentage of variance explained by the model using $k$ latent variables. The difference in $R^2$ between the models with different dimensions could be associated with the % variance associated with this extra dimensions. But note that this depends on the network actually learning and reaching a good minima, which in NN with SGD is not guaranteed. Also, there's a question about the hidden dimensions before the final latent bottle-neck. So, a lot of assumptions and approximations, but could "kind-of" work. Here's a Colab notebook where I did some experiments on the MNIST data with some basic and shallow AE network. And here's the $R^2$ scores:
Evaluating an autoencoder: possible approaches?
AutoEncoders are essentially regression, so you could calculate the $R^2 = 1-\frac{SSE}{SST}$, where $SST=\sum_i (x_i-\bar x)^2$ and $SSE$ is the reconstruction loss (sum, not mean). This metric has a
Evaluating an autoencoder: possible approaches? AutoEncoders are essentially regression, so you could calculate the $R^2 = 1-\frac{SSE}{SST}$, where $SST=\sum_i (x_i-\bar x)^2$ and $SSE$ is the reconstruction loss (sum, not mean). This metric has an upper bound of 1 for perfect reconstruction but doesn't have a lower bound (as the network outputs can be worse than the mean, in case of bad "learning"). You could maybe (at your own risk) interpret a positive score as a percentage of variance explained by the model using $k$ latent variables. The difference in $R^2$ between the models with different dimensions could be associated with the % variance associated with this extra dimensions. But note that this depends on the network actually learning and reaching a good minima, which in NN with SGD is not guaranteed. Also, there's a question about the hidden dimensions before the final latent bottle-neck. So, a lot of assumptions and approximations, but could "kind-of" work. Here's a Colab notebook where I did some experiments on the MNIST data with some basic and shallow AE network. And here's the $R^2$ scores:
Evaluating an autoencoder: possible approaches? AutoEncoders are essentially regression, so you could calculate the $R^2 = 1-\frac{SSE}{SST}$, where $SST=\sum_i (x_i-\bar x)^2$ and $SSE$ is the reconstruction loss (sum, not mean). This metric has a
33,188
What is the utility/significance of PAC learnability and VC dimension?
I'm not sure if this answer addresses all of your questions above, but here's my shot at answering your main question as to why PAC-learnability is useful in ML: Let's say you have a hypothesis h that belongs to some hypotheses space H. You want to find out how many training examples you need for your hypothesis to learn to some minimal performance level. Sample complexity (number of training examples needed for a learner to learn to some minimal performance) is driven by PAC-learnability. Basically we want h to be approximately correct (the error goal such that the error probability (epsilon) is bounded: 0<= epsion <= 1/2) and we also want to be confident that h is going to be correct most of the time (the certainty goal such that certainty probability (delta) is at least within some specified range: 0<=delta<=1/2). We want all this in polynomial time. Of course, PAC-learnability is dependent on sample size and dimension. So you can use PAC-learnability to determine the number of examples you need for your hypotheses h to be probably approximately correct.
What is the utility/significance of PAC learnability and VC dimension?
I'm not sure if this answer addresses all of your questions above, but here's my shot at answering your main question as to why PAC-learnability is useful in ML: Let's say you have a hypothesis h that
What is the utility/significance of PAC learnability and VC dimension? I'm not sure if this answer addresses all of your questions above, but here's my shot at answering your main question as to why PAC-learnability is useful in ML: Let's say you have a hypothesis h that belongs to some hypotheses space H. You want to find out how many training examples you need for your hypothesis to learn to some minimal performance level. Sample complexity (number of training examples needed for a learner to learn to some minimal performance) is driven by PAC-learnability. Basically we want h to be approximately correct (the error goal such that the error probability (epsilon) is bounded: 0<= epsion <= 1/2) and we also want to be confident that h is going to be correct most of the time (the certainty goal such that certainty probability (delta) is at least within some specified range: 0<=delta<=1/2). We want all this in polynomial time. Of course, PAC-learnability is dependent on sample size and dimension. So you can use PAC-learnability to determine the number of examples you need for your hypotheses h to be probably approximately correct.
What is the utility/significance of PAC learnability and VC dimension? I'm not sure if this answer addresses all of your questions above, but here's my shot at answering your main question as to why PAC-learnability is useful in ML: Let's say you have a hypothesis h that
33,189
What is non-parametric structural equation modeling?
I have a feeling that you're looking for piecewise SEM, as I've heard it mentioned with reference to Pearl in the past. It is literally sequences of regressions, with some graph theory to tie things together. There are also distribution free estimators of typical SEM models though (though they don't really perform any better than ML with robust variance estimates). Ultimately, however, it does depend on interpretation. "Non-parametric SEM" isn't a widely use term, and different authors will use it differently. The presumed or implemented method, however, is very relevant to me. I'd like to know exactly how we can more or less model complex, high dimensional structural equations. Part of my barrier to understanding is that I don't understand, computationally, how SEMs are fit, except that (despite a common misinterpretation) they are not just sequences of regression models. Maximum likelihood! We construct a distribution function $f(X;\theta)$ for the data, and maximize it over $\theta$. In SEM, this is done jointly and automatically. However, it's useful to understand how this can be done from marginal/conditional distributions: Let's say that we have the variables $x$, $z$, $y$. We want to fit a mediation model to this data. Assuming normality, we construct the distributions as follows: $$ y_{\mid z,x} \sim \mathcal{N}(\alpha_y + \beta_0x + \beta_1z, \sigma_y^2) $$ $$ z_{\mid x} \sim \mathcal{N}(\alpha_z+ \beta_2x, \sigma_z^2) $$ $$ x \sim \mathcal{N}(\alpha_x,\sigma_x^2) $$ We then combine these into a single distribution, using the probability chain rule, yielding $f(y,z,x;\theta)$, where $\theta$ includes all the model parameters. This is our likelihood function, $L(\theta;data)$, and we simply (or not-so-simply) need to find the maximum of it. With SEM we add some assumptions so that we can actually identify the distribution (e.g. model is recursive, which means the opposite of what you would think it does), and specify all the relations at once as a matrix equation with a particular form. For instance, with a LISREL model: $$ \eta = B\eta + \Gamma\xi + \zeta $$ $$ y = \Lambda_y\eta + \epsilon $$ $$ x = \Lambda_x\xi + \delta $$ Or, in words: Latent DVs = (coefs * latent DVs) + (coefs * latent IVs) + error, Observed DVs = (coefs * latent DVs) + error, Observed IVs = (coefs * latent IVs) + error For some more detail on constructing these matrices, see this. Alternatively, this is slightly 'softer'. Modern software often constructs these matrices for you from some easier-to-read form such as lavaan or Mplus' syntax. We can also estimate the parameters, with the same equation setup, using alternative methods such as weighted least squares that don't obviously depend on a distribution. However, these methods don't actually tend to be any better than maximum likelihood if you use robust variances. Of the acceptable methods(s) what constitutes non-linear SEM? Non-linear SEM typically refers to SEM that contains latent interactions or polynomial effects. Such models can be considerably more difficult to estimate, and are not supported by most SEM programs (Mplus and OpenMX being the exceptions). Is it just a matter of interpretation as above? As mentioned previously, yes. Although it's also a matter of how the term is typically used, if such a precedent exists. Or do we need to use non-linear modeling with splines and penalties? No. What about robust covariance? ML with robust (co)variance estimates generally performs similarly (or even better than) "distribution-free" methods such as WLS. The idea behind it is that ML estimates are consistent even if your model is misspecified, provided that the object of inference in the misspecified model is the true object of interest. The problem isn't with the estimates, it's with the variances. The way that we typically estimate variances (simply inverting the information matrix) underestimates variances when the model is misspecified. To address this, we simply replace the variance estimates with a consistent variance estimator, such as those from bootstraping or a sandwich estimator.
What is non-parametric structural equation modeling?
I have a feeling that you're looking for piecewise SEM, as I've heard it mentioned with reference to Pearl in the past. It is literally sequences of regressions, with some graph theory to tie things
What is non-parametric structural equation modeling? I have a feeling that you're looking for piecewise SEM, as I've heard it mentioned with reference to Pearl in the past. It is literally sequences of regressions, with some graph theory to tie things together. There are also distribution free estimators of typical SEM models though (though they don't really perform any better than ML with robust variance estimates). Ultimately, however, it does depend on interpretation. "Non-parametric SEM" isn't a widely use term, and different authors will use it differently. The presumed or implemented method, however, is very relevant to me. I'd like to know exactly how we can more or less model complex, high dimensional structural equations. Part of my barrier to understanding is that I don't understand, computationally, how SEMs are fit, except that (despite a common misinterpretation) they are not just sequences of regression models. Maximum likelihood! We construct a distribution function $f(X;\theta)$ for the data, and maximize it over $\theta$. In SEM, this is done jointly and automatically. However, it's useful to understand how this can be done from marginal/conditional distributions: Let's say that we have the variables $x$, $z$, $y$. We want to fit a mediation model to this data. Assuming normality, we construct the distributions as follows: $$ y_{\mid z,x} \sim \mathcal{N}(\alpha_y + \beta_0x + \beta_1z, \sigma_y^2) $$ $$ z_{\mid x} \sim \mathcal{N}(\alpha_z+ \beta_2x, \sigma_z^2) $$ $$ x \sim \mathcal{N}(\alpha_x,\sigma_x^2) $$ We then combine these into a single distribution, using the probability chain rule, yielding $f(y,z,x;\theta)$, where $\theta$ includes all the model parameters. This is our likelihood function, $L(\theta;data)$, and we simply (or not-so-simply) need to find the maximum of it. With SEM we add some assumptions so that we can actually identify the distribution (e.g. model is recursive, which means the opposite of what you would think it does), and specify all the relations at once as a matrix equation with a particular form. For instance, with a LISREL model: $$ \eta = B\eta + \Gamma\xi + \zeta $$ $$ y = \Lambda_y\eta + \epsilon $$ $$ x = \Lambda_x\xi + \delta $$ Or, in words: Latent DVs = (coefs * latent DVs) + (coefs * latent IVs) + error, Observed DVs = (coefs * latent DVs) + error, Observed IVs = (coefs * latent IVs) + error For some more detail on constructing these matrices, see this. Alternatively, this is slightly 'softer'. Modern software often constructs these matrices for you from some easier-to-read form such as lavaan or Mplus' syntax. We can also estimate the parameters, with the same equation setup, using alternative methods such as weighted least squares that don't obviously depend on a distribution. However, these methods don't actually tend to be any better than maximum likelihood if you use robust variances. Of the acceptable methods(s) what constitutes non-linear SEM? Non-linear SEM typically refers to SEM that contains latent interactions or polynomial effects. Such models can be considerably more difficult to estimate, and are not supported by most SEM programs (Mplus and OpenMX being the exceptions). Is it just a matter of interpretation as above? As mentioned previously, yes. Although it's also a matter of how the term is typically used, if such a precedent exists. Or do we need to use non-linear modeling with splines and penalties? No. What about robust covariance? ML with robust (co)variance estimates generally performs similarly (or even better than) "distribution-free" methods such as WLS. The idea behind it is that ML estimates are consistent even if your model is misspecified, provided that the object of inference in the misspecified model is the true object of interest. The problem isn't with the estimates, it's with the variances. The way that we typically estimate variances (simply inverting the information matrix) underestimates variances when the model is misspecified. To address this, we simply replace the variance estimates with a consistent variance estimator, such as those from bootstraping or a sandwich estimator.
What is non-parametric structural equation modeling? I have a feeling that you're looking for piecewise SEM, as I've heard it mentioned with reference to Pearl in the past. It is literally sequences of regressions, with some graph theory to tie things
33,190
Multiple linear regression vs. Time Series
The most popular methods for time series forecasting are ARIMA and Holt-Winters. Holt-Winters is simpler and computationally less expensive. It is especially designed for seasonality. If you use ARIMA you must use seasonal ARIMA. Some studies show that, in real life data, Holt-Winters and seasonal ARIMA not only have a similar accuracy but predict similar values (http://webarchive.nationalarchives.gov.uk/20160105160709/http://www.ons.gov.uk/ons/guide-method/ukcemga/ukcemga-publications/publications/archive/from-holt-winters-to-arima-modelling--measuring-the-impact-on-forecasting-errors-for-components-of-quarterly-estimates-of-public-service-output.pdf). Your problem is multi-variate time series, not just $y(t)$ but $y(X,t)$. An idea is to try something like a linear regression with time varying coefficients. Think of a linear model without time : $y(X)=\beta X$ where $\beta$ is a vector. Then introduce time : $y(X,t)=\beta(t) X$. Then see $\beta(t)$ as a vector time series. But you can't observe $\beta(t)$. I have not read any article addressing this problem even though it is somehow a problem of growing importance : studying time and other parameters together. If at each time you have a lot of (y,X) samples covering well the possible values of X, then you could possibly estimate $\beta(t)$ at every time and then apply a time series method to this vector. But I guess you data is not like this. Added: The ultimate solution where you can really work on $\beta(t)$ as a hidden parameter is the Kalman filter. If $\beta(t)$ is just a random walk, then the state of Kalman filter is just $\beta(t)$ and this would be not so difficult to implement, using observations to update the filter. Next step would be to use an ARIMA or HW model inside the filter but this starts being hardcore maths. I don't know of anything like this packaged as an easy-to-use tool. You can read more about it: What are disadvantages of state-space models and Kalman Filter for time-series modelling?
Multiple linear regression vs. Time Series
The most popular methods for time series forecasting are ARIMA and Holt-Winters. Holt-Winters is simpler and computationally less expensive. It is especially designed for seasonality. If you use ARIMA
Multiple linear regression vs. Time Series The most popular methods for time series forecasting are ARIMA and Holt-Winters. Holt-Winters is simpler and computationally less expensive. It is especially designed for seasonality. If you use ARIMA you must use seasonal ARIMA. Some studies show that, in real life data, Holt-Winters and seasonal ARIMA not only have a similar accuracy but predict similar values (http://webarchive.nationalarchives.gov.uk/20160105160709/http://www.ons.gov.uk/ons/guide-method/ukcemga/ukcemga-publications/publications/archive/from-holt-winters-to-arima-modelling--measuring-the-impact-on-forecasting-errors-for-components-of-quarterly-estimates-of-public-service-output.pdf). Your problem is multi-variate time series, not just $y(t)$ but $y(X,t)$. An idea is to try something like a linear regression with time varying coefficients. Think of a linear model without time : $y(X)=\beta X$ where $\beta$ is a vector. Then introduce time : $y(X,t)=\beta(t) X$. Then see $\beta(t)$ as a vector time series. But you can't observe $\beta(t)$. I have not read any article addressing this problem even though it is somehow a problem of growing importance : studying time and other parameters together. If at each time you have a lot of (y,X) samples covering well the possible values of X, then you could possibly estimate $\beta(t)$ at every time and then apply a time series method to this vector. But I guess you data is not like this. Added: The ultimate solution where you can really work on $\beta(t)$ as a hidden parameter is the Kalman filter. If $\beta(t)$ is just a random walk, then the state of Kalman filter is just $\beta(t)$ and this would be not so difficult to implement, using observations to update the filter. Next step would be to use an ARIMA or HW model inside the filter but this starts being hardcore maths. I don't know of anything like this packaged as an easy-to-use tool. You can read more about it: What are disadvantages of state-space models and Kalman Filter for time-series modelling?
Multiple linear regression vs. Time Series The most popular methods for time series forecasting are ARIMA and Holt-Winters. Holt-Winters is simpler and computationally less expensive. It is especially designed for seasonality. If you use ARIMA
33,191
Multiple linear regression vs. Time Series
"Studying time and other parameters together" is the subject of Transfer Functions . See http://www.math.cts.nthu.edu.tw/download.php?filename=569_fe0ff1a2.pdf&dir=publish&title=Ruey+S.+Tsay-Lec1 AND Transfer function in forecasting models - interpretation AND https://onlinecourses.science.psu.edu/stat510/node/75 AND my comments in this discussion Autocorrelation and heteroskedasticity in time series data.... AND http://autobox.com/cms/images/dllupdate/TFFLOW.png for the steps in the analysis.
Multiple linear regression vs. Time Series
"Studying time and other parameters together" is the subject of Transfer Functions . See http://www.math.cts.nthu.edu.tw/download.php?filename=569_fe0ff1a2.pdf&dir=publish&title=Ruey+S.+Tsay-Lec1 AND
Multiple linear regression vs. Time Series "Studying time and other parameters together" is the subject of Transfer Functions . See http://www.math.cts.nthu.edu.tw/download.php?filename=569_fe0ff1a2.pdf&dir=publish&title=Ruey+S.+Tsay-Lec1 AND Transfer function in forecasting models - interpretation AND https://onlinecourses.science.psu.edu/stat510/node/75 AND my comments in this discussion Autocorrelation and heteroskedasticity in time series data.... AND http://autobox.com/cms/images/dllupdate/TFFLOW.png for the steps in the analysis.
Multiple linear regression vs. Time Series "Studying time and other parameters together" is the subject of Transfer Functions . See http://www.math.cts.nthu.edu.tw/download.php?filename=569_fe0ff1a2.pdf&dir=publish&title=Ruey+S.+Tsay-Lec1 AND
33,192
Understanding LSTM topology
Suppose I train the LSTM with all the data. Can I then run an arbitrary length input set through it? Abstractly, yes. However, some software implementations have hard rules about whether or not variables need to be a fixed size, or if they can be variable sizes, so in terms of programming, you'll have to check that you're implementing things correctly. So it seems like I would train a single LSTM cell, and then chain n of them together for a given input vector list of length n? No. Each cell processes all time-units. That's what makes them recurrent: the cell processes an input $x_t$ by updating the cell's memory state. The next time unit is a function of the previous memory state and the new input $x_{t+1}$.
Understanding LSTM topology
Suppose I train the LSTM with all the data. Can I then run an arbitrary length input set through it? Abstractly, yes. However, some software implementations have hard rules about whether or not varia
Understanding LSTM topology Suppose I train the LSTM with all the data. Can I then run an arbitrary length input set through it? Abstractly, yes. However, some software implementations have hard rules about whether or not variables need to be a fixed size, or if they can be variable sizes, so in terms of programming, you'll have to check that you're implementing things correctly. So it seems like I would train a single LSTM cell, and then chain n of them together for a given input vector list of length n? No. Each cell processes all time-units. That's what makes them recurrent: the cell processes an input $x_t$ by updating the cell's memory state. The next time unit is a function of the previous memory state and the new input $x_{t+1}$.
Understanding LSTM topology Suppose I train the LSTM with all the data. Can I then run an arbitrary length input set through it? Abstractly, yes. However, some software implementations have hard rules about whether or not varia
33,193
Gaussian Mixture Model - Model selection using the held-out likelihood?
Here you find a somehow related paper that can give you an insight. In it, the authors found that the BIC and held-out log-probability performed similarly to the held-out probability. However, the paper is related to latent pattern models, aka. Mixed membership models, in which they wanted to identify the optimal number of latent categories, K.
Gaussian Mixture Model - Model selection using the held-out likelihood?
Here you find a somehow related paper that can give you an insight. In it, the authors found that the BIC and held-out log-probability performed similarly to the held-out probability. However, the pap
Gaussian Mixture Model - Model selection using the held-out likelihood? Here you find a somehow related paper that can give you an insight. In it, the authors found that the BIC and held-out log-probability performed similarly to the held-out probability. However, the paper is related to latent pattern models, aka. Mixed membership models, in which they wanted to identify the optimal number of latent categories, K.
Gaussian Mixture Model - Model selection using the held-out likelihood? Here you find a somehow related paper that can give you an insight. In it, the authors found that the BIC and held-out log-probability performed similarly to the held-out probability. However, the pap
33,194
Gaussian Mixture Model - Model selection using the held-out likelihood?
I would say using hold-out data set likelihood is a good approach. For Mixture of Gaussians, the more Guassians we have, the better likelihood we can get. Just like the order in polynomial regression problem. AIC and BIC will penalize on number of parameters (Gaussians) used automatically, but using a separate testing set will also be a good choice. I will use an extreme example to explain, suppose we select number of Gaussian is as same as number of data points in your training set. Your training score will be really good (Infinite likelihood), but the testing score will not be so. Which is as same as other machine learning model selection process.
Gaussian Mixture Model - Model selection using the held-out likelihood?
I would say using hold-out data set likelihood is a good approach. For Mixture of Gaussians, the more Guassians we have, the better likelihood we can get. Just like the order in polynomial regression
Gaussian Mixture Model - Model selection using the held-out likelihood? I would say using hold-out data set likelihood is a good approach. For Mixture of Gaussians, the more Guassians we have, the better likelihood we can get. Just like the order in polynomial regression problem. AIC and BIC will penalize on number of parameters (Gaussians) used automatically, but using a separate testing set will also be a good choice. I will use an extreme example to explain, suppose we select number of Gaussian is as same as number of data points in your training set. Your training score will be really good (Infinite likelihood), but the testing score will not be so. Which is as same as other machine learning model selection process.
Gaussian Mixture Model - Model selection using the held-out likelihood? I would say using hold-out data set likelihood is a good approach. For Mixture of Gaussians, the more Guassians we have, the better likelihood we can get. Just like the order in polynomial regression
33,195
What are the steps to convert weighted sum of squares to matrix form?
I'll venture an answer to this question: Everything you've presented is correct. What you've basically derived is the Gauss-Markov theorem: the weighted least squares estimator is the best linear unbiased estimator for weighted data. This estimator minimizes the weighted sum-of-squares (your first display) and is given by: $\hat{\beta}_{WLS} = \left( \mathbf{X}^T\mathbf{W}\mathbf{X} \right) \left( \mathbf{X}^T \mathbf{W} Y \right)$. Here $\mathbf{X}$ is the design matrix with the first column set to $\mathbf{1}$ the $n \times 1$ vector of ones (this is the intercept term). This result applies to an arbitrary covariance matrix. However, weighted independent data are represented with a vector of weights along the diagonal of the weight matrix. (your notation has $w$ as the regression coefficient and $u$ as the weight, so to avoid confusion, the design matrix would be $\mathbf{X} = [x], \mathbf{W} = \text{diag}(u),$ and $\beta=[w]$. The proof of the Gauss Markov theorem is by contradiction. See here. What that means is that we don't analytically derive such an estimator directly from the loss function. You may have seen such an approach used with deriving linear and logistic regression estimating equations.
What are the steps to convert weighted sum of squares to matrix form?
I'll venture an answer to this question: Everything you've presented is correct. What you've basically derived is the Gauss-Markov theorem: the weighted least squares estimator is the best linear unbi
What are the steps to convert weighted sum of squares to matrix form? I'll venture an answer to this question: Everything you've presented is correct. What you've basically derived is the Gauss-Markov theorem: the weighted least squares estimator is the best linear unbiased estimator for weighted data. This estimator minimizes the weighted sum-of-squares (your first display) and is given by: $\hat{\beta}_{WLS} = \left( \mathbf{X}^T\mathbf{W}\mathbf{X} \right) \left( \mathbf{X}^T \mathbf{W} Y \right)$. Here $\mathbf{X}$ is the design matrix with the first column set to $\mathbf{1}$ the $n \times 1$ vector of ones (this is the intercept term). This result applies to an arbitrary covariance matrix. However, weighted independent data are represented with a vector of weights along the diagonal of the weight matrix. (your notation has $w$ as the regression coefficient and $u$ as the weight, so to avoid confusion, the design matrix would be $\mathbf{X} = [x], \mathbf{W} = \text{diag}(u),$ and $\beta=[w]$. The proof of the Gauss Markov theorem is by contradiction. See here. What that means is that we don't analytically derive such an estimator directly from the loss function. You may have seen such an approach used with deriving linear and logistic regression estimating equations.
What are the steps to convert weighted sum of squares to matrix form? I'll venture an answer to this question: Everything you've presented is correct. What you've basically derived is the Gauss-Markov theorem: the weighted least squares estimator is the best linear unbi
33,196
Using PCA on an image dataset prior to classification with a neural network
I agree with all @amoeba 's comments. But would add a couple of things. The reason PCA is used on images is because it works as' feature selection ' : objects span multiple pixels, so correlated changes over multiple pixels are indicative of objects. Throwing away un correlated Pixel changes is getting rid of' noise' which could lead to bad generalisation. In general nns (using gradient descent) do better with sphered inputs (ie un correlated normalised inputs), this is because then your error surface will be more symmetrical and so the single learning rate works better (you need a small learning rate in highly curved directions and a large learning rate in shallow directions). Did you normalise your inputs (good) as well or just decorrelate? Did you use l2 regularisation? This has a similar effect to PCA regularisation. For correlated inputs it emphasises small similar weights (ie averaging out the noise, penalising large weights so single pixels cannot have a disproportionate effect on classification) (see eg elements of statistical learning book), so perhaps you saw no benefit to PCA because the l2 regularisation was already effective. Or perhaps the nn was too small to overfit. Lastly did you reoptimise the parameters... I would expect you would need different learning rate and other parameters after changing to first k principal components.
Using PCA on an image dataset prior to classification with a neural network
I agree with all @amoeba 's comments. But would add a couple of things. The reason PCA is used on images is because it works as' feature selection ' : objects span multiple pixels, so correlated cha
Using PCA on an image dataset prior to classification with a neural network I agree with all @amoeba 's comments. But would add a couple of things. The reason PCA is used on images is because it works as' feature selection ' : objects span multiple pixels, so correlated changes over multiple pixels are indicative of objects. Throwing away un correlated Pixel changes is getting rid of' noise' which could lead to bad generalisation. In general nns (using gradient descent) do better with sphered inputs (ie un correlated normalised inputs), this is because then your error surface will be more symmetrical and so the single learning rate works better (you need a small learning rate in highly curved directions and a large learning rate in shallow directions). Did you normalise your inputs (good) as well or just decorrelate? Did you use l2 regularisation? This has a similar effect to PCA regularisation. For correlated inputs it emphasises small similar weights (ie averaging out the noise, penalising large weights so single pixels cannot have a disproportionate effect on classification) (see eg elements of statistical learning book), so perhaps you saw no benefit to PCA because the l2 regularisation was already effective. Or perhaps the nn was too small to overfit. Lastly did you reoptimise the parameters... I would expect you would need different learning rate and other parameters after changing to first k principal components.
Using PCA on an image dataset prior to classification with a neural network I agree with all @amoeba 's comments. But would add a couple of things. The reason PCA is used on images is because it works as' feature selection ' : objects span multiple pixels, so correlated cha
33,197
Using PCA on an image dataset prior to classification with a neural network
Per definition, PCA removes correlation among variables. It is used before classification because not all classifiers can deal well with high dimensional data (but neural nets can) and not all classifiers can deal well with correlated variables (but neural nets can). Especially with images, you typically do not want to remove correlation and you also want multiple layers such that neighboring pixels can be aggregated into image features. Your experimental results reflect the poor choice of this technique for this particular task.
Using PCA on an image dataset prior to classification with a neural network
Per definition, PCA removes correlation among variables. It is used before classification because not all classifiers can deal well with high dimensional data (but neural nets can) and not all classif
Using PCA on an image dataset prior to classification with a neural network Per definition, PCA removes correlation among variables. It is used before classification because not all classifiers can deal well with high dimensional data (but neural nets can) and not all classifiers can deal well with correlated variables (but neural nets can). Especially with images, you typically do not want to remove correlation and you also want multiple layers such that neighboring pixels can be aggregated into image features. Your experimental results reflect the poor choice of this technique for this particular task.
Using PCA on an image dataset prior to classification with a neural network Per definition, PCA removes correlation among variables. It is used before classification because not all classifiers can deal well with high dimensional data (but neural nets can) and not all classif
33,198
Using PCA on an image dataset prior to classification with a neural network
If your images(the images that you vectorized so that each image is now a single row with M columns where M is the number of total pixels x 32 x 32 x 3) contains little to no correlation, then the number of principle components required to explain most of the variances(>95% for example) in your data increases. In order to determine how "feasible" PCA is, checking explained variance is a good idea. In your case, since your data matrix has a size of NxM where M > N, maximum number of components is N. If the number of PCs required is close to 50000, then using PCA makes no sense. You can calculate the explained variance by: explained variance = sum of the eigenvalues that correspond to the PCs you use / sum of ALL eigenvalues I would choose the number of principle components which explains at least more than 90% variance. Another method for choosing the correct number of PCs is drawing the number of PCs vs. explained cumulative variance plot. In the plot you may choose the number where the explained variance doesn't increase significanly anymore. Thus, I think your problem might be choosing a good number of PCs. Another problem might be related to projection of the test samples. When you divided your samples for constructing the NN and for testing the NN, you need to project the test data set using the eigenvectors obtained from the training data set.
Using PCA on an image dataset prior to classification with a neural network
If your images(the images that you vectorized so that each image is now a single row with M columns where M is the number of total pixels x 32 x 32 x 3) contains little to no correlation, then the num
Using PCA on an image dataset prior to classification with a neural network If your images(the images that you vectorized so that each image is now a single row with M columns where M is the number of total pixels x 32 x 32 x 3) contains little to no correlation, then the number of principle components required to explain most of the variances(>95% for example) in your data increases. In order to determine how "feasible" PCA is, checking explained variance is a good idea. In your case, since your data matrix has a size of NxM where M > N, maximum number of components is N. If the number of PCs required is close to 50000, then using PCA makes no sense. You can calculate the explained variance by: explained variance = sum of the eigenvalues that correspond to the PCs you use / sum of ALL eigenvalues I would choose the number of principle components which explains at least more than 90% variance. Another method for choosing the correct number of PCs is drawing the number of PCs vs. explained cumulative variance plot. In the plot you may choose the number where the explained variance doesn't increase significanly anymore. Thus, I think your problem might be choosing a good number of PCs. Another problem might be related to projection of the test samples. When you divided your samples for constructing the NN and for testing the NN, you need to project the test data set using the eigenvectors obtained from the training data set.
Using PCA on an image dataset prior to classification with a neural network If your images(the images that you vectorized so that each image is now a single row with M columns where M is the number of total pixels x 32 x 32 x 3) contains little to no correlation, then the num
33,199
I Just Ran Two Million Regressions - Integrated Likelihood
For OLS, you can still compute the likelihood function (the exponentiated log likelihood, as Christoph Hanck mentions in the comment). It is just the good old $L_i = \prod_i (2\pi \sigma^2)^{-.5} \exp(-.5 (y_i - x_i\beta)^2)$. Stata stores this as e(ll) after running a regression using regress Then you construct weights as $w_i = \frac{L_i}{\sum_j L_j}$. Finally, you construct weighted averages of your regression coefficients using $w_i$ as weights.
I Just Ran Two Million Regressions - Integrated Likelihood
For OLS, you can still compute the likelihood function (the exponentiated log likelihood, as Christoph Hanck mentions in the comment). It is just the good old $L_i = \prod_i (2\pi \sigma^2)^{-.5} \exp
I Just Ran Two Million Regressions - Integrated Likelihood For OLS, you can still compute the likelihood function (the exponentiated log likelihood, as Christoph Hanck mentions in the comment). It is just the good old $L_i = \prod_i (2\pi \sigma^2)^{-.5} \exp(-.5 (y_i - x_i\beta)^2)$. Stata stores this as e(ll) after running a regression using regress Then you construct weights as $w_i = \frac{L_i}{\sum_j L_j}$. Finally, you construct weighted averages of your regression coefficients using $w_i$ as weights.
I Just Ran Two Million Regressions - Integrated Likelihood For OLS, you can still compute the likelihood function (the exponentiated log likelihood, as Christoph Hanck mentions in the comment). It is just the good old $L_i = \prod_i (2\pi \sigma^2)^{-.5} \exp
33,200
Prediction interval for a future proportion of successes under Binomial setting
I will address all 3 parts to the question. There are two conflated issues, first is the method you use to fit a regression model in this case. The second is how to interval estimates from your estimates to predict a new estimate. if your response variables are Binomially distributed you would typically use either a logistic regression or a probit regression (glm with normal cdf as a link function). If you do a logistic regression, take the response to be the ratio of the observed counts divided by the the known upper bound i.e. $y_i/n_i$. Then take your predictors/covariates and put these into your R call to a glm function. The returned object has everything you need to do the rest of your calculations. x<- rnorm(100, sd=2) prob_true <- 1/(1+exp(-(1+5*x))) counts <- rbinom(100, 50,prob_true) print(d.AD <- data.frame(counts,x)) glm.D93 <- glm(counts/50 ~ x, family = binomial() ) For a linear regression model the formula for a prediction interval is: $\hat{y}_i \pm t_{n-p}s_y\sqrt{1+\frac{1}{n}+\frac{(x_i-\bar{x})^2}{(n-1)s^2_x}}$ You can use the linear regression model as an approximation for the glm. To do this you would linear regression formula for the linear combination of predictors before you do the inverse link transformation to get the probabilities back on the 0-1 scale. The code to do this is baked into the predict.glm() R function. Here is some example code that will also make a nice plot. (EDIT: This code is for confidence interval, not for prediction interval) y_hat <- predict(glm.D93, type="link", se.fit=TRUE) t_np<- qt(.975, 100-2, ncp=0) ub <- y_hat$fit + t_np * y_hat$se.fit lb <- y_hat$fit - t_np * y_hat$se.fit point <- y_hat$fit p_hat <- glm.D93$family$linkinv(point) p_hat_lb <- glm.D93$family$linkinv(lb) p_hat_ub <- glm.D93$family$linkinv(ub) plot(x,p_hat) points(x, p_hat_ub, col='red') points(x, p_hat_lb, col='blue') You can do the same thing for any glm, e.g. Poisson, inverse Gaussian, gamma, etc. In each case do the prediction interval on the scale of the linear combination of the predictors. After you get the two end points of the prediction interval you convert these end points via the inverse link. For each of the glms I mentioned the inverse link might be different than the logit case I wrote here. Hope this helps.
Prediction interval for a future proportion of successes under Binomial setting
I will address all 3 parts to the question. There are two conflated issues, first is the method you use to fit a regression model in this case. The second is how to interval estimates from your esti
Prediction interval for a future proportion of successes under Binomial setting I will address all 3 parts to the question. There are two conflated issues, first is the method you use to fit a regression model in this case. The second is how to interval estimates from your estimates to predict a new estimate. if your response variables are Binomially distributed you would typically use either a logistic regression or a probit regression (glm with normal cdf as a link function). If you do a logistic regression, take the response to be the ratio of the observed counts divided by the the known upper bound i.e. $y_i/n_i$. Then take your predictors/covariates and put these into your R call to a glm function. The returned object has everything you need to do the rest of your calculations. x<- rnorm(100, sd=2) prob_true <- 1/(1+exp(-(1+5*x))) counts <- rbinom(100, 50,prob_true) print(d.AD <- data.frame(counts,x)) glm.D93 <- glm(counts/50 ~ x, family = binomial() ) For a linear regression model the formula for a prediction interval is: $\hat{y}_i \pm t_{n-p}s_y\sqrt{1+\frac{1}{n}+\frac{(x_i-\bar{x})^2}{(n-1)s^2_x}}$ You can use the linear regression model as an approximation for the glm. To do this you would linear regression formula for the linear combination of predictors before you do the inverse link transformation to get the probabilities back on the 0-1 scale. The code to do this is baked into the predict.glm() R function. Here is some example code that will also make a nice plot. (EDIT: This code is for confidence interval, not for prediction interval) y_hat <- predict(glm.D93, type="link", se.fit=TRUE) t_np<- qt(.975, 100-2, ncp=0) ub <- y_hat$fit + t_np * y_hat$se.fit lb <- y_hat$fit - t_np * y_hat$se.fit point <- y_hat$fit p_hat <- glm.D93$family$linkinv(point) p_hat_lb <- glm.D93$family$linkinv(lb) p_hat_ub <- glm.D93$family$linkinv(ub) plot(x,p_hat) points(x, p_hat_ub, col='red') points(x, p_hat_lb, col='blue') You can do the same thing for any glm, e.g. Poisson, inverse Gaussian, gamma, etc. In each case do the prediction interval on the scale of the linear combination of the predictors. After you get the two end points of the prediction interval you convert these end points via the inverse link. For each of the glms I mentioned the inverse link might be different than the logit case I wrote here. Hope this helps.
Prediction interval for a future proportion of successes under Binomial setting I will address all 3 parts to the question. There are two conflated issues, first is the method you use to fit a regression model in this case. The second is how to interval estimates from your esti