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
|
|---|---|---|---|---|---|---|
41,701
|
Experimental design & questions on use of generalized linear models
|
Software: R is certainly a good choice. I use python for this sort of thing; I write my own objective/gradient function(s) and use one of the scipy optimizers, like L-BFGS. But, R is better if you aren't a strong programmer.
Caveat: I'm a machine learning guy, not a statistician, so please consider my answer to be one opinion, not the "right answer".
It sounds like your model should have at least coefficients for (1) is treatment?, (2) is control?, (3) each plot, (4) each region, (5) week-of-year, (6) week-of-year-and-region, (7) water depth, (8) bird species, (9) water-depth-and-bird-species. After including all of these, I'd look at residuals to try to determine any obvious ones I missed. Though, it sounds like you have a pretty good idea of all of the major covariates.
I would try different models (Poisson, negative binomial, zero-inflated Poisson) and use a hold-out set to determine which is more appropriate. I would use L2 regularization and seriously consider L2 normalizing the covariates (at least approximately).
If there is a strong covariate like depth, I'd definitely want to include it in my model, else other covariates may appear stronger than they really are.
|
Experimental design & questions on use of generalized linear models
|
Software: R is certainly a good choice. I use python for this sort of thing; I write my own objective/gradient function(s) and use one of the scipy optimizers, like L-BFGS. But, R is better if you a
|
Experimental design & questions on use of generalized linear models
Software: R is certainly a good choice. I use python for this sort of thing; I write my own objective/gradient function(s) and use one of the scipy optimizers, like L-BFGS. But, R is better if you aren't a strong programmer.
Caveat: I'm a machine learning guy, not a statistician, so please consider my answer to be one opinion, not the "right answer".
It sounds like your model should have at least coefficients for (1) is treatment?, (2) is control?, (3) each plot, (4) each region, (5) week-of-year, (6) week-of-year-and-region, (7) water depth, (8) bird species, (9) water-depth-and-bird-species. After including all of these, I'd look at residuals to try to determine any obvious ones I missed. Though, it sounds like you have a pretty good idea of all of the major covariates.
I would try different models (Poisson, negative binomial, zero-inflated Poisson) and use a hold-out set to determine which is more appropriate. I would use L2 regularization and seriously consider L2 normalizing the covariates (at least approximately).
If there is a strong covariate like depth, I'd definitely want to include it in my model, else other covariates may appear stronger than they really are.
|
Experimental design & questions on use of generalized linear models
Software: R is certainly a good choice. I use python for this sort of thing; I write my own objective/gradient function(s) and use one of the scipy optimizers, like L-BFGS. But, R is better if you a
|
41,702
|
Experimental design & questions on use of generalized linear models
|
If you choose a negative bionomial, then the package glmmADMB in R is the package for you. It is fantastic! It works just like a lmer model (where you can have fixed, random effects and nested components if you choose, along with the negative bionomial distribution/family.
Best of luck.
Here is an example from the package description:
om <- glmmadmb(SiblingNegotiation ~ FoodTreatment * SexParent(1|Nest) +
offset(log(BroodSize)),
zeroInflation=TRUE, family="nbinom", data=Owls)
|
Experimental design & questions on use of generalized linear models
|
If you choose a negative bionomial, then the package glmmADMB in R is the package for you. It is fantastic! It works just like a lmer model (where you can have fixed, random effects and nested compone
|
Experimental design & questions on use of generalized linear models
If you choose a negative bionomial, then the package glmmADMB in R is the package for you. It is fantastic! It works just like a lmer model (where you can have fixed, random effects and nested components if you choose, along with the negative bionomial distribution/family.
Best of luck.
Here is an example from the package description:
om <- glmmadmb(SiblingNegotiation ~ FoodTreatment * SexParent(1|Nest) +
offset(log(BroodSize)),
zeroInflation=TRUE, family="nbinom", data=Owls)
|
Experimental design & questions on use of generalized linear models
If you choose a negative bionomial, then the package glmmADMB in R is the package for you. It is fantastic! It works just like a lmer model (where you can have fixed, random effects and nested compone
|
41,703
|
How to calculate the interaction standard error of a linear regression model in R?
|
You will need a little more information than summary(reg) provides, namely, the covariance matrix of the estimates. vcov(reg) will give that to you:
x1 <- rnorm(100)
x2 <- 0.7*rnorm(100) + 0.7*x1
y <- x1 + x2 + rnorm(100)
reg <- lm(y~x1+x2)
vcov(reg)
(Intercept) x1 x2
(Intercept) 0.009780556 -0.002229766 0.001652152
x1 -0.002229766 0.016996594 -0.012423096
x2 0.001652152 -0.012423096 0.018662900
The covariance between the coefficient of x1 and x2 is in the cell with row label x1 and column label x2 (or vice versa), and the variance terms are on the diagonal.
The difference between vcov(reg) and summary(reg)$cov is that the latter is not scaled by $\hat{\sigma}^2$.
|
How to calculate the interaction standard error of a linear regression model in R?
|
You will need a little more information than summary(reg) provides, namely, the covariance matrix of the estimates. vcov(reg) will give that to you:
x1 <- rnorm(100)
x2 <- 0.7*rnorm(100) + 0.7*x1
y <
|
How to calculate the interaction standard error of a linear regression model in R?
You will need a little more information than summary(reg) provides, namely, the covariance matrix of the estimates. vcov(reg) will give that to you:
x1 <- rnorm(100)
x2 <- 0.7*rnorm(100) + 0.7*x1
y <- x1 + x2 + rnorm(100)
reg <- lm(y~x1+x2)
vcov(reg)
(Intercept) x1 x2
(Intercept) 0.009780556 -0.002229766 0.001652152
x1 -0.002229766 0.016996594 -0.012423096
x2 0.001652152 -0.012423096 0.018662900
The covariance between the coefficient of x1 and x2 is in the cell with row label x1 and column label x2 (or vice versa), and the variance terms are on the diagonal.
The difference between vcov(reg) and summary(reg)$cov is that the latter is not scaled by $\hat{\sigma}^2$.
|
How to calculate the interaction standard error of a linear regression model in R?
You will need a little more information than summary(reg) provides, namely, the covariance matrix of the estimates. vcov(reg) will give that to you:
x1 <- rnorm(100)
x2 <- 0.7*rnorm(100) + 0.7*x1
y <
|
41,704
|
What is the conventional definition of recurrence-free survival?
|
As you have seen, both definitions are acceptable, mostly because both options have problems. Even the FDA does not seem to express a preference. Quoting from Guidance for Industry Clinical Trial Endpoints for the Approval of Cancer Drugs and Biologics (DFS is Disease Free Survival):
The definition of DFS can be complicated, particularly when deaths are noted without prior tumor progression documentation. These events can be scored either as disease recurrences or as censored events. Although all methods for statistical analysis of deaths have some limitations, considering all deaths (deaths from all causes) as recurrences can minimize bias. DFS can be overestimated using this definition, especially in patients who die after a long period without observation. Bias can be introduced if the frequency of long-term follow-up visits is dissimilar between the study arms or if dropouts are not random because of toxicity. Some analyses count cancer-related deaths as DFS events and censor noncancer deaths. This method can introduce bias in the attribution of the cause of death. Furthermore, any method that censors patients, whether at death or at the last visit, assumes that the censored patients have the same risk of recurrence as noncensored patients.
|
What is the conventional definition of recurrence-free survival?
|
As you have seen, both definitions are acceptable, mostly because both options have problems. Even the FDA does not seem to express a preference. Quoting from Guidance for Industry Clinical Trial Endp
|
What is the conventional definition of recurrence-free survival?
As you have seen, both definitions are acceptable, mostly because both options have problems. Even the FDA does not seem to express a preference. Quoting from Guidance for Industry Clinical Trial Endpoints for the Approval of Cancer Drugs and Biologics (DFS is Disease Free Survival):
The definition of DFS can be complicated, particularly when deaths are noted without prior tumor progression documentation. These events can be scored either as disease recurrences or as censored events. Although all methods for statistical analysis of deaths have some limitations, considering all deaths (deaths from all causes) as recurrences can minimize bias. DFS can be overestimated using this definition, especially in patients who die after a long period without observation. Bias can be introduced if the frequency of long-term follow-up visits is dissimilar between the study arms or if dropouts are not random because of toxicity. Some analyses count cancer-related deaths as DFS events and censor noncancer deaths. This method can introduce bias in the attribution of the cause of death. Furthermore, any method that censors patients, whether at death or at the last visit, assumes that the censored patients have the same risk of recurrence as noncensored patients.
|
What is the conventional definition of recurrence-free survival?
As you have seen, both definitions are acceptable, mostly because both options have problems. Even the FDA does not seem to express a preference. Quoting from Guidance for Industry Clinical Trial Endp
|
41,705
|
What is the conventional definition of recurrence-free survival?
|
The issue of death in any non-fatal disease is a problem in many survival analysis studies. I have generally seen this handled two ways, and have not seen anyone arguing that there is a particular dominant or unified standard.
The first way is to consider death to be one of your outcomes. So your event becomes "Event OR All-cause Mortality". This may be more intuitive and, conveniently, if you think your disease may be driving some of those deaths, may capture additional information. It's also the most amenable to a straightforward survival analysis.
The second method is to treat death as a competing risk. Then, the usual approach is to treat death-events as censored for the outcome of interest at time of death, and analyze from there. This essentially asks "What would your hazard of death have been, had you not died for some other reason?". Especially if you think death is something of an "uninteresting" outcome, this may be a workable approach.
As both are pretty approachable using standard software, I'd consider doing both, and seeing if your estimates end up being substantially different.
|
What is the conventional definition of recurrence-free survival?
|
The issue of death in any non-fatal disease is a problem in many survival analysis studies. I have generally seen this handled two ways, and have not seen anyone arguing that there is a particular dom
|
What is the conventional definition of recurrence-free survival?
The issue of death in any non-fatal disease is a problem in many survival analysis studies. I have generally seen this handled two ways, and have not seen anyone arguing that there is a particular dominant or unified standard.
The first way is to consider death to be one of your outcomes. So your event becomes "Event OR All-cause Mortality". This may be more intuitive and, conveniently, if you think your disease may be driving some of those deaths, may capture additional information. It's also the most amenable to a straightforward survival analysis.
The second method is to treat death as a competing risk. Then, the usual approach is to treat death-events as censored for the outcome of interest at time of death, and analyze from there. This essentially asks "What would your hazard of death have been, had you not died for some other reason?". Especially if you think death is something of an "uninteresting" outcome, this may be a workable approach.
As both are pretty approachable using standard software, I'd consider doing both, and seeing if your estimates end up being substantially different.
|
What is the conventional definition of recurrence-free survival?
The issue of death in any non-fatal disease is a problem in many survival analysis studies. I have generally seen this handled two ways, and have not seen anyone arguing that there is a particular dom
|
41,706
|
What is the conventional definition of recurrence-free survival?
|
If death is traditionally included as an event, what is the rationale for that? It certainly is not a recurrence.
I faced the same issue as you. The interest that I can see is when the outcome is "Does the patient's state deteriorate due to the disease?" In that case, you can define an event as being:
a death due to the disease
a recurrence
And you can define a censored observation as being:
a death whose cause is unknown or not due to the disease
a loss to follow-up
But in my opinion, we should rather call this outcome progression-free survival (PFS). In all cases, we should always precise the definition we use in our communications/publications: what defines an event.
According to several cancer MD researchers whom I have been working with, if the cause of death is unknown, then we should never consider it as an event when studying RFS/PFS. Otherwise we would be confusing it with overall survival (OS, all-cause-mortality) while one objective of studying RFS/PFS is in fact to focus on the disease.
|
What is the conventional definition of recurrence-free survival?
|
If death is traditionally included as an event, what is the rationale for that? It certainly is not a recurrence.
I faced the same issue as you. The interest that I can see is when the outcome is "Do
|
What is the conventional definition of recurrence-free survival?
If death is traditionally included as an event, what is the rationale for that? It certainly is not a recurrence.
I faced the same issue as you. The interest that I can see is when the outcome is "Does the patient's state deteriorate due to the disease?" In that case, you can define an event as being:
a death due to the disease
a recurrence
And you can define a censored observation as being:
a death whose cause is unknown or not due to the disease
a loss to follow-up
But in my opinion, we should rather call this outcome progression-free survival (PFS). In all cases, we should always precise the definition we use in our communications/publications: what defines an event.
According to several cancer MD researchers whom I have been working with, if the cause of death is unknown, then we should never consider it as an event when studying RFS/PFS. Otherwise we would be confusing it with overall survival (OS, all-cause-mortality) while one objective of studying RFS/PFS is in fact to focus on the disease.
|
What is the conventional definition of recurrence-free survival?
If death is traditionally included as an event, what is the rationale for that? It certainly is not a recurrence.
I faced the same issue as you. The interest that I can see is when the outcome is "Do
|
41,707
|
Build a covariance matrix for GAM
|
Coincidentally I have been pondering this problem for a little while and resorted to emailing Simon Wood about this only the other day.
His advice to me was (amongst other things but I don't think using bam()'s rho argument is applicable when you have by terms in the model) to check the example at the end of ?magic. That example I reproduce below with outputs:
## Now a correlated data example ...
library(nlme)
## simulate truth
set.seed(1)
n <- 400
sig <- 2
x <- 0:(n-1)/(n-1)
f <- 0.2 * x^11 * (10 * (1-x))^6 + 10 * (10*x)^3 * (1-x)^10
## produce scaled covariance matrix for AR1 errors...
V <- corMatrix(Initialize(corAR1(.6),data.frame(x=x)))
## note here that V is what you would estimate from the model residuals
## but here we are generating the data from known correlation.
## You would plug your estimate of the correlation parameter in to corAR1(X)
##
## for the Cholesky factorisation of V
Cv <- chol(V) # t(Cv)%*%Cv=V
## Simulate AR1 errors ...
e <- t(Cv) %*% rnorm(n, 0, sig) # so cov(e) = V * sig^2
## Observe truth + AR1 errors
y <- f + e
## GAM ignoring correlation
b <- gam(y ~ s(x, k = 20))
## Fit smooth, taking account of *known* correlation...
## form a weight matrix
w <- solve(t(Cv)) # V^{-1} = w'w
## Use `gam' to set up model for fitting...
G <- gam(y ~ s(x, k = 20), fit=FALSE)
## fit using magic, with weight *matrix*
mgfit <- magic(G$y, G$X, G$sp, G$S, G$off, rank=G$rank, C=G$C, w=w)
## Modify previous gam object using new fit, for plotting...
mg.stuff <- magic.post.proc(G$X, mgfit, w)
b2 <- b ## copy b
b2$edf <- mg.stuff$edf
b2$Vp <- mg.stuff$Vb
b2$coefficients <- mgfit$b
## compare fits
layout(matrix(1:2, ncol = 2))
plot(b, main = "Ignoring correlation")
lines(x, f-mean(f), col=2)
plot(b2, main = "Known correlation")
lines(x, f-mean(f), col=2)
layout(1)
The resulting plot of the two fits looks like this:
You have the additional problem that your $V$ will not be a simple matrix like the one here. As you are fitting by Country your $V$ will be a block diagonal (I think that is the right term) matrix formed by first generating each $V_{country}$ and then stacking them in a diagonal fashion such that observations within a single Country are correlated with one another (so their entries in the matrix are none-zero, being $\rho^{|s|}$ where $\rho$ is the estiated AR(1) parameter for that Country and s is the separation in time points of the two residuals) but are uncorrelated with the observations from other countries (those entries in $V$ are zero). At least that is what the gamm() code you show would produce IIRC.
Although I haven't tried this, there are several options to form block diagonal matrices in R and you could use the function posted to R-Help some years ago to stick your individual $V_{country}$ together. Other options include converting each $V$ into a sparse matrix that the Matrix package understands, use its bdiag() function and then coerce back to a dense matrix using as.matrix(). See the help for the Matrix package for details.
As for obtaining the AR(1) terms for each countries residuals, fit your model via gam() but to help, place all the data in time order within country first before fitting. If you have any NA in the data, make sure to add na.action = na.exclude in the call to gam() as that will place NA back into the resdiuals that you extract via resid() from the model. You can split the vector of residuals by country like this:
res <- resid(mod)
res.spl <- split(res, Dat$Country)
Then you could simply sapply() the function acf() or pacf() to each component of res.spl to extract the lag 1 coefficient for each country. Those are the values to plug into corAR1() in the above example code.
Amazingly, your example code looks very similar to some that of my PhD student (although they are working on lakes) sent me the other day. Do you know someone working on hi-res lake data? If not perhaps they saw your post here?
|
Build a covariance matrix for GAM
|
Coincidentally I have been pondering this problem for a little while and resorted to emailing Simon Wood about this only the other day.
His advice to me was (amongst other things but I don't think usi
|
Build a covariance matrix for GAM
Coincidentally I have been pondering this problem for a little while and resorted to emailing Simon Wood about this only the other day.
His advice to me was (amongst other things but I don't think using bam()'s rho argument is applicable when you have by terms in the model) to check the example at the end of ?magic. That example I reproduce below with outputs:
## Now a correlated data example ...
library(nlme)
## simulate truth
set.seed(1)
n <- 400
sig <- 2
x <- 0:(n-1)/(n-1)
f <- 0.2 * x^11 * (10 * (1-x))^6 + 10 * (10*x)^3 * (1-x)^10
## produce scaled covariance matrix for AR1 errors...
V <- corMatrix(Initialize(corAR1(.6),data.frame(x=x)))
## note here that V is what you would estimate from the model residuals
## but here we are generating the data from known correlation.
## You would plug your estimate of the correlation parameter in to corAR1(X)
##
## for the Cholesky factorisation of V
Cv <- chol(V) # t(Cv)%*%Cv=V
## Simulate AR1 errors ...
e <- t(Cv) %*% rnorm(n, 0, sig) # so cov(e) = V * sig^2
## Observe truth + AR1 errors
y <- f + e
## GAM ignoring correlation
b <- gam(y ~ s(x, k = 20))
## Fit smooth, taking account of *known* correlation...
## form a weight matrix
w <- solve(t(Cv)) # V^{-1} = w'w
## Use `gam' to set up model for fitting...
G <- gam(y ~ s(x, k = 20), fit=FALSE)
## fit using magic, with weight *matrix*
mgfit <- magic(G$y, G$X, G$sp, G$S, G$off, rank=G$rank, C=G$C, w=w)
## Modify previous gam object using new fit, for plotting...
mg.stuff <- magic.post.proc(G$X, mgfit, w)
b2 <- b ## copy b
b2$edf <- mg.stuff$edf
b2$Vp <- mg.stuff$Vb
b2$coefficients <- mgfit$b
## compare fits
layout(matrix(1:2, ncol = 2))
plot(b, main = "Ignoring correlation")
lines(x, f-mean(f), col=2)
plot(b2, main = "Known correlation")
lines(x, f-mean(f), col=2)
layout(1)
The resulting plot of the two fits looks like this:
You have the additional problem that your $V$ will not be a simple matrix like the one here. As you are fitting by Country your $V$ will be a block diagonal (I think that is the right term) matrix formed by first generating each $V_{country}$ and then stacking them in a diagonal fashion such that observations within a single Country are correlated with one another (so their entries in the matrix are none-zero, being $\rho^{|s|}$ where $\rho$ is the estiated AR(1) parameter for that Country and s is the separation in time points of the two residuals) but are uncorrelated with the observations from other countries (those entries in $V$ are zero). At least that is what the gamm() code you show would produce IIRC.
Although I haven't tried this, there are several options to form block diagonal matrices in R and you could use the function posted to R-Help some years ago to stick your individual $V_{country}$ together. Other options include converting each $V$ into a sparse matrix that the Matrix package understands, use its bdiag() function and then coerce back to a dense matrix using as.matrix(). See the help for the Matrix package for details.
As for obtaining the AR(1) terms for each countries residuals, fit your model via gam() but to help, place all the data in time order within country first before fitting. If you have any NA in the data, make sure to add na.action = na.exclude in the call to gam() as that will place NA back into the resdiuals that you extract via resid() from the model. You can split the vector of residuals by country like this:
res <- resid(mod)
res.spl <- split(res, Dat$Country)
Then you could simply sapply() the function acf() or pacf() to each component of res.spl to extract the lag 1 coefficient for each country. Those are the values to plug into corAR1() in the above example code.
Amazingly, your example code looks very similar to some that of my PhD student (although they are working on lakes) sent me the other day. Do you know someone working on hi-res lake data? If not perhaps they saw your post here?
|
Build a covariance matrix for GAM
Coincidentally I have been pondering this problem for a little while and resorted to emailing Simon Wood about this only the other day.
His advice to me was (amongst other things but I don't think usi
|
41,708
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
|
I do not know whether there are established methods to compare panel data to repeated cross-sectional data. But I want to add that true panel data is not always superior to repeated cross-sectional data in general. Attrition or learning effects for example may be a problem in panel data but not in repeated cross-sectional data although I do not know whether these problems are present in your case. But if this is the case, the second and third years (and so on) of your panel data may be problematic compared to repeated cross-sectional data in some sense. You should keep this in mind.
In general I think what you want to do sounds doable and it could reveal new information in comparison with the analysis of cross-sectional data only (although I do not know your research question).
If the estimations differ between both analyses I would have a look whether what could be the reasons by looking at the advantages and disadvantes of both types of datasets. There are several papers about the this topic which might help you such as
Deaton (1985)
Verbeek & Nijman (1992)
Frees (2004)
Lee & Niemeier (1996)
Hsiao (2007)
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
|
I do not know whether there are established methods to compare panel data to repeated cross-sectional data. But I want to add that true panel data is not always superior to repeated cross-sectional da
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
I do not know whether there are established methods to compare panel data to repeated cross-sectional data. But I want to add that true panel data is not always superior to repeated cross-sectional data in general. Attrition or learning effects for example may be a problem in panel data but not in repeated cross-sectional data although I do not know whether these problems are present in your case. But if this is the case, the second and third years (and so on) of your panel data may be problematic compared to repeated cross-sectional data in some sense. You should keep this in mind.
In general I think what you want to do sounds doable and it could reveal new information in comparison with the analysis of cross-sectional data only (although I do not know your research question).
If the estimations differ between both analyses I would have a look whether what could be the reasons by looking at the advantages and disadvantes of both types of datasets. There are several papers about the this topic which might help you such as
Deaton (1985)
Verbeek & Nijman (1992)
Frees (2004)
Lee & Niemeier (1996)
Hsiao (2007)
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
I do not know whether there are established methods to compare panel data to repeated cross-sectional data. But I want to add that true panel data is not always superior to repeated cross-sectional da
|
41,709
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
|
In this paper by Seawright (2009) several approaches how to analyze pseudo-panel data are disscussed, including:
Cohort averaging (Deaton 1985; Verbeek & Nijman 1992)
Two-Stage Auxiliary Instrumental Variables (2SAIV)
(Franklin 1989)
Multiple imputation (Gelman/King/Liu 1999)
Matching (Rubin 2006)
Three of the approaches are assesed against a true panel "gold standard" and a pure cross-sectional estimation. The author reaches the conclusion that pseudo-panel matching performs best under the specified conditions due to its robustness against parametric misspecification.
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
|
In this paper by Seawright (2009) several approaches how to analyze pseudo-panel data are disscussed, including:
Cohort averaging (Deaton 1985; Verbeek & Nijman 1992)
Two-Stage Auxiliary Instrumental
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
In this paper by Seawright (2009) several approaches how to analyze pseudo-panel data are disscussed, including:
Cohort averaging (Deaton 1985; Verbeek & Nijman 1992)
Two-Stage Auxiliary Instrumental Variables (2SAIV)
(Franklin 1989)
Multiple imputation (Gelman/King/Liu 1999)
Matching (Rubin 2006)
Three of the approaches are assesed against a true panel "gold standard" and a pure cross-sectional estimation. The author reaches the conclusion that pseudo-panel matching performs best under the specified conditions due to its robustness against parametric misspecification.
|
Validity of pseudo-panel data constructed from repeated cross sectional data as a panel data
In this paper by Seawright (2009) several approaches how to analyze pseudo-panel data are disscussed, including:
Cohort averaging (Deaton 1985; Verbeek & Nijman 1992)
Two-Stage Auxiliary Instrumental
|
41,710
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
Cross-validation will not eliminate over-fitting either, only (hopefully) reduce it. If you minimise any statistic with a non-zero variance evaluated over a finite sample of data there is a risk of over-fitting. The more choices you make, the larger the chance of over-fitting. The harder you try to minimise the statistic, the larger the chance of over-fitting, which is one of the problems with using GAs - it is trying very hard to find the lowest minimum.
Regularisation is probably a better approach if predictive performance is what is important, as it involves fewer choices.
Essentially in statistics, optimisation is the root of all over-fitting, so the best way to avoid over-fitting is to minimise the amount of optimisation you do.
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
Cross-validation will not eliminate over-fitting either, only (hopefully) reduce it. If you minimise any statistic with a non-zero variance evaluated over a finite sample of data there is a risk of o
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
Cross-validation will not eliminate over-fitting either, only (hopefully) reduce it. If you minimise any statistic with a non-zero variance evaluated over a finite sample of data there is a risk of over-fitting. The more choices you make, the larger the chance of over-fitting. The harder you try to minimise the statistic, the larger the chance of over-fitting, which is one of the problems with using GAs - it is trying very hard to find the lowest minimum.
Regularisation is probably a better approach if predictive performance is what is important, as it involves fewer choices.
Essentially in statistics, optimisation is the root of all over-fitting, so the best way to avoid over-fitting is to minimise the amount of optimisation you do.
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
Cross-validation will not eliminate over-fitting either, only (hopefully) reduce it. If you minimise any statistic with a non-zero variance evaluated over a finite sample of data there is a risk of o
|
41,711
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
there is only one paradigm that can avoid models from overfiting -on future data- that is of course VC bound. Many researchers say that VC bound is a pecimistic case but i don't understand .if there is only one woman in the space, is it possible to make comment about the beauty of that the only one female...
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
there is only one paradigm that can avoid models from overfiting -on future data- that is of course VC bound. Many researchers say that VC bound is a pecimistic case but i don't understand .if there i
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
there is only one paradigm that can avoid models from overfiting -on future data- that is of course VC bound. Many researchers say that VC bound is a pecimistic case but i don't understand .if there is only one woman in the space, is it possible to make comment about the beauty of that the only one female...
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
there is only one paradigm that can avoid models from overfiting -on future data- that is of course VC bound. Many researchers say that VC bound is a pecimistic case but i don't understand .if there i
|
41,712
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
There is nothing stopping you from including a regularization penalty in the optimization loop to be minimised, in addition to least squares. I have done this with good results. I agree with Dikran that optimisation will still cause over fitting in a regression model (even a cross-validated one) unless such steps are taken.
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
|
There is nothing stopping you from including a regularization penalty in the optimization loop to be minimised, in addition to least squares. I have done this with good results. I agree with Dikran th
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
There is nothing stopping you from including a regularization penalty in the optimization loop to be minimised, in addition to least squares. I have done this with good results. I agree with Dikran that optimisation will still cause over fitting in a regression model (even a cross-validated one) unless such steps are taken.
|
How to avoid overfitting when using crossvalidation within Genetic Algorithms
There is nothing stopping you from including a regularization penalty in the optimization loop to be minimised, in addition to least squares. I have done this with good results. I agree with Dikran th
|
41,713
|
Extremely large class set for support vector machine (SVM) classification
|
I would use the DAGSVM approach, which constructs a tree of pairwise classifiers. If you have only 100 patterns per class, but tens of thousands of classes, a lot of the pairwise classifiers will have no training data and hence not every possible pairwise classifier will need to be constructed.
However, more importantly, it is hard to consider a problem with such a large number of classes, where the classification is not in some sense hierarchical. A better approach would be to first construct a classifier to classify each pattern into broad categories (representing a set of related classes) and then iteratively refine patterns withing each broad category to identify the finer distinctions between classes.
|
Extremely large class set for support vector machine (SVM) classification
|
I would use the DAGSVM approach, which constructs a tree of pairwise classifiers. If you have only 100 patterns per class, but tens of thousands of classes, a lot of the pairwise classifiers will hav
|
Extremely large class set for support vector machine (SVM) classification
I would use the DAGSVM approach, which constructs a tree of pairwise classifiers. If you have only 100 patterns per class, but tens of thousands of classes, a lot of the pairwise classifiers will have no training data and hence not every possible pairwise classifier will need to be constructed.
However, more importantly, it is hard to consider a problem with such a large number of classes, where the classification is not in some sense hierarchical. A better approach would be to first construct a classifier to classify each pattern into broad categories (representing a set of related classes) and then iteratively refine patterns withing each broad category to identify the finer distinctions between classes.
|
Extremely large class set for support vector machine (SVM) classification
I would use the DAGSVM approach, which constructs a tree of pairwise classifiers. If you have only 100 patterns per class, but tens of thousands of classes, a lot of the pairwise classifiers will hav
|
41,714
|
Extremely large class set for support vector machine (SVM) classification
|
Have a look a Vowpal Wabbit. It's an implementation of Stochasic Gradient Decent, which is very efficient for large scale datasets. If you choose the right parameters it can mimic a SVM (hinge-loss). It also includes a reduction called Error-Correcting Tournaments, which is quite efficient for multiple classes.
|
Extremely large class set for support vector machine (SVM) classification
|
Have a look a Vowpal Wabbit. It's an implementation of Stochasic Gradient Decent, which is very efficient for large scale datasets. If you choose the right parameters it can mimic a SVM (hinge-loss).
|
Extremely large class set for support vector machine (SVM) classification
Have a look a Vowpal Wabbit. It's an implementation of Stochasic Gradient Decent, which is very efficient for large scale datasets. If you choose the right parameters it can mimic a SVM (hinge-loss). It also includes a reduction called Error-Correcting Tournaments, which is quite efficient for multiple classes.
|
Extremely large class set for support vector machine (SVM) classification
Have a look a Vowpal Wabbit. It's an implementation of Stochasic Gradient Decent, which is very efficient for large scale datasets. If you choose the right parameters it can mimic a SVM (hinge-loss).
|
41,715
|
Extremely large class set for support vector machine (SVM) classification
|
There are classification models that are inherently multiclass, without error-correcting codes or one-vs-rest. Some popular ones are Neural Networks, Linear Discriminant Analysis, Random Forests, Naive Bayes and kNN. The training time usually goes up a little, but it's far more efficient than one-vs-rest classification. There's a multiclass formulation of structural SVM, that worth mentioning. Though I haven't used it myself.
|
Extremely large class set for support vector machine (SVM) classification
|
There are classification models that are inherently multiclass, without error-correcting codes or one-vs-rest. Some popular ones are Neural Networks, Linear Discriminant Analysis, Random Forests, Naiv
|
Extremely large class set for support vector machine (SVM) classification
There are classification models that are inherently multiclass, without error-correcting codes or one-vs-rest. Some popular ones are Neural Networks, Linear Discriminant Analysis, Random Forests, Naive Bayes and kNN. The training time usually goes up a little, but it's far more efficient than one-vs-rest classification. There's a multiclass formulation of structural SVM, that worth mentioning. Though I haven't used it myself.
|
Extremely large class set for support vector machine (SVM) classification
There are classification models that are inherently multiclass, without error-correcting codes or one-vs-rest. Some popular ones are Neural Networks, Linear Discriminant Analysis, Random Forests, Naiv
|
41,716
|
Problem with Pareto distribution and R
|
By using ecdf and density, you're not actually doing the Pareto calculations, but instead using estimates based on a sample that are, by their non-parametric nature, not guaranteed (read: not going to) have the desired property.
Try the following:
x <- seq(0.1,10,by=0.1)
fx <- dpareto(x, 1.5, 0.05)
Fx <- ppareto(x, 1.5, 0.05)
plot((1-Fx)/fx ~ x)
You'll get the nice straight line out:
|
Problem with Pareto distribution and R
|
By using ecdf and density, you're not actually doing the Pareto calculations, but instead using estimates based on a sample that are, by their non-parametric nature, not guaranteed (read: not going to
|
Problem with Pareto distribution and R
By using ecdf and density, you're not actually doing the Pareto calculations, but instead using estimates based on a sample that are, by their non-parametric nature, not guaranteed (read: not going to) have the desired property.
Try the following:
x <- seq(0.1,10,by=0.1)
fx <- dpareto(x, 1.5, 0.05)
Fx <- ppareto(x, 1.5, 0.05)
plot((1-Fx)/fx ~ x)
You'll get the nice straight line out:
|
Problem with Pareto distribution and R
By using ecdf and density, you're not actually doing the Pareto calculations, but instead using estimates based on a sample that are, by their non-parametric nature, not guaranteed (read: not going to
|
41,717
|
Generating random matrices with sum and maximality constraints
|
OK, to move these efforts along (but with some diffidence) I offer this approach: generate the diagonal elements first. Make them large constants. Generate all off-diagonal elements iid according to any (non-negative) distribution you want. Normalize rows. Check the column-max condition. Repeat if violated.
By making the initial constants sufficiently large, the expected number of repetitions can be made small.
Clearly the diagonal elements are iid, the non-diagonal elements are iid, but (of course) the two distributions differ.
Here's some code to play with.
n <- 8 # Matrix dimension
y <- rep(1 + 3/sqrt(n),n) # A large constant compared to entries in x
x <- matrix(runif(n^2), ncol=n) # Here, uniform distributions off diagonal
x[cbind(1:n,1:n)] <- y # (Paste in the diagonal)
z <- t(apply(x, 1, function(u) u/sum(u))) # Normalize the rows
which(1:n != apply(z, 2, which.max)) # Find all columns violating the conditions
(One hopes for integer(0) as the output; otherwise, indexes of columns whose maxima are not diagonal will be output.) I have experimented with n ranging from 3 through 300.
It's instructive to plot the columns:
plot(z[1,], type="n")
apply(z, 2, function(u) lines(u, col=(256*runif(1))))
|
Generating random matrices with sum and maximality constraints
|
OK, to move these efforts along (but with some diffidence) I offer this approach: generate the diagonal elements first. Make them large constants. Generate all off-diagonal elements iid according to
|
Generating random matrices with sum and maximality constraints
OK, to move these efforts along (but with some diffidence) I offer this approach: generate the diagonal elements first. Make them large constants. Generate all off-diagonal elements iid according to any (non-negative) distribution you want. Normalize rows. Check the column-max condition. Repeat if violated.
By making the initial constants sufficiently large, the expected number of repetitions can be made small.
Clearly the diagonal elements are iid, the non-diagonal elements are iid, but (of course) the two distributions differ.
Here's some code to play with.
n <- 8 # Matrix dimension
y <- rep(1 + 3/sqrt(n),n) # A large constant compared to entries in x
x <- matrix(runif(n^2), ncol=n) # Here, uniform distributions off diagonal
x[cbind(1:n,1:n)] <- y # (Paste in the diagonal)
z <- t(apply(x, 1, function(u) u/sum(u))) # Normalize the rows
which(1:n != apply(z, 2, which.max)) # Find all columns violating the conditions
(One hopes for integer(0) as the output; otherwise, indexes of columns whose maxima are not diagonal will be output.) I have experimented with n ranging from 3 through 300.
It's instructive to plot the columns:
plot(z[1,], type="n")
apply(z, 2, function(u) lines(u, col=(256*runif(1))))
|
Generating random matrices with sum and maximality constraints
OK, to move these efforts along (but with some diffidence) I offer this approach: generate the diagonal elements first. Make them large constants. Generate all off-diagonal elements iid according to
|
41,718
|
Generating random matrices with sum and maximality constraints
|
First, I would generate a matrix $M$ such that $M_{ij}$ is exponentially distributed with mean $\mu$ for all $i \ne j$ or $0$ otherwise.
Then, calculate your matrix
\begin{align}
X_{ij} &= \frac{e^{-M_{ij}}}{\sum_je^{-M_{ij}}}
\end{align}
To efficiently sample from a categorical distribution (a list of probabilities totalling 1), just build a Huffman tree using the probabilities of each outcome keeping track of the total probability in descendants to the left of each node. Sample from a uniform distribution, and find the leaf node whose cdf is the smallest one larger than your sampled value. (This has an amortized cost of the entropy of your categorical distribution.)
|
Generating random matrices with sum and maximality constraints
|
First, I would generate a matrix $M$ such that $M_{ij}$ is exponentially distributed with mean $\mu$ for all $i \ne j$ or $0$ otherwise.
Then, calculate your matrix
\begin{align}
X_{ij} &= \frac{e^{-M
|
Generating random matrices with sum and maximality constraints
First, I would generate a matrix $M$ such that $M_{ij}$ is exponentially distributed with mean $\mu$ for all $i \ne j$ or $0$ otherwise.
Then, calculate your matrix
\begin{align}
X_{ij} &= \frac{e^{-M_{ij}}}{\sum_je^{-M_{ij}}}
\end{align}
To efficiently sample from a categorical distribution (a list of probabilities totalling 1), just build a Huffman tree using the probabilities of each outcome keeping track of the total probability in descendants to the left of each node. Sample from a uniform distribution, and find the leaf node whose cdf is the smallest one larger than your sampled value. (This has an amortized cost of the entropy of your categorical distribution.)
|
Generating random matrices with sum and maximality constraints
First, I would generate a matrix $M$ such that $M_{ij}$ is exponentially distributed with mean $\mu$ for all $i \ne j$ or $0$ otherwise.
Then, calculate your matrix
\begin{align}
X_{ij} &= \frac{e^{-M
|
41,719
|
Generating random matrices with sum and maximality constraints
|
First generate random rows then divide each row by its sum so you get them to sum to one. Then order the rows a particular way, in the first row you want the row that contains the element in its first position that is the max of column 1. So, in the nth row you want the row that has the max of the nth column.
|
Generating random matrices with sum and maximality constraints
|
First generate random rows then divide each row by its sum so you get them to sum to one. Then order the rows a particular way, in the first row you want the row that contains the element in its first
|
Generating random matrices with sum and maximality constraints
First generate random rows then divide each row by its sum so you get them to sum to one. Then order the rows a particular way, in the first row you want the row that contains the element in its first position that is the max of column 1. So, in the nth row you want the row that has the max of the nth column.
|
Generating random matrices with sum and maximality constraints
First generate random rows then divide each row by its sum so you get them to sum to one. Then order the rows a particular way, in the first row you want the row that contains the element in its first
|
41,720
|
Generating random matrices with sum and maximality constraints
|
Just generate each row from a Dirichlet distribution then reorder if needed to put the largest value on the diagonal (or choose the parameters such that the largest is likely to be on the diagonal).
|
Generating random matrices with sum and maximality constraints
|
Just generate each row from a Dirichlet distribution then reorder if needed to put the largest value on the diagonal (or choose the parameters such that the largest is likely to be on the diagonal).
|
Generating random matrices with sum and maximality constraints
Just generate each row from a Dirichlet distribution then reorder if needed to put the largest value on the diagonal (or choose the parameters such that the largest is likely to be on the diagonal).
|
Generating random matrices with sum and maximality constraints
Just generate each row from a Dirichlet distribution then reorder if needed to put the largest value on the diagonal (or choose the parameters such that the largest is likely to be on the diagonal).
|
41,721
|
Generating random matrices with sum and maximality constraints
|
Essentially the same idea of whuber, this time using Dirichlets: the lines of the matrix are independent Dirichlets, with each Dirichlet putting more mass on the corresponding diagonal element.
rdirichlet <- function(a) {
x <- sapply(a, function(a) rgamma(1, a, 1))
return(x / sum(x))
}
n <- 5
A0 <- 10
a <- matrix(data = 1, nrow = n, ncol = n)
diag(a) <- A0
x <- matrix(nrow = n, ncol = n)
for (i in 1:n) x[i,] <- rdirichlet(a[i,])
Reject if x does not satisfy the constraints. If the rejection rate is too high, increase the value of A0. Here is a sample x.
> x
[,1] [,2] [,3] [,4] [,5]
[1,] 0.484437196 0.03511667 0.04919437 0.12718905 0.304062711
[2,] 0.008626386 0.76520244 0.03231747 0.02454215 0.169311552
[3,] 0.176631389 0.01971251 0.55780424 0.07952712 0.166324747
[4,] 0.003109732 0.12056624 0.09335086 0.77330892 0.009664246
[5,] 0.037015097 0.02485376 0.04536731 0.05083834 0.841925490
P.S. Please, vectorize that pesky for.
|
Generating random matrices with sum and maximality constraints
|
Essentially the same idea of whuber, this time using Dirichlets: the lines of the matrix are independent Dirichlets, with each Dirichlet putting more mass on the corresponding diagonal element.
rdiric
|
Generating random matrices with sum and maximality constraints
Essentially the same idea of whuber, this time using Dirichlets: the lines of the matrix are independent Dirichlets, with each Dirichlet putting more mass on the corresponding diagonal element.
rdirichlet <- function(a) {
x <- sapply(a, function(a) rgamma(1, a, 1))
return(x / sum(x))
}
n <- 5
A0 <- 10
a <- matrix(data = 1, nrow = n, ncol = n)
diag(a) <- A0
x <- matrix(nrow = n, ncol = n)
for (i in 1:n) x[i,] <- rdirichlet(a[i,])
Reject if x does not satisfy the constraints. If the rejection rate is too high, increase the value of A0. Here is a sample x.
> x
[,1] [,2] [,3] [,4] [,5]
[1,] 0.484437196 0.03511667 0.04919437 0.12718905 0.304062711
[2,] 0.008626386 0.76520244 0.03231747 0.02454215 0.169311552
[3,] 0.176631389 0.01971251 0.55780424 0.07952712 0.166324747
[4,] 0.003109732 0.12056624 0.09335086 0.77330892 0.009664246
[5,] 0.037015097 0.02485376 0.04536731 0.05083834 0.841925490
P.S. Please, vectorize that pesky for.
|
Generating random matrices with sum and maximality constraints
Essentially the same idea of whuber, this time using Dirichlets: the lines of the matrix are independent Dirichlets, with each Dirichlet putting more mass on the corresponding diagonal element.
rdiric
|
41,722
|
How adding covariance noise in Gaussian processes to prevent overfitting?
|
The covariance essentially specifies how similar the regression function should be as a function of the attributes. The squared exponential function encodes the prior knowledge that the posterior should be a smooth function (on some characteristic length-scale governed by the hyper-parameters). If the function that generated the observations is not smooth however but has a random element (which will generally be the case), then maximising the marginal likelihood will end up encouraging the hyper-parameters to take on values that allow the GP to model these random variations, rather than concentrating on the larger scale smoothness.
Adding a noise term encodes the prior knowledge that the function should be fairly smooth (the SEiso bit) but that there will also be random variations superimposed on top. Then in model selection, vairations in the data can be explained as being due to either the difference in the input features (the SEiso bit) or just down to random meaningless variability in the data. There is then less pressure on the SEiso bit to explain the variability, and hence less pressure to make an SEiso component with short length-scales, which tend to generalise better.
Having said which, I have been performing some experiments with GP classifiers and learning the covariance function, and I found it didn't make a great deal of difference whether a noise term was used or not. The marginal likelihood is a statistic that is evaluated on a finite (normally quite small) sample of data, which means it has a non-negligible variance, which means that there is inevitably a danger of over-fitting if you perform model selection by maximising the marginal likelihood. That danger might be more substantial than the danger of model mis-specification (not including the right components in the covariance function).
|
How adding covariance noise in Gaussian processes to prevent overfitting?
|
The covariance essentially specifies how similar the regression function should be as a function of the attributes. The squared exponential function encodes the prior knowledge that the posterior sho
|
How adding covariance noise in Gaussian processes to prevent overfitting?
The covariance essentially specifies how similar the regression function should be as a function of the attributes. The squared exponential function encodes the prior knowledge that the posterior should be a smooth function (on some characteristic length-scale governed by the hyper-parameters). If the function that generated the observations is not smooth however but has a random element (which will generally be the case), then maximising the marginal likelihood will end up encouraging the hyper-parameters to take on values that allow the GP to model these random variations, rather than concentrating on the larger scale smoothness.
Adding a noise term encodes the prior knowledge that the function should be fairly smooth (the SEiso bit) but that there will also be random variations superimposed on top. Then in model selection, vairations in the data can be explained as being due to either the difference in the input features (the SEiso bit) or just down to random meaningless variability in the data. There is then less pressure on the SEiso bit to explain the variability, and hence less pressure to make an SEiso component with short length-scales, which tend to generalise better.
Having said which, I have been performing some experiments with GP classifiers and learning the covariance function, and I found it didn't make a great deal of difference whether a noise term was used or not. The marginal likelihood is a statistic that is evaluated on a finite (normally quite small) sample of data, which means it has a non-negligible variance, which means that there is inevitably a danger of over-fitting if you perform model selection by maximising the marginal likelihood. That danger might be more substantial than the danger of model mis-specification (not including the right components in the covariance function).
|
How adding covariance noise in Gaussian processes to prevent overfitting?
The covariance essentially specifies how similar the regression function should be as a function of the attributes. The squared exponential function encodes the prior knowledge that the posterior sho
|
41,723
|
How adding covariance noise in Gaussian processes to prevent overfitting?
|
Assume that you want to fit $\beta$ in the model
$$ [y_1, y_2] = [0,1]\beta + [\epsilon(s_1), \epsilon(s_1)], $$
where the noise $\epsilon$ are a zero mean Gaussian process with say Matérn covariance (any covariance function will do).
So you have two observations at the same point but then the only difference between the observations are $\beta$, so $\beta = y_2 -y_1$ with probability 1.
This is the extreme case of that the observations are at the same point, but points very close together will give the same result in practice.
Which is often not what one wants so one adds some noise to avoid this type of over fitting.
|
How adding covariance noise in Gaussian processes to prevent overfitting?
|
Assume that you want to fit $\beta$ in the model
$$ [y_1, y_2] = [0,1]\beta + [\epsilon(s_1), \epsilon(s_1)], $$
where the noise $\epsilon$ are a zero mean Gaussian process with say Matérn covaria
|
How adding covariance noise in Gaussian processes to prevent overfitting?
Assume that you want to fit $\beta$ in the model
$$ [y_1, y_2] = [0,1]\beta + [\epsilon(s_1), \epsilon(s_1)], $$
where the noise $\epsilon$ are a zero mean Gaussian process with say Matérn covariance (any covariance function will do).
So you have two observations at the same point but then the only difference between the observations are $\beta$, so $\beta = y_2 -y_1$ with probability 1.
This is the extreme case of that the observations are at the same point, but points very close together will give the same result in practice.
Which is often not what one wants so one adds some noise to avoid this type of over fitting.
|
How adding covariance noise in Gaussian processes to prevent overfitting?
Assume that you want to fit $\beta$ in the model
$$ [y_1, y_2] = [0,1]\beta + [\epsilon(s_1), \epsilon(s_1)], $$
where the noise $\epsilon$ are a zero mean Gaussian process with say Matérn covaria
|
41,724
|
Can I compare ordinal rankings (and if so, how)?
|
I'm not sure how to do this in Excel, but Kendall's tau is what springs to mind. The gist of that method is for each pair of supervisors (1 and 2, say) to take each pair of employees and count how many times their ranks are ordered in the same way.
For that example, look at supervisor 1 and 3. They agree on the orderings of employees 1-2 and 1-3, but not on 2-3, so they'd have a tau of 1/3 (i.e. (2-1)/3). Supervisors 1 and 2 disagree on all pairings, so they'd have a tau of -1 (i.e. (0-3)/3).
Addendum: You may also want to try Spearman's rho. It's more sensitive to outliers (for example, if one supervisor just hated someone and ranked them at the bottom, while the rest of the order was the same, they would have a low rho), so I don't think it's as good a measure, but it's trivially easy to calculate in Excel. Just do the CORREL of the ranks. The difference is a little like the a MAD vs RMSE difference; rho is more like the squared difference, while tau is more like the absolute difference.
|
Can I compare ordinal rankings (and if so, how)?
|
I'm not sure how to do this in Excel, but Kendall's tau is what springs to mind. The gist of that method is for each pair of supervisors (1 and 2, say) to take each pair of employees and count how man
|
Can I compare ordinal rankings (and if so, how)?
I'm not sure how to do this in Excel, but Kendall's tau is what springs to mind. The gist of that method is for each pair of supervisors (1 and 2, say) to take each pair of employees and count how many times their ranks are ordered in the same way.
For that example, look at supervisor 1 and 3. They agree on the orderings of employees 1-2 and 1-3, but not on 2-3, so they'd have a tau of 1/3 (i.e. (2-1)/3). Supervisors 1 and 2 disagree on all pairings, so they'd have a tau of -1 (i.e. (0-3)/3).
Addendum: You may also want to try Spearman's rho. It's more sensitive to outliers (for example, if one supervisor just hated someone and ranked them at the bottom, while the rest of the order was the same, they would have a low rho), so I don't think it's as good a measure, but it's trivially easy to calculate in Excel. Just do the CORREL of the ranks. The difference is a little like the a MAD vs RMSE difference; rho is more like the squared difference, while tau is more like the absolute difference.
|
Can I compare ordinal rankings (and if so, how)?
I'm not sure how to do this in Excel, but Kendall's tau is what springs to mind. The gist of that method is for each pair of supervisors (1 and 2, say) to take each pair of employees and count how man
|
41,725
|
Can I compare ordinal rankings (and if so, how)?
|
Johann is recommending nonparametric measures of association. If you reject independence than you are saying that the is a difference between the two groups. Another way is nonparametric ANOVA which could use the Kruskal-Wallis test for differences between the three raters. Other association measures that were specifically designed for this problem are the Kappa statistic and the intraclass correlation.
|
Can I compare ordinal rankings (and if so, how)?
|
Johann is recommending nonparametric measures of association. If you reject independence than you are saying that the is a difference between the two groups. Another way is nonparametric ANOVA which
|
Can I compare ordinal rankings (and if so, how)?
Johann is recommending nonparametric measures of association. If you reject independence than you are saying that the is a difference between the two groups. Another way is nonparametric ANOVA which could use the Kruskal-Wallis test for differences between the three raters. Other association measures that were specifically designed for this problem are the Kappa statistic and the intraclass correlation.
|
Can I compare ordinal rankings (and if so, how)?
Johann is recommending nonparametric measures of association. If you reject independence than you are saying that the is a difference between the two groups. Another way is nonparametric ANOVA which
|
41,726
|
Plotting overlaid ROC curves
|
The caTools package provides the colAUC function. Use it and set the plotROC argument to TRUE. I have been satisfied with the graphs it produces.
|
Plotting overlaid ROC curves
|
The caTools package provides the colAUC function. Use it and set the plotROC argument to TRUE. I have been satisfied with the graphs it produces.
|
Plotting overlaid ROC curves
The caTools package provides the colAUC function. Use it and set the plotROC argument to TRUE. I have been satisfied with the graphs it produces.
|
Plotting overlaid ROC curves
The caTools package provides the colAUC function. Use it and set the plotROC argument to TRUE. I have been satisfied with the graphs it produces.
|
41,727
|
Plotting overlaid ROC curves
|
If you'd like to overlay the ROC curves over each other, you can use the roc function from the pROC R package to get the sensitivity and specificity values and plot them out manually,
#outcome var
y = c(rep(0,50), rep(1, 50))
#predictors
x1 = y + rnorm(100, sd = 1)
x2 = y + rnorm(100, sd = 4)
model1 = glm(y ~ x1, family = binomial())
pred1 = predict(model1)
model2 = glm(y ~ x1 + x2, family = binomial())
pred2 = predict(model2)
library(pROC)
roc1 = roc(y, pred1)
roc2 = roc(y, pred2)
Specificity and Sensitivity Values
> str(roc1)
List of 15
\$ percent : logi FALSE
\$ sensitivities : num [1:101] 1 1 0.98 0.98 0.98 0.98 0.98 0.98 0.96...
\$ specificities : num [1:101] 0 0.02 0.02 0.04 0.06 0.08 0.1 0.12 0.12
...
or use the plot function as
plot(roc1, col = 1, lty = 2, main = "ROC")
plot(roc2, col = 4, lty = 3, add = TRUE)
Also, there is also the pROC::ggroc function for ggplot2 plotting abilities.
|
Plotting overlaid ROC curves
|
If you'd like to overlay the ROC curves over each other, you can use the roc function from the pROC R package to get the sensitivity and specificity values and plot them out manually,
#outcome va
|
Plotting overlaid ROC curves
If you'd like to overlay the ROC curves over each other, you can use the roc function from the pROC R package to get the sensitivity and specificity values and plot them out manually,
#outcome var
y = c(rep(0,50), rep(1, 50))
#predictors
x1 = y + rnorm(100, sd = 1)
x2 = y + rnorm(100, sd = 4)
model1 = glm(y ~ x1, family = binomial())
pred1 = predict(model1)
model2 = glm(y ~ x1 + x2, family = binomial())
pred2 = predict(model2)
library(pROC)
roc1 = roc(y, pred1)
roc2 = roc(y, pred2)
Specificity and Sensitivity Values
> str(roc1)
List of 15
\$ percent : logi FALSE
\$ sensitivities : num [1:101] 1 1 0.98 0.98 0.98 0.98 0.98 0.98 0.96...
\$ specificities : num [1:101] 0 0.02 0.02 0.04 0.06 0.08 0.1 0.12 0.12
...
or use the plot function as
plot(roc1, col = 1, lty = 2, main = "ROC")
plot(roc2, col = 4, lty = 3, add = TRUE)
Also, there is also the pROC::ggroc function for ggplot2 plotting abilities.
|
Plotting overlaid ROC curves
If you'd like to overlay the ROC curves over each other, you can use the roc function from the pROC R package to get the sensitivity and specificity values and plot them out manually,
#outcome va
|
41,728
|
Tips and tricks for getting good parameter estimates using Bayesian nonlinear regression
|
Here's the notation I'm going to use for the sigmoid model:
$y = U + \frac{L - U}{1 + (\frac{x}{x_0})^k}$
The problem is that the sigmoid model nests functions that are close to linear within a bounded domain, and further, that very different parameter values give rise to almost-lines that are almost the same. Check it out:
sigmoid <- function(x, L, U, x_0, k) U + (L-U)/(1 + (x/x_0)^k)
x<- runif(n = 40, min = 15, max = 25)
y1 <- sigmoid(x, -10, 50, 20, 5) + rnorm(length(x), sd = 2)
y2 <- sigmoid(x, -24, 76, 21.6, 3) + rnorm(length(x), sd = 2)
curve(sigmoid(x, -10, 50, 20, 5), from = 15, to = 25, ylab = "y")
curve(sigmoid(x, -24, 76, 21.6, 3), add = TRUE, col = "red")
points(x, y1)
points(x, y2, col = "red")
The upshot is that the likelihood function changes very, very slowly in some directions over vast swaths of the parameter space. If the priors don't constrain the parameters, then the posterior distribution inherits the likelihood's ill-conditioning.
I haven't used jags, so I don't know how much freedom you have to specify priors. (When things get this complicated I usually roll my own sampling algorithm in R.) The approach I'd use in this situation is to give zero prior support to sigmoid functions that don't have detectable saturation on both ends of the data domain (by "data domain" I mean the closed interval between the minimum and maximum $x$ values). This won't work unless the data really do turn out to have detectable saturation at both ends -- but if the data look linear on either end, one shouldn't be fitting a sigmoid anyway.
First, note that slope of the function at the midpoint is $\frac{(U-L)k} {4x_0}$. Let the set of $x$ values for which the ratio of slope of the sigmoid function to the slope at the midpoint is at most $\frac{1}{2}$ be the "saturation regions". There will be two saturation regions, one above the midpoint and one below. Points in these regions contribute most of their information to determining the values of the asymptotes. In fact, estimating an asymptote is basically like estimating a constant, so the standard error of the estimate of an asymptote is approximately $\frac{\sigma}{\sqrt{n}}$, where $n$ is the number of data points in the appropriate saturation region.
Let $n_U$ and $n_L$ be the number of data points within the upper and lower saturation regions, respectively. Note that these numbers are implicitly functions of all the parameters of the sigmoid function. To exclude regions of flat likelihood from the prior support, I would choose a prior which assigns zero density unless the following conditions are satisfied:
$x_0$ is within the data domain
$n_U > 0$
$n_L > 0$
conditionally on $\sigma$, $U - \frac{2\sigma}{\sqrt{n_U}} > L + \frac{2\sigma}{\sqrt{n_L}}$
I'm not sure what prior is reasonable to assign within this region of prior support, but if it's just flat, at least it can't be worse than frequentist inference based on asymptotics of the likelihood function.
|
Tips and tricks for getting good parameter estimates using Bayesian nonlinear regression
|
Here's the notation I'm going to use for the sigmoid model:
$y = U + \frac{L - U}{1 + (\frac{x}{x_0})^k}$
The problem is that the sigmoid model nests functions that are close to linear within a bounde
|
Tips and tricks for getting good parameter estimates using Bayesian nonlinear regression
Here's the notation I'm going to use for the sigmoid model:
$y = U + \frac{L - U}{1 + (\frac{x}{x_0})^k}$
The problem is that the sigmoid model nests functions that are close to linear within a bounded domain, and further, that very different parameter values give rise to almost-lines that are almost the same. Check it out:
sigmoid <- function(x, L, U, x_0, k) U + (L-U)/(1 + (x/x_0)^k)
x<- runif(n = 40, min = 15, max = 25)
y1 <- sigmoid(x, -10, 50, 20, 5) + rnorm(length(x), sd = 2)
y2 <- sigmoid(x, -24, 76, 21.6, 3) + rnorm(length(x), sd = 2)
curve(sigmoid(x, -10, 50, 20, 5), from = 15, to = 25, ylab = "y")
curve(sigmoid(x, -24, 76, 21.6, 3), add = TRUE, col = "red")
points(x, y1)
points(x, y2, col = "red")
The upshot is that the likelihood function changes very, very slowly in some directions over vast swaths of the parameter space. If the priors don't constrain the parameters, then the posterior distribution inherits the likelihood's ill-conditioning.
I haven't used jags, so I don't know how much freedom you have to specify priors. (When things get this complicated I usually roll my own sampling algorithm in R.) The approach I'd use in this situation is to give zero prior support to sigmoid functions that don't have detectable saturation on both ends of the data domain (by "data domain" I mean the closed interval between the minimum and maximum $x$ values). This won't work unless the data really do turn out to have detectable saturation at both ends -- but if the data look linear on either end, one shouldn't be fitting a sigmoid anyway.
First, note that slope of the function at the midpoint is $\frac{(U-L)k} {4x_0}$. Let the set of $x$ values for which the ratio of slope of the sigmoid function to the slope at the midpoint is at most $\frac{1}{2}$ be the "saturation regions". There will be two saturation regions, one above the midpoint and one below. Points in these regions contribute most of their information to determining the values of the asymptotes. In fact, estimating an asymptote is basically like estimating a constant, so the standard error of the estimate of an asymptote is approximately $\frac{\sigma}{\sqrt{n}}$, where $n$ is the number of data points in the appropriate saturation region.
Let $n_U$ and $n_L$ be the number of data points within the upper and lower saturation regions, respectively. Note that these numbers are implicitly functions of all the parameters of the sigmoid function. To exclude regions of flat likelihood from the prior support, I would choose a prior which assigns zero density unless the following conditions are satisfied:
$x_0$ is within the data domain
$n_U > 0$
$n_L > 0$
conditionally on $\sigma$, $U - \frac{2\sigma}{\sqrt{n_U}} > L + \frac{2\sigma}{\sqrt{n_L}}$
I'm not sure what prior is reasonable to assign within this region of prior support, but if it's just flat, at least it can't be worse than frequentist inference based on asymptotics of the likelihood function.
|
Tips and tricks for getting good parameter estimates using Bayesian nonlinear regression
Here's the notation I'm going to use for the sigmoid model:
$y = U + \frac{L - U}{1 + (\frac{x}{x_0})^k}$
The problem is that the sigmoid model nests functions that are close to linear within a bounde
|
41,729
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
|
The issue becomes less contentious if you state the facts[1]. After all, all multivariate robust estimation procedures have at their core an outlier detection algorithm and all will in some form or another output a list of suspect observations. Stated otherwise, given a robust fit, identifying outliers is in principle not an issue.
The main difference between robust estimation approaches and the testing approaches (Dixon, Grubbs) is that the latter can sustain at most a single outlier. In contrast, most state of the art robust estimation procedures have been designed to handle nearly 50% contamination (they can in principle be tuned to handle anywhere between 0 and nearly 50 percent outliers trading off robustness for computational costs).
[1] Rousseeuw P. J. and Van Zomeren B. C.,
Unmasking Multivariate Outliers and Leverage Points.
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
|
The issue becomes less contentious if you state the facts[1]. After all, all multivariate robust estimation procedures have at their core an outlier detection algorithm and all will in some form or an
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
The issue becomes less contentious if you state the facts[1]. After all, all multivariate robust estimation procedures have at their core an outlier detection algorithm and all will in some form or another output a list of suspect observations. Stated otherwise, given a robust fit, identifying outliers is in principle not an issue.
The main difference between robust estimation approaches and the testing approaches (Dixon, Grubbs) is that the latter can sustain at most a single outlier. In contrast, most state of the art robust estimation procedures have been designed to handle nearly 50% contamination (they can in principle be tuned to handle anywhere between 0 and nearly 50 percent outliers trading off robustness for computational costs).
[1] Rousseeuw P. J. and Van Zomeren B. C.,
Unmasking Multivariate Outliers and Leverage Points.
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
The issue becomes less contentious if you state the facts[1]. After all, all multivariate robust estimation procedures have at their core an outlier detection algorithm and all will in some form or an
|
41,730
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
|
I say no! I have done research on Dixon's test back in the 1980s. I took a look at that post and commented there. I think there is confusion because robust estimation and outlier detection though similar have different objectives and some people I think seem to feel that since the outlier methods are not mentioned in the robustness literature that there is something wrong with them. I hope other will agree with me in answering this question.
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
|
I say no! I have done research on Dixon's test back in the 1980s. I took a look at that post and commented there. I think there is confusion because robust estimation and outlier detection though si
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
I say no! I have done research on Dixon's test back in the 1980s. I took a look at that post and commented there. I think there is confusion because robust estimation and outlier detection though similar have different objectives and some people I think seem to feel that since the outlier methods are not mentioned in the robustness literature that there is something wrong with them. I hope other will agree with me in answering this question.
|
Tests for univariate outliers: have Dixon's and Grubb's methods been discredited?
I say no! I have done research on Dixon's test back in the 1980s. I took a look at that post and commented there. I think there is confusion because robust estimation and outlier detection though si
|
41,731
|
How do you generate data from the multivariate Marshall Olkin distributed data?
|
The Marshall-Olkin bivariate distribution is not absolutely continuous because ${\mathbb P}[Y_1=Y_2]>0$. Therefore, in a simulation it is natural to observe values along $Y_1=Y_2$.
Thanks for the kind offer.
|
How do you generate data from the multivariate Marshall Olkin distributed data?
|
The Marshall-Olkin bivariate distribution is not absolutely continuous because ${\mathbb P}[Y_1=Y_2]>0$. Therefore, in a simulation it is natural to observe values along $Y_1=Y_2$.
Thanks for the kind
|
How do you generate data from the multivariate Marshall Olkin distributed data?
The Marshall-Olkin bivariate distribution is not absolutely continuous because ${\mathbb P}[Y_1=Y_2]>0$. Therefore, in a simulation it is natural to observe values along $Y_1=Y_2$.
Thanks for the kind offer.
|
How do you generate data from the multivariate Marshall Olkin distributed data?
The Marshall-Olkin bivariate distribution is not absolutely continuous because ${\mathbb P}[Y_1=Y_2]>0$. Therefore, in a simulation it is natural to observe values along $Y_1=Y_2$.
Thanks for the kind
|
41,732
|
Model selection in mixed-model context using lmer
|
As far as I'm aware, you want to specify the random effects structure first. Chapter 5 section 7 of Zuur details the general steps for selecting a model. First, include all the relevant fixed effects. Second, identify the random effects structure using REML. Third, find the fixed effects structure with ML. Fourth, Zuur suggests using the REML estimation to present (I'm not sure why). Section 5.8 has examples.
|
Model selection in mixed-model context using lmer
|
As far as I'm aware, you want to specify the random effects structure first. Chapter 5 section 7 of Zuur details the general steps for selecting a model. First, include all the relevant fixed effects.
|
Model selection in mixed-model context using lmer
As far as I'm aware, you want to specify the random effects structure first. Chapter 5 section 7 of Zuur details the general steps for selecting a model. First, include all the relevant fixed effects. Second, identify the random effects structure using REML. Third, find the fixed effects structure with ML. Fourth, Zuur suggests using the REML estimation to present (I'm not sure why). Section 5.8 has examples.
|
Model selection in mixed-model context using lmer
As far as I'm aware, you want to specify the random effects structure first. Chapter 5 section 7 of Zuur details the general steps for selecting a model. First, include all the relevant fixed effects.
|
41,733
|
Calculating the Variance using Delta Method
|
For notational simplicity define $X_1=A$, $X_2=B$, $X_3=C$, $X_4=D$ and $L=f(X_1,X_2,X_3,X_4)$ with $f(x_1,x_2,x_3,x_4) = \frac{x_1}{x_2}+\frac{x_3}{x_4}$. A first order expansion around $\mu = (\mu_1, \mu_2,\mu_3, \mu_4)$ where $\mu_i=\mathbb{E}[X_i]$ shows that the following approximation holds
$$L \approx f(\mu) + \sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i)$$
as soon as the quantities $X_i-\mu_i$ are small enough.
Since $\mathbb{E}\big[\sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i) \big]=0$ it thus follows that the variance of $L$ can also be approximated by
$$\textrm{var}(L) \approx \mathbb{E} \Big[ \Big\{\sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i) \Big\}^2 \Big] \\
= \sum_{1 \leq i,j \leq 4} \textrm{Cov}(X_i,X_j) \partial_i f(\mu) \partial_j f(\mu).$$
|
Calculating the Variance using Delta Method
|
For notational simplicity define $X_1=A$, $X_2=B$, $X_3=C$, $X_4=D$ and $L=f(X_1,X_2,X_3,X_4)$ with $f(x_1,x_2,x_3,x_4) = \frac{x_1}{x_2}+\frac{x_3}{x_4}$. A first order expansion around $\mu = (\mu
|
Calculating the Variance using Delta Method
For notational simplicity define $X_1=A$, $X_2=B$, $X_3=C$, $X_4=D$ and $L=f(X_1,X_2,X_3,X_4)$ with $f(x_1,x_2,x_3,x_4) = \frac{x_1}{x_2}+\frac{x_3}{x_4}$. A first order expansion around $\mu = (\mu_1, \mu_2,\mu_3, \mu_4)$ where $\mu_i=\mathbb{E}[X_i]$ shows that the following approximation holds
$$L \approx f(\mu) + \sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i)$$
as soon as the quantities $X_i-\mu_i$ are small enough.
Since $\mathbb{E}\big[\sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i) \big]=0$ it thus follows that the variance of $L$ can also be approximated by
$$\textrm{var}(L) \approx \mathbb{E} \Big[ \Big\{\sum_{i=1}^4 \partial_i f(\mu) \, (X_i-\mu_i) \Big\}^2 \Big] \\
= \sum_{1 \leq i,j \leq 4} \textrm{Cov}(X_i,X_j) \partial_i f(\mu) \partial_j f(\mu).$$
|
Calculating the Variance using Delta Method
For notational simplicity define $X_1=A$, $X_2=B$, $X_3=C$, $X_4=D$ and $L=f(X_1,X_2,X_3,X_4)$ with $f(x_1,x_2,x_3,x_4) = \frac{x_1}{x_2}+\frac{x_3}{x_4}$. A first order expansion around $\mu = (\mu
|
41,734
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
If you z-standardize each of your series, $(X_i-\bar{X})/\sigma$, that is, unify level of the series firstly and swing of the series secondly, then the only difference that remains is the difference in shape. Compute euclidean distances (or similar measure) between 120 series and perform hierarchical clustering. You might also want (maybe) to do mild smoothig of the curves prior all.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
If you z-standardize each of your series, $(X_i-\bar{X})/\sigma$, that is, unify level of the series firstly and swing of the series secondly, then the only difference that remains is the difference i
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
If you z-standardize each of your series, $(X_i-\bar{X})/\sigma$, that is, unify level of the series firstly and swing of the series secondly, then the only difference that remains is the difference in shape. Compute euclidean distances (or similar measure) between 120 series and perform hierarchical clustering. You might also want (maybe) to do mild smoothig of the curves prior all.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
If you z-standardize each of your series, $(X_i-\bar{X})/\sigma$, that is, unify level of the series firstly and swing of the series secondly, then the only difference that remains is the difference i
|
41,735
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
All of the recommendations so far rely on the standard moment-based approaches to time series analysis and all are a type of HAC model. The question, though, specifically queried the patterning or shape in the data. Andreas Brandmaier at the Max Planck Institute has developed an non-moment-based, information and complexity theoretic pattern analysis time series model that he calls permutation distribution analysis. He's written an R module to test the similarities in shape. PDC has a long history in biostatistics as an approach to two group similarities. Brandmaier's dissertation was on PDC and structural equation modeling trees.
pdc: An R Package for Complexity-Based Clustering of Time Series, J Stat Software, Andreas Brandmaier
Permutation Distribution Clustering and Structural Equation Model Trees, Brandmaier dissertation PDF
In addition, there is Eamon Keogh's machine learning, iSax method for this.
http://www.cs.ucr.edu/~eamonn/
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
All of the recommendations so far rely on the standard moment-based approaches to time series analysis and all are a type of HAC model. The question, though, specifically queried the patterning or sha
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
All of the recommendations so far rely on the standard moment-based approaches to time series analysis and all are a type of HAC model. The question, though, specifically queried the patterning or shape in the data. Andreas Brandmaier at the Max Planck Institute has developed an non-moment-based, information and complexity theoretic pattern analysis time series model that he calls permutation distribution analysis. He's written an R module to test the similarities in shape. PDC has a long history in biostatistics as an approach to two group similarities. Brandmaier's dissertation was on PDC and structural equation modeling trees.
pdc: An R Package for Complexity-Based Clustering of Time Series, J Stat Software, Andreas Brandmaier
Permutation Distribution Clustering and Structural Equation Model Trees, Brandmaier dissertation PDF
In addition, there is Eamon Keogh's machine learning, iSax method for this.
http://www.cs.ucr.edu/~eamonn/
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
All of the recommendations so far rely on the standard moment-based approaches to time series analysis and all are a type of HAC model. The question, though, specifically queried the patterning or sha
|
41,736
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
You should first differentiate your time series, i.e. consider $X_t = S_t - S_{t-1}$. Then, a correlation-based clustering will do it. You should use Spearman correlation rather than the Pearson one, as it is more generic and robust to strong variations. If you suspect that the strength of variations matters somehow, you could use a correlation+distribution clustering, i.e. each time series can be viewed as a random variable, and the values of its variations $X_t$ are realizations. Sklar's theorem asserts that the whole information, assuming i.i.d. sampling of the $X_t$, can be captured by a "pure correlation" and distribution separately, cf. this paper which illustrates the approach by clustering financial time series, and eventually this link for a snippet of Python code.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
You should first differentiate your time series, i.e. consider $X_t = S_t - S_{t-1}$. Then, a correlation-based clustering will do it. You should use Spearman correlation rather than the Pearson one,
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
You should first differentiate your time series, i.e. consider $X_t = S_t - S_{t-1}$. Then, a correlation-based clustering will do it. You should use Spearman correlation rather than the Pearson one, as it is more generic and robust to strong variations. If you suspect that the strength of variations matters somehow, you could use a correlation+distribution clustering, i.e. each time series can be viewed as a random variable, and the values of its variations $X_t$ are realizations. Sklar's theorem asserts that the whole information, assuming i.i.d. sampling of the $X_t$, can be captured by a "pure correlation" and distribution separately, cf. this paper which illustrates the approach by clustering financial time series, and eventually this link for a snippet of Python code.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
You should first differentiate your time series, i.e. consider $X_t = S_t - S_{t-1}$. Then, a correlation-based clustering will do it. You should use Spearman correlation rather than the Pearson one,
|
41,737
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
Alternatively (tentative suggestion!!!): could you not create a new variable, delta.growth, which is growth at t=i - growth at t=i-1, for each time point t=0 ... t=n. I am not sure exactly how this would differ to Z-score assessment. Would be interesting to find out!
You could also use joint trajectory interpretation to model both absolute growth and delta.growth. This should give weighting to both shape and value, although I am naive to this approach.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
Alternatively (tentative suggestion!!!): could you not create a new variable, delta.growth, which is growth at t=i - growth at t=i-1, for each time point t=0 ... t=n. I am not sure exactly how this wo
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
Alternatively (tentative suggestion!!!): could you not create a new variable, delta.growth, which is growth at t=i - growth at t=i-1, for each time point t=0 ... t=n. I am not sure exactly how this would differ to Z-score assessment. Would be interesting to find out!
You could also use joint trajectory interpretation to model both absolute growth and delta.growth. This should give weighting to both shape and value, although I am naive to this approach.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
Alternatively (tentative suggestion!!!): could you not create a new variable, delta.growth, which is growth at t=i - growth at t=i-1, for each time point t=0 ... t=n. I am not sure exactly how this wo
|
41,738
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
There is the dynamic time warping R package dtw which allows you to compare shapes of curves and goes beyond one to one matching.
There's also the dtwclust R package:
Time series clustering along with optimized techniques related to the Dynamic Time Warping distance and its corresponding lower bounds.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
There is the dynamic time warping R package dtw which allows you to compare shapes of curves and goes beyond one to one matching.
There's also the dtwclust R package:
Time series clustering along wit
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
There is the dynamic time warping R package dtw which allows you to compare shapes of curves and goes beyond one to one matching.
There's also the dtwclust R package:
Time series clustering along with optimized techniques related to the Dynamic Time Warping distance and its corresponding lower bounds.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
There is the dynamic time warping R package dtw which allows you to compare shapes of curves and goes beyond one to one matching.
There's also the dtwclust R package:
Time series clustering along wit
|
41,739
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
I might be late for this question but there is now an R package called KmlShape (produced by the same author that made the Kml package), that clusters trajectories based on their shape. It uses the K-means algorithm with the Fréchet distance.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
|
I might be late for this question but there is now an R package called KmlShape (produced by the same author that made the Kml package), that clusters trajectories based on their shape. It uses the K-
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
I might be late for this question but there is now an R package called KmlShape (produced by the same author that made the Kml package), that clusters trajectories based on their shape. It uses the K-means algorithm with the Fréchet distance.
|
How to do time series ( longitudinal) clustering based entirely on Shape of the curves?
I might be late for this question but there is now an R package called KmlShape (produced by the same author that made the Kml package), that clusters trajectories based on their shape. It uses the K-
|
41,740
|
A short question on sample variance
|
I don't think you're going to get a lot of benefit here, at least in situations where the mean is not very informative about the variance. In these situations, whether the $X_i$ vary about a number close to $\bar X$ or close to $\hat X$ is not very helpful in determining how much they vary.
To see this in the algebra, notice that
$$
V_2 = \frac{1}{N-1}(\sum X_i - \hat X)^2 = \frac{1}{N-1}(\sum_i X_i - \bar X + \bar X - \hat X)^2
$$
meaning we can write it as
$$
V_1 + \frac{N}{N-1}(\bar X - \hat X)^2.
$$
Also, if you have $K$ different estimates of the same quantity, optimality is usually obtained by taking their weighted average, where the weights are proportional to the inverse of their (co)variance. The Gauss Markov Theorem is the main result, and its generalization by Aitken.
NB for a situation where the mean is very informative about the variance, use binary $X_i$, where if you know the mean you know the variance.
|
A short question on sample variance
|
I don't think you're going to get a lot of benefit here, at least in situations where the mean is not very informative about the variance. In these situations, whether the $X_i$ vary about a number cl
|
A short question on sample variance
I don't think you're going to get a lot of benefit here, at least in situations where the mean is not very informative about the variance. In these situations, whether the $X_i$ vary about a number close to $\bar X$ or close to $\hat X$ is not very helpful in determining how much they vary.
To see this in the algebra, notice that
$$
V_2 = \frac{1}{N-1}(\sum X_i - \hat X)^2 = \frac{1}{N-1}(\sum_i X_i - \bar X + \bar X - \hat X)^2
$$
meaning we can write it as
$$
V_1 + \frac{N}{N-1}(\bar X - \hat X)^2.
$$
Also, if you have $K$ different estimates of the same quantity, optimality is usually obtained by taking their weighted average, where the weights are proportional to the inverse of their (co)variance. The Gauss Markov Theorem is the main result, and its generalization by Aitken.
NB for a situation where the mean is very informative about the variance, use binary $X_i$, where if you know the mean you know the variance.
|
A short question on sample variance
I don't think you're going to get a lot of benefit here, at least in situations where the mean is not very informative about the variance. In these situations, whether the $X_i$ vary about a number cl
|
41,741
|
A short question on sample variance
|
First, $\bar X$ is the best linear unbiased estimator of $\mu$, the population mean. You can improve the mean squared error by shrinkage, but among unbiased estimates, you cannot get any better in terms of variance than $\sigma^2/n$ ($\sigma^2$ being the population variance). Moreover, from the asymptotic theory of estimating equations, I believe you cannot do better than $\sigma^2/n$ asymptotically, anyway, so the bias, if any, has to go away at a rate faster than $O(n^{-1/2})$. A technically valid source to improve efficiency of the estimator of the mean is knowledge of the distributional form of your data (gamma? Poisson? double exponential?), whereas the mean is expressed as a function of the (estimated) population parameters, but of course practicality of any such assumption is dubious, at best.
Second, the estimate $V_1$ is only good as an unbiased estimate of the variance. As far as I recall my stat theory classes, the estimate $$V_3=\frac1{n+1} \sum_i (X_i-\bar X)^2$$ has the smallest MSE as the estimator of the sampling variance $V[\bar X]$ (you probably have to assume normality of $X_i$'s to get a specific answer, as the MSE of the variance estimator depends on the kurtosis of the original distribution).
So you can do all sorts of things with biased estimates, and improve the MSE of either the estimator of $\mu$ or the estimator of $V[\hat\mu]$. But the unbiased estimation theory is fairly rigid, and Cramer-Rao bound together with Rao-Blackwell theorem give strict limits for your efficiency.
|
A short question on sample variance
|
First, $\bar X$ is the best linear unbiased estimator of $\mu$, the population mean. You can improve the mean squared error by shrinkage, but among unbiased estimates, you cannot get any better in ter
|
A short question on sample variance
First, $\bar X$ is the best linear unbiased estimator of $\mu$, the population mean. You can improve the mean squared error by shrinkage, but among unbiased estimates, you cannot get any better in terms of variance than $\sigma^2/n$ ($\sigma^2$ being the population variance). Moreover, from the asymptotic theory of estimating equations, I believe you cannot do better than $\sigma^2/n$ asymptotically, anyway, so the bias, if any, has to go away at a rate faster than $O(n^{-1/2})$. A technically valid source to improve efficiency of the estimator of the mean is knowledge of the distributional form of your data (gamma? Poisson? double exponential?), whereas the mean is expressed as a function of the (estimated) population parameters, but of course practicality of any such assumption is dubious, at best.
Second, the estimate $V_1$ is only good as an unbiased estimate of the variance. As far as I recall my stat theory classes, the estimate $$V_3=\frac1{n+1} \sum_i (X_i-\bar X)^2$$ has the smallest MSE as the estimator of the sampling variance $V[\bar X]$ (you probably have to assume normality of $X_i$'s to get a specific answer, as the MSE of the variance estimator depends on the kurtosis of the original distribution).
So you can do all sorts of things with biased estimates, and improve the MSE of either the estimator of $\mu$ or the estimator of $V[\hat\mu]$. But the unbiased estimation theory is fairly rigid, and Cramer-Rao bound together with Rao-Blackwell theorem give strict limits for your efficiency.
|
A short question on sample variance
First, $\bar X$ is the best linear unbiased estimator of $\mu$, the population mean. You can improve the mean squared error by shrinkage, but among unbiased estimates, you cannot get any better in ter
|
41,742
|
A short question on sample variance
|
imagine we had a better estimate of the population mean: Xˆ that was guaranteed to have lower variance than the sample mean Xˉ. Could it be used to obtain an improved estimate of the population variance?
Yes.
Given only the samples the distribution over the mean and variance is normal-inverse-gamma. If you project this distribution so as to isolate only the estimate of the variance, it's no longer inverse-gamma-distributed, but will have a heavier tail.
On the other hand, given the samples and an exact mean, the distribution over the variance is inverse-gamma with shape $\frac n2$.
How you turn these priors over the variance into an estimate is up to you. The maximum likelihood estimators that most people calculate are the modes of the aforementioned distributions. I don't think the two distributions will have the same mode. (I think the first one will usually be larger, but the second will be larger if your true mean is very far from the sample mean.)
|
A short question on sample variance
|
imagine we had a better estimate of the population mean: Xˆ that was guaranteed to have lower variance than the sample mean Xˉ. Could it be used to obtain an improved estimate of the population varian
|
A short question on sample variance
imagine we had a better estimate of the population mean: Xˆ that was guaranteed to have lower variance than the sample mean Xˉ. Could it be used to obtain an improved estimate of the population variance?
Yes.
Given only the samples the distribution over the mean and variance is normal-inverse-gamma. If you project this distribution so as to isolate only the estimate of the variance, it's no longer inverse-gamma-distributed, but will have a heavier tail.
On the other hand, given the samples and an exact mean, the distribution over the variance is inverse-gamma with shape $\frac n2$.
How you turn these priors over the variance into an estimate is up to you. The maximum likelihood estimators that most people calculate are the modes of the aforementioned distributions. I don't think the two distributions will have the same mode. (I think the first one will usually be larger, but the second will be larger if your true mean is very far from the sample mean.)
|
A short question on sample variance
imagine we had a better estimate of the population mean: Xˆ that was guaranteed to have lower variance than the sample mean Xˉ. Could it be used to obtain an improved estimate of the population varian
|
41,743
|
Distribution of random effects
|
Assuming a normal distribution for the random effects is convenient from a computational point of view. However, it could be rather restrictive. In general, incorrect distribution assumption for the random effects has unfavorable influence on statistical inferences; see e.g.
1) Agresti, A., Caffo, B. & Ohman-Strickland, P. (2004). Examples in which misspecification of a random effects distribution reduces efficiency, and possible remedies, Computational Statistics and Data Analysis, 47, 639-653.
2) Heagerty, P. J. & Kurland, B. F. (2001). Misspecified maximum likelihood estimates and generalised linear mixed models, Biometrika, 88, 973-985.
3) Litiere, S., Alonso, A. & Molenberghs, G. (2007). Type I and type II error under random-effects misspecification in generalized linear mixed models, Biometrics, 63, 1038-1044.
This motivates the search for mixed models with more flexible distributions for the
random effects. For instance, there has been much literature on non-parametric
modeling, such as Dirichlet process models and stick-breaking processes.
Komarek, A. & Lesaffre, E. (2008), CSDA, 52, 3441-3458, have proposed a parametric extension, replacing the normal distribution in generalized linear mixed models with a penalized Gaussian mixture distribution.
Some others have proposed to use skew normal distribution as extensions to the normal. For example, see Hosseini, F., Eidsvik, J. and Mohammadzadeh, M. (2011). Approximate Bayesian inference in spatial generalized linear mixed models with skew normal latent variables, Computational Statistics and Data Analysis, 55, 1791-1806.
|
Distribution of random effects
|
Assuming a normal distribution for the random effects is convenient from a computational point of view. However, it could be rather restrictive. In general, incorrect distribution assumption for the r
|
Distribution of random effects
Assuming a normal distribution for the random effects is convenient from a computational point of view. However, it could be rather restrictive. In general, incorrect distribution assumption for the random effects has unfavorable influence on statistical inferences; see e.g.
1) Agresti, A., Caffo, B. & Ohman-Strickland, P. (2004). Examples in which misspecification of a random effects distribution reduces efficiency, and possible remedies, Computational Statistics and Data Analysis, 47, 639-653.
2) Heagerty, P. J. & Kurland, B. F. (2001). Misspecified maximum likelihood estimates and generalised linear mixed models, Biometrika, 88, 973-985.
3) Litiere, S., Alonso, A. & Molenberghs, G. (2007). Type I and type II error under random-effects misspecification in generalized linear mixed models, Biometrics, 63, 1038-1044.
This motivates the search for mixed models with more flexible distributions for the
random effects. For instance, there has been much literature on non-parametric
modeling, such as Dirichlet process models and stick-breaking processes.
Komarek, A. & Lesaffre, E. (2008), CSDA, 52, 3441-3458, have proposed a parametric extension, replacing the normal distribution in generalized linear mixed models with a penalized Gaussian mixture distribution.
Some others have proposed to use skew normal distribution as extensions to the normal. For example, see Hosseini, F., Eidsvik, J. and Mohammadzadeh, M. (2011). Approximate Bayesian inference in spatial generalized linear mixed models with skew normal latent variables, Computational Statistics and Data Analysis, 55, 1791-1806.
|
Distribution of random effects
Assuming a normal distribution for the random effects is convenient from a computational point of view. However, it could be rather restrictive. In general, incorrect distribution assumption for the r
|
41,744
|
Negative Binomial Regression and Heteroskedasticity
|
Heteroskedasticity is relevant with ordinary linear regression, where there is an assumption that variance is constant (do not depend on the mean), known as homoskedasticity. But with alternative regression models, like Poisson regression or negative binomial regression, there is no assumption of constant variance! In its place this models do assume some other mean-variance relationship, in the case of Poisson regression that the variance=mean. For negative binomial regression, there do exist several variants with different mean-variance relationships. So in place of investigating violation of homoskedasticity, you should investigate violation of the assumed mean-variance relationship. You could start with a plot of residuals versus predicted values.
|
Negative Binomial Regression and Heteroskedasticity
|
Heteroskedasticity is relevant with ordinary linear regression, where there is an assumption that variance is constant (do not depend on the mean), known as homoskedasticity. But with alternative reg
|
Negative Binomial Regression and Heteroskedasticity
Heteroskedasticity is relevant with ordinary linear regression, where there is an assumption that variance is constant (do not depend on the mean), known as homoskedasticity. But with alternative regression models, like Poisson regression or negative binomial regression, there is no assumption of constant variance! In its place this models do assume some other mean-variance relationship, in the case of Poisson regression that the variance=mean. For negative binomial regression, there do exist several variants with different mean-variance relationships. So in place of investigating violation of homoskedasticity, you should investigate violation of the assumed mean-variance relationship. You could start with a plot of residuals versus predicted values.
|
Negative Binomial Regression and Heteroskedasticity
Heteroskedasticity is relevant with ordinary linear regression, where there is an assumption that variance is constant (do not depend on the mean), known as homoskedasticity. But with alternative reg
|
41,745
|
Increase the sample size of a Latin Hypercube study?
|
With Latin hypercube samples, you have to decide on the number of samples, so that you break your range into either 10 or 20 bins to begin with. Otherwise, you will likely miss some parts of your space. My understanding is that the only quasi-Monte Carlo method that allows to take the next sample (or next $N$ samples) easily without trying to figure out their dependence on the previously collected samples is Halton sequence. See the encompassing treatment in Niederreiter (1992).
In fact, as far as I recall from computational physics literature (most likely, it was in Morokoff and Caflisch (1995)), for the sequence of length up to about $6^d$ where $d$ is the dimension of your space, quasi Monte Carlo sequences do not show appreciable gains over the standard pseudo-random number generators. So you may not have to bother with LHC and agonize over the choice between 10 and 20 samples -- you can just start with any random number generator you have at hand, and keep adding new ones if you are not satisfied with the achieved precision.
|
Increase the sample size of a Latin Hypercube study?
|
With Latin hypercube samples, you have to decide on the number of samples, so that you break your range into either 10 or 20 bins to begin with. Otherwise, you will likely miss some parts of your spac
|
Increase the sample size of a Latin Hypercube study?
With Latin hypercube samples, you have to decide on the number of samples, so that you break your range into either 10 or 20 bins to begin with. Otherwise, you will likely miss some parts of your space. My understanding is that the only quasi-Monte Carlo method that allows to take the next sample (or next $N$ samples) easily without trying to figure out their dependence on the previously collected samples is Halton sequence. See the encompassing treatment in Niederreiter (1992).
In fact, as far as I recall from computational physics literature (most likely, it was in Morokoff and Caflisch (1995)), for the sequence of length up to about $6^d$ where $d$ is the dimension of your space, quasi Monte Carlo sequences do not show appreciable gains over the standard pseudo-random number generators. So you may not have to bother with LHC and agonize over the choice between 10 and 20 samples -- you can just start with any random number generator you have at hand, and keep adding new ones if you are not satisfied with the achieved precision.
|
Increase the sample size of a Latin Hypercube study?
With Latin hypercube samples, you have to decide on the number of samples, so that you break your range into either 10 or 20 bins to begin with. Otherwise, you will likely miss some parts of your spac
|
41,746
|
How to capture competitive spatial interactions between multiple stores and customers
|
One of the assumptions of the Huff model (which we call multinomial logit in economics) is Independence of Irrelevant Alternatives. IIA says that the ratio of red store to green store sales is independent of the existence and characteristics of all other alternatives --- it only depends on red and green store characteristics. Your intuition is that this assumption should be violated in this application.
What you want is one of the alternatives to multinomial logit which relaxes the IIA assumption. There are a number of these, including multinomial probit, nested logit, and logit models using the generalized extreme value distribution, sometimes called generalized logit. There are large literatures in this in both Industrial Organization and in Marketing.
Though these models are all defined at the individual level, they can be estimated with data at the market level (like total sales at each store in your example). There is a nice free online book by Kenneth Train. Actually, there are two.
|
How to capture competitive spatial interactions between multiple stores and customers
|
One of the assumptions of the Huff model (which we call multinomial logit in economics) is Independence of Irrelevant Alternatives. IIA says that the ratio of red store to green store sales is indepe
|
How to capture competitive spatial interactions between multiple stores and customers
One of the assumptions of the Huff model (which we call multinomial logit in economics) is Independence of Irrelevant Alternatives. IIA says that the ratio of red store to green store sales is independent of the existence and characteristics of all other alternatives --- it only depends on red and green store characteristics. Your intuition is that this assumption should be violated in this application.
What you want is one of the alternatives to multinomial logit which relaxes the IIA assumption. There are a number of these, including multinomial probit, nested logit, and logit models using the generalized extreme value distribution, sometimes called generalized logit. There are large literatures in this in both Industrial Organization and in Marketing.
Though these models are all defined at the individual level, they can be estimated with data at the market level (like total sales at each store in your example). There is a nice free online book by Kenneth Train. Actually, there are two.
|
How to capture competitive spatial interactions between multiple stores and customers
One of the assumptions of the Huff model (which we call multinomial logit in economics) is Independence of Irrelevant Alternatives. IIA says that the ratio of red store to green store sales is indepe
|
41,747
|
How to capture competitive spatial interactions between multiple stores and customers
|
You are right, the original model seems to calculate individual attractiveness and probabilities but does not take into account the interactions.
Let's say you calculate P(i,j) Using the definition of huff-model from -
http://www.directionsmag.com/articles/retail-trade-area-analysis-using-the-huff-model/123411
then to translate your intuition -
P'(i,j) = P(i,j) * [k / [sum(A(i,j')]]
where k is some constant. sum(A(i,j')) is the attractiveness (numerator of earlier formula) of all stores except this one. This will introduce dampening and penalize a store for being close to other desirable stores.
|
How to capture competitive spatial interactions between multiple stores and customers
|
You are right, the original model seems to calculate individual attractiveness and probabilities but does not take into account the interactions.
Let's say you calculate P(i,j) Using the definition of
|
How to capture competitive spatial interactions between multiple stores and customers
You are right, the original model seems to calculate individual attractiveness and probabilities but does not take into account the interactions.
Let's say you calculate P(i,j) Using the definition of huff-model from -
http://www.directionsmag.com/articles/retail-trade-area-analysis-using-the-huff-model/123411
then to translate your intuition -
P'(i,j) = P(i,j) * [k / [sum(A(i,j')]]
where k is some constant. sum(A(i,j')) is the attractiveness (numerator of earlier formula) of all stores except this one. This will introduce dampening and penalize a store for being close to other desirable stores.
|
How to capture competitive spatial interactions between multiple stores and customers
You are right, the original model seems to calculate individual attractiveness and probabilities but does not take into account the interactions.
Let's say you calculate P(i,j) Using the definition of
|
41,748
|
How to select the final model with elastic net feature selection, cross validation and SVM?
|
By "for each fold I get a different set of features", I suspect you mean that you are using a k-fold cross-validation procedure to estimte the performance of the model. The thing to remember about cross-validation is that you are estimating the perfomance of a method of constructing a model, not the model itself. So you form the final model, just use the procedure used in each fold of the cross-validation, but using all of the data, rather than (k-1)/k of it.
I am not sure there is much to be gained from using an elastic net to choose the features for an SVM. The SVM is an approximate implementation of a bound on the generalisation performance, which is independent of the dimensionality of the input space, so with a good choice of C, it should work just fine in a 10,000 dimensional feature space (this is what I have found via practical experience as well).
As a sort of belt-and-braces approach, you could use bootstrapped SVMs, and use the out-of-bag error to estimate performance. If you have a linear SVM, then you can combine all of the bootstrapped SVMs into a single linear model after training, so there is no performance problem in operation. Likewise an average of the elastic net models will probably work pretty well also.
|
How to select the final model with elastic net feature selection, cross validation and SVM?
|
By "for each fold I get a different set of features", I suspect you mean that you are using a k-fold cross-validation procedure to estimte the performance of the model. The thing to remember about cr
|
How to select the final model with elastic net feature selection, cross validation and SVM?
By "for each fold I get a different set of features", I suspect you mean that you are using a k-fold cross-validation procedure to estimte the performance of the model. The thing to remember about cross-validation is that you are estimating the perfomance of a method of constructing a model, not the model itself. So you form the final model, just use the procedure used in each fold of the cross-validation, but using all of the data, rather than (k-1)/k of it.
I am not sure there is much to be gained from using an elastic net to choose the features for an SVM. The SVM is an approximate implementation of a bound on the generalisation performance, which is independent of the dimensionality of the input space, so with a good choice of C, it should work just fine in a 10,000 dimensional feature space (this is what I have found via practical experience as well).
As a sort of belt-and-braces approach, you could use bootstrapped SVMs, and use the out-of-bag error to estimate performance. If you have a linear SVM, then you can combine all of the bootstrapped SVMs into a single linear model after training, so there is no performance problem in operation. Likewise an average of the elastic net models will probably work pretty well also.
|
How to select the final model with elastic net feature selection, cross validation and SVM?
By "for each fold I get a different set of features", I suspect you mean that you are using a k-fold cross-validation procedure to estimte the performance of the model. The thing to remember about cr
|
41,749
|
Invertibility of AR(p) model
|
The answer to your question can be summarized as follows:
Pure MA models are always stationary (since they contain no AR terms).
Pure MA models may or may not be invertible.
Pure AR models are always invertible (since they contain no MA terms).
Pure AR models may or may not be stationary.
|
Invertibility of AR(p) model
|
The answer to your question can be summarized as follows:
Pure MA models are always stationary (since they contain no AR terms).
Pure MA models may or may not be invertible.
Pure AR models are always
|
Invertibility of AR(p) model
The answer to your question can be summarized as follows:
Pure MA models are always stationary (since they contain no AR terms).
Pure MA models may or may not be invertible.
Pure AR models are always invertible (since they contain no MA terms).
Pure AR models may or may not be stationary.
|
Invertibility of AR(p) model
The answer to your question can be summarized as follows:
Pure MA models are always stationary (since they contain no AR terms).
Pure MA models may or may not be invertible.
Pure AR models are always
|
41,750
|
Invertibility of AR(p) model
|
AR processes are always invertible and stationary iff the root of the characteristic polynomial are outside the unit circle.
|
Invertibility of AR(p) model
|
AR processes are always invertible and stationary iff the root of the characteristic polynomial are outside the unit circle.
|
Invertibility of AR(p) model
AR processes are always invertible and stationary iff the root of the characteristic polynomial are outside the unit circle.
|
Invertibility of AR(p) model
AR processes are always invertible and stationary iff the root of the characteristic polynomial are outside the unit circle.
|
41,751
|
Online clustering
|
Within the sofia-ml package there is code for fast k-means clustering based on mini-batches (see paper here). The other thing you can do to speed things up is use Random Projections (see e.g. here and here) - since in k-means all you are interested in is $\ell_2$ distances, and random projections preserve these (up to some $\epsilon$).
|
Online clustering
|
Within the sofia-ml package there is code for fast k-means clustering based on mini-batches (see paper here). The other thing you can do to speed things up is use Random Projections (see e.g. here and
|
Online clustering
Within the sofia-ml package there is code for fast k-means clustering based on mini-batches (see paper here). The other thing you can do to speed things up is use Random Projections (see e.g. here and here) - since in k-means all you are interested in is $\ell_2$ distances, and random projections preserve these (up to some $\epsilon$).
|
Online clustering
Within the sofia-ml package there is code for fast k-means clustering based on mini-batches (see paper here). The other thing you can do to speed things up is use Random Projections (see e.g. here and
|
41,752
|
Online clustering
|
Read the original k-means literature.
The MacQueen publication was based on updating the result by adding single points.
Most people nowerdays seem to use Lloyd iteratation, where you do the typical EM iterations, somewhat a "bulk version" of MacQueen.
|
Online clustering
|
Read the original k-means literature.
The MacQueen publication was based on updating the result by adding single points.
Most people nowerdays seem to use Lloyd iteratation, where you do the typical E
|
Online clustering
Read the original k-means literature.
The MacQueen publication was based on updating the result by adding single points.
Most people nowerdays seem to use Lloyd iteratation, where you do the typical EM iterations, somewhat a "bulk version" of MacQueen.
|
Online clustering
Read the original k-means literature.
The MacQueen publication was based on updating the result by adding single points.
Most people nowerdays seem to use Lloyd iteratation, where you do the typical E
|
41,753
|
Online clustering
|
Consider using Dirichlet Process K-means original paper with implementation on github. The DP means algorithm creates new clusters as more data arrives. It doesn't require a prior knowledge of the number of clusters K. DP means is a Bayesian non-parametric extension of the K-means algorithm based on small variance asymptotics (SVA) approximation of the Dirichlet Process Mixture Model.
|
Online clustering
|
Consider using Dirichlet Process K-means original paper with implementation on github. The DP means algorithm creates new clusters as more data arrives. It doesn't require a prior knowledge of the num
|
Online clustering
Consider using Dirichlet Process K-means original paper with implementation on github. The DP means algorithm creates new clusters as more data arrives. It doesn't require a prior knowledge of the number of clusters K. DP means is a Bayesian non-parametric extension of the K-means algorithm based on small variance asymptotics (SVA) approximation of the Dirichlet Process Mixture Model.
|
Online clustering
Consider using Dirichlet Process K-means original paper with implementation on github. The DP means algorithm creates new clusters as more data arrives. It doesn't require a prior knowledge of the num
|
41,754
|
Using Fractional Polynomials for Logistic Regression Modelling in R
|
The exposition is obscure but the examples and the discussion on p. 101 make the intentions clear.
Recall that the objective (for the situation with a single continuous covariate $x$) is to generalize logistic regression from the case
$$\text{logit}(y) = \beta_0 + \beta_1 x$$
to a relatively simple nonlinear expression of the form
$$\text{logit}(y) = \beta_0 + \beta_1 F_1(x) + \cdots + \beta_J F_J(x).$$
"Fractional polynomials" [sic] are expressions of the form
$$F(x) = x^p (\log(x))^q$$
for suitably chosen powers $p$ and $q$, with $q$ a natural number and $p$ a real number close to $1$. It is intended that if a high power $q$ of the logarithm is included, then all lower powers $q-1, q-2, \ldots, 1, 0$ will also be included. To be practicable and interpretable, H&L suggest restricting the values of $p$ to the set $P$ = $\{-2, -1, -1/2, 0, 1/2, 1, 2, 3\}$ ($0$ corresponds to $\log$, as usual) and $q$ to the set $\{0,1\}$.
When we limit the fractional polynomial to just two terms ($J=2$), the only possibilities according to these rules are of the form
$$F_1(x) = x^{p_1}, F_2(x) = x^{p_2}$$
for $p_1 \ne p_2$ or
$$F_1(x) = x^p, F_2(x) = x^p\log(x).$$
(The case $p=0$ corresponds to using $F_1(x) = \log(x)$ and $F_2(x) = (\log(x))^2$.)
These possibilities can be uniquely determined by a non-decreasing sequence of $J=2$ elements of $P$. The sequence $(p_1,p_2)$ with $p_2 \gt p_1$ specifies the first kind of fractional polynomial and the sequence $(p_1,p_2) = (p,p)$ specifies the second kind. Because $P$ has eight elements, this gives $\binom{8+1}{2} = 36$ possibilities for $J=2$. For instance, your case of $(-1,-1)$ specifies the model
$$\text{logit}(y) = \beta_0 + \beta_1 \frac{1}{x} + \beta_2 \frac{\log(x)}{x}.$$
(H&L go on to recount an approximate procedure in which partial likelihood ratio tests are used to fit the best model with $J=1$ (there are just eight of these) and then the best model with $J=2$ is fit. Each contributes approximately $2J$ degrees of freedom in the resulting chi-squared test.)
Of course, to be really sure of what R is doing, you should either look at the source code, or fit the model and plot the predictions against the data, or both.
|
Using Fractional Polynomials for Logistic Regression Modelling in R
|
The exposition is obscure but the examples and the discussion on p. 101 make the intentions clear.
Recall that the objective (for the situation with a single continuous covariate $x$) is to generalize
|
Using Fractional Polynomials for Logistic Regression Modelling in R
The exposition is obscure but the examples and the discussion on p. 101 make the intentions clear.
Recall that the objective (for the situation with a single continuous covariate $x$) is to generalize logistic regression from the case
$$\text{logit}(y) = \beta_0 + \beta_1 x$$
to a relatively simple nonlinear expression of the form
$$\text{logit}(y) = \beta_0 + \beta_1 F_1(x) + \cdots + \beta_J F_J(x).$$
"Fractional polynomials" [sic] are expressions of the form
$$F(x) = x^p (\log(x))^q$$
for suitably chosen powers $p$ and $q$, with $q$ a natural number and $p$ a real number close to $1$. It is intended that if a high power $q$ of the logarithm is included, then all lower powers $q-1, q-2, \ldots, 1, 0$ will also be included. To be practicable and interpretable, H&L suggest restricting the values of $p$ to the set $P$ = $\{-2, -1, -1/2, 0, 1/2, 1, 2, 3\}$ ($0$ corresponds to $\log$, as usual) and $q$ to the set $\{0,1\}$.
When we limit the fractional polynomial to just two terms ($J=2$), the only possibilities according to these rules are of the form
$$F_1(x) = x^{p_1}, F_2(x) = x^{p_2}$$
for $p_1 \ne p_2$ or
$$F_1(x) = x^p, F_2(x) = x^p\log(x).$$
(The case $p=0$ corresponds to using $F_1(x) = \log(x)$ and $F_2(x) = (\log(x))^2$.)
These possibilities can be uniquely determined by a non-decreasing sequence of $J=2$ elements of $P$. The sequence $(p_1,p_2)$ with $p_2 \gt p_1$ specifies the first kind of fractional polynomial and the sequence $(p_1,p_2) = (p,p)$ specifies the second kind. Because $P$ has eight elements, this gives $\binom{8+1}{2} = 36$ possibilities for $J=2$. For instance, your case of $(-1,-1)$ specifies the model
$$\text{logit}(y) = \beta_0 + \beta_1 \frac{1}{x} + \beta_2 \frac{\log(x)}{x}.$$
(H&L go on to recount an approximate procedure in which partial likelihood ratio tests are used to fit the best model with $J=1$ (there are just eight of these) and then the best model with $J=2$ is fit. Each contributes approximately $2J$ degrees of freedom in the resulting chi-squared test.)
Of course, to be really sure of what R is doing, you should either look at the source code, or fit the model and plot the predictions against the data, or both.
|
Using Fractional Polynomials for Logistic Regression Modelling in R
The exposition is obscure but the examples and the discussion on p. 101 make the intentions clear.
Recall that the objective (for the situation with a single continuous covariate $x$) is to generalize
|
41,755
|
Bounded in probability ($o_{P}$)
|
Adjusting the notation of Wasserman's notes a little bit, I presume that the problem may be restated like this.
You have $Y^{(i)}_1,\dots,Y^{(i)}_n$ independent and identically distributed $Ber(p^{(i)})$, for $i=1,\dots,m$.
Define the estimates $\hat{p}^{(i)}_n=(1/n)\sum_{j=1}^n Y^{(i)}_j$, for $i=1,\dots,m$.
Then, using subadditivity and Hoeffding's inequality, we have
$$
P\left(\max_{1\leq i\leq m} |\hat{p}^{(i)}_n - p^{(i)}| > \epsilon\right) \leq \sum_{i=1}^m P\left(|\hat{p}^{(i)}_n - p^{(i)}| > \epsilon\right) \leq \sum_{i=1}^m 2 e^{-2n\epsilon^2} = 2 m e^{-2n\epsilon^2} = (*) \, .
$$
Now, if the number of coins $m$ is fixed, it is clear that $(*)\to 0$, as $n\to\infty$, and we have the desired result: $\max_{1\leq i\leq m} |\hat{p}^{(i)}_n - p^{(i)}|=o_P(1)$.
But Wasserman seems to do more and allows $m$ to grow with $n$. In this case, as long as $m\leq e^{n^\gamma}$, for $0\leq\gamma<1$, we have $(*) \leq 2\exp(-(2n\epsilon^2-n^\gamma)) \to 0$, as $n\to\infty$, and we have the same conclusion of the former case.
|
Bounded in probability ($o_{P}$)
|
Adjusting the notation of Wasserman's notes a little bit, I presume that the problem may be restated like this.
You have $Y^{(i)}_1,\dots,Y^{(i)}_n$ independent and identically distributed $Ber(p^{(i)
|
Bounded in probability ($o_{P}$)
Adjusting the notation of Wasserman's notes a little bit, I presume that the problem may be restated like this.
You have $Y^{(i)}_1,\dots,Y^{(i)}_n$ independent and identically distributed $Ber(p^{(i)})$, for $i=1,\dots,m$.
Define the estimates $\hat{p}^{(i)}_n=(1/n)\sum_{j=1}^n Y^{(i)}_j$, for $i=1,\dots,m$.
Then, using subadditivity and Hoeffding's inequality, we have
$$
P\left(\max_{1\leq i\leq m} |\hat{p}^{(i)}_n - p^{(i)}| > \epsilon\right) \leq \sum_{i=1}^m P\left(|\hat{p}^{(i)}_n - p^{(i)}| > \epsilon\right) \leq \sum_{i=1}^m 2 e^{-2n\epsilon^2} = 2 m e^{-2n\epsilon^2} = (*) \, .
$$
Now, if the number of coins $m$ is fixed, it is clear that $(*)\to 0$, as $n\to\infty$, and we have the desired result: $\max_{1\leq i\leq m} |\hat{p}^{(i)}_n - p^{(i)}|=o_P(1)$.
But Wasserman seems to do more and allows $m$ to grow with $n$. In this case, as long as $m\leq e^{n^\gamma}$, for $0\leq\gamma<1$, we have $(*) \leq 2\exp(-(2n\epsilon^2-n^\gamma)) \to 0$, as $n\to\infty$, and we have the same conclusion of the former case.
|
Bounded in probability ($o_{P}$)
Adjusting the notation of Wasserman's notes a little bit, I presume that the problem may be restated like this.
You have $Y^{(i)}_1,\dots,Y^{(i)}_n$ independent and identically distributed $Ber(p^{(i)
|
41,756
|
About interpretation of the results of quantile regression
|
You can interpret the results of quantile regression in a very similar way to OLS regression, except that, rather than predicting the mean of the dependent variable, quantile regression looks at the quantiles of the dependent variable. By choosing .5 and .6, you are using the 50th and 60th percentiles.
I wrote about quantile regression on my blog here. I also did a presentation about it, quantile regression using PROC QUANTREG in SAS.
|
About interpretation of the results of quantile regression
|
You can interpret the results of quantile regression in a very similar way to OLS regression, except that, rather than predicting the mean of the dependent variable, quantile regression looks at the q
|
About interpretation of the results of quantile regression
You can interpret the results of quantile regression in a very similar way to OLS regression, except that, rather than predicting the mean of the dependent variable, quantile regression looks at the quantiles of the dependent variable. By choosing .5 and .6, you are using the 50th and 60th percentiles.
I wrote about quantile regression on my blog here. I also did a presentation about it, quantile regression using PROC QUANTREG in SAS.
|
About interpretation of the results of quantile regression
You can interpret the results of quantile regression in a very similar way to OLS regression, except that, rather than predicting the mean of the dependent variable, quantile regression looks at the q
|
41,757
|
About interpretation of the results of quantile regression
|
With OLS you predict a mean value for given xs, with the median regression you predict a median value given the same xs, so if you estimate a regression for the 1st QUARTILE, you get the predicted 1st quartile given the same xs.
|
About interpretation of the results of quantile regression
|
With OLS you predict a mean value for given xs, with the median regression you predict a median value given the same xs, so if you estimate a regression for the 1st QUARTILE, you get the predicted 1st
|
About interpretation of the results of quantile regression
With OLS you predict a mean value for given xs, with the median regression you predict a median value given the same xs, so if you estimate a regression for the 1st QUARTILE, you get the predicted 1st quartile given the same xs.
|
About interpretation of the results of quantile regression
With OLS you predict a mean value for given xs, with the median regression you predict a median value given the same xs, so if you estimate a regression for the 1st QUARTILE, you get the predicted 1st
|
41,758
|
Comparing standard deviations between variables with very different ranges
|
What you're thinking about is the coefficient of variation, SD/mean.
|
Comparing standard deviations between variables with very different ranges
|
What you're thinking about is the coefficient of variation, SD/mean.
|
Comparing standard deviations between variables with very different ranges
What you're thinking about is the coefficient of variation, SD/mean.
|
Comparing standard deviations between variables with very different ranges
What you're thinking about is the coefficient of variation, SD/mean.
|
41,759
|
Which link function for a regression when Y is continuous between 0 and 1?
|
There's nothing wrong per se with using "logistic regression" for this kind of data. You can think of it as an empirical adjustment to allow fitting a response that has a bounded support. It's better than the alternative (logit-transforming your response, then using ordinary linear regression) because the resulting predictions are asymptotically unbiased, the mean predicted value equals the observed mean response, and (probably the most important) you don't have to worry about situations where Y equals 0 or 1. The arcsin transformation can handle Y = 0 or 1, but then your regression results aren't so easily interpretable in terms of log-odds ratios.
The main thing to look out for is that, as with any generalized linear model, you are implicitly assuming a particular relationship between the $E(Y|X)$ and $\textrm{Var}(Y|X)$. You should check that this assumption holds, eg by looking at diagnostic plots of residuals.
For most cases, doing a probit regression will give very similar results to a logistic regression. An alternative is to use the complementary-log-log link if you have reason to believe there is asymmetry between Y = 0 and 1.
|
Which link function for a regression when Y is continuous between 0 and 1?
|
There's nothing wrong per se with using "logistic regression" for this kind of data. You can think of it as an empirical adjustment to allow fitting a response that has a bounded support. It's better
|
Which link function for a regression when Y is continuous between 0 and 1?
There's nothing wrong per se with using "logistic regression" for this kind of data. You can think of it as an empirical adjustment to allow fitting a response that has a bounded support. It's better than the alternative (logit-transforming your response, then using ordinary linear regression) because the resulting predictions are asymptotically unbiased, the mean predicted value equals the observed mean response, and (probably the most important) you don't have to worry about situations where Y equals 0 or 1. The arcsin transformation can handle Y = 0 or 1, but then your regression results aren't so easily interpretable in terms of log-odds ratios.
The main thing to look out for is that, as with any generalized linear model, you are implicitly assuming a particular relationship between the $E(Y|X)$ and $\textrm{Var}(Y|X)$. You should check that this assumption holds, eg by looking at diagnostic plots of residuals.
For most cases, doing a probit regression will give very similar results to a logistic regression. An alternative is to use the complementary-log-log link if you have reason to believe there is asymmetry between Y = 0 and 1.
|
Which link function for a regression when Y is continuous between 0 and 1?
There's nothing wrong per se with using "logistic regression" for this kind of data. You can think of it as an empirical adjustment to allow fitting a response that has a bounded support. It's better
|
41,760
|
Which link function for a regression when Y is continuous between 0 and 1?
|
Link functions convert the expected value of Y (given X) to something that is unbounded. While in logistic regression, Y takes values 0 or 1, the logit isn't applied to Y but to Pr(Y=1|X). (The logit of 0 and 1 are each undefined.) So it's perfectly reasonable to use the logit or the probit in this case.
The other thing to think about is the residual variance: is there a particular transformation that would best stabilize the variance for your case? For proportions, the arcsine square-root transformation is often used, as it is variance-stabilizing for binomial proportions. Consider the discussion here.
|
Which link function for a regression when Y is continuous between 0 and 1?
|
Link functions convert the expected value of Y (given X) to something that is unbounded. While in logistic regression, Y takes values 0 or 1, the logit isn't applied to Y but to Pr(Y=1|X). (The logi
|
Which link function for a regression when Y is continuous between 0 and 1?
Link functions convert the expected value of Y (given X) to something that is unbounded. While in logistic regression, Y takes values 0 or 1, the logit isn't applied to Y but to Pr(Y=1|X). (The logit of 0 and 1 are each undefined.) So it's perfectly reasonable to use the logit or the probit in this case.
The other thing to think about is the residual variance: is there a particular transformation that would best stabilize the variance for your case? For proportions, the arcsine square-root transformation is often used, as it is variance-stabilizing for binomial proportions. Consider the discussion here.
|
Which link function for a regression when Y is continuous between 0 and 1?
Link functions convert the expected value of Y (given X) to something that is unbounded. While in logistic regression, Y takes values 0 or 1, the logit isn't applied to Y but to Pr(Y=1|X). (The logi
|
41,761
|
Finding expectation of reciprocal of sample mean
|
First you find the distribution of the sample mean. The easiest way to do this is to use moment generating function. For exponential distribution, we have
$$m_{X_i}(t)=E\left[\exp\left(tX_i\right)\right]=\left(1-\frac{t}{\theta}\right)^{-1}$$
For sample mean we have
$$m_{\overline{X}}(t)=E\left[\exp\left(t \overline{X}\right)\right]=E\left[\exp\left(tN^{-1}\sum_{i=1}^{N}X_i\right)\right]=E\left[\prod_{i=1}^{N}\exp(tN^{-1}X_{i})\right]$$
Because of independence, we can interchange the product and expectation operations. so we get.
$$m_{\overline{X}}(t)=\prod_{i=1}^{N}E\left[\exp(tN^{-1}X_{i})\right]=\prod_{i=1}^{N}m_{X_i}(tN^{-1})=\left(1-\frac{t}{N\theta}\right)^{-N}$$
This is the moment generating function of a gamma distribution with shape parameter $N$ and inverse scale parameter $N\theta$, which has mean value of $\frac{1}{\theta}$, showing that the MLE is unbiased for the parameter $\beta=\frac{1}{\theta}$.
Now we simply take the expected value of $\frac{1}{\overline{X}}$ where $\overline{X}\sim Gamma(N,N\theta)$, which is given by:
$$E\left(\frac{1}{\overline{X}}\right)=\int_0^{\infty}\frac{1}{\overline{X}}f(\overline{X})d\overline{X}=\int_0^{\infty}\frac{1}{\overline{X}}\frac{(N\theta)^N \overline{X}^{N-1}\exp(-N\theta \overline{X})}{\Gamma(N)}d\overline{X}$$
In the integral, make the change of variables $t=N\theta \overline{X}\implies dt=N\theta d\overline{X}$, and we get
$$E\left(\frac{1}{\overline{X}}\right)=\frac{1}{\Gamma(N)}\int_0^{\infty}\frac{N\theta}{t}t^{N-1}\exp(-t)dt$$
$$=\frac{N\theta}{\Gamma(N)}\int_0^{\infty}t^{N-2}\exp(-t)dt=\frac{N\theta\Gamma(N-1)}{\Gamma(N)}=\frac{N\theta}{N-1}$$
Provided that $N\neq 1$, otherwise the expectation does not exist (and hence niether does the bias). So you have a bias of:
$$E\left(\frac{1}{\overline{X}}-\theta\right)=\frac{\theta}{N-1}$$
|
Finding expectation of reciprocal of sample mean
|
First you find the distribution of the sample mean. The easiest way to do this is to use moment generating function. For exponential distribution, we have
$$m_{X_i}(t)=E\left[\exp\left(tX_i\right)\r
|
Finding expectation of reciprocal of sample mean
First you find the distribution of the sample mean. The easiest way to do this is to use moment generating function. For exponential distribution, we have
$$m_{X_i}(t)=E\left[\exp\left(tX_i\right)\right]=\left(1-\frac{t}{\theta}\right)^{-1}$$
For sample mean we have
$$m_{\overline{X}}(t)=E\left[\exp\left(t \overline{X}\right)\right]=E\left[\exp\left(tN^{-1}\sum_{i=1}^{N}X_i\right)\right]=E\left[\prod_{i=1}^{N}\exp(tN^{-1}X_{i})\right]$$
Because of independence, we can interchange the product and expectation operations. so we get.
$$m_{\overline{X}}(t)=\prod_{i=1}^{N}E\left[\exp(tN^{-1}X_{i})\right]=\prod_{i=1}^{N}m_{X_i}(tN^{-1})=\left(1-\frac{t}{N\theta}\right)^{-N}$$
This is the moment generating function of a gamma distribution with shape parameter $N$ and inverse scale parameter $N\theta$, which has mean value of $\frac{1}{\theta}$, showing that the MLE is unbiased for the parameter $\beta=\frac{1}{\theta}$.
Now we simply take the expected value of $\frac{1}{\overline{X}}$ where $\overline{X}\sim Gamma(N,N\theta)$, which is given by:
$$E\left(\frac{1}{\overline{X}}\right)=\int_0^{\infty}\frac{1}{\overline{X}}f(\overline{X})d\overline{X}=\int_0^{\infty}\frac{1}{\overline{X}}\frac{(N\theta)^N \overline{X}^{N-1}\exp(-N\theta \overline{X})}{\Gamma(N)}d\overline{X}$$
In the integral, make the change of variables $t=N\theta \overline{X}\implies dt=N\theta d\overline{X}$, and we get
$$E\left(\frac{1}{\overline{X}}\right)=\frac{1}{\Gamma(N)}\int_0^{\infty}\frac{N\theta}{t}t^{N-1}\exp(-t)dt$$
$$=\frac{N\theta}{\Gamma(N)}\int_0^{\infty}t^{N-2}\exp(-t)dt=\frac{N\theta\Gamma(N-1)}{\Gamma(N)}=\frac{N\theta}{N-1}$$
Provided that $N\neq 1$, otherwise the expectation does not exist (and hence niether does the bias). So you have a bias of:
$$E\left(\frac{1}{\overline{X}}-\theta\right)=\frac{\theta}{N-1}$$
|
Finding expectation of reciprocal of sample mean
First you find the distribution of the sample mean. The easiest way to do this is to use moment generating function. For exponential distribution, we have
$$m_{X_i}(t)=E\left[\exp\left(tX_i\right)\r
|
41,762
|
Smoothing when standard errors are known/estimated
|
You can account for the differing standard errors using inverse-variance weights. You would weight each observation by the inverse of its variance, i.e. one over the square of its standard error. The simplest case is weighted least squares but similar principles apply to most other types of regression models. There are many possible smoothing methods such as smoothing splines or local polynomials.. the choice depends on what your data looks like, what you want to do with the results and what software you have available. Any method should be able to produce confidence or prediction bands around the fitted curve.
I'm not very familiar with what's available in R; I see the lm function allows a weights argument and the smooth.Pspline function of the pspline package has a w argument. I assume other functions and packages have something similar - perhaps someone else can expand (I'm more familiar with Stata which allows weights in virtually all its regression models).
|
Smoothing when standard errors are known/estimated
|
You can account for the differing standard errors using inverse-variance weights. You would weight each observation by the inverse of its variance, i.e. one over the square of its standard error. The
|
Smoothing when standard errors are known/estimated
You can account for the differing standard errors using inverse-variance weights. You would weight each observation by the inverse of its variance, i.e. one over the square of its standard error. The simplest case is weighted least squares but similar principles apply to most other types of regression models. There are many possible smoothing methods such as smoothing splines or local polynomials.. the choice depends on what your data looks like, what you want to do with the results and what software you have available. Any method should be able to produce confidence or prediction bands around the fitted curve.
I'm not very familiar with what's available in R; I see the lm function allows a weights argument and the smooth.Pspline function of the pspline package has a w argument. I assume other functions and packages have something similar - perhaps someone else can expand (I'm more familiar with Stata which allows weights in virtually all its regression models).
|
Smoothing when standard errors are known/estimated
You can account for the differing standard errors using inverse-variance weights. You would weight each observation by the inverse of its variance, i.e. one over the square of its standard error. The
|
41,763
|
R package for marketing
|
One clarifying question would be: how familiar are you with R already?
To be honest, not buying the macros is probably too risky. Will the teacher expect your assignments to exactly match the results of the macros? Might they even expect you to submit Excel spreadsheets as your answers? Are the techniques used in the macros straight out of your textbook (i.e. you could reproduce them in R) or are you going to have to reverse engineer what the macros do (without having them in hand) to duplicate the results in R? If you need help, will the teacher, teaching assistants, classmates only be able to speak in terms of Excel?
I used R in a machine learning class where the teacher highly recommended Matlab, and I was the only one who used R. (I think one or two folks used Java, maybe one Python.) I'd been working in R for years, though, and was quite confident I could do what needed to be done, even though I could not use the recommended Matlab Toolkits. I did well in the class, but you really have to have your eyes open going in and feel comfortable in R and in finding the right R packages to accomplish what you need to do.
If you buy the macros, you can still try to replicate the results in R. (Check your results against the macros.) That way, you'll be preparing for the future. Your situation is sort of like where the professor requires you to buy their book for the course: sometimes it's easier to pay the ransom than to fight.
|
R package for marketing
|
One clarifying question would be: how familiar are you with R already?
To be honest, not buying the macros is probably too risky. Will the teacher expect your assignments to exactly match the results
|
R package for marketing
One clarifying question would be: how familiar are you with R already?
To be honest, not buying the macros is probably too risky. Will the teacher expect your assignments to exactly match the results of the macros? Might they even expect you to submit Excel spreadsheets as your answers? Are the techniques used in the macros straight out of your textbook (i.e. you could reproduce them in R) or are you going to have to reverse engineer what the macros do (without having them in hand) to duplicate the results in R? If you need help, will the teacher, teaching assistants, classmates only be able to speak in terms of Excel?
I used R in a machine learning class where the teacher highly recommended Matlab, and I was the only one who used R. (I think one or two folks used Java, maybe one Python.) I'd been working in R for years, though, and was quite confident I could do what needed to be done, even though I could not use the recommended Matlab Toolkits. I did well in the class, but you really have to have your eyes open going in and feel comfortable in R and in finding the right R packages to accomplish what you need to do.
If you buy the macros, you can still try to replicate the results in R. (Check your results against the macros.) That way, you'll be preparing for the future. Your situation is sort of like where the professor requires you to buy their book for the course: sometimes it's easier to pay the ransom than to fight.
|
R package for marketing
One clarifying question would be: how familiar are you with R already?
To be honest, not buying the macros is probably too risky. Will the teacher expect your assignments to exactly match the results
|
41,764
|
R package for marketing
|
Take a look at this open source project:
https://github.com/lukaszdz/library
It contains implementations of the most commonly used probability distributions in Marketing. It should cover the sales forecasting and adoption models of the package you mentioned.
|
R package for marketing
|
Take a look at this open source project:
https://github.com/lukaszdz/library
It contains implementations of the most commonly used probability distributions in Marketing. It should cover the sales for
|
R package for marketing
Take a look at this open source project:
https://github.com/lukaszdz/library
It contains implementations of the most commonly used probability distributions in Marketing. It should cover the sales forecasting and adoption models of the package you mentioned.
|
R package for marketing
Take a look at this open source project:
https://github.com/lukaszdz/library
It contains implementations of the most commonly used probability distributions in Marketing. It should cover the sales for
|
41,765
|
R package for marketing
|
The beauty of R is its flexibility - a good place to start with business data is this list of R packages by task http://cran.r-project.org/web/views/ - in particular, you'll find lists for Econometrics, Social Science, Optimization, Time Series (Forecasting) and others. Here is a great case study application of R for campaign forecasting http://www.inside-r.org/howto/direct-marketing-flight-forecasting-system.
|
R package for marketing
|
The beauty of R is its flexibility - a good place to start with business data is this list of R packages by task http://cran.r-project.org/web/views/ - in particular, you'll find lists for Econometric
|
R package for marketing
The beauty of R is its flexibility - a good place to start with business data is this list of R packages by task http://cran.r-project.org/web/views/ - in particular, you'll find lists for Econometrics, Social Science, Optimization, Time Series (Forecasting) and others. Here is a great case study application of R for campaign forecasting http://www.inside-r.org/howto/direct-marketing-flight-forecasting-system.
|
R package for marketing
The beauty of R is its flexibility - a good place to start with business data is this list of R packages by task http://cran.r-project.org/web/views/ - in particular, you'll find lists for Econometric
|
41,766
|
Definition of "degree of interaction" in the MARS model
|
The degree of interaction is the maximum degree of input terms in the regression function. For example a model such as $y=0.5x_1+0.2x_2 -.3$ has degree $1$. While $y=0.5x_1+0.2x_2 + .05x_1x_2-.3$ has degree $2$. For simplicity, I have given a linear regression example instead of MARS.
Or, paraphrasing from the wikipedia entry, something like
$\text{ozone} = 5.2
+ 0.93 \max(0, \mathrm{temp} - 58)
- 0.64 \max(0, \mathrm{temp} - 68)$
$ - 0.016 \max(0, \mathrm{wind} - 7) \max(0, 200 - \text{vis})$
is an example of a MARS model with degree of interaction $2$.
|
Definition of "degree of interaction" in the MARS model
|
The degree of interaction is the maximum degree of input terms in the regression function. For example a model such as $y=0.5x_1+0.2x_2 -.3$ has degree $1$. While $y=0.5x_1+0.2x_2 + .05x_1x_2-.3$ has
|
Definition of "degree of interaction" in the MARS model
The degree of interaction is the maximum degree of input terms in the regression function. For example a model such as $y=0.5x_1+0.2x_2 -.3$ has degree $1$. While $y=0.5x_1+0.2x_2 + .05x_1x_2-.3$ has degree $2$. For simplicity, I have given a linear regression example instead of MARS.
Or, paraphrasing from the wikipedia entry, something like
$\text{ozone} = 5.2
+ 0.93 \max(0, \mathrm{temp} - 58)
- 0.64 \max(0, \mathrm{temp} - 68)$
$ - 0.016 \max(0, \mathrm{wind} - 7) \max(0, 200 - \text{vis})$
is an example of a MARS model with degree of interaction $2$.
|
Definition of "degree of interaction" in the MARS model
The degree of interaction is the maximum degree of input terms in the regression function. For example a model such as $y=0.5x_1+0.2x_2 -.3$ has degree $1$. While $y=0.5x_1+0.2x_2 + .05x_1x_2-.3$ has
|
41,767
|
Example implementation of random forest
|
For implementations, see this Q. However I wouldn't say any of them is easy to follow.
In fact the main issue is the tree building itself. It is usually cluttered code adapted from some other package, the rest of the algorithm is mostly trivial... you may thus try first to write random naive Bayes or some similar algorithm using simpler base classifier.
|
Example implementation of random forest
|
For implementations, see this Q. However I wouldn't say any of them is easy to follow.
In fact the main issue is the tree building itself. It is usually cluttered code adapted from some other packag
|
Example implementation of random forest
For implementations, see this Q. However I wouldn't say any of them is easy to follow.
In fact the main issue is the tree building itself. It is usually cluttered code adapted from some other package, the rest of the algorithm is mostly trivial... you may thus try first to write random naive Bayes or some similar algorithm using simpler base classifier.
|
Example implementation of random forest
For implementations, see this Q. However I wouldn't say any of them is easy to follow.
In fact the main issue is the tree building itself. It is usually cluttered code adapted from some other packag
|
41,768
|
Is there an R optimization package that can handle integer constraints and non-linear objective functions?
|
The most recent issue of The R Journal contains Differential Evolution with DEoptim, which illustrates how to use DEoptim for portfolio optimization.
|
Is there an R optimization package that can handle integer constraints and non-linear objective func
|
The most recent issue of The R Journal contains Differential Evolution with DEoptim, which illustrates how to use DEoptim for portfolio optimization.
|
Is there an R optimization package that can handle integer constraints and non-linear objective functions?
The most recent issue of The R Journal contains Differential Evolution with DEoptim, which illustrates how to use DEoptim for portfolio optimization.
|
Is there an R optimization package that can handle integer constraints and non-linear objective func
The most recent issue of The R Journal contains Differential Evolution with DEoptim, which illustrates how to use DEoptim for portfolio optimization.
|
41,769
|
Is there an R optimization package that can handle integer constraints and non-linear objective functions?
|
If you are willing to pay for it, there is an interface between R and NAG NAGFWrappers
That includes all sort of optimization algorithms, if you know NAG, all chapter E04 is in there.
Obviously you could interface R with NAG writing some C++ code before the package was available, but now it's easier.
|
Is there an R optimization package that can handle integer constraints and non-linear objective func
|
If you are willing to pay for it, there is an interface between R and NAG NAGFWrappers
That includes all sort of optimization algorithms, if you know NAG, all chapter E04 is in there.
Obviously you co
|
Is there an R optimization package that can handle integer constraints and non-linear objective functions?
If you are willing to pay for it, there is an interface between R and NAG NAGFWrappers
That includes all sort of optimization algorithms, if you know NAG, all chapter E04 is in there.
Obviously you could interface R with NAG writing some C++ code before the package was available, but now it's easier.
|
Is there an R optimization package that can handle integer constraints and non-linear objective func
If you are willing to pay for it, there is an interface between R and NAG NAGFWrappers
That includes all sort of optimization algorithms, if you know NAG, all chapter E04 is in there.
Obviously you co
|
41,770
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
A simple approach would be to calculate the sum score or the mean. Another approach would not assume that all variables are of equal importance and we could calculate a weighted mean.
Let's assume we have the following 10 patients and variables v1 to v5.
> set.seed(1)
> df <- data.frame(v1 = sample(1:5, 10, replace = TRUE),
+ v2 = sample(1:5, 10, replace = TRUE),
+ v3 = sample(1:5, 10, replace = TRUE),
+ v4 = sample(1:5, 10, replace = TRUE),
+ v5 = sample(1:5, 10, replace = TRUE))
>
> df
v1 v2 v3 v4 v5
1 2 2 5 3 5
2 2 1 2 3 4
3 3 4 4 3 4
4 5 2 1 1 3
5 2 4 2 5 3
6 5 3 2 4 4
7 5 4 1 4 1
8 4 5 2 1 3
9 4 2 5 4 4
10 1 4 2 3 4
1. Sum score and ranks
> df$sum <- rowSums(df)
> df$ranks <- abs(rank(df$sum) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks
1 2 2 5 3 5 17 4.0
2 2 1 2 3 4 12 9.5
3 3 4 4 3 4 18 2.5
4 5 2 1 1 3 12 9.5
5 2 4 2 5 3 16 5.0
6 5 3 2 4 4 18 2.5
7 5 4 1 4 1 15 6.5
8 4 5 2 1 3 15 6.5
9 4 2 5 4 4 19 1.0
10 1 4 2 3 4 14 8.0
2. Mean score and ranks (note: ranks and ranks2 are equal)
> df$means <- apply(df[, 1:5], 1, mean)
> df$ranks2 <- abs(rank(df$mean) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks means ranks2
1 2 2 5 3 5 17 4.0 3.4 4.0
2 2 1 2 3 4 12 9.5 2.4 9.5
3 3 4 4 3 4 18 2.5 3.6 2.5
4 5 2 1 1 3 12 9.5 2.4 9.5
5 2 4 2 5 3 16 5.0 3.2 5.0
6 5 3 2 4 4 18 2.5 3.6 2.5
7 5 4 1 4 1 15 6.5 3.0 6.5
8 4 5 2 1 3 15 6.5 3.0 6.5
9 4 2 5 4 4 19 1.0 3.8 1.0
10 1 4 2 3 4 14 8.0 2.8 8.0
3. Weighted mean score (i.e. I assume that V3 and V4 are more important than v1, v2 or v5)
> weights <- c(0.5, 0.5, 1, 1, 0.5)
> wmean <- function(x, w = weights){weighted.mean(x, w = w)}
> df$wmeans <- sapply(split(df[, 1:5], 1:10), wmean)
> df$ranks3 <- abs(rank(df$wmeans) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks means ranks2 wmeans ranks3
1 2 2 5 3 5 17 4.0 3.4 4.0 3.571429 2.5
2 2 1 2 3 4 12 9.5 2.4 9.5 2.428571 9.0
3 3 4 4 3 4 18 2.5 3.6 2.5 3.571429 2.5
4 5 2 1 1 3 12 9.5 2.4 9.5 2.000000 10.0
5 2 4 2 5 3 16 5.0 3.2 5.0 3.285714 5.0
6 5 3 2 4 4 18 2.5 3.6 2.5 3.428571 4.0
7 5 4 1 4 1 15 6.5 3.0 6.5 2.857143 6.0
8 4 5 2 1 3 15 6.5 3.0 6.5 2.571429 8.0
9 4 2 5 4 4 19 1.0 3.8 1.0 4.000000 1.0
10 1 4 2 3 4 14 8.0 2.8 8.0 2.714286 7.0
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
A simple approach would be to calculate the sum score or the mean. Another approach would not assume that all variables are of equal importance and we could calculate a weighted mean.
Let's assume we
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
A simple approach would be to calculate the sum score or the mean. Another approach would not assume that all variables are of equal importance and we could calculate a weighted mean.
Let's assume we have the following 10 patients and variables v1 to v5.
> set.seed(1)
> df <- data.frame(v1 = sample(1:5, 10, replace = TRUE),
+ v2 = sample(1:5, 10, replace = TRUE),
+ v3 = sample(1:5, 10, replace = TRUE),
+ v4 = sample(1:5, 10, replace = TRUE),
+ v5 = sample(1:5, 10, replace = TRUE))
>
> df
v1 v2 v3 v4 v5
1 2 2 5 3 5
2 2 1 2 3 4
3 3 4 4 3 4
4 5 2 1 1 3
5 2 4 2 5 3
6 5 3 2 4 4
7 5 4 1 4 1
8 4 5 2 1 3
9 4 2 5 4 4
10 1 4 2 3 4
1. Sum score and ranks
> df$sum <- rowSums(df)
> df$ranks <- abs(rank(df$sum) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks
1 2 2 5 3 5 17 4.0
2 2 1 2 3 4 12 9.5
3 3 4 4 3 4 18 2.5
4 5 2 1 1 3 12 9.5
5 2 4 2 5 3 16 5.0
6 5 3 2 4 4 18 2.5
7 5 4 1 4 1 15 6.5
8 4 5 2 1 3 15 6.5
9 4 2 5 4 4 19 1.0
10 1 4 2 3 4 14 8.0
2. Mean score and ranks (note: ranks and ranks2 are equal)
> df$means <- apply(df[, 1:5], 1, mean)
> df$ranks2 <- abs(rank(df$mean) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks means ranks2
1 2 2 5 3 5 17 4.0 3.4 4.0
2 2 1 2 3 4 12 9.5 2.4 9.5
3 3 4 4 3 4 18 2.5 3.6 2.5
4 5 2 1 1 3 12 9.5 2.4 9.5
5 2 4 2 5 3 16 5.0 3.2 5.0
6 5 3 2 4 4 18 2.5 3.6 2.5
7 5 4 1 4 1 15 6.5 3.0 6.5
8 4 5 2 1 3 15 6.5 3.0 6.5
9 4 2 5 4 4 19 1.0 3.8 1.0
10 1 4 2 3 4 14 8.0 2.8 8.0
3. Weighted mean score (i.e. I assume that V3 and V4 are more important than v1, v2 or v5)
> weights <- c(0.5, 0.5, 1, 1, 0.5)
> wmean <- function(x, w = weights){weighted.mean(x, w = w)}
> df$wmeans <- sapply(split(df[, 1:5], 1:10), wmean)
> df$ranks3 <- abs(rank(df$wmeans) - (dim(df)[1] + 1))
> df
v1 v2 v3 v4 v5 sum ranks means ranks2 wmeans ranks3
1 2 2 5 3 5 17 4.0 3.4 4.0 3.571429 2.5
2 2 1 2 3 4 12 9.5 2.4 9.5 2.428571 9.0
3 3 4 4 3 4 18 2.5 3.6 2.5 3.571429 2.5
4 5 2 1 1 3 12 9.5 2.4 9.5 2.000000 10.0
5 2 4 2 5 3 16 5.0 3.2 5.0 3.285714 5.0
6 5 3 2 4 4 18 2.5 3.6 2.5 3.428571 4.0
7 5 4 1 4 1 15 6.5 3.0 6.5 2.857143 6.0
8 4 5 2 1 3 15 6.5 3.0 6.5 2.571429 8.0
9 4 2 5 4 4 19 1.0 3.8 1.0 4.000000 1.0
10 1 4 2 3 4 14 8.0 2.8 8.0 2.714286 7.0
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
A simple approach would be to calculate the sum score or the mean. Another approach would not assume that all variables are of equal importance and we could calculate a weighted mean.
Let's assume we
|
41,771
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
Any function $f: \mathbb{R}^5 \to \mathbb{R}$ that is separately increasing in each of its arguments will work. For example, you can select positive parameters $\alpha_i$ and any real parameters $\lambda_i$ and rank the data $(x_1, x_2, x_3, x_4, x_5)$ according to the values of
$$\sum_{i=1}^{5} \alpha_i (x_i^{\lambda_i} - 1) / \lambda_i \text{.}$$
Evidently some criterion is needed to select among such a rich set of distinctly different scores. In particular, the simple obvious solutions (frequently employed, unfortunately) of just summing the scores or first "normalizing" them in some fashion and then summing them will suffer from this lack of grounding in reality. To put it another way: any answer that does not derive its support from additional information is a pure fabrication.
Because this problem is essentially the same as Creating an index of quality from multiple variables to enable rank ordering, I refer you to the discussion there for more information.
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
Any function $f: \mathbb{R}^5 \to \mathbb{R}$ that is separately increasing in each of its arguments will work. For example, you can select positive parameters $\alpha_i$ and any real parameters $\la
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
Any function $f: \mathbb{R}^5 \to \mathbb{R}$ that is separately increasing in each of its arguments will work. For example, you can select positive parameters $\alpha_i$ and any real parameters $\lambda_i$ and rank the data $(x_1, x_2, x_3, x_4, x_5)$ according to the values of
$$\sum_{i=1}^{5} \alpha_i (x_i^{\lambda_i} - 1) / \lambda_i \text{.}$$
Evidently some criterion is needed to select among such a rich set of distinctly different scores. In particular, the simple obvious solutions (frequently employed, unfortunately) of just summing the scores or first "normalizing" them in some fashion and then summing them will suffer from this lack of grounding in reality. To put it another way: any answer that does not derive its support from additional information is a pure fabrication.
Because this problem is essentially the same as Creating an index of quality from multiple variables to enable rank ordering, I refer you to the discussion there for more information.
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
Any function $f: \mathbb{R}^5 \to \mathbb{R}$ that is separately increasing in each of its arguments will work. For example, you can select positive parameters $\alpha_i$ and any real parameters $\la
|
41,772
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
I would just simply sum them up, weighting each factor if necessary.
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
I would just simply sum them up, weighting each factor if necessary.
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
I would just simply sum them up, weighting each factor if necessary.
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
I would just simply sum them up, weighting each factor if necessary.
|
41,773
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
How about generating a synthetic binary target variable first and then running a logistic regression model?
The synthetic variable should be something like... "If the observation is in the top decile on all of the input variable distributions flag it as 1 else 0"
Having generated the binary target variable... Run logistic regression to come up with probabilistic metric 0 to 1 assesing how far/close in the tails of multiple distributions observation is?
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
|
How about generating a synthetic binary target variable first and then running a logistic regression model?
The synthetic variable should be something like... "If the observation is in the top decile
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
How about generating a synthetic binary target variable first and then running a logistic regression model?
The synthetic variable should be something like... "If the observation is in the top decile on all of the input variable distributions flag it as 1 else 0"
Having generated the binary target variable... Run logistic regression to come up with probabilistic metric 0 to 1 assesing how far/close in the tails of multiple distributions observation is?
|
Creating an index based on a set of measurements without a target for purpose of rank ordering
How about generating a synthetic binary target variable first and then running a logistic regression model?
The synthetic variable should be something like... "If the observation is in the top decile
|
41,774
|
Factor analysis problem -- singular covariance matrix?
|
Yes, the two errors amount to the same thing. They're telling you (roughly) that two or more of your manifest variables are linearly dependent (like $y_1 = ay_2 + b$ for scalars $a, b$). These two variables (dimensions) would be "redundant", meaning that the sample covariance matrix is not invertible (ie is singular) and therefore not positive definite either.
As for what you ought to do about it, that depends. First I would try to find out which variables are giving you the trouble; a scatterplot matrix might be enough to tell you that. Then you can decide what to do from there - most likely dropping some redundant variables.
|
Factor analysis problem -- singular covariance matrix?
|
Yes, the two errors amount to the same thing. They're telling you (roughly) that two or more of your manifest variables are linearly dependent (like $y_1 = ay_2 + b$ for scalars $a, b$). These two var
|
Factor analysis problem -- singular covariance matrix?
Yes, the two errors amount to the same thing. They're telling you (roughly) that two or more of your manifest variables are linearly dependent (like $y_1 = ay_2 + b$ for scalars $a, b$). These two variables (dimensions) would be "redundant", meaning that the sample covariance matrix is not invertible (ie is singular) and therefore not positive definite either.
As for what you ought to do about it, that depends. First I would try to find out which variables are giving you the trouble; a scatterplot matrix might be enough to tell you that. Then you can decide what to do from there - most likely dropping some redundant variables.
|
Factor analysis problem -- singular covariance matrix?
Yes, the two errors amount to the same thing. They're telling you (roughly) that two or more of your manifest variables are linearly dependent (like $y_1 = ay_2 + b$ for scalars $a, b$). These two var
|
41,775
|
Calculation of power of survival study
|
In the R Hmisc package see the cpower and spower functions. spower does simulations for complex situations (late treatment effect, drop-in, drop-out, etc.) whereas cpower using normal approximations for simpler cases such as yours.
|
Calculation of power of survival study
|
In the R Hmisc package see the cpower and spower functions. spower does simulations for complex situations (late treatment effect, drop-in, drop-out, etc.) whereas cpower using normal approximations
|
Calculation of power of survival study
In the R Hmisc package see the cpower and spower functions. spower does simulations for complex situations (late treatment effect, drop-in, drop-out, etc.) whereas cpower using normal approximations for simpler cases such as yours.
|
Calculation of power of survival study
In the R Hmisc package see the cpower and spower functions. spower does simulations for complex situations (late treatment effect, drop-in, drop-out, etc.) whereas cpower using normal approximations
|
41,776
|
How to shuffle matrix data in R?
|
something like:
nr<-dim(M)[1]
M[sample.int(nr),]
|
How to shuffle matrix data in R?
|
something like:
nr<-dim(M)[1]
M[sample.int(nr),]
|
How to shuffle matrix data in R?
something like:
nr<-dim(M)[1]
M[sample.int(nr),]
|
How to shuffle matrix data in R?
something like:
nr<-dim(M)[1]
M[sample.int(nr),]
|
41,777
|
How to evaluate "external" quality of clustering?
|
I do not perfectly understand what you mean by internal and external quality. I assume that internal refers to a measure computed on the obtained partition while external is the result that you would like to obtain.
Usually, internal measure aims at comparing the within cluster distance compared to the distance between the cluster. Intuitively, if clusters are dense and well separated, then you have a good clustering. As this is the objective of clustering, you cannot really do better, unless you ask people to look at your partitions and say whether or not they are good.
If the resulting clustering does not seems good to you, it is probably that either your points are not correctly placed or your distance is not adapted to your problem. For example, suppose that your expected clusters form long parallel rectangle in your representation. If you use an euclidean distance, you won't be able to find the expected partition.
To solve this problem, if in the resulting partition, you find that their is points in the same cluster that should not belong together, then ask yourself why the chosen distance considered them as close. Then, just build (or read about) a new distance function that avoid this problem.
To sum up, if you find that the computed partition does not make sense, it is not necessarily because your quality measure is wrong, but more likely because the clustering performed the wrong task. Finding a good distance and space representation is probably the main task when doing clustering.
|
How to evaluate "external" quality of clustering?
|
I do not perfectly understand what you mean by internal and external quality. I assume that internal refers to a measure computed on the obtained partition while external is the result that you would
|
How to evaluate "external" quality of clustering?
I do not perfectly understand what you mean by internal and external quality. I assume that internal refers to a measure computed on the obtained partition while external is the result that you would like to obtain.
Usually, internal measure aims at comparing the within cluster distance compared to the distance between the cluster. Intuitively, if clusters are dense and well separated, then you have a good clustering. As this is the objective of clustering, you cannot really do better, unless you ask people to look at your partitions and say whether or not they are good.
If the resulting clustering does not seems good to you, it is probably that either your points are not correctly placed or your distance is not adapted to your problem. For example, suppose that your expected clusters form long parallel rectangle in your representation. If you use an euclidean distance, you won't be able to find the expected partition.
To solve this problem, if in the resulting partition, you find that their is points in the same cluster that should not belong together, then ask yourself why the chosen distance considered them as close. Then, just build (or read about) a new distance function that avoid this problem.
To sum up, if you find that the computed partition does not make sense, it is not necessarily because your quality measure is wrong, but more likely because the clustering performed the wrong task. Finding a good distance and space representation is probably the main task when doing clustering.
|
How to evaluate "external" quality of clustering?
I do not perfectly understand what you mean by internal and external quality. I assume that internal refers to a measure computed on the obtained partition while external is the result that you would
|
41,778
|
How to evaluate "external" quality of clustering?
|
Based on what I understand from your question...
It sounds like you are clustering based on one set of characteristics, but then wanting the clusters to ideally reflect other characteristics that your clustering wasn't based on. The way to fix this is to give everything some thought before estimating any models, and making sure your "internal" charateristics match up with the "external" ones. In other words, if you want sentences that are clustered based on topic, then the crux is to find the distance metric (or whatever) that reflects that. EDIT: This is also basically what Mougel says.
That said, maybe you don't have any ideas on how to do this at the start and want to experiment a bit. The trouble with clustering is that the class labels are unknown...but from your example it seems like a person could look at the individual results and decide if they were happy with the clustering. So you could cluster, then take a manageable random sample of the output and see how well it did for yourself. Extending from this, you could assign class labels at the start and turn this into a classification problem.
Bottom line: I'm not aware of a "statistical" or automated approach to this - this seems like a problem that will be solved with more user input and thoughfulness.
|
How to evaluate "external" quality of clustering?
|
Based on what I understand from your question...
It sounds like you are clustering based on one set of characteristics, but then wanting the clusters to ideally reflect other characteristics that your
|
How to evaluate "external" quality of clustering?
Based on what I understand from your question...
It sounds like you are clustering based on one set of characteristics, but then wanting the clusters to ideally reflect other characteristics that your clustering wasn't based on. The way to fix this is to give everything some thought before estimating any models, and making sure your "internal" charateristics match up with the "external" ones. In other words, if you want sentences that are clustered based on topic, then the crux is to find the distance metric (or whatever) that reflects that. EDIT: This is also basically what Mougel says.
That said, maybe you don't have any ideas on how to do this at the start and want to experiment a bit. The trouble with clustering is that the class labels are unknown...but from your example it seems like a person could look at the individual results and decide if they were happy with the clustering. So you could cluster, then take a manageable random sample of the output and see how well it did for yourself. Extending from this, you could assign class labels at the start and turn this into a classification problem.
Bottom line: I'm not aware of a "statistical" or automated approach to this - this seems like a problem that will be solved with more user input and thoughfulness.
|
How to evaluate "external" quality of clustering?
Based on what I understand from your question...
It sounds like you are clustering based on one set of characteristics, but then wanting the clusters to ideally reflect other characteristics that your
|
41,779
|
How to evaluate "external" quality of clustering?
|
Solving a real problem takes a combination of technique and domain knowledge. You're asking about technique, and you're getting good answers on that front. But you can't really succeed without some defined domain knowledge. Your main task is to elicit, focus, distill, etc, that domain knowledge. Then you'll be able to properly apply a technique.
So you need to help them (whoever it is that's waving their arms and crying "No good, no good!" about your clusters) focus. If you're clustering photos, make or solicit 20 specific examples of good clusters (of say 5 photos each), and 20 specific examples of bad clusters. You can then take the advice of the other answers in this thread and try to align your clustering distance with the answers.*
This is the part of statistics that books and classes really don't cover. It's the consultant side of the coin. But I can't see any way you'll succeed without doing it. (Even if the them is you.)
_* There are also semi-supervised techniques that use some labeled data and mostly unlabeled data, but as a first step you can explore your data with what labels you can elicit and then figure out what metric works best.
|
How to evaluate "external" quality of clustering?
|
Solving a real problem takes a combination of technique and domain knowledge. You're asking about technique, and you're getting good answers on that front. But you can't really succeed without some de
|
How to evaluate "external" quality of clustering?
Solving a real problem takes a combination of technique and domain knowledge. You're asking about technique, and you're getting good answers on that front. But you can't really succeed without some defined domain knowledge. Your main task is to elicit, focus, distill, etc, that domain knowledge. Then you'll be able to properly apply a technique.
So you need to help them (whoever it is that's waving their arms and crying "No good, no good!" about your clusters) focus. If you're clustering photos, make or solicit 20 specific examples of good clusters (of say 5 photos each), and 20 specific examples of bad clusters. You can then take the advice of the other answers in this thread and try to align your clustering distance with the answers.*
This is the part of statistics that books and classes really don't cover. It's the consultant side of the coin. But I can't see any way you'll succeed without doing it. (Even if the them is you.)
_* There are also semi-supervised techniques that use some labeled data and mostly unlabeled data, but as a first step you can explore your data with what labels you can elicit and then figure out what metric works best.
|
How to evaluate "external" quality of clustering?
Solving a real problem takes a combination of technique and domain knowledge. You're asking about technique, and you're getting good answers on that front. But you can't really succeed without some de
|
41,780
|
Reality check using GLM
|
Following Nick Sabbe's answer, here is the simplest GLMM solution I can come up with:
dej$location <- factor(rep(1:25,2))
library(lme4)
glmer(count ~ type1 + type2*species +
perc.for.100m + perc.dry.100m + perc.wet.100m +
(1|location), family = poisson, data = dej)
It would be a good idea to check for overdispersion too.
For your picture, I would try
library(ggplot2)
ggplot(dej,aes(x=type2,y=count))+stat_sum(aes(size=..n..))+
facet_grid(.~species)
mainly for the advantage of stat_sum, which will easily show where you have a lot of overplotting (more simply you could try jittering)
|
Reality check using GLM
|
Following Nick Sabbe's answer, here is the simplest GLMM solution I can come up with:
dej$location <- factor(rep(1:25,2))
library(lme4)
glmer(count ~ type1 + type2*species +
perc.for.100m + perc.d
|
Reality check using GLM
Following Nick Sabbe's answer, here is the simplest GLMM solution I can come up with:
dej$location <- factor(rep(1:25,2))
library(lme4)
glmer(count ~ type1 + type2*species +
perc.for.100m + perc.dry.100m + perc.wet.100m +
(1|location), family = poisson, data = dej)
It would be a good idea to check for overdispersion too.
For your picture, I would try
library(ggplot2)
ggplot(dej,aes(x=type2,y=count))+stat_sum(aes(size=..n..))+
facet_grid(.~species)
mainly for the advantage of stat_sum, which will easily show where you have a lot of overplotting (more simply you could try jittering)
|
Reality check using GLM
Following Nick Sabbe's answer, here is the simplest GLMM solution I can come up with:
dej$location <- factor(rep(1:25,2))
library(lme4)
glmer(count ~ type1 + type2*species +
perc.for.100m + perc.d
|
41,781
|
Reality check using GLM
|
You indicate yourself that your measurements are not independent (you measure both species' abundance from the same locations). As such, you should correct for repeated measurements.
Try lmer from the lme4 package.
|
Reality check using GLM
|
You indicate yourself that your measurements are not independent (you measure both species' abundance from the same locations). As such, you should correct for repeated measurements.
Try lmer from the
|
Reality check using GLM
You indicate yourself that your measurements are not independent (you measure both species' abundance from the same locations). As such, you should correct for repeated measurements.
Try lmer from the lme4 package.
|
Reality check using GLM
You indicate yourself that your measurements are not independent (you measure both species' abundance from the same locations). As such, you should correct for repeated measurements.
Try lmer from the
|
41,782
|
Statistical analysis of competition data
|
Yes. This situation is so complicated and the results are so interdependent that the applicability of almost any standard test has to be called into question.
Why not conduct a permutation test? This is a natural situation for it: the null hypothesis of no treatment effect basically says the labels are meaningless. So, keep all the results but permute the labels, always maintaining a group of 10 "controls" and a group of 12 "treatment" subjects. Compute any ranking or relative score between the groups you deem meaningful for every one of the $\binom{22}{10}$ = 646,646 permutations. (You could randomly sample the permutations to save time, but their number is small enough that this brute-force calculation is easily carried out.) That's the permutation distribution for your statistic under the null hypothesis. To determine the p-value, see where the observed value of the statistic falls on the cumulative distribution.
BTW, if the men were not chosen to compete at random (formally--not arbitarily--using a random number generator), then one could validly suspect any apparent difference might be due to the sequence in which the men competed. No statistical test can overcome such a deficiency if it is present.
|
Statistical analysis of competition data
|
Yes. This situation is so complicated and the results are so interdependent that the applicability of almost any standard test has to be called into question.
Why not conduct a permutation test? Thi
|
Statistical analysis of competition data
Yes. This situation is so complicated and the results are so interdependent that the applicability of almost any standard test has to be called into question.
Why not conduct a permutation test? This is a natural situation for it: the null hypothesis of no treatment effect basically says the labels are meaningless. So, keep all the results but permute the labels, always maintaining a group of 10 "controls" and a group of 12 "treatment" subjects. Compute any ranking or relative score between the groups you deem meaningful for every one of the $\binom{22}{10}$ = 646,646 permutations. (You could randomly sample the permutations to save time, but their number is small enough that this brute-force calculation is easily carried out.) That's the permutation distribution for your statistic under the null hypothesis. To determine the p-value, see where the observed value of the statistic falls on the cumulative distribution.
BTW, if the men were not chosen to compete at random (formally--not arbitarily--using a random number generator), then one could validly suspect any apparent difference might be due to the sequence in which the men competed. No statistical test can overcome such a deficiency if it is present.
|
Statistical analysis of competition data
Yes. This situation is so complicated and the results are so interdependent that the applicability of almost any standard test has to be called into question.
Why not conduct a permutation test? Thi
|
41,783
|
Estimate the nearest of N random points in a box in E^d?
|
First, here are some commonly known facts which will be useful. Suppose i.i.d $X_1, \cdots, X_n$ have the cumulative distribution function $F(X) = P[X \leq x]$, then cumulative distribution function of $\min X_i$ is $G(X) = 1-(1-F(X))^n.$ The expected value of a nonnegative random variable in terms of its cdf is $E[X] = \int_0^\infty G(x) dx$. The median is $G^{-1}(1/2)$.
In this problem, the cdf of the distance from the center is
$$F(r) = P[|X| \leq r] = \frac{vol(B_q(r) \cap E^d)}{vol(E^d)}$$
where $B_q(r) = \{x: |x| \leq q\}$ and $vol(S)$ denotes the volume (Lesbesgue measure) of $S$.
The tricky part is evaluating $vol(B_q(r) \cap E^d)$.
We will deal with the special case that $a_i \geq 0$ for $1 \leq i \leq d$.
The general case follows from subdividing $E^d$ by quadrant.
Since we are working with the $q$-norm, it will be invaluable to do a change of coordinates, letting $y_i = x_i^q$. (Remember that we are assuming that the $x_i$ are nonnegative.) Then we have $\frac{dy_i}{dx_i} = qx_i^{q-1}$, so
$$dx_i = q^{-1} x_i^{1-q}dy_i = (1/q) y_i^{(1-q)/q} dy_i.$$
For notational clarity, we illustrate the calculation for $d=2$, and for general $d$ our methods should extend in the obvious way.
Assuming that $|(a_1, a_2)| \leq r$, we have
$$
vol(B_q(r) \cap E^d) = \int_{a_1}^{\min(b_1, r^q)} \int_{a_2}^{\min(b_2, r^q - y_1)} (1/q) y_2^{(1-q)/q} dy_2 (1/q) y_1^{(1-q)/q} dy_1
$$
$$= (1/q)^2 \int_{a_1}^{\min(b_1, r^q)} \int_{a_2}^{\min(b_2, r^q - y_1)} y_2^{(1-q)/q} dy_2 y_1^{(1-q)/q} dy_1$$
$$=(1/q)^2 \int_{a_1}^{\min(b_1, r^q)} q [\min(b_2, r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
$$=(1/q) \int_{a_1}^{\min(b_1, r^q)} [\min(b_2, r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
We will want to split the preceding integral into the cases when $y_1 > r^q - b_2$ and $y_1 \leq r^q - b_2$. The integral in the first case is
$$(1/q) \int_{a_1}^{r^q - b_2} [(r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
and the integral in the second case is
$$
(1/q) \int_{r^q - b_2}^{\min(b_1, r^q)} [b_2^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1.
$$
The reader is strongly advised to find a Computer Algebra System at this point.
|
Estimate the nearest of N random points in a box in E^d?
|
First, here are some commonly known facts which will be useful. Suppose i.i.d $X_1, \cdots, X_n$ have the cumulative distribution function $F(X) = P[X \leq x]$, then cumulative distribution function
|
Estimate the nearest of N random points in a box in E^d?
First, here are some commonly known facts which will be useful. Suppose i.i.d $X_1, \cdots, X_n$ have the cumulative distribution function $F(X) = P[X \leq x]$, then cumulative distribution function of $\min X_i$ is $G(X) = 1-(1-F(X))^n.$ The expected value of a nonnegative random variable in terms of its cdf is $E[X] = \int_0^\infty G(x) dx$. The median is $G^{-1}(1/2)$.
In this problem, the cdf of the distance from the center is
$$F(r) = P[|X| \leq r] = \frac{vol(B_q(r) \cap E^d)}{vol(E^d)}$$
where $B_q(r) = \{x: |x| \leq q\}$ and $vol(S)$ denotes the volume (Lesbesgue measure) of $S$.
The tricky part is evaluating $vol(B_q(r) \cap E^d)$.
We will deal with the special case that $a_i \geq 0$ for $1 \leq i \leq d$.
The general case follows from subdividing $E^d$ by quadrant.
Since we are working with the $q$-norm, it will be invaluable to do a change of coordinates, letting $y_i = x_i^q$. (Remember that we are assuming that the $x_i$ are nonnegative.) Then we have $\frac{dy_i}{dx_i} = qx_i^{q-1}$, so
$$dx_i = q^{-1} x_i^{1-q}dy_i = (1/q) y_i^{(1-q)/q} dy_i.$$
For notational clarity, we illustrate the calculation for $d=2$, and for general $d$ our methods should extend in the obvious way.
Assuming that $|(a_1, a_2)| \leq r$, we have
$$
vol(B_q(r) \cap E^d) = \int_{a_1}^{\min(b_1, r^q)} \int_{a_2}^{\min(b_2, r^q - y_1)} (1/q) y_2^{(1-q)/q} dy_2 (1/q) y_1^{(1-q)/q} dy_1
$$
$$= (1/q)^2 \int_{a_1}^{\min(b_1, r^q)} \int_{a_2}^{\min(b_2, r^q - y_1)} y_2^{(1-q)/q} dy_2 y_1^{(1-q)/q} dy_1$$
$$=(1/q)^2 \int_{a_1}^{\min(b_1, r^q)} q [\min(b_2, r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
$$=(1/q) \int_{a_1}^{\min(b_1, r^q)} [\min(b_2, r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
We will want to split the preceding integral into the cases when $y_1 > r^q - b_2$ and $y_1 \leq r^q - b_2$. The integral in the first case is
$$(1/q) \int_{a_1}^{r^q - b_2} [(r^q - y_1)^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1$$
and the integral in the second case is
$$
(1/q) \int_{r^q - b_2}^{\min(b_1, r^q)} [b_2^{1/q} - a_2^{1/q}]y_1^{(1-q)/q} dy_1.
$$
The reader is strongly advised to find a Computer Algebra System at this point.
|
Estimate the nearest of N random points in a box in E^d?
First, here are some commonly known facts which will be useful. Suppose i.i.d $X_1, \cdots, X_n$ have the cumulative distribution function $F(X) = P[X \leq x]$, then cumulative distribution function
|
41,784
|
Plotting binomial proportions on a box & whiskers plot using R
|
This really does look to be more appropriate to an [r] tagged question in SO but there seems to be a surprisingly wide degree of tolerance for such questions in CV, so here goes. The answer also assumes you did not really want to use the existing boxplot() function which is what would be used to construct a true box-and-whiskers plot (and which doesn't really use binomial CI's, but rather uses the Tukey defined fivenum() function ). The plotrix and gplots packages both have what appears to be the same plotCI function;
est1 <- binom.test(100,1000) ; est2 <- binom.test(125,1000)
estvals <- rbind( c(est1$estimate, est1$conf.int[1], est1$conf.int[2]),
c(est2$estimate, est2$conf.int[1], est2$conf.int[2]))
plotCI(x = c(1,2), estvals[,1], ui=estvals[,3], li=estvals[,2],
xlim=c(0.5,2.5), ylim=c(0, 0.15) , xaxt="n", xlab="Groups")
The basic function is the arrows() plotting function with an argument that splays the points of the arrows to 90 degrees in both directions.
|
Plotting binomial proportions on a box & whiskers plot using R
|
This really does look to be more appropriate to an [r] tagged question in SO but there seems to be a surprisingly wide degree of tolerance for such questions in CV, so here goes. The answer also assum
|
Plotting binomial proportions on a box & whiskers plot using R
This really does look to be more appropriate to an [r] tagged question in SO but there seems to be a surprisingly wide degree of tolerance for such questions in CV, so here goes. The answer also assumes you did not really want to use the existing boxplot() function which is what would be used to construct a true box-and-whiskers plot (and which doesn't really use binomial CI's, but rather uses the Tukey defined fivenum() function ). The plotrix and gplots packages both have what appears to be the same plotCI function;
est1 <- binom.test(100,1000) ; est2 <- binom.test(125,1000)
estvals <- rbind( c(est1$estimate, est1$conf.int[1], est1$conf.int[2]),
c(est2$estimate, est2$conf.int[1], est2$conf.int[2]))
plotCI(x = c(1,2), estvals[,1], ui=estvals[,3], li=estvals[,2],
xlim=c(0.5,2.5), ylim=c(0, 0.15) , xaxt="n", xlab="Groups")
The basic function is the arrows() plotting function with an argument that splays the points of the arrows to 90 degrees in both directions.
|
Plotting binomial proportions on a box & whiskers plot using R
This really does look to be more appropriate to an [r] tagged question in SO but there seems to be a surprisingly wide degree of tolerance for such questions in CV, so here goes. The answer also assum
|
41,785
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
If I'm not mistaken:
$[1 + \langle x,y\rangle]^2$ = $\langle[1, \sqrt{2}y_1, y_1^2, \sqrt{2}y_2, y_2^2, \sqrt{2}y_1y_2], [1, \sqrt{2}x_1, x_1^2, \sqrt{2}x_2, x_2^2, \sqrt{2}x_1x_2]^T\rangle$
So the separating rule is linear in $R^6$. Consequently, VC-dim is 7.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
If I'm not mistaken:
$[1 + \langle x,y\rangle]^2$ = $\langle[1, \sqrt{2}y_1, y_1^2, \sqrt{2}y_2, y_2^2, \sqrt{2}y_1y_2], [1, \sqrt{2}x_1, x_1^2, \sqrt{2}x_2, x_2^2, \sqrt{2}x_1x_2]^T\rangle$
So the se
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
If I'm not mistaken:
$[1 + \langle x,y\rangle]^2$ = $\langle[1, \sqrt{2}y_1, y_1^2, \sqrt{2}y_2, y_2^2, \sqrt{2}y_1y_2], [1, \sqrt{2}x_1, x_1^2, \sqrt{2}x_2, x_2^2, \sqrt{2}x_1x_2]^T\rangle$
So the separating rule is linear in $R^6$. Consequently, VC-dim is 7.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
If I'm not mistaken:
$[1 + \langle x,y\rangle]^2$ = $\langle[1, \sqrt{2}y_1, y_1^2, \sqrt{2}y_2, y_2^2, \sqrt{2}y_1y_2], [1, \sqrt{2}x_1, x_1^2, \sqrt{2}x_2, x_2^2, \sqrt{2}x_1x_2]^T\rangle$
So the se
|
41,786
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
The answer is 6. See the edits above for details.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
The answer is 6. See the edits above for details.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
The answer is 6. See the edits above for details.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
The answer is 6. See the edits above for details.
|
41,787
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
The VC dimension is the equal to the enumerative combinatorics of the number of monomials for a polynomial of degree $k$ and $n$ variables, thus $\binom{n+k}{k}$. Here we have $k=2$ and $n=2$ thus the VC dimension is $\binom{4}{2}=6$.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
|
The VC dimension is the equal to the enumerative combinatorics of the number of monomials for a polynomial of degree $k$ and $n$ variables, thus $\binom{n+k}{k}$. Here we have $k=2$ and $n=2$ thus the
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
The VC dimension is the equal to the enumerative combinatorics of the number of monomials for a polynomial of degree $k$ and $n$ variables, thus $\binom{n+k}{k}$. Here we have $k=2$ and $n=2$ thus the VC dimension is $\binom{4}{2}=6$.
|
VC dimension of SVM with polynomial kernel in $\mathbb{R^{2}}$
The VC dimension is the equal to the enumerative combinatorics of the number of monomials for a polynomial of degree $k$ and $n$ variables, thus $\binom{n+k}{k}$. Here we have $k=2$ and $n=2$ thus the
|
41,788
|
Why do I get equal AIC, BIC and log likelihood for different models in LME framework?
|
The models are exactly equivalent. In both models you effectively specify one parameter for each combination of levels of Season and Crownlevel - the only difference is the parameterization:
In the first model, you fit main effects for Season and Crownlevel and an interaction effect to capture the combination-specific deviations from the main effects.
In the second model, you specify only the main effect of season, and the interaction effect then captures the deviations for each crownlevel within a season.
H_CE~Season:Crownlevel
would also yield an equivalent model, with one parameter for each combination of season and crownlevel (minus one that is non-identifiable because of the intercept, i.e. constitutes the reference category).
BTW: I don't think your model specification is faulty, which specification is better depends on the inference you want to do with your model.
|
Why do I get equal AIC, BIC and log likelihood for different models in LME framework?
|
The models are exactly equivalent. In both models you effectively specify one parameter for each combination of levels of Season and Crownlevel - the only difference is the parameterization:
In the f
|
Why do I get equal AIC, BIC and log likelihood for different models in LME framework?
The models are exactly equivalent. In both models you effectively specify one parameter for each combination of levels of Season and Crownlevel - the only difference is the parameterization:
In the first model, you fit main effects for Season and Crownlevel and an interaction effect to capture the combination-specific deviations from the main effects.
In the second model, you specify only the main effect of season, and the interaction effect then captures the deviations for each crownlevel within a season.
H_CE~Season:Crownlevel
would also yield an equivalent model, with one parameter for each combination of season and crownlevel (minus one that is non-identifiable because of the intercept, i.e. constitutes the reference category).
BTW: I don't think your model specification is faulty, which specification is better depends on the inference you want to do with your model.
|
Why do I get equal AIC, BIC and log likelihood for different models in LME framework?
The models are exactly equivalent. In both models you effectively specify one parameter for each combination of levels of Season and Crownlevel - the only difference is the parameterization:
In the f
|
41,789
|
When is Generalized Belief Propagation exact?
|
GBP includes the junction tree algorithm as a special case, and since junction tree is exact, GBP will be exact whenever the region graph corresponds to a junction tree. This is the only general case where GBP is exact, as shown by Theorem 14 of Pakzad and Anantharam (Neural Computation, 2005).
|
When is Generalized Belief Propagation exact?
|
GBP includes the junction tree algorithm as a special case, and since junction tree is exact, GBP will be exact whenever the region graph corresponds to a junction tree. This is the only general case
|
When is Generalized Belief Propagation exact?
GBP includes the junction tree algorithm as a special case, and since junction tree is exact, GBP will be exact whenever the region graph corresponds to a junction tree. This is the only general case where GBP is exact, as shown by Theorem 14 of Pakzad and Anantharam (Neural Computation, 2005).
|
When is Generalized Belief Propagation exact?
GBP includes the junction tree algorithm as a special case, and since junction tree is exact, GBP will be exact whenever the region graph corresponds to a junction tree. This is the only general case
|
41,790
|
Estimating the probability of a person getting a question right
|
If I understand your question correctly, you have a set of items (pass-fail) and you want to assess the probability of endorsing the $k$th item given its preceding responses? If that's the case, what is usually done in psychometrics for educational assessment is to rely on Item Response Model, like the Rasch Model. In short, you model the probability of endorsing an item as a function of item difficulty and person ability (the more proficient an individual is, the more likely his response to an easy item will be correct). This assumes that the content you are assessing is unidimensional, and that the items can be ordered by difficulty on that scale. A Guttman model is rarely applicable, so we may allow for some "imperfect" response patterns (e.g., 111011101110000, the 4th and 8th items were failed although the examinee reached the 11th item before giving up), but the sum score is a sufficient statistic for the Rasch Model. Under this approach, you need to have responses from other individuals on the same set of items. To get an idea, look at the LSAT data set and the way it is analysed in the ltm R package.
I have described a psychometrical model, not a purely probabilistic framework for estimating the probability of failing after the $k$th item, with all other items right (this would follow a geometric law).
|
Estimating the probability of a person getting a question right
|
If I understand your question correctly, you have a set of items (pass-fail) and you want to assess the probability of endorsing the $k$th item given its preceding responses? If that's the case, what
|
Estimating the probability of a person getting a question right
If I understand your question correctly, you have a set of items (pass-fail) and you want to assess the probability of endorsing the $k$th item given its preceding responses? If that's the case, what is usually done in psychometrics for educational assessment is to rely on Item Response Model, like the Rasch Model. In short, you model the probability of endorsing an item as a function of item difficulty and person ability (the more proficient an individual is, the more likely his response to an easy item will be correct). This assumes that the content you are assessing is unidimensional, and that the items can be ordered by difficulty on that scale. A Guttman model is rarely applicable, so we may allow for some "imperfect" response patterns (e.g., 111011101110000, the 4th and 8th items were failed although the examinee reached the 11th item before giving up), but the sum score is a sufficient statistic for the Rasch Model. Under this approach, you need to have responses from other individuals on the same set of items. To get an idea, look at the LSAT data set and the way it is analysed in the ltm R package.
I have described a psychometrical model, not a purely probabilistic framework for estimating the probability of failing after the $k$th item, with all other items right (this would follow a geometric law).
|
Estimating the probability of a person getting a question right
If I understand your question correctly, you have a set of items (pass-fail) and you want to assess the probability of endorsing the $k$th item given its preceding responses? If that's the case, what
|
41,791
|
Estimating the probability of a person getting a question right
|
Sounds like a classic data mining task:
Y_i = whether person i gets the question right,
X_i (vector) = set of past performance of person i.
Using a set of past data on n people (i=1,...,n), you can fit a predictive model of the sort Y = function of X.
A variety of models can be used to predict the performance of a new person on this question. If you are short of data, then logistic regression and discriminant analysis would be good choices. If you have data on lots of people, then you could try more data-driven methods such as classification trees, k-nearest neighbors, or neural nets.
|
Estimating the probability of a person getting a question right
|
Sounds like a classic data mining task:
Y_i = whether person i gets the question right,
X_i (vector) = set of past performance of person i.
Using a set of past data on n people (i=1,...,n), you can f
|
Estimating the probability of a person getting a question right
Sounds like a classic data mining task:
Y_i = whether person i gets the question right,
X_i (vector) = set of past performance of person i.
Using a set of past data on n people (i=1,...,n), you can fit a predictive model of the sort Y = function of X.
A variety of models can be used to predict the performance of a new person on this question. If you are short of data, then logistic regression and discriminant analysis would be good choices. If you have data on lots of people, then you could try more data-driven methods such as classification trees, k-nearest neighbors, or neural nets.
|
Estimating the probability of a person getting a question right
Sounds like a classic data mining task:
Y_i = whether person i gets the question right,
X_i (vector) = set of past performance of person i.
Using a set of past data on n people (i=1,...,n), you can f
|
41,792
|
Effect size of McNemar's Test
|
In general, I think best practice for presenting measures of effect size depends on the question of interest and the usual practice in your field. There's little point reporting an effect measure that readers will be unfamiliar with.
Having said that, in this particular case if you want a single effect measure I think the (conditional) odds ratio b / c is the obvious choice. Giving both proportions b / (b + c) and c / (b + c) gives more information and clearly the odds ratio can be derived from these two. I wouldn't call two proportions an 'effect size' though.
I'd strongly encourage you to report all four cells of the 2×2 table concordancy table, however. That way nothing is hidden and anyone can calculate whatever statistics they wish. It's only four numbers, after all.
|
Effect size of McNemar's Test
|
In general, I think best practice for presenting measures of effect size depends on the question of interest and the usual practice in your field. There's little point reporting an effect measure that
|
Effect size of McNemar's Test
In general, I think best practice for presenting measures of effect size depends on the question of interest and the usual practice in your field. There's little point reporting an effect measure that readers will be unfamiliar with.
Having said that, in this particular case if you want a single effect measure I think the (conditional) odds ratio b / c is the obvious choice. Giving both proportions b / (b + c) and c / (b + c) gives more information and clearly the odds ratio can be derived from these two. I wouldn't call two proportions an 'effect size' though.
I'd strongly encourage you to report all four cells of the 2×2 table concordancy table, however. That way nothing is hidden and anyone can calculate whatever statistics they wish. It's only four numbers, after all.
|
Effect size of McNemar's Test
In general, I think best practice for presenting measures of effect size depends on the question of interest and the usual practice in your field. There's little point reporting an effect measure that
|
41,793
|
Finding coefficients for VECM + exogenous variables
|
In Johansen article VECM is specified with dummy variables. If your exogenous variables are strictly exogenous I see no reason why you cannot use original Johansen VECM,
so look in the article how Johansen treats dummies.
R package vars implements Johansen approach, where you can supply the dummies.
|
Finding coefficients for VECM + exogenous variables
|
In Johansen article VECM is specified with dummy variables. If your exogenous variables are strictly exogenous I see no reason why you cannot use original Johansen VECM,
so look in the article how Jo
|
Finding coefficients for VECM + exogenous variables
In Johansen article VECM is specified with dummy variables. If your exogenous variables are strictly exogenous I see no reason why you cannot use original Johansen VECM,
so look in the article how Johansen treats dummies.
R package vars implements Johansen approach, where you can supply the dummies.
|
Finding coefficients for VECM + exogenous variables
In Johansen article VECM is specified with dummy variables. If your exogenous variables are strictly exogenous I see no reason why you cannot use original Johansen VECM,
so look in the article how Jo
|
41,794
|
Regularization and Mean Estimation
|
Sure, it would be equivalent to the following ridge-like optimization problem:
$\underset{\mu\in\mathbb{R}|\mu_0,\lambda\geq0}{\min} ||x_i-\mu-\mu_0||_2+\lambda\mu^2$
For $\lambda=0$, $\mu+\mu_0$ goes to the OLS solution (i.e. $\bar{x}$), for $\lambda=\infty$, it shrinks to $\mu_0$.
|
Regularization and Mean Estimation
|
Sure, it would be equivalent to the following ridge-like optimization problem:
$\underset{\mu\in\mathbb{R}|\mu_0,\lambda\geq0}{\min} ||x_i-\mu-\mu_0||_2+\lambda\mu^2$
For $\lambda=0$, $\mu+\mu_0$ goes
|
Regularization and Mean Estimation
Sure, it would be equivalent to the following ridge-like optimization problem:
$\underset{\mu\in\mathbb{R}|\mu_0,\lambda\geq0}{\min} ||x_i-\mu-\mu_0||_2+\lambda\mu^2$
For $\lambda=0$, $\mu+\mu_0$ goes to the OLS solution (i.e. $\bar{x}$), for $\lambda=\infty$, it shrinks to $\mu_0$.
|
Regularization and Mean Estimation
Sure, it would be equivalent to the following ridge-like optimization problem:
$\underset{\mu\in\mathbb{R}|\mu_0,\lambda\geq0}{\min} ||x_i-\mu-\mu_0||_2+\lambda\mu^2$
For $\lambda=0$, $\mu+\mu_0$ goes
|
41,795
|
Regularization and Mean Estimation
|
Ridge regression (Hoerl and Kennard, 1988) was initially developed to overcome singularities when inverting $X^tX$ (by adding $\lambda$ to its diagonal elements). Thus, the regularization in this case consists in working with a vc matrix $(X^tX-\lambda I)^{-1}$. This L2 penalization leads to "better" predictions than with usual OLS by optimizing the compromise between bias and variance (shrinkage), but it suffers from considering all coefficients in the model. The regression coefficients are found to be
$$
\hat\beta=\underset{\beta}{\operatorname{argmin}}\|Y-X\beta\|^2 + \lambda\|\beta\|^2
$$
with $\vert\vert\beta\vert\vert^2 = \sum_{j=1}^p\beta_j^2$ (L2-norm).
From a bayesian perspective, you can consider that the $\beta$'s must be small and plug them into a prior distribution. The likelihood $\ell (y,X,\hat\beta,\sigma^2)$ can thus be weighted by the prior probability for $\hat\beta$ (assumed i.i.d. with zero mean and variance $\tau^2$), and the posterior is found to be
$$
f(\beta|y,X,\sigma^2,\tau^2)=(y-\hat\beta^tX)^t(y-\hat\beta^tX)+\frac{\sigma^2}{\tau^2}\hat\beta^t\hat\beta
$$
where $\sigma^2$ is the variance of your $y$'s. It follows that this density is the opposite of the residual sum of squares that is to be minimized in the Ridge framework, after setting $\lambda=\sigma^2/\tau^2$.
The bayesian estimator for $\hat\beta$ is thus the same as the OLS one when considering the Ridge loss function with a prior variance $\tau^2$. More details can be found in The Elements of Statistical Learning from Hastie, Tibshirani, and Friedman (§3.4.3, p.60 in the 1st ed.). The second edition is also available for free.
|
Regularization and Mean Estimation
|
Ridge regression (Hoerl and Kennard, 1988) was initially developed to overcome singularities when inverting $X^tX$ (by adding $\lambda$ to its diagonal elements). Thus, the regularization in this case
|
Regularization and Mean Estimation
Ridge regression (Hoerl and Kennard, 1988) was initially developed to overcome singularities when inverting $X^tX$ (by adding $\lambda$ to its diagonal elements). Thus, the regularization in this case consists in working with a vc matrix $(X^tX-\lambda I)^{-1}$. This L2 penalization leads to "better" predictions than with usual OLS by optimizing the compromise between bias and variance (shrinkage), but it suffers from considering all coefficients in the model. The regression coefficients are found to be
$$
\hat\beta=\underset{\beta}{\operatorname{argmin}}\|Y-X\beta\|^2 + \lambda\|\beta\|^2
$$
with $\vert\vert\beta\vert\vert^2 = \sum_{j=1}^p\beta_j^2$ (L2-norm).
From a bayesian perspective, you can consider that the $\beta$'s must be small and plug them into a prior distribution. The likelihood $\ell (y,X,\hat\beta,\sigma^2)$ can thus be weighted by the prior probability for $\hat\beta$ (assumed i.i.d. with zero mean and variance $\tau^2$), and the posterior is found to be
$$
f(\beta|y,X,\sigma^2,\tau^2)=(y-\hat\beta^tX)^t(y-\hat\beta^tX)+\frac{\sigma^2}{\tau^2}\hat\beta^t\hat\beta
$$
where $\sigma^2$ is the variance of your $y$'s. It follows that this density is the opposite of the residual sum of squares that is to be minimized in the Ridge framework, after setting $\lambda=\sigma^2/\tau^2$.
The bayesian estimator for $\hat\beta$ is thus the same as the OLS one when considering the Ridge loss function with a prior variance $\tau^2$. More details can be found in The Elements of Statistical Learning from Hastie, Tibshirani, and Friedman (§3.4.3, p.60 in the 1st ed.). The second edition is also available for free.
|
Regularization and Mean Estimation
Ridge regression (Hoerl and Kennard, 1988) was initially developed to overcome singularities when inverting $X^tX$ (by adding $\lambda$ to its diagonal elements). Thus, the regularization in this case
|
41,796
|
Visualizing activity frequency
|
You might be trying to incorporate too much information into the graphic. The essence of the visualization seems to be the frequency with which units are active more than one day and, possibly, the times at which those units are active.
Just to generate ideas--because there are many possible solutions--consider a display that provides a clear graphical distinction between the longer-term units and the shorter-term ones and allows assessments of the frequencies with which these occur. One simple solution is a scatterplot where the contiguous activity of a unit between times $x$ and $x + y$ is indicated by a point at $(x,y)$. Modify one salient characteristic of the point, such as its color, to emphasize the distinction between $y \ge 1$ and $y \lt 1$.
Here is a crude illustration: the first plots units on the vertical axis (200 of them), time on the horizontal (75 days; it needs a grid to show the units of time), and unit activities on a gray scale where darker corresponds to longer continuous activity. The second shows similar data as a scatterplot. The latter could be accompanied by a histogram of frequencies. The former ought to have the units sorted vertically by their average length in service.
|
Visualizing activity frequency
|
You might be trying to incorporate too much information into the graphic. The essence of the visualization seems to be the frequency with which units are active more than one day and, possibly, the t
|
Visualizing activity frequency
You might be trying to incorporate too much information into the graphic. The essence of the visualization seems to be the frequency with which units are active more than one day and, possibly, the times at which those units are active.
Just to generate ideas--because there are many possible solutions--consider a display that provides a clear graphical distinction between the longer-term units and the shorter-term ones and allows assessments of the frequencies with which these occur. One simple solution is a scatterplot where the contiguous activity of a unit between times $x$ and $x + y$ is indicated by a point at $(x,y)$. Modify one salient characteristic of the point, such as its color, to emphasize the distinction between $y \ge 1$ and $y \lt 1$.
Here is a crude illustration: the first plots units on the vertical axis (200 of them), time on the horizontal (75 days; it needs a grid to show the units of time), and unit activities on a gray scale where darker corresponds to longer continuous activity. The second shows similar data as a scatterplot. The latter could be accompanied by a histogram of frequencies. The former ought to have the units sorted vertically by their average length in service.
|
Visualizing activity frequency
You might be trying to incorporate too much information into the graphic. The essence of the visualization seems to be the frequency with which units are active more than one day and, possibly, the t
|
41,797
|
Visualizing activity frequency
|
How about creating small timelines for each unit, one on top of the other, sorted in order of most to least active? Think sparklines
You could probably do something like highlight the inactive time as either a shaded portion of the chart, or a colored portion of the unit's timeline.
Since each unit would have a small plot, you'd be able to see an individual's activity at a given time. And sorting them by activity would show how poorly some units are performing, as the plots get flatter (and/or more full of your inactivity indicator) as you go down the graphic.
I don't have any great ideas on what software to create this with. You might be able to do it with Lattice in R.
|
Visualizing activity frequency
|
How about creating small timelines for each unit, one on top of the other, sorted in order of most to least active? Think sparklines
You could probably do something like highlight the inactive time a
|
Visualizing activity frequency
How about creating small timelines for each unit, one on top of the other, sorted in order of most to least active? Think sparklines
You could probably do something like highlight the inactive time as either a shaded portion of the chart, or a colored portion of the unit's timeline.
Since each unit would have a small plot, you'd be able to see an individual's activity at a given time. And sorting them by activity would show how poorly some units are performing, as the plots get flatter (and/or more full of your inactivity indicator) as you go down the graphic.
I don't have any great ideas on what software to create this with. You might be able to do it with Lattice in R.
|
Visualizing activity frequency
How about creating small timelines for each unit, one on top of the other, sorted in order of most to least active? Think sparklines
You could probably do something like highlight the inactive time a
|
41,798
|
All-Purpose Sample Entropy
|
Entropy is entropy with respect to a measure
As noticed in the answer to this question https://mathoverflow.net/questions/33088/entropy-of-a-general-prob-measure/33090#33090 , entropy is only defined with respect to a given measure. For example discrete entropy is entropy with respect to counting measure.
Sample entropy should be an estimate of a predefined entropy.
I think the idea of sample entropy can be generalised to any type of entropy but you need to know which entropy you are trying to estimate before estimating it.
Example of entropy with respect to counting+lebesgues
For example, if you are trying to estimate the entropy with respect to the sum of the lebesgues measure on $[0,1]$ and the counting measure on $\{0,1\}$ a good estimate certainly (my intuition) is a sum of the two estimates you mention in your question (with $i=0,1$ in the first sum).
|
All-Purpose Sample Entropy
|
Entropy is entropy with respect to a measure
As noticed in the answer to this question https://mathoverflow.net/questions/33088/entropy-of-a-general-prob-measure/33090#33090 , entropy is only defined
|
All-Purpose Sample Entropy
Entropy is entropy with respect to a measure
As noticed in the answer to this question https://mathoverflow.net/questions/33088/entropy-of-a-general-prob-measure/33090#33090 , entropy is only defined with respect to a given measure. For example discrete entropy is entropy with respect to counting measure.
Sample entropy should be an estimate of a predefined entropy.
I think the idea of sample entropy can be generalised to any type of entropy but you need to know which entropy you are trying to estimate before estimating it.
Example of entropy with respect to counting+lebesgues
For example, if you are trying to estimate the entropy with respect to the sum of the lebesgues measure on $[0,1]$ and the counting measure on $\{0,1\}$ a good estimate certainly (my intuition) is a sum of the two estimates you mention in your question (with $i=0,1$ in the first sum).
|
All-Purpose Sample Entropy
Entropy is entropy with respect to a measure
As noticed in the answer to this question https://mathoverflow.net/questions/33088/entropy-of-a-general-prob-measure/33090#33090 , entropy is only defined
|
41,799
|
Significant Difference between two network graphs
|
I agree with Srikant, you need to model your process. You mentioned that you had already created some networks in R, what model did you assume?
The way I would tackle this problem, is to form a mathematical model, say an ODE model. For example,
\begin{equation}
\frac{dX_i(t)}{dt} = \lambda X_{i-1}(t) -\mu X_{i+1}(t)
\end{equation}
where $X_i$ depends on the population at geographic unit $i$. Since you are interested in differences in time, your parameters $\lambda$ may also depend on $t$.
You can fit both models simultaneously and determine if the rates are different.
You problem isn't easy and I don't think there's an simple solution to it.
|
Significant Difference between two network graphs
|
I agree with Srikant, you need to model your process. You mentioned that you had already created some networks in R, what model did you assume?
The way I would tackle this problem, is to form a mathem
|
Significant Difference between two network graphs
I agree with Srikant, you need to model your process. You mentioned that you had already created some networks in R, what model did you assume?
The way I would tackle this problem, is to form a mathematical model, say an ODE model. For example,
\begin{equation}
\frac{dX_i(t)}{dt} = \lambda X_{i-1}(t) -\mu X_{i+1}(t)
\end{equation}
where $X_i$ depends on the population at geographic unit $i$. Since you are interested in differences in time, your parameters $\lambda$ may also depend on $t$.
You can fit both models simultaneously and determine if the rates are different.
You problem isn't easy and I don't think there's an simple solution to it.
|
Significant Difference between two network graphs
I agree with Srikant, you need to model your process. You mentioned that you had already created some networks in R, what model did you assume?
The way I would tackle this problem, is to form a mathem
|
41,800
|
Significant Difference between two network graphs
|
I am not sure I will be able to provide a complete answer but here is how I would start.
Step 1: Model the data generating process for the flows through the network
For example, you may want to model the flows from one point to another point in the network as a poisson distribution. The poission distribution is used to model arrivals in a system over time and thus may work well for network flows. Depending on network complexity and your needs you can model each path such that the arrival rate for each path is either different or the same (See the $\lambda$ parameter for the poisson distribution.)
Step 2: Identify a testing strategy which would let you ascertain the strength of evidence for your null model.
The challenge in this step is two-fold. First, you have to define what you mean when you say that the network flows in a network at different times is the same. Are you talking about throughput? or Are you talking about the flows across each one of the paths?
The second challenge is that once you have solved the above issue, you need to find out a way to test your null hypothesis.
As an example: Suppose you want to check that the flows across each path are the same and that your are modeling the path flows for the network by a single parameter (i.e., $\lambda$ is identical for all paths). Thus, your null hypothesis would assume that $\lambda$ does not change with time. This how you would go about testing your null hypothesis:
Null Hypothesis is True
Pool all network flows across time and estimate a common $\lambda$ using maximum likelihood estimation for the poisson distribution.
Null Hypothesis is not true
Estimate $\lambda$ for each time period separately so that you get two different values (one for each one of the time periods).
You can then select the model (pooled or separate) that fits the data better on the basis of a criteria such as the likelihood ratio.
|
Significant Difference between two network graphs
|
I am not sure I will be able to provide a complete answer but here is how I would start.
Step 1: Model the data generating process for the flows through the network
For example, you may want to model
|
Significant Difference between two network graphs
I am not sure I will be able to provide a complete answer but here is how I would start.
Step 1: Model the data generating process for the flows through the network
For example, you may want to model the flows from one point to another point in the network as a poisson distribution. The poission distribution is used to model arrivals in a system over time and thus may work well for network flows. Depending on network complexity and your needs you can model each path such that the arrival rate for each path is either different or the same (See the $\lambda$ parameter for the poisson distribution.)
Step 2: Identify a testing strategy which would let you ascertain the strength of evidence for your null model.
The challenge in this step is two-fold. First, you have to define what you mean when you say that the network flows in a network at different times is the same. Are you talking about throughput? or Are you talking about the flows across each one of the paths?
The second challenge is that once you have solved the above issue, you need to find out a way to test your null hypothesis.
As an example: Suppose you want to check that the flows across each path are the same and that your are modeling the path flows for the network by a single parameter (i.e., $\lambda$ is identical for all paths). Thus, your null hypothesis would assume that $\lambda$ does not change with time. This how you would go about testing your null hypothesis:
Null Hypothesis is True
Pool all network flows across time and estimate a common $\lambda$ using maximum likelihood estimation for the poisson distribution.
Null Hypothesis is not true
Estimate $\lambda$ for each time period separately so that you get two different values (one for each one of the time periods).
You can then select the model (pooled or separate) that fits the data better on the basis of a criteria such as the likelihood ratio.
|
Significant Difference between two network graphs
I am not sure I will be able to provide a complete answer but here is how I would start.
Step 1: Model the data generating process for the flows through the network
For example, you may want to model
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.