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
|
|---|---|---|---|---|---|---|
42,801
|
How to summarize knowledge about importance of variables?
|
In case you are interested in a linear model, here's direction that hasn't been mentioned in the comments / other answers:
Let $x \in R^{30}$ be the feature vector, and you want to learn a linear mapping $y = w\cdot x$ that maps $x$ to a value (that can be transformed into a probability using logistic regression, from which you can do anything).
I assume that there's a cost involved in obtaining many features / using all of them for prediction (otherwise, why not use all of them).
What you can do is to regularize the learning process with $L_1$ norm. It is known that $L_1$ regularization results in sparser models (i.e. a weight vector $w$ with lots of zeros in it), which is what you want.
Specifically, you would minimize the following:
$$ \textrm{RegularizedLoss}(w,\lambda) = \textrm{Loss}(w) + \lambda \cdot \|w\|_1,$$
where $\textrm{Loss}(w)$ is the logistic loss. There are efficient ways to do this (for example, vowpal wabbit can handle $L_1$ regularization).
The specific value of $\lambda$ controls the tradeoff between accuracy and sparsity, i.e. how much loss in accuracy are you willing to take in return for a model that uses less features.
HTH.
|
How to summarize knowledge about importance of variables?
|
In case you are interested in a linear model, here's direction that hasn't been mentioned in the comments / other answers:
Let $x \in R^{30}$ be the feature vector, and you want to learn a linear mapp
|
How to summarize knowledge about importance of variables?
In case you are interested in a linear model, here's direction that hasn't been mentioned in the comments / other answers:
Let $x \in R^{30}$ be the feature vector, and you want to learn a linear mapping $y = w\cdot x$ that maps $x$ to a value (that can be transformed into a probability using logistic regression, from which you can do anything).
I assume that there's a cost involved in obtaining many features / using all of them for prediction (otherwise, why not use all of them).
What you can do is to regularize the learning process with $L_1$ norm. It is known that $L_1$ regularization results in sparser models (i.e. a weight vector $w$ with lots of zeros in it), which is what you want.
Specifically, you would minimize the following:
$$ \textrm{RegularizedLoss}(w,\lambda) = \textrm{Loss}(w) + \lambda \cdot \|w\|_1,$$
where $\textrm{Loss}(w)$ is the logistic loss. There are efficient ways to do this (for example, vowpal wabbit can handle $L_1$ regularization).
The specific value of $\lambda$ controls the tradeoff between accuracy and sparsity, i.e. how much loss in accuracy are you willing to take in return for a model that uses less features.
HTH.
|
How to summarize knowledge about importance of variables?
In case you are interested in a linear model, here's direction that hasn't been mentioned in the comments / other answers:
Let $x \in R^{30}$ be the feature vector, and you want to learn a linear mapp
|
42,802
|
How to summarize knowledge about importance of variables?
|
Whenever I approach problem of optimization function that I cannot define, but I can calculate, I use some heuristic method.
As your searched space is big (but not BIG big, 30 features is not a lot), I would go with some genetic algorithm. This could be quite trivial, but representation of your problem may just be binary vector, so standard masked crossover and bit flipping mutation may have quite good results.
As for your question specifically: you can summarize this knowledge in form of GA itself. You do not need human-readable representation of your knowledge, so actual knowledge will be encoded in specimen representation and evaluation function.
Disclaimer: This is my intuition, close to guessing (but with some experience in heuristic optimization). I cannot show you any papers that would back this idea, but I'm pretty sure you'll find something on that.
|
How to summarize knowledge about importance of variables?
|
Whenever I approach problem of optimization function that I cannot define, but I can calculate, I use some heuristic method.
As your searched space is big (but not BIG big, 30 features is not a lot),
|
How to summarize knowledge about importance of variables?
Whenever I approach problem of optimization function that I cannot define, but I can calculate, I use some heuristic method.
As your searched space is big (but not BIG big, 30 features is not a lot), I would go with some genetic algorithm. This could be quite trivial, but representation of your problem may just be binary vector, so standard masked crossover and bit flipping mutation may have quite good results.
As for your question specifically: you can summarize this knowledge in form of GA itself. You do not need human-readable representation of your knowledge, so actual knowledge will be encoded in specimen representation and evaluation function.
Disclaimer: This is my intuition, close to guessing (but with some experience in heuristic optimization). I cannot show you any papers that would back this idea, but I'm pretty sure you'll find something on that.
|
How to summarize knowledge about importance of variables?
Whenever I approach problem of optimization function that I cannot define, but I can calculate, I use some heuristic method.
As your searched space is big (but not BIG big, 30 features is not a lot),
|
42,803
|
Are these data underdispersed? If so, what mechanisms may explain this?
|
This kind of underdispersion can happen if the subject needs to calibrate themselves to the task on any given day. This implies that the probability of success is not constant but changes according to a fixed pattern. The following sequence of success probabilities (one for each of the 20 trials, to be used every day) produces a distribution like the one shown. This is known as a Poisson-Binomial distribution.
0.00,0.00,0.00,0.00,0.03,0.10,0.34,0.72,0.97,0.99,0.99,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00
Besides this particular sequence, any sequence of probabilities whose mean is 0.65 and whose variance is 0.2 will work.
|
Are these data underdispersed? If so, what mechanisms may explain this?
|
This kind of underdispersion can happen if the subject needs to calibrate themselves to the task on any given day. This implies that the probability of success is not constant but changes according t
|
Are these data underdispersed? If so, what mechanisms may explain this?
This kind of underdispersion can happen if the subject needs to calibrate themselves to the task on any given day. This implies that the probability of success is not constant but changes according to a fixed pattern. The following sequence of success probabilities (one for each of the 20 trials, to be used every day) produces a distribution like the one shown. This is known as a Poisson-Binomial distribution.
0.00,0.00,0.00,0.00,0.03,0.10,0.34,0.72,0.97,0.99,0.99,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00
Besides this particular sequence, any sequence of probabilities whose mean is 0.65 and whose variance is 0.2 will work.
|
Are these data underdispersed? If so, what mechanisms may explain this?
This kind of underdispersion can happen if the subject needs to calibrate themselves to the task on any given day. This implies that the probability of success is not constant but changes according t
|
42,804
|
Managing 'prefer not to says' in sensitive questionnaires
|
Answering your specific technical question -- the theory of inference for partially identified distributions has been developed in the works of Charles Manski. In your example, the confidence interval would be (60% minus 1.96 times whatever standard error corresponds to the 60% assumption, 70% plus 1.96 times whatever standard error corresponds to the 70% assumption).
You can do something different statistically, and treat "Prefer not to say" as missing data. Then you can impute the answers (better, using multiple imputation) based on additional covariates, such as behaviors and attitudes (towards religion, say), etc.
Finally, to rectify the problem at its source, you need to design your instrument differently. They say that there are no sensitive questions, but there are sensitive answers to some questions. The answer "heterosexual" is not particularly sensitive, but non-straight answers are. I am not a questionnaire designer, I can't guide you very far, but there are plenty resources from, you know, bound books as they used to have in the XX century, to MOOCs.
|
Managing 'prefer not to says' in sensitive questionnaires
|
Answering your specific technical question -- the theory of inference for partially identified distributions has been developed in the works of Charles Manski. In your example, the confidence interval
|
Managing 'prefer not to says' in sensitive questionnaires
Answering your specific technical question -- the theory of inference for partially identified distributions has been developed in the works of Charles Manski. In your example, the confidence interval would be (60% minus 1.96 times whatever standard error corresponds to the 60% assumption, 70% plus 1.96 times whatever standard error corresponds to the 70% assumption).
You can do something different statistically, and treat "Prefer not to say" as missing data. Then you can impute the answers (better, using multiple imputation) based on additional covariates, such as behaviors and attitudes (towards religion, say), etc.
Finally, to rectify the problem at its source, you need to design your instrument differently. They say that there are no sensitive questions, but there are sensitive answers to some questions. The answer "heterosexual" is not particularly sensitive, but non-straight answers are. I am not a questionnaire designer, I can't guide you very far, but there are plenty resources from, you know, bound books as they used to have in the XX century, to MOOCs.
|
Managing 'prefer not to says' in sensitive questionnaires
Answering your specific technical question -- the theory of inference for partially identified distributions has been developed in the works of Charles Manski. In your example, the confidence interval
|
42,805
|
Managing 'prefer not to says' in sensitive questionnaires
|
You can't get there from here, in my view. If there are very few prefer-not-to-say's, you can omit them without much bias. However, if you have lots in that category (say 5% or more), then I think you need a different design. Like ... don't even ask them if they "prefer not to say"!
There are ways of asking sensitive questions. In one method, people are told to answer truthfully or to lie, according as some random process (hidden to the interviewer) directs them. Using the known probability of a lie, you can infer the proportion with a particular characteristic without knowing the actual characteristics of any individual. This works for binary questions.
I like your idea of going Bayesian on this if you have prior information about the "prefer not to says".
|
Managing 'prefer not to says' in sensitive questionnaires
|
You can't get there from here, in my view. If there are very few prefer-not-to-say's, you can omit them without much bias. However, if you have lots in that category (say 5% or more), then I think you
|
Managing 'prefer not to says' in sensitive questionnaires
You can't get there from here, in my view. If there are very few prefer-not-to-say's, you can omit them without much bias. However, if you have lots in that category (say 5% or more), then I think you need a different design. Like ... don't even ask them if they "prefer not to say"!
There are ways of asking sensitive questions. In one method, people are told to answer truthfully or to lie, according as some random process (hidden to the interviewer) directs them. Using the known probability of a lie, you can infer the proportion with a particular characteristic without knowing the actual characteristics of any individual. This works for binary questions.
I like your idea of going Bayesian on this if you have prior information about the "prefer not to says".
|
Managing 'prefer not to says' in sensitive questionnaires
You can't get there from here, in my view. If there are very few prefer-not-to-say's, you can omit them without much bias. However, if you have lots in that category (say 5% or more), then I think you
|
42,806
|
Managing 'prefer not to says' in sensitive questionnaires
|
(add a statistical answer complementary to my political comment on top)
We have reasonable suspicion that the 'prefer not to says' are not missing at random. We think that the probability of an individual selecting 'prefer not to say' will be higher for individuals who are homosexuals, bisexuals and other(s)
Here one wants to reduce the 'prefer not to says' answers to other categories in a statisticaly correct and significant manner.
This would be correct under the following conditions:
1) The rest options are independent and elementary events of the sample space
2) The rest options partition the sample space completely (and representatively)
3) The prior probabilities of the rest options can be infered indepentantly
Then one can indeed reduce the 'prefer not to say' answers (or other types in same vain) to the elementary options (partitions) using the answer data to calibrate the reduction (within a statistical significant range)
For the example question given (and similar examples given in comments) this is not so.
If one insists on that effectively endorses the truism that "there are lies, big lies and statistics".
From wikipedia Statistical Imputation
[M]ost statistical packages default to discarding any case that has a
missing value, which may introduce bias or affect the
representativeness of the results
i would prefer not to even take such questionares no matter how they are marketed.
Let me give another similar example that makes the previous paragraph explicit:
If you draft for the war in Iraq:
a) Go to front line
b) Go to back line
c) Goto paramedics
d) Prefer not to answer.
Better not even take these questionaires!
|
Managing 'prefer not to says' in sensitive questionnaires
|
(add a statistical answer complementary to my political comment on top)
We have reasonable suspicion that the 'prefer not to says' are not missing at random. We think that the probability of an indivi
|
Managing 'prefer not to says' in sensitive questionnaires
(add a statistical answer complementary to my political comment on top)
We have reasonable suspicion that the 'prefer not to says' are not missing at random. We think that the probability of an individual selecting 'prefer not to say' will be higher for individuals who are homosexuals, bisexuals and other(s)
Here one wants to reduce the 'prefer not to says' answers to other categories in a statisticaly correct and significant manner.
This would be correct under the following conditions:
1) The rest options are independent and elementary events of the sample space
2) The rest options partition the sample space completely (and representatively)
3) The prior probabilities of the rest options can be infered indepentantly
Then one can indeed reduce the 'prefer not to say' answers (or other types in same vain) to the elementary options (partitions) using the answer data to calibrate the reduction (within a statistical significant range)
For the example question given (and similar examples given in comments) this is not so.
If one insists on that effectively endorses the truism that "there are lies, big lies and statistics".
From wikipedia Statistical Imputation
[M]ost statistical packages default to discarding any case that has a
missing value, which may introduce bias or affect the
representativeness of the results
i would prefer not to even take such questionares no matter how they are marketed.
Let me give another similar example that makes the previous paragraph explicit:
If you draft for the war in Iraq:
a) Go to front line
b) Go to back line
c) Goto paramedics
d) Prefer not to answer.
Better not even take these questionaires!
|
Managing 'prefer not to says' in sensitive questionnaires
(add a statistical answer complementary to my political comment on top)
We have reasonable suspicion that the 'prefer not to says' are not missing at random. We think that the probability of an indivi
|
42,807
|
Feature Selection: Information Gain VS Mutual Information
|
They are identically the same.
If $X$ is a nominal feature with $k$ different values and $C$ is your target class with $m$ classes.
\begin{align}
\mbox{MI} &= \sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log \frac{P(x_i,c_j)}{P(x_i)P(c_j)}\\
&=-\sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log P(c_j) + \sum_{i=1}^k\sum_{j=1}^m P(c_j|x_i)P(x_i)\log P(c_j|x_i)\\
&= -\sum_{j=1}^m P(c_j)\log P(c_j) + \sum_{i=1}^kP(x_i)\sum_{j=1}^m P(c_j|x_i)\log P(c_j|x_i)\\
&= H(C) - H(C|X) = \mbox{IG}
\end{align}
This is a case of inconsistent naming. You might want to have a look at this question too.
|
Feature Selection: Information Gain VS Mutual Information
|
They are identically the same.
If $X$ is a nominal feature with $k$ different values and $C$ is your target class with $m$ classes.
\begin{align}
\mbox{MI} &= \sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log \
|
Feature Selection: Information Gain VS Mutual Information
They are identically the same.
If $X$ is a nominal feature with $k$ different values and $C$ is your target class with $m$ classes.
\begin{align}
\mbox{MI} &= \sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log \frac{P(x_i,c_j)}{P(x_i)P(c_j)}\\
&=-\sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log P(c_j) + \sum_{i=1}^k\sum_{j=1}^m P(c_j|x_i)P(x_i)\log P(c_j|x_i)\\
&= -\sum_{j=1}^m P(c_j)\log P(c_j) + \sum_{i=1}^kP(x_i)\sum_{j=1}^m P(c_j|x_i)\log P(c_j|x_i)\\
&= H(C) - H(C|X) = \mbox{IG}
\end{align}
This is a case of inconsistent naming. You might want to have a look at this question too.
|
Feature Selection: Information Gain VS Mutual Information
They are identically the same.
If $X$ is a nominal feature with $k$ different values and $C$ is your target class with $m$ classes.
\begin{align}
\mbox{MI} &= \sum_{i=1}^k\sum_{j=1}^m P(x_i,c_j)\log \
|
42,808
|
In neural networks, how to tell the feature which contributes the most to the output value?
|
This is more of a statistics question than a specific programming one. If you have your heart set on using neural nets an example using feature selection with Garson's algorithm is here. Below I have provided the code that you can try. Hopefully this can give you something to start with.
But please note this is only one possible answer. There are many other approaches people have taken as this is an active area of research (neural networks are complex!). There are very likely other methods that may be more suitable, more efficient, etc. You may not want to even use neural nets (I don't know your specific reasons). Depending on your data it may be better to use some alternative feature selection up front before the neural net. A simple google scholar search for 'neural network feature selection' will return several papers on the matter. There are many very strong opinions on the subject of neural networks so be warned there is no definitive answer out there.
# code from link noted above (slightly updated)
require(clusterGeneration)
require(nnet)
#define number of variables and observations
set.seed(2)
num.vars<-8
num.obs<-10000
#define correlation matrix for explanatory variables
#define actual parameter values
cov.mat<-genPositiveDefMat(num.vars,covMethod=c("unifcorrmat"))$Sigma
rand.vars<-mvrnorm(num.obs,rep(0,num.vars),Sigma=cov.mat)
parms<-runif(num.vars,-10,10)
y<-rand.vars %*% matrix(parms) + rnorm(num.obs,sd=20)
#prep data and create neural network
y<-data.frame((y-min(y))/(max(y)-min(y)))
names(y)<-'y'
rand.vars<-data.frame(rand.vars)
mod1<-nnet(rand.vars,y,size=8,linout=T)
require(devtools)
#import 'gar.fun' from beckmw's Github - this is Garson's algorithm
source_gist('6206737')
#use the function on the model created above
gar.fun('y',mod1)
Here is the output plot. You can see there are both positive and negative values. The negative and positive values reflect negative and positive relationships between the variable and the response variable.
|
In neural networks, how to tell the feature which contributes the most to the output value?
|
This is more of a statistics question than a specific programming one. If you have your heart set on using neural nets an example using feature selection with Garson's algorithm is here. Below I hav
|
In neural networks, how to tell the feature which contributes the most to the output value?
This is more of a statistics question than a specific programming one. If you have your heart set on using neural nets an example using feature selection with Garson's algorithm is here. Below I have provided the code that you can try. Hopefully this can give you something to start with.
But please note this is only one possible answer. There are many other approaches people have taken as this is an active area of research (neural networks are complex!). There are very likely other methods that may be more suitable, more efficient, etc. You may not want to even use neural nets (I don't know your specific reasons). Depending on your data it may be better to use some alternative feature selection up front before the neural net. A simple google scholar search for 'neural network feature selection' will return several papers on the matter. There are many very strong opinions on the subject of neural networks so be warned there is no definitive answer out there.
# code from link noted above (slightly updated)
require(clusterGeneration)
require(nnet)
#define number of variables and observations
set.seed(2)
num.vars<-8
num.obs<-10000
#define correlation matrix for explanatory variables
#define actual parameter values
cov.mat<-genPositiveDefMat(num.vars,covMethod=c("unifcorrmat"))$Sigma
rand.vars<-mvrnorm(num.obs,rep(0,num.vars),Sigma=cov.mat)
parms<-runif(num.vars,-10,10)
y<-rand.vars %*% matrix(parms) + rnorm(num.obs,sd=20)
#prep data and create neural network
y<-data.frame((y-min(y))/(max(y)-min(y)))
names(y)<-'y'
rand.vars<-data.frame(rand.vars)
mod1<-nnet(rand.vars,y,size=8,linout=T)
require(devtools)
#import 'gar.fun' from beckmw's Github - this is Garson's algorithm
source_gist('6206737')
#use the function on the model created above
gar.fun('y',mod1)
Here is the output plot. You can see there are both positive and negative values. The negative and positive values reflect negative and positive relationships between the variable and the response variable.
|
In neural networks, how to tell the feature which contributes the most to the output value?
This is more of a statistics question than a specific programming one. If you have your heart set on using neural nets an example using feature selection with Garson's algorithm is here. Below I hav
|
42,809
|
In neural networks, how to tell the feature which contributes the most to the output value?
|
caret package offers variable importance for neural network models along with others. You can refer to this here which says:
Neural Networks: The method used here is based on Gevrey et al (2003), which uses combinations of the absolute values of the weights. For classification models, the class-specific importances will be the same.
It also includes feature selection by Recursive Feature:
Recursive Feature Elimination: Variable importance is computed using the ranking method used for feature selection. For the final subset size, the importances for the models across all resamples are averaged to compute an overall value.
Here's what you can do :
library(caret)
# varimp
control <- trainControl(method="repeatedcv", number=10, repeats=3)
model <- train(y~., data=train, method="nnet",trControl=control)
imp<-varImp(model)
plot(imp)
# rfe
control <- rfeControl(functions=rfFuncs, method="cv", number=10)
results <- rfe(train[,!colnames %in% c("y")],train$y, sizes=c(1:(ncol(train)-1), rfeControl=control)
print(results)
# features selected
predictors(results)
plot(results, type=c("g", "o"))
|
In neural networks, how to tell the feature which contributes the most to the output value?
|
caret package offers variable importance for neural network models along with others. You can refer to this here which says:
Neural Networks: The method used here is based on Gevrey et al (2003), whi
|
In neural networks, how to tell the feature which contributes the most to the output value?
caret package offers variable importance for neural network models along with others. You can refer to this here which says:
Neural Networks: The method used here is based on Gevrey et al (2003), which uses combinations of the absolute values of the weights. For classification models, the class-specific importances will be the same.
It also includes feature selection by Recursive Feature:
Recursive Feature Elimination: Variable importance is computed using the ranking method used for feature selection. For the final subset size, the importances for the models across all resamples are averaged to compute an overall value.
Here's what you can do :
library(caret)
# varimp
control <- trainControl(method="repeatedcv", number=10, repeats=3)
model <- train(y~., data=train, method="nnet",trControl=control)
imp<-varImp(model)
plot(imp)
# rfe
control <- rfeControl(functions=rfFuncs, method="cv", number=10)
results <- rfe(train[,!colnames %in% c("y")],train$y, sizes=c(1:(ncol(train)-1), rfeControl=control)
print(results)
# features selected
predictors(results)
plot(results, type=c("g", "o"))
|
In neural networks, how to tell the feature which contributes the most to the output value?
caret package offers variable importance for neural network models along with others. You can refer to this here which says:
Neural Networks: The method used here is based on Gevrey et al (2003), whi
|
42,810
|
Comparison between MAD and SD
|
Let $X$ be a $N(\mu, \sigma^2)$ random variable, and we have a size-$n$ sample of i.i.d. realizations from it. Then for the random variable
$$\tilde X_i= X_i - \bar X_n = \left(1-\frac 1n\right)X_i - \frac1n\sum_{j\neq i}X_j$$
we have that it is also normal, and that
$$E(\tilde X_i) = \frac {n-1}n\mu - \frac {n-1}n\mu =0,\;\; \\
\operatorname{Var}(\tilde X_i) \equiv \sigma^2_c= \left(\frac {n-1}{n}\right)^2 \sigma^2 + \frac {n-1}{n^2}\sigma^2 = \frac {n(n-1)}{n^2}\sigma^2$$
Then the variable $|\tilde X_i|$ is a half-normal distribution with
$$E\left(|\tilde X_i|\right) = \sigma_c\sqrt {\frac 2{\pi}} = \sigma\frac {n(n-1)}{n^2}\sqrt {\frac 2{\pi}} \\
\operatorname{Var}(|\tilde X_i|) = \sigma^2_c\left(1-\frac 2{\pi}\right) = \sigma^2\frac {n(n-1)}{n^2}\left(1-\frac 2{\pi}\right)$$
Therefore the quantity
$$d_n = \frac{1}{n}\sum_{i=1}^n|X_i-\bar X_n| = \frac{1}{n}\sum_{i=1}^n|\tilde X_i| \xrightarrow{p}\frac{1}{n}\sum_{i=1}^nE|\tilde X_i| =\sigma\sqrt {\frac 2{\pi}}$$
by the Weak Law of Large Numbers, and since the term $\frac {n(n-1)}{n^2}$ tends to unity as $n$ tends to infinity. Note that the $|\tilde X_i|$ variables are not independent, but Markov's LLN covers also dependent random variables as long as they are "asymptotically uncorrelated" meaning that the Variance of $d_n$ should go to zero asymptotically. And it does -intuitively and informally, as $n$ increases the source of dependence, $\bar X_n$, becomes more and more "independent" of its components as it converges to the constant $\mu$, and the correlation between the $|\tilde X_i|$'s vanishes.
Note also that the above result does not mean that $d_n$ is inconsistent -because $d_n$ does not attempt to measure the standard deviation in the first place.
As for the matter of relative asymptotic efficiency, in the reference you mention, and in page 3, there exists equation $(1.5)$, which shows you how to calculate this relative efficiency measure (setting the $\varepsilon$ equal to zero, since you do not have a contaminated sample). You have written the variances upside-down in the quotient, and more over, not only the variances take part in this measure.
|
Comparison between MAD and SD
|
Let $X$ be a $N(\mu, \sigma^2)$ random variable, and we have a size-$n$ sample of i.i.d. realizations from it. Then for the random variable
$$\tilde X_i= X_i - \bar X_n = \left(1-\frac 1n\right)X_i -
|
Comparison between MAD and SD
Let $X$ be a $N(\mu, \sigma^2)$ random variable, and we have a size-$n$ sample of i.i.d. realizations from it. Then for the random variable
$$\tilde X_i= X_i - \bar X_n = \left(1-\frac 1n\right)X_i - \frac1n\sum_{j\neq i}X_j$$
we have that it is also normal, and that
$$E(\tilde X_i) = \frac {n-1}n\mu - \frac {n-1}n\mu =0,\;\; \\
\operatorname{Var}(\tilde X_i) \equiv \sigma^2_c= \left(\frac {n-1}{n}\right)^2 \sigma^2 + \frac {n-1}{n^2}\sigma^2 = \frac {n(n-1)}{n^2}\sigma^2$$
Then the variable $|\tilde X_i|$ is a half-normal distribution with
$$E\left(|\tilde X_i|\right) = \sigma_c\sqrt {\frac 2{\pi}} = \sigma\frac {n(n-1)}{n^2}\sqrt {\frac 2{\pi}} \\
\operatorname{Var}(|\tilde X_i|) = \sigma^2_c\left(1-\frac 2{\pi}\right) = \sigma^2\frac {n(n-1)}{n^2}\left(1-\frac 2{\pi}\right)$$
Therefore the quantity
$$d_n = \frac{1}{n}\sum_{i=1}^n|X_i-\bar X_n| = \frac{1}{n}\sum_{i=1}^n|\tilde X_i| \xrightarrow{p}\frac{1}{n}\sum_{i=1}^nE|\tilde X_i| =\sigma\sqrt {\frac 2{\pi}}$$
by the Weak Law of Large Numbers, and since the term $\frac {n(n-1)}{n^2}$ tends to unity as $n$ tends to infinity. Note that the $|\tilde X_i|$ variables are not independent, but Markov's LLN covers also dependent random variables as long as they are "asymptotically uncorrelated" meaning that the Variance of $d_n$ should go to zero asymptotically. And it does -intuitively and informally, as $n$ increases the source of dependence, $\bar X_n$, becomes more and more "independent" of its components as it converges to the constant $\mu$, and the correlation between the $|\tilde X_i|$'s vanishes.
Note also that the above result does not mean that $d_n$ is inconsistent -because $d_n$ does not attempt to measure the standard deviation in the first place.
As for the matter of relative asymptotic efficiency, in the reference you mention, and in page 3, there exists equation $(1.5)$, which shows you how to calculate this relative efficiency measure (setting the $\varepsilon$ equal to zero, since you do not have a contaminated sample). You have written the variances upside-down in the quotient, and more over, not only the variances take part in this measure.
|
Comparison between MAD and SD
Let $X$ be a $N(\mu, \sigma^2)$ random variable, and we have a size-$n$ sample of i.i.d. realizations from it. Then for the random variable
$$\tilde X_i= X_i - \bar X_n = \left(1-\frac 1n\right)X_i -
|
42,811
|
Intervention Analysis - Pulse over several periods
|
Lets say you have a time series data 42 observations. Observation 7 to 13 have step(level shift) intervention and observations 29 to 35 have step intervention of 5 units. The remainder observations are 0. As an example, see below chart for simulated data with actual and actual + error.
If you would like to model this data as a intervention analysis using arima transfer function, you simply need to create a dummy coded variable with 1's for 7 to 13 and 1's for 29 to 35 and pass this is a step intervention in ARIMAX model. I don't know how to use R for transfer function modeling, so I used SAS. See below the actual and predicted data. The ARIMAX approximated the data very well. See below the SAS code that I used to create the data and as well as the ARIMAX.
If your second intervention has a first intervention has a decaying effect, all you need to do is create a second intervention variable at the end of first step function and code it appropriately.
Hopefully this helped.
data temp;
input actual @@;
error = rand("NORMAL");
datalines;
0 0 0 0 0 0 5
5 5 5 5 5 5 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
5 5 5 5 5 5 5
0 0 0 0 0 0 0
;
run;
data temp;
set temp;
actual_error = actual+error; *add random error;
if 7 <= _n_ <= 14 or 29 <= _n_ <= 35 then step = 1; * First Intervention step;
else step = 0;
run;
ods graphics on;
proc arima data = temp plots = all;
identify var=actual_error crosscorr = (step);
estimate input = (step) method = ml outest = mm1; /*Estimate Model using Transfer Function*/
forecast out = out1 lead = 0;
run;
ods graphics off;
EDIT: as b_miner would like to know how to model this with temporary level shift with a linear decay, I have modified the example. I have shown only the first level shift, the second level shift could be easily added. If you are looking for a decay other than a linear decay then it is fairly easy to do, just use a step+gradual permanent decay function using transfer function. Intervention modeling is more of an art than science. You assume a shape, test the hypothesis, if acceptable move on else change the shape. Intervention modeling is deterministic in nature. If you are interested in learning more about transfer function modeling/intervention detection, I would highly recommend Forecasting-Dynamic-Regression-Models-Pankratz. This text has all the different types of intervention models possible, in addition to transfer function modeling.
Hope this helps.
data temp;
input actual @@;
error = rand("NORMAL");
datalines;
0 0 0 0 0 0 5
5 5 5 5 5 5 4.1
4 3.5 3 2.5 2 1.75 1.25
0.75 0.25 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
;
run;
data temp;
set temp;
retain ramp 0;
actual_error = actual+error; *add random error;
if 7 <= _n_ <= 13 then step = 1;
else step = 0;
if 14 <= _n_ <= 23 then do;
step = (_n_ - 24)/(13-24);
end;
run;
ods graphics on;
proc arima data = temp plots = all;
identify var=actual_error crosscorr = (step);
estimate input = (step) method = ml outest = mm1; /*Estimate Model using Transfer Function*/
forecast out = out1 lead = 0;
run;
ods graphics off;
|
Intervention Analysis - Pulse over several periods
|
Lets say you have a time series data 42 observations. Observation 7 to 13 have step(level shift) intervention and observations 29 to 35 have step intervention of 5 units. The remainder observations ar
|
Intervention Analysis - Pulse over several periods
Lets say you have a time series data 42 observations. Observation 7 to 13 have step(level shift) intervention and observations 29 to 35 have step intervention of 5 units. The remainder observations are 0. As an example, see below chart for simulated data with actual and actual + error.
If you would like to model this data as a intervention analysis using arima transfer function, you simply need to create a dummy coded variable with 1's for 7 to 13 and 1's for 29 to 35 and pass this is a step intervention in ARIMAX model. I don't know how to use R for transfer function modeling, so I used SAS. See below the actual and predicted data. The ARIMAX approximated the data very well. See below the SAS code that I used to create the data and as well as the ARIMAX.
If your second intervention has a first intervention has a decaying effect, all you need to do is create a second intervention variable at the end of first step function and code it appropriately.
Hopefully this helped.
data temp;
input actual @@;
error = rand("NORMAL");
datalines;
0 0 0 0 0 0 5
5 5 5 5 5 5 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
5 5 5 5 5 5 5
0 0 0 0 0 0 0
;
run;
data temp;
set temp;
actual_error = actual+error; *add random error;
if 7 <= _n_ <= 14 or 29 <= _n_ <= 35 then step = 1; * First Intervention step;
else step = 0;
run;
ods graphics on;
proc arima data = temp plots = all;
identify var=actual_error crosscorr = (step);
estimate input = (step) method = ml outest = mm1; /*Estimate Model using Transfer Function*/
forecast out = out1 lead = 0;
run;
ods graphics off;
EDIT: as b_miner would like to know how to model this with temporary level shift with a linear decay, I have modified the example. I have shown only the first level shift, the second level shift could be easily added. If you are looking for a decay other than a linear decay then it is fairly easy to do, just use a step+gradual permanent decay function using transfer function. Intervention modeling is more of an art than science. You assume a shape, test the hypothesis, if acceptable move on else change the shape. Intervention modeling is deterministic in nature. If you are interested in learning more about transfer function modeling/intervention detection, I would highly recommend Forecasting-Dynamic-Regression-Models-Pankratz. This text has all the different types of intervention models possible, in addition to transfer function modeling.
Hope this helps.
data temp;
input actual @@;
error = rand("NORMAL");
datalines;
0 0 0 0 0 0 5
5 5 5 5 5 5 4.1
4 3.5 3 2.5 2 1.75 1.25
0.75 0.25 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
;
run;
data temp;
set temp;
retain ramp 0;
actual_error = actual+error; *add random error;
if 7 <= _n_ <= 13 then step = 1;
else step = 0;
if 14 <= _n_ <= 23 then do;
step = (_n_ - 24)/(13-24);
end;
run;
ods graphics on;
proc arima data = temp plots = all;
identify var=actual_error crosscorr = (step);
estimate input = (step) method = ml outest = mm1; /*Estimate Model using Transfer Function*/
forecast out = out1 lead = 0;
run;
ods graphics off;
|
Intervention Analysis - Pulse over several periods
Lets say you have a time series data 42 observations. Observation 7 to 13 have step(level shift) intervention and observations 29 to 35 have step intervention of 5 units. The remainder observations ar
|
42,812
|
Quasi maximum likelihood estimation versus pseudo MLE
|
Quasi-likelihood and Pseudo-likelihood mean different things. If the probability model is possibly misspecified, then the likelihood function is called a quasi-likelihood function (see White 1982 econometrica for example). In the special case where the probability model is correctly specified then the quasi-maximum likelihood estimation is the same as maximum likelihood estimation. The terminology "pseudo-likelihood" is not as established but typically means that independence assumptions are violated so that the the independence assumptions which permit the likelihood function to be constructed as a product of other likelihood functions are violated but the likelihood function is constructed as a product of other likelihood functions anyway. Thus, every pseudo-likelihood function is a quasi-likelihood function but every quasi-likelihood function is not necessarily a pseudo-likelihood function. See Besag 1986 "Analysis of Dirty Pictures" (Journal of Royal Statistical Society Series B, Vol. 48 for discussion of the pseudolikelihood function). These terms are not restricted to the assumption of normality.
|
Quasi maximum likelihood estimation versus pseudo MLE
|
Quasi-likelihood and Pseudo-likelihood mean different things. If the probability model is possibly misspecified, then the likelihood function is called a quasi-likelihood function (see White 1982 econ
|
Quasi maximum likelihood estimation versus pseudo MLE
Quasi-likelihood and Pseudo-likelihood mean different things. If the probability model is possibly misspecified, then the likelihood function is called a quasi-likelihood function (see White 1982 econometrica for example). In the special case where the probability model is correctly specified then the quasi-maximum likelihood estimation is the same as maximum likelihood estimation. The terminology "pseudo-likelihood" is not as established but typically means that independence assumptions are violated so that the the independence assumptions which permit the likelihood function to be constructed as a product of other likelihood functions are violated but the likelihood function is constructed as a product of other likelihood functions anyway. Thus, every pseudo-likelihood function is a quasi-likelihood function but every quasi-likelihood function is not necessarily a pseudo-likelihood function. See Besag 1986 "Analysis of Dirty Pictures" (Journal of Royal Statistical Society Series B, Vol. 48 for discussion of the pseudolikelihood function). These terms are not restricted to the assumption of normality.
|
Quasi maximum likelihood estimation versus pseudo MLE
Quasi-likelihood and Pseudo-likelihood mean different things. If the probability model is possibly misspecified, then the likelihood function is called a quasi-likelihood function (see White 1982 econ
|
42,813
|
Quasi maximum likelihood estimation versus pseudo MLE
|
The two names denote the same concept. See f.e. Hayashi's Econometrics. Concerning the second part I am not sure, but, normally, it is explained as the estimation if the model is misspecified (generally) - "in ways that do not affect the consistency of the estimator" (Davidson, Mackinnon - Econometric Theory and Methods.
|
Quasi maximum likelihood estimation versus pseudo MLE
|
The two names denote the same concept. See f.e. Hayashi's Econometrics. Concerning the second part I am not sure, but, normally, it is explained as the estimation if the model is misspecified (general
|
Quasi maximum likelihood estimation versus pseudo MLE
The two names denote the same concept. See f.e. Hayashi's Econometrics. Concerning the second part I am not sure, but, normally, it is explained as the estimation if the model is misspecified (generally) - "in ways that do not affect the consistency of the estimator" (Davidson, Mackinnon - Econometric Theory and Methods.
|
Quasi maximum likelihood estimation versus pseudo MLE
The two names denote the same concept. See f.e. Hayashi's Econometrics. Concerning the second part I am not sure, but, normally, it is explained as the estimation if the model is misspecified (general
|
42,814
|
Elastic net package for mixed effects models?
|
Maybe look at the MMS package. The lassop function seems to only be for lasso analysis, yet is clearly built on the glmnet package and includes some of its parameters such as alpha. If nothing else it is likely a good package to modify for your purposes.
https://cran.r-project.org/web/packages/MMS/MMS.pdf
|
Elastic net package for mixed effects models?
|
Maybe look at the MMS package. The lassop function seems to only be for lasso analysis, yet is clearly built on the glmnet package and includes some of its parameters such as alpha. If nothing else it
|
Elastic net package for mixed effects models?
Maybe look at the MMS package. The lassop function seems to only be for lasso analysis, yet is clearly built on the glmnet package and includes some of its parameters such as alpha. If nothing else it is likely a good package to modify for your purposes.
https://cran.r-project.org/web/packages/MMS/MMS.pdf
|
Elastic net package for mixed effects models?
Maybe look at the MMS package. The lassop function seems to only be for lasso analysis, yet is clearly built on the glmnet package and includes some of its parameters such as alpha. If nothing else it
|
42,815
|
Elastic net package for mixed effects models?
|
It has been a while, but if anyone is still searching: https://github.com/debbiemarkslab/GELMMnet
|
Elastic net package for mixed effects models?
|
It has been a while, but if anyone is still searching: https://github.com/debbiemarkslab/GELMMnet
|
Elastic net package for mixed effects models?
It has been a while, but if anyone is still searching: https://github.com/debbiemarkslab/GELMMnet
|
Elastic net package for mixed effects models?
It has been a while, but if anyone is still searching: https://github.com/debbiemarkslab/GELMMnet
|
42,816
|
What regression model to use when independent variables are percentages to predict % outcome?
|
Your response is binary and so you probably want to look at something like a binomial GLM for that, such as logistic regression.
Having a group of $k$ predictors that add to 1 (e.g. the $k=3$ body proportion predictors) would imply that at most you can have $k-1$ of them in the model because of the multicollinearity issue.
However, I'm going to suggest that you may also want to transform those percentages; they're unlikely to enter the model linearly; indeed with a logit link my first thought would be that you might want to try something like the logit of the proportions instead.
|
What regression model to use when independent variables are percentages to predict % outcome?
|
Your response is binary and so you probably want to look at something like a binomial GLM for that, such as logistic regression.
Having a group of $k$ predictors that add to 1 (e.g. the $k=3$ body pro
|
What regression model to use when independent variables are percentages to predict % outcome?
Your response is binary and so you probably want to look at something like a binomial GLM for that, such as logistic regression.
Having a group of $k$ predictors that add to 1 (e.g. the $k=3$ body proportion predictors) would imply that at most you can have $k-1$ of them in the model because of the multicollinearity issue.
However, I'm going to suggest that you may also want to transform those percentages; they're unlikely to enter the model linearly; indeed with a logit link my first thought would be that you might want to try something like the logit of the proportions instead.
|
What regression model to use when independent variables are percentages to predict % outcome?
Your response is binary and so you probably want to look at something like a binomial GLM for that, such as logistic regression.
Having a group of $k$ predictors that add to 1 (e.g. the $k=3$ body pro
|
42,817
|
What regression model to use when independent variables are percentages to predict % outcome?
|
I'd also go for logistic regression since you don't mention that you have a time variable specifying the time from inclusion in the study until start of smoking or censoring (end of study); in that case a Cox regression would be better.
I doubt that there is any difference in using percentages as predictors as compared to other continuous variables. For example, BMI (Body mass Index) is neither a directly measured predictors, as it is derived from a division of two units.
As Glen_b mentions, these predictors might not be truly linearly associated with the dependent variable. But transforming them might make predictors more difficult to interpret and journals typically don't like transformed variables if they are the predictors of main interest.
|
What regression model to use when independent variables are percentages to predict % outcome?
|
I'd also go for logistic regression since you don't mention that you have a time variable specifying the time from inclusion in the study until start of smoking or censoring (end of study); in that ca
|
What regression model to use when independent variables are percentages to predict % outcome?
I'd also go for logistic regression since you don't mention that you have a time variable specifying the time from inclusion in the study until start of smoking or censoring (end of study); in that case a Cox regression would be better.
I doubt that there is any difference in using percentages as predictors as compared to other continuous variables. For example, BMI (Body mass Index) is neither a directly measured predictors, as it is derived from a division of two units.
As Glen_b mentions, these predictors might not be truly linearly associated with the dependent variable. But transforming them might make predictors more difficult to interpret and journals typically don't like transformed variables if they are the predictors of main interest.
|
What regression model to use when independent variables are percentages to predict % outcome?
I'd also go for logistic regression since you don't mention that you have a time variable specifying the time from inclusion in the study until start of smoking or censoring (end of study); in that ca
|
42,818
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
|
Non-response is a frequent problem in surveys, to be sure. Any use of these data would need to include some language about the non-response rate, and the results judged with caution.
As to your question about R usage, the code looks fine. As a detail, instead of using weights in the svydesign part, I would use fpc=~rep(10000,10000). If you supply weights, you don't get the finite population correction -- just a weighted estimate.
Post-stratification is not the answer to all of life's problems. It can reduce the variance of the estimates, but not as much as if you had stratified from the start. And of course, it does nothing for you if the variable of interest is unrelated to the post-stratification variable, and related to whatever caused the non-response.
I think that a place to start in this case is to see whether the distribution of states in your responders is typical of your professional group. If it is, then post-stratification is unnecessary. If you know the age and gender of your people, you could test for those as well.
Post-stratification does literally nothing if you are calculating means of the post-stratification groups. (Example: I post-stratify on gender and then calculate the means for men and women). This is due to a design decision by Thomas Lumley, which he discusses on page 137 of his book, Complex Surveys: a Guide to Analysis using R.
I do not believe that your situation is as dire as @whuber believes, nor does it compare to the Literary Digest snafu during the 1936 presidential election. The LD drew a sample from a population frame that favoured the Republicans. They would have had problems even with a good response rate. Your population frame is complete.
Remember that you actually did, physically, receive information from 2,000 out of 10,000 people. You saw what you saw. The missing 8,000 would have to be very different from the 2,000 to massively shift your estimated mean from where it currently is. How bad can it be? Do some sensitivity tests and publish your results, I say.
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
|
Non-response is a frequent problem in surveys, to be sure. Any use of these data would need to include some language about the non-response rate, and the results judged with caution.
As to your questi
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
Non-response is a frequent problem in surveys, to be sure. Any use of these data would need to include some language about the non-response rate, and the results judged with caution.
As to your question about R usage, the code looks fine. As a detail, instead of using weights in the svydesign part, I would use fpc=~rep(10000,10000). If you supply weights, you don't get the finite population correction -- just a weighted estimate.
Post-stratification is not the answer to all of life's problems. It can reduce the variance of the estimates, but not as much as if you had stratified from the start. And of course, it does nothing for you if the variable of interest is unrelated to the post-stratification variable, and related to whatever caused the non-response.
I think that a place to start in this case is to see whether the distribution of states in your responders is typical of your professional group. If it is, then post-stratification is unnecessary. If you know the age and gender of your people, you could test for those as well.
Post-stratification does literally nothing if you are calculating means of the post-stratification groups. (Example: I post-stratify on gender and then calculate the means for men and women). This is due to a design decision by Thomas Lumley, which he discusses on page 137 of his book, Complex Surveys: a Guide to Analysis using R.
I do not believe that your situation is as dire as @whuber believes, nor does it compare to the Literary Digest snafu during the 1936 presidential election. The LD drew a sample from a population frame that favoured the Republicans. They would have had problems even with a good response rate. Your population frame is complete.
Remember that you actually did, physically, receive information from 2,000 out of 10,000 people. You saw what you saw. The missing 8,000 would have to be very different from the 2,000 to massively shift your estimated mean from where it currently is. How bad can it be? Do some sensitivity tests and publish your results, I say.
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
Non-response is a frequent problem in surveys, to be sure. Any use of these data would need to include some language about the non-response rate, and the results judged with caution.
As to your questi
|
42,819
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
|
What do you mean by "there were no sampling probabilities" ? Did all units have the same inclusion probability (simple random sampling) ? Or is it because you tried to contact every unit in your population (in which case all initial weights are equal to 1) ?
Anyway, your results can clearly be used (even though your response rate is a little low, estimations on very small sub-populations might not be very precise) ! You'll be fine as long as you account for non-response in your estimations.
Post-stratification is one way to do so (then your post-stratification variables have to be highly correlated with non-response probability), but I'd recommend using Homegeneous Response Groups, which I explained in details in a post I wrote a little while ago.
PS : As @Placidia mentioned, the case of the 1936 election is really different : the bias comes from a flaw in the sampling frame, it is not a form of non-response biais.
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
|
What do you mean by "there were no sampling probabilities" ? Did all units have the same inclusion probability (simple random sampling) ? Or is it because you tried to contact every unit in your popul
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
What do you mean by "there were no sampling probabilities" ? Did all units have the same inclusion probability (simple random sampling) ? Or is it because you tried to contact every unit in your population (in which case all initial weights are equal to 1) ?
Anyway, your results can clearly be used (even though your response rate is a little low, estimations on very small sub-populations might not be very precise) ! You'll be fine as long as you account for non-response in your estimations.
Post-stratification is one way to do so (then your post-stratification variables have to be highly correlated with non-response probability), but I'd recommend using Homegeneous Response Groups, which I explained in details in a post I wrote a little while ago.
PS : As @Placidia mentioned, the case of the 1936 election is really different : the bias comes from a flaw in the sampling frame, it is not a form of non-response biais.
|
recommendations to analyze a survey of the entire sample frame with a 20% response rate
What do you mean by "there were no sampling probabilities" ? Did all units have the same inclusion probability (simple random sampling) ? Or is it because you tried to contact every unit in your popul
|
42,820
|
Logistic regression assumptions for a model with many binary independent variables
|
If all your regressor variables are binary, then the linearity assumption is vacuous! so can be ignored. But you say you have variables like age, which is not binary. Then you can consider using a spline of age instead of age directly, which leads to GAMs (generalized additive models) or the use of regression splines. I found this useful when there are one or a few such variables.
Then consider which interactions you consider plausible, then start with your model.
|
Logistic regression assumptions for a model with many binary independent variables
|
If all your regressor variables are binary, then the linearity assumption is vacuous! so can be ignored. But you say you have variables like age, which is not binary. Then you can consider using a s
|
Logistic regression assumptions for a model with many binary independent variables
If all your regressor variables are binary, then the linearity assumption is vacuous! so can be ignored. But you say you have variables like age, which is not binary. Then you can consider using a spline of age instead of age directly, which leads to GAMs (generalized additive models) or the use of regression splines. I found this useful when there are one or a few such variables.
Then consider which interactions you consider plausible, then start with your model.
|
Logistic regression assumptions for a model with many binary independent variables
If all your regressor variables are binary, then the linearity assumption is vacuous! so can be ignored. But you say you have variables like age, which is not binary. Then you can consider using a s
|
42,821
|
Logistic regression assumptions for a model with many binary independent variables
|
Here are some thoughts:
If you only want to identify relevant variables (e.g., you don't want to test pre-existing hypotheses, and you aren't trying to build the optimal model for predicting favorability later), you might try either CART, or combining logistic regression with LASSO penalization.
There is no assumption of 'linearity' in logistic regression. In general, people consider LR to be a non-linear model. There is some sense in which any model assumes it is properly specified, and it is possible (with a continuous variable) that you could need a squared term (e.g.) for the model to be reasonably well specified, but even that isn't true with only dichotomous variables.
It is often best to try to reduce your independent variables first. However, you still won't have to worry about 'linearity'.
|
Logistic regression assumptions for a model with many binary independent variables
|
Here are some thoughts:
If you only want to identify relevant variables (e.g., you don't want to test pre-existing hypotheses, and you aren't trying to build the optimal model for predicting favora
|
Logistic regression assumptions for a model with many binary independent variables
Here are some thoughts:
If you only want to identify relevant variables (e.g., you don't want to test pre-existing hypotheses, and you aren't trying to build the optimal model for predicting favorability later), you might try either CART, or combining logistic regression with LASSO penalization.
There is no assumption of 'linearity' in logistic regression. In general, people consider LR to be a non-linear model. There is some sense in which any model assumes it is properly specified, and it is possible (with a continuous variable) that you could need a squared term (e.g.) for the model to be reasonably well specified, but even that isn't true with only dichotomous variables.
It is often best to try to reduce your independent variables first. However, you still won't have to worry about 'linearity'.
|
Logistic regression assumptions for a model with many binary independent variables
Here are some thoughts:
If you only want to identify relevant variables (e.g., you don't want to test pre-existing hypotheses, and you aren't trying to build the optimal model for predicting favora
|
42,822
|
Reduce Random Forest model memory size
|
I used this function to reduce my default caret-output from 137 MB to 3 MB. You can still use this model for prediction with $finalModel
## Clean Model to Save Memory
## http://stats.stackexchange.com/questions/102667/reduce-random-forest-model-memory-size
stripRF <- function(cm) {
cm$finalModel$predicted <- NULL
cm$finalModel$oob.times <- NULL
cm$finalModel$y <- NULL
cm$finalModel$votes <- NULL
cm$control$indexOut <- NULL
cm$control$index <- NULL
cm$trainingData <- NULL
attr(cm$terms,".Environment") <- c()
attr(cm$formula,".Environment") <- c()
cm
}
|
Reduce Random Forest model memory size
|
I used this function to reduce my default caret-output from 137 MB to 3 MB. You can still use this model for prediction with $finalModel
## Clean Model to Save Memory
## http://stats.stackexchange.co
|
Reduce Random Forest model memory size
I used this function to reduce my default caret-output from 137 MB to 3 MB. You can still use this model for prediction with $finalModel
## Clean Model to Save Memory
## http://stats.stackexchange.com/questions/102667/reduce-random-forest-model-memory-size
stripRF <- function(cm) {
cm$finalModel$predicted <- NULL
cm$finalModel$oob.times <- NULL
cm$finalModel$y <- NULL
cm$finalModel$votes <- NULL
cm$control$indexOut <- NULL
cm$control$index <- NULL
cm$trainingData <- NULL
attr(cm$terms,".Environment") <- c()
attr(cm$formula,".Environment") <- c()
cm
}
|
Reduce Random Forest model memory size
I used this function to reduce my default caret-output from 137 MB to 3 MB. You can still use this model for prediction with $finalModel
## Clean Model to Save Memory
## http://stats.stackexchange.co
|
42,823
|
Inconsistency in Two stage Maximum Likelihood Estimation
|
This seems analogous to a profile likelihood approach. If no matter what $\beta$ is, you will always get the same MLE for $(\alpha_1, \alpha_2)$, then you can maximize with respect to $(\alpha_1, \alpha_2)$ first, then maximize with respect to $\beta$ conditional on$(\hat{\alpha_1}, \hat{\alpha_2})$ .
If that's not true, then you could switch to a 2-dimensional profile likelihood approach. What you can do is for each point on a suitably fine two-dimensional grid of $(\alpha_1, \alpha_2)$, compute the MLE for each of the $\beta$'s. The overall MLE will involve computing the joint likelihood, $L(\alpha_1,\alpha_2, \hat{\beta})$ for every point on the grid. It's a brute force method but it's guaranteed to find the joint MLE.
|
Inconsistency in Two stage Maximum Likelihood Estimation
|
This seems analogous to a profile likelihood approach. If no matter what $\beta$ is, you will always get the same MLE for $(\alpha_1, \alpha_2)$, then you can maximize with respect to $(\alpha_1, \al
|
Inconsistency in Two stage Maximum Likelihood Estimation
This seems analogous to a profile likelihood approach. If no matter what $\beta$ is, you will always get the same MLE for $(\alpha_1, \alpha_2)$, then you can maximize with respect to $(\alpha_1, \alpha_2)$ first, then maximize with respect to $\beta$ conditional on$(\hat{\alpha_1}, \hat{\alpha_2})$ .
If that's not true, then you could switch to a 2-dimensional profile likelihood approach. What you can do is for each point on a suitably fine two-dimensional grid of $(\alpha_1, \alpha_2)$, compute the MLE for each of the $\beta$'s. The overall MLE will involve computing the joint likelihood, $L(\alpha_1,\alpha_2, \hat{\beta})$ for every point on the grid. It's a brute force method but it's guaranteed to find the joint MLE.
|
Inconsistency in Two stage Maximum Likelihood Estimation
This seems analogous to a profile likelihood approach. If no matter what $\beta$ is, you will always get the same MLE for $(\alpha_1, \alpha_2)$, then you can maximize with respect to $(\alpha_1, \al
|
42,824
|
Power when using binomial data versus continuous data
|
A Bernoulli (binary) random variable has one bit of information. This is the lowest amount of information something can have short of no information at all. A continuous response that is integer valued 0-100 has 6 bits (binary digits) of information. Assuming that not all of the 6 bits are pure noise, the non-binary variable has very much more information than the binary one. This results in better statistical power and precision when making inferences.
|
Power when using binomial data versus continuous data
|
A Bernoulli (binary) random variable has one bit of information. This is the lowest amount of information something can have short of no information at all. A continuous response that is integer val
|
Power when using binomial data versus continuous data
A Bernoulli (binary) random variable has one bit of information. This is the lowest amount of information something can have short of no information at all. A continuous response that is integer valued 0-100 has 6 bits (binary digits) of information. Assuming that not all of the 6 bits are pure noise, the non-binary variable has very much more information than the binary one. This results in better statistical power and precision when making inferences.
|
Power when using binomial data versus continuous data
A Bernoulli (binary) random variable has one bit of information. This is the lowest amount of information something can have short of no information at all. A continuous response that is integer val
|
42,825
|
Item reliability or fit in IRT-based adaptive tests?
|
Item fit is a pretty active area of research in IRT literature. There are specific models (i.e., Rasch models) that have their own specific item fit statistics, such as the infit and outfit (which may relate to your case, within each packet of equally discriminating items), and more general ones that don't rely on the strict Rasch model format. I tend to prefer the latter, since they work equally well for Rasch items as well.
Look into the S-X2 statistic since I think it is one of the better tests overall, and is fairly cheap to compute for each item (unlike Information matrix based tests). It's also possible to use variants of the M2 statistic for each item, though this gets out of hand for larger tests, or to use some older two-stage methods which requires computing person estimates and creating expected value bins manually to form an approximate $\chi^2$ test (I wouldn't recommend this approach, despite its popularity in the past). Hope that helps.
References
Kang, T. & Chen, Troy, T. (2007). An investigation of the performance of the generalized S-X2 item-fit index for polytomous IRT models. ACT
Maydeu-Olivares, A. & Joe, H. Limited information goodness-of-fit testing in multidimensional contingency tables. Psychometrika, 2006, 71, 713-732
Ranger, J. & Kuhn, J.-T. Assessing Fit of Item Response Models Using the Information Matrix Test. Journal of Educational Measurement, 2012, 49, 247-268
Reise, S. P. (1990). A comparison of item- and person-fit methods of assessing model-data fit in IRT. Applied Psychological Measurement, 14, 127-137.
Wright B. D. & Masters, G. N. Rating scale analysis. MESA Press, 1982
|
Item reliability or fit in IRT-based adaptive tests?
|
Item fit is a pretty active area of research in IRT literature. There are specific models (i.e., Rasch models) that have their own specific item fit statistics, such as the infit and outfit (which may
|
Item reliability or fit in IRT-based adaptive tests?
Item fit is a pretty active area of research in IRT literature. There are specific models (i.e., Rasch models) that have their own specific item fit statistics, such as the infit and outfit (which may relate to your case, within each packet of equally discriminating items), and more general ones that don't rely on the strict Rasch model format. I tend to prefer the latter, since they work equally well for Rasch items as well.
Look into the S-X2 statistic since I think it is one of the better tests overall, and is fairly cheap to compute for each item (unlike Information matrix based tests). It's also possible to use variants of the M2 statistic for each item, though this gets out of hand for larger tests, or to use some older two-stage methods which requires computing person estimates and creating expected value bins manually to form an approximate $\chi^2$ test (I wouldn't recommend this approach, despite its popularity in the past). Hope that helps.
References
Kang, T. & Chen, Troy, T. (2007). An investigation of the performance of the generalized S-X2 item-fit index for polytomous IRT models. ACT
Maydeu-Olivares, A. & Joe, H. Limited information goodness-of-fit testing in multidimensional contingency tables. Psychometrika, 2006, 71, 713-732
Ranger, J. & Kuhn, J.-T. Assessing Fit of Item Response Models Using the Information Matrix Test. Journal of Educational Measurement, 2012, 49, 247-268
Reise, S. P. (1990). A comparison of item- and person-fit methods of assessing model-data fit in IRT. Applied Psychological Measurement, 14, 127-137.
Wright B. D. & Masters, G. N. Rating scale analysis. MESA Press, 1982
|
Item reliability or fit in IRT-based adaptive tests?
Item fit is a pretty active area of research in IRT literature. There are specific models (i.e., Rasch models) that have their own specific item fit statistics, such as the infit and outfit (which may
|
42,826
|
Guide / tutorial for design & analysis of experiments in retail settings
|
Great question!
Though I think that you will find most books on the principles of experimental design helpful, here is an HBR piece that serves as a step-by-step guide for business experiments.
|
Guide / tutorial for design & analysis of experiments in retail settings
|
Great question!
Though I think that you will find most books on the principles of experimental design helpful, here is an HBR piece that serves as a step-by-step guide for business experiments.
|
Guide / tutorial for design & analysis of experiments in retail settings
Great question!
Though I think that you will find most books on the principles of experimental design helpful, here is an HBR piece that serves as a step-by-step guide for business experiments.
|
Guide / tutorial for design & analysis of experiments in retail settings
Great question!
Though I think that you will find most books on the principles of experimental design helpful, here is an HBR piece that serves as a step-by-step guide for business experiments.
|
42,827
|
How to derive the Projected normal distribution
|
There is a trick for calculating the pdf of 2-d projected normal, which can be found on pp. 52 of Mardia (1972).
After change of variable $x_1 = r\, \cos\theta$ and $x_2 = r\,\sin\theta$, we have
$f(\theta)= \int_{0}^{\infty}\frac{1}{\sqrt{2\pi}\sigma_1\sigma_2\sqrt{1-\rho^2} }r\,\mbox{exp}\{-\frac{\sigma_2^2(r\cos\theta-\mu_1)^2-2\rho(r\cos\theta-\mu_1)(r\sin\theta-\mu_2)+\sigma_1^2(r\sin\theta-\mu_2)^2}{2\sigma_1^2\sigma_2^2(1-\rho^2)}\}\mbox{d}r$,
Use the following result,
$d^2\int_{0}^{\infty}r\,\mbox{exp}\{-\frac{1}{2}d^2(r^2-2br)\}\mbox{d}r = 1+ (2\pi)^{\frac{1}{2}}bd\,\mbox{e}^{\frac{1}{2}b^2d^2}\Phi(bd),$
where $\Phi(x)$ is the cdf of $\mbox{N}(0,1)$.
With $d^2 = \frac{\sigma_2^2\cos^2\theta-\rho\sigma_1\sigma_2\sin2\theta+\sigma_1^2\sin^2\theta}{(1-\rho^2)\sigma_1^2\sigma_2^2}$ and $b = \frac{\mu_1\sigma_2(\sigma_2\cos\theta-\rho\sigma_1\sin\theta)+\mu_2\sigma_1(\sigma_1\sin\theta-\rho\sigma_2\cos\theta)}{\sigma_2^2\cos^2\theta-\rho\sigma_1\sigma_2\sin2\theta+\sigma_1^2\sin^2\theta}$,
you are going to obtain the pdf listed in the above paper.
|
How to derive the Projected normal distribution
|
There is a trick for calculating the pdf of 2-d projected normal, which can be found on pp. 52 of Mardia (1972).
After change of variable $x_1 = r\, \cos\theta$ and $x_2 = r\,\sin\theta$, we have
$f(
|
How to derive the Projected normal distribution
There is a trick for calculating the pdf of 2-d projected normal, which can be found on pp. 52 of Mardia (1972).
After change of variable $x_1 = r\, \cos\theta$ and $x_2 = r\,\sin\theta$, we have
$f(\theta)= \int_{0}^{\infty}\frac{1}{\sqrt{2\pi}\sigma_1\sigma_2\sqrt{1-\rho^2} }r\,\mbox{exp}\{-\frac{\sigma_2^2(r\cos\theta-\mu_1)^2-2\rho(r\cos\theta-\mu_1)(r\sin\theta-\mu_2)+\sigma_1^2(r\sin\theta-\mu_2)^2}{2\sigma_1^2\sigma_2^2(1-\rho^2)}\}\mbox{d}r$,
Use the following result,
$d^2\int_{0}^{\infty}r\,\mbox{exp}\{-\frac{1}{2}d^2(r^2-2br)\}\mbox{d}r = 1+ (2\pi)^{\frac{1}{2}}bd\,\mbox{e}^{\frac{1}{2}b^2d^2}\Phi(bd),$
where $\Phi(x)$ is the cdf of $\mbox{N}(0,1)$.
With $d^2 = \frac{\sigma_2^2\cos^2\theta-\rho\sigma_1\sigma_2\sin2\theta+\sigma_1^2\sin^2\theta}{(1-\rho^2)\sigma_1^2\sigma_2^2}$ and $b = \frac{\mu_1\sigma_2(\sigma_2\cos\theta-\rho\sigma_1\sin\theta)+\mu_2\sigma_1(\sigma_1\sin\theta-\rho\sigma_2\cos\theta)}{\sigma_2^2\cos^2\theta-\rho\sigma_1\sigma_2\sin2\theta+\sigma_1^2\sin^2\theta}$,
you are going to obtain the pdf listed in the above paper.
|
How to derive the Projected normal distribution
There is a trick for calculating the pdf of 2-d projected normal, which can be found on pp. 52 of Mardia (1972).
After change of variable $x_1 = r\, \cos\theta$ and $x_2 = r\,\sin\theta$, we have
$f(
|
42,828
|
Comparing ISOMAP residual variance to PCA explained variance
|
The original Isomap paper defined "residual variance" as follows (reference 42):
$$\text{residual variance} = 1 - R^2(\hat D_M, D_y)$$
where $R$ is the Pearson correlation coefficient over all entries of $\hat D_M$ and $D_Y$. $\hat D_M$ is the euclidean distance matrix for PCA and the geodesic distance matrix for Isomap. $D_Y$ is the euclidean distance matrix of the low dimensional embedding, this matrix changes with the number of dimensions you use for the embedding.
EDIT:
This is numerically different than the explained variance of PCA derived from the eigenvalues and I don't know if there is a direct connection between the two of them.
EDIT:
I asked here for the connection between residual and explained variance.
|
Comparing ISOMAP residual variance to PCA explained variance
|
The original Isomap paper defined "residual variance" as follows (reference 42):
$$\text{residual variance} = 1 - R^2(\hat D_M, D_y)$$
where $R$ is the Pearson correlation coefficient over all entrie
|
Comparing ISOMAP residual variance to PCA explained variance
The original Isomap paper defined "residual variance" as follows (reference 42):
$$\text{residual variance} = 1 - R^2(\hat D_M, D_y)$$
where $R$ is the Pearson correlation coefficient over all entries of $\hat D_M$ and $D_Y$. $\hat D_M$ is the euclidean distance matrix for PCA and the geodesic distance matrix for Isomap. $D_Y$ is the euclidean distance matrix of the low dimensional embedding, this matrix changes with the number of dimensions you use for the embedding.
EDIT:
This is numerically different than the explained variance of PCA derived from the eigenvalues and I don't know if there is a direct connection between the two of them.
EDIT:
I asked here for the connection between residual and explained variance.
|
Comparing ISOMAP residual variance to PCA explained variance
The original Isomap paper defined "residual variance" as follows (reference 42):
$$\text{residual variance} = 1 - R^2(\hat D_M, D_y)$$
where $R$ is the Pearson correlation coefficient over all entrie
|
42,829
|
Finding the cluster centers in kernel k-means clustering
|
I think I found an answer. All you need to do in Kernel K means is to compute
$$
C^{(t+1)}(i) = argmin_k \{K(x_i,x_i) -\frac{2}{N_k}{\Sigma_{l\epsilon C^{t}_k}}K(x_i,x_l) +\frac{1}{N_k^2} {\Sigma_{{l,{l`}}\epsilon C^{t}_k} }K(x_l,x_{l`})\} ...(1)
$$
So this is the only operation that needs to be done. One need not to know each cluster center in high dimensional space. Just compute $(1)$ again and again till the algorithm converges.
Algorithm:
Step 1: Assign Random Cluster to points (Known as clsuter map $ C(i):= \{k: i\rightarrow k\}$ i.e point $i$ is assigned to cluster $k$
Step 2: For each point perform $(1)$ above and assign new $C(i)$.
Just to be more clear at this step:
$\rightarrow$After running this step for $(t-1)^{th} iteration $, you get a new $C^{(t)}(i)$ which will be used in (1) again to calculate $C^{(t+1)}(i)$
$\rightarrow$ So each iteration assigns new $C(i)$.Hence, $C^{(t)}(i)$ keeps on changing ( which is representative of cluster means).
Step 3: Repeat 2 above till the point assignments do not change or any of your error metric is stable.
(I am not sure about the error metric that should be used)
New Point:
Each new point will be classified according to $(1)$ above.
|
Finding the cluster centers in kernel k-means clustering
|
I think I found an answer. All you need to do in Kernel K means is to compute
$$
C^{(t+1)}(i) = argmin_k \{K(x_i,x_i) -\frac{2}{N_k}{\Sigma_{l\epsilon C^{t}_k}}K(x_i,x_l) +\frac{1}{N_k^2} {\Sigma_{{l
|
Finding the cluster centers in kernel k-means clustering
I think I found an answer. All you need to do in Kernel K means is to compute
$$
C^{(t+1)}(i) = argmin_k \{K(x_i,x_i) -\frac{2}{N_k}{\Sigma_{l\epsilon C^{t}_k}}K(x_i,x_l) +\frac{1}{N_k^2} {\Sigma_{{l,{l`}}\epsilon C^{t}_k} }K(x_l,x_{l`})\} ...(1)
$$
So this is the only operation that needs to be done. One need not to know each cluster center in high dimensional space. Just compute $(1)$ again and again till the algorithm converges.
Algorithm:
Step 1: Assign Random Cluster to points (Known as clsuter map $ C(i):= \{k: i\rightarrow k\}$ i.e point $i$ is assigned to cluster $k$
Step 2: For each point perform $(1)$ above and assign new $C(i)$.
Just to be more clear at this step:
$\rightarrow$After running this step for $(t-1)^{th} iteration $, you get a new $C^{(t)}(i)$ which will be used in (1) again to calculate $C^{(t+1)}(i)$
$\rightarrow$ So each iteration assigns new $C(i)$.Hence, $C^{(t)}(i)$ keeps on changing ( which is representative of cluster means).
Step 3: Repeat 2 above till the point assignments do not change or any of your error metric is stable.
(I am not sure about the error metric that should be used)
New Point:
Each new point will be classified according to $(1)$ above.
|
Finding the cluster centers in kernel k-means clustering
I think I found an answer. All you need to do in Kernel K means is to compute
$$
C^{(t+1)}(i) = argmin_k \{K(x_i,x_i) -\frac{2}{N_k}{\Sigma_{l\epsilon C^{t}_k}}K(x_i,x_l) +\frac{1}{N_k^2} {\Sigma_{{l
|
42,830
|
Finding the cluster centers in kernel k-means clustering
|
You can't compute the cluster centers. If we let $\Phi\::\: \mathbb{R}^p \to F$ be the map into the unknown feature space, then the center for a cluster $C_m$ is $$ \mu_m^\Phi = \frac{1}{n_m}\sum_{x_i \in C_m} \Phi(x_i),$$
where $n_m$ is the number of observations in cluster $C_m$. But, we don't know what $\Phi$ is (which is why we are using a kernel), and therefore we don't know $\mu_m^\Phi$.
The reason that we don't need to know $\mu_m^\Phi$ when performing kernel k-means is that during each iteration, a point $x$ is assigned to the cluster $C_m$ which minimizes
$$
\begin{align}
||\Phi(x) - \mu_m^\Phi||^2 &= \Phi(x)^\top\Phi(x) - \frac{1}{n_m}\sum_{x_i \in C_m}\Phi(x_i)^\top\Phi(x) - \frac{1}{n_m}\sum_{x_i \in C_m}\Phi(x)^\top\Phi(x_i) \\
&\phantom{=} + \frac{1}{n_m^2}\sum_{x_i \in C_m}\sum_{x_j \in C_m}\Phi(x_i)^\top\Phi(x_j) \\
&= K(x, x) - \frac{2}{n_m}\sum_{x_i \in C_m}K(x, x_i) + \frac{1}{n_m^2}\sum_{x_i \in C_m}\sum_{x_j \in C_m}K(x_i, x_j),
\end{align}
$$
assuming $K$ is a Mercer kernel.
|
Finding the cluster centers in kernel k-means clustering
|
You can't compute the cluster centers. If we let $\Phi\::\: \mathbb{R}^p \to F$ be the map into the unknown feature space, then the center for a cluster $C_m$ is $$ \mu_m^\Phi = \frac{1}{n_m}\sum_{x_i
|
Finding the cluster centers in kernel k-means clustering
You can't compute the cluster centers. If we let $\Phi\::\: \mathbb{R}^p \to F$ be the map into the unknown feature space, then the center for a cluster $C_m$ is $$ \mu_m^\Phi = \frac{1}{n_m}\sum_{x_i \in C_m} \Phi(x_i),$$
where $n_m$ is the number of observations in cluster $C_m$. But, we don't know what $\Phi$ is (which is why we are using a kernel), and therefore we don't know $\mu_m^\Phi$.
The reason that we don't need to know $\mu_m^\Phi$ when performing kernel k-means is that during each iteration, a point $x$ is assigned to the cluster $C_m$ which minimizes
$$
\begin{align}
||\Phi(x) - \mu_m^\Phi||^2 &= \Phi(x)^\top\Phi(x) - \frac{1}{n_m}\sum_{x_i \in C_m}\Phi(x_i)^\top\Phi(x) - \frac{1}{n_m}\sum_{x_i \in C_m}\Phi(x)^\top\Phi(x_i) \\
&\phantom{=} + \frac{1}{n_m^2}\sum_{x_i \in C_m}\sum_{x_j \in C_m}\Phi(x_i)^\top\Phi(x_j) \\
&= K(x, x) - \frac{2}{n_m}\sum_{x_i \in C_m}K(x, x_i) + \frac{1}{n_m^2}\sum_{x_i \in C_m}\sum_{x_j \in C_m}K(x_i, x_j),
\end{align}
$$
assuming $K$ is a Mercer kernel.
|
Finding the cluster centers in kernel k-means clustering
You can't compute the cluster centers. If we let $\Phi\::\: \mathbb{R}^p \to F$ be the map into the unknown feature space, then the center for a cluster $C_m$ is $$ \mu_m^\Phi = \frac{1}{n_m}\sum_{x_i
|
42,831
|
Can the curse of dimensionality be solved by changing the metric tensor?
|
Yes indeed, that is the case of the Isomap algorithm and Laplacians eigenmaps, for example. There are quite a few approaches listed in this article and also here. Some of them are implemented in scikit-learn.
|
Can the curse of dimensionality be solved by changing the metric tensor?
|
Yes indeed, that is the case of the Isomap algorithm and Laplacians eigenmaps, for example. There are quite a few approaches listed in this article and also here. Some of them are implemented in sciki
|
Can the curse of dimensionality be solved by changing the metric tensor?
Yes indeed, that is the case of the Isomap algorithm and Laplacians eigenmaps, for example. There are quite a few approaches listed in this article and also here. Some of them are implemented in scikit-learn.
|
Can the curse of dimensionality be solved by changing the metric tensor?
Yes indeed, that is the case of the Isomap algorithm and Laplacians eigenmaps, for example. There are quite a few approaches listed in this article and also here. Some of them are implemented in sciki
|
42,832
|
Is the value of $\alpha$ the same for all support vectors (SV) in the dual and what is the reason for it if they do or don't?
|
The cost function of SVM is:
$$\min_{\alpha,\xi,b} \frac{1}{2}\|\mathbf{w}\|^2 + C\sum_{i=1}^n \xi_i$$
where $\xi$ are the slack variables (0 for hard margin) and
$$
||\mathbf{w}||^2 =\mathbf{w}^T\mathbf{w} = \sum_{i\in \mathcal{S}}\sum_{j\in \mathcal{S}} \alpha_i \alpha_j y_i y_j \kappa(\mathbf{x}_i,\mathbf{x}_j)
$$
A couple of important properties can be derived from the Langrangian (here with slack variables):
$$L_p = \frac{1}{2}||\mathbf{w}||^2+C\sum_{i=1}^n\xi_i
-\sum_{i=1}^n\alpha_i\Big[y_i\big(<\mathbf{w},\varphi(\mathbf{x}_i)>+b\big)-(1-\xi_i)\Big]-\sum_{i=1}^n\mu_i\xi_i.
$$
By setting the partial derivative to $\xi$ (the slack variables) to zero, we obtain the following equation in $\alpha$:
$$\frac{\partial L_p}{\partial \xi_i}=0 \quad \rightarrow \quad
\alpha_i=C-\mu_i, \quad \forall i$$
In the presence of slack variables, all support values ($\alpha$'s) are bound by $0$ and $C$. They are not all equal.
In the absence of slack variables (hard margin SVM), $\alpha$ values are not equal because $\alpha$ is a direct part of the objective function as shown in the first two equations. In hard margin SVM, the cost function is a weighted quadratic function in $\alpha$ where the kernel evaluations between corresponding points determine the weights. Since not all weights are equal, the $\alpha$ values aren't either.
This is more apparant in least-squares SVM (LS-SVM), where all training points become support vectors due to the problem formulation. One of the original methods proposed to obtain sparsity in LS-SVM involved pruning support vectors with small $\alpha$ values.
|
Is the value of $\alpha$ the same for all support vectors (SV) in the dual and what is the reason fo
|
The cost function of SVM is:
$$\min_{\alpha,\xi,b} \frac{1}{2}\|\mathbf{w}\|^2 + C\sum_{i=1}^n \xi_i$$
where $\xi$ are the slack variables (0 for hard margin) and
$$
||\mathbf{w}||^2 =\mathbf{w}^T\mat
|
Is the value of $\alpha$ the same for all support vectors (SV) in the dual and what is the reason for it if they do or don't?
The cost function of SVM is:
$$\min_{\alpha,\xi,b} \frac{1}{2}\|\mathbf{w}\|^2 + C\sum_{i=1}^n \xi_i$$
where $\xi$ are the slack variables (0 for hard margin) and
$$
||\mathbf{w}||^2 =\mathbf{w}^T\mathbf{w} = \sum_{i\in \mathcal{S}}\sum_{j\in \mathcal{S}} \alpha_i \alpha_j y_i y_j \kappa(\mathbf{x}_i,\mathbf{x}_j)
$$
A couple of important properties can be derived from the Langrangian (here with slack variables):
$$L_p = \frac{1}{2}||\mathbf{w}||^2+C\sum_{i=1}^n\xi_i
-\sum_{i=1}^n\alpha_i\Big[y_i\big(<\mathbf{w},\varphi(\mathbf{x}_i)>+b\big)-(1-\xi_i)\Big]-\sum_{i=1}^n\mu_i\xi_i.
$$
By setting the partial derivative to $\xi$ (the slack variables) to zero, we obtain the following equation in $\alpha$:
$$\frac{\partial L_p}{\partial \xi_i}=0 \quad \rightarrow \quad
\alpha_i=C-\mu_i, \quad \forall i$$
In the presence of slack variables, all support values ($\alpha$'s) are bound by $0$ and $C$. They are not all equal.
In the absence of slack variables (hard margin SVM), $\alpha$ values are not equal because $\alpha$ is a direct part of the objective function as shown in the first two equations. In hard margin SVM, the cost function is a weighted quadratic function in $\alpha$ where the kernel evaluations between corresponding points determine the weights. Since not all weights are equal, the $\alpha$ values aren't either.
This is more apparant in least-squares SVM (LS-SVM), where all training points become support vectors due to the problem formulation. One of the original methods proposed to obtain sparsity in LS-SVM involved pruning support vectors with small $\alpha$ values.
|
Is the value of $\alpha$ the same for all support vectors (SV) in the dual and what is the reason fo
The cost function of SVM is:
$$\min_{\alpha,\xi,b} \frac{1}{2}\|\mathbf{w}\|^2 + C\sum_{i=1}^n \xi_i$$
where $\xi$ are the slack variables (0 for hard margin) and
$$
||\mathbf{w}||^2 =\mathbf{w}^T\mat
|
42,833
|
Bayesian hurdle model and predictions
|
Let's call the posterior predictive distribution $\tilde{Y}$.
$$\begin{align}\tilde{Y}_{\pi} &\sim\text{Bernoulli}(\pi)\\
\tilde{Y}_{\lambda} &\sim\text{Poisson}(\lambda)\\
\tilde{Y} &\sim\tilde{Y}_{\pi}*\tilde{Y}_{\lambda}\end{align}$$
You would need to truncate $\tilde{Y}_{\lambda}$ to be non-zero. Since you would then have a full predictive distribution, it would be easy to calculate intervals, expectations, etc.
Computation wise, this could be implemented in a number of ways. One possibility (in pseudo-code):
y_new = 0
y_pi = bernoulli_rng(pi)
if(y_pi==1)
while(y_new==0)
y_new = poisson_rng(lambda)
return y_new
|
Bayesian hurdle model and predictions
|
Let's call the posterior predictive distribution $\tilde{Y}$.
$$\begin{align}\tilde{Y}_{\pi} &\sim\text{Bernoulli}(\pi)\\
\tilde{Y}_{\lambda} &\sim\text{Poisson}(\lambda)\\
\tilde{Y} &\sim\tilde{Y}_{\
|
Bayesian hurdle model and predictions
Let's call the posterior predictive distribution $\tilde{Y}$.
$$\begin{align}\tilde{Y}_{\pi} &\sim\text{Bernoulli}(\pi)\\
\tilde{Y}_{\lambda} &\sim\text{Poisson}(\lambda)\\
\tilde{Y} &\sim\tilde{Y}_{\pi}*\tilde{Y}_{\lambda}\end{align}$$
You would need to truncate $\tilde{Y}_{\lambda}$ to be non-zero. Since you would then have a full predictive distribution, it would be easy to calculate intervals, expectations, etc.
Computation wise, this could be implemented in a number of ways. One possibility (in pseudo-code):
y_new = 0
y_pi = bernoulli_rng(pi)
if(y_pi==1)
while(y_new==0)
y_new = poisson_rng(lambda)
return y_new
|
Bayesian hurdle model and predictions
Let's call the posterior predictive distribution $\tilde{Y}$.
$$\begin{align}\tilde{Y}_{\pi} &\sim\text{Bernoulli}(\pi)\\
\tilde{Y}_{\lambda} &\sim\text{Poisson}(\lambda)\\
\tilde{Y} &\sim\tilde{Y}_{\
|
42,834
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
|
I wouldn't expect the distribution of the nearest neighbour distances to be uniform under spatial randomness.
According to Wikipedia (http://en.wikipedia.org/wiki/Complete_spatial_randomness), the distance of the first neighbour in your case has the following distribution:
$P_1(r) = 3\lambda r^2\exp(-\lambda r^3)$
where $\lambda$ is ta density dependent parameter. This is obviously non-uniform!
Concerning your clustering question: You can always cluster points, independently of their distribution.
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
|
I wouldn't expect the distribution of the nearest neighbour distances to be uniform under spatial randomness.
According to Wikipedia (http://en.wikipedia.org/wiki/Complete_spatial_randomness), the dis
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
I wouldn't expect the distribution of the nearest neighbour distances to be uniform under spatial randomness.
According to Wikipedia (http://en.wikipedia.org/wiki/Complete_spatial_randomness), the distance of the first neighbour in your case has the following distribution:
$P_1(r) = 3\lambda r^2\exp(-\lambda r^3)$
where $\lambda$ is ta density dependent parameter. This is obviously non-uniform!
Concerning your clustering question: You can always cluster points, independently of their distribution.
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
I wouldn't expect the distribution of the nearest neighbour distances to be uniform under spatial randomness.
According to Wikipedia (http://en.wikipedia.org/wiki/Complete_spatial_randomness), the dis
|
42,835
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
|
Consider a uniform 1 dimensional $U[0;1]$ distribution.
Probably the simplest distribution we can find, right?
The distribution of distances will not be uniform.
Instead (if I'm not mistaken; might only hold for the central area), it should be a Beta $B(k,n+1-k)$ distribution. If you are talking about the 1 nearest neigbor, that is a $B(1,n)$ distribution. This is only uniform, if $n=1$.
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
|
Consider a uniform 1 dimensional $U[0;1]$ distribution.
Probably the simplest distribution we can find, right?
The distribution of distances will not be uniform.
Instead (if I'm not mistaken; might on
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
Consider a uniform 1 dimensional $U[0;1]$ distribution.
Probably the simplest distribution we can find, right?
The distribution of distances will not be uniform.
Instead (if I'm not mistaken; might only hold for the central area), it should be a Beta $B(k,n+1-k)$ distribution. If you are talking about the 1 nearest neigbor, that is a $B(1,n)$ distribution. This is only uniform, if $n=1$.
|
How to generate random points in the volume of a sphere with uniform nearest neighbour distances
Consider a uniform 1 dimensional $U[0;1]$ distribution.
Probably the simplest distribution we can find, right?
The distribution of distances will not be uniform.
Instead (if I'm not mistaken; might on
|
42,836
|
use of t-test to compare performance of algorithms
|
I suggest using a paired t-test because the accuracies on different data sets should not be compared directly. Each data set you test on should form a pair in your t test.
Based on your example, you would be doing something like this in R to compare SIFT and SURF:
SIFT <- c(0.90, 0.84, 0.90, 0.45)
SURF <- c(0.84, 0.67, 0.45, 0.34)
SIFT_v_SURF <- t.test(SIFT,SURF,paired=TRUE,alternative="greater")
Note: by using a t-test you are assuming normality which may not be the case.
|
use of t-test to compare performance of algorithms
|
I suggest using a paired t-test because the accuracies on different data sets should not be compared directly. Each data set you test on should form a pair in your t test.
Based on your example, you w
|
use of t-test to compare performance of algorithms
I suggest using a paired t-test because the accuracies on different data sets should not be compared directly. Each data set you test on should form a pair in your t test.
Based on your example, you would be doing something like this in R to compare SIFT and SURF:
SIFT <- c(0.90, 0.84, 0.90, 0.45)
SURF <- c(0.84, 0.67, 0.45, 0.34)
SIFT_v_SURF <- t.test(SIFT,SURF,paired=TRUE,alternative="greater")
Note: by using a t-test you are assuming normality which may not be the case.
|
use of t-test to compare performance of algorithms
I suggest using a paired t-test because the accuracies on different data sets should not be compared directly. Each data set you test on should form a pair in your t test.
Based on your example, you w
|
42,837
|
use of t-test to compare performance of algorithms
|
The t-test is for comparing 2 groups (or one group to a theoretical value). With 3 groups (tests) you would need ANOVA and since there is blocking (the generalization of pairing) due to the different datasets you would be using randomized block ANOVA or a mixed effects model.
However, these methods depend on approximate normality and with the nature of your data, it is not likely to be approximately normal and your sample size is not large enough to invoke the CLT. A permutation test is probably your best option given your data.
Here is R code for one possible way to do a permutation test:
SIFT <- c(0.90, 0.84, 0.90, 0.45)
SURF <- c(0.84, 0.67, 0.45, 0.34)
ORB <- c(0.34, 0.45, 0.45, 0.23)
tmpdat <- rbind( SIFT, SURF, ORB )
tmpfun <- function(m) diff( range( rowMeans(m) ) )
out <- c( tmpfun(tmpdat),
replicate( 9999, tmpfun( apply(tmpdat, 2, sample) ) ) )
hist(out)
abline(v=out[1])
mean( out >= out[1] )
|
use of t-test to compare performance of algorithms
|
The t-test is for comparing 2 groups (or one group to a theoretical value). With 3 groups (tests) you would need ANOVA and since there is blocking (the generalization of pairing) due to the different
|
use of t-test to compare performance of algorithms
The t-test is for comparing 2 groups (or one group to a theoretical value). With 3 groups (tests) you would need ANOVA and since there is blocking (the generalization of pairing) due to the different datasets you would be using randomized block ANOVA or a mixed effects model.
However, these methods depend on approximate normality and with the nature of your data, it is not likely to be approximately normal and your sample size is not large enough to invoke the CLT. A permutation test is probably your best option given your data.
Here is R code for one possible way to do a permutation test:
SIFT <- c(0.90, 0.84, 0.90, 0.45)
SURF <- c(0.84, 0.67, 0.45, 0.34)
ORB <- c(0.34, 0.45, 0.45, 0.23)
tmpdat <- rbind( SIFT, SURF, ORB )
tmpfun <- function(m) diff( range( rowMeans(m) ) )
out <- c( tmpfun(tmpdat),
replicate( 9999, tmpfun( apply(tmpdat, 2, sample) ) ) )
hist(out)
abline(v=out[1])
mean( out >= out[1] )
|
use of t-test to compare performance of algorithms
The t-test is for comparing 2 groups (or one group to a theoretical value). With 3 groups (tests) you would need ANOVA and since there is blocking (the generalization of pairing) due to the different
|
42,838
|
use of t-test to compare performance of algorithms
|
Usually you don't summarise since performance of specific algorithm is related to the characteristics of the specific dataset. In literature you see phrases like "Algorithm X won in 5 out of 10 datasets".
However, if numbers are correct, in your case there is a clear winner and that's SIFT: it beats all other algorithms in all datasets.
|
use of t-test to compare performance of algorithms
|
Usually you don't summarise since performance of specific algorithm is related to the characteristics of the specific dataset. In literature you see phrases like "Algorithm X won in 5 out of 10 datase
|
use of t-test to compare performance of algorithms
Usually you don't summarise since performance of specific algorithm is related to the characteristics of the specific dataset. In literature you see phrases like "Algorithm X won in 5 out of 10 datasets".
However, if numbers are correct, in your case there is a clear winner and that's SIFT: it beats all other algorithms in all datasets.
|
use of t-test to compare performance of algorithms
Usually you don't summarise since performance of specific algorithm is related to the characteristics of the specific dataset. In literature you see phrases like "Algorithm X won in 5 out of 10 datase
|
42,839
|
Evaluating goodness of fit for distributions (e.g. LogNorm, Gamma, ...) with estimated parameters using KS tests (and R)
|
The paper from Clauset et al. warns (Section 4.2) against small sample sizes (< 100) which are much easier to fit. You may want to consider using the direct comparisons of models.
While the p-value of the KS statistic with estimated parameters is an overestimate, the bootstrapping procedure you described is able to tackle this and provides a correct p-value given enough simulations.
However, the way the goodness of fit is computed in your code is not correct as it does not strictly follow the procedure described in the paper, and implemented in the poweRlaw package.
Specifically: the synthetic data generation procedure is half implemented, it does not search for the best xmin as provided by the extimate_xmin function of the poweRlaw package, and finally the ks.test discards all the ties, which the package doesn't with its built-in KS test.
On this page is provided code that takes into account these issues using poweRlaw; as a consequence it is significantly slower than the code you suggested: http://notesnico.blogspot.com/2014/07/goodness-of-fit-test-for-log-normal-and.html
|
Evaluating goodness of fit for distributions (e.g. LogNorm, Gamma, ...) with estimated parameters us
|
The paper from Clauset et al. warns (Section 4.2) against small sample sizes (< 100) which are much easier to fit. You may want to consider using the direct comparisons of models.
While the p-value o
|
Evaluating goodness of fit for distributions (e.g. LogNorm, Gamma, ...) with estimated parameters using KS tests (and R)
The paper from Clauset et al. warns (Section 4.2) against small sample sizes (< 100) which are much easier to fit. You may want to consider using the direct comparisons of models.
While the p-value of the KS statistic with estimated parameters is an overestimate, the bootstrapping procedure you described is able to tackle this and provides a correct p-value given enough simulations.
However, the way the goodness of fit is computed in your code is not correct as it does not strictly follow the procedure described in the paper, and implemented in the poweRlaw package.
Specifically: the synthetic data generation procedure is half implemented, it does not search for the best xmin as provided by the extimate_xmin function of the poweRlaw package, and finally the ks.test discards all the ties, which the package doesn't with its built-in KS test.
On this page is provided code that takes into account these issues using poweRlaw; as a consequence it is significantly slower than the code you suggested: http://notesnico.blogspot.com/2014/07/goodness-of-fit-test-for-log-normal-and.html
|
Evaluating goodness of fit for distributions (e.g. LogNorm, Gamma, ...) with estimated parameters us
The paper from Clauset et al. warns (Section 4.2) against small sample sizes (< 100) which are much easier to fit. You may want to consider using the direct comparisons of models.
While the p-value o
|
42,840
|
Enforcing orthogonality of inputs for multiple linear regression
|
There are plenty of examples of orthogonal designs for continuous predictors in the experimental design literature. A simple one is the design matrix (using centred predictors)
$$\boldsymbol{X}=(\boldsymbol{I},\boldsymbol{x}_1,\boldsymbol{x}_2)=\left(\begin{matrix}
1 & -1 & -1\\
1 & -1 & 0\\
1 & -1 & 1\\
1 & 0 & -1\\
1 & 0 & 0\\
1 & 0 & 1\\
1 & 1 & -1\\
1 & 1 & 0\\
1 & 1 & 1\\
\end{matrix}\right)$$
for the linear regression $$y_i=\beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} +\varepsilon_i$$
The diagonal variance–covariance matrix for the parameter estimates
$$\operatorname{Var} \boldsymbol{\hat\beta}= (\boldsymbol{X}^\mathrm{T}\boldsymbol{X})^{-1}\sigma^2=\left(\begin{matrix}
\tfrac{1}{9} & 0 & 0\\
0 & \tfrac{1}{6} & 0\\
0 & 0 & \tfrac{1}{6}\\
\end{matrix}\right)\sigma^2$$
where $\sigma^2$ is the error variance, shows that you have uncorrelated estimators for $\beta_1$ & $\beta_2$
|
Enforcing orthogonality of inputs for multiple linear regression
|
There are plenty of examples of orthogonal designs for continuous predictors in the experimental design literature. A simple one is the design matrix (using centred predictors)
$$\boldsymbol{X}=(\bold
|
Enforcing orthogonality of inputs for multiple linear regression
There are plenty of examples of orthogonal designs for continuous predictors in the experimental design literature. A simple one is the design matrix (using centred predictors)
$$\boldsymbol{X}=(\boldsymbol{I},\boldsymbol{x}_1,\boldsymbol{x}_2)=\left(\begin{matrix}
1 & -1 & -1\\
1 & -1 & 0\\
1 & -1 & 1\\
1 & 0 & -1\\
1 & 0 & 0\\
1 & 0 & 1\\
1 & 1 & -1\\
1 & 1 & 0\\
1 & 1 & 1\\
\end{matrix}\right)$$
for the linear regression $$y_i=\beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} +\varepsilon_i$$
The diagonal variance–covariance matrix for the parameter estimates
$$\operatorname{Var} \boldsymbol{\hat\beta}= (\boldsymbol{X}^\mathrm{T}\boldsymbol{X})^{-1}\sigma^2=\left(\begin{matrix}
\tfrac{1}{9} & 0 & 0\\
0 & \tfrac{1}{6} & 0\\
0 & 0 & \tfrac{1}{6}\\
\end{matrix}\right)\sigma^2$$
where $\sigma^2$ is the error variance, shows that you have uncorrelated estimators for $\beta_1$ & $\beta_2$
|
Enforcing orthogonality of inputs for multiple linear regression
There are plenty of examples of orthogonal designs for continuous predictors in the experimental design literature. A simple one is the design matrix (using centred predictors)
$$\boldsymbol{X}=(\bold
|
42,841
|
Estimating successes while obtaining Bernoulli samples
|
Given that I've already seen k successes on n samples of a Bernoulli
distribution with unknown parameter p, what is the probability that,
if I keep sampling from the same distribution, after N observations
(say N=100), I'll see at least K successes (say K=10).
A Bayesian answer to this question is:
$$
\Theta\sim\mathrm{U}[0,1], \qquad X\mid\Theta\sim\mathrm{Bin}(n,\Theta), \qquad Y\mid\Theta\sim\mathrm{Bin}(N,\Theta) \, .
$$
$$
\begin{eqnarray}
P(Y\geq K&\mid& X=k) = \sum_{m=K}^N P(Y=m\mid X=k) \\
&=& \sum_{m=K}^N \int_0^1 f_{Y\mid\Theta}(m\mid\theta) f_{\Theta\mid X}(\theta\mid k)\,d\theta \qquad\qquad\qquad\qquad\qquad (*) \\
&=& \frac{\Gamma(n+2)}{\Gamma(k+1)\Gamma(n-k+1)} \sum_{m=K}^N {N \choose m} \int_0^1 \theta^{m+k}(1-\theta)^{N+n-m-k} \, d\theta \\
&=& \frac{(n+1)!}{k!(n-k)!} \sum_{m=K}^N \left( {N \choose m} \frac{\Gamma(m+k+1)\Gamma(N+n-m-k+1)}{\Gamma(N+n+2)} \right) \\
&=& \frac{(n+1)!}{k!(n-k)!(N+n+1)!} \sum_{m=K}^N \left( {N \choose m} (m+k)!(N+n-m-k)! \right)\, .
\end{eqnarray}
$$
The $(*)$ equality follows from the theorem of total probability, the product rule, and the conditional independence of $Y$ and $X$, given $\Theta$:
$$
\begin{eqnarray}
f_{Y\mid X}(m\mid k) &=& \int f_{Y,\Theta\mid X}(m,\theta\mid k) \,d\theta \\
&=& \int f_{Y\mid\Theta, X}(m\mid\theta,k) f_{\Theta\mid X}(\theta\mid k) \,d\theta \\
&=& \int f_{Y\mid\Theta}(m\mid\theta) f_{\Theta\mid X}(\theta\mid k) \,d\theta \, .
\end{eqnarray}
$$
|
Estimating successes while obtaining Bernoulli samples
|
Given that I've already seen k successes on n samples of a Bernoulli
distribution with unknown parameter p, what is the probability that,
if I keep sampling from the same distribution, after N obs
|
Estimating successes while obtaining Bernoulli samples
Given that I've already seen k successes on n samples of a Bernoulli
distribution with unknown parameter p, what is the probability that,
if I keep sampling from the same distribution, after N observations
(say N=100), I'll see at least K successes (say K=10).
A Bayesian answer to this question is:
$$
\Theta\sim\mathrm{U}[0,1], \qquad X\mid\Theta\sim\mathrm{Bin}(n,\Theta), \qquad Y\mid\Theta\sim\mathrm{Bin}(N,\Theta) \, .
$$
$$
\begin{eqnarray}
P(Y\geq K&\mid& X=k) = \sum_{m=K}^N P(Y=m\mid X=k) \\
&=& \sum_{m=K}^N \int_0^1 f_{Y\mid\Theta}(m\mid\theta) f_{\Theta\mid X}(\theta\mid k)\,d\theta \qquad\qquad\qquad\qquad\qquad (*) \\
&=& \frac{\Gamma(n+2)}{\Gamma(k+1)\Gamma(n-k+1)} \sum_{m=K}^N {N \choose m} \int_0^1 \theta^{m+k}(1-\theta)^{N+n-m-k} \, d\theta \\
&=& \frac{(n+1)!}{k!(n-k)!} \sum_{m=K}^N \left( {N \choose m} \frac{\Gamma(m+k+1)\Gamma(N+n-m-k+1)}{\Gamma(N+n+2)} \right) \\
&=& \frac{(n+1)!}{k!(n-k)!(N+n+1)!} \sum_{m=K}^N \left( {N \choose m} (m+k)!(N+n-m-k)! \right)\, .
\end{eqnarray}
$$
The $(*)$ equality follows from the theorem of total probability, the product rule, and the conditional independence of $Y$ and $X$, given $\Theta$:
$$
\begin{eqnarray}
f_{Y\mid X}(m\mid k) &=& \int f_{Y,\Theta\mid X}(m,\theta\mid k) \,d\theta \\
&=& \int f_{Y\mid\Theta, X}(m\mid\theta,k) f_{\Theta\mid X}(\theta\mid k) \,d\theta \\
&=& \int f_{Y\mid\Theta}(m\mid\theta) f_{\Theta\mid X}(\theta\mid k) \,d\theta \, .
\end{eqnarray}
$$
|
Estimating successes while obtaining Bernoulli samples
Given that I've already seen k successes on n samples of a Bernoulli
distribution with unknown parameter p, what is the probability that,
if I keep sampling from the same distribution, after N obs
|
42,842
|
Estimating successes while obtaining Bernoulli samples
|
This sounds like the perfect job for Bayesian parameter estimation. So the model you have is:
$$ k \sim \text{Binom}(p,n) $$
And what you want to know is the probability of $p > 0.1$. Using Bayesian parameter estimation there is nothing stopping you from estimating $\text{prob}(p > 0.1)$ at $n=1, n=2, \dots$ and stopping when the probability $\text{prob}(p > 0.1)$ is too small ("these parameters are probably not going to work") or large enough ("These parameters are probably going to work"). The two things you have to decide is: (1) What are the probability cut-offs when you are going to stop and either keep the parameters because they seem good or toss the parameters and try some new ones. (2) A prior probability for what values of $p$ are likely before you start your experiment. For (2) a reasonable starting point could be to assume a "flat prior", that is, assume that all values of $p$ are equally likely before having seen any data. If, as you state, the typical value of $p$ seems small there might be priors that better reflect the information you have.
A great introduction to how to do Bayesian inference on binomial proportions can be found here.
I don't know if you use R but a quick function that calculates $p > 0.1$ given $k$ and $n$ would be:
bin_prob <- function(k, n) {
mean(rbeta(99999, 1 + k, 1 + (n - k)) > 0.1)
}
This however assumes that before seeing any data all possible values of $p$ are equally probable. That is, before seeing any data the probability of $p > 0.1$ is 0.9. A function that perhaps would be better calibrated to your prior information would be:
bin_prob <- function(k, n) {
mean(rbeta(99999, 1 + k, 6.6 + (n - k)) > 0.1)
}
This function assumes that prior to any data the probability of $p > 0.1$ is 50%. Here follows some sample output:
> bin_prob(k=0, n=0)
[1] 0.5
> bin_prob(k=0, n=1)
[1] 0.448
> bin_prob(k=1, n=1)
[1] 0.829
> bin_prob(k=0, n=4)
[1] 0.328
> bin_prob(k=4, n=4)
[1] 0.998
> bin_prob(k=8, n=25)
[1] 0.997
> bin_prob(k=0, n=25)
[1] 0.037
|
Estimating successes while obtaining Bernoulli samples
|
This sounds like the perfect job for Bayesian parameter estimation. So the model you have is:
$$ k \sim \text{Binom}(p,n) $$
And what you want to know is the probability of $p > 0.1$. Using Bayesian p
|
Estimating successes while obtaining Bernoulli samples
This sounds like the perfect job for Bayesian parameter estimation. So the model you have is:
$$ k \sim \text{Binom}(p,n) $$
And what you want to know is the probability of $p > 0.1$. Using Bayesian parameter estimation there is nothing stopping you from estimating $\text{prob}(p > 0.1)$ at $n=1, n=2, \dots$ and stopping when the probability $\text{prob}(p > 0.1)$ is too small ("these parameters are probably not going to work") or large enough ("These parameters are probably going to work"). The two things you have to decide is: (1) What are the probability cut-offs when you are going to stop and either keep the parameters because they seem good or toss the parameters and try some new ones. (2) A prior probability for what values of $p$ are likely before you start your experiment. For (2) a reasonable starting point could be to assume a "flat prior", that is, assume that all values of $p$ are equally likely before having seen any data. If, as you state, the typical value of $p$ seems small there might be priors that better reflect the information you have.
A great introduction to how to do Bayesian inference on binomial proportions can be found here.
I don't know if you use R but a quick function that calculates $p > 0.1$ given $k$ and $n$ would be:
bin_prob <- function(k, n) {
mean(rbeta(99999, 1 + k, 1 + (n - k)) > 0.1)
}
This however assumes that before seeing any data all possible values of $p$ are equally probable. That is, before seeing any data the probability of $p > 0.1$ is 0.9. A function that perhaps would be better calibrated to your prior information would be:
bin_prob <- function(k, n) {
mean(rbeta(99999, 1 + k, 6.6 + (n - k)) > 0.1)
}
This function assumes that prior to any data the probability of $p > 0.1$ is 50%. Here follows some sample output:
> bin_prob(k=0, n=0)
[1] 0.5
> bin_prob(k=0, n=1)
[1] 0.448
> bin_prob(k=1, n=1)
[1] 0.829
> bin_prob(k=0, n=4)
[1] 0.328
> bin_prob(k=4, n=4)
[1] 0.998
> bin_prob(k=8, n=25)
[1] 0.997
> bin_prob(k=0, n=25)
[1] 0.037
|
Estimating successes while obtaining Bernoulli samples
This sounds like the perfect job for Bayesian parameter estimation. So the model you have is:
$$ k \sim \text{Binom}(p,n) $$
And what you want to know is the probability of $p > 0.1$. Using Bayesian p
|
42,843
|
Ordinal regression: proportional odds assumption
|
First off, are your two independent variables being adjusted as factors or numerically coded responses and is there an interaction term for the two? The reason I ask is because the test of proportional odds grows very sensitive with small cell counts. For this reason, I often find it justifiable to adjust input variables as their ordinally coded values (1: poor, 2: fair-to-poor, etc.). Doing so allows information to be borrowed across groups, proportionality is assessed so that an associated difference in the odds of a more favorable response comparing units differing by 1 in the predictor are consistent with odds of an even more favorable response (the rough and contrived interpretation of the test of proportional odds).
If your numeric coding still fails to give valid proportionality, it is possible to get consistent cumulative odds ratios estimates by collapsing adjacent categories like the two bottom box responses.
Thirdly, another powered test of association between an ordinal response and two ordinal factors is a plain old linear regression model. Using robust standard errors, you get valid confidence intervals despite the distribution of the errors. This tends to be less powerful that categorical methods, but with fewer pitfalls due to zero cell counts.
Lastly, as a comment, robust standard errors allow consistent estimation of the mean model in most circumstances. I'm not sure if these are implemented in SPSS, but R and SAS use these frequently. As with the proportional hazards assumption in the Cox model, when this "model based assumption check" fails, it does not mean the model results are entirely invalid, it's just that the effect estimates are "averaged" over their inconsistent proportionality. For instance, if proportional odds model has excessive numbers of respondents giving top box responses, and a predictor shows a large association for the top box response but smaller association for other cumulative measures, then you'll find that the cumulative odds ratio is a weighted combination of the several thresholded odds ratios, with a higher weight placed upon the top box OR.
|
Ordinal regression: proportional odds assumption
|
First off, are your two independent variables being adjusted as factors or numerically coded responses and is there an interaction term for the two? The reason I ask is because the test of proportiona
|
Ordinal regression: proportional odds assumption
First off, are your two independent variables being adjusted as factors or numerically coded responses and is there an interaction term for the two? The reason I ask is because the test of proportional odds grows very sensitive with small cell counts. For this reason, I often find it justifiable to adjust input variables as their ordinally coded values (1: poor, 2: fair-to-poor, etc.). Doing so allows information to be borrowed across groups, proportionality is assessed so that an associated difference in the odds of a more favorable response comparing units differing by 1 in the predictor are consistent with odds of an even more favorable response (the rough and contrived interpretation of the test of proportional odds).
If your numeric coding still fails to give valid proportionality, it is possible to get consistent cumulative odds ratios estimates by collapsing adjacent categories like the two bottom box responses.
Thirdly, another powered test of association between an ordinal response and two ordinal factors is a plain old linear regression model. Using robust standard errors, you get valid confidence intervals despite the distribution of the errors. This tends to be less powerful that categorical methods, but with fewer pitfalls due to zero cell counts.
Lastly, as a comment, robust standard errors allow consistent estimation of the mean model in most circumstances. I'm not sure if these are implemented in SPSS, but R and SAS use these frequently. As with the proportional hazards assumption in the Cox model, when this "model based assumption check" fails, it does not mean the model results are entirely invalid, it's just that the effect estimates are "averaged" over their inconsistent proportionality. For instance, if proportional odds model has excessive numbers of respondents giving top box responses, and a predictor shows a large association for the top box response but smaller association for other cumulative measures, then you'll find that the cumulative odds ratio is a weighted combination of the several thresholded odds ratios, with a higher weight placed upon the top box OR.
|
Ordinal regression: proportional odds assumption
First off, are your two independent variables being adjusted as factors or numerically coded responses and is there an interaction term for the two? The reason I ask is because the test of proportiona
|
42,844
|
Relation between autocorrelation function and periodogram in time series analysis
|
The relation between the autocovariance (or autocorrelation) and the spectral density (for which the periodogram is an estimator) is given by the Fourier transform. The two form a so-called Fourier-transform pair meaning the two are time(or space)-domain vs. frequency-domain representations of the same thing. Specifically, if time series $\{X_t\}$ has autovariance function $\gamma(\tau)$ at time lag $\tau$, then the spectral density is defined by
\begin{equation}
f(\nu)=\sum\limits_{\tau=-\infty}^{\infty} \gamma(\tau)e^{-2i\pi\nu\tau}.
\end{equation}
In words, the spectral density partitions the autocovariance as energy-per-hertz of a signal. For example, if you have a deterministic signal with period $t=12$, then the series lagged with itself (ACF) at lag 12 will be perfectly correlated (autocorrelation=1). Subsequently, all power in the spectral density will be concentrated at frequency $1/t$.
|
Relation between autocorrelation function and periodogram in time series analysis
|
The relation between the autocovariance (or autocorrelation) and the spectral density (for which the periodogram is an estimator) is given by the Fourier transform. The two form a so-called Fourier-tr
|
Relation between autocorrelation function and periodogram in time series analysis
The relation between the autocovariance (or autocorrelation) and the spectral density (for which the periodogram is an estimator) is given by the Fourier transform. The two form a so-called Fourier-transform pair meaning the two are time(or space)-domain vs. frequency-domain representations of the same thing. Specifically, if time series $\{X_t\}$ has autovariance function $\gamma(\tau)$ at time lag $\tau$, then the spectral density is defined by
\begin{equation}
f(\nu)=\sum\limits_{\tau=-\infty}^{\infty} \gamma(\tau)e^{-2i\pi\nu\tau}.
\end{equation}
In words, the spectral density partitions the autocovariance as energy-per-hertz of a signal. For example, if you have a deterministic signal with period $t=12$, then the series lagged with itself (ACF) at lag 12 will be perfectly correlated (autocorrelation=1). Subsequently, all power in the spectral density will be concentrated at frequency $1/t$.
|
Relation between autocorrelation function and periodogram in time series analysis
The relation between the autocovariance (or autocorrelation) and the spectral density (for which the periodogram is an estimator) is given by the Fourier transform. The two form a so-called Fourier-tr
|
42,845
|
Average over two variables: Why do standard error of mean and error propagation differ and what does that mean?
|
If you take the standard deviation of your two values (first way you suggested), this does not include the error within each measurement, only the error between the two methods (heating vs. cooling). That is why the first way shows surprisingly low standard deviation- it's only incorporating one of the sources of error.
Therefore, the correct way is to propagate error (the second way you suggested). This incorporates both the measurement error of each value and the error between your two methods.
(Also a note based on the question comments: the manufacturer error listed is the +/- range guaranteed by the company based on all the devices they make. So yes, it does save you time if you use it as the equipment's error, but if you take many measurements of the same thing yourself you can calculate the error of your specific equipment and that can be more precise than the range guaranteed by the manufacturer. I don't know about thermometers, but this is what analytical chemists do with their glassware.)
|
Average over two variables: Why do standard error of mean and error propagation differ and what does
|
If you take the standard deviation of your two values (first way you suggested), this does not include the error within each measurement, only the error between the two methods (heating vs. cooling).
|
Average over two variables: Why do standard error of mean and error propagation differ and what does that mean?
If you take the standard deviation of your two values (first way you suggested), this does not include the error within each measurement, only the error between the two methods (heating vs. cooling). That is why the first way shows surprisingly low standard deviation- it's only incorporating one of the sources of error.
Therefore, the correct way is to propagate error (the second way you suggested). This incorporates both the measurement error of each value and the error between your two methods.
(Also a note based on the question comments: the manufacturer error listed is the +/- range guaranteed by the company based on all the devices they make. So yes, it does save you time if you use it as the equipment's error, but if you take many measurements of the same thing yourself you can calculate the error of your specific equipment and that can be more precise than the range guaranteed by the manufacturer. I don't know about thermometers, but this is what analytical chemists do with their glassware.)
|
Average over two variables: Why do standard error of mean and error propagation differ and what does
If you take the standard deviation of your two values (first way you suggested), this does not include the error within each measurement, only the error between the two methods (heating vs. cooling).
|
42,846
|
What is a "factor" in factor analysis?
|
The usual factor analysis model is
$$\mathbf{Y} = \mathbf{\mu}+ \mathbf{\Phi}\mathbf{L} + \mathbf{\eta},$$
where $\mathbf{Y}$ represents a collection of $n$ observations of $k$ random variables; i.e. it is a matrix of $n \times k$ size. $\mathbf{\mu} = \mathbf{1}_n^{\prime} (\mu_1, \mu_2, \ldots, \mu_k)$
is also an $n\times k$ matrix, constant in each column, giving the
means of the $k$ variables. $\mathbf{\Phi}$ is a $n\times p$ matrix of $p \le k$ factors; $\mathbf{L}$ is an $p \times n$ matrix of (unknown) constants (to be estimated); and $\mathbf{\eta}$ is an $n \times k$ matrix of errors. The rows of $\mathbf{\eta}$ are independent and independent of $\Phi$. The elements within row $i$ have mean $0$ and variance $\sigma_i^2$. The quantities on the right hand side are unobservable but (usually) fewer in number than the $nk$ data values, and so are (up to a degree of ambiguity discussed below) identifiable. Note that $\eta$ is not to be identified, but only its row variances $\sigma_i^2$, called "uniquenesses".
In the language of factor analysis, the factors are the columns of $\mathbf{\Phi}$. From $k$ original variables it extracts $p\lt k$ factors. One can say that a "factor" is a whole column; i.e., a collection of $n$ realizations of a random variable, or, more abstractly, a random variable itself. Usually it is assumed that the factors are uncorrelated and standardized, i.e. have unit variance.
The rows of $\mathbf{L}$ are called factor loadings.
Note that this model is unique only up to orthogonal transformations, in that
$$\mathbf{Y} = \mathbf{\mu}+ (\mathbf{\Phi P^\top})(\mathbf{PL}) + \mathbf{\eta},$$
where $\mathbf{P}$ is any orthogonal matrix.
|
What is a "factor" in factor analysis?
|
The usual factor analysis model is
$$\mathbf{Y} = \mathbf{\mu}+ \mathbf{\Phi}\mathbf{L} + \mathbf{\eta},$$
where $\mathbf{Y}$ represents a collection of $n$ observations of $k$ random variables; i.e.
|
What is a "factor" in factor analysis?
The usual factor analysis model is
$$\mathbf{Y} = \mathbf{\mu}+ \mathbf{\Phi}\mathbf{L} + \mathbf{\eta},$$
where $\mathbf{Y}$ represents a collection of $n$ observations of $k$ random variables; i.e. it is a matrix of $n \times k$ size. $\mathbf{\mu} = \mathbf{1}_n^{\prime} (\mu_1, \mu_2, \ldots, \mu_k)$
is also an $n\times k$ matrix, constant in each column, giving the
means of the $k$ variables. $\mathbf{\Phi}$ is a $n\times p$ matrix of $p \le k$ factors; $\mathbf{L}$ is an $p \times n$ matrix of (unknown) constants (to be estimated); and $\mathbf{\eta}$ is an $n \times k$ matrix of errors. The rows of $\mathbf{\eta}$ are independent and independent of $\Phi$. The elements within row $i$ have mean $0$ and variance $\sigma_i^2$. The quantities on the right hand side are unobservable but (usually) fewer in number than the $nk$ data values, and so are (up to a degree of ambiguity discussed below) identifiable. Note that $\eta$ is not to be identified, but only its row variances $\sigma_i^2$, called "uniquenesses".
In the language of factor analysis, the factors are the columns of $\mathbf{\Phi}$. From $k$ original variables it extracts $p\lt k$ factors. One can say that a "factor" is a whole column; i.e., a collection of $n$ realizations of a random variable, or, more abstractly, a random variable itself. Usually it is assumed that the factors are uncorrelated and standardized, i.e. have unit variance.
The rows of $\mathbf{L}$ are called factor loadings.
Note that this model is unique only up to orthogonal transformations, in that
$$\mathbf{Y} = \mathbf{\mu}+ (\mathbf{\Phi P^\top})(\mathbf{PL}) + \mathbf{\eta},$$
where $\mathbf{P}$ is any orthogonal matrix.
|
What is a "factor" in factor analysis?
The usual factor analysis model is
$$\mathbf{Y} = \mathbf{\mu}+ \mathbf{\Phi}\mathbf{L} + \mathbf{\eta},$$
where $\mathbf{Y}$ represents a collection of $n$ observations of $k$ random variables; i.e.
|
42,847
|
What is a "factor" in factor analysis?
|
Factor is a vector. The set of factors give you a coordinate system, a basis. Factor loadings are sets of coordinates in this basis.
Let's say you have a $T\times n$ matrix $X=x_{ti}$. Imagine that it's a path of particle in n-dimensional space, where $t$ is time, and $i$ is the dimension.
What factor analysis does is simply change the coordinate system from your current basis to something else, then your $X$ matrix becomes a $T\times n$ matrix $A=a_{ti}$. It's the same path in time, except in different coordinates. The actual coordinates of a point at time $t$ are called loadings or a score in PCA, i.e. each row is a particular point in time, a loading.
The reason to transform the coordinates is usually convenience or clarity. For instance, these would be coordinates of circular motion in cartesian system (x,y):
0.8415 0.5403
0.9093 -0.4161
0.1411 -0.9900
-0.7568 -0.6536
-0.9589 0.2837
-0.2794 0.9602
0.6570 0.7539
0.9894 -0.1455
0.4121 -0.9111
-0.5440 -0.8391
Here's the same in polar system (angle,radius):
1.0000 1.0000
2.0000 1.0000
3.0000 1.0000
4.0000 1.0000
5.0000 1.0000
6.0000 1.0000
0.7168 1.0000
1.7168 1.0000
2.7168 1.0000
3.7168 1.0000
The polar system is obviously suited better for this process, as you can shrink the dimensionality of the system. It's essentially one-dimensional motion along the circle's circumference.
Factor analysis is usually linear in some way, and doesn't do cool stuff like this, but still works for many processes.
|
What is a "factor" in factor analysis?
|
Factor is a vector. The set of factors give you a coordinate system, a basis. Factor loadings are sets of coordinates in this basis.
Let's say you have a $T\times n$ matrix $X=x_{ti}$. Imagine that it
|
What is a "factor" in factor analysis?
Factor is a vector. The set of factors give you a coordinate system, a basis. Factor loadings are sets of coordinates in this basis.
Let's say you have a $T\times n$ matrix $X=x_{ti}$. Imagine that it's a path of particle in n-dimensional space, where $t$ is time, and $i$ is the dimension.
What factor analysis does is simply change the coordinate system from your current basis to something else, then your $X$ matrix becomes a $T\times n$ matrix $A=a_{ti}$. It's the same path in time, except in different coordinates. The actual coordinates of a point at time $t$ are called loadings or a score in PCA, i.e. each row is a particular point in time, a loading.
The reason to transform the coordinates is usually convenience or clarity. For instance, these would be coordinates of circular motion in cartesian system (x,y):
0.8415 0.5403
0.9093 -0.4161
0.1411 -0.9900
-0.7568 -0.6536
-0.9589 0.2837
-0.2794 0.9602
0.6570 0.7539
0.9894 -0.1455
0.4121 -0.9111
-0.5440 -0.8391
Here's the same in polar system (angle,radius):
1.0000 1.0000
2.0000 1.0000
3.0000 1.0000
4.0000 1.0000
5.0000 1.0000
6.0000 1.0000
0.7168 1.0000
1.7168 1.0000
2.7168 1.0000
3.7168 1.0000
The polar system is obviously suited better for this process, as you can shrink the dimensionality of the system. It's essentially one-dimensional motion along the circle's circumference.
Factor analysis is usually linear in some way, and doesn't do cool stuff like this, but still works for many processes.
|
What is a "factor" in factor analysis?
Factor is a vector. The set of factors give you a coordinate system, a basis. Factor loadings are sets of coordinates in this basis.
Let's say you have a $T\times n$ matrix $X=x_{ti}$. Imagine that it
|
42,848
|
Time series dynamic poisson regression
|
It looks like a zero-inflated Poisson or negative binomial dynamic model would be adequate. If you are using R, you might want to look at package ZIM.
|
Time series dynamic poisson regression
|
It looks like a zero-inflated Poisson or negative binomial dynamic model would be adequate. If you are using R, you might want to look at package ZIM.
|
Time series dynamic poisson regression
It looks like a zero-inflated Poisson or negative binomial dynamic model would be adequate. If you are using R, you might want to look at package ZIM.
|
Time series dynamic poisson regression
It looks like a zero-inflated Poisson or negative binomial dynamic model would be adequate. If you are using R, you might want to look at package ZIM.
|
42,849
|
Degenerate random variable
|
NO. Let $X$ be any variable and $Y$ independent such that $Y=0$ with probability 1. Then $XY$ is degenerate, but $X$ need not be.
This was already answered in comments:
No. Only one of them needs to be. Let $X$ be zero with probability 1 and let $Y$ be any finite-valued random variable. – Macro
To complete @Macro's thought, consider the contrapositive: when both X and Y are nondegenerate, independence implies XY must be nondegenerate. Therefore Macro has supplied all the possible counterexamples (up to permutation of X and Y). – whuber
|
Degenerate random variable
|
NO. Let $X$ be any variable and $Y$ independent such that $Y=0$ with probability 1. Then $XY$ is degenerate, but $X$ need not be.
This was already answered in comments:
No. Only one of them needs to
|
Degenerate random variable
NO. Let $X$ be any variable and $Y$ independent such that $Y=0$ with probability 1. Then $XY$ is degenerate, but $X$ need not be.
This was already answered in comments:
No. Only one of them needs to be. Let $X$ be zero with probability 1 and let $Y$ be any finite-valued random variable. – Macro
To complete @Macro's thought, consider the contrapositive: when both X and Y are nondegenerate, independence implies XY must be nondegenerate. Therefore Macro has supplied all the possible counterexamples (up to permutation of X and Y). – whuber
|
Degenerate random variable
NO. Let $X$ be any variable and $Y$ independent such that $Y=0$ with probability 1. Then $XY$ is degenerate, but $X$ need not be.
This was already answered in comments:
No. Only one of them needs to
|
42,850
|
Create 3 correlated variables with pre-specified correlations [duplicate]
|
You could do something like this:
library(mvtnorm)
x = 3.3
sig = matrix(c(30,x,x,x,x,1,.7,.7,x,.7,1,.7,x,.7,.7,1),nrow=4)
X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
round(cor(X),2)
Y = rmvnorm(10000,mean=rep(0,4),sigma=sig,method="svd")
round(cor(Y),2)
Not the structure of the covariance matrix:
> sig
[,1] [,2] [,3] [,4]
[1,] 30.0 3.3 3.3 3.3
[2,] 3.3 1.0 0.7 0.7
[3,] 3.3 0.7 1.0 0.7
[4,] 3.3 0.7 0.7 1.0
Now, as you can see with only 100 samples the calculated correlation is:
> X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
> round(cor(X),2)
[,1] [,2] [,3] [,4]
[1,] 1.00 0.70 0.59 0.67
[2,] 0.70 1.00 0.72 0.73
[3,] 0.59 0.72 1.00 0.74
[4,] 0.67 0.73 0.74 1.00
and with 100,000 samples the calculated correlation is:
> Y = rmvnorm(100000,mean=rep(0,4),sigma=sig,method="svd")
> round(cor(Y),2)
[,1] [,2] [,3] [,4]
[1,] 1.0 0.6 0.6 0.6
[2,] 0.6 1.0 0.7 0.7
[3,] 0.6 0.7 1.0 0.7
[4,] 0.6 0.7 0.7 1.0
|
Create 3 correlated variables with pre-specified correlations [duplicate]
|
You could do something like this:
library(mvtnorm)
x = 3.3
sig = matrix(c(30,x,x,x,x,1,.7,.7,x,.7,1,.7,x,.7,.7,1),nrow=4)
X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
round(cor(X),2)
Y = r
|
Create 3 correlated variables with pre-specified correlations [duplicate]
You could do something like this:
library(mvtnorm)
x = 3.3
sig = matrix(c(30,x,x,x,x,1,.7,.7,x,.7,1,.7,x,.7,.7,1),nrow=4)
X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
round(cor(X),2)
Y = rmvnorm(10000,mean=rep(0,4),sigma=sig,method="svd")
round(cor(Y),2)
Not the structure of the covariance matrix:
> sig
[,1] [,2] [,3] [,4]
[1,] 30.0 3.3 3.3 3.3
[2,] 3.3 1.0 0.7 0.7
[3,] 3.3 0.7 1.0 0.7
[4,] 3.3 0.7 0.7 1.0
Now, as you can see with only 100 samples the calculated correlation is:
> X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
> round(cor(X),2)
[,1] [,2] [,3] [,4]
[1,] 1.00 0.70 0.59 0.67
[2,] 0.70 1.00 0.72 0.73
[3,] 0.59 0.72 1.00 0.74
[4,] 0.67 0.73 0.74 1.00
and with 100,000 samples the calculated correlation is:
> Y = rmvnorm(100000,mean=rep(0,4),sigma=sig,method="svd")
> round(cor(Y),2)
[,1] [,2] [,3] [,4]
[1,] 1.0 0.6 0.6 0.6
[2,] 0.6 1.0 0.7 0.7
[3,] 0.6 0.7 1.0 0.7
[4,] 0.6 0.7 0.7 1.0
|
Create 3 correlated variables with pre-specified correlations [duplicate]
You could do something like this:
library(mvtnorm)
x = 3.3
sig = matrix(c(30,x,x,x,x,1,.7,.7,x,.7,1,.7,x,.7,.7,1),nrow=4)
X = rmvnorm(100,mean=rep(0,4),sigma=sig,method="svd")
round(cor(X),2)
Y = r
|
42,851
|
Create 3 correlated variables with pre-specified correlations [duplicate]
|
I don't know R, so here are verbal directions.
Step 1. Let $U$ be the upper Cholesky factor of the correlation matrix.
For the correlation matrix you give, $U$ is
1 .6 .6 .6
0 .8 .425 .425
0 0 .677772 .235145
0 0 0 .635674
Step 2. Let $X$ be an $n \times 4$ matrix in which the first column is your given vector R,
with the three other columns filled with random independent standard normals.
Step 3. Subtract its mean from each column of $X$, then get the QR decomposition of the result.
If $R_{1,1}$ is negative then change the signs of all four values in row 1 of $U$.
Step 4. Let $Y = Q\,U \sqrt{n-1}$. If all you want is standard scores then you're done. Otherwise you can replace the first column of $Y$ by your given vector R, then for each of the three other columns, multiply by the desired standard deviation and add the desired mean.
|
Create 3 correlated variables with pre-specified correlations [duplicate]
|
I don't know R, so here are verbal directions.
Step 1. Let $U$ be the upper Cholesky factor of the correlation matrix.
For the correlation matrix you give, $U$ is
1 .6 .6 .6
0 .8 .425 .4
|
Create 3 correlated variables with pre-specified correlations [duplicate]
I don't know R, so here are verbal directions.
Step 1. Let $U$ be the upper Cholesky factor of the correlation matrix.
For the correlation matrix you give, $U$ is
1 .6 .6 .6
0 .8 .425 .425
0 0 .677772 .235145
0 0 0 .635674
Step 2. Let $X$ be an $n \times 4$ matrix in which the first column is your given vector R,
with the three other columns filled with random independent standard normals.
Step 3. Subtract its mean from each column of $X$, then get the QR decomposition of the result.
If $R_{1,1}$ is negative then change the signs of all four values in row 1 of $U$.
Step 4. Let $Y = Q\,U \sqrt{n-1}$. If all you want is standard scores then you're done. Otherwise you can replace the first column of $Y$ by your given vector R, then for each of the three other columns, multiply by the desired standard deviation and add the desired mean.
|
Create 3 correlated variables with pre-specified correlations [duplicate]
I don't know R, so here are verbal directions.
Step 1. Let $U$ be the upper Cholesky factor of the correlation matrix.
For the correlation matrix you give, $U$ is
1 .6 .6 .6
0 .8 .425 .4
|
42,852
|
Is it OK to use correlated variables for cluster analysis?
|
Correlation can cause problems with many clustering algorithms by giving extra weight on these attributes. For k-means it seems to be a best practise to whiten the data first, for example.
However, there exist correlation clustering algorithms that are meant to process data containing multiple correlations, and cluster objects based on the correlations they exhibit.
|
Is it OK to use correlated variables for cluster analysis?
|
Correlation can cause problems with many clustering algorithms by giving extra weight on these attributes. For k-means it seems to be a best practise to whiten the data first, for example.
However, th
|
Is it OK to use correlated variables for cluster analysis?
Correlation can cause problems with many clustering algorithms by giving extra weight on these attributes. For k-means it seems to be a best practise to whiten the data first, for example.
However, there exist correlation clustering algorithms that are meant to process data containing multiple correlations, and cluster objects based on the correlations they exhibit.
|
Is it OK to use correlated variables for cluster analysis?
Correlation can cause problems with many clustering algorithms by giving extra weight on these attributes. For k-means it seems to be a best practise to whiten the data first, for example.
However, th
|
42,853
|
Kernel regression with monotonicity constraints
|
Shape restrictions on the kernel regression function can be imposed using various approach.
One general method was developed in Du, Parmeter and Racine (2013). The basic idea is to impose the constraints (here monotonicity) through weights in a generalized kernel estimator in the spirit of Hall and Huang (2001). The procedure involves solving a quadratic program with linear inequality constraints.
Another method was recently proposed in Horowitz and Lee (2015). The idea is to estimate the unrestricted kernel function, then evaluate what constraints are binding, and finally re-estimate the kernel function under the restrictions found and ignore all others.
Other recent papers study shape restrictions in econometrics. Among others, Chernozukov, Newey and Santos (2015) for conditional moment restriction models although I find it to be a difficult read.
|
Kernel regression with monotonicity constraints
|
Shape restrictions on the kernel regression function can be imposed using various approach.
One general method was developed in Du, Parmeter and Racine (2013). The basic idea is to impose the constrai
|
Kernel regression with monotonicity constraints
Shape restrictions on the kernel regression function can be imposed using various approach.
One general method was developed in Du, Parmeter and Racine (2013). The basic idea is to impose the constraints (here monotonicity) through weights in a generalized kernel estimator in the spirit of Hall and Huang (2001). The procedure involves solving a quadratic program with linear inequality constraints.
Another method was recently proposed in Horowitz and Lee (2015). The idea is to estimate the unrestricted kernel function, then evaluate what constraints are binding, and finally re-estimate the kernel function under the restrictions found and ignore all others.
Other recent papers study shape restrictions in econometrics. Among others, Chernozukov, Newey and Santos (2015) for conditional moment restriction models although I find it to be a difficult read.
|
Kernel regression with monotonicity constraints
Shape restrictions on the kernel regression function can be imposed using various approach.
One general method was developed in Du, Parmeter and Racine (2013). The basic idea is to impose the constrai
|
42,854
|
How to specify the Wishart distribution scale matrix
|
The author of rjags has mentioned, that the Wishhart distribution can only be used, when it appears as a conjugate distribution in a strong sense:
http://sourceforge.net/p/mcmc-jags/discussion/610037/thread/eab372de
There is a way around this though (I have to give credit to the authors of the R package bamdit though, thats where I first spotted the following trick:
model
{
for( i in 1 : n ) {
m[i,1:2] ~ dmnorm(mu.0[1:2], sigma.inv[1:2, 1:2]) ## m is not the data
w[i] ~ dgamma(nu.2, nu.2) T(0.1, 3)
y[i, 1] <- mu[1] + m[i, 1] / sqrt(w[i]) ## y is the data
y[i, 2] <- mu[2] + m[i, 2] / sqrt(w[i]) ## the scale enters here
}
# Priors ...
mu[1] ~ dnorm(m.0[1], pre.mu[1])
mu[2] ~ dnorm(m.0[2], pre.mu[2])
mu.0[1] <- 0
mu.0[2] <- 0
# Weights distribution
nu.2 <- nu / 2
nu ~ dexp(nu.0) # prior for df
sigma.inv[1:2,1:2] ~ dwish(R[1:2,1:2], k)
sigma[1:2, 1:2] <- inverse(sigma.inv[1:2, 1:2])
}
|
How to specify the Wishart distribution scale matrix
|
The author of rjags has mentioned, that the Wishhart distribution can only be used, when it appears as a conjugate distribution in a strong sense:
http://sourceforge.net/p/mcmc-jags/discussion/610037/
|
How to specify the Wishart distribution scale matrix
The author of rjags has mentioned, that the Wishhart distribution can only be used, when it appears as a conjugate distribution in a strong sense:
http://sourceforge.net/p/mcmc-jags/discussion/610037/thread/eab372de
There is a way around this though (I have to give credit to the authors of the R package bamdit though, thats where I first spotted the following trick:
model
{
for( i in 1 : n ) {
m[i,1:2] ~ dmnorm(mu.0[1:2], sigma.inv[1:2, 1:2]) ## m is not the data
w[i] ~ dgamma(nu.2, nu.2) T(0.1, 3)
y[i, 1] <- mu[1] + m[i, 1] / sqrt(w[i]) ## y is the data
y[i, 2] <- mu[2] + m[i, 2] / sqrt(w[i]) ## the scale enters here
}
# Priors ...
mu[1] ~ dnorm(m.0[1], pre.mu[1])
mu[2] ~ dnorm(m.0[2], pre.mu[2])
mu.0[1] <- 0
mu.0[2] <- 0
# Weights distribution
nu.2 <- nu / 2
nu ~ dexp(nu.0) # prior for df
sigma.inv[1:2,1:2] ~ dwish(R[1:2,1:2], k)
sigma[1:2, 1:2] <- inverse(sigma.inv[1:2, 1:2])
}
|
How to specify the Wishart distribution scale matrix
The author of rjags has mentioned, that the Wishhart distribution can only be used, when it appears as a conjugate distribution in a strong sense:
http://sourceforge.net/p/mcmc-jags/discussion/610037/
|
42,855
|
How to transform factor scores of a PCA for a regression, in SPSS?
|
simply put:
$
factorscore = loading_1*X_1+loading_2*X_2+\ldots+loading_k*X_k
$
You may need to standardize your variables beforehand if they do not share the same metric. If you do this with your data, your self-computed factor score should correlate above .9 with SPSS' factor score (at least if you do not have cross-loadings). Therefore I do not really see the point of computing them by hand. Moreover, if you have reasonable PCA results, you may want to compute something like a sum score instead of factor scores for your subsequent regression analyses.
|
How to transform factor scores of a PCA for a regression, in SPSS?
|
simply put:
$
factorscore = loading_1*X_1+loading_2*X_2+\ldots+loading_k*X_k
$
You may need to standardize your variables beforehand if they do not share the same metric. If you do this with your data
|
How to transform factor scores of a PCA for a regression, in SPSS?
simply put:
$
factorscore = loading_1*X_1+loading_2*X_2+\ldots+loading_k*X_k
$
You may need to standardize your variables beforehand if they do not share the same metric. If you do this with your data, your self-computed factor score should correlate above .9 with SPSS' factor score (at least if you do not have cross-loadings). Therefore I do not really see the point of computing them by hand. Moreover, if you have reasonable PCA results, you may want to compute something like a sum score instead of factor scores for your subsequent regression analyses.
|
How to transform factor scores of a PCA for a regression, in SPSS?
simply put:
$
factorscore = loading_1*X_1+loading_2*X_2+\ldots+loading_k*X_k
$
You may need to standardize your variables beforehand if they do not share the same metric. If you do this with your data
|
42,856
|
How to transform factor scores of a PCA for a regression, in SPSS?
|
i think this will help:
https://pdfs.semanticscholar.org/f7d6/bdbd63f784ef9badb087e9235f62fb74a5e9.pdf
Me, myself was troubled on the link between MLR and PCA or FA and it was so hard to find an answer on this very hot issue: it gives FA or PCA a new whole perspective and added utility.
However, having (hopefully) answered your question leads instantly to another question: is non-linear regression on factors possible or meaningful...
|
How to transform factor scores of a PCA for a regression, in SPSS?
|
i think this will help:
https://pdfs.semanticscholar.org/f7d6/bdbd63f784ef9badb087e9235f62fb74a5e9.pdf
Me, myself was troubled on the link between MLR and PCA or FA and it was so hard to find an answe
|
How to transform factor scores of a PCA for a regression, in SPSS?
i think this will help:
https://pdfs.semanticscholar.org/f7d6/bdbd63f784ef9badb087e9235f62fb74a5e9.pdf
Me, myself was troubled on the link between MLR and PCA or FA and it was so hard to find an answer on this very hot issue: it gives FA or PCA a new whole perspective and added utility.
However, having (hopefully) answered your question leads instantly to another question: is non-linear regression on factors possible or meaningful...
|
How to transform factor scores of a PCA for a regression, in SPSS?
i think this will help:
https://pdfs.semanticscholar.org/f7d6/bdbd63f784ef9badb087e9235f62fb74a5e9.pdf
Me, myself was troubled on the link between MLR and PCA or FA and it was so hard to find an answe
|
42,857
|
How to test the effect of variable on spatial distribution of points in R
|
Moran's I is able to test if spatial correlation is present in data. In other words, it can answer three kinds of hypotheses:
1:
Are points with similar values (birds with similar personality) close to each other?
In this case is p-value<0.05 and Moran.I$observed will be
positive number
2:
Are points with similar values more distant from each other? (like chess-board pattern, where neighbours have opposite values)
In this case is also p-value<0.05 but Moran.I$observed will be
negative number
3:
There is random pattern in data (no spatial correlation)
In this case p-value>0.05
Computation:
library(ape)
# matrix of all distances...
my.dists <- as.matrix(dist(cbind(my.data$x_coor, my.data$y_coor)))
# ...which is inversed...
my.dists.inv <- 1/my.dists
# ...and their diagonals set to "0"
diag(my.dists.inv) <- 0
# than inserted into Moran.I with tested variable
Moran.I(my.data$aggression, my.dists.inv)
Result:
Moran's I revealed a positive spatial correlation between points
Many thanks to Andy W
|
How to test the effect of variable on spatial distribution of points in R
|
Moran's I is able to test if spatial correlation is present in data. In other words, it can answer three kinds of hypotheses:
1:
Are points with similar values (birds with similar personality) close t
|
How to test the effect of variable on spatial distribution of points in R
Moran's I is able to test if spatial correlation is present in data. In other words, it can answer three kinds of hypotheses:
1:
Are points with similar values (birds with similar personality) close to each other?
In this case is p-value<0.05 and Moran.I$observed will be
positive number
2:
Are points with similar values more distant from each other? (like chess-board pattern, where neighbours have opposite values)
In this case is also p-value<0.05 but Moran.I$observed will be
negative number
3:
There is random pattern in data (no spatial correlation)
In this case p-value>0.05
Computation:
library(ape)
# matrix of all distances...
my.dists <- as.matrix(dist(cbind(my.data$x_coor, my.data$y_coor)))
# ...which is inversed...
my.dists.inv <- 1/my.dists
# ...and their diagonals set to "0"
diag(my.dists.inv) <- 0
# than inserted into Moran.I with tested variable
Moran.I(my.data$aggression, my.dists.inv)
Result:
Moran's I revealed a positive spatial correlation between points
Many thanks to Andy W
|
How to test the effect of variable on spatial distribution of points in R
Moran's I is able to test if spatial correlation is present in data. In other words, it can answer three kinds of hypotheses:
1:
Are points with similar values (birds with similar personality) close t
|
42,858
|
Distribution of deviances from logistic regression
|
If your individual binomial denominators $n_i$ are sufficiently large, then the deviance residuals are approximately normally distributed. This is the basis of the common assumption that the residual deviance $D$ has a chi-square distribution with df equal to the residual df of the model. Basically, the theory underlying these results is asymptotic for $n_i \to \infty$.
However, if your $n_i$ are small, then the theory no longer holds. In particular, for binary data, the individual $n_i$s are all 1, and the residuals don't have a sensible distribution at all -- they'll just be two clusters, corresponding to $y = 0$ or $1$. In this case, diagnostics based on the residuals aren't very useful, unless you can aggregate your data somehow to make each $n_i$ large.
|
Distribution of deviances from logistic regression
|
If your individual binomial denominators $n_i$ are sufficiently large, then the deviance residuals are approximately normally distributed. This is the basis of the common assumption that the residual
|
Distribution of deviances from logistic regression
If your individual binomial denominators $n_i$ are sufficiently large, then the deviance residuals are approximately normally distributed. This is the basis of the common assumption that the residual deviance $D$ has a chi-square distribution with df equal to the residual df of the model. Basically, the theory underlying these results is asymptotic for $n_i \to \infty$.
However, if your $n_i$ are small, then the theory no longer holds. In particular, for binary data, the individual $n_i$s are all 1, and the residuals don't have a sensible distribution at all -- they'll just be two clusters, corresponding to $y = 0$ or $1$. In this case, diagnostics based on the residuals aren't very useful, unless you can aggregate your data somehow to make each $n_i$ large.
|
Distribution of deviances from logistic regression
If your individual binomial denominators $n_i$ are sufficiently large, then the deviance residuals are approximately normally distributed. This is the basis of the common assumption that the residual
|
42,859
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
The question is to calculate the following statistic from the above regression output:
$$s.e.(\hat\mu|x_j)=\hat\sigma\sqrt{1/n+(x_j-\bar{x})^2/\Sigma{(x_i-\bar{x})^2}}.$$
The answer is inspired by @whuber:
get $\hat\sigma$ from $\hat\sigma^2=SS_{Residual}/(n-p-1)$,
where $p=1$;
$n$ and $x_j$ are known;
obtain $\bar{x}$ from
$\hat{Var}(β_{cons})=\hatσ^2(1/n+\bar{x}^2/\Sigma{(x_i-\bar{x})^2})$;
$\Sigma{(x_i-\bar{x})^2}=SS_{Model}/\hat{\beta}_{pop}^2$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
The question is to calculate the following statistic from the above regression output:
$$s.e.(\hat\mu|x_j)=\hat\sigma\sqrt{1/n+(x_j-\bar{x})^2/\Sigma{(x_i-\bar{x})^2}}.$$
The answer is inspired by @wh
|
Can we calculate the standard error of prediction just based on simple linear regression output?
The question is to calculate the following statistic from the above regression output:
$$s.e.(\hat\mu|x_j)=\hat\sigma\sqrt{1/n+(x_j-\bar{x})^2/\Sigma{(x_i-\bar{x})^2}}.$$
The answer is inspired by @whuber:
get $\hat\sigma$ from $\hat\sigma^2=SS_{Residual}/(n-p-1)$,
where $p=1$;
$n$ and $x_j$ are known;
obtain $\bar{x}$ from
$\hat{Var}(β_{cons})=\hatσ^2(1/n+\bar{x}^2/\Sigma{(x_i-\bar{x})^2})$;
$\Sigma{(x_i-\bar{x})^2}=SS_{Model}/\hat{\beta}_{pop}^2$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
The question is to calculate the following statistic from the above regression output:
$$s.e.(\hat\mu|x_j)=\hat\sigma\sqrt{1/n+(x_j-\bar{x})^2/\Sigma{(x_i-\bar{x})^2}}.$$
The answer is inspired by @wh
|
42,860
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
For simplicity, we are working with the following model:
$$y=\beta_0 + \beta_1x + \varepsilon,$$
where $\varepsilon\sim N(0, \sigma^2)$.
Now suppose that for $x=5$, we would like to predict $E(y|x=5) = \beta_0 + 5\beta_1$, denoted by $pre$.
We note that $pre$ is just a value if we know $\beta_0$ and $\beta_1$. However, they are unknow and each of them has its own sampling distribution (where the sd of this distribution is called the se). Therefore, the standard error associated with $pre$ is computed as:
$$Var(pre) = Var(\beta_0 + 5\beta_1) = Var(\beta_0) + 10 Cov(\beta_0, \beta_1) + 25Var(\beta_1).$$
Now you can see that you cannot compute this variance if you do not know the covariance $Cov(\beta_0, \beta_1)$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
For simplicity, we are working with the following model:
$$y=\beta_0 + \beta_1x + \varepsilon,$$
where $\varepsilon\sim N(0, \sigma^2)$.
Now suppose that for $x=5$, we would like to predict $E(y|x=5)
|
Can we calculate the standard error of prediction just based on simple linear regression output?
For simplicity, we are working with the following model:
$$y=\beta_0 + \beta_1x + \varepsilon,$$
where $\varepsilon\sim N(0, \sigma^2)$.
Now suppose that for $x=5$, we would like to predict $E(y|x=5) = \beta_0 + 5\beta_1$, denoted by $pre$.
We note that $pre$ is just a value if we know $\beta_0$ and $\beta_1$. However, they are unknow and each of them has its own sampling distribution (where the sd of this distribution is called the se). Therefore, the standard error associated with $pre$ is computed as:
$$Var(pre) = Var(\beta_0 + 5\beta_1) = Var(\beta_0) + 10 Cov(\beta_0, \beta_1) + 25Var(\beta_1).$$
Now you can see that you cannot compute this variance if you do not know the covariance $Cov(\beta_0, \beta_1)$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
For simplicity, we are working with the following model:
$$y=\beta_0 + \beta_1x + \varepsilon,$$
where $\varepsilon\sim N(0, \sigma^2)$.
Now suppose that for $x=5$, we would like to predict $E(y|x=5)
|
42,861
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
See Section 6-4a of Wooldridge (2020), Introductory Econometrics: A Modern Approach, 7ed, Cengage.
Variance of prediction error
It's not $\sigma^2 [ 1/n + (x_j-\bar{x})^2 / \sum_i (x_i - \bar{x})^2 ]$.
For the correct expression, let me use vector notations. The model is $y=x\beta + u$, where $x=(1,pop)$. Let $x_0 = (1,1029)$. The value to predict ($y_0$) is not yet labeled. The predictor is $\hat\theta = x_0 \hat\beta$, where $\hat\beta$ is the OLS estimator, and the label to predict is $x_0 \beta + u_0$. The prediction error is thus $y_0 - \hat\theta = u_0 - x_0 (\hat\beta-\beta)$.
As $\hat\beta$ is a function of the sample and $u_0$ (out of sample) is assumed to be independent of the sample, the variance of the prediction error is $\sigma^2 + x_0 V(\hat\beta) x_0'$, where $'$ stands for transpose. As $V(\hat\beta) = \sigma^2 (X'X)^{-1}$, where $X$ is the feature matrix (including the constant term in the first column), the variance of the prediction error is $\sigma^2 [ 1+ x_0 (X'X)^{-1} x_0' ]$ so the standard error is
$$\sigma \sqrt{1 + x_0 (X'X)^{-1} x_0'}.$$
Calculation of se(prediction error)
If we change the variable $pop$ to $pop-1029$, then $\hat\theta$ is reported as the intercept estimate:
/* Stata */
gen pop2 = pop - 1029
reg fuel pop2
You see that the reparameterizated model $fuel = \theta + \beta_1 (pop-1029) + u$ gives $\theta = \beta_0 + 1029 \beta_1$ so the intercept estimator $\hat\theta$ is your predictor.
The reported standard error is, however, $se(\hat\theta) = \hat\sigma \sqrt{x_0 (X'X)^{-1} x_0'}$, not the desired $\hat\sigma \sqrt{1+x_0 (X'X)^{-1} x_0'}$. For the correct one, you can simply compute $\sqrt{\hat\sigma^2 + se(\hat\theta)^2}$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
|
See Section 6-4a of Wooldridge (2020), Introductory Econometrics: A Modern Approach, 7ed, Cengage.
Variance of prediction error
It's not $\sigma^2 [ 1/n + (x_j-\bar{x})^2 / \sum_i (x_i - \bar{x})^2 ]$
|
Can we calculate the standard error of prediction just based on simple linear regression output?
See Section 6-4a of Wooldridge (2020), Introductory Econometrics: A Modern Approach, 7ed, Cengage.
Variance of prediction error
It's not $\sigma^2 [ 1/n + (x_j-\bar{x})^2 / \sum_i (x_i - \bar{x})^2 ]$.
For the correct expression, let me use vector notations. The model is $y=x\beta + u$, where $x=(1,pop)$. Let $x_0 = (1,1029)$. The value to predict ($y_0$) is not yet labeled. The predictor is $\hat\theta = x_0 \hat\beta$, where $\hat\beta$ is the OLS estimator, and the label to predict is $x_0 \beta + u_0$. The prediction error is thus $y_0 - \hat\theta = u_0 - x_0 (\hat\beta-\beta)$.
As $\hat\beta$ is a function of the sample and $u_0$ (out of sample) is assumed to be independent of the sample, the variance of the prediction error is $\sigma^2 + x_0 V(\hat\beta) x_0'$, where $'$ stands for transpose. As $V(\hat\beta) = \sigma^2 (X'X)^{-1}$, where $X$ is the feature matrix (including the constant term in the first column), the variance of the prediction error is $\sigma^2 [ 1+ x_0 (X'X)^{-1} x_0' ]$ so the standard error is
$$\sigma \sqrt{1 + x_0 (X'X)^{-1} x_0'}.$$
Calculation of se(prediction error)
If we change the variable $pop$ to $pop-1029$, then $\hat\theta$ is reported as the intercept estimate:
/* Stata */
gen pop2 = pop - 1029
reg fuel pop2
You see that the reparameterizated model $fuel = \theta + \beta_1 (pop-1029) + u$ gives $\theta = \beta_0 + 1029 \beta_1$ so the intercept estimator $\hat\theta$ is your predictor.
The reported standard error is, however, $se(\hat\theta) = \hat\sigma \sqrt{x_0 (X'X)^{-1} x_0'}$, not the desired $\hat\sigma \sqrt{1+x_0 (X'X)^{-1} x_0'}$. For the correct one, you can simply compute $\sqrt{\hat\sigma^2 + se(\hat\theta)^2}$.
|
Can we calculate the standard error of prediction just based on simple linear regression output?
See Section 6-4a of Wooldridge (2020), Introductory Econometrics: A Modern Approach, 7ed, Cengage.
Variance of prediction error
It's not $\sigma^2 [ 1/n + (x_j-\bar{x})^2 / \sum_i (x_i - \bar{x})^2 ]$
|
42,862
|
Post hoc tests for robust mixed design ANOVA using R
|
The robust mixed-design ANOVA function is now called rmanova instead tsplit and unfortunately the WRS2 package does not yet contain a corresponding post-hoc test for it. (mcp2atm is solely for t2way). In case you need to conduct a post-hoc test, you must use the original WRS package for now.
This package contains the functions bwmcp for multiple comparisons of variable A (between), B (within) and the interaction between these two. If you are interested just in one of these you can use bwamcp for A, bwbmcp for B respectively bwimcp for the interaction. The usage of these function is not as straightforward:
# load the latest WRS package
> source("https://dornsife.usc.edu/assets/sites/239/docs/Rallfun-v38.txt")
# convert your data for the function from long format into list format.
> data <- bw2list(yourdf, 4, c(7,8))
# In this example "4" stands for the column where your independent groups are located.
# c(7,8) indicates the position of the columns with the within groups data
Now that we have the data prepared suppose that our between subject variable has 3 levels (groups) and our within-subject variable (as seen above) has 2 levels. The function would then look like this:
> bwmcp(3,2, data, tr = 0.2) # uses by default 20% trimmed means
|
Post hoc tests for robust mixed design ANOVA using R
|
The robust mixed-design ANOVA function is now called rmanova instead tsplit and unfortunately the WRS2 package does not yet contain a corresponding post-hoc test for it. (mcp2atm is solely for t2way).
|
Post hoc tests for robust mixed design ANOVA using R
The robust mixed-design ANOVA function is now called rmanova instead tsplit and unfortunately the WRS2 package does not yet contain a corresponding post-hoc test for it. (mcp2atm is solely for t2way). In case you need to conduct a post-hoc test, you must use the original WRS package for now.
This package contains the functions bwmcp for multiple comparisons of variable A (between), B (within) and the interaction between these two. If you are interested just in one of these you can use bwamcp for A, bwbmcp for B respectively bwimcp for the interaction. The usage of these function is not as straightforward:
# load the latest WRS package
> source("https://dornsife.usc.edu/assets/sites/239/docs/Rallfun-v38.txt")
# convert your data for the function from long format into list format.
> data <- bw2list(yourdf, 4, c(7,8))
# In this example "4" stands for the column where your independent groups are located.
# c(7,8) indicates the position of the columns with the within groups data
Now that we have the data prepared suppose that our between subject variable has 3 levels (groups) and our within-subject variable (as seen above) has 2 levels. The function would then look like this:
> bwmcp(3,2, data, tr = 0.2) # uses by default 20% trimmed means
|
Post hoc tests for robust mixed design ANOVA using R
The robust mixed-design ANOVA function is now called rmanova instead tsplit and unfortunately the WRS2 package does not yet contain a corresponding post-hoc test for it. (mcp2atm is solely for t2way).
|
42,863
|
Post hoc tests for robust mixed design ANOVA using R
|
You can use the WRS2 package and run the following posthoc tests: sppbb (within effects p), sppba (between effects), and sppbi (interaction effects).
You can read more about it here: https://link.springer.com/article/10.3758/s13428-019-01246-w
|
Post hoc tests for robust mixed design ANOVA using R
|
You can use the WRS2 package and run the following posthoc tests: sppbb (within effects p), sppba (between effects), and sppbi (interaction effects).
You can read more about it here: https://link.spri
|
Post hoc tests for robust mixed design ANOVA using R
You can use the WRS2 package and run the following posthoc tests: sppbb (within effects p), sppba (between effects), and sppbi (interaction effects).
You can read more about it here: https://link.springer.com/article/10.3758/s13428-019-01246-w
|
Post hoc tests for robust mixed design ANOVA using R
You can use the WRS2 package and run the following posthoc tests: sppbb (within effects p), sppba (between effects), and sppbi (interaction effects).
You can read more about it here: https://link.spri
|
42,864
|
Appropriate regression model when dependent variable is between 0 and 1?
|
Do you have any values of the response that are exactly 0 or 1? (those will cause problems with a logit transform)
Have you tried plotting your data? What exploratory techniques have you used? What have other researchers in the area done?
You could try simulating some data that fits with a logit transform or a beta regression model (or anything else that you consider trying) and see how that compares to your data to get a better feel for which model may be more appropriate.
With what you have given us, we can only make suggestions, you need to decide on what makes the most sense based on your understanding of the data, the science behind it, and what questions you are trying to ask. You may also need to consult with an expert in the area and/or a professional statistician. Choosing to not do a beta regression because it is beyond you is like having your doctor say that you may need brain surgery, but he is going to take out your appendix instead because brains are beyond his experience, but he is good with appendixes.
|
Appropriate regression model when dependent variable is between 0 and 1?
|
Do you have any values of the response that are exactly 0 or 1? (those will cause problems with a logit transform)
Have you tried plotting your data? What exploratory techniques have you used? What
|
Appropriate regression model when dependent variable is between 0 and 1?
Do you have any values of the response that are exactly 0 or 1? (those will cause problems with a logit transform)
Have you tried plotting your data? What exploratory techniques have you used? What have other researchers in the area done?
You could try simulating some data that fits with a logit transform or a beta regression model (or anything else that you consider trying) and see how that compares to your data to get a better feel for which model may be more appropriate.
With what you have given us, we can only make suggestions, you need to decide on what makes the most sense based on your understanding of the data, the science behind it, and what questions you are trying to ask. You may also need to consult with an expert in the area and/or a professional statistician. Choosing to not do a beta regression because it is beyond you is like having your doctor say that you may need brain surgery, but he is going to take out your appendix instead because brains are beyond his experience, but he is good with appendixes.
|
Appropriate regression model when dependent variable is between 0 and 1?
Do you have any values of the response that are exactly 0 or 1? (those will cause problems with a logit transform)
Have you tried plotting your data? What exploratory techniques have you used? What
|
42,865
|
Appropriate regression model when dependent variable is between 0 and 1?
|
You know $k$ but you used dependent variable $1/k$. Do not divide, but use values of $k$ as dependent variable. As you say $k$ is number of classes, so you should see the regression with categorical dependent variable. For reference you should look
here
and I think you should avoid $1/k$ if you used any other regression or method. Because as you have more classes result become near zero and for small classes result close to 1, and that yields misleading results over independent variables.
|
Appropriate regression model when dependent variable is between 0 and 1?
|
You know $k$ but you used dependent variable $1/k$. Do not divide, but use values of $k$ as dependent variable. As you say $k$ is number of classes, so you should see the regression with categorical d
|
Appropriate regression model when dependent variable is between 0 and 1?
You know $k$ but you used dependent variable $1/k$. Do not divide, but use values of $k$ as dependent variable. As you say $k$ is number of classes, so you should see the regression with categorical dependent variable. For reference you should look
here
and I think you should avoid $1/k$ if you used any other regression or method. Because as you have more classes result become near zero and for small classes result close to 1, and that yields misleading results over independent variables.
|
Appropriate regression model when dependent variable is between 0 and 1?
You know $k$ but you used dependent variable $1/k$. Do not divide, but use values of $k$ as dependent variable. As you say $k$ is number of classes, so you should see the regression with categorical d
|
42,866
|
Random Forest and cluster-level bootstrapping
|
Your question seems to be addressed in the paper "An Introspective Comparison of Random Forest-Based Classifiers for the Analysis of Cluster-Correlated Data by Way of RF++" available here.
Those authors addressed the question with "subject-level bootstrapping". They wrote their own software which I have not used (so I can't vouch for it) and was updated last in 2009. I'd feel more comfortable just writing my own bootstrapping code and using a well maintained random forest package.
If you want to use R, you could just write your own code to bootstrap subject-level sampling and set the parameter replace=FALSE in the randomForest function. Sample household IDs (with replacement) and then within each household include all individuals. Build a RF with that training data, and use the RF to predict the values of the individuals from unsampled households. Repeat that whole process 10 or so times so that each individual has several RF predictions, and combine all of those into a single prediction. That seems to be the general approach taken in the paper referenced above.
|
Random Forest and cluster-level bootstrapping
|
Your question seems to be addressed in the paper "An Introspective Comparison of Random Forest-Based Classifiers for the Analysis of Cluster-Correlated Data by Way of RF++" available here.
Those auth
|
Random Forest and cluster-level bootstrapping
Your question seems to be addressed in the paper "An Introspective Comparison of Random Forest-Based Classifiers for the Analysis of Cluster-Correlated Data by Way of RF++" available here.
Those authors addressed the question with "subject-level bootstrapping". They wrote their own software which I have not used (so I can't vouch for it) and was updated last in 2009. I'd feel more comfortable just writing my own bootstrapping code and using a well maintained random forest package.
If you want to use R, you could just write your own code to bootstrap subject-level sampling and set the parameter replace=FALSE in the randomForest function. Sample household IDs (with replacement) and then within each household include all individuals. Build a RF with that training data, and use the RF to predict the values of the individuals from unsampled households. Repeat that whole process 10 or so times so that each individual has several RF predictions, and combine all of those into a single prediction. That seems to be the general approach taken in the paper referenced above.
|
Random Forest and cluster-level bootstrapping
Your question seems to be addressed in the paper "An Introspective Comparison of Random Forest-Based Classifiers for the Analysis of Cluster-Correlated Data by Way of RF++" available here.
Those auth
|
42,867
|
Random Forest and cluster-level bootstrapping
|
Have you looked into using the strata and sampsize parameters from the R package 'random forest'? You could indicate household in the strata parameter.
This is copied from the R documentation on the randomForest package:
strata: A (factor) variable that is used for stratified sampling.
sampsize: Size(s) of sample to draw. For classification, if sampsize is a vector of the length the number of strata, then sampling is stratified by strata, and the elements of sampsize indicate the numbers to be drawn from the strata.
|
Random Forest and cluster-level bootstrapping
|
Have you looked into using the strata and sampsize parameters from the R package 'random forest'? You could indicate household in the strata parameter.
This is copied from the R documentation on the
|
Random Forest and cluster-level bootstrapping
Have you looked into using the strata and sampsize parameters from the R package 'random forest'? You could indicate household in the strata parameter.
This is copied from the R documentation on the randomForest package:
strata: A (factor) variable that is used for stratified sampling.
sampsize: Size(s) of sample to draw. For classification, if sampsize is a vector of the length the number of strata, then sampling is stratified by strata, and the elements of sampsize indicate the numbers to be drawn from the strata.
|
Random Forest and cluster-level bootstrapping
Have you looked into using the strata and sampsize parameters from the R package 'random forest'? You could indicate household in the strata parameter.
This is copied from the R documentation on the
|
42,868
|
Are crossed factorial design and full factorial design the same concept?
|
(Crossed) factorial design is not always equal to Full factorial design.
In this context, the word "crossed" is a synonym of "factorial" (see here). Both indicates the presence of interactions between factors.
A factorial design can be either:
Full (all possible interactions) or,
Fractional (without all interactions, but some).
Therefore, a "factorial design" does not necessarily implies it is "fully crossed".
In the OP's case, where:
two factors A and B are crossed, if every level of A can occur in every level of B
It will be a full factorial design.
|
Are crossed factorial design and full factorial design the same concept?
|
(Crossed) factorial design is not always equal to Full factorial design.
In this context, the word "crossed" is a synonym of "factorial" (see here). Both indicates the presence of interactions between
|
Are crossed factorial design and full factorial design the same concept?
(Crossed) factorial design is not always equal to Full factorial design.
In this context, the word "crossed" is a synonym of "factorial" (see here). Both indicates the presence of interactions between factors.
A factorial design can be either:
Full (all possible interactions) or,
Fractional (without all interactions, but some).
Therefore, a "factorial design" does not necessarily implies it is "fully crossed".
In the OP's case, where:
two factors A and B are crossed, if every level of A can occur in every level of B
It will be a full factorial design.
|
Are crossed factorial design and full factorial design the same concept?
(Crossed) factorial design is not always equal to Full factorial design.
In this context, the word "crossed" is a synonym of "factorial" (see here). Both indicates the presence of interactions between
|
42,869
|
K-means as limit of Soft K-means algorithm
|
When I look at the case where we have a single point and two clusters, it seems to me that both clusters in soft k-means will eventually be centered around the single point.
In the soft k-means, there is no such thing as an "un-assigned" cluster, so each cluster that would've been unassigned in the hard k-means will center on the nearest point.
|
K-means as limit of Soft K-means algorithm
|
When I look at the case where we have a single point and two clusters, it seems to me that both clusters in soft k-means will eventually be centered around the single point.
In the soft k-means, ther
|
K-means as limit of Soft K-means algorithm
When I look at the case where we have a single point and two clusters, it seems to me that both clusters in soft k-means will eventually be centered around the single point.
In the soft k-means, there is no such thing as an "un-assigned" cluster, so each cluster that would've been unassigned in the hard k-means will center on the nearest point.
|
K-means as limit of Soft K-means algorithm
When I look at the case where we have a single point and two clusters, it seems to me that both clusters in soft k-means will eventually be centered around the single point.
In the soft k-means, ther
|
42,870
|
K-means as limit of Soft K-means algorithm
|
Try to find a probabilistic interpretation for each $r$. Then try to express the new position as an expectation over the r's.
|
K-means as limit of Soft K-means algorithm
|
Try to find a probabilistic interpretation for each $r$. Then try to express the new position as an expectation over the r's.
|
K-means as limit of Soft K-means algorithm
Try to find a probabilistic interpretation for each $r$. Then try to express the new position as an expectation over the r's.
|
K-means as limit of Soft K-means algorithm
Try to find a probabilistic interpretation for each $r$. Then try to express the new position as an expectation over the r's.
|
42,871
|
(Why) should bootstrap sampling distribution for logistic regression slope be conditional on $S=\sum Y_j$?
|
Davison & Hinkley, I now believe, would argue that, for this problem, their proposed method is preferable.
Example 4.1 comes near the start of a chapter in which the authors first develop a big-picture overview of several approaches to hypothesis testing and only then introduce bootstrap hypothesis tests. In discussing hypothesis tests for which the null hypothesis $H_0$ is composite, they lay out several approaches to forming a test:
Very rarely, one may carefully choose a test statistic $T$ with distribution that is the same for all $F$ satisfying $H_0$. A familiar example is the Student's $t$-test for a normal mean with unknown variance.
Failing that, and more often, one may be able to eliminate the parameters that remain unknown when $H_0$ is true by conditioning on the sufficient statistic (denoted by $S$) under $H_0$. This produces a conditional $P$-value defined by:
$$
p = \mathrm{Pr}(T \geq t | S=s, H_0)
$$
Permutation tests, which condition on the marginal EDFs as their sufficient statistic, are good examples of this approach.
Where that is not possible, "a less satisfactory approach, which can nevertheless give good approximations is to estimate $F$ by a CDF $\hat{F}_0$ which satisfies $H_0$ and then calculate":
$$
p = \mathrm{Pr}(T \geq t | \hat{F}_0)
$$
This is the approach taken by bootstrap hypothesis tests.
Using the terminology that Davison & Hinkley use, their Example 4.1 is a conditional test that implements the second approach given above. My proposed solution is a bootstrap test that follows the logic in the third approach given above.
Edit of 2017-02-22
Romano (1989), mentioned in the Bibliographic Notes of D&H's Chapter 4, elucidates and explores in much greater detail the distinction between permutation (conditional) tests and bootstraps tests.
References:
Romano, J. P. Bootstrap and randomization tests of some nonparametric hypotheses. 1989. The Annals of Statistics. 17(1), 141–159. http://dx.doi.org/10.1214/aos/1176347007
|
(Why) should bootstrap sampling distribution for logistic regression slope be conditional on $S=\sum
|
Davison & Hinkley, I now believe, would argue that, for this problem, their proposed method is preferable.
Example 4.1 comes near the start of a chapter in which the authors first develop a big-pictur
|
(Why) should bootstrap sampling distribution for logistic regression slope be conditional on $S=\sum Y_j$?
Davison & Hinkley, I now believe, would argue that, for this problem, their proposed method is preferable.
Example 4.1 comes near the start of a chapter in which the authors first develop a big-picture overview of several approaches to hypothesis testing and only then introduce bootstrap hypothesis tests. In discussing hypothesis tests for which the null hypothesis $H_0$ is composite, they lay out several approaches to forming a test:
Very rarely, one may carefully choose a test statistic $T$ with distribution that is the same for all $F$ satisfying $H_0$. A familiar example is the Student's $t$-test for a normal mean with unknown variance.
Failing that, and more often, one may be able to eliminate the parameters that remain unknown when $H_0$ is true by conditioning on the sufficient statistic (denoted by $S$) under $H_0$. This produces a conditional $P$-value defined by:
$$
p = \mathrm{Pr}(T \geq t | S=s, H_0)
$$
Permutation tests, which condition on the marginal EDFs as their sufficient statistic, are good examples of this approach.
Where that is not possible, "a less satisfactory approach, which can nevertheless give good approximations is to estimate $F$ by a CDF $\hat{F}_0$ which satisfies $H_0$ and then calculate":
$$
p = \mathrm{Pr}(T \geq t | \hat{F}_0)
$$
This is the approach taken by bootstrap hypothesis tests.
Using the terminology that Davison & Hinkley use, their Example 4.1 is a conditional test that implements the second approach given above. My proposed solution is a bootstrap test that follows the logic in the third approach given above.
Edit of 2017-02-22
Romano (1989), mentioned in the Bibliographic Notes of D&H's Chapter 4, elucidates and explores in much greater detail the distinction between permutation (conditional) tests and bootstraps tests.
References:
Romano, J. P. Bootstrap and randomization tests of some nonparametric hypotheses. 1989. The Annals of Statistics. 17(1), 141–159. http://dx.doi.org/10.1214/aos/1176347007
|
(Why) should bootstrap sampling distribution for logistic regression slope be conditional on $S=\sum
Davison & Hinkley, I now believe, would argue that, for this problem, their proposed method is preferable.
Example 4.1 comes near the start of a chapter in which the authors first develop a big-pictur
|
42,872
|
How to Test the Difference between 2 Sets of Pearson Correlations?
|
Simply do a t-test of the transformed correlations, exactly as you would test any two sets of data to compare their means. The test technically is a comparison of the mean transformed correlations, but for most purposes that's not a problem. (How meaningful would an arithmetic mean of correlations be in the first place? Arguably, the transformed correlation coefficients are the meaningful quantities!)
The whole point to the Fisher Z transformation $$\rho\to (\log(1+\rho)-\log(1-\rho))/2$$ is to make comparisons legitimate. When $n$ bivariate data are independently sampled from a near-bivariate Normal distribution with given correlation $\rho,$ the Fisher Z- transformed sample correlation coefficient will have close to a Normal distribution, with mean equal to the transformed value of $\rho$ and variance $1/(n-3)$--regardless of the value of $\rho.$ This is just what is needed to justify applying the Student t test (with equal variances in each group) or Analysis of Variance.
To demonstrate, I simulated samples of size $n=50$ from various bivariate Normal distributions having a range of correlations $\rho,$ repeating this $50,000$ times to obtain $50,000$ sample correlation coefficients for each $\rho$. To make these results comparable, I subtracted the Fisher Z transformation of $\rho$ from each transformed sample correlation coefficient, calling the result "$Z,$" so as to produce distributions that ought to be approximately Normal, all of zero mean, and all with the same standard deviation of $\sqrt{1/(50-3)} \approx 0.15.$ For comparison I have overplotted the density function of that Normal distribution on each histogram.
You can see that across this wide range of underlying correlations (as extreme as $-0.95$), the Fisher-transformed sample correlations indeed look like they have nearly Normal distributions, as promised.
For those who might be worried about extreme cases, I extended the simulations out to $\rho=0.9999$ (with $\rho=0$ shown as a reference at the left). The transformed distributions are still Normal and still have the promised variances:
Finally, the picture doesn't change much with small sample sizes. Here's the same simulation with samples of just $n=8$ bivariate Normal values:
A tiny bit of skewness towards less extreme values is apparent, and the standard deviations seem a little smaller than expected, but these variations are so small as to be of no concern.
|
How to Test the Difference between 2 Sets of Pearson Correlations?
|
Simply do a t-test of the transformed correlations, exactly as you would test any two sets of data to compare their means. The test technically is a comparison of the mean transformed correlations, b
|
How to Test the Difference between 2 Sets of Pearson Correlations?
Simply do a t-test of the transformed correlations, exactly as you would test any two sets of data to compare their means. The test technically is a comparison of the mean transformed correlations, but for most purposes that's not a problem. (How meaningful would an arithmetic mean of correlations be in the first place? Arguably, the transformed correlation coefficients are the meaningful quantities!)
The whole point to the Fisher Z transformation $$\rho\to (\log(1+\rho)-\log(1-\rho))/2$$ is to make comparisons legitimate. When $n$ bivariate data are independently sampled from a near-bivariate Normal distribution with given correlation $\rho,$ the Fisher Z- transformed sample correlation coefficient will have close to a Normal distribution, with mean equal to the transformed value of $\rho$ and variance $1/(n-3)$--regardless of the value of $\rho.$ This is just what is needed to justify applying the Student t test (with equal variances in each group) or Analysis of Variance.
To demonstrate, I simulated samples of size $n=50$ from various bivariate Normal distributions having a range of correlations $\rho,$ repeating this $50,000$ times to obtain $50,000$ sample correlation coefficients for each $\rho$. To make these results comparable, I subtracted the Fisher Z transformation of $\rho$ from each transformed sample correlation coefficient, calling the result "$Z,$" so as to produce distributions that ought to be approximately Normal, all of zero mean, and all with the same standard deviation of $\sqrt{1/(50-3)} \approx 0.15.$ For comparison I have overplotted the density function of that Normal distribution on each histogram.
You can see that across this wide range of underlying correlations (as extreme as $-0.95$), the Fisher-transformed sample correlations indeed look like they have nearly Normal distributions, as promised.
For those who might be worried about extreme cases, I extended the simulations out to $\rho=0.9999$ (with $\rho=0$ shown as a reference at the left). The transformed distributions are still Normal and still have the promised variances:
Finally, the picture doesn't change much with small sample sizes. Here's the same simulation with samples of just $n=8$ bivariate Normal values:
A tiny bit of skewness towards less extreme values is apparent, and the standard deviations seem a little smaller than expected, but these variations are so small as to be of no concern.
|
How to Test the Difference between 2 Sets of Pearson Correlations?
Simply do a t-test of the transformed correlations, exactly as you would test any two sets of data to compare their means. The test technically is a comparison of the mean transformed correlations, b
|
42,873
|
How to Test the Difference between 2 Sets of Pearson Correlations?
|
The problem with using a 2 sample t-test is, presumably, that the correlations are not normally distributed. So, you can use a non-parametric test such as Wilcoxon. Or you could do a permutation test.
|
How to Test the Difference between 2 Sets of Pearson Correlations?
|
The problem with using a 2 sample t-test is, presumably, that the correlations are not normally distributed. So, you can use a non-parametric test such as Wilcoxon. Or you could do a permutation test.
|
How to Test the Difference between 2 Sets of Pearson Correlations?
The problem with using a 2 sample t-test is, presumably, that the correlations are not normally distributed. So, you can use a non-parametric test such as Wilcoxon. Or you could do a permutation test.
|
How to Test the Difference between 2 Sets of Pearson Correlations?
The problem with using a 2 sample t-test is, presumably, that the correlations are not normally distributed. So, you can use a non-parametric test such as Wilcoxon. Or you could do a permutation test.
|
42,874
|
Libsvm one-class svm: how to consider all data to be in-class
|
If you set the nu parameter to very small (-n 0.001) and set the gamma to small as well (-g 0.001) you will get almost all your training data being in your class.
|
Libsvm one-class svm: how to consider all data to be in-class
|
If you set the nu parameter to very small (-n 0.001) and set the gamma to small as well (-g 0.001) you will get almost all your training data being in your class.
|
Libsvm one-class svm: how to consider all data to be in-class
If you set the nu parameter to very small (-n 0.001) and set the gamma to small as well (-g 0.001) you will get almost all your training data being in your class.
|
Libsvm one-class svm: how to consider all data to be in-class
If you set the nu parameter to very small (-n 0.001) and set the gamma to small as well (-g 0.001) you will get almost all your training data being in your class.
|
42,875
|
Libsvm one-class svm: how to consider all data to be in-class
|
I tried your code. For one-class-SVM, the penalty determined by a parameter nu. The default value is 0.5. That is what gives you this plot. If you set it to be 1, all the points are classified as one class. Setting C does not affect the output because C is not relevant to one-class-SVM.
|
Libsvm one-class svm: how to consider all data to be in-class
|
I tried your code. For one-class-SVM, the penalty determined by a parameter nu. The default value is 0.5. That is what gives you this plot. If you set it to be 1, all the points are classified as one
|
Libsvm one-class svm: how to consider all data to be in-class
I tried your code. For one-class-SVM, the penalty determined by a parameter nu. The default value is 0.5. That is what gives you this plot. If you set it to be 1, all the points are classified as one class. Setting C does not affect the output because C is not relevant to one-class-SVM.
|
Libsvm one-class svm: how to consider all data to be in-class
I tried your code. For one-class-SVM, the penalty determined by a parameter nu. The default value is 0.5. That is what gives you this plot. If you set it to be 1, all the points are classified as one
|
42,876
|
Libsvm one-class svm: how to consider all data to be in-class
|
I know it's a bit late but anyway my contribution to your question is this:
You are using a gaussian kernel to train your one-class svm. This may mislead you for making deductions about the support vectors presence. If you just modify your example and use a linear one-class svm (always better explained in linear case) you will see that your sv are equally distributed in all the space. (I am not suggesting that linear is the best choice, just that are more straight forward to be be explained).
As you have defined your question is that all the data points that are used as Support Vector are also considered to be outside the class so your concern is why the majority of sv is outside your class? My guess is that your data is quite dense and in the attempt to model the boundary a lot of your outliers are required for this task. If you make another experiment with sparser data I think that wont be such a problem.
|
Libsvm one-class svm: how to consider all data to be in-class
|
I know it's a bit late but anyway my contribution to your question is this:
You are using a gaussian kernel to train your one-class svm. This may mislead you for making deductions about the support ve
|
Libsvm one-class svm: how to consider all data to be in-class
I know it's a bit late but anyway my contribution to your question is this:
You are using a gaussian kernel to train your one-class svm. This may mislead you for making deductions about the support vectors presence. If you just modify your example and use a linear one-class svm (always better explained in linear case) you will see that your sv are equally distributed in all the space. (I am not suggesting that linear is the best choice, just that are more straight forward to be be explained).
As you have defined your question is that all the data points that are used as Support Vector are also considered to be outside the class so your concern is why the majority of sv is outside your class? My guess is that your data is quite dense and in the attempt to model the boundary a lot of your outliers are required for this task. If you make another experiment with sparser data I think that wont be such a problem.
|
Libsvm one-class svm: how to consider all data to be in-class
I know it's a bit late but anyway my contribution to your question is this:
You are using a gaussian kernel to train your one-class svm. This may mislead you for making deductions about the support ve
|
42,877
|
Libsvm one-class svm: how to consider all data to be in-class
|
I changed the colors:
green -> training set,
red-> SV,
blue->in class data
Also I added the nu value into svmtrain parameters
model = svmtrain(labels, data, '-s 2 -t 2 -nu 0.1');
optimization finished, #iter = 484
obj = 723.098765, rho = 15.666491
nSV = 112, nBSV = 88
Accuracy = 90% (900/1000) (classification)
|
Libsvm one-class svm: how to consider all data to be in-class
|
I changed the colors:
green -> training set,
red-> SV,
blue->in class data
Also I added the nu value into svmtrain parameters
model = svmtrain(labels, data, '-s 2 -t 2 -nu 0.1');
optimization finis
|
Libsvm one-class svm: how to consider all data to be in-class
I changed the colors:
green -> training set,
red-> SV,
blue->in class data
Also I added the nu value into svmtrain parameters
model = svmtrain(labels, data, '-s 2 -t 2 -nu 0.1');
optimization finished, #iter = 484
obj = 723.098765, rho = 15.666491
nSV = 112, nBSV = 88
Accuracy = 90% (900/1000) (classification)
|
Libsvm one-class svm: how to consider all data to be in-class
I changed the colors:
green -> training set,
red-> SV,
blue->in class data
Also I added the nu value into svmtrain parameters
model = svmtrain(labels, data, '-s 2 -t 2 -nu 0.1');
optimization finis
|
42,878
|
Should my test set be balanced or imbalanced?
|
I would say neither of the options you suggested: use all the data you have and try to ensure the distributions of training and test set match. This will give you the most realistic assessment of the model's performance. If your classification algorithm has trouble dealing with imbalanced data, use something else.
So in short: split in training and testing, keeping both of them imbalanced. Don't throw data away by subsampling.
|
Should my test set be balanced or imbalanced?
|
I would say neither of the options you suggested: use all the data you have and try to ensure the distributions of training and test set match. This will give you the most realistic assessment of the
|
Should my test set be balanced or imbalanced?
I would say neither of the options you suggested: use all the data you have and try to ensure the distributions of training and test set match. This will give you the most realistic assessment of the model's performance. If your classification algorithm has trouble dealing with imbalanced data, use something else.
So in short: split in training and testing, keeping both of them imbalanced. Don't throw data away by subsampling.
|
Should my test set be balanced or imbalanced?
I would say neither of the options you suggested: use all the data you have and try to ensure the distributions of training and test set match. This will give you the most realistic assessment of the
|
42,879
|
Confidence intervals for glmer() from lme4
|
the code then calculates the confidence intervals it says prediction +/- 2*sqrt(pvar1). Shouldn't it be the t.crit value or 1.96 for a normal distribution?
This is correct. 1.96 is a more accurate critical value, however, statistical inference in mixed models is plagued with problems due to the presence of the random effects. It is difficult to quantify the uncertainty in the random effects.
2 is often use, as Ben Bolker points out in the comments, in order to empasize that these are approximate values.
Accordingly, any p values or confidence intervals should be considered approximate.
|
Confidence intervals for glmer() from lme4
|
the code then calculates the confidence intervals it says prediction +/- 2*sqrt(pvar1). Shouldn't it be the t.crit value or 1.96 for a normal distribution?
This is correct. 1.96 is a more accurate cr
|
Confidence intervals for glmer() from lme4
the code then calculates the confidence intervals it says prediction +/- 2*sqrt(pvar1). Shouldn't it be the t.crit value or 1.96 for a normal distribution?
This is correct. 1.96 is a more accurate critical value, however, statistical inference in mixed models is plagued with problems due to the presence of the random effects. It is difficult to quantify the uncertainty in the random effects.
2 is often use, as Ben Bolker points out in the comments, in order to empasize that these are approximate values.
Accordingly, any p values or confidence intervals should be considered approximate.
|
Confidence intervals for glmer() from lme4
the code then calculates the confidence intervals it says prediction +/- 2*sqrt(pvar1). Shouldn't it be the t.crit value or 1.96 for a normal distribution?
This is correct. 1.96 is a more accurate cr
|
42,880
|
Ratios of means - statistical comparison test using Fieller's theorem?
|
Although the general solution may be difficult, for this situation the solution is simple if analyses are performed in the log scale. I would argue that working in the log scale would make sense for this type of data even if ratios weren't being compared.
The experiments and desired comparisons described only make sense if all ion currents have the same sign (all inward or all outward with respect to the cells). Furthermore, errors in these types of measurements are often proportional to the values being measured rather than being independent of the values. So working in the log scale of (absolute value of) currents makes sense.
If $I$ represents current, 1 and 2 represent the genes, and $c$ and $a$ represent control and activator cases respectively, the desired comparison is $I_{1a}/I_{1c}$ versus $I_{2a}/I_{2c}$. In the log scale the null hypothesis becomes:
$$log(I_{1a})-log(I_{1c}) = log(I_{2a})-log(I_{2c})$$
which can be tested by examining an interaction between gene and activator in a standard linear model in this log scale. This approach has the advantage of easily being extended to multiple genes (and activators).
I suppose one could imagine situations where working in the log scale would be inappropriate, but for this type of comparison in biomedical experiments in practice the log transformation often makes sense in terms of what is being measured and avoids the hassles noted here for applying Fieller's intervals.
|
Ratios of means - statistical comparison test using Fieller's theorem?
|
Although the general solution may be difficult, for this situation the solution is simple if analyses are performed in the log scale. I would argue that working in the log scale would make sense for t
|
Ratios of means - statistical comparison test using Fieller's theorem?
Although the general solution may be difficult, for this situation the solution is simple if analyses are performed in the log scale. I would argue that working in the log scale would make sense for this type of data even if ratios weren't being compared.
The experiments and desired comparisons described only make sense if all ion currents have the same sign (all inward or all outward with respect to the cells). Furthermore, errors in these types of measurements are often proportional to the values being measured rather than being independent of the values. So working in the log scale of (absolute value of) currents makes sense.
If $I$ represents current, 1 and 2 represent the genes, and $c$ and $a$ represent control and activator cases respectively, the desired comparison is $I_{1a}/I_{1c}$ versus $I_{2a}/I_{2c}$. In the log scale the null hypothesis becomes:
$$log(I_{1a})-log(I_{1c}) = log(I_{2a})-log(I_{2c})$$
which can be tested by examining an interaction between gene and activator in a standard linear model in this log scale. This approach has the advantage of easily being extended to multiple genes (and activators).
I suppose one could imagine situations where working in the log scale would be inappropriate, but for this type of comparison in biomedical experiments in practice the log transformation often makes sense in terms of what is being measured and avoids the hassles noted here for applying Fieller's intervals.
|
Ratios of means - statistical comparison test using Fieller's theorem?
Although the general solution may be difficult, for this situation the solution is simple if analyses are performed in the log scale. I would argue that working in the log scale would make sense for t
|
42,881
|
Are the posteriors "different"? How does one discuss the result?
|
I think the most appropriate summary for this application is just to simply state that the years were 15% different, ± some uncertainty. Here's why: first, the concept of statistical significance per se doesn't fit naturally into the Bayesian framework; second, in this application it's not really plausible that the parameter takes the exact same value in the two data sets, so you might as well just estimate the difference directly.
The interpretation of the fact that 0 is within the error bars is this: the data do not strongly indicate the sign of the difference. That's the Bayesian equivalent of "lack of statistical significance". But even if the result is not significant in this sense, you may (or may not) be able to make a scientifically interesting claim about the magnitude of the difference.
|
Are the posteriors "different"? How does one discuss the result?
|
I think the most appropriate summary for this application is just to simply state that the years were 15% different, ± some uncertainty. Here's why: first, the concept of statistical significance per
|
Are the posteriors "different"? How does one discuss the result?
I think the most appropriate summary for this application is just to simply state that the years were 15% different, ± some uncertainty. Here's why: first, the concept of statistical significance per se doesn't fit naturally into the Bayesian framework; second, in this application it's not really plausible that the parameter takes the exact same value in the two data sets, so you might as well just estimate the difference directly.
The interpretation of the fact that 0 is within the error bars is this: the data do not strongly indicate the sign of the difference. That's the Bayesian equivalent of "lack of statistical significance". But even if the result is not significant in this sense, you may (or may not) be able to make a scientifically interesting claim about the magnitude of the difference.
|
Are the posteriors "different"? How does one discuss the result?
I think the most appropriate summary for this application is just to simply state that the years were 15% different, ± some uncertainty. Here's why: first, the concept of statistical significance per
|
42,882
|
Variations in time series
|
You asked for a general explanation of the concept. Your comments about the current status of forecasting at three levels of aggregation is dead on ! My answer may not precisely deal with some of your specific interests as you have focused on some distractions but I thought that I would share the follwing with you. I was asked to discuss how software I had helped write could deal with and accomodate monthly vs weekly vs daily forecasts.
My response was in three parts :
A. Overall comments on weekly versus monthly
B. The argument for parsing the momrhly forecast to dai;ly using simple ratios
C. The argument against #2 and FOR daily forecasts to be DIRECTLY developed and then used to make weekly and/or monthly forecasts.
Response A)
Monthly:
Advantages – Fast to compute, easier to model, easier to identify changes in trends, better for strategic long term forecasting
Disadvantages – If you need to plan as the daily level for capacity, people and spoilage of product then higher levels of forecasting won’t help understand the demand on a daily basis as a 1/30th ration estimate is clearly insufficient.
Causal variables that change on a frequent basis (ie daily/weekly – price, promotion) are not easily integrated into monthly analysis
Integrating Macroeconomic variables like Quarterly Unemployment requires an additional step of creating splines.
Weekly:
Advantages – When you can’t handle the modeling process at a daily level you “settle” for this. When you have very systematic cyclical cycles like “artic ice extents” that follow a rigid curve and not need for day of the week variations.
Disadvantages – Floating Holidays like Thanksgiving, Easter, Ramadan, Chinese New Year change every year and disrupt the estimate for the coefficients for the week of the year impact which CAN be handled by creating a variable for each.
The number of weeks in a year is subject to change and creates a statistical issue due to the fact that every year doesn’t have 52 weeks. We have seen the need to allocate the 53rd week to a “non-player” week to make the data a standard 52 week period which is workable, but disruptive compared to daily data.
Causal variables that change on a frequent basis (ie daily/weekly – price, promotion) are not easily integrated into monthly analysis
Integrating Macroeconomic variables like Quarterly Unemployment requires an additional step of creating splines.
Response B) ( tongue-in-cheek answer )
Assuming you had the daily data in a data warehouse and you wanted to develop daily from the monthly forecasts.
I would take monthly forecasts and partition it to daily in the following manner.
Compute daily averages from the history database thus D1,D2,….D7 averages are known and will be used
I would compute the overall average (XBAR) and compute 7 indices I1=D1/XBAR ; I2=D2/XBAR …. I7=D7/XBAR thus the 7 I’s represent percentages i.e.
.9,1,2,…..8 for example.
I would then compute a forecast for DAY1 in the month by using the appropriate I value and get [1/30]*Monthly forecast*I , essentially adjusting the baseline daily forecast of 1/30 th of the monthly expectation.
Finally I would then normalize these DAILY forecasts so that they add to the monthly forecast.
Response C)
I should also add that the procedure I laid out in (B) is subject to a number of assumptions regarding the historical data , most of which are unrealistic in my opinion:
1) That there are no trends and no level shifts .
2) That there are no PULSES ( one time unusual values )
3) That there are no Holiday effects OR special days in the month effects OR special weeks in the month effects or beginning/end-of the month effects
4) There are no seasonality effects (monthly or weekly )
5) There have been no changes in the day-of-the-week averages over time
6) There is no autoregressive structure
7) There have been no chnages in model paramters or the error variance over time.
All of these considerations suggest that models should be developed at the daily level in order to provide information as quickly as possible.
Hope this helps !
|
Variations in time series
|
You asked for a general explanation of the concept. Your comments about the current status of forecasting at three levels of aggregation is dead on ! My answer may not precisely deal with some of you
|
Variations in time series
You asked for a general explanation of the concept. Your comments about the current status of forecasting at three levels of aggregation is dead on ! My answer may not precisely deal with some of your specific interests as you have focused on some distractions but I thought that I would share the follwing with you. I was asked to discuss how software I had helped write could deal with and accomodate monthly vs weekly vs daily forecasts.
My response was in three parts :
A. Overall comments on weekly versus monthly
B. The argument for parsing the momrhly forecast to dai;ly using simple ratios
C. The argument against #2 and FOR daily forecasts to be DIRECTLY developed and then used to make weekly and/or monthly forecasts.
Response A)
Monthly:
Advantages – Fast to compute, easier to model, easier to identify changes in trends, better for strategic long term forecasting
Disadvantages – If you need to plan as the daily level for capacity, people and spoilage of product then higher levels of forecasting won’t help understand the demand on a daily basis as a 1/30th ration estimate is clearly insufficient.
Causal variables that change on a frequent basis (ie daily/weekly – price, promotion) are not easily integrated into monthly analysis
Integrating Macroeconomic variables like Quarterly Unemployment requires an additional step of creating splines.
Weekly:
Advantages – When you can’t handle the modeling process at a daily level you “settle” for this. When you have very systematic cyclical cycles like “artic ice extents” that follow a rigid curve and not need for day of the week variations.
Disadvantages – Floating Holidays like Thanksgiving, Easter, Ramadan, Chinese New Year change every year and disrupt the estimate for the coefficients for the week of the year impact which CAN be handled by creating a variable for each.
The number of weeks in a year is subject to change and creates a statistical issue due to the fact that every year doesn’t have 52 weeks. We have seen the need to allocate the 53rd week to a “non-player” week to make the data a standard 52 week period which is workable, but disruptive compared to daily data.
Causal variables that change on a frequent basis (ie daily/weekly – price, promotion) are not easily integrated into monthly analysis
Integrating Macroeconomic variables like Quarterly Unemployment requires an additional step of creating splines.
Response B) ( tongue-in-cheek answer )
Assuming you had the daily data in a data warehouse and you wanted to develop daily from the monthly forecasts.
I would take monthly forecasts and partition it to daily in the following manner.
Compute daily averages from the history database thus D1,D2,….D7 averages are known and will be used
I would compute the overall average (XBAR) and compute 7 indices I1=D1/XBAR ; I2=D2/XBAR …. I7=D7/XBAR thus the 7 I’s represent percentages i.e.
.9,1,2,…..8 for example.
I would then compute a forecast for DAY1 in the month by using the appropriate I value and get [1/30]*Monthly forecast*I , essentially adjusting the baseline daily forecast of 1/30 th of the monthly expectation.
Finally I would then normalize these DAILY forecasts so that they add to the monthly forecast.
Response C)
I should also add that the procedure I laid out in (B) is subject to a number of assumptions regarding the historical data , most of which are unrealistic in my opinion:
1) That there are no trends and no level shifts .
2) That there are no PULSES ( one time unusual values )
3) That there are no Holiday effects OR special days in the month effects OR special weeks in the month effects or beginning/end-of the month effects
4) There are no seasonality effects (monthly or weekly )
5) There have been no changes in the day-of-the-week averages over time
6) There is no autoregressive structure
7) There have been no chnages in model paramters or the error variance over time.
All of these considerations suggest that models should be developed at the daily level in order to provide information as quickly as possible.
Hope this helps !
|
Variations in time series
You asked for a general explanation of the concept. Your comments about the current status of forecasting at three levels of aggregation is dead on ! My answer may not precisely deal with some of you
|
42,883
|
Variations in time series
|
It will depend on your research question.
I'm interested that there is no answer to this question so far; does it mean there is no standard solution? Seasonal adjustment seems to be extremely ad hoc...
If the company you are looking at is focused on "working days" (eg they are a firm that only produces on those days) then counts per working day would make sense. However, if business takes place even on holidays and weekends you would probably be better off with just counts per day. In either case you might find that in any modelling you do you want to include the number of weekends and/or non-working days as a variable to see if it helps explanation.
|
Variations in time series
|
It will depend on your research question.
I'm interested that there is no answer to this question so far; does it mean there is no standard solution? Seasonal adjustment seems to be extremely ad hoc.
|
Variations in time series
It will depend on your research question.
I'm interested that there is no answer to this question so far; does it mean there is no standard solution? Seasonal adjustment seems to be extremely ad hoc...
If the company you are looking at is focused on "working days" (eg they are a firm that only produces on those days) then counts per working day would make sense. However, if business takes place even on holidays and weekends you would probably be better off with just counts per day. In either case you might find that in any modelling you do you want to include the number of weekends and/or non-working days as a variable to see if it helps explanation.
|
Variations in time series
It will depend on your research question.
I'm interested that there is no answer to this question so far; does it mean there is no standard solution? Seasonal adjustment seems to be extremely ad hoc.
|
42,884
|
equivalence testing for a chi-squared test
|
An appropriate test statistic used to measure the degree of association between binomial paired variables is the log odds ratio.
The odds ratio expresses how much more likely there is to be a success in one case given a success in the other. for more info on odds ratios see Grimes & Schulz 2008
the important thing is that it is equal to one iff the two variables are independent.
taking the log of the ratio makes it symmetrical around zero.
As described in Testing Statistical Hypotheses of Equivalence and Noninferiority and here, to demonstrate equivalence one has to demonstrate (at a certain alpha) that the estimate of your statistic lies within the a predefined equivalence margin of the value you would expect for perfect equivalence.
The equivalence margin is the difference you would consider not practically different, and does not have a spesific value. It will depend on your spesific case and you will have to exercise some judgement..
For the log odds ratio wellek suggests 0.41 and 0.85 as strict and liberal bounds respectively
|
equivalence testing for a chi-squared test
|
An appropriate test statistic used to measure the degree of association between binomial paired variables is the log odds ratio.
The odds ratio expresses how much more likely there is to be a success
|
equivalence testing for a chi-squared test
An appropriate test statistic used to measure the degree of association between binomial paired variables is the log odds ratio.
The odds ratio expresses how much more likely there is to be a success in one case given a success in the other. for more info on odds ratios see Grimes & Schulz 2008
the important thing is that it is equal to one iff the two variables are independent.
taking the log of the ratio makes it symmetrical around zero.
As described in Testing Statistical Hypotheses of Equivalence and Noninferiority and here, to demonstrate equivalence one has to demonstrate (at a certain alpha) that the estimate of your statistic lies within the a predefined equivalence margin of the value you would expect for perfect equivalence.
The equivalence margin is the difference you would consider not practically different, and does not have a spesific value. It will depend on your spesific case and you will have to exercise some judgement..
For the log odds ratio wellek suggests 0.41 and 0.85 as strict and liberal bounds respectively
|
equivalence testing for a chi-squared test
An appropriate test statistic used to measure the degree of association between binomial paired variables is the log odds ratio.
The odds ratio expresses how much more likely there is to be a success
|
42,885
|
Time series prediction with non-constant sampling interval
|
Broadly speaking, I can think of three approaches:
Stay in your native space: Design a meaningful distance function $d(S_1, S_2)$ between samples. For instance, you could do something like summing $t_1 * t_2$ over every t in $S_1$ and $S_2$ and weighting by the distance between the two. Once you have this function, you can use kernel methods to do your learning (eg. SVMs if you're doing classification). If you want to prove that your SVM will converge you'll need to ensure that your distance function is positive semi-definite, but in practice it may well work fine either way. Your performance here will depend on how well you design your distance function.
Extract some features. Ie. map to an m-dimensional space. An example approach: divide your timeline into k (overlapping) bins for various values of k, and count three values for each bin 1 to k: the number of -1s, +1s and 0s (no signal). Then, concatenate all values (for all k, for 1 to k, all three frequencies) into a vector and use that as a representation of your instance. Then, you can use any basic classifier you like. Your performance here will depend on the quality of your feature extraction. It should capture as much relevant information and try to minimize the number of dimensions of the resulting vector.
Use a temporal model. A recurrent neural network or a hidden markov model can read the signals coming in and learn to synchronize with the signal. It will then continuously predict the next value at any moment. The drawback is that there is much less of a general framework. You'll have to do more work to implement everything for your domain, and comparing results between models is more difficult. Echo state networks (or reservoir computing) are probably a good model to investigate if your signal has a long memory.
I would go for the second option if you want to keep things simple, the first if you want to reduce arbitrary choices and the third if the first two don't work.
|
Time series prediction with non-constant sampling interval
|
Broadly speaking, I can think of three approaches:
Stay in your native space: Design a meaningful distance function $d(S_1, S_2)$ between samples. For instance, you could do something like summing $t
|
Time series prediction with non-constant sampling interval
Broadly speaking, I can think of three approaches:
Stay in your native space: Design a meaningful distance function $d(S_1, S_2)$ between samples. For instance, you could do something like summing $t_1 * t_2$ over every t in $S_1$ and $S_2$ and weighting by the distance between the two. Once you have this function, you can use kernel methods to do your learning (eg. SVMs if you're doing classification). If you want to prove that your SVM will converge you'll need to ensure that your distance function is positive semi-definite, but in practice it may well work fine either way. Your performance here will depend on how well you design your distance function.
Extract some features. Ie. map to an m-dimensional space. An example approach: divide your timeline into k (overlapping) bins for various values of k, and count three values for each bin 1 to k: the number of -1s, +1s and 0s (no signal). Then, concatenate all values (for all k, for 1 to k, all three frequencies) into a vector and use that as a representation of your instance. Then, you can use any basic classifier you like. Your performance here will depend on the quality of your feature extraction. It should capture as much relevant information and try to minimize the number of dimensions of the resulting vector.
Use a temporal model. A recurrent neural network or a hidden markov model can read the signals coming in and learn to synchronize with the signal. It will then continuously predict the next value at any moment. The drawback is that there is much less of a general framework. You'll have to do more work to implement everything for your domain, and comparing results between models is more difficult. Echo state networks (or reservoir computing) are probably a good model to investigate if your signal has a long memory.
I would go for the second option if you want to keep things simple, the first if you want to reduce arbitrary choices and the third if the first two don't work.
|
Time series prediction with non-constant sampling interval
Broadly speaking, I can think of three approaches:
Stay in your native space: Design a meaningful distance function $d(S_1, S_2)$ between samples. For instance, you could do something like summing $t
|
42,886
|
Time series prediction with non-constant sampling interval
|
If I understand correctly, this is just standard sequential binary prediction. You have an alphabet $\Sigma = \{-1,1\}$, and samples drawn from $\Sigma^*$ (the set of all finite length strings over your alphabet) Given a string $s_{1:t-1} \in \Sigma^*$ (the observations from time $1$ to $t-1$) you want to predict $s_{t}$.
There are many techniques you could apply. What's going to be best is largely dependent on the nature of the data, especially things like how long each sequence is and how complex the dependency structure is. For example, it may be the case that $s_{t+1} = \text{sign}\left(\sum_{i=1}^{t} s_i\right) =$ the most frequent symbol is a good predictor. On the other hand if your data features dependencies separated by long time periods, something like $s_i = -1 \implies P(s_{i+100} = 1) >> P(s_{i+100} = -1)$, you're going to have a bad time as these types of relationship are notoriously hard to learn.
Without knowing more it is difficult to suggest any particular approach but here are some potential ideas to get your started/give you things to google.
$n^{th}$ order markov models
$k$-nearest neighbors with some appropriate distance function (Levenshtein distance for example)
hidden markov models
recurrent neural networks
context tree weighting
|
Time series prediction with non-constant sampling interval
|
If I understand correctly, this is just standard sequential binary prediction. You have an alphabet $\Sigma = \{-1,1\}$, and samples drawn from $\Sigma^*$ (the set of all finite length strings over yo
|
Time series prediction with non-constant sampling interval
If I understand correctly, this is just standard sequential binary prediction. You have an alphabet $\Sigma = \{-1,1\}$, and samples drawn from $\Sigma^*$ (the set of all finite length strings over your alphabet) Given a string $s_{1:t-1} \in \Sigma^*$ (the observations from time $1$ to $t-1$) you want to predict $s_{t}$.
There are many techniques you could apply. What's going to be best is largely dependent on the nature of the data, especially things like how long each sequence is and how complex the dependency structure is. For example, it may be the case that $s_{t+1} = \text{sign}\left(\sum_{i=1}^{t} s_i\right) =$ the most frequent symbol is a good predictor. On the other hand if your data features dependencies separated by long time periods, something like $s_i = -1 \implies P(s_{i+100} = 1) >> P(s_{i+100} = -1)$, you're going to have a bad time as these types of relationship are notoriously hard to learn.
Without knowing more it is difficult to suggest any particular approach but here are some potential ideas to get your started/give you things to google.
$n^{th}$ order markov models
$k$-nearest neighbors with some appropriate distance function (Levenshtein distance for example)
hidden markov models
recurrent neural networks
context tree weighting
|
Time series prediction with non-constant sampling interval
If I understand correctly, this is just standard sequential binary prediction. You have an alphabet $\Sigma = \{-1,1\}$, and samples drawn from $\Sigma^*$ (the set of all finite length strings over yo
|
42,887
|
Markov Chain process - Missing values
|
This is best and most transparently done in bayesian modelling. Bayesian inference works using MCMC (Markov Chain Monte Carlo) simulations, and that's exactly what you need. Example model code in bugs (not tested!):
dataset[1] ~ dbern(P1) # you must somehow solve the first element
for (i in 2:n) { # markov chain - define how each value depends on the previous one
dataset[i] ~ dbern(p.presence[dataset[i - 1]])
}
dbern(p) stands for Bernoulli distribution with probability p. The array p.presence can be defined as (using P* variables as you defined them):
p.presence[0] = P01 / P0 # probability of presence, given absence in previous step
p.presence[1] = P11 / P1 # probability of presence, given presence in previous step
This way you can pass p.presence as input data (as in your example), but you could also let bugs to estimate it from the data!! (this is much more common and reasonable). You can of course get posterior distributions and MCMC simulation samples for the missing values (NA) in the dataset, and compute various other statistics on it.
|
Markov Chain process - Missing values
|
This is best and most transparently done in bayesian modelling. Bayesian inference works using MCMC (Markov Chain Monte Carlo) simulations, and that's exactly what you need. Example model code in bugs
|
Markov Chain process - Missing values
This is best and most transparently done in bayesian modelling. Bayesian inference works using MCMC (Markov Chain Monte Carlo) simulations, and that's exactly what you need. Example model code in bugs (not tested!):
dataset[1] ~ dbern(P1) # you must somehow solve the first element
for (i in 2:n) { # markov chain - define how each value depends on the previous one
dataset[i] ~ dbern(p.presence[dataset[i - 1]])
}
dbern(p) stands for Bernoulli distribution with probability p. The array p.presence can be defined as (using P* variables as you defined them):
p.presence[0] = P01 / P0 # probability of presence, given absence in previous step
p.presence[1] = P11 / P1 # probability of presence, given presence in previous step
This way you can pass p.presence as input data (as in your example), but you could also let bugs to estimate it from the data!! (this is much more common and reasonable). You can of course get posterior distributions and MCMC simulation samples for the missing values (NA) in the dataset, and compute various other statistics on it.
|
Markov Chain process - Missing values
This is best and most transparently done in bayesian modelling. Bayesian inference works using MCMC (Markov Chain Monte Carlo) simulations, and that's exactly what you need. Example model code in bugs
|
42,888
|
Deep belief network performs worse than a simple MLP
|
My guess is that your training procedure is simply unable to find good parameters for such a big model. It is quite hard to get an MLP with more than three layers to work well on image classification problems, even when pretraining with a DBN. Most papers on image classification I have seen use three layers or even show that the performance decreases when you use more layers (this paper for example, table 6). So yes, this behavior is kind of normal.
It also fits with my experience with DBNs. After two or three layers, the generative performance of the DBN saturates or even decreases.
Another hint that you are likely facing an underfitting problem is your performance. Yann LeCun's website shows that you can get below 3% error even with fairly small 3-layer MLPs. Your error on the other hand seems to stay well above 5% for all of your models.
My suggestion would therefore be to stick with a smaller model or switch to more powerful optimization techniques.
|
Deep belief network performs worse than a simple MLP
|
My guess is that your training procedure is simply unable to find good parameters for such a big model. It is quite hard to get an MLP with more than three layers to work well on image classification
|
Deep belief network performs worse than a simple MLP
My guess is that your training procedure is simply unable to find good parameters for such a big model. It is quite hard to get an MLP with more than three layers to work well on image classification problems, even when pretraining with a DBN. Most papers on image classification I have seen use three layers or even show that the performance decreases when you use more layers (this paper for example, table 6). So yes, this behavior is kind of normal.
It also fits with my experience with DBNs. After two or three layers, the generative performance of the DBN saturates or even decreases.
Another hint that you are likely facing an underfitting problem is your performance. Yann LeCun's website shows that you can get below 3% error even with fairly small 3-layer MLPs. Your error on the other hand seems to stay well above 5% for all of your models.
My suggestion would therefore be to stick with a smaller model or switch to more powerful optimization techniques.
|
Deep belief network performs worse than a simple MLP
My guess is that your training procedure is simply unable to find good parameters for such a big model. It is quite hard to get an MLP with more than three layers to work well on image classification
|
42,889
|
Deep belief network performs worse than a simple MLP
|
I'm seeing similar results but with a much simpler network using only a single hidden layer. I'm doing some tests on the CIFAR-10 image database. My network is 768-64-1, a binary classifier. If I use a RBM to pre-train layer 768-64 + backprop I get an F1 score of about 0.38 on validation/test. Where as using random weights with no pre-training and backprop I get an F1 score of about 0.45.
The weights learnt by the RBM are more meaningful visually, you can make out features that correspond to the data. Where as the random weights don't evolve past randomness much, yet perform better.
|
Deep belief network performs worse than a simple MLP
|
I'm seeing similar results but with a much simpler network using only a single hidden layer. I'm doing some tests on the CIFAR-10 image database. My network is 768-64-1, a binary classifier. If I use
|
Deep belief network performs worse than a simple MLP
I'm seeing similar results but with a much simpler network using only a single hidden layer. I'm doing some tests on the CIFAR-10 image database. My network is 768-64-1, a binary classifier. If I use a RBM to pre-train layer 768-64 + backprop I get an F1 score of about 0.38 on validation/test. Where as using random weights with no pre-training and backprop I get an F1 score of about 0.45.
The weights learnt by the RBM are more meaningful visually, you can make out features that correspond to the data. Where as the random weights don't evolve past randomness much, yet perform better.
|
Deep belief network performs worse than a simple MLP
I'm seeing similar results but with a much simpler network using only a single hidden layer. I'm doing some tests on the CIFAR-10 image database. My network is 768-64-1, a binary classifier. If I use
|
42,890
|
What is the standard error for the distribution of the difference in proportions (for hypothesis testing)?
|
The proportions $p_1$ and $p_2$ you use in the variance should be the true proportions under the null hypothesis, where $p_1=p_2+c$. Obviously you don't know what these are (other than $c$) so you have to estimate them from your data. Either of the formulae you have reasonable estimates, but it is possible to combine them.
Consider we start with the obvious estimates $\hat{p_1}=\frac{X_1}{n_1}$ and $\hat{p_2}=\frac{X_2}{n_2}$. This won't do because they are unlikely to be exactly $c$ different. Consider an alternative estimate of $\hat{p_1}=\frac{X_2}{n_2}+c=\hat{p_2}+c$. Then you might construct a weighted average of your two estimates of $p_1$:
$\hat{p_{1b}}=\frac{n_2(\hat{p_2}+c)+n_1\hat{p_1}}{n_1+n_2}$
which reduces to:
$\hat{p_{1b}}=\frac{X_2+n_{2}c+X_1}{n_1+n_2}$
So then I'd use that in the formula to estimate the standard error of the distribution
$\sigma_{\hat{p}_{1b} - \hat{p}_2}=\sqrt{\frac{\hat{p}_{1b}(1-\hat{p}_{1b})}{n_1}+\frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}$
In practice, my experience is that this sort of thing doesn't make much difference...
With regard to your post script, the reason the difference is asymptotically normal is, as you guess, because the linear combination of two normal distributed random variables is also normally distributed (and the same goes when the normality is only asymptotic).
|
What is the standard error for the distribution of the difference in proportions (for hypothesis tes
|
The proportions $p_1$ and $p_2$ you use in the variance should be the true proportions under the null hypothesis, where $p_1=p_2+c$. Obviously you don't know what these are (other than $c$) so you ha
|
What is the standard error for the distribution of the difference in proportions (for hypothesis testing)?
The proportions $p_1$ and $p_2$ you use in the variance should be the true proportions under the null hypothesis, where $p_1=p_2+c$. Obviously you don't know what these are (other than $c$) so you have to estimate them from your data. Either of the formulae you have reasonable estimates, but it is possible to combine them.
Consider we start with the obvious estimates $\hat{p_1}=\frac{X_1}{n_1}$ and $\hat{p_2}=\frac{X_2}{n_2}$. This won't do because they are unlikely to be exactly $c$ different. Consider an alternative estimate of $\hat{p_1}=\frac{X_2}{n_2}+c=\hat{p_2}+c$. Then you might construct a weighted average of your two estimates of $p_1$:
$\hat{p_{1b}}=\frac{n_2(\hat{p_2}+c)+n_1\hat{p_1}}{n_1+n_2}$
which reduces to:
$\hat{p_{1b}}=\frac{X_2+n_{2}c+X_1}{n_1+n_2}$
So then I'd use that in the formula to estimate the standard error of the distribution
$\sigma_{\hat{p}_{1b} - \hat{p}_2}=\sqrt{\frac{\hat{p}_{1b}(1-\hat{p}_{1b})}{n_1}+\frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}$
In practice, my experience is that this sort of thing doesn't make much difference...
With regard to your post script, the reason the difference is asymptotically normal is, as you guess, because the linear combination of two normal distributed random variables is also normally distributed (and the same goes when the normality is only asymptotic).
|
What is the standard error for the distribution of the difference in proportions (for hypothesis tes
The proportions $p_1$ and $p_2$ you use in the variance should be the true proportions under the null hypothesis, where $p_1=p_2+c$. Obviously you don't know what these are (other than $c$) so you ha
|
42,891
|
Joint likelihood of two models
|
So it turns out the solution is trivial, and is simply the sum of the two sub-models.
|
Joint likelihood of two models
|
So it turns out the solution is trivial, and is simply the sum of the two sub-models.
|
Joint likelihood of two models
So it turns out the solution is trivial, and is simply the sum of the two sub-models.
|
Joint likelihood of two models
So it turns out the solution is trivial, and is simply the sum of the two sub-models.
|
42,892
|
Bayesian Updating Without Conjugate Prior
|
One approach is to fit a density estimator to your first posterior distribution, then use the estimated density as the prior in your update. One option for a density estimator to use is logspline densities, see the logspline package in R for one way to fit these.
It depends on what tool you are using to do your gibbs sampling as to how you would specify the logspline (or other estimator) as you prior (once you have the coefficients from the logspline function the log density is just a sum of cubic polynomials so it should be fairly simple to translate to most Gibbs samplers). I have seen a trick in WinBugs and OpenBugs where you use a chisquare as an intermediate distribution but specify your own function that gives your prior. Tools like Stan let you program your own prior. If you do this in regular R then you can just use the logspline functions there.
|
Bayesian Updating Without Conjugate Prior
|
One approach is to fit a density estimator to your first posterior distribution, then use the estimated density as the prior in your update. One option for a density estimator to use is logspline den
|
Bayesian Updating Without Conjugate Prior
One approach is to fit a density estimator to your first posterior distribution, then use the estimated density as the prior in your update. One option for a density estimator to use is logspline densities, see the logspline package in R for one way to fit these.
It depends on what tool you are using to do your gibbs sampling as to how you would specify the logspline (or other estimator) as you prior (once you have the coefficients from the logspline function the log density is just a sum of cubic polynomials so it should be fairly simple to translate to most Gibbs samplers). I have seen a trick in WinBugs and OpenBugs where you use a chisquare as an intermediate distribution but specify your own function that gives your prior. Tools like Stan let you program your own prior. If you do this in regular R then you can just use the logspline functions there.
|
Bayesian Updating Without Conjugate Prior
One approach is to fit a density estimator to your first posterior distribution, then use the estimated density as the prior in your update. One option for a density estimator to use is logspline den
|
42,893
|
Reference on examples with R codes for Bayesian simulation based methods of posterior approximation
|
Online information would suggest
Christian Robert, George Casella (2009). Introducing Monte Carlo Methods with R. Springer-Verlag, New York.
would at least be a start and the code is available in the mcsm package here.
Perhaps someone who has actually read it might be able to provide further comments.
|
Reference on examples with R codes for Bayesian simulation based methods of posterior approximation
|
Online information would suggest
Christian Robert, George Casella (2009). Introducing Monte Carlo Methods with R. Springer-Verlag, New York.
would at least be a start and the code is available in t
|
Reference on examples with R codes for Bayesian simulation based methods of posterior approximation
Online information would suggest
Christian Robert, George Casella (2009). Introducing Monte Carlo Methods with R. Springer-Verlag, New York.
would at least be a start and the code is available in the mcsm package here.
Perhaps someone who has actually read it might be able to provide further comments.
|
Reference on examples with R codes for Bayesian simulation based methods of posterior approximation
Online information would suggest
Christian Robert, George Casella (2009). Introducing Monte Carlo Methods with R. Springer-Verlag, New York.
would at least be a start and the code is available in t
|
42,894
|
Creating a recommender system for shoe sizing
|
Depends what assumptions you're willing to make about the sizing of shoes. For instance, I think it's safe to assume the difference between a size 9 to 10 Redwings Iron Ranger is similar to the difference between a 10 and 11 Adidas Samba. If a 9 IR wears a 10 Samba, then we'd know a 10IR would wear an 11 Samba.
It also depends on whether you have information on multiple shoes within individuals in which case you'd get more information with your repeated measures. Assuming you didn't, you can simple take the grand average of sizes within each shoe group and compare the average difference between groups under the assumption people don't own shoes that don't fit.
If you did have multiple measurements, you can get a more precise recommendation by fitting a mixed effects model which will average over the individual effects and estimate a categorical individual difference between sizes in each shoe.
$$ \mathbb{E}[ \mbox{Size} | \mbox{Brand}, \mbox{Individual}] = \beta_{0, i} + \beta_{1, b} * \mbox{Brand} $$
SPSS, R, SAS and statistical software can fit these, but not your plain vanilla Excel.
It's worth noting that shoes in general run both wide and long, so you might consider asking a more refined question about how to recommend someone buy a pair of shoes based on fits which are purported to run long/wide.
|
Creating a recommender system for shoe sizing
|
Depends what assumptions you're willing to make about the sizing of shoes. For instance, I think it's safe to assume the difference between a size 9 to 10 Redwings Iron Ranger is similar to the differ
|
Creating a recommender system for shoe sizing
Depends what assumptions you're willing to make about the sizing of shoes. For instance, I think it's safe to assume the difference between a size 9 to 10 Redwings Iron Ranger is similar to the difference between a 10 and 11 Adidas Samba. If a 9 IR wears a 10 Samba, then we'd know a 10IR would wear an 11 Samba.
It also depends on whether you have information on multiple shoes within individuals in which case you'd get more information with your repeated measures. Assuming you didn't, you can simple take the grand average of sizes within each shoe group and compare the average difference between groups under the assumption people don't own shoes that don't fit.
If you did have multiple measurements, you can get a more precise recommendation by fitting a mixed effects model which will average over the individual effects and estimate a categorical individual difference between sizes in each shoe.
$$ \mathbb{E}[ \mbox{Size} | \mbox{Brand}, \mbox{Individual}] = \beta_{0, i} + \beta_{1, b} * \mbox{Brand} $$
SPSS, R, SAS and statistical software can fit these, but not your plain vanilla Excel.
It's worth noting that shoes in general run both wide and long, so you might consider asking a more refined question about how to recommend someone buy a pair of shoes based on fits which are purported to run long/wide.
|
Creating a recommender system for shoe sizing
Depends what assumptions you're willing to make about the sizing of shoes. For instance, I think it's safe to assume the difference between a size 9 to 10 Redwings Iron Ranger is similar to the differ
|
42,895
|
How to calculate chi squared from mauchly of R's ezANOVA output?
|
Using this paper on Mauchly Test (switched the $W$ to $\log(W)$),
I can get an approximate value for $\chi^2$:
library(reshape2); library(ez)
dat <- data.frame(id=as.factor(1:10), matrix(rpois(90, 10), ncol=9))
dat2 <- melt(dat)
mod <- ezANOVA(data=dat2, dv = .(value), wid=.(id), within=.(variable),
detailed=TRUE, type=3)
mod
#or repeated measures
k <- 5
#number of particpants
n <- 9
d <- 1 - ((2 * ((k - 1)^2)+(k - 1)+2)/(6*(k - 1)*(n - 1)))
W <- mod[[2]][2] #Mauchly's W from ezANOVA
-(n-1)*d*log(W) #chi^2
(k*(k - 1)/2) - 1 #df
|
How to calculate chi squared from mauchly of R's ezANOVA output?
|
Using this paper on Mauchly Test (switched the $W$ to $\log(W)$),
I can get an approximate value for $\chi^2$:
library(reshape2); library(ez)
dat <- data.frame(id=as.factor(1:10), matrix(rpois(90, 10)
|
How to calculate chi squared from mauchly of R's ezANOVA output?
Using this paper on Mauchly Test (switched the $W$ to $\log(W)$),
I can get an approximate value for $\chi^2$:
library(reshape2); library(ez)
dat <- data.frame(id=as.factor(1:10), matrix(rpois(90, 10), ncol=9))
dat2 <- melt(dat)
mod <- ezANOVA(data=dat2, dv = .(value), wid=.(id), within=.(variable),
detailed=TRUE, type=3)
mod
#or repeated measures
k <- 5
#number of particpants
n <- 9
d <- 1 - ((2 * ((k - 1)^2)+(k - 1)+2)/(6*(k - 1)*(n - 1)))
W <- mod[[2]][2] #Mauchly's W from ezANOVA
-(n-1)*d*log(W) #chi^2
(k*(k - 1)/2) - 1 #df
|
How to calculate chi squared from mauchly of R's ezANOVA output?
Using this paper on Mauchly Test (switched the $W$ to $\log(W)$),
I can get an approximate value for $\chi^2$:
library(reshape2); library(ez)
dat <- data.frame(id=as.factor(1:10), matrix(rpois(90, 10)
|
42,896
|
Understanding the random effect in linear mixed models (lme4, R) [duplicate]
|
To answer your question (or at least part of it), why do all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)... I think the answer is that they are simply trying to be more clear in their notation. (1+P$fgrupp|P$lweek) and (P$grupp|P$lweek) do yield the same results. However, (P$grupp|P$lweek) implies the existance of an estimated intercept where as (1+P$grupp|P$lweek) makes it explicit. By the way, if you didn't want to estimate the intercept you'd replace the 1 with a 0, e.g. (0+P$grupp|P$lweek).
By the way Roland is probably right. P$fgrupp|P$lweek is going to try to estimate a different effect of group for each 'lweek' you have in your data. If 'lweek' is weeks, this probably isn't the appopriate grouping factor. What is the appopriate grouping factor, type of feed or cows is going to depend on your experimental design.
|
Understanding the random effect in linear mixed models (lme4, R) [duplicate]
|
To answer your question (or at least part of it), why do all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)... I think the answer is that they are simply try
|
Understanding the random effect in linear mixed models (lme4, R) [duplicate]
To answer your question (or at least part of it), why do all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)... I think the answer is that they are simply trying to be more clear in their notation. (1+P$fgrupp|P$lweek) and (P$grupp|P$lweek) do yield the same results. However, (P$grupp|P$lweek) implies the existance of an estimated intercept where as (1+P$grupp|P$lweek) makes it explicit. By the way, if you didn't want to estimate the intercept you'd replace the 1 with a 0, e.g. (0+P$grupp|P$lweek).
By the way Roland is probably right. P$fgrupp|P$lweek is going to try to estimate a different effect of group for each 'lweek' you have in your data. If 'lweek' is weeks, this probably isn't the appopriate grouping factor. What is the appopriate grouping factor, type of feed or cows is going to depend on your experimental design.
|
Understanding the random effect in linear mixed models (lme4, R) [duplicate]
To answer your question (or at least part of it), why do all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)... I think the answer is that they are simply try
|
42,897
|
Can this be considered close to normally distributed?
|
I think that you are mixing together a couple of different concepts. You ask about normality, using t-tests, and deciding if something is large.
First, no, the data shown is not considered close to normal, but if you are interested in using t-tests then that is not the important question. The population and sample distributions are less important than the sampling distribution when determining if t-tests can be used. What determines the shape of the sampling distribution is a combination of the population distribution, how the sample is obtained, and the sample size. The beauty of the Central Limit Theorem (and it is beautiful enough that I have a cross-stitch of it on my wall) is that as the sample size gets large the sampling distribution becomes more like the normal distribution, so for a large sample size and a simple random sample (or samples similar to SRS) we can use the t-tests and the approximation will be very good. The important thing to be large here is the sample size, not the data or standard deviation. If you believe that the data shown above represent the population (which needs to come from your knowledge of the science behind the data) and with a sample size of 1536 the normal based inference (t-test and others) will be very good approximations.
If your goal is to determine which farms are "large", then the t-test proceedures do not answer that question. That will be more determined by the science behind the data and the question of interest and you will not be able to use the normal or t distributions for this data looking at decisions about individual farms.
|
Can this be considered close to normally distributed?
|
I think that you are mixing together a couple of different concepts. You ask about normality, using t-tests, and deciding if something is large.
First, no, the data shown is not considered close to n
|
Can this be considered close to normally distributed?
I think that you are mixing together a couple of different concepts. You ask about normality, using t-tests, and deciding if something is large.
First, no, the data shown is not considered close to normal, but if you are interested in using t-tests then that is not the important question. The population and sample distributions are less important than the sampling distribution when determining if t-tests can be used. What determines the shape of the sampling distribution is a combination of the population distribution, how the sample is obtained, and the sample size. The beauty of the Central Limit Theorem (and it is beautiful enough that I have a cross-stitch of it on my wall) is that as the sample size gets large the sampling distribution becomes more like the normal distribution, so for a large sample size and a simple random sample (or samples similar to SRS) we can use the t-tests and the approximation will be very good. The important thing to be large here is the sample size, not the data or standard deviation. If you believe that the data shown above represent the population (which needs to come from your knowledge of the science behind the data) and with a sample size of 1536 the normal based inference (t-test and others) will be very good approximations.
If your goal is to determine which farms are "large", then the t-test proceedures do not answer that question. That will be more determined by the science behind the data and the question of interest and you will not be able to use the normal or t distributions for this data looking at decisions about individual farms.
|
Can this be considered close to normally distributed?
I think that you are mixing together a couple of different concepts. You ask about normality, using t-tests, and deciding if something is large.
First, no, the data shown is not considered close to n
|
42,898
|
How to combine the responses of two sensors?
|
You may want to have a look on Dempster-Shafer theory. This framework has been investigated for merging information coming from sensors, for instance you can have a look at the following papers:
Information fusion and evidential grammars for object class
segmentation
Information Fusion on Oversegmented Images:
An Application for Urban Scene Understanding
|
How to combine the responses of two sensors?
|
You may want to have a look on Dempster-Shafer theory. This framework has been investigated for merging information coming from sensors, for instance you can have a look at the following papers:
Inf
|
How to combine the responses of two sensors?
You may want to have a look on Dempster-Shafer theory. This framework has been investigated for merging information coming from sensors, for instance you can have a look at the following papers:
Information fusion and evidential grammars for object class
segmentation
Information Fusion on Oversegmented Images:
An Application for Urban Scene Understanding
|
How to combine the responses of two sensors?
You may want to have a look on Dempster-Shafer theory. This framework has been investigated for merging information coming from sensors, for instance you can have a look at the following papers:
Inf
|
42,899
|
How to combine the responses of two sensors?
|
Being sensed is a binary outcome. The sensors' distance from target is a covariate that determine the outcomes. Logistic regression is one way to model this. The model would look like a smooth 2-dimensional surface over the x-y plane where x and y represent the respective sensor's distance from the target, with the height being the logit of p where p is the probability that the target is sensed (I am assuming that the definition of target being detected is that at least one of the sensors detects it).
There are other possibilities of modeling a binary outcome, probit analysis is one alternative for example. The choice will depend on what modeling assumptions you think are reasonable.
|
How to combine the responses of two sensors?
|
Being sensed is a binary outcome. The sensors' distance from target is a covariate that determine the outcomes. Logistic regression is one way to model this. The model would look like a smooth 2-dim
|
How to combine the responses of two sensors?
Being sensed is a binary outcome. The sensors' distance from target is a covariate that determine the outcomes. Logistic regression is one way to model this. The model would look like a smooth 2-dimensional surface over the x-y plane where x and y represent the respective sensor's distance from the target, with the height being the logit of p where p is the probability that the target is sensed (I am assuming that the definition of target being detected is that at least one of the sensors detects it).
There are other possibilities of modeling a binary outcome, probit analysis is one alternative for example. The choice will depend on what modeling assumptions you think are reasonable.
|
How to combine the responses of two sensors?
Being sensed is a binary outcome. The sensors' distance from target is a covariate that determine the outcomes. Logistic regression is one way to model this. The model would look like a smooth 2-dim
|
42,900
|
Model broken stick model in R where one line has a constant gradient?
|
I may have found a solution to my problem, but could someone please confirm what I've done?
I slightly modified the above functions b1 and b2. I have called them b3 and b4:
b3 <- function(x, bp) ifelse(x < bp, bp - x, 0) #Y = mx + c
b4 <- function(x, bp) ifelse(x < bp, 0, 1) #Y = C
The mixed model is similar, but b3 and b4 are used:
mod2 <- lmer(SIGNAL ~ b3(dci, bp) + b4(dci,bp) + (1 | gauge), data = cand_bug_data)
|
Model broken stick model in R where one line has a constant gradient?
|
I may have found a solution to my problem, but could someone please confirm what I've done?
I slightly modified the above functions b1 and b2. I have called them b3 and b4:
b3 <- function(x, bp) ifels
|
Model broken stick model in R where one line has a constant gradient?
I may have found a solution to my problem, but could someone please confirm what I've done?
I slightly modified the above functions b1 and b2. I have called them b3 and b4:
b3 <- function(x, bp) ifelse(x < bp, bp - x, 0) #Y = mx + c
b4 <- function(x, bp) ifelse(x < bp, 0, 1) #Y = C
The mixed model is similar, but b3 and b4 are used:
mod2 <- lmer(SIGNAL ~ b3(dci, bp) + b4(dci,bp) + (1 | gauge), data = cand_bug_data)
|
Model broken stick model in R where one line has a constant gradient?
I may have found a solution to my problem, but could someone please confirm what I've done?
I slightly modified the above functions b1 and b2. I have called them b3 and b4:
b3 <- function(x, bp) ifels
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.