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
24,901
Predicting cluster of a new object with kmeans in R [closed]
Check this complete answer. The code you need is: clusters <- function(x, centers) { # compute squared euclidean distance from each sample to each cluster center tmp <- sapply(seq_len(nrow(x)), function(i) apply(centers, 1, function(v) sum((x[i, ]-v)^2))) max.col(-t(tmp)) # find index of min distance } # create a simple data set with two clusters set.seed(1) x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) colnames(x) <- c("x", "y") x_new <- rbind(matrix(rnorm(10, sd = 0.3), ncol = 2), matrix(rnorm(10, mean = 1, sd = 0.3), ncol = 2)) colnames(x_new) <- c("x", "y") cl <- kmeans(x, centers=2) all.equal(cl[["cluster"]], clusters(x, cl[["centers"]])) # [1] TRUE clusters(x_new, cl[["centers"]]) # [1] 2 2 2 2 2 1 1 1 1 1
Predicting cluster of a new object with kmeans in R [closed]
Check this complete answer. The code you need is: clusters <- function(x, centers) { # compute squared euclidean distance from each sample to each cluster center tmp <- sapply(seq_len(nrow(x)),
Predicting cluster of a new object with kmeans in R [closed] Check this complete answer. The code you need is: clusters <- function(x, centers) { # compute squared euclidean distance from each sample to each cluster center tmp <- sapply(seq_len(nrow(x)), function(i) apply(centers, 1, function(v) sum((x[i, ]-v)^2))) max.col(-t(tmp)) # find index of min distance } # create a simple data set with two clusters set.seed(1) x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) colnames(x) <- c("x", "y") x_new <- rbind(matrix(rnorm(10, sd = 0.3), ncol = 2), matrix(rnorm(10, mean = 1, sd = 0.3), ncol = 2)) colnames(x_new) <- c("x", "y") cl <- kmeans(x, centers=2) all.equal(cl[["cluster"]], clusters(x, cl[["centers"]])) # [1] TRUE clusters(x_new, cl[["centers"]]) # [1] 2 2 2 2 2 1 1 1 1 1
Predicting cluster of a new object with kmeans in R [closed] Check this complete answer. The code you need is: clusters <- function(x, centers) { # compute squared euclidean distance from each sample to each cluster center tmp <- sapply(seq_len(nrow(x)),
24,902
Predicting cluster of a new object with kmeans in R [closed]
Another option is to use the predict method from flexclust package after converting your stats::kmeans model to his kcca type.
Predicting cluster of a new object with kmeans in R [closed]
Another option is to use the predict method from flexclust package after converting your stats::kmeans model to his kcca type.
Predicting cluster of a new object with kmeans in R [closed] Another option is to use the predict method from flexclust package after converting your stats::kmeans model to his kcca type.
Predicting cluster of a new object with kmeans in R [closed] Another option is to use the predict method from flexclust package after converting your stats::kmeans model to his kcca type.
24,903
Predicting cluster of a new object with kmeans in R [closed]
You could write an S3 method to predict the classes for a new dataset. The following minimises the sum-of-squares. It is used as for other predict functions: newdata should match the structure of your input to kmeans, and the method argument should work as for fitted.kmeans predict.kmeans <- function(object, newdata, method = c("centers", "classes")) { method <- match.arg(method) centers <- object$centers ss_by_center <- apply(centers, 1, function(x) { colSums((t(newdata) - x) ^ 2) }) best_clusters <- apply(ss_by_center, 1, which.min) if (method == "centers") { centers[best_clusters, ] } else { best_clusters } } I wish there was a predict.kmeans in the existing stats namespace.
Predicting cluster of a new object with kmeans in R [closed]
You could write an S3 method to predict the classes for a new dataset. The following minimises the sum-of-squares. It is used as for other predict functions: newdata should match the structure of your
Predicting cluster of a new object with kmeans in R [closed] You could write an S3 method to predict the classes for a new dataset. The following minimises the sum-of-squares. It is used as for other predict functions: newdata should match the structure of your input to kmeans, and the method argument should work as for fitted.kmeans predict.kmeans <- function(object, newdata, method = c("centers", "classes")) { method <- match.arg(method) centers <- object$centers ss_by_center <- apply(centers, 1, function(x) { colSums((t(newdata) - x) ^ 2) }) best_clusters <- apply(ss_by_center, 1, which.min) if (method == "centers") { centers[best_clusters, ] } else { best_clusters } } I wish there was a predict.kmeans in the existing stats namespace.
Predicting cluster of a new object with kmeans in R [closed] You could write an S3 method to predict the classes for a new dataset. The following minimises the sum-of-squares. It is used as for other predict functions: newdata should match the structure of your
24,904
What is a consistency check?
To chl's list, which focuses on frank data processing errors, I would add checks for subtler errors to address the following questions and issues (given in no particular order and certainly incomplete): Assuming database integrity, are the data reasonable? Do they roughly conform with expectations or conventional models, or would they surprise someone familiar with similar data? Are the data internally consistent? For example, if one field is supposed to be the sum of two others, is it? How complete are the data? Are they what were specified during the data collection planning phase? Are there any extra data that were not planned for? If so, why are they there? Most analyses implicitly or explicitly model the data in a parsimonious way and include the possibility of variation from the general description. Each such model suggests its own particular way to identify outliers--the data that deviate remarkably from the general description. Were attempts made to identify and understand outliers at each stage of exploration and analysis? In many cases it is possible for the analyst to introduce additional data into the analysis for quality checking and insight. For example, many data sets in the natural and social sciences as well as business include (at least implicitly) location information: identifiers of Census regions; names of countries, states, counties; customer zip codes; and so on. Even if--perhaps especially if--spatial correlation is not an element of the EDA or modeling, the analyst can join the data to geographic representations of the locations and map them to look for patterns and outliers. One of the most insidious errors that can creep into an analysis is loss of data. When extracting fields, summarizing data, reformatting datasets, etc., if one or two items are dropped from a large dataset often there will be nothing to flag it. But occasionally something important is lost, to one's extreme embarrassment if it is ever discovered. Simple checks--such as comparing before and after counts and totals of data--need to occur routinely to guard against such things. Another insidious error is associated with type conversion in digital computing. For example, recently I had to construct a key (for matching two data files) out of a floating point field. The software (Stata) imported the field as a single precision float in one file but, for whatever reason, as a double precision float in another file. Most of the time the values matched but, in a few cases due to different rounding, they did not. Some data were lost as a result. I caught this only due to the application of (6). In general, it pays to check for consistency of field data types: ints vs. floats, lengths of strings, etc. If a spreadsheet is ever used at any stage of analysis, expect the worst. The problem is that even a stray keystroke can invisibly corrupt the data. When the results are critical, it pays to keep going back and forth--export to the spreadsheet, do the analysis, import back, and systematically compare--to make sure nothing untoward happened. Whenever a database is updated, it is worthwhile to pause and perform systematic, complete comparisons with the old one to make sure nothing was lost, changed, or corrupted in the process. At a higher level, whenever an estimate is performed (such as a regression, PCA, whatever), it can be worthwhile to perform it using a different technique to check for sensitivities or even possible errors in the code. E.g., follow an OLS regression by some form of robust regression and compare the coefficients. For important results, it can be comforting to obtain the answers using two (or more) different software platforms. Perhaps the best kind of general "consistency check" anyone can perform is to graph everything, early and often.
What is a consistency check?
To chl's list, which focuses on frank data processing errors, I would add checks for subtler errors to address the following questions and issues (given in no particular order and certainly incomplete
What is a consistency check? To chl's list, which focuses on frank data processing errors, I would add checks for subtler errors to address the following questions and issues (given in no particular order and certainly incomplete): Assuming database integrity, are the data reasonable? Do they roughly conform with expectations or conventional models, or would they surprise someone familiar with similar data? Are the data internally consistent? For example, if one field is supposed to be the sum of two others, is it? How complete are the data? Are they what were specified during the data collection planning phase? Are there any extra data that were not planned for? If so, why are they there? Most analyses implicitly or explicitly model the data in a parsimonious way and include the possibility of variation from the general description. Each such model suggests its own particular way to identify outliers--the data that deviate remarkably from the general description. Were attempts made to identify and understand outliers at each stage of exploration and analysis? In many cases it is possible for the analyst to introduce additional data into the analysis for quality checking and insight. For example, many data sets in the natural and social sciences as well as business include (at least implicitly) location information: identifiers of Census regions; names of countries, states, counties; customer zip codes; and so on. Even if--perhaps especially if--spatial correlation is not an element of the EDA or modeling, the analyst can join the data to geographic representations of the locations and map them to look for patterns and outliers. One of the most insidious errors that can creep into an analysis is loss of data. When extracting fields, summarizing data, reformatting datasets, etc., if one or two items are dropped from a large dataset often there will be nothing to flag it. But occasionally something important is lost, to one's extreme embarrassment if it is ever discovered. Simple checks--such as comparing before and after counts and totals of data--need to occur routinely to guard against such things. Another insidious error is associated with type conversion in digital computing. For example, recently I had to construct a key (for matching two data files) out of a floating point field. The software (Stata) imported the field as a single precision float in one file but, for whatever reason, as a double precision float in another file. Most of the time the values matched but, in a few cases due to different rounding, they did not. Some data were lost as a result. I caught this only due to the application of (6). In general, it pays to check for consistency of field data types: ints vs. floats, lengths of strings, etc. If a spreadsheet is ever used at any stage of analysis, expect the worst. The problem is that even a stray keystroke can invisibly corrupt the data. When the results are critical, it pays to keep going back and forth--export to the spreadsheet, do the analysis, import back, and systematically compare--to make sure nothing untoward happened. Whenever a database is updated, it is worthwhile to pause and perform systematic, complete comparisons with the old one to make sure nothing was lost, changed, or corrupted in the process. At a higher level, whenever an estimate is performed (such as a regression, PCA, whatever), it can be worthwhile to perform it using a different technique to check for sensitivities or even possible errors in the code. E.g., follow an OLS regression by some form of robust regression and compare the coefficients. For important results, it can be comforting to obtain the answers using two (or more) different software platforms. Perhaps the best kind of general "consistency check" anyone can perform is to graph everything, early and often.
What is a consistency check? To chl's list, which focuses on frank data processing errors, I would add checks for subtler errors to address the following questions and issues (given in no particular order and certainly incomplete
24,905
What is a consistency check?
I suppose this has to do with some form of Quality Control about data integrity, and more specifically that you regularly check that your working database isn't corrupted (due to error during transfer, copy, or after an update or a sanity check). This may also mean ensuring that your intermediate computation are double-checked (either manually or through additional code or macros in your statistical software). Other information may be found here: the ICH E6 (R1) reference guide about Guideline for Good Clinical Practice from the EMEA, Guidelines on Good Clinical Laboratory Practice, or Clinical Research Study Investigator's Toolbox.
What is a consistency check?
I suppose this has to do with some form of Quality Control about data integrity, and more specifically that you regularly check that your working database isn't corrupted (due to error during transfer
What is a consistency check? I suppose this has to do with some form of Quality Control about data integrity, and more specifically that you regularly check that your working database isn't corrupted (due to error during transfer, copy, or after an update or a sanity check). This may also mean ensuring that your intermediate computation are double-checked (either manually or through additional code or macros in your statistical software). Other information may be found here: the ICH E6 (R1) reference guide about Guideline for Good Clinical Practice from the EMEA, Guidelines on Good Clinical Laboratory Practice, or Clinical Research Study Investigator's Toolbox.
What is a consistency check? I suppose this has to do with some form of Quality Control about data integrity, and more specifically that you regularly check that your working database isn't corrupted (due to error during transfer
24,906
What is a consistency check?
to add to the other good points When using Excel, I always generate a case number as the first column for each line, this is then copied to the last column. Excel seems quite happy to sort just a few columns at a time, causing chaos if you are not careful to select them all. Your may not even be aware that this has happened. Being able to check that the case numbers agree in the first and last columns of a line is a useful precaution. I always review the outliers. Double entry of data by separate people is recommended for critical work. When entering data from paper documents, it is a good idea to use a reference identifier to be able to refer back to the exact document and line from which the entry derived, numbering of data entry forms helps with this. Edit - Another item - I know that editing spreadsheets is fraught with problems, but it is much easier to clean up data entry with them. However, I also keep the original unedited version, so that any changes can be verified or in the worst case restored.
What is a consistency check?
to add to the other good points When using Excel, I always generate a case number as the first column for each line, this is then copied to the last column. Excel seems quite happy to sort just a few
What is a consistency check? to add to the other good points When using Excel, I always generate a case number as the first column for each line, this is then copied to the last column. Excel seems quite happy to sort just a few columns at a time, causing chaos if you are not careful to select them all. Your may not even be aware that this has happened. Being able to check that the case numbers agree in the first and last columns of a line is a useful precaution. I always review the outliers. Double entry of data by separate people is recommended for critical work. When entering data from paper documents, it is a good idea to use a reference identifier to be able to refer back to the exact document and line from which the entry derived, numbering of data entry forms helps with this. Edit - Another item - I know that editing spreadsheets is fraught with problems, but it is much easier to clean up data entry with them. However, I also keep the original unedited version, so that any changes can be verified or in the worst case restored.
What is a consistency check? to add to the other good points When using Excel, I always generate a case number as the first column for each line, this is then copied to the last column. Excel seems quite happy to sort just a few
24,907
Lambda - Exponential vs. Poisson Interpretation
Suppose I am waiting for a bus at a stop. And suppose that a bus usually arrives at the stop in every 10 mins. Now I define λ to be the rate of arrival of a bus per minute. So, λ = (1/10). Now I want to compute the probability that no bus arrives in the next minute. I can do it using both the poisson and the exponential distribution. Poisson λ = 1/10 Probability of 0 arrivals in the next minute: P(X = 0) = 0.9048 Exponential λ = 1/10 Probability of my having to wait for more than 1 minute: P(X>1) = 0.9048 Note: Look at the expected values of both the distributions. For Poisson, we get that the average number of buses arriving per minute E(X) = λ = 0.10 buses. For exponential, the average waiting time for a bus to arrive E(X) = (1/λ) = 10 mins
Lambda - Exponential vs. Poisson Interpretation
Suppose I am waiting for a bus at a stop. And suppose that a bus usually arrives at the stop in every 10 mins. Now I define λ to be the rate of arrival of a bus per minute. So, λ = (1/10). Now I want
Lambda - Exponential vs. Poisson Interpretation Suppose I am waiting for a bus at a stop. And suppose that a bus usually arrives at the stop in every 10 mins. Now I define λ to be the rate of arrival of a bus per minute. So, λ = (1/10). Now I want to compute the probability that no bus arrives in the next minute. I can do it using both the poisson and the exponential distribution. Poisson λ = 1/10 Probability of 0 arrivals in the next minute: P(X = 0) = 0.9048 Exponential λ = 1/10 Probability of my having to wait for more than 1 minute: P(X>1) = 0.9048 Note: Look at the expected values of both the distributions. For Poisson, we get that the average number of buses arriving per minute E(X) = λ = 0.10 buses. For exponential, the average waiting time for a bus to arrive E(X) = (1/λ) = 10 mins
Lambda - Exponential vs. Poisson Interpretation Suppose I am waiting for a bus at a stop. And suppose that a bus usually arrives at the stop in every 10 mins. Now I define λ to be the rate of arrival of a bus per minute. So, λ = (1/10). Now I want
24,908
Lambda - Exponential vs. Poisson Interpretation
The fact that both of these distributions use the same parameter is probably a coincidence stemming from notational convention. After all, one random variable is discrete, and the other is continuous. They should never model the exact same thing. However, sometimes it isn't a coincidence. One instance where these parameters can mean similar things, and where you can use either of these distributions in the same modeling task is when you are using a Poisson process. This would be useful in a situation where you're modeling things arriving randomly in time (e.g. you receiving texts on your cell phone). Say you start measuring at time $0$. Fixing any time $t > 0$, you could call the total received by this time $N_t$ and assume $$ N_t \sim \text{Poisson}(\lambda t); $$ $\lambda$ here is a rate measured in calls per unit time. You could also look at the waiting times between texts $X_1, X_2, \ldots$ and assume that $$ X_i \overset{iid}{\sim} \text{Exponential}(\lambda); $$ here $\lambda$ is also a rate (if you're writing the density the way you are in this question). The arrival times of each text message are the partial sums $S_n = \sum_{i=1}^n X_i$. The relationship between these two distributions in this particular situation is as follows: given an integer $n$, and a time $t$, $$ P(S_n \le t) = P(N_t \ge n). $$ In the special case where $n = t = 1$, both of these expressions are equal to $1 - e^{-\lambda}$.
Lambda - Exponential vs. Poisson Interpretation
The fact that both of these distributions use the same parameter is probably a coincidence stemming from notational convention. After all, one random variable is discrete, and the other is continuous.
Lambda - Exponential vs. Poisson Interpretation The fact that both of these distributions use the same parameter is probably a coincidence stemming from notational convention. After all, one random variable is discrete, and the other is continuous. They should never model the exact same thing. However, sometimes it isn't a coincidence. One instance where these parameters can mean similar things, and where you can use either of these distributions in the same modeling task is when you are using a Poisson process. This would be useful in a situation where you're modeling things arriving randomly in time (e.g. you receiving texts on your cell phone). Say you start measuring at time $0$. Fixing any time $t > 0$, you could call the total received by this time $N_t$ and assume $$ N_t \sim \text{Poisson}(\lambda t); $$ $\lambda$ here is a rate measured in calls per unit time. You could also look at the waiting times between texts $X_1, X_2, \ldots$ and assume that $$ X_i \overset{iid}{\sim} \text{Exponential}(\lambda); $$ here $\lambda$ is also a rate (if you're writing the density the way you are in this question). The arrival times of each text message are the partial sums $S_n = \sum_{i=1}^n X_i$. The relationship between these two distributions in this particular situation is as follows: given an integer $n$, and a time $t$, $$ P(S_n \le t) = P(N_t \ge n). $$ In the special case where $n = t = 1$, both of these expressions are equal to $1 - e^{-\lambda}$.
Lambda - Exponential vs. Poisson Interpretation The fact that both of these distributions use the same parameter is probably a coincidence stemming from notational convention. After all, one random variable is discrete, and the other is continuous.
24,909
Lambda - Exponential vs. Poisson Interpretation
Does this, from Wikipedia sum up the relationship in a simple way? If for every t > 0 the number of arrivals in the time interval [0, t] follows the Poisson distribution with mean λt, then the sequence of inter-arrival times are independent and identically distributed exponential random variables having mean 1/λ. Reference: S. M. Ross (2007). Introduction to Probability Models (ninth ed.). Boston: Academic Press. ISBN 978-0-12-598062-3. pp. 307–308.
Lambda - Exponential vs. Poisson Interpretation
Does this, from Wikipedia sum up the relationship in a simple way? If for every t > 0 the number of arrivals in the time interval [0, t] follows the Poisson distribution with mean λt, then the sequ
Lambda - Exponential vs. Poisson Interpretation Does this, from Wikipedia sum up the relationship in a simple way? If for every t > 0 the number of arrivals in the time interval [0, t] follows the Poisson distribution with mean λt, then the sequence of inter-arrival times are independent and identically distributed exponential random variables having mean 1/λ. Reference: S. M. Ross (2007). Introduction to Probability Models (ninth ed.). Boston: Academic Press. ISBN 978-0-12-598062-3. pp. 307–308.
Lambda - Exponential vs. Poisson Interpretation Does this, from Wikipedia sum up the relationship in a simple way? If for every t > 0 the number of arrivals in the time interval [0, t] follows the Poisson distribution with mean λt, then the sequ
24,910
Lambda - Exponential vs. Poisson Interpretation
The lambdas are interchangeable in certain contexts. Suppose that I'm measuring radioactivity with a Geyger counter. In one case, $\lambda=2$ means that on average I get 2 clicks per second, and the average time between clicks is $1/2$ seconds. The number of clicks per second is from a Poisson distribution, and the time between clicks is from an Exponential distribution, with both of these having $\lambda=2$.
Lambda - Exponential vs. Poisson Interpretation
The lambdas are interchangeable in certain contexts. Suppose that I'm measuring radioactivity with a Geyger counter. In one case, $\lambda=2$ means that on average I get 2 clicks per second, and the a
Lambda - Exponential vs. Poisson Interpretation The lambdas are interchangeable in certain contexts. Suppose that I'm measuring radioactivity with a Geyger counter. In one case, $\lambda=2$ means that on average I get 2 clicks per second, and the average time between clicks is $1/2$ seconds. The number of clicks per second is from a Poisson distribution, and the time between clicks is from an Exponential distribution, with both of these having $\lambda=2$.
Lambda - Exponential vs. Poisson Interpretation The lambdas are interchangeable in certain contexts. Suppose that I'm measuring radioactivity with a Geyger counter. In one case, $\lambda=2$ means that on average I get 2 clicks per second, and the a
24,911
Lambda - Exponential vs. Poisson Interpretation
As stated in Taylor's answer, there is a connection between the exponential distribution and the Poisson distribution through the equivalence of certain probability statements relating these in a Poisson process. Mathematically, this equivalence comes from a recurrence property of the incomplete gamma function, which can be used to show the probabilistic equivalence at issue. In a Poisson process we have events occurring at some specified rate $\lambda > 0$ and we can analyse the process by looking either at the time between events, or the number of events in a given time. To do the former, let $X_1, X_2, X_3, ... \sim \text{IID Exp} (\lambda)$ be the time between events in the process, and define the partial sums $S_n \equiv \sum_{i=1}^n X_i$, which represent the time taken for the first $n$ events. Then we have $S_n \sim \text{Ga} (n, \lambda)$ so that: $$\begin{equation} \begin{aligned} \mathbb{P}(S_n \leqslant t) = 1 - \mathbb{P}(S_n >t) &= 1 - \int\limits_t^{\infty} \text{Ga} (s|n, \lambda) ds \\ &= 1-\frac{\lambda^n}{\Gamma (n) } \int\limits_t^{\infty} s^{n-1} \exp (- \lambda s) ds \\ &= 1-\frac{1}{\Gamma (n)} \int\limits_t^{\infty} (\lambda s) ^{n-1} \exp (- \lambda s) \lambda ds \\ &= 1-\frac{1}{\Gamma (n)} \int\limits_{\lambda t}^{\infty} r^{n-1} \exp \left( - r \right) dr \\ &= 1-\frac{\Gamma(n, \lambda t)}{\Gamma (n)}. \\ \end{aligned} \end{equation}$$ Using integration by parts, the upper incomplete gamma function follows the recurrence: $$\begin{matrix} \Gamma (n, x) = (n-1) \Gamma(n-1, x) + x^{n-1} \exp (-x) & & \Gamma (1, x) = \exp(-x). \end{matrix}$$ For integer $n$, repeated application of this recurrence yields: $$\Gamma (n, x) = \Gamma (n) \exp (-x) \sum_{k=0}^{n-1} \frac{x^k}{k!}.$$ So, letting $N_t \sim \text{Pois} (\lambda t)$ we have: $$\begin{equation} \begin{aligned} \mathbb{P}(S_n \leqslant t) &= 1- \exp (-\lambda t) \sum_{k=0}^{n-1} \frac{(\lambda t)^k}{k!} \\ &= 1 - \sum_{k=0}^{n-1} \text{Pois} (k|\lambda t) \\ &= \sum_{k=n}^{\infty} \text{Pois} (k|\lambda t) \\ &= \mathbb{P} (N_t \geqslant n). \end{aligned} \end{equation}$$ This gives us a basic intuitive result for the Poisson process. If the time taken for the first $n$ events is no greater than $t$ then the number of events that have occurred at time $t$ is at least $n$. If the time between events follows an exponential distribution then the number of events at a given time follows a Poisson distribution.
Lambda - Exponential vs. Poisson Interpretation
As stated in Taylor's answer, there is a connection between the exponential distribution and the Poisson distribution through the equivalence of certain probability statements relating these in a Pois
Lambda - Exponential vs. Poisson Interpretation As stated in Taylor's answer, there is a connection between the exponential distribution and the Poisson distribution through the equivalence of certain probability statements relating these in a Poisson process. Mathematically, this equivalence comes from a recurrence property of the incomplete gamma function, which can be used to show the probabilistic equivalence at issue. In a Poisson process we have events occurring at some specified rate $\lambda > 0$ and we can analyse the process by looking either at the time between events, or the number of events in a given time. To do the former, let $X_1, X_2, X_3, ... \sim \text{IID Exp} (\lambda)$ be the time between events in the process, and define the partial sums $S_n \equiv \sum_{i=1}^n X_i$, which represent the time taken for the first $n$ events. Then we have $S_n \sim \text{Ga} (n, \lambda)$ so that: $$\begin{equation} \begin{aligned} \mathbb{P}(S_n \leqslant t) = 1 - \mathbb{P}(S_n >t) &= 1 - \int\limits_t^{\infty} \text{Ga} (s|n, \lambda) ds \\ &= 1-\frac{\lambda^n}{\Gamma (n) } \int\limits_t^{\infty} s^{n-1} \exp (- \lambda s) ds \\ &= 1-\frac{1}{\Gamma (n)} \int\limits_t^{\infty} (\lambda s) ^{n-1} \exp (- \lambda s) \lambda ds \\ &= 1-\frac{1}{\Gamma (n)} \int\limits_{\lambda t}^{\infty} r^{n-1} \exp \left( - r \right) dr \\ &= 1-\frac{\Gamma(n, \lambda t)}{\Gamma (n)}. \\ \end{aligned} \end{equation}$$ Using integration by parts, the upper incomplete gamma function follows the recurrence: $$\begin{matrix} \Gamma (n, x) = (n-1) \Gamma(n-1, x) + x^{n-1} \exp (-x) & & \Gamma (1, x) = \exp(-x). \end{matrix}$$ For integer $n$, repeated application of this recurrence yields: $$\Gamma (n, x) = \Gamma (n) \exp (-x) \sum_{k=0}^{n-1} \frac{x^k}{k!}.$$ So, letting $N_t \sim \text{Pois} (\lambda t)$ we have: $$\begin{equation} \begin{aligned} \mathbb{P}(S_n \leqslant t) &= 1- \exp (-\lambda t) \sum_{k=0}^{n-1} \frac{(\lambda t)^k}{k!} \\ &= 1 - \sum_{k=0}^{n-1} \text{Pois} (k|\lambda t) \\ &= \sum_{k=n}^{\infty} \text{Pois} (k|\lambda t) \\ &= \mathbb{P} (N_t \geqslant n). \end{aligned} \end{equation}$$ This gives us a basic intuitive result for the Poisson process. If the time taken for the first $n$ events is no greater than $t$ then the number of events that have occurred at time $t$ is at least $n$. If the time between events follows an exponential distribution then the number of events at a given time follows a Poisson distribution.
Lambda - Exponential vs. Poisson Interpretation As stated in Taylor's answer, there is a connection between the exponential distribution and the Poisson distribution through the equivalence of certain probability statements relating these in a Pois
24,912
Misunderstandings of "spurious correlation"?
I've always hated the term "spurious correlation" because it is not the correlation that is spurious, but the inference of an underlying (false) causal relationship. So-called "spurious correlation" arises when there is evidence of correlation between variables, but the correlation does not reflect a causal effect from one variable to the other. If it were up to me, this would be called "spurious inference of cause", which is how I think of it. So you're right: people shouldn't foam at the mouth over the mere fact that statistical tests can detect correlation, especially if there is no assertion of an underlying cause. (Unfortunately, just as people often confuse correlation and cause, some people also confuse the assertion of correlation as an implicit assertion of cause, and then object to this as spurious!) To understand explanations of this topic, and avoid interpretive errors, you also have to be careful with your interpretation, and bear in mind the difference between statistical independence and causal independence. In the Wikipedia quote in your question, they are (implicitly) referring to causal independence, not statistical independence (the latter is the one where $\mathbb{P}(A|B) = \mathbb{P}(A)$). The Wikipedia explanation could be tightened up by being more explicit about the difference, but it is worth interpreting it in a way that allows for the dual meanings of "independence".
Misunderstandings of "spurious correlation"?
I've always hated the term "spurious correlation" because it is not the correlation that is spurious, but the inference of an underlying (false) causal relationship. So-called "spurious correlation"
Misunderstandings of "spurious correlation"? I've always hated the term "spurious correlation" because it is not the correlation that is spurious, but the inference of an underlying (false) causal relationship. So-called "spurious correlation" arises when there is evidence of correlation between variables, but the correlation does not reflect a causal effect from one variable to the other. If it were up to me, this would be called "spurious inference of cause", which is how I think of it. So you're right: people shouldn't foam at the mouth over the mere fact that statistical tests can detect correlation, especially if there is no assertion of an underlying cause. (Unfortunately, just as people often confuse correlation and cause, some people also confuse the assertion of correlation as an implicit assertion of cause, and then object to this as spurious!) To understand explanations of this topic, and avoid interpretive errors, you also have to be careful with your interpretation, and bear in mind the difference between statistical independence and causal independence. In the Wikipedia quote in your question, they are (implicitly) referring to causal independence, not statistical independence (the latter is the one where $\mathbb{P}(A|B) = \mathbb{P}(A)$). The Wikipedia explanation could be tightened up by being more explicit about the difference, but it is worth interpreting it in a way that allows for the dual meanings of "independence".
Misunderstandings of "spurious correlation"? I've always hated the term "spurious correlation" because it is not the correlation that is spurious, but the inference of an underlying (false) causal relationship. So-called "spurious correlation"
24,913
Misunderstandings of "spurious correlation"?
First, correlation applies to variables but not to events, and so on that count the passage you quote is imprecise. Second, "spurious correlation" has meaning only when variables are in fact correlated, i.e., statistically associated and therefore statistically not independent. So the passage is flawed on that count as well. Identifying a correlation as spurious becomes useful when, despite such a correlation, two variables are demonstrably not causally related to each other, based on other evidence or reasoning. Not only, as you say, can correlation exist without causation, but in some cases correlation may mislead one into assuming causation, and pointing out spuriosity is a way of combating such misunderstanding or shining a light on such incorrect assumptions.
Misunderstandings of "spurious correlation"?
First, correlation applies to variables but not to events, and so on that count the passage you quote is imprecise. Second, "spurious correlation" has meaning only when variables are in fact correlate
Misunderstandings of "spurious correlation"? First, correlation applies to variables but not to events, and so on that count the passage you quote is imprecise. Second, "spurious correlation" has meaning only when variables are in fact correlated, i.e., statistically associated and therefore statistically not independent. So the passage is flawed on that count as well. Identifying a correlation as spurious becomes useful when, despite such a correlation, two variables are demonstrably not causally related to each other, based on other evidence or reasoning. Not only, as you say, can correlation exist without causation, but in some cases correlation may mislead one into assuming causation, and pointing out spuriosity is a way of combating such misunderstanding or shining a light on such incorrect assumptions.
Misunderstandings of "spurious correlation"? First, correlation applies to variables but not to events, and so on that count the passage you quote is imprecise. Second, "spurious correlation" has meaning only when variables are in fact correlate
24,914
Misunderstandings of "spurious correlation"?
There is a huge misunderstand about the meaning of "spurious correlation". Even among practitioners. Spurious correlation is not only about absence of causal relation. It's about absence of correlation itself! Spurious correlation appears when two totally uncorrelated variables present a correlation in-sample just by luck. Therefore, this is a concept closely related to the concept of type I error (when the null hypothesis assumes that X and Y are uncorrelated). This distinction is very important because in some occasions what is relevant to know is if variables X and Y are correlated, no matter the causal relation. For example, for forecasting purpose, if the analyst observe X and X is correlated to Y, possibly X can be used to make a good forecast of Y. A good paper that explore this concept is "Spurious regressions with stationary series" Granger, Hyung and Jeon. Link: https://escholarship.org/uc/item/7r3353t8 "A spurious regression occurs when a pair of independent series, but with strong temporal properties, are found apparently to be related according to standard inference in an OLS regression." Summing up, we can have the following cases: (i) X causes Y or Y causes X; (ii) X and Y are correlated, but neither X causes Y nor Y causes X; (iii) X and Y are uncorrelated, but they present correlation in-sample by luck (spurious relation).
Misunderstandings of "spurious correlation"?
There is a huge misunderstand about the meaning of "spurious correlation". Even among practitioners. Spurious correlation is not only about absence of causal relation. It's about absence of correlatio
Misunderstandings of "spurious correlation"? There is a huge misunderstand about the meaning of "spurious correlation". Even among practitioners. Spurious correlation is not only about absence of causal relation. It's about absence of correlation itself! Spurious correlation appears when two totally uncorrelated variables present a correlation in-sample just by luck. Therefore, this is a concept closely related to the concept of type I error (when the null hypothesis assumes that X and Y are uncorrelated). This distinction is very important because in some occasions what is relevant to know is if variables X and Y are correlated, no matter the causal relation. For example, for forecasting purpose, if the analyst observe X and X is correlated to Y, possibly X can be used to make a good forecast of Y. A good paper that explore this concept is "Spurious regressions with stationary series" Granger, Hyung and Jeon. Link: https://escholarship.org/uc/item/7r3353t8 "A spurious regression occurs when a pair of independent series, but with strong temporal properties, are found apparently to be related according to standard inference in an OLS regression." Summing up, we can have the following cases: (i) X causes Y or Y causes X; (ii) X and Y are correlated, but neither X causes Y nor Y causes X; (iii) X and Y are uncorrelated, but they present correlation in-sample by luck (spurious relation).
Misunderstandings of "spurious correlation"? There is a huge misunderstand about the meaning of "spurious correlation". Even among practitioners. Spurious correlation is not only about absence of causal relation. It's about absence of correlatio
24,915
Misunderstandings of "spurious correlation"?
Let me try explaining the concept of spurious correlation in terms of graphical models. Generally, there is some hidden associated variable which is causing the spurious correlation. Assume that the hidden variable is A and two variables which are spuriously correlated are B and C. In such scenarios, a graph structure similar to B<-A->C exist. B and C are conditionally independent (implies uncorrelated) which means B and C are correlated if A is not given and they are uncorrelated if A is given.
Misunderstandings of "spurious correlation"?
Let me try explaining the concept of spurious correlation in terms of graphical models. Generally, there is some hidden associated variable which is causing the spurious correlation. Assume that the
Misunderstandings of "spurious correlation"? Let me try explaining the concept of spurious correlation in terms of graphical models. Generally, there is some hidden associated variable which is causing the spurious correlation. Assume that the hidden variable is A and two variables which are spuriously correlated are B and C. In such scenarios, a graph structure similar to B<-A->C exist. B and C are conditionally independent (implies uncorrelated) which means B and C are correlated if A is not given and they are uncorrelated if A is given.
Misunderstandings of "spurious correlation"? Let me try explaining the concept of spurious correlation in terms of graphical models. Generally, there is some hidden associated variable which is causing the spurious correlation. Assume that the
24,916
Misunderstandings of "spurious correlation"?
I don't think there's any real misunderstanding or confusion here. Yes, the Wikipedia entry could be more carefully worded and yes, "spurious correlation" is really about an improper interpretation of correlation. But ... So what? Those of us who are data analysts/statisticians/data scientists or just geeky in this area understand this. But the rest of the population will leap to conclusions from correlations all the time. Labeling some correlations as spurious is an attempt to limit those leaps. I think it's a better attempt than other phrases which are less dramatic. In a certain sense, the correlation is spurious or fake and "foaming at the mouth" is sometimes the appropriate reaction. All sorts of bad decisions have been made by people who don't understand (or simply forget) that correlation is not causation.
Misunderstandings of "spurious correlation"?
I don't think there's any real misunderstanding or confusion here. Yes, the Wikipedia entry could be more carefully worded and yes, "spurious correlation" is really about an improper interpretation of
Misunderstandings of "spurious correlation"? I don't think there's any real misunderstanding or confusion here. Yes, the Wikipedia entry could be more carefully worded and yes, "spurious correlation" is really about an improper interpretation of correlation. But ... So what? Those of us who are data analysts/statisticians/data scientists or just geeky in this area understand this. But the rest of the population will leap to conclusions from correlations all the time. Labeling some correlations as spurious is an attempt to limit those leaps. I think it's a better attempt than other phrases which are less dramatic. In a certain sense, the correlation is spurious or fake and "foaming at the mouth" is sometimes the appropriate reaction. All sorts of bad decisions have been made by people who don't understand (or simply forget) that correlation is not causation.
Misunderstandings of "spurious correlation"? I don't think there's any real misunderstanding or confusion here. Yes, the Wikipedia entry could be more carefully worded and yes, "spurious correlation" is really about an improper interpretation of
24,917
Coordinate descent soft-thresholding update operator for LASSO
Here is an alternative derivation which I find quite intuitive using summations rather than matrix notation. Notation is similar to Stanford CS229 notation with $m$ observations, $n$ features, superscript $(i)$ for the $i$'th observation, subscript $j$ for the $j$'th feature. Lasso cost function \begin{aligned} RSS^{lasso}(\theta) & = RSS^{OLS}(\theta) + \lambda \Vert \theta \Vert_1 \\ &= \frac{1}{2} \sum_{i=1}^m \left[y^{(i)} - \sum_{j=0}^n \theta_j x_j^{(i)}\right]^2 + \lambda \sum_{j=1}^n |\theta_j| \end{aligned} Focus on the OLS term \begin{aligned} \frac{\partial }{\partial \theta_j} RSS^{OLS}(\theta) & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{j=0}^n \theta_j x_j^{(i)}\right] \\ & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} - \theta_j x_j^{(i)}\right] \\ & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} \right] + \theta_j \sum_{i=1}^m (x_j^{(i)})^2 \\ & \triangleq - \rho_j + \theta_j z_j \end{aligned} where we define $\rho_j$ and the normalizing constant $z_j$ for notational simplicity Focus on the $L_1$ term The problem with this term is that the derivative of the absolute function is undefined at $\theta = 0$. The method of coordinate descent makes use of two techniques which are to Perform coordinate-wise optimization, which means that at each step only one feature is considered and all others are treated as constants Make use of subderivatives and subdifferentials which are extensions of the notions of derivative for non differentiable functions. The combination of these two points is important because in general, the subdifferential approach to the Lasso regression does not have a closed form solution in the multivariate case. Except for the special case of orthogonal features which is discussed here. As we did previously for the OLS term, the coordinate descent allows us to isolate the $\theta_j$: $$ \lambda \sum_{j=1}^n |\theta_j| = \lambda |\theta_j| + \lambda \sum_{k\neq j}^n |\theta_k|$$ And optimizing this equation as a function of $\theta_j$ reduces it to a univariate problem. Using the definition of the subdifferential as a non empty, closed interval $[a,b]$ where $a$ and $b$ are the one sided limits of the derivative we get the following equation for the subdifferential $\partial_{theta_j} \lambda |\theta|_1$ \begin{equation} \partial_{\theta_j} \lambda \sum_{j=1}^n |\theta_j| = \partial_{\theta_j} \lambda |\theta_j|= \begin{cases} \{ - \lambda \} & \text{if}\ \theta_j < 0 \\ [ - \lambda , \lambda ] & \text{if}\ \theta_j = 0 \\ \{ \lambda \} & \text{if}\ \theta_j > 0 \end{cases} \end{equation} Putting it together Returning to the complete Lasso cost function which is convex and non differentiable (as both the OLS and the absolute function are convex) $$ RSS^{lasso}(\theta) = RSS^{OLS}(\theta) + \lambda || \theta ||_1 \triangleq f(\theta) + g(\theta)$$ We now make use of three important properties of subdifferential theory (see wikipedia) A convex function is differentiable at a point $x_0$ if and only if the subdifferential set is made up of only one point, which is the derivative at $x_0$ Moreau-Rockafellar theorem: If $f$ and $g$ are both convex functions with subdifferentials $\partial f$ and $\partial g$ then the subdifferential of $f + g$ is $\partial(f + g) = \partial f + \partial g$. Stationary condition: A point $x_0$ is the global minimum of a convex function $f$ if and only if the zero is contained in the subdifferential Computing the subdifferential of the Lasso cost function and equating to zero to find the minimum: \begin{aligned} \partial_{\theta_j} RSS^{lasso}(\theta) &= \partial_{\theta_j} RSS^{OLS}(\theta) + \partial_{\theta_j} \lambda || \theta ||_1 \\ 0 & = -\rho_j + \theta_j z_j + \partial_{\theta_j} \lambda || \theta_j || \\ 0 & = \begin{cases} -\rho_j + \theta_j z_j - \lambda & \text{if}\ \theta_j < 0 \\ [-\rho_j - \lambda ,-\rho_j + \lambda ] & \text{if}\ \theta_j = 0 \\ -\rho_j + \theta_j z_j + \lambda & \text{if}\ \theta_j > 0 \end{cases} \end{aligned} For the second case we must ensure that the closed interval contains the zero so that $\theta_j = 0$ is a global minimum \begin{aligned} 0 \in [-\rho_j - \lambda ,-\rho_j + \lambda ] \\ -\rho_j - \lambda \leq 0 \\ -\rho_j +\lambda \geq 0 \\ - \lambda \leq \rho_j \leq \lambda \end{aligned} Solving for $\theta_j$ for the first and third case and combining with above: \begin{aligned} \begin{cases} \theta_j = \frac{\rho_j + \lambda}{z_j} & \text{for} \ \rho_j < - \lambda \\ \theta_j = 0 & \text{for} \ - \lambda \leq \rho_j \leq \lambda \\ \theta_j = \frac{\rho_j - \lambda}{z_j} & \text{for} \ \rho_j > \lambda \end{cases} \end{aligned} We recognize this as the soft thresholding function $\frac{1}{z_j} S(\rho_j , \lambda)$ where $\frac{1}{z_j}$ is a normalizing constant which is equal to $1$ when the data is normalized. Coordinate descent update rule: Repeat until convergence or max number of iterations: For $j = 0,1,...,n$ Compute $\rho_j = \sum_{i=1}^m x_j^{(i)} (y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} ]$ Compute $z_j = \sum_{i=1}^m (x_j^{(i)})^2$ Set $\theta_j = \frac{1}{z_j} S(\rho_j, \lambda)$ Soft threshold function Sources: A fantastic blog post Coursera ML course Lecture notes Code for the figure
Coordinate descent soft-thresholding update operator for LASSO
Here is an alternative derivation which I find quite intuitive using summations rather than matrix notation. Notation is similar to Stanford CS229 notation with $m$ observations, $n$ features, supersc
Coordinate descent soft-thresholding update operator for LASSO Here is an alternative derivation which I find quite intuitive using summations rather than matrix notation. Notation is similar to Stanford CS229 notation with $m$ observations, $n$ features, superscript $(i)$ for the $i$'th observation, subscript $j$ for the $j$'th feature. Lasso cost function \begin{aligned} RSS^{lasso}(\theta) & = RSS^{OLS}(\theta) + \lambda \Vert \theta \Vert_1 \\ &= \frac{1}{2} \sum_{i=1}^m \left[y^{(i)} - \sum_{j=0}^n \theta_j x_j^{(i)}\right]^2 + \lambda \sum_{j=1}^n |\theta_j| \end{aligned} Focus on the OLS term \begin{aligned} \frac{\partial }{\partial \theta_j} RSS^{OLS}(\theta) & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{j=0}^n \theta_j x_j^{(i)}\right] \\ & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} - \theta_j x_j^{(i)}\right] \\ & = - \sum_{i=1}^m x_j^{(i)} \left[y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} \right] + \theta_j \sum_{i=1}^m (x_j^{(i)})^2 \\ & \triangleq - \rho_j + \theta_j z_j \end{aligned} where we define $\rho_j$ and the normalizing constant $z_j$ for notational simplicity Focus on the $L_1$ term The problem with this term is that the derivative of the absolute function is undefined at $\theta = 0$. The method of coordinate descent makes use of two techniques which are to Perform coordinate-wise optimization, which means that at each step only one feature is considered and all others are treated as constants Make use of subderivatives and subdifferentials which are extensions of the notions of derivative for non differentiable functions. The combination of these two points is important because in general, the subdifferential approach to the Lasso regression does not have a closed form solution in the multivariate case. Except for the special case of orthogonal features which is discussed here. As we did previously for the OLS term, the coordinate descent allows us to isolate the $\theta_j$: $$ \lambda \sum_{j=1}^n |\theta_j| = \lambda |\theta_j| + \lambda \sum_{k\neq j}^n |\theta_k|$$ And optimizing this equation as a function of $\theta_j$ reduces it to a univariate problem. Using the definition of the subdifferential as a non empty, closed interval $[a,b]$ where $a$ and $b$ are the one sided limits of the derivative we get the following equation for the subdifferential $\partial_{theta_j} \lambda |\theta|_1$ \begin{equation} \partial_{\theta_j} \lambda \sum_{j=1}^n |\theta_j| = \partial_{\theta_j} \lambda |\theta_j|= \begin{cases} \{ - \lambda \} & \text{if}\ \theta_j < 0 \\ [ - \lambda , \lambda ] & \text{if}\ \theta_j = 0 \\ \{ \lambda \} & \text{if}\ \theta_j > 0 \end{cases} \end{equation} Putting it together Returning to the complete Lasso cost function which is convex and non differentiable (as both the OLS and the absolute function are convex) $$ RSS^{lasso}(\theta) = RSS^{OLS}(\theta) + \lambda || \theta ||_1 \triangleq f(\theta) + g(\theta)$$ We now make use of three important properties of subdifferential theory (see wikipedia) A convex function is differentiable at a point $x_0$ if and only if the subdifferential set is made up of only one point, which is the derivative at $x_0$ Moreau-Rockafellar theorem: If $f$ and $g$ are both convex functions with subdifferentials $\partial f$ and $\partial g$ then the subdifferential of $f + g$ is $\partial(f + g) = \partial f + \partial g$. Stationary condition: A point $x_0$ is the global minimum of a convex function $f$ if and only if the zero is contained in the subdifferential Computing the subdifferential of the Lasso cost function and equating to zero to find the minimum: \begin{aligned} \partial_{\theta_j} RSS^{lasso}(\theta) &= \partial_{\theta_j} RSS^{OLS}(\theta) + \partial_{\theta_j} \lambda || \theta ||_1 \\ 0 & = -\rho_j + \theta_j z_j + \partial_{\theta_j} \lambda || \theta_j || \\ 0 & = \begin{cases} -\rho_j + \theta_j z_j - \lambda & \text{if}\ \theta_j < 0 \\ [-\rho_j - \lambda ,-\rho_j + \lambda ] & \text{if}\ \theta_j = 0 \\ -\rho_j + \theta_j z_j + \lambda & \text{if}\ \theta_j > 0 \end{cases} \end{aligned} For the second case we must ensure that the closed interval contains the zero so that $\theta_j = 0$ is a global minimum \begin{aligned} 0 \in [-\rho_j - \lambda ,-\rho_j + \lambda ] \\ -\rho_j - \lambda \leq 0 \\ -\rho_j +\lambda \geq 0 \\ - \lambda \leq \rho_j \leq \lambda \end{aligned} Solving for $\theta_j$ for the first and third case and combining with above: \begin{aligned} \begin{cases} \theta_j = \frac{\rho_j + \lambda}{z_j} & \text{for} \ \rho_j < - \lambda \\ \theta_j = 0 & \text{for} \ - \lambda \leq \rho_j \leq \lambda \\ \theta_j = \frac{\rho_j - \lambda}{z_j} & \text{for} \ \rho_j > \lambda \end{cases} \end{aligned} We recognize this as the soft thresholding function $\frac{1}{z_j} S(\rho_j , \lambda)$ where $\frac{1}{z_j}$ is a normalizing constant which is equal to $1$ when the data is normalized. Coordinate descent update rule: Repeat until convergence or max number of iterations: For $j = 0,1,...,n$ Compute $\rho_j = \sum_{i=1}^m x_j^{(i)} (y^{(i)} - \sum_{k \neq j}^n \theta_k x_k^{(i)} ]$ Compute $z_j = \sum_{i=1}^m (x_j^{(i)})^2$ Set $\theta_j = \frac{1}{z_j} S(\rho_j, \lambda)$ Soft threshold function Sources: A fantastic blog post Coursera ML course Lecture notes Code for the figure
Coordinate descent soft-thresholding update operator for LASSO Here is an alternative derivation which I find quite intuitive using summations rather than matrix notation. Notation is similar to Stanford CS229 notation with $m$ observations, $n$ features, supersc
24,918
Coordinate descent soft-thresholding update operator for LASSO
You can find the detailed derivation about the soft-thresholding solution to LASSO from here Derivation of closed form lasso solution As for the elastic net, it's just the L1 (LASSO) penalty combined with the L2 (Bridge) penalty. Thus you can do similar derivation accordingly.
Coordinate descent soft-thresholding update operator for LASSO
You can find the detailed derivation about the soft-thresholding solution to LASSO from here Derivation of closed form lasso solution As for the elastic net, it's just the L1 (LASSO) penalty combined
Coordinate descent soft-thresholding update operator for LASSO You can find the detailed derivation about the soft-thresholding solution to LASSO from here Derivation of closed form lasso solution As for the elastic net, it's just the L1 (LASSO) penalty combined with the L2 (Bridge) penalty. Thus you can do similar derivation accordingly.
Coordinate descent soft-thresholding update operator for LASSO You can find the detailed derivation about the soft-thresholding solution to LASSO from here Derivation of closed form lasso solution As for the elastic net, it's just the L1 (LASSO) penalty combined
24,919
How Conditional Random Fields and Logistic Regression could be the same?
From the formulation of a general conditional model (lets omit the bias $\lambda_y$ for simplicity ), $$ P(y|x) = \frac{1}{Z(x)} \exp( \sum\limits_{k=1}^K \lambda_{y,j}x_j ) $$ Where $Z(x) = \sum\limits_y \exp(\sum\limits_{k=1}^K \lambda_{y,j}x_j ) $ Call $w_y = [\lambda_{y,1},...\lambda_{y,k}]$ $$ \Rightarrow P(y|x) = \frac{1}{Z(x)} \exp(w_y^\top x) $$ If $y$ can take only binary values, i.e. $y \in \{+1,-1\}$, $$ P(y = 1|x) = \frac{\exp(w_{+1}^\top x)}{ \exp(w_{+1}^\top x) + \exp(w_{-1}^\top x) } $$ $$ P(y = 1|x) = \frac{1}{ 1 + \exp( (w_{-1}-w_{+1})^\top x ) } $$ Call $w' = w_{+1}-w_{-1}$ $$ P(y = 1|x) = \frac{1}{ 1 + \exp( -w'^\top x ) } $$ Similarly, $$ P(y = -1|x) = \frac{1}{ 1 + \exp( +w'^\top x ) } $$ This corresponds to binary logistic regression with $t = w'^\top x$. So by restricting the conditional model to 2 outcomes you get the binary logistic regression model.
How Conditional Random Fields and Logistic Regression could be the same?
From the formulation of a general conditional model (lets omit the bias $\lambda_y$ for simplicity ), $$ P(y|x) = \frac{1}{Z(x)} \exp( \sum\limits_{k=1}^K \lambda_{y,j}x_j ) $$ Where $Z(x) = \sum\lim
How Conditional Random Fields and Logistic Regression could be the same? From the formulation of a general conditional model (lets omit the bias $\lambda_y$ for simplicity ), $$ P(y|x) = \frac{1}{Z(x)} \exp( \sum\limits_{k=1}^K \lambda_{y,j}x_j ) $$ Where $Z(x) = \sum\limits_y \exp(\sum\limits_{k=1}^K \lambda_{y,j}x_j ) $ Call $w_y = [\lambda_{y,1},...\lambda_{y,k}]$ $$ \Rightarrow P(y|x) = \frac{1}{Z(x)} \exp(w_y^\top x) $$ If $y$ can take only binary values, i.e. $y \in \{+1,-1\}$, $$ P(y = 1|x) = \frac{\exp(w_{+1}^\top x)}{ \exp(w_{+1}^\top x) + \exp(w_{-1}^\top x) } $$ $$ P(y = 1|x) = \frac{1}{ 1 + \exp( (w_{-1}-w_{+1})^\top x ) } $$ Call $w' = w_{+1}-w_{-1}$ $$ P(y = 1|x) = \frac{1}{ 1 + \exp( -w'^\top x ) } $$ Similarly, $$ P(y = -1|x) = \frac{1}{ 1 + \exp( +w'^\top x ) } $$ This corresponds to binary logistic regression with $t = w'^\top x$. So by restricting the conditional model to 2 outcomes you get the binary logistic regression model.
How Conditional Random Fields and Logistic Regression could be the same? From the formulation of a general conditional model (lets omit the bias $\lambda_y$ for simplicity ), $$ P(y|x) = \frac{1}{Z(x)} \exp( \sum\limits_{k=1}^K \lambda_{y,j}x_j ) $$ Where $Z(x) = \sum\lim
24,920
How Conditional Random Fields and Logistic Regression could be the same?
First of all, let's clarify what you read in the wikipedia article you linked to. This: $f(t) = \frac{1}{1+e^{-t}}$ Is simply a logistic function. It is not logistic regression. If you continue reading, you will see this form: $\pi(x) = \frac{1}{1+e^{-(\beta_0+\beta_1x)}}$ Which shows the logistic regression form with one variable. $x$ will be the data and $\beta_0,\beta_1$ will be the parameters that you fit. With multiple variables, you get multinomial logistic regression - see this wikipedia article. This article explains that a Maximum Entropy Classifier is simply a logistic regression model used for classification (i.e. to predict binary classes). This is also the first form of logistic regression which you present in your question. This form now fits one parameter per variable (sometimes with an additional bias parameter), and adds an additional term $Z$ (aka the partition function) which simply normalizes everything into a probability distribution. Finally, the text explains (1.2.2.1) how this form of logistic regression can be viewed as a CRF, via interpreting the function as a multiplication of feature functions (similar to how you multiply factors in random fields - see the beginning of the text).
How Conditional Random Fields and Logistic Regression could be the same?
First of all, let's clarify what you read in the wikipedia article you linked to. This: $f(t) = \frac{1}{1+e^{-t}}$ Is simply a logistic function. It is not logistic regression. If you continue readin
How Conditional Random Fields and Logistic Regression could be the same? First of all, let's clarify what you read in the wikipedia article you linked to. This: $f(t) = \frac{1}{1+e^{-t}}$ Is simply a logistic function. It is not logistic regression. If you continue reading, you will see this form: $\pi(x) = \frac{1}{1+e^{-(\beta_0+\beta_1x)}}$ Which shows the logistic regression form with one variable. $x$ will be the data and $\beta_0,\beta_1$ will be the parameters that you fit. With multiple variables, you get multinomial logistic regression - see this wikipedia article. This article explains that a Maximum Entropy Classifier is simply a logistic regression model used for classification (i.e. to predict binary classes). This is also the first form of logistic regression which you present in your question. This form now fits one parameter per variable (sometimes with an additional bias parameter), and adds an additional term $Z$ (aka the partition function) which simply normalizes everything into a probability distribution. Finally, the text explains (1.2.2.1) how this form of logistic regression can be viewed as a CRF, via interpreting the function as a multiplication of feature functions (similar to how you multiply factors in random fields - see the beginning of the text).
How Conditional Random Fields and Logistic Regression could be the same? First of all, let's clarify what you read in the wikipedia article you linked to. This: $f(t) = \frac{1}{1+e^{-t}}$ Is simply a logistic function. It is not logistic regression. If you continue readin
24,921
How Conditional Random Fields and Logistic Regression could be the same?
I'd like to plug in my understanding here in very simple words. For the CRFs we need to calculate the probability of each sequence of the ground truth tags. How can we calculate the probabilities? We can calculate the potential of the sequence(numerator) and the total potentials(denominator/normalization) of all possible sequences somehow like that we do in logistic regression. Let me apply that to the logistic regression first(when $|y|>2$ it becomes the Multi-class Logistic Regression/or Softmax Regression, but they are the same thing in nature). The total potentials of the logistic regression is $$Z(x) = \sum\limits_y \exp(\sum\limits_{k=1}^K \lambda_{y,k}x_k ) $$ and the sequence potential(here more appropriately the label potential or logit) is $$\exp( \sum\limits_{k=1}^K \lambda_{y,k}x_k )$$ with the sequence length of just 1, then we can divide the sequence potential by they total potentials to get the probability: $$P(y|X) = \frac{1}{Z(X)} \exp( \sum\limits_{k=1}^K \lambda_{y,k}x_k )$$ Now that we have obtained the probability of the right tag/label we can calculate the negative log likelihood using this: $- \log P(y|X)$(the loss for a sample). We can easily see that the logistic regression(here the general multi-class logistic regression) is very simple because the label sequence length is just one, then it is very natural for us to ask if we can combine several logistic regressions together to form a sequence of tags given the observed X(condition)? The answer is yes, and we get the CRF. The difference lies in that in logistic regressions we have only unary potentials/scores(|y| logits) but in CRFs we have a binary potentials between each two sets of unary potentials for each two continuous time-steps, and the binary potentials form the transformation matrix(only one matrix for all two continuous time-steps) meaning the transition potentials/scores from each tag in one time-step to each next tag in the next time-step. Here the key points come, that is how can we calculate the probability of a sequence of ground truth tags? It's very simple with the transition scores(binary potentials). We just multiply all the potentials in the path of the ground truth sequence tags as the numerator and the sum of all possible paths(multiplications) as the denominator. But the denominator seems very expensive to compute since there are $|y|^{|sequence\_length|}$(here we ignore the start and end symbol) possible paths. But we can utilize the math tool named generalized distributive law and implement it using the programming tool named dynamic programming. Once we have got the probability of the ground truth tag sequence we can use the negative log likelihood as the loss for each sample to train the weights for the features(like those in the logistic regression for the unary potentials or unary scores or emission scores or logits) and the weights in the transition matrix(binary potentials or binary scores). Hope this helps to some extent.
How Conditional Random Fields and Logistic Regression could be the same?
I'd like to plug in my understanding here in very simple words. For the CRFs we need to calculate the probability of each sequence of the ground truth tags. How can we calculate the probabilities? We
How Conditional Random Fields and Logistic Regression could be the same? I'd like to plug in my understanding here in very simple words. For the CRFs we need to calculate the probability of each sequence of the ground truth tags. How can we calculate the probabilities? We can calculate the potential of the sequence(numerator) and the total potentials(denominator/normalization) of all possible sequences somehow like that we do in logistic regression. Let me apply that to the logistic regression first(when $|y|>2$ it becomes the Multi-class Logistic Regression/or Softmax Regression, but they are the same thing in nature). The total potentials of the logistic regression is $$Z(x) = \sum\limits_y \exp(\sum\limits_{k=1}^K \lambda_{y,k}x_k ) $$ and the sequence potential(here more appropriately the label potential or logit) is $$\exp( \sum\limits_{k=1}^K \lambda_{y,k}x_k )$$ with the sequence length of just 1, then we can divide the sequence potential by they total potentials to get the probability: $$P(y|X) = \frac{1}{Z(X)} \exp( \sum\limits_{k=1}^K \lambda_{y,k}x_k )$$ Now that we have obtained the probability of the right tag/label we can calculate the negative log likelihood using this: $- \log P(y|X)$(the loss for a sample). We can easily see that the logistic regression(here the general multi-class logistic regression) is very simple because the label sequence length is just one, then it is very natural for us to ask if we can combine several logistic regressions together to form a sequence of tags given the observed X(condition)? The answer is yes, and we get the CRF. The difference lies in that in logistic regressions we have only unary potentials/scores(|y| logits) but in CRFs we have a binary potentials between each two sets of unary potentials for each two continuous time-steps, and the binary potentials form the transformation matrix(only one matrix for all two continuous time-steps) meaning the transition potentials/scores from each tag in one time-step to each next tag in the next time-step. Here the key points come, that is how can we calculate the probability of a sequence of ground truth tags? It's very simple with the transition scores(binary potentials). We just multiply all the potentials in the path of the ground truth sequence tags as the numerator and the sum of all possible paths(multiplications) as the denominator. But the denominator seems very expensive to compute since there are $|y|^{|sequence\_length|}$(here we ignore the start and end symbol) possible paths. But we can utilize the math tool named generalized distributive law and implement it using the programming tool named dynamic programming. Once we have got the probability of the ground truth tag sequence we can use the negative log likelihood as the loss for each sample to train the weights for the features(like those in the logistic regression for the unary potentials or unary scores or emission scores or logits) and the weights in the transition matrix(binary potentials or binary scores). Hope this helps to some extent.
How Conditional Random Fields and Logistic Regression could be the same? I'd like to plug in my understanding here in very simple words. For the CRFs we need to calculate the probability of each sequence of the ground truth tags. How can we calculate the probabilities? We
24,922
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of diagnosing potential influential datapoints?
Assume a regression model $\bf{y} = \bf{X} \bf{\beta} + \bf{\epsilon}$ with design matrix $\bf{X}$ (a $\bf{1}$ column followed by your predictors), predictions $\hat{\bf{y}} = \bf{X} (\bf{X}' \bf{X})^{-1} \bf{X}' \bf{y} = \bf{H} \bf{y}$ (where $\bf{H}$ is the "hat-matrix"), and residuals $\bf{e} = \bf{y} - \hat{\bf{y}}$. The regression model assumes that the true errors $\bf{\epsilon}$ all have the same variance (homoskedasticity): The covariance matrix of the residuals is $V(\bf{e}) = \sigma^{2} (\bf{I} - \bf{H})$. This means that the raw residuals $e_{i}$ have different variances $\sigma^{2} (1-h_{ii})$ - the diagonal of the matrix $\sigma^{2} (\bf{I} - \bf{H})$. The diagonal elements of $\bf{H}$ are the hat-values $h_{ii}$. The truely standardized residuals with variance 1 throughout are thus $\bf{e} / (\sigma \sqrt{1 - h_{ii}})$. The problem is that the error variance $\sigma$ is unknown, and internally / externally studentized residuals $\bf{e} / (\hat{\sigma} \sqrt{1 - h_{ii}})$ result from particular choices for an estimate $\hat{\sigma}$. Since raw residuals are expected to be heteroskedastic even if the $\epsilon$ are homoskedastic, the raw residuals are theoretically less well suited to diagnose problems with the homoskedasticity assumption than standardized or studentized residuals.
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of
Assume a regression model $\bf{y} = \bf{X} \bf{\beta} + \bf{\epsilon}$ with design matrix $\bf{X}$ (a $\bf{1}$ column followed by your predictors), predictions $\hat{\bf{y}} = \bf{X} (\bf{X}' \bf{X})^
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of diagnosing potential influential datapoints? Assume a regression model $\bf{y} = \bf{X} \bf{\beta} + \bf{\epsilon}$ with design matrix $\bf{X}$ (a $\bf{1}$ column followed by your predictors), predictions $\hat{\bf{y}} = \bf{X} (\bf{X}' \bf{X})^{-1} \bf{X}' \bf{y} = \bf{H} \bf{y}$ (where $\bf{H}$ is the "hat-matrix"), and residuals $\bf{e} = \bf{y} - \hat{\bf{y}}$. The regression model assumes that the true errors $\bf{\epsilon}$ all have the same variance (homoskedasticity): The covariance matrix of the residuals is $V(\bf{e}) = \sigma^{2} (\bf{I} - \bf{H})$. This means that the raw residuals $e_{i}$ have different variances $\sigma^{2} (1-h_{ii})$ - the diagonal of the matrix $\sigma^{2} (\bf{I} - \bf{H})$. The diagonal elements of $\bf{H}$ are the hat-values $h_{ii}$. The truely standardized residuals with variance 1 throughout are thus $\bf{e} / (\sigma \sqrt{1 - h_{ii}})$. The problem is that the error variance $\sigma$ is unknown, and internally / externally studentized residuals $\bf{e} / (\hat{\sigma} \sqrt{1 - h_{ii}})$ result from particular choices for an estimate $\hat{\sigma}$. Since raw residuals are expected to be heteroskedastic even if the $\epsilon$ are homoskedastic, the raw residuals are theoretically less well suited to diagnose problems with the homoskedasticity assumption than standardized or studentized residuals.
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of Assume a regression model $\bf{y} = \bf{X} \bf{\beta} + \bf{\epsilon}$ with design matrix $\bf{X}$ (a $\bf{1}$ column followed by your predictors), predictions $\hat{\bf{y}} = \bf{X} (\bf{X}' \bf{X})^
24,923
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of diagnosing potential influential datapoints?
What types of data did you do your test plots on? When all the assumptions hold (or come close) then I would not expect much of a difference between the raw and studentized residuals, the main advantage is when there are highly influential points. Consider this (simulated) data that has a positive linear trend and a highly influential outlier: Here is the plot of the fitted values vs. the raw residuals: Notice that the value of the residual of our influential point is closer to 0 than the minimum and maximum residuals from the rest of the points (it is not in the 3 most extreme raw residuals). Now here is the plot with the standardized (internally studentized) residuals: In this plot the standardized residual stands out because its influence has been accounted for. In this simple example it is easy to see what is going on, but what if we had more than 1 $x$ variable and a point that was very influential, but not unusual in the 2 dimensional plots? It would not be obvious from plots of raw residuals, but the studentized residuals would show that residual as more extreme.
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of
What types of data did you do your test plots on? When all the assumptions hold (or come close) then I would not expect much of a difference between the raw and studentized residuals, the main advant
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of diagnosing potential influential datapoints? What types of data did you do your test plots on? When all the assumptions hold (or come close) then I would not expect much of a difference between the raw and studentized residuals, the main advantage is when there are highly influential points. Consider this (simulated) data that has a positive linear trend and a highly influential outlier: Here is the plot of the fitted values vs. the raw residuals: Notice that the value of the residual of our influential point is closer to 0 than the minimum and maximum residuals from the rest of the points (it is not in the 3 most extreme raw residuals). Now here is the plot with the standardized (internally studentized) residuals: In this plot the standardized residual stands out because its influence has been accounted for. In this simple example it is easy to see what is going on, but what if we had more than 1 $x$ variable and a point that was very influential, but not unusual in the 2 dimensional plots? It would not be obvious from plots of raw residuals, but the studentized residuals would show that residual as more extreme.
What advantages do "internally studentized residuals" offer over raw estimated residuals in terms of What types of data did you do your test plots on? When all the assumptions hold (or come close) then I would not expect much of a difference between the raw and studentized residuals, the main advant
24,924
Identifying outliers for non linear regression
Several tests for outliers, including Dixon's and Grubb's, are available in the outliers package in R. For a list of the tests, see the documentation for the package. References describing the tests are given on the help pages for the corresponding functions. In case you were planning to remove the outliers from your data, bear in mind that this isn't always advisable. See for instance this question for a discussion on this (as well as some more suggestions on how to detect outliers).
Identifying outliers for non linear regression
Several tests for outliers, including Dixon's and Grubb's, are available in the outliers package in R. For a list of the tests, see the documentation for the package. References describing the tests a
Identifying outliers for non linear regression Several tests for outliers, including Dixon's and Grubb's, are available in the outliers package in R. For a list of the tests, see the documentation for the package. References describing the tests are given on the help pages for the corresponding functions. In case you were planning to remove the outliers from your data, bear in mind that this isn't always advisable. See for instance this question for a discussion on this (as well as some more suggestions on how to detect outliers).
Identifying outliers for non linear regression Several tests for outliers, including Dixon's and Grubb's, are available in the outliers package in R. For a list of the tests, see the documentation for the package. References describing the tests a
24,925
Identifying outliers for non linear regression
Neither am I a statistician. Therefore I use my expert knowledge about the data to find outliers. I.e. I look for physical/biological/whatever reasons that made some measurements different from the others. In my case that is e.g. cosmic rays messing up part of the measured signal someone entering the lab, switching on the light just the whole spectrum somehow looks different the first measurement series was taken during normal work hours and is an order of magniture more noisy than the 10 pm series Surely you could tell us similar effects. Note that my 3rd point is different from the others: I don't know what happened. This may be the kind of outlier you're asking about. However, without knowing what caused it (and that this cause invalidates the data point) it is difficult to say that it shouldn't appear in the data set. Also: your outlier may be my most interesting sample... Therefore, I often do not speak of outliers, but of suspicious data points. This reminds everyone that they need to be double checked for their meaning. Whether it is good or not to exclude data (who wants to find outliers just for the sake of having them?) depends very much on what the task at hand is and what the "boundary conditions" for that task are. Some examples: you just discovered the new outlierensis Joachimii subspecies ;-) no reason to exclude them. Exclude all others. you want to predict preying times of mites. If it is acceptable to restrict the prediction to certain conditions, you could formulate these and exclude all other samples and say your predictive model deals with this or that situation, though you already know other situations (describe outlier here) do occur. Keep in mind that excluding data with the help of model diagnostics can create a kind of a self-fulfilling prophecy or an overoptimistic bias (i.e. if you claim your method is generally applicable): the more samples you exclude because they don't fit your assumptions, the better are the assumptions met by the remaining samples. But that's only because of exclusion. I currently have a task at hand where I have a bunch of bad measurements (I know the physical reason why I consider the measurement bad), and a few more that somehow "look weird". What I do is that I exclude these samples from trainig of a (predicitve) model, but separately test the model with these so I can say something about the robustness of my model against outliers of those types which I know will occur every once in a while. Thus, the application somehow or other needs to deal with these outliers. Yet another way to look at outliers is asking: "How much do they influence my model?" (Leverage). From this point of view you can measure robustness or stability with respect to weird training samples. Whatever statistical procedure you use, it will either not identify any outliers, or also have false positives. You can characterize an outlier testing procedure like other diagnostic tests: it has a sensitivity and a specificity, and - more important for you - they correspond (via the outlier proportion in your data) to a positive and negative predictive value. In other words, particularly if your data has very few outliers, the probablility that a case identified by the outlier test really is an outlier (i.e. shouldn't be in the data) can be very low. I believe that expert knowledge about the data at hand is usually much better at detecting outliers than statistical tests: the test is just as good as the assumptions behind it. And one-size-fits-all is often not really good for data analysis. At least I frequently deals with a kind of outliers, where experts (about that type of measurement) have no problem identifying the exact part of the signal that is compromised while automated procedures often fail (it is easy to get them detecting that there is a problem, but very difficult to get them finding where the problem begins and where it ends).
Identifying outliers for non linear regression
Neither am I a statistician. Therefore I use my expert knowledge about the data to find outliers. I.e. I look for physical/biological/whatever reasons that made some measurements different from the ot
Identifying outliers for non linear regression Neither am I a statistician. Therefore I use my expert knowledge about the data to find outliers. I.e. I look for physical/biological/whatever reasons that made some measurements different from the others. In my case that is e.g. cosmic rays messing up part of the measured signal someone entering the lab, switching on the light just the whole spectrum somehow looks different the first measurement series was taken during normal work hours and is an order of magniture more noisy than the 10 pm series Surely you could tell us similar effects. Note that my 3rd point is different from the others: I don't know what happened. This may be the kind of outlier you're asking about. However, without knowing what caused it (and that this cause invalidates the data point) it is difficult to say that it shouldn't appear in the data set. Also: your outlier may be my most interesting sample... Therefore, I often do not speak of outliers, but of suspicious data points. This reminds everyone that they need to be double checked for their meaning. Whether it is good or not to exclude data (who wants to find outliers just for the sake of having them?) depends very much on what the task at hand is and what the "boundary conditions" for that task are. Some examples: you just discovered the new outlierensis Joachimii subspecies ;-) no reason to exclude them. Exclude all others. you want to predict preying times of mites. If it is acceptable to restrict the prediction to certain conditions, you could formulate these and exclude all other samples and say your predictive model deals with this or that situation, though you already know other situations (describe outlier here) do occur. Keep in mind that excluding data with the help of model diagnostics can create a kind of a self-fulfilling prophecy or an overoptimistic bias (i.e. if you claim your method is generally applicable): the more samples you exclude because they don't fit your assumptions, the better are the assumptions met by the remaining samples. But that's only because of exclusion. I currently have a task at hand where I have a bunch of bad measurements (I know the physical reason why I consider the measurement bad), and a few more that somehow "look weird". What I do is that I exclude these samples from trainig of a (predicitve) model, but separately test the model with these so I can say something about the robustness of my model against outliers of those types which I know will occur every once in a while. Thus, the application somehow or other needs to deal with these outliers. Yet another way to look at outliers is asking: "How much do they influence my model?" (Leverage). From this point of view you can measure robustness or stability with respect to weird training samples. Whatever statistical procedure you use, it will either not identify any outliers, or also have false positives. You can characterize an outlier testing procedure like other diagnostic tests: it has a sensitivity and a specificity, and - more important for you - they correspond (via the outlier proportion in your data) to a positive and negative predictive value. In other words, particularly if your data has very few outliers, the probablility that a case identified by the outlier test really is an outlier (i.e. shouldn't be in the data) can be very low. I believe that expert knowledge about the data at hand is usually much better at detecting outliers than statistical tests: the test is just as good as the assumptions behind it. And one-size-fits-all is often not really good for data analysis. At least I frequently deals with a kind of outliers, where experts (about that type of measurement) have no problem identifying the exact part of the signal that is compromised while automated procedures often fail (it is easy to get them detecting that there is a problem, but very difficult to get them finding where the problem begins and where it ends).
Identifying outliers for non linear regression Neither am I a statistician. Therefore I use my expert knowledge about the data to find outliers. I.e. I look for physical/biological/whatever reasons that made some measurements different from the ot
24,926
Identifying outliers for non linear regression
For univariate outliers there is Dixon's ratio test and Grubbs' test assuming normality. To test for an outlier you have to assume a population distribution because you are trying to show that the observed value is extreme or unusual to come from the assumed distribution. I have a paper in the American Statistician in 1982 that I may have referenced here before which shows that Dixon's ratio test can be used in small samples even for some non-normal distributions. Chernick, M.R. (1982)"A Note on the Robustness of Dixon's Ratio in Small Samples" American Statistician p 140. For multivariate outliers and outliers in time series, influence functions for parameter estimates are useful measures for detecting outliers informally (I do not know of formal tests constructed for them although such tests are possible). Look at Barnett and Lewis' text "Outliers in Statistical Data" for detailed treatment of outlier detection methods.
Identifying outliers for non linear regression
For univariate outliers there is Dixon's ratio test and Grubbs' test assuming normality. To test for an outlier you have to assume a population distribution because you are trying to show that the ob
Identifying outliers for non linear regression For univariate outliers there is Dixon's ratio test and Grubbs' test assuming normality. To test for an outlier you have to assume a population distribution because you are trying to show that the observed value is extreme or unusual to come from the assumed distribution. I have a paper in the American Statistician in 1982 that I may have referenced here before which shows that Dixon's ratio test can be used in small samples even for some non-normal distributions. Chernick, M.R. (1982)"A Note on the Robustness of Dixon's Ratio in Small Samples" American Statistician p 140. For multivariate outliers and outliers in time series, influence functions for parameter estimates are useful measures for detecting outliers informally (I do not know of formal tests constructed for them although such tests are possible). Look at Barnett and Lewis' text "Outliers in Statistical Data" for detailed treatment of outlier detection methods.
Identifying outliers for non linear regression For univariate outliers there is Dixon's ratio test and Grubbs' test assuming normality. To test for an outlier you have to assume a population distribution because you are trying to show that the ob
24,927
Identifying outliers for non linear regression
See http://www.waset.org/journals/waset/v36/v36-45.pdf, "On the outlier Detection in Nonlinear Regression" [sic]. Abstract The detection of outliers is very essential because of their responsibility for producing huge interpretative problem in linear as well as in nonlinear regression analysis. Much work has been accomplished on the identification of outlier in linear regression, but not in nonlinear regression. In this article we propose several outlier detection techniques for nonlinear regression. The main idea is to use the linear approximation of a nonlinear model and consider the gradient as the design matrix. Subsequently, the detection techniques are formulated. Six detection measures are developed that combined with three estimation techniques such as the Least-Squares, M and MM-estimators. The study shows that among the six measures, only the studentized residual and Cook Distance which combined with the MM estimator, consistently capable of identifying the correct outliers.
Identifying outliers for non linear regression
See http://www.waset.org/journals/waset/v36/v36-45.pdf, "On the outlier Detection in Nonlinear Regression" [sic]. Abstract The detection of outliers is very essential because of their responsibility
Identifying outliers for non linear regression See http://www.waset.org/journals/waset/v36/v36-45.pdf, "On the outlier Detection in Nonlinear Regression" [sic]. Abstract The detection of outliers is very essential because of their responsibility for producing huge interpretative problem in linear as well as in nonlinear regression analysis. Much work has been accomplished on the identification of outlier in linear regression, but not in nonlinear regression. In this article we propose several outlier detection techniques for nonlinear regression. The main idea is to use the linear approximation of a nonlinear model and consider the gradient as the design matrix. Subsequently, the detection techniques are formulated. Six detection measures are developed that combined with three estimation techniques such as the Least-Squares, M and MM-estimators. The study shows that among the six measures, only the studentized residual and Cook Distance which combined with the MM estimator, consistently capable of identifying the correct outliers.
Identifying outliers for non linear regression See http://www.waset.org/journals/waset/v36/v36-45.pdf, "On the outlier Detection in Nonlinear Regression" [sic]. Abstract The detection of outliers is very essential because of their responsibility
24,928
Identifying outliers for non linear regression
An outlier is a point that is "too far" from "some baseline". The trick is to define both those phrases! With nonlinear regression, one can't just use univariate methods to see if an outlier is "too far" from the best-fit curve, because the outlier can have an enormous influence on the curve itself. Ron Brown and I developed a unique method (which we call ROUT -- Robust regression and Outlier removal) for doing detecting outliers with nonlinear regression, without letting the outlier affect the curve too much. First fit the data with a robust regression method where outliers have little influence. That forms the baseline. Then use the ideas of the False Discovery Rate (FDR) to define when a point is "too far" from that baseline, and so is an outlier. Finally, it removes the identified outliers, and fits the remaining points conventionally. The method is published in an open access journal: Motulsky HJ and Brown RE, Detecting outliers when fitting data with nonlinear regression – a new method based on robust nonlinear regression and the false discovery rate, BMC Bioinformatics 2006, 7:123. Here is the abstract: Background. Nonlinear regression, like linear regression, assumes that the scatter of data around the ideal curve follows a Gaussian or normal distribution. This assumption leads to the familiar goal of regression: to minimize the sum of the squares of the vertical or Y-value distances between the points and the curve. Outliers can dominate the sum-of-the-squares calculation, and lead to misleading results. However, we know of no practical method for routinely identifying outliers when fitting curves with nonlinear regression. Results. We describe a new method for identifying outliers when fitting data with nonlinear regression. We first fit the data using a robust form of nonlinear regression, based on the assumption that scatter follows a Lorentzian distribution. We devised a new adaptive method that gradually becomes more robust as the method proceeds. To define outliers, we adapted the false discovery rate approach to handling multiple comparisons. We then remove the outliers, and analyze the data using ordinary least-squares regression. Because the method combines robust regression and outlier removal, we call it the ROUT method. When analyzing simulated data, where all scatter is Gaussian, our method detects (falsely) one or more outlier in only about 1–3% of experiments. When analyzing data contaminated with one or several outliers, the ROUT method performs well at outlier identification, with an average False Discovery Rate less than 1%. Conclusion. Our method, which combines a new method of robust nonlinear regression with a new method of outlier identification, identifies outliers from nonlinear curve fits with reasonable power and few false positives. It has not (as far as I know) been implemented in R. But we implemented it in GraphPad Prism. and provide a simple explanation in the Prism help.
Identifying outliers for non linear regression
An outlier is a point that is "too far" from "some baseline". The trick is to define both those phrases! With nonlinear regression, one can't just use univariate methods to see if an outlier is "too f
Identifying outliers for non linear regression An outlier is a point that is "too far" from "some baseline". The trick is to define both those phrases! With nonlinear regression, one can't just use univariate methods to see if an outlier is "too far" from the best-fit curve, because the outlier can have an enormous influence on the curve itself. Ron Brown and I developed a unique method (which we call ROUT -- Robust regression and Outlier removal) for doing detecting outliers with nonlinear regression, without letting the outlier affect the curve too much. First fit the data with a robust regression method where outliers have little influence. That forms the baseline. Then use the ideas of the False Discovery Rate (FDR) to define when a point is "too far" from that baseline, and so is an outlier. Finally, it removes the identified outliers, and fits the remaining points conventionally. The method is published in an open access journal: Motulsky HJ and Brown RE, Detecting outliers when fitting data with nonlinear regression – a new method based on robust nonlinear regression and the false discovery rate, BMC Bioinformatics 2006, 7:123. Here is the abstract: Background. Nonlinear regression, like linear regression, assumes that the scatter of data around the ideal curve follows a Gaussian or normal distribution. This assumption leads to the familiar goal of regression: to minimize the sum of the squares of the vertical or Y-value distances between the points and the curve. Outliers can dominate the sum-of-the-squares calculation, and lead to misleading results. However, we know of no practical method for routinely identifying outliers when fitting curves with nonlinear regression. Results. We describe a new method for identifying outliers when fitting data with nonlinear regression. We first fit the data using a robust form of nonlinear regression, based on the assumption that scatter follows a Lorentzian distribution. We devised a new adaptive method that gradually becomes more robust as the method proceeds. To define outliers, we adapted the false discovery rate approach to handling multiple comparisons. We then remove the outliers, and analyze the data using ordinary least-squares regression. Because the method combines robust regression and outlier removal, we call it the ROUT method. When analyzing simulated data, where all scatter is Gaussian, our method detects (falsely) one or more outlier in only about 1–3% of experiments. When analyzing data contaminated with one or several outliers, the ROUT method performs well at outlier identification, with an average False Discovery Rate less than 1%. Conclusion. Our method, which combines a new method of robust nonlinear regression with a new method of outlier identification, identifies outliers from nonlinear curve fits with reasonable power and few false positives. It has not (as far as I know) been implemented in R. But we implemented it in GraphPad Prism. and provide a simple explanation in the Prism help.
Identifying outliers for non linear regression An outlier is a point that is "too far" from "some baseline". The trick is to define both those phrases! With nonlinear regression, one can't just use univariate methods to see if an outlier is "too f
24,929
Identifying outliers for non linear regression
Your question is too general. There is no single best method to exclude the "outliers". You had to know some properties on the "outliers". or you do not know which method is the best. After deciding which method you want to use, you need to calibrate the parameters of the method carefully.
Identifying outliers for non linear regression
Your question is too general. There is no single best method to exclude the "outliers". You had to know some properties on the "outliers". or you do not know which method is the best. After deciding
Identifying outliers for non linear regression Your question is too general. There is no single best method to exclude the "outliers". You had to know some properties on the "outliers". or you do not know which method is the best. After deciding which method you want to use, you need to calibrate the parameters of the method carefully.
Identifying outliers for non linear regression Your question is too general. There is no single best method to exclude the "outliers". You had to know some properties on the "outliers". or you do not know which method is the best. After deciding
24,930
Data reduction technique to identify types of countries
As an exploratory method, PCA is a good first choice for an assignment like this IMO. It'd also be nice for them to get exposed to it; it sounds like many of them won't have seen principal components before. In terms of data I'd also point you to the World Bank Indicators, which are remarkably complete: http://data.worldbank.org/indicator.
Data reduction technique to identify types of countries
As an exploratory method, PCA is a good first choice for an assignment like this IMO. It'd also be nice for them to get exposed to it; it sounds like many of them won't have seen principal components
Data reduction technique to identify types of countries As an exploratory method, PCA is a good first choice for an assignment like this IMO. It'd also be nice for them to get exposed to it; it sounds like many of them won't have seen principal components before. In terms of data I'd also point you to the World Bank Indicators, which are remarkably complete: http://data.worldbank.org/indicator.
Data reduction technique to identify types of countries As an exploratory method, PCA is a good first choice for an assignment like this IMO. It'd also be nice for them to get exposed to it; it sounds like many of them won't have seen principal components
24,931
Data reduction technique to identify types of countries
I agree with JMS, and PCA seems like a good idea after examining the initial correlations and scatterplots between the variables for each county. This thread has some useful suggestions to introduce PCA in non-mathematical terms. I would also suggest utilizing small multiple maps to visualize the spatial distributions of each of the variables (and there are some good examples in this question on the gis.se site). I think these work particularly well if you have a limited number of areal units to compare and you use a good color scheme (like this example on Andrew Gelman's blog). Unfortunately the nature of any "world countries" dataset I suspect would frequently result in sparse data (i.e. alot of missing countries), making geographic visualization difficult. But such visualization techniques should be useful in other situations as well for your course.
Data reduction technique to identify types of countries
I agree with JMS, and PCA seems like a good idea after examining the initial correlations and scatterplots between the variables for each county. This thread has some useful suggestions to introduce P
Data reduction technique to identify types of countries I agree with JMS, and PCA seems like a good idea after examining the initial correlations and scatterplots between the variables for each county. This thread has some useful suggestions to introduce PCA in non-mathematical terms. I would also suggest utilizing small multiple maps to visualize the spatial distributions of each of the variables (and there are some good examples in this question on the gis.se site). I think these work particularly well if you have a limited number of areal units to compare and you use a good color scheme (like this example on Andrew Gelman's blog). Unfortunately the nature of any "world countries" dataset I suspect would frequently result in sparse data (i.e. alot of missing countries), making geographic visualization difficult. But such visualization techniques should be useful in other situations as well for your course.
Data reduction technique to identify types of countries I agree with JMS, and PCA seems like a good idea after examining the initial correlations and scatterplots between the variables for each county. This thread has some useful suggestions to introduce P
24,932
Data reduction technique to identify types of countries
A quick added note: Whichever of the above techniques you use, you'll want to first check the distributions of your variables since many of them will "require" that you first transform them using a logarithm. Doing so will reveal some of the relationships much better than using the original variables would.
Data reduction technique to identify types of countries
A quick added note: Whichever of the above techniques you use, you'll want to first check the distributions of your variables since many of them will "require" that you first transform them using a l
Data reduction technique to identify types of countries A quick added note: Whichever of the above techniques you use, you'll want to first check the distributions of your variables since many of them will "require" that you first transform them using a logarithm. Doing so will reveal some of the relationships much better than using the original variables would.
Data reduction technique to identify types of countries A quick added note: Whichever of the above techniques you use, you'll want to first check the distributions of your variables since many of them will "require" that you first transform them using a l
24,933
Data reduction technique to identify types of countries
You may use CUR decomposition as an alternative to PCA. For CUR decomposition, you may refer to [1] or [2]. In CUR decomposition, C stands for the selected columns, R stands for the selected rows and U is the linking matrix. Let me paraphrase the intuition behind CUR decompsosition as given in [1]; Although the truncated SVD is widely used, the vectors $u_i$ and $v_i$ themselves may lack any meaning in terms of the field from which the data are drawn. For example, the eigenvector [(1/2)age − (1/ √2)height + (1/2)income] being one of the significant uncorrelated “factors” or “features” from a dataset of people’s features, is not particularly informative or meaningful. The nice thing about CUR is that basis columns are actual columns (or rows) and better to interpret as opposed to PCA (which uses trancated SVD). The algorithm given in [1] is easy to implement and you can play with it by changing the error threshold and get different number of bases. [1] M.W. Mahoney and P. Drineas, “CUR matrix decompositions for improved data analysis.,” Proceedings of the National Academy of Sciences of the United States of America, vol. 106, Jan. 2009, pp. 697-702. [2] J. Sun, Y. Xie, H. Zhang, and C. Faloutsos, “Less is more: Compact matrix decomposition for large sparse graphs,” Proceedings of the Seventh SIAM International Conference on Data Mining, Citeseer, 2007, p. 366.
Data reduction technique to identify types of countries
You may use CUR decomposition as an alternative to PCA. For CUR decomposition, you may refer to [1] or [2]. In CUR decomposition, C stands for the selected columns, R stands for the selected rows and
Data reduction technique to identify types of countries You may use CUR decomposition as an alternative to PCA. For CUR decomposition, you may refer to [1] or [2]. In CUR decomposition, C stands for the selected columns, R stands for the selected rows and U is the linking matrix. Let me paraphrase the intuition behind CUR decompsosition as given in [1]; Although the truncated SVD is widely used, the vectors $u_i$ and $v_i$ themselves may lack any meaning in terms of the field from which the data are drawn. For example, the eigenvector [(1/2)age − (1/ √2)height + (1/2)income] being one of the significant uncorrelated “factors” or “features” from a dataset of people’s features, is not particularly informative or meaningful. The nice thing about CUR is that basis columns are actual columns (or rows) and better to interpret as opposed to PCA (which uses trancated SVD). The algorithm given in [1] is easy to implement and you can play with it by changing the error threshold and get different number of bases. [1] M.W. Mahoney and P. Drineas, “CUR matrix decompositions for improved data analysis.,” Proceedings of the National Academy of Sciences of the United States of America, vol. 106, Jan. 2009, pp. 697-702. [2] J. Sun, Y. Xie, H. Zhang, and C. Faloutsos, “Less is more: Compact matrix decomposition for large sparse graphs,” Proceedings of the Seventh SIAM International Conference on Data Mining, Citeseer, 2007, p. 366.
Data reduction technique to identify types of countries You may use CUR decomposition as an alternative to PCA. For CUR decomposition, you may refer to [1] or [2]. In CUR decomposition, C stands for the selected columns, R stands for the selected rows and
24,934
Data reduction technique to identify types of countries
Depending on your objectives, classification of registries on groups might be best achieved by some clustering method. For a relatively small number of cases hierarchical clustering is usually best suited, at least in the exploratory phase, while for a more polished solution you might look to some iterative process like K-means. According to which software you're using it's also possible to use a process, which is in SPSS but I don't know where else, called two step clustering, which is fast, though opaque, and seems to give good results. Cluster analysis yields a classification solution that maximizes variance between groups while minimizing variance inside said groups. It will also likely yield results that are easier to interpret.
Data reduction technique to identify types of countries
Depending on your objectives, classification of registries on groups might be best achieved by some clustering method. For a relatively small number of cases hierarchical clustering is usually best su
Data reduction technique to identify types of countries Depending on your objectives, classification of registries on groups might be best achieved by some clustering method. For a relatively small number of cases hierarchical clustering is usually best suited, at least in the exploratory phase, while for a more polished solution you might look to some iterative process like K-means. According to which software you're using it's also possible to use a process, which is in SPSS but I don't know where else, called two step clustering, which is fast, though opaque, and seems to give good results. Cluster analysis yields a classification solution that maximizes variance between groups while minimizing variance inside said groups. It will also likely yield results that are easier to interpret.
Data reduction technique to identify types of countries Depending on your objectives, classification of registries on groups might be best achieved by some clustering method. For a relatively small number of cases hierarchical clustering is usually best su
24,935
Data reduction technique to identify types of countries
I suggest clustering on variables and on observations (separately) to shed light on the dataset. Variable clustering (say, using Spearmean $\rho^2$ as a similarity measure as in the R Hmisc package's varclus function) will help one see which variables "run together."
Data reduction technique to identify types of countries
I suggest clustering on variables and on observations (separately) to shed light on the dataset. Variable clustering (say, using Spearmean $\rho^2$ as a similarity measure as in the R Hmisc package's
Data reduction technique to identify types of countries I suggest clustering on variables and on observations (separately) to shed light on the dataset. Variable clustering (say, using Spearmean $\rho^2$ as a similarity measure as in the R Hmisc package's varclus function) will help one see which variables "run together."
Data reduction technique to identify types of countries I suggest clustering on variables and on observations (separately) to shed light on the dataset. Variable clustering (say, using Spearmean $\rho^2$ as a similarity measure as in the R Hmisc package's
24,936
Data reduction technique to identify types of countries
Another option would be to use Self-Organizing Maps (SOM's). Any idea of what software the students will be using? I know that R, for example, has a couple of SOM implementations. SOM's may fail your "component factors make intuitive sense" test, however. (Not necessarily true with PCA, either...)
Data reduction technique to identify types of countries
Another option would be to use Self-Organizing Maps (SOM's). Any idea of what software the students will be using? I know that R, for example, has a couple of SOM implementations. SOM's may fail your
Data reduction technique to identify types of countries Another option would be to use Self-Organizing Maps (SOM's). Any idea of what software the students will be using? I know that R, for example, has a couple of SOM implementations. SOM's may fail your "component factors make intuitive sense" test, however. (Not necessarily true with PCA, either...)
Data reduction technique to identify types of countries Another option would be to use Self-Organizing Maps (SOM's). Any idea of what software the students will be using? I know that R, for example, has a couple of SOM implementations. SOM's may fail your
24,937
Square root of a Beta(1,1) random variable
If $X^{2}\sim\operatorname{Beta}(1,1)$ (which is a uniform distribution), then $X^p\sim\operatorname{Kumaraswamy}(1/p, 1)$ (see the Wikipedia page). The PDF of the resulting Kumaraswamy distribution is given by $$ f(x)=\frac{x^{\frac{1}{p}-1}}{p}\qquad 0<x<1 $$ So for the example with $p=1/2$ we have $(X^2)^{1/2}=X\sim\operatorname{Kumaraswamy}(2, 1)$ with PDF $f(x) = 2x$ for $0<x<1$. Generally, if $X\sim\operatorname{Beta}(\alpha,\beta)$, then $X^p$ with $p>0$ has PDF $$ f(x)=\frac{x^{\alpha/p-1}\left(1 - x^{1/p}\right)^{\beta- 1}}{pB(\alpha, \beta)}\qquad 0<x<1 $$ where $B(\alpha, \beta)$ is the beta function. For example, if $X^{2}\sim\operatorname{Beta}(0.5, 0.5)$, then $X$ has PDF (setting $p=1/2, \alpha = \beta=1/2$) $$ f(x)=\frac{2}{\pi\sqrt{1 - x^{2}}}\qquad 0<x<1 $$
Square root of a Beta(1,1) random variable
If $X^{2}\sim\operatorname{Beta}(1,1)$ (which is a uniform distribution), then $X^p\sim\operatorname{Kumaraswamy}(1/p, 1)$ (see the Wikipedia page). The PDF of the resulting Kumaraswamy distribution i
Square root of a Beta(1,1) random variable If $X^{2}\sim\operatorname{Beta}(1,1)$ (which is a uniform distribution), then $X^p\sim\operatorname{Kumaraswamy}(1/p, 1)$ (see the Wikipedia page). The PDF of the resulting Kumaraswamy distribution is given by $$ f(x)=\frac{x^{\frac{1}{p}-1}}{p}\qquad 0<x<1 $$ So for the example with $p=1/2$ we have $(X^2)^{1/2}=X\sim\operatorname{Kumaraswamy}(2, 1)$ with PDF $f(x) = 2x$ for $0<x<1$. Generally, if $X\sim\operatorname{Beta}(\alpha,\beta)$, then $X^p$ with $p>0$ has PDF $$ f(x)=\frac{x^{\alpha/p-1}\left(1 - x^{1/p}\right)^{\beta- 1}}{pB(\alpha, \beta)}\qquad 0<x<1 $$ where $B(\alpha, \beta)$ is the beta function. For example, if $X^{2}\sim\operatorname{Beta}(0.5, 0.5)$, then $X$ has PDF (setting $p=1/2, \alpha = \beta=1/2$) $$ f(x)=\frac{2}{\pi\sqrt{1 - x^{2}}}\qquad 0<x<1 $$
Square root of a Beta(1,1) random variable If $X^{2}\sim\operatorname{Beta}(1,1)$ (which is a uniform distribution), then $X^p\sim\operatorname{Kumaraswamy}(1/p, 1)$ (see the Wikipedia page). The PDF of the resulting Kumaraswamy distribution i
24,938
Square root of a Beta(1,1) random variable
You ask for a general method. Here is one. When $X^p$ has a Beta$(\alpha,\beta)$ distribution for $p\gt 0,$ this means for all $0\lt y \lt 1$ that $$F_X(y^{1/p}) = \Pr(X \le y^{1/p}) = \Pr(X^p \le y) = \frac{1}{B(\alpha,\beta)}\int_0^y t^{\alpha-1}(1-t)^{\beta-1}\,\mathrm{d}t.$$ Differentiating with respect to $y$ via the Chain Rule (at the left) and Fundamental Theorem of Calculus (at the right) reveals that $$f_X(y^{1/p}) \frac{y^{1/p-1}}{p} = \frac{\mathrm{d}}{\mathrm{d}y} F_X(y^{1/p}) = \frac{1}{B(\alpha,\beta)}y^{\alpha-1}(1-y)^{\beta-1}$$ Solve this for $f_X,$ writing $x=y^{1/p}$ (which also lies in the interval $(0,1)$) to obtain $$\begin{aligned} f_X(x) &= \frac{1}{B(\alpha,\beta)}y^{\alpha-1}(1-y)^{\beta-1}\,p\, y^{1-1/p}\\ &= \frac{1}{B(\alpha,\beta)}\left(x^p\right)^{\alpha-1}(1-\left(x^p\right))^{\beta-1}\,p\, \left(x^p\right)^{1-1/p}\\ &=\frac{p}{B(\alpha,\beta)}\,x^{p\alpha-1}(1-x^p)^{\beta-1}. \end{aligned}$$ That gives you closed forms for the density $f_X$ and, via integration, the distribution $F_X.$ Here are histograms created by drawing a sample of a million values from each of four Beta distributions and taking their $p^\text{th}$ roots for various $p.$ Over them are plotted in red the graphs of $f_X$ to demonstrate its correctness. Here is the R code to use if you would like to view more examples. # # Describe a collection of distributions. # Theta <- rbind(c(alpha=3, beta=7, p=5), c(1/2, 3/2, 5), c(3/2, 1/2, 1/5), c(1, 1, 1/2)) n <- 1e6 # Sample size # # Sample and plot each distribution. # par(mfrow=c(2,2)) apply(Theta, 1, function(theta) { alpha <- theta[1]; beta <- theta[2]; p <- theta[3] Y <- rbeta(n, alpha, beta) X <- Y^(1/p) hist(X, breaks=80, freq=FALSE, col="Gray") curve(p / beta(alpha,beta) * x^(p*alpha-1) * (1-x^p)^(beta-1), n=501, lwd=2, col="Red", add=TRUE) mtext(bquote(paste(alpha==.(alpha), ", ", beta==.(beta), ", and ", p==.(p))), side=3, line=0) }) par(mfrow=c(1,1))
Square root of a Beta(1,1) random variable
You ask for a general method. Here is one. When $X^p$ has a Beta$(\alpha,\beta)$ distribution for $p\gt 0,$ this means for all $0\lt y \lt 1$ that $$F_X(y^{1/p}) = \Pr(X \le y^{1/p}) = \Pr(X^p \le y)
Square root of a Beta(1,1) random variable You ask for a general method. Here is one. When $X^p$ has a Beta$(\alpha,\beta)$ distribution for $p\gt 0,$ this means for all $0\lt y \lt 1$ that $$F_X(y^{1/p}) = \Pr(X \le y^{1/p}) = \Pr(X^p \le y) = \frac{1}{B(\alpha,\beta)}\int_0^y t^{\alpha-1}(1-t)^{\beta-1}\,\mathrm{d}t.$$ Differentiating with respect to $y$ via the Chain Rule (at the left) and Fundamental Theorem of Calculus (at the right) reveals that $$f_X(y^{1/p}) \frac{y^{1/p-1}}{p} = \frac{\mathrm{d}}{\mathrm{d}y} F_X(y^{1/p}) = \frac{1}{B(\alpha,\beta)}y^{\alpha-1}(1-y)^{\beta-1}$$ Solve this for $f_X,$ writing $x=y^{1/p}$ (which also lies in the interval $(0,1)$) to obtain $$\begin{aligned} f_X(x) &= \frac{1}{B(\alpha,\beta)}y^{\alpha-1}(1-y)^{\beta-1}\,p\, y^{1-1/p}\\ &= \frac{1}{B(\alpha,\beta)}\left(x^p\right)^{\alpha-1}(1-\left(x^p\right))^{\beta-1}\,p\, \left(x^p\right)^{1-1/p}\\ &=\frac{p}{B(\alpha,\beta)}\,x^{p\alpha-1}(1-x^p)^{\beta-1}. \end{aligned}$$ That gives you closed forms for the density $f_X$ and, via integration, the distribution $F_X.$ Here are histograms created by drawing a sample of a million values from each of four Beta distributions and taking their $p^\text{th}$ roots for various $p.$ Over them are plotted in red the graphs of $f_X$ to demonstrate its correctness. Here is the R code to use if you would like to view more examples. # # Describe a collection of distributions. # Theta <- rbind(c(alpha=3, beta=7, p=5), c(1/2, 3/2, 5), c(3/2, 1/2, 1/5), c(1, 1, 1/2)) n <- 1e6 # Sample size # # Sample and plot each distribution. # par(mfrow=c(2,2)) apply(Theta, 1, function(theta) { alpha <- theta[1]; beta <- theta[2]; p <- theta[3] Y <- rbeta(n, alpha, beta) X <- Y^(1/p) hist(X, breaks=80, freq=FALSE, col="Gray") curve(p / beta(alpha,beta) * x^(p*alpha-1) * (1-x^p)^(beta-1), n=501, lwd=2, col="Red", add=TRUE) mtext(bquote(paste(alpha==.(alpha), ", ", beta==.(beta), ", and ", p==.(p))), side=3, line=0) }) par(mfrow=c(1,1))
Square root of a Beta(1,1) random variable You ask for a general method. Here is one. When $X^p$ has a Beta$(\alpha,\beta)$ distribution for $p\gt 0,$ this means for all $0\lt y \lt 1$ that $$F_X(y^{1/p}) = \Pr(X \le y^{1/p}) = \Pr(X^p \le y)
24,939
Probabilistic programming vs "traditional" ML
It's generally true in my personal experience as a professional data scientist. It's true in my personal experience because it's what I observe most of the time. If you're asking why it happens this way, it's for a few reasons: Many traditional ML algorithms are nowadays available "off the shelf", including sophisticated ensemble methods, neural networks, etc. Probabilistic methods still often require bespoke solutions, either written in a DSL like Stan or directly in a general-purpose programming language. Many people entering data science nowadays are coming from engineering and natural science backgrounds, where they have strong mathematical and "algorithmic" skills but don't have as much experience or intuition with probability modeling. It's just not on their radar, and they aren't as comfortable with the methods and the software required to implement them. Making a "hard" prediction from a probabilistic model involves either hand-waving or formal decision theory. AI researchers and highly-paid statistical consultants know this, and they embrace it. But for the rank-and-file data scientist, it's not so easy to turn to your manager and start speaking in terms of distributions and probabilities. The business (or the automated system you're building) just needs a damn answer. Life is just a whole lot easier when you stop equivocating about probabilities and stuff, in which case you might as well not bother with them in the first place. Probabilistic modeling often ends up being very computationally intensive, especially Bayesian modeling where closed-form solutions are a rare luxury, and doubly especially on "big" data sets. I wouldn't hesitate to run XGBoost on a data set with 10 million rows. I wouldn't even consider running a Stan model on a data set with 10 million rows. Given all the downsides described above, a data scientist or a small team of data scientists can iterate much more quickly using less-probabilistic machine learning techniques, and get "good enough" results. Edit: as pointed out in the comments, #1 and #2 could both be because probabilistic programming methods haven't yet been shown to have knockout performance on real-world problems. CNNs got popular because they blew away existing techniques. Edit 2: it seems that probabilistic is getting popular for time series modeling, where deep learning doesn't seem as effective as in other domains. Edit 3 (December 2020): probabilistic programming is now becoming much more popular in a wide variety of domains, as probabilistic programming languages get better and the solvers get better and faster.
Probabilistic programming vs "traditional" ML
It's generally true in my personal experience as a professional data scientist. It's true in my personal experience because it's what I observe most of the time. If you're asking why it happens this
Probabilistic programming vs "traditional" ML It's generally true in my personal experience as a professional data scientist. It's true in my personal experience because it's what I observe most of the time. If you're asking why it happens this way, it's for a few reasons: Many traditional ML algorithms are nowadays available "off the shelf", including sophisticated ensemble methods, neural networks, etc. Probabilistic methods still often require bespoke solutions, either written in a DSL like Stan or directly in a general-purpose programming language. Many people entering data science nowadays are coming from engineering and natural science backgrounds, where they have strong mathematical and "algorithmic" skills but don't have as much experience or intuition with probability modeling. It's just not on their radar, and they aren't as comfortable with the methods and the software required to implement them. Making a "hard" prediction from a probabilistic model involves either hand-waving or formal decision theory. AI researchers and highly-paid statistical consultants know this, and they embrace it. But for the rank-and-file data scientist, it's not so easy to turn to your manager and start speaking in terms of distributions and probabilities. The business (or the automated system you're building) just needs a damn answer. Life is just a whole lot easier when you stop equivocating about probabilities and stuff, in which case you might as well not bother with them in the first place. Probabilistic modeling often ends up being very computationally intensive, especially Bayesian modeling where closed-form solutions are a rare luxury, and doubly especially on "big" data sets. I wouldn't hesitate to run XGBoost on a data set with 10 million rows. I wouldn't even consider running a Stan model on a data set with 10 million rows. Given all the downsides described above, a data scientist or a small team of data scientists can iterate much more quickly using less-probabilistic machine learning techniques, and get "good enough" results. Edit: as pointed out in the comments, #1 and #2 could both be because probabilistic programming methods haven't yet been shown to have knockout performance on real-world problems. CNNs got popular because they blew away existing techniques. Edit 2: it seems that probabilistic is getting popular for time series modeling, where deep learning doesn't seem as effective as in other domains. Edit 3 (December 2020): probabilistic programming is now becoming much more popular in a wide variety of domains, as probabilistic programming languages get better and the solvers get better and faster.
Probabilistic programming vs "traditional" ML It's generally true in my personal experience as a professional data scientist. It's true in my personal experience because it's what I observe most of the time. If you're asking why it happens this
24,940
Probabilistic programming vs "traditional" ML
To combat ShadowTalker above's point about probabilistic ML being not quite up to snuff yet, is definitely true as-is, but there have been some really exciting advances in scalability and complexity because of variational inference which is definitely still cutting-edge research. I think it remains an interesting question of whether, if probabilistic ML could deliver the same performance of traditional methods, would we prefer it uniformly to those methods? In a lot of ways, there's so much more information conveyed in a PML estimated posterior. Regardless of the answer to the above question, I think the two sets of methods will live in different niches in the years to come. I think probably traditional methods will retain a performance edge to some degree, but when we're actually worried about the latent variables (unknowns) in a problem, PML will be the right machinery for the job.
Probabilistic programming vs "traditional" ML
To combat ShadowTalker above's point about probabilistic ML being not quite up to snuff yet, is definitely true as-is, but there have been some really exciting advances in scalability and complexity b
Probabilistic programming vs "traditional" ML To combat ShadowTalker above's point about probabilistic ML being not quite up to snuff yet, is definitely true as-is, but there have been some really exciting advances in scalability and complexity because of variational inference which is definitely still cutting-edge research. I think it remains an interesting question of whether, if probabilistic ML could deliver the same performance of traditional methods, would we prefer it uniformly to those methods? In a lot of ways, there's so much more information conveyed in a PML estimated posterior. Regardless of the answer to the above question, I think the two sets of methods will live in different niches in the years to come. I think probably traditional methods will retain a performance edge to some degree, but when we're actually worried about the latent variables (unknowns) in a problem, PML will be the right machinery for the job.
Probabilistic programming vs "traditional" ML To combat ShadowTalker above's point about probabilistic ML being not quite up to snuff yet, is definitely true as-is, but there have been some really exciting advances in scalability and complexity b
24,941
Should I report non-significant results?
Yes, non-significant results are just as important as significant ones. If you are reporting any result, always include the df, test statistic, and p value. And in that case, you should state the exact p-value, rather than generalising to >0.05
Should I report non-significant results?
Yes, non-significant results are just as important as significant ones. If you are reporting any result, always include the df, test statistic, and p value. And in that case, you should state the exac
Should I report non-significant results? Yes, non-significant results are just as important as significant ones. If you are reporting any result, always include the df, test statistic, and p value. And in that case, you should state the exact p-value, rather than generalising to >0.05
Should I report non-significant results? Yes, non-significant results are just as important as significant ones. If you are reporting any result, always include the df, test statistic, and p value. And in that case, you should state the exac
24,942
Should I report non-significant results?
If you are publishing a paper in the open literature, you should definitely report statistically insignificant results the same way you report statistical significant results. Otherwise you contribute to underreporting bias.
Should I report non-significant results?
If you are publishing a paper in the open literature, you should definitely report statistically insignificant results the same way you report statistical significant results. Otherwise you contribute
Should I report non-significant results? If you are publishing a paper in the open literature, you should definitely report statistically insignificant results the same way you report statistical significant results. Otherwise you contribute to underreporting bias.
Should I report non-significant results? If you are publishing a paper in the open literature, you should definitely report statistically insignificant results the same way you report statistical significant results. Otherwise you contribute
24,943
Adjusted Rand Index vs Adjusted Mutual Information
Short answer Use ARI when the ground truth clustering has large equal sized clusters Use AMI when the ground truth clustering is unbalanced and there exist small clusters Longer answer I worked on this topic. Reference: Adjusting for Chance Clustering Comparison Measures A one-line summary of the paper is: AMI is high when there are pure clusters in the clustering solution. Let's have a look at an example. We have a reference clustering V consisting of 4 equal size clusters. Each cluster is of size 25. Then we have two clustering solutions: U1 that has pure clusters (many zeros in the contingency table) U2 that has impure clusters AMI will choose U1 and ARI will choose U2. Eventually: U1 is unbalanced. Unbalanced clusters have more chances to present pure clusters. AMI is biased towards unbalanced clustering solutions U2 is balanced. ARI is biased towards balanced clustering solutions. If we are using external validity indices such as AMI and ARI, we are aiming at matching the reference clustering with our clustering solution. This is why the recommendation at the top: AMI when the reference clustering is unbalanced, and ARI when the reference clustering is balanced. We do this mainly due to the biases in both measures. Also, when we have an unbalanced reference clustering with small clusters, we are even more interested in generating pure small clusters in the solution. We want to identify precisely the small clusters from the reference. Even a single mismatched data point can have a relatively higher impact. Other than the recommendations above, we could use AMI when we are interested in having pure clusters in the solution. Experiment Here I sketched an experiment where P generates solutions U which are balanced when P=1 and unbalanced when P=0. You can play with the notebook here.
Adjusted Rand Index vs Adjusted Mutual Information
Short answer Use ARI when the ground truth clustering has large equal sized clusters Use AMI when the ground truth clustering is unbalanced and there exist small clusters Longer answer I worked on t
Adjusted Rand Index vs Adjusted Mutual Information Short answer Use ARI when the ground truth clustering has large equal sized clusters Use AMI when the ground truth clustering is unbalanced and there exist small clusters Longer answer I worked on this topic. Reference: Adjusting for Chance Clustering Comparison Measures A one-line summary of the paper is: AMI is high when there are pure clusters in the clustering solution. Let's have a look at an example. We have a reference clustering V consisting of 4 equal size clusters. Each cluster is of size 25. Then we have two clustering solutions: U1 that has pure clusters (many zeros in the contingency table) U2 that has impure clusters AMI will choose U1 and ARI will choose U2. Eventually: U1 is unbalanced. Unbalanced clusters have more chances to present pure clusters. AMI is biased towards unbalanced clustering solutions U2 is balanced. ARI is biased towards balanced clustering solutions. If we are using external validity indices such as AMI and ARI, we are aiming at matching the reference clustering with our clustering solution. This is why the recommendation at the top: AMI when the reference clustering is unbalanced, and ARI when the reference clustering is balanced. We do this mainly due to the biases in both measures. Also, when we have an unbalanced reference clustering with small clusters, we are even more interested in generating pure small clusters in the solution. We want to identify precisely the small clusters from the reference. Even a single mismatched data point can have a relatively higher impact. Other than the recommendations above, we could use AMI when we are interested in having pure clusters in the solution. Experiment Here I sketched an experiment where P generates solutions U which are balanced when P=1 and unbalanced when P=0. You can play with the notebook here.
Adjusted Rand Index vs Adjusted Mutual Information Short answer Use ARI when the ground truth clustering has large equal sized clusters Use AMI when the ground truth clustering is unbalanced and there exist small clusters Longer answer I worked on t
24,944
Adjusted Rand Index vs Adjusted Mutual Information
They are two out of a dozen that all try to compare clusterings. But they are not equivalent. They use different theory. Sometimes, ARI may prefer one result and the AMI another. But often they agree in preference (not in the numbers).
Adjusted Rand Index vs Adjusted Mutual Information
They are two out of a dozen that all try to compare clusterings. But they are not equivalent. They use different theory. Sometimes, ARI may prefer one result and the AMI another. But often they agree
Adjusted Rand Index vs Adjusted Mutual Information They are two out of a dozen that all try to compare clusterings. But they are not equivalent. They use different theory. Sometimes, ARI may prefer one result and the AMI another. But often they agree in preference (not in the numbers).
Adjusted Rand Index vs Adjusted Mutual Information They are two out of a dozen that all try to compare clusterings. But they are not equivalent. They use different theory. Sometimes, ARI may prefer one result and the AMI another. But often they agree
24,945
Is it wrong to use ANOVA instead of a t-test for comparing two means?
It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident that a t-test with unequal variances is not equivalent. Since you can get appropriate estimates when the variances are unequal (variances are generally always unequal to some decimal place), it probably makes sense to use the t-test as it is more flexible than an ANOVA (assuming you only have two groups). Update: Here is code to show that the t-statistic^2 for the equal variance t-test, but not the unequal t-test, is the same as the f-statistic. dat_mtcars <- mtcars # unequal variance model t_unequal <- t.test(mpg ~ factor(vs), data = dat_mtcars) t_stat_unequal <- t_unequal$statistic # assume equal variance t_equal <- t.test(mpg ~ factor(vs), var.equal = TRUE, data = dat_mtcars) t_stat_equal <- t_equal$statistic # anova a_equal <- aov(mpg ~ factor(vs), data = dat_mtcars) f_stat <- anova(a_equal) f_stat$`F value`[1] # compare by dividing (1 = equivalence) (t_stat_unequal^2) / f_stat$`F value`[1] (t_stat_equal^2) / f_stat$`F value`[1] # (t-stat with equal var^2) = F
Is it wrong to use ANOVA instead of a t-test for comparing two means?
It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident th
Is it wrong to use ANOVA instead of a t-test for comparing two means? It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident that a t-test with unequal variances is not equivalent. Since you can get appropriate estimates when the variances are unequal (variances are generally always unequal to some decimal place), it probably makes sense to use the t-test as it is more flexible than an ANOVA (assuming you only have two groups). Update: Here is code to show that the t-statistic^2 for the equal variance t-test, but not the unequal t-test, is the same as the f-statistic. dat_mtcars <- mtcars # unequal variance model t_unequal <- t.test(mpg ~ factor(vs), data = dat_mtcars) t_stat_unequal <- t_unequal$statistic # assume equal variance t_equal <- t.test(mpg ~ factor(vs), var.equal = TRUE, data = dat_mtcars) t_stat_equal <- t_equal$statistic # anova a_equal <- aov(mpg ~ factor(vs), data = dat_mtcars) f_stat <- anova(a_equal) f_stat$`F value`[1] # compare by dividing (1 = equivalence) (t_stat_unequal^2) / f_stat$`F value`[1] (t_stat_equal^2) / f_stat$`F value`[1] # (t-stat with equal var^2) = F
Is it wrong to use ANOVA instead of a t-test for comparing two means? It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident th
24,946
Is it wrong to use ANOVA instead of a t-test for comparing two means?
They are equivalent. An ANOVA with only two groups is equivalent to a t-test. The difference is when you have several groups then the type I error will increase for the t-tests as you are not able to test the hypothesis jointly. ANOVA does not suffer from this problem as you jointly test them through an F-test.
Is it wrong to use ANOVA instead of a t-test for comparing two means?
They are equivalent. An ANOVA with only two groups is equivalent to a t-test. The difference is when you have several groups then the type I error will increase for the t-tests as you are not able to
Is it wrong to use ANOVA instead of a t-test for comparing two means? They are equivalent. An ANOVA with only two groups is equivalent to a t-test. The difference is when you have several groups then the type I error will increase for the t-tests as you are not able to test the hypothesis jointly. ANOVA does not suffer from this problem as you jointly test them through an F-test.
Is it wrong to use ANOVA instead of a t-test for comparing two means? They are equivalent. An ANOVA with only two groups is equivalent to a t-test. The difference is when you have several groups then the type I error will increase for the t-tests as you are not able to
24,947
Is it meaningful to calculate standard deviation of two numbers?
Compilation and expansion of comments: Let's presume your data is Normally distributed. If you want to form two-sided error bars (or confidence intervals), say at the 95% level, you will need to base that on the Student t distribution with n-1 degrees of freedom, where n is the number of data points. You propose to have 2 data points, therefore requiring use of Student t with 1 degree of freedom. 95% 2-sided error bars for n = 2 data points require a multiplicative factor of 12.71 on the sample standard deviation, not the familiar factor of 1.96 based on the Normal (Student t with $\infty$ degrees of freedom). The corresponding multiplicative factor for n = 3 data points is 4.30. The situation gets even more extreme for two-sided 99% error bars (confidence intervals). As you can see, at either confidence level, there's a big "savings" in the multiplicative factor if you have 3 data points instead of 2. And you don't get dinged as badly by the use of n-1 vs. n in the denominator of sample standard deviation. n Confidence Level Multiplicative Factor 2 0.95 12.71 3 0.95 4.30 4 0.95 3.18 5 0.95 2.78 infinity 0.95 1.96 2 0.99 63.66 3 0.99 9.92 4 0.99 5.84 5 0.99 4.60 infinity 0.99 2.58
Is it meaningful to calculate standard deviation of two numbers?
Compilation and expansion of comments: Let's presume your data is Normally distributed. If you want to form two-sided error bars (or confidence intervals), say at the 95% level, you will need to base
Is it meaningful to calculate standard deviation of two numbers? Compilation and expansion of comments: Let's presume your data is Normally distributed. If you want to form two-sided error bars (or confidence intervals), say at the 95% level, you will need to base that on the Student t distribution with n-1 degrees of freedom, where n is the number of data points. You propose to have 2 data points, therefore requiring use of Student t with 1 degree of freedom. 95% 2-sided error bars for n = 2 data points require a multiplicative factor of 12.71 on the sample standard deviation, not the familiar factor of 1.96 based on the Normal (Student t with $\infty$ degrees of freedom). The corresponding multiplicative factor for n = 3 data points is 4.30. The situation gets even more extreme for two-sided 99% error bars (confidence intervals). As you can see, at either confidence level, there's a big "savings" in the multiplicative factor if you have 3 data points instead of 2. And you don't get dinged as badly by the use of n-1 vs. n in the denominator of sample standard deviation. n Confidence Level Multiplicative Factor 2 0.95 12.71 3 0.95 4.30 4 0.95 3.18 5 0.95 2.78 infinity 0.95 1.96 2 0.99 63.66 3 0.99 9.92 4 0.99 5.84 5 0.99 4.60 infinity 0.99 2.58
Is it meaningful to calculate standard deviation of two numbers? Compilation and expansion of comments: Let's presume your data is Normally distributed. If you want to form two-sided error bars (or confidence intervals), say at the 95% level, you will need to base
24,948
Is it meaningful to calculate standard deviation of two numbers?
Setting aside your initial explanation of the time-series context, it might be useful to look at this as a simple case of observing two data points. For any two observed values $x_1 , x_2$ the sample standard deviation is $s = |x_2 - x_1| / \sqrt2$. This statistic is exactly as informative as giving the sample range of the two values (since it is just a scalar multiple of that statistic). There is nothing inherently wrong with using this statistic as information on the standard deviation of the underlying distribution, but obviously there is a great deal of variability to this statistic. The sampling distribution of the sample standard deviation depends on the underlying distribution for the observable values. In the special case where $X_1, X_2 \sim \text{IID N}(\mu, \sigma^2)$ are normal values you have $S \sim \sigma \cdot \chi_1$ which is a scaled half-normal distribution. Obviously this means that your sample standard deviation is quite a poor estimator of the standard deviation parameter (biased and with high variance), but that is to be expected with so little data.
Is it meaningful to calculate standard deviation of two numbers?
Setting aside your initial explanation of the time-series context, it might be useful to look at this as a simple case of observing two data points. For any two observed values $x_1 , x_2$ the sample
Is it meaningful to calculate standard deviation of two numbers? Setting aside your initial explanation of the time-series context, it might be useful to look at this as a simple case of observing two data points. For any two observed values $x_1 , x_2$ the sample standard deviation is $s = |x_2 - x_1| / \sqrt2$. This statistic is exactly as informative as giving the sample range of the two values (since it is just a scalar multiple of that statistic). There is nothing inherently wrong with using this statistic as information on the standard deviation of the underlying distribution, but obviously there is a great deal of variability to this statistic. The sampling distribution of the sample standard deviation depends on the underlying distribution for the observable values. In the special case where $X_1, X_2 \sim \text{IID N}(\mu, \sigma^2)$ are normal values you have $S \sim \sigma \cdot \chi_1$ which is a scaled half-normal distribution. Obviously this means that your sample standard deviation is quite a poor estimator of the standard deviation parameter (biased and with high variance), but that is to be expected with so little data.
Is it meaningful to calculate standard deviation of two numbers? Setting aside your initial explanation of the time-series context, it might be useful to look at this as a simple case of observing two data points. For any two observed values $x_1 , x_2$ the sample
24,949
Is it meaningful to calculate standard deviation of two numbers?
If you only have 2 values, just present those 2 values. It doesn't make sense to convert 2 measurements into 2 other quantities (mean and stdev) if your audience is going to argue about the significance of one or the other. If you want to estimate uncertainty, these other responses are right on, but don't forget to add other potential sources of error (measurement instrument bias errors, resolution, etc.).
Is it meaningful to calculate standard deviation of two numbers?
If you only have 2 values, just present those 2 values. It doesn't make sense to convert 2 measurements into 2 other quantities (mean and stdev) if your audience is going to argue about the significa
Is it meaningful to calculate standard deviation of two numbers? If you only have 2 values, just present those 2 values. It doesn't make sense to convert 2 measurements into 2 other quantities (mean and stdev) if your audience is going to argue about the significance of one or the other. If you want to estimate uncertainty, these other responses are right on, but don't forget to add other potential sources of error (measurement instrument bias errors, resolution, etc.).
Is it meaningful to calculate standard deviation of two numbers? If you only have 2 values, just present those 2 values. It doesn't make sense to convert 2 measurements into 2 other quantities (mean and stdev) if your audience is going to argue about the significa
24,950
Is it meaningful to calculate standard deviation of two numbers?
" I know that you could compare the two time series by taking Pearson correlation and such" -- this is incorrect. Pearson Correlation assumes observations are independent, but time series data is by nature not independent. You would actually need to use a cross-correlation. Reference: https://web.archive.org/web/20160302024823/https://onlinecourses.science.psu.edu/stat510/node/74 Also, you shouldn't use the typical variance (if you really must calculate a variance); I suggest using something like Mean Absolute Deviance (MAD). You can then create a histogram to summarise the distribution of similarity/dissimilarity.
Is it meaningful to calculate standard deviation of two numbers?
" I know that you could compare the two time series by taking Pearson correlation and such" -- this is incorrect. Pearson Correlation assumes observations are independent, but time series data is by n
Is it meaningful to calculate standard deviation of two numbers? " I know that you could compare the two time series by taking Pearson correlation and such" -- this is incorrect. Pearson Correlation assumes observations are independent, but time series data is by nature not independent. You would actually need to use a cross-correlation. Reference: https://web.archive.org/web/20160302024823/https://onlinecourses.science.psu.edu/stat510/node/74 Also, you shouldn't use the typical variance (if you really must calculate a variance); I suggest using something like Mean Absolute Deviance (MAD). You can then create a histogram to summarise the distribution of similarity/dissimilarity.
Is it meaningful to calculate standard deviation of two numbers? " I know that you could compare the two time series by taking Pearson correlation and such" -- this is incorrect. Pearson Correlation assumes observations are independent, but time series data is by n
24,951
How to get the derivative of a normal distribution w.r.t its parameters?
Just apply the chain rule for differentiation. The CDF $F_X(x; \mu, \sigma^2)$ of a $N(\mu,\sigma^2)$ random variable $X$ is $\Phi\left(\frac{x-\mu}{\sigma}\right)$ and so $$\frac{\partial}{\partial \mu}F_X(x; \mu, \sigma^2) =\frac{\partial}{\partial \mu}\Phi\left(\frac{x-\mu}{\sigma}\right) = \phi\left(\frac{x-\mu}{\sigma}\right)\frac{-1}{\sigma} = -\left[\frac{1}{\sigma}\phi\left(\frac{x-\mu}{\sigma}\right)\right]$$ where $\phi(x)$ is the standard normal density and the quantity in square brackets on the rightmost expression above can be recognized as the density of $X\sim N(\mu,\sigma^2)$. I will leave the calculation of the derivative with respect to $\sigma$ or $\sigma^2$ for you to work out for yourself.
How to get the derivative of a normal distribution w.r.t its parameters?
Just apply the chain rule for differentiation. The CDF $F_X(x; \mu, \sigma^2)$ of a $N(\mu,\sigma^2)$ random variable $X$ is $\Phi\left(\frac{x-\mu}{\sigma}\right)$ and so $$\frac{\partial}{\partial
How to get the derivative of a normal distribution w.r.t its parameters? Just apply the chain rule for differentiation. The CDF $F_X(x; \mu, \sigma^2)$ of a $N(\mu,\sigma^2)$ random variable $X$ is $\Phi\left(\frac{x-\mu}{\sigma}\right)$ and so $$\frac{\partial}{\partial \mu}F_X(x; \mu, \sigma^2) =\frac{\partial}{\partial \mu}\Phi\left(\frac{x-\mu}{\sigma}\right) = \phi\left(\frac{x-\mu}{\sigma}\right)\frac{-1}{\sigma} = -\left[\frac{1}{\sigma}\phi\left(\frac{x-\mu}{\sigma}\right)\right]$$ where $\phi(x)$ is the standard normal density and the quantity in square brackets on the rightmost expression above can be recognized as the density of $X\sim N(\mu,\sigma^2)$. I will leave the calculation of the derivative with respect to $\sigma$ or $\sigma^2$ for you to work out for yourself.
How to get the derivative of a normal distribution w.r.t its parameters? Just apply the chain rule for differentiation. The CDF $F_X(x; \mu, \sigma^2)$ of a $N(\mu,\sigma^2)$ random variable $X$ is $\Phi\left(\frac{x-\mu}{\sigma}\right)$ and so $$\frac{\partial}{\partial
24,952
How to get the derivative of a normal distribution w.r.t its parameters?
It's a simple calculus. Remember that an integral (which is the cumulative probability function) is basically a sum. So, a derivative of a sum is the same as a sum of derivatives. Hence, you simply differentiate the function (i.e. density) under the integral, and integrate. This was my bastardized version of the fundamental theorem of calculus, that some didn't like here. Here's how you'd do it with the normal probability. First, the general relation for probability function $F(x;\mu,\sigma)$ and the density $f(x;\mu,\sigma)$ where the mean and the standard deviation are the parameters: $$\frac{\partial}{\partial \mu} F(x;\mu,\sigma)=\frac{\partial}{\partial \mu}\int_{-\infty}^x f(x;\mu,\sigma) dx=\int_{-\infty}^x \frac{\partial}{\partial \mu} f(x;\mu,\sigma) dx$$ You, actually, used a more general form of this manipulation called Leibnitz rule when you mentioned that the differentiation of the probability function by the variable itself (i.e. $\frac{\partial}{\partial x}$) will give you the density (PDF). Next, plug the density: $$=\int_{-\infty}^x \frac{\partial}{\partial \mu} \frac{e^{-(x-\mu)^2/\sigma^2}}{\sqrt{2\pi}\sigma} dx=\int_{-\infty}^x\frac{2(x-\mu)}{\sigma^2} \frac{e^{-(x-\mu)^2/\sigma^2}}{\sqrt{2\pi}\sigma} dx$$ Change of variables $\xi=\frac{(x-\mu)^2}{\sigma^2}$: $$=\frac{1}{\sqrt{2\pi}\sigma}\left(-\int_0^\infty e^{-\xi} d\xi + \int_{0}^{\xi(x)} e^{-\xi}d\xi\right) =\frac{1}{\sqrt{2\pi}\sigma}\left( -1-(e^{-\xi(x)}-1) \right)$$ $$=-\frac{e^{-\frac{(x-\mu)^2}{\sigma^2}}}{\sqrt{2\pi}\sigma}$$ Hence, you have the following: $$\frac{\partial}{\partial \mu} F(x;\mu,\sigma)=-f(x;\mu,\sigma)$$ You can a similar trick with the variance.
How to get the derivative of a normal distribution w.r.t its parameters?
It's a simple calculus. Remember that an integral (which is the cumulative probability function) is basically a sum. So, a derivative of a sum is the same as a sum of derivatives. Hence, you simply di
How to get the derivative of a normal distribution w.r.t its parameters? It's a simple calculus. Remember that an integral (which is the cumulative probability function) is basically a sum. So, a derivative of a sum is the same as a sum of derivatives. Hence, you simply differentiate the function (i.e. density) under the integral, and integrate. This was my bastardized version of the fundamental theorem of calculus, that some didn't like here. Here's how you'd do it with the normal probability. First, the general relation for probability function $F(x;\mu,\sigma)$ and the density $f(x;\mu,\sigma)$ where the mean and the standard deviation are the parameters: $$\frac{\partial}{\partial \mu} F(x;\mu,\sigma)=\frac{\partial}{\partial \mu}\int_{-\infty}^x f(x;\mu,\sigma) dx=\int_{-\infty}^x \frac{\partial}{\partial \mu} f(x;\mu,\sigma) dx$$ You, actually, used a more general form of this manipulation called Leibnitz rule when you mentioned that the differentiation of the probability function by the variable itself (i.e. $\frac{\partial}{\partial x}$) will give you the density (PDF). Next, plug the density: $$=\int_{-\infty}^x \frac{\partial}{\partial \mu} \frac{e^{-(x-\mu)^2/\sigma^2}}{\sqrt{2\pi}\sigma} dx=\int_{-\infty}^x\frac{2(x-\mu)}{\sigma^2} \frac{e^{-(x-\mu)^2/\sigma^2}}{\sqrt{2\pi}\sigma} dx$$ Change of variables $\xi=\frac{(x-\mu)^2}{\sigma^2}$: $$=\frac{1}{\sqrt{2\pi}\sigma}\left(-\int_0^\infty e^{-\xi} d\xi + \int_{0}^{\xi(x)} e^{-\xi}d\xi\right) =\frac{1}{\sqrt{2\pi}\sigma}\left( -1-(e^{-\xi(x)}-1) \right)$$ $$=-\frac{e^{-\frac{(x-\mu)^2}{\sigma^2}}}{\sqrt{2\pi}\sigma}$$ Hence, you have the following: $$\frac{\partial}{\partial \mu} F(x;\mu,\sigma)=-f(x;\mu,\sigma)$$ You can a similar trick with the variance.
How to get the derivative of a normal distribution w.r.t its parameters? It's a simple calculus. Remember that an integral (which is the cumulative probability function) is basically a sum. So, a derivative of a sum is the same as a sum of derivatives. Hence, you simply di
24,953
Popular named entity resolution software
The problem of named entity resolution is referred to as multiple terms, including deduplication and record linkage. I doubt that it is possible to determine precisely, what software belong to some of the most popular for solving that problem. There are various approaches and algorithms can be used for named entity resolution. Therefore, software which implements those can be seen as complementary to each other (perhaps, there exist multiple research studies that compare and benchmark entity resolution approaches and algorithms, but so far I have seen only two of them - see references below, denoted with a triple asterisk "***"). This nice tutorial (in a form of presentation slides) on entity resolution provides a comprehensive overview of the problem and the solutions, including both approaches and algorithms. The tutorial also provides an extensive set of references to sources with further information. Speaking about corresponding software, one may find open source or dual-license projects, such as Java-based Stanford NLP Group software (which includes Stanford named entity recognizer (NER)), Stanford Entity Resolution Framework (SERF), LingPipe (which includes a NER module) and Duke library, as well as Python-based NLTK software (http://www.nltk.org/book/ch07.html). I realize that named entity recognition and resolution are quite different tasks, however, some of the above-referenced software, focused on the former, might be useful for the latter, by using appropriate code segments. Additionally, the following IMHO related/relevant software and papers might also be of interest: Information Extraction framework in Python; GATE software, in particular, ANNIE information extraction system; several other NER tools, mentioned in this paper***; this excellent overview*** of NER approaches, including neural networks and deep learning; Ontotext's S4 (Self-Service Semantic Suite) on-demand software provides access to linked data repositories, such as DBpedia, Freebase and GeoNames; Elasticsearch NER plug-in for Duke; this paper on Swoosh algorithms, implemented by SERF software; Wikilinks Corpus, released by Google; this paper on entity disambiguation; book "Data Matching" on record linkage, entity resolution, and duplicate detection.
Popular named entity resolution software
The problem of named entity resolution is referred to as multiple terms, including deduplication and record linkage. I doubt that it is possible to determine precisely, what software belong to some of
Popular named entity resolution software The problem of named entity resolution is referred to as multiple terms, including deduplication and record linkage. I doubt that it is possible to determine precisely, what software belong to some of the most popular for solving that problem. There are various approaches and algorithms can be used for named entity resolution. Therefore, software which implements those can be seen as complementary to each other (perhaps, there exist multiple research studies that compare and benchmark entity resolution approaches and algorithms, but so far I have seen only two of them - see references below, denoted with a triple asterisk "***"). This nice tutorial (in a form of presentation slides) on entity resolution provides a comprehensive overview of the problem and the solutions, including both approaches and algorithms. The tutorial also provides an extensive set of references to sources with further information. Speaking about corresponding software, one may find open source or dual-license projects, such as Java-based Stanford NLP Group software (which includes Stanford named entity recognizer (NER)), Stanford Entity Resolution Framework (SERF), LingPipe (which includes a NER module) and Duke library, as well as Python-based NLTK software (http://www.nltk.org/book/ch07.html). I realize that named entity recognition and resolution are quite different tasks, however, some of the above-referenced software, focused on the former, might be useful for the latter, by using appropriate code segments. Additionally, the following IMHO related/relevant software and papers might also be of interest: Information Extraction framework in Python; GATE software, in particular, ANNIE information extraction system; several other NER tools, mentioned in this paper***; this excellent overview*** of NER approaches, including neural networks and deep learning; Ontotext's S4 (Self-Service Semantic Suite) on-demand software provides access to linked data repositories, such as DBpedia, Freebase and GeoNames; Elasticsearch NER plug-in for Duke; this paper on Swoosh algorithms, implemented by SERF software; Wikilinks Corpus, released by Google; this paper on entity disambiguation; book "Data Matching" on record linkage, entity resolution, and duplicate detection.
Popular named entity resolution software The problem of named entity resolution is referred to as multiple terms, including deduplication and record linkage. I doubt that it is possible to determine precisely, what software belong to some of
24,954
Popular named entity resolution software
Be careful not to confuse "entity resolution" with "named entity recognition". Named entity recognition refers to finding named entities (for example proper nouns) in text. That's what your original question asked for. You can do this in NLTK & Python for example, or using Stanford's NER tool. Entity matching (or entity resolution) is also called data deduplication or record linkage. This is not the same thing as NER. Entity matching says, "given these two entities, are they the same thing?" To match entities, we may look at features about them, for example if we are trying to decide if Mary Smith is the same as Mary Q. Smith, we might check to see if the street addresses are the same for both people. We can also use string distances or other metrics (Levenshtein, soundex, etc) on the names themselves to see if they are "close enough" to possibly represent the same person. But entity matching and named entity recognition are NOT the same thing.
Popular named entity resolution software
Be careful not to confuse "entity resolution" with "named entity recognition". Named entity recognition refers to finding named entities (for example proper nouns) in text. That's what your original q
Popular named entity resolution software Be careful not to confuse "entity resolution" with "named entity recognition". Named entity recognition refers to finding named entities (for example proper nouns) in text. That's what your original question asked for. You can do this in NLTK & Python for example, or using Stanford's NER tool. Entity matching (or entity resolution) is also called data deduplication or record linkage. This is not the same thing as NER. Entity matching says, "given these two entities, are they the same thing?" To match entities, we may look at features about them, for example if we are trying to decide if Mary Smith is the same as Mary Q. Smith, we might check to see if the street addresses are the same for both people. We can also use string distances or other metrics (Levenshtein, soundex, etc) on the names themselves to see if they are "close enough" to possibly represent the same person. But entity matching and named entity recognition are NOT the same thing.
Popular named entity resolution software Be careful not to confuse "entity resolution" with "named entity recognition". Named entity recognition refers to finding named entities (for example proper nouns) in text. That's what your original q
24,955
Popular named entity resolution software
I've come across DataMatch by Data Ladder, which is a great fuzzy matching and entity resolution tool used across business and would work really well for this situation. They offer a complimentary trial for new users. In fact, an independent verified evaluation was done of the software comparing it to major software tools by IBM and SAS. There was a study done at Curtin University Centre for Data Linkage in Australia that simulated the matching of 4.4 million records. It identified what providers had in terms of accuracy (Number of matches found vs available. Number of false matches) 1. DataMatch Enterprise, Highest Accuracy (>95%), Very Fast, Low Cost 2. IBM Quality Stage, High Accuracy (>90%), Very Fast, High Cost (>$100K) 3. SAS Data Flux, Medium Accuracy (>85%), Fast, High Cost (>100K)
Popular named entity resolution software
I've come across DataMatch by Data Ladder, which is a great fuzzy matching and entity resolution tool used across business and would work really well for this situation. They offer a complimentary tri
Popular named entity resolution software I've come across DataMatch by Data Ladder, which is a great fuzzy matching and entity resolution tool used across business and would work really well for this situation. They offer a complimentary trial for new users. In fact, an independent verified evaluation was done of the software comparing it to major software tools by IBM and SAS. There was a study done at Curtin University Centre for Data Linkage in Australia that simulated the matching of 4.4 million records. It identified what providers had in terms of accuracy (Number of matches found vs available. Number of false matches) 1. DataMatch Enterprise, Highest Accuracy (>95%), Very Fast, Low Cost 2. IBM Quality Stage, High Accuracy (>90%), Very Fast, High Cost (>$100K) 3. SAS Data Flux, Medium Accuracy (>85%), Fast, High Cost (>100K)
Popular named entity resolution software I've come across DataMatch by Data Ladder, which is a great fuzzy matching and entity resolution tool used across business and would work really well for this situation. They offer a complimentary tri
24,956
Popular named entity resolution software
Ralph, These are deduplicaton tools for data ETL, IBM's Quality Stage is a data deduplication tool mainly used during processing data during typical data ETL, it is not an Entity Resolution tool. There is a difference between the two concepts. For entity resolution, try IBM InfoSphere MDM or IBM InfoSphere Identity Insight.
Popular named entity resolution software
Ralph, These are deduplicaton tools for data ETL, IBM's Quality Stage is a data deduplication tool mainly used during processing data during typical data ETL, it is not an Entity Resolution tool. The
Popular named entity resolution software Ralph, These are deduplicaton tools for data ETL, IBM's Quality Stage is a data deduplication tool mainly used during processing data during typical data ETL, it is not an Entity Resolution tool. There is a difference between the two concepts. For entity resolution, try IBM InfoSphere MDM or IBM InfoSphere Identity Insight.
Popular named entity resolution software Ralph, These are deduplicaton tools for data ETL, IBM's Quality Stage is a data deduplication tool mainly used during processing data during typical data ETL, it is not an Entity Resolution tool. The
24,957
Textbook deriving Metropolis-Hastings and Gibbs Sampling
For a handbook and an extensive coverage, the following one is very moderately priced. Brooks, et al. (ed.), Handbook of Markov Chain Monte Carlo, Chapman & Hall/CRC, 2011. Robert and Casella (2010) have a good deal of theory.
Textbook deriving Metropolis-Hastings and Gibbs Sampling
For a handbook and an extensive coverage, the following one is very moderately priced. Brooks, et al. (ed.), Handbook of Markov Chain Monte Carlo, Chapman & Hall/CRC, 2011. Robert and Casella (2010)
Textbook deriving Metropolis-Hastings and Gibbs Sampling For a handbook and an extensive coverage, the following one is very moderately priced. Brooks, et al. (ed.), Handbook of Markov Chain Monte Carlo, Chapman & Hall/CRC, 2011. Robert and Casella (2010) have a good deal of theory.
Textbook deriving Metropolis-Hastings and Gibbs Sampling For a handbook and an extensive coverage, the following one is very moderately priced. Brooks, et al. (ed.), Handbook of Markov Chain Monte Carlo, Chapman & Hall/CRC, 2011. Robert and Casella (2010)
24,958
Textbook deriving Metropolis-Hastings and Gibbs Sampling
I'm not sure whether this is exactly what you're after, but a couple of articles I've found useful on theoretical properties of various Metropolis-Hastings algorithms are: Optimal scaling for various Metropolis-Hastings algorithms - Roberts & Rosenthal, 2001. (This summarises some earlier results for the Ransom walk Metropolis and the Metropolis-adjusted Langevin algorithm.) The Random Walk Metropolis: linking theory and practice through a case study - Sherlock, Fearnhead & Roberts, 2009 (This may be a good bridge between theoretical properties and practical use, as suggested by the title.) The book by Robert & Casella (mentioned above) is a very good and thorough resource, but you may also find these two of use: Markov Chain Monte Carlo in Practice - Gilks, Richardson & Spiegelhalter (1995) Markov Chain Monte Carlo: Stochastic simulation for Bayesian inference - Gamerman (2006) These both also have information on Gibbs sampling. I suppose you may also find some other information on Markov Chains useful. I generally use: Markov Chains - Norris, (1998). But there is also some good information in most MCMC books on this.
Textbook deriving Metropolis-Hastings and Gibbs Sampling
I'm not sure whether this is exactly what you're after, but a couple of articles I've found useful on theoretical properties of various Metropolis-Hastings algorithms are: Optimal scaling for various
Textbook deriving Metropolis-Hastings and Gibbs Sampling I'm not sure whether this is exactly what you're after, but a couple of articles I've found useful on theoretical properties of various Metropolis-Hastings algorithms are: Optimal scaling for various Metropolis-Hastings algorithms - Roberts & Rosenthal, 2001. (This summarises some earlier results for the Ransom walk Metropolis and the Metropolis-adjusted Langevin algorithm.) The Random Walk Metropolis: linking theory and practice through a case study - Sherlock, Fearnhead & Roberts, 2009 (This may be a good bridge between theoretical properties and practical use, as suggested by the title.) The book by Robert & Casella (mentioned above) is a very good and thorough resource, but you may also find these two of use: Markov Chain Monte Carlo in Practice - Gilks, Richardson & Spiegelhalter (1995) Markov Chain Monte Carlo: Stochastic simulation for Bayesian inference - Gamerman (2006) These both also have information on Gibbs sampling. I suppose you may also find some other information on Markov Chains useful. I generally use: Markov Chains - Norris, (1998). But there is also some good information in most MCMC books on this.
Textbook deriving Metropolis-Hastings and Gibbs Sampling I'm not sure whether this is exactly what you're after, but a couple of articles I've found useful on theoretical properties of various Metropolis-Hastings algorithms are: Optimal scaling for various
24,959
Textbook deriving Metropolis-Hastings and Gibbs Sampling
In addition to the already excellent references provided above, I'd like to suggest the paper Markov chains for exploring posterior distributions (with discussion). by L. Tierney. It is one of the most influential MCMC theory articles of the 1990s, which carefully studies the assumptions needed to analyze the Markov chains and their properties (e.g. convergence of ergodic averages and central limit theorems).
Textbook deriving Metropolis-Hastings and Gibbs Sampling
In addition to the already excellent references provided above, I'd like to suggest the paper Markov chains for exploring posterior distributions (with discussion). by L. Tierney. It is one of the mos
Textbook deriving Metropolis-Hastings and Gibbs Sampling In addition to the already excellent references provided above, I'd like to suggest the paper Markov chains for exploring posterior distributions (with discussion). by L. Tierney. It is one of the most influential MCMC theory articles of the 1990s, which carefully studies the assumptions needed to analyze the Markov chains and their properties (e.g. convergence of ergodic averages and central limit theorems).
Textbook deriving Metropolis-Hastings and Gibbs Sampling In addition to the already excellent references provided above, I'd like to suggest the paper Markov chains for exploring posterior distributions (with discussion). by L. Tierney. It is one of the mos
24,960
Variance of resistors in parallel
The equivalent resistance $R$ of the entire circuit solves $$ \frac1R=\sum_{i=1}^{3}\frac{1}{R_i}. $$ One assumes that $R_i=i\mu+\sigma\sqrt{i}Z_i$, for some independent random variables $Z_i$, centered and with variance $1$. Without further indications, one cannot compute the variance of $R$, hence, to go further, we consider the regime where $$ \color{red}{\sigma\ll\mu}. $$ Then, $$ \frac{1}{R_i}=\frac1{i\mu}-\frac{\sigma}{\mu^2}\frac{Z_i}{i\sqrt{i}}+\text{higher order terms}, $$ hence $$ \frac{1}{R}=\frac{a}{\mu}-\frac{\sigma}{\mu^2}Z+\text{higher order terms}, $$ where $$ a=\sum_{i=1}^{3}\frac1{i}=\frac{11}6,\qquad Z=\sum_{i=1}^{3}\frac{Z_i}{i\sqrt{i}}. $$ One sees that $$ \mathrm E(Z)=0,\qquad\mathrm E(Z^2)=b,\qquad b=\sum\limits_{i=1}^{3}\frac1{i^3}=\frac{251}{216}. $$ Furthermore, $$ R=\frac{\mu}a-\frac{\sigma}{a^2}Z+\text{higher order terms}, $$ Thus, in the limit $\sigma\to0$, $$ \mathrm E(R)\approx\frac{\mu}a=\frac6{11}\mu, $$ and $$ \text{Var}(R)\approx\sigma^2\cdot\frac{b}{a^4}=\sigma^2\cdot\left(\frac{6}{11}\right)^4\cdot\frac{251}{216}=\sigma^2\cdot0.10286\ldots $$ These asymptotics of $\mathrm E(R)$ and $\text{Var}(R)$ can be generalized to any number of resistances in parallel, each being the result of $n_i$ elementary resistances in series, the elementary resistances being independent and each with mean $\mu$ and variance $\sigma^2$. Then, when $\sigma\to0$, $$ \mathrm E(R)\to\frac{\mu}a,\quad \sigma^{-2}\text{Var}(R)\to\frac{b}{a^4}, $$ where $$ a=\sum_i\frac1{n_i},\quad b=\sum_i\frac1{n_i^3}. $$
Variance of resistors in parallel
The equivalent resistance $R$ of the entire circuit solves $$ \frac1R=\sum_{i=1}^{3}\frac{1}{R_i}. $$ One assumes that $R_i=i\mu+\sigma\sqrt{i}Z_i$, for some independent random variables $Z_i$, center
Variance of resistors in parallel The equivalent resistance $R$ of the entire circuit solves $$ \frac1R=\sum_{i=1}^{3}\frac{1}{R_i}. $$ One assumes that $R_i=i\mu+\sigma\sqrt{i}Z_i$, for some independent random variables $Z_i$, centered and with variance $1$. Without further indications, one cannot compute the variance of $R$, hence, to go further, we consider the regime where $$ \color{red}{\sigma\ll\mu}. $$ Then, $$ \frac{1}{R_i}=\frac1{i\mu}-\frac{\sigma}{\mu^2}\frac{Z_i}{i\sqrt{i}}+\text{higher order terms}, $$ hence $$ \frac{1}{R}=\frac{a}{\mu}-\frac{\sigma}{\mu^2}Z+\text{higher order terms}, $$ where $$ a=\sum_{i=1}^{3}\frac1{i}=\frac{11}6,\qquad Z=\sum_{i=1}^{3}\frac{Z_i}{i\sqrt{i}}. $$ One sees that $$ \mathrm E(Z)=0,\qquad\mathrm E(Z^2)=b,\qquad b=\sum\limits_{i=1}^{3}\frac1{i^3}=\frac{251}{216}. $$ Furthermore, $$ R=\frac{\mu}a-\frac{\sigma}{a^2}Z+\text{higher order terms}, $$ Thus, in the limit $\sigma\to0$, $$ \mathrm E(R)\approx\frac{\mu}a=\frac6{11}\mu, $$ and $$ \text{Var}(R)\approx\sigma^2\cdot\frac{b}{a^4}=\sigma^2\cdot\left(\frac{6}{11}\right)^4\cdot\frac{251}{216}=\sigma^2\cdot0.10286\ldots $$ These asymptotics of $\mathrm E(R)$ and $\text{Var}(R)$ can be generalized to any number of resistances in parallel, each being the result of $n_i$ elementary resistances in series, the elementary resistances being independent and each with mean $\mu$ and variance $\sigma^2$. Then, when $\sigma\to0$, $$ \mathrm E(R)\to\frac{\mu}a,\quad \sigma^{-2}\text{Var}(R)\to\frac{b}{a^4}, $$ where $$ a=\sum_i\frac1{n_i},\quad b=\sum_i\frac1{n_i^3}. $$
Variance of resistors in parallel The equivalent resistance $R$ of the entire circuit solves $$ \frac1R=\sum_{i=1}^{3}\frac{1}{R_i}. $$ One assumes that $R_i=i\mu+\sigma\sqrt{i}Z_i$, for some independent random variables $Z_i$, center
24,961
Variance of resistors in parallel
I don't think the exact answer depends only on $\mu$ and $\sigma^2$. When you sampled, I suppose you must have used some concrete distribution – probably a normal distribution? In any case, we can calculate the mean and variance of the resistance of the circuit in linear approximation, and then the exact form of the distribution is irrelevant. The resistance of the circuit is $\left(R_1^{-1}+R_2^{-1}+R_3^{-1}\right)^{-1}$. In linear approximation, the mean and variance of the reciprocal of a random variable with mean $\mu$ and variance $\sigma^2$ are $1/\mu$ and $\sigma^2/\mu^4$, respectively. Thus we have a sum of terms with means $1/\mu$, $1/(2\mu)$ and $1/(3\mu)$ and variances $\sigma^2/\mu^4$, $\sigma^2/(8\mu^4)$ and $\sigma^2/(27\mu^4)$, respectively, which adds up to a mean of $\frac{11}6/\mu$ and a variance of $\frac{251}{216}\sigma^2/\mu^4$. Then taking the reciprocal of that yields a mean of $\frac6{11}\mu$ and a variance of $\left(\frac{251}{216}\sigma^2/\mu^4\right)/\left(\frac{11}6/\mu\right)^4=\frac{1506}{14641}\sigma^2\approx0.10286\sigma^2$, in agreement with your result.
Variance of resistors in parallel
I don't think the exact answer depends only on $\mu$ and $\sigma^2$. When you sampled, I suppose you must have used some concrete distribution – probably a normal distribution? In any case, we can cal
Variance of resistors in parallel I don't think the exact answer depends only on $\mu$ and $\sigma^2$. When you sampled, I suppose you must have used some concrete distribution – probably a normal distribution? In any case, we can calculate the mean and variance of the resistance of the circuit in linear approximation, and then the exact form of the distribution is irrelevant. The resistance of the circuit is $\left(R_1^{-1}+R_2^{-1}+R_3^{-1}\right)^{-1}$. In linear approximation, the mean and variance of the reciprocal of a random variable with mean $\mu$ and variance $\sigma^2$ are $1/\mu$ and $\sigma^2/\mu^4$, respectively. Thus we have a sum of terms with means $1/\mu$, $1/(2\mu)$ and $1/(3\mu)$ and variances $\sigma^2/\mu^4$, $\sigma^2/(8\mu^4)$ and $\sigma^2/(27\mu^4)$, respectively, which adds up to a mean of $\frac{11}6/\mu$ and a variance of $\frac{251}{216}\sigma^2/\mu^4$. Then taking the reciprocal of that yields a mean of $\frac6{11}\mu$ and a variance of $\left(\frac{251}{216}\sigma^2/\mu^4\right)/\left(\frac{11}6/\mu\right)^4=\frac{1506}{14641}\sigma^2\approx0.10286\sigma^2$, in agreement with your result.
Variance of resistors in parallel I don't think the exact answer depends only on $\mu$ and $\sigma^2$. When you sampled, I suppose you must have used some concrete distribution – probably a normal distribution? In any case, we can cal
24,962
Variance of resistors in parallel
This depends on the shape of the distribution for the resistance. Without knowing the distribution, I can't even say the average resistance, although I think there are constraints. So, let's pick a distribution which is tractible: Let $s$ be the standard deviation of the resistance of one resistor. Let the resistance be $\mu \pm s$, with each sign occurring with with probability $1/2$. This gives us $2^6 = 64$ cases to consider, or $2 \times 3 \times 4=24$ if we combine some cases. Of course we'll assume the resistances are independent. If we choose $\mu = 100$ and $s=1$ then the mean is $54.543291$ (slightly lower than $100 \times \frac{6}{11}$), and the variance is $0.102864$. If we choose $\mu = 5$ and $s=1$, then the variance is $0.103693$. Here is a power series expansion for the ratios between the variances when the mean is $1$ and the variance is $x$: $\frac{1506}{14641} + \frac{36000}{1771561}x + \frac{218016}{19487171}x^2 + O(x^3)$. When $x$ is small, the dominant term is $\frac{1506}{14641} = 0.102862$. While the question you ask technically depends on the distribution, you are probably interested in situations where the standard deviation is small compared with the mean, and I think there is a well-defined limit which doesn't depend on the distribution. Linearize the dependence of the circuit's resistance as a function of the resistances of each piece: $$C = \frac {1}{1/R_1 + 1/(R_2+R_3) + 1/(R_4 + R_5 + R_6)}$$ $$ \approx \frac{6}{11} \mu + \sum_{i=1}^6 (R_i - \mu)\frac {\partial C}{\partial R_i}(\mu,\mu,\mu,\mu,\mu,\mu)$$ $$\therefore \text{Var}(C) \approx \sum_{i=1}^6 \text{Var}(R_i)\bigg(\frac {\partial C}{\partial R_i}(\mu,\mu,\mu,\mu,\mu,\mu)\bigg)^2 $$ With this specific circuit, the scaled partial derivatives are $\frac {36}{121}, \frac{9}{121} ,\frac{9}{121}, \frac{4}{121},\frac{4}{121},\frac{4}{121} $, and $$ \bigg(\frac{36}{121}\bigg)^2 + 2\bigg(\frac{9}{121}\bigg)^2 + 3\bigg(\frac{4}{121}\bigg)^2 = \frac{1506}{14641} = 0.102862$$
Variance of resistors in parallel
This depends on the shape of the distribution for the resistance. Without knowing the distribution, I can't even say the average resistance, although I think there are constraints. So, let's pick a di
Variance of resistors in parallel This depends on the shape of the distribution for the resistance. Without knowing the distribution, I can't even say the average resistance, although I think there are constraints. So, let's pick a distribution which is tractible: Let $s$ be the standard deviation of the resistance of one resistor. Let the resistance be $\mu \pm s$, with each sign occurring with with probability $1/2$. This gives us $2^6 = 64$ cases to consider, or $2 \times 3 \times 4=24$ if we combine some cases. Of course we'll assume the resistances are independent. If we choose $\mu = 100$ and $s=1$ then the mean is $54.543291$ (slightly lower than $100 \times \frac{6}{11}$), and the variance is $0.102864$. If we choose $\mu = 5$ and $s=1$, then the variance is $0.103693$. Here is a power series expansion for the ratios between the variances when the mean is $1$ and the variance is $x$: $\frac{1506}{14641} + \frac{36000}{1771561}x + \frac{218016}{19487171}x^2 + O(x^3)$. When $x$ is small, the dominant term is $\frac{1506}{14641} = 0.102862$. While the question you ask technically depends on the distribution, you are probably interested in situations where the standard deviation is small compared with the mean, and I think there is a well-defined limit which doesn't depend on the distribution. Linearize the dependence of the circuit's resistance as a function of the resistances of each piece: $$C = \frac {1}{1/R_1 + 1/(R_2+R_3) + 1/(R_4 + R_5 + R_6)}$$ $$ \approx \frac{6}{11} \mu + \sum_{i=1}^6 (R_i - \mu)\frac {\partial C}{\partial R_i}(\mu,\mu,\mu,\mu,\mu,\mu)$$ $$\therefore \text{Var}(C) \approx \sum_{i=1}^6 \text{Var}(R_i)\bigg(\frac {\partial C}{\partial R_i}(\mu,\mu,\mu,\mu,\mu,\mu)\bigg)^2 $$ With this specific circuit, the scaled partial derivatives are $\frac {36}{121}, \frac{9}{121} ,\frac{9}{121}, \frac{4}{121},\frac{4}{121},\frac{4}{121} $, and $$ \bigg(\frac{36}{121}\bigg)^2 + 2\bigg(\frac{9}{121}\bigg)^2 + 3\bigg(\frac{4}{121}\bigg)^2 = \frac{1506}{14641} = 0.102862$$
Variance of resistors in parallel This depends on the shape of the distribution for the resistance. Without knowing the distribution, I can't even say the average resistance, although I think there are constraints. So, let's pick a di
24,963
Variance of resistors in parallel
I warn that, as I reasoned it, this is a long answer, but maybe someone can come up with something better starting from my attempt (which may not be optimal). Also, I misread the original OPs question and thought it said that the resistances where normally distributed. I'll leave the answer anyways, but that's an underlying supposition. 1. Physical reasoning of the problem My reasoning is as follows: recall that, for resistors that are in paralel, the equivalent resistance $R_{eq}$ is given by: $$R_{eq}^{-1}=\sum_{i}^{N}\frac{1}{R_i},$$ where $R_i$ are the resistances of each part of the circuit. In your case, this gives us $$R_{eq}=\left(\frac{1}{R_1}+\frac{1}{R_2}+\frac{1}{R_3}\right)^{-1},\ \ \ (*)$$ where $R_1$ is the part of the circuit with 1 resistance, and has therefore a normal distribution with mean $\mu$ and variance $\sigma^2$, and by the same reasoning $R_2\sim N(2\mu,2\sigma^2)$ is the equivalent resistance of the part of the circuit with two resistances and, finally, $R_3\sim N(3\mu,3\sigma^2)$ is the equivalent resistance of the part of the circuit with three resistances. You ought to find the distribution of $R_{eq}$ and from there obtain the variance of it. 2. Obtaining the distribution of $R_{eq}$ One way to find the distribution is by noting that: $$p(R_{eq})=\int p(R_{eq},R_1,R_2,R_3)dR_1dR_2dR_3=\int p(R_1|R_{eq},R_2,R_3)p(R_{eq},R_2,R_3)dR_1dR_2dR_3.\ \ \ (1)$$ From here, we also note that we can write $$p(R_{eq},R_2,R_3)=p(R_2|R_{eq},R_3)p(R_{eq},R_3)=p(R_2|R_{eq},R_3)p(R_{eq}|R_3)p(R_3)$$ (which was obtained via the Bayes Theorem), which, assuming independance between $R_1$, $R_2$ and $R_3$ (which is physically plausible), can be written as $$p(R_{eq},R_2,R_3)=p(R_2|R_{eq})p(R_{eq}|R_3)p(R_3).$$ Replacing this in $(1)$ and noting that another consequence of the independance between the three resistances is that $p(R_1|R_{eq},R_2,R_3)=p(R_1|R_{eq})$, we get: $$p(R_{eq})=\int p(R_1|R_{eq})p(R_2|R_{eq})p(R_{eq}|R_3)p(R_3)dR_1dR_2dR_3=\int p(R_{eq}|R_3)p(R_3)dR_3.\ \ \ (2)$$ Our last problem then is to find $p(R_{eq}|R_3)$, i.e., the distribution of the r.v. $R_{eq}|R_3$. This problem is analogous to the one we found here, except that now you replace $R_3$ in eq. $(*)$ by a constant, say, $r_3$. Following the same arguments as above, you can find that $$p(R_{eq}|R_3)=\int p(R_{eq}|R_2,R_3)p(R_2)dR_2.\ \ \ (3)$$ Apparently the rest is replacing the known distributions, except for a little problem: the distribution of $R_{eq}|R_2,R_3$ can be obtained from $(*)$ by noting that $X_1$ is gaussian, so, you essentially need to find the distribution of the random variable $$W=\left(\frac{1}{X}+a+b\right)^{-1},$$ where $a$ and $b$ are constants, and $X$ is gaussian with mean $\mu$ and variance $\sigma^2$. If my calculations are correct, this distribution is: $$p(W)=\frac{1}{[1-W(a+b)]^2}\frac{1}{\sqrt{2\pi \sigma^2}}\text{exp}\left(-\frac{X(W)-\mu}{2\sigma^2}\right),$$ where, $$X(W)=\frac{1}{W^{-1}-a-b},$$ so $R_{eq}|R_2,R_3$'s distribution would be $$p(R_{eq}|R_2,R_3)=\frac{1}{[1-R_{eq}(a+b)]^2}\frac{1}{\sqrt{2\pi \sigma^2}}\text{exp}\left(-\frac{X(R_{eq})-\mu}{2\sigma^2}\right),$$ where $a=1/R_2$ and $b=1/R_3$. The thing is that I don't know if this is analytically tractable in order to solve the integral in equation $(3)$, which then will lead us to solve the poblem by replacing it's result in equation $(2)$. At least to me at this time of the night it is not.
Variance of resistors in parallel
I warn that, as I reasoned it, this is a long answer, but maybe someone can come up with something better starting from my attempt (which may not be optimal). Also, I misread the original OPs question
Variance of resistors in parallel I warn that, as I reasoned it, this is a long answer, but maybe someone can come up with something better starting from my attempt (which may not be optimal). Also, I misread the original OPs question and thought it said that the resistances where normally distributed. I'll leave the answer anyways, but that's an underlying supposition. 1. Physical reasoning of the problem My reasoning is as follows: recall that, for resistors that are in paralel, the equivalent resistance $R_{eq}$ is given by: $$R_{eq}^{-1}=\sum_{i}^{N}\frac{1}{R_i},$$ where $R_i$ are the resistances of each part of the circuit. In your case, this gives us $$R_{eq}=\left(\frac{1}{R_1}+\frac{1}{R_2}+\frac{1}{R_3}\right)^{-1},\ \ \ (*)$$ where $R_1$ is the part of the circuit with 1 resistance, and has therefore a normal distribution with mean $\mu$ and variance $\sigma^2$, and by the same reasoning $R_2\sim N(2\mu,2\sigma^2)$ is the equivalent resistance of the part of the circuit with two resistances and, finally, $R_3\sim N(3\mu,3\sigma^2)$ is the equivalent resistance of the part of the circuit with three resistances. You ought to find the distribution of $R_{eq}$ and from there obtain the variance of it. 2. Obtaining the distribution of $R_{eq}$ One way to find the distribution is by noting that: $$p(R_{eq})=\int p(R_{eq},R_1,R_2,R_3)dR_1dR_2dR_3=\int p(R_1|R_{eq},R_2,R_3)p(R_{eq},R_2,R_3)dR_1dR_2dR_3.\ \ \ (1)$$ From here, we also note that we can write $$p(R_{eq},R_2,R_3)=p(R_2|R_{eq},R_3)p(R_{eq},R_3)=p(R_2|R_{eq},R_3)p(R_{eq}|R_3)p(R_3)$$ (which was obtained via the Bayes Theorem), which, assuming independance between $R_1$, $R_2$ and $R_3$ (which is physically plausible), can be written as $$p(R_{eq},R_2,R_3)=p(R_2|R_{eq})p(R_{eq}|R_3)p(R_3).$$ Replacing this in $(1)$ and noting that another consequence of the independance between the three resistances is that $p(R_1|R_{eq},R_2,R_3)=p(R_1|R_{eq})$, we get: $$p(R_{eq})=\int p(R_1|R_{eq})p(R_2|R_{eq})p(R_{eq}|R_3)p(R_3)dR_1dR_2dR_3=\int p(R_{eq}|R_3)p(R_3)dR_3.\ \ \ (2)$$ Our last problem then is to find $p(R_{eq}|R_3)$, i.e., the distribution of the r.v. $R_{eq}|R_3$. This problem is analogous to the one we found here, except that now you replace $R_3$ in eq. $(*)$ by a constant, say, $r_3$. Following the same arguments as above, you can find that $$p(R_{eq}|R_3)=\int p(R_{eq}|R_2,R_3)p(R_2)dR_2.\ \ \ (3)$$ Apparently the rest is replacing the known distributions, except for a little problem: the distribution of $R_{eq}|R_2,R_3$ can be obtained from $(*)$ by noting that $X_1$ is gaussian, so, you essentially need to find the distribution of the random variable $$W=\left(\frac{1}{X}+a+b\right)^{-1},$$ where $a$ and $b$ are constants, and $X$ is gaussian with mean $\mu$ and variance $\sigma^2$. If my calculations are correct, this distribution is: $$p(W)=\frac{1}{[1-W(a+b)]^2}\frac{1}{\sqrt{2\pi \sigma^2}}\text{exp}\left(-\frac{X(W)-\mu}{2\sigma^2}\right),$$ where, $$X(W)=\frac{1}{W^{-1}-a-b},$$ so $R_{eq}|R_2,R_3$'s distribution would be $$p(R_{eq}|R_2,R_3)=\frac{1}{[1-R_{eq}(a+b)]^2}\frac{1}{\sqrt{2\pi \sigma^2}}\text{exp}\left(-\frac{X(R_{eq})-\mu}{2\sigma^2}\right),$$ where $a=1/R_2$ and $b=1/R_3$. The thing is that I don't know if this is analytically tractable in order to solve the integral in equation $(3)$, which then will lead us to solve the poblem by replacing it's result in equation $(2)$. At least to me at this time of the night it is not.
Variance of resistors in parallel I warn that, as I reasoned it, this is a long answer, but maybe someone can come up with something better starting from my attempt (which may not be optimal). Also, I misread the original OPs question
24,964
Is it acceptable to reverse a sign of a principal component score? [duplicate]
The signs of the eigenvectors are essentially arbitrary; if a colleague were to run the same analyses on the same data but on a different computer it would not be surprising to see one or both eigenvectors (your PC1a, & PC2a) to have different signs. Computing the PCA using the same data on the same computer but via different software packages can also have the same effect. As such you can quite happily change the sign of the eigenvectors without altering the PCA.
Is it acceptable to reverse a sign of a principal component score? [duplicate]
The signs of the eigenvectors are essentially arbitrary; if a colleague were to run the same analyses on the same data but on a different computer it would not be surprising to see one or both eigenve
Is it acceptable to reverse a sign of a principal component score? [duplicate] The signs of the eigenvectors are essentially arbitrary; if a colleague were to run the same analyses on the same data but on a different computer it would not be surprising to see one or both eigenvectors (your PC1a, & PC2a) to have different signs. Computing the PCA using the same data on the same computer but via different software packages can also have the same effect. As such you can quite happily change the sign of the eigenvectors without altering the PCA.
Is it acceptable to reverse a sign of a principal component score? [duplicate] The signs of the eigenvectors are essentially arbitrary; if a colleague were to run the same analyses on the same data but on a different computer it would not be surprising to see one or both eigenve
24,965
Is it acceptable to reverse a sign of a principal component score? [duplicate]
Multiplying a principal component vector by a negative sign is fine. For 0 mean data matrix $X$, PCA calculates, $$\max_{w} (Xw)^{T}(Xw) $$ s.t. $w^{T}w = 1. $ The equality constraint is there else we could make $||w||$ as large as we wish, so the whole maximization program would be ill-posed. As you can see, if we define $w' = -w$, the new program is identical: $$\max_{w'} (Xw')^{T}(Xw') $$ s.t. $w'^{T}w' = 1. $.
Is it acceptable to reverse a sign of a principal component score? [duplicate]
Multiplying a principal component vector by a negative sign is fine. For 0 mean data matrix $X$, PCA calculates, $$\max_{w} (Xw)^{T}(Xw) $$ s.t. $w^{T}w = 1. $ The equality constraint is there else we
Is it acceptable to reverse a sign of a principal component score? [duplicate] Multiplying a principal component vector by a negative sign is fine. For 0 mean data matrix $X$, PCA calculates, $$\max_{w} (Xw)^{T}(Xw) $$ s.t. $w^{T}w = 1. $ The equality constraint is there else we could make $||w||$ as large as we wish, so the whole maximization program would be ill-posed. As you can see, if we define $w' = -w$, the new program is identical: $$\max_{w'} (Xw')^{T}(Xw') $$ s.t. $w'^{T}w' = 1. $.
Is it acceptable to reverse a sign of a principal component score? [duplicate] Multiplying a principal component vector by a negative sign is fine. For 0 mean data matrix $X$, PCA calculates, $$\max_{w} (Xw)^{T}(Xw) $$ s.t. $w^{T}w = 1. $ The equality constraint is there else we
24,966
Is it acceptable to reverse a sign of a principal component score? [duplicate]
You could use theory and the PCA to construct your components using a formula. For example Overall Ability = zSpell + zRead Relative Aptitude in Spelling in comparison to reading = zSpell - zRead That's basically what the PCA is doing. However, it removes issues of different signs across analyses. If the studies use exactly the same variables, you could even take it one step further and standardise the variables in both studies by a common mean and standard deviation. This would make the absolute values in the two studies comparable.
Is it acceptable to reverse a sign of a principal component score? [duplicate]
You could use theory and the PCA to construct your components using a formula. For example Overall Ability = zSpell + zRead Relative Aptitude in Spelling in comparison to reading = zSpell - zRead Th
Is it acceptable to reverse a sign of a principal component score? [duplicate] You could use theory and the PCA to construct your components using a formula. For example Overall Ability = zSpell + zRead Relative Aptitude in Spelling in comparison to reading = zSpell - zRead That's basically what the PCA is doing. However, it removes issues of different signs across analyses. If the studies use exactly the same variables, you could even take it one step further and standardise the variables in both studies by a common mean and standard deviation. This would make the absolute values in the two studies comparable.
Is it acceptable to reverse a sign of a principal component score? [duplicate] You could use theory and the PCA to construct your components using a formula. For example Overall Ability = zSpell + zRead Relative Aptitude in Spelling in comparison to reading = zSpell - zRead Th
24,967
Is it acceptable to reverse a sign of a principal component score? [duplicate]
Reversing the sign of the component is fine. The direction of the component is arbitrary. You can check Harman (1976) Modern Factor Analysis as a reference.
Is it acceptable to reverse a sign of a principal component score? [duplicate]
Reversing the sign of the component is fine. The direction of the component is arbitrary. You can check Harman (1976) Modern Factor Analysis as a reference.
Is it acceptable to reverse a sign of a principal component score? [duplicate] Reversing the sign of the component is fine. The direction of the component is arbitrary. You can check Harman (1976) Modern Factor Analysis as a reference.
Is it acceptable to reverse a sign of a principal component score? [duplicate] Reversing the sign of the component is fine. The direction of the component is arbitrary. You can check Harman (1976) Modern Factor Analysis as a reference.
24,968
Clustering distributions
I understand you such that all distributions can potentially take on the same 70 discrete values. Then it will be easy for you to compare cumulative curves of the distributions (comparing cumulative curves is the general way to compare distributions). That will be omnibus comparison for differences in shape, location, and spread. So, prepare data in the form like (A, B, ... etc are the distributions) Value CumProp_A CumProp_B ... 1 .01 .05 2 .12 .14 ... ... ... 70 1.00 1.00 and compute a distance matrix between the distributions. Submit to hierarchical clustering (I'd recommend complete linkage method). What distance? Well, if you think two cumulative curves are very different if they are far apart just at one value (b), use Chebyshev distance. If you think two cumulative curves are very different only if one is stably above the other along a wide range of values (c), use autocorrelative distance. In case any local differences between the curves are important (a), use Manhattan distance. P.S. Autocorrelative distance is just a non-normalized coefficient of autocorrelation of differences between the cumulative curves X and Y: $\sum_{i=2}^N (X-Y)_i*(X-Y)_{i-1}$
Clustering distributions
I understand you such that all distributions can potentially take on the same 70 discrete values. Then it will be easy for you to compare cumulative curves of the distributions (comparing cumulative c
Clustering distributions I understand you such that all distributions can potentially take on the same 70 discrete values. Then it will be easy for you to compare cumulative curves of the distributions (comparing cumulative curves is the general way to compare distributions). That will be omnibus comparison for differences in shape, location, and spread. So, prepare data in the form like (A, B, ... etc are the distributions) Value CumProp_A CumProp_B ... 1 .01 .05 2 .12 .14 ... ... ... 70 1.00 1.00 and compute a distance matrix between the distributions. Submit to hierarchical clustering (I'd recommend complete linkage method). What distance? Well, if you think two cumulative curves are very different if they are far apart just at one value (b), use Chebyshev distance. If you think two cumulative curves are very different only if one is stably above the other along a wide range of values (c), use autocorrelative distance. In case any local differences between the curves are important (a), use Manhattan distance. P.S. Autocorrelative distance is just a non-normalized coefficient of autocorrelation of differences between the cumulative curves X and Y: $\sum_{i=2}^N (X-Y)_i*(X-Y)_{i-1}$
Clustering distributions I understand you such that all distributions can potentially take on the same 70 discrete values. Then it will be easy for you to compare cumulative curves of the distributions (comparing cumulative c
24,969
Clustering distributions
If your data are histograms, you might want to look into appropriat distance functions for that such as the "histogram intersection distance". There is a tool called ELKI that has a wide variety of clustering algorithms (much more modern ones than k-means and hierarchical clustering) and it even has a version of histogram intersection distance included, that you can use in most algorithms. You might want to try out a few of the algorithms available in it. From the plot you gave above, it is unclear to me what you want to do. Group the individual histograms, right? Judging from the 10 you showed above, there might be no clusters.
Clustering distributions
If your data are histograms, you might want to look into appropriat distance functions for that such as the "histogram intersection distance". There is a tool called ELKI that has a wide variety of cl
Clustering distributions If your data are histograms, you might want to look into appropriat distance functions for that such as the "histogram intersection distance". There is a tool called ELKI that has a wide variety of clustering algorithms (much more modern ones than k-means and hierarchical clustering) and it even has a version of histogram intersection distance included, that you can use in most algorithms. You might want to try out a few of the algorithms available in it. From the plot you gave above, it is unclear to me what you want to do. Group the individual histograms, right? Judging from the 10 you showed above, there might be no clusters.
Clustering distributions If your data are histograms, you might want to look into appropriat distance functions for that such as the "histogram intersection distance". There is a tool called ELKI that has a wide variety of cl
24,970
Clustering distributions
You may want to use some feature extraction technique to derive descriptors for a k-means or other type of clustering. A basic approach would be to fit a certain distribution to your histograms and use its parameters as descriptors. For instance, you seem to have bimodal distributions, that you can describe with 2 means and 2 standard deviations. Another possibility is to cluster over the first two or three principal component of the counts of the histograms. Alternatively wavelets approaches can be used. This page explains how to do that when dealing with extracellular spikes. The data is different, but the idea should be applicable to your case. You will also find many references at the bottom. http://www.scholarpedia.org/article/Spike_sorting In R you can calculate the principal components of your peaks using either the princomp or prcomp function. Here you'll find a tutorial on PCA in R. For wavelets you may look at the wavelets package. k-means clustering can be achieved using the kmeans function.
Clustering distributions
You may want to use some feature extraction technique to derive descriptors for a k-means or other type of clustering. A basic approach would be to fit a certain distribution to your histograms and us
Clustering distributions You may want to use some feature extraction technique to derive descriptors for a k-means or other type of clustering. A basic approach would be to fit a certain distribution to your histograms and use its parameters as descriptors. For instance, you seem to have bimodal distributions, that you can describe with 2 means and 2 standard deviations. Another possibility is to cluster over the first two or three principal component of the counts of the histograms. Alternatively wavelets approaches can be used. This page explains how to do that when dealing with extracellular spikes. The data is different, but the idea should be applicable to your case. You will also find many references at the bottom. http://www.scholarpedia.org/article/Spike_sorting In R you can calculate the principal components of your peaks using either the princomp or prcomp function. Here you'll find a tutorial on PCA in R. For wavelets you may look at the wavelets package. k-means clustering can be achieved using the kmeans function.
Clustering distributions You may want to use some feature extraction technique to derive descriptors for a k-means or other type of clustering. A basic approach would be to fit a certain distribution to your histograms and us
24,971
Possible to get a better ANN by removing some connections?
Yes it is possible. Some people have looked at this problem in detail. Here is an old paper about a method to do so: Optimal brain damage
Possible to get a better ANN by removing some connections?
Yes it is possible. Some people have looked at this problem in detail. Here is an old paper about a method to do so: Optimal brain damage
Possible to get a better ANN by removing some connections? Yes it is possible. Some people have looked at this problem in detail. Here is an old paper about a method to do so: Optimal brain damage
Possible to get a better ANN by removing some connections? Yes it is possible. Some people have looked at this problem in detail. Here is an old paper about a method to do so: Optimal brain damage
24,972
Possible to get a better ANN by removing some connections?
As a rule of thumb, small and/or sparse networks generalise better. You can let your training algorithm weed out unecessary connections within a fixed-size network by applying some form of weight decay, or you can apply an algorithm that aims to optimise network architecture/topology itself through removing unecessary inputs, hidden nodes or connections. Have a look at these references for ideas and starting points for further research, or look into the use of evolutionary algorithms to design, prune and optimise architectures. Castellano, G., Fanelli, A.M. (2000) 'Variable selection using neural-network models', Neurcomputing (31) Ji C., Psaltis D. (1997) 'Network Synthesis through Data-Driven Growth and Decay', Neural Networks Vol. 10, No. 6, pp. 1133-1141 Narasimha P.L. et al (2008) 'An integrated growing-pruning method for feedforward network training', Neurocomputing (71), pp. 2831-2847 Schuster, A. (2008) 'Robust Artificial Neural Network Architectures', International Journal of Computational Intelligence (4:2), pp. 98-104
Possible to get a better ANN by removing some connections?
As a rule of thumb, small and/or sparse networks generalise better. You can let your training algorithm weed out unecessary connections within a fixed-size network by applying some form of weight deca
Possible to get a better ANN by removing some connections? As a rule of thumb, small and/or sparse networks generalise better. You can let your training algorithm weed out unecessary connections within a fixed-size network by applying some form of weight decay, or you can apply an algorithm that aims to optimise network architecture/topology itself through removing unecessary inputs, hidden nodes or connections. Have a look at these references for ideas and starting points for further research, or look into the use of evolutionary algorithms to design, prune and optimise architectures. Castellano, G., Fanelli, A.M. (2000) 'Variable selection using neural-network models', Neurcomputing (31) Ji C., Psaltis D. (1997) 'Network Synthesis through Data-Driven Growth and Decay', Neural Networks Vol. 10, No. 6, pp. 1133-1141 Narasimha P.L. et al (2008) 'An integrated growing-pruning method for feedforward network training', Neurocomputing (71), pp. 2831-2847 Schuster, A. (2008) 'Robust Artificial Neural Network Architectures', International Journal of Computational Intelligence (4:2), pp. 98-104
Possible to get a better ANN by removing some connections? As a rule of thumb, small and/or sparse networks generalise better. You can let your training algorithm weed out unecessary connections within a fixed-size network by applying some form of weight deca
24,973
Possible to get a better ANN by removing some connections?
In most cases if you remove unnecesary connections you'll get better network. It is easy to overtrain (overfit) the network --- in which case it will perform poorly on validation dataset. Pruning unnecesary connections will most probably reduce o overtraining probability. Please see: http://en.wikipedia.org/wiki/Overfitting .
Possible to get a better ANN by removing some connections?
In most cases if you remove unnecesary connections you'll get better network. It is easy to overtrain (overfit) the network --- in which case it will perform poorly on validation dataset. Pruning unn
Possible to get a better ANN by removing some connections? In most cases if you remove unnecesary connections you'll get better network. It is easy to overtrain (overfit) the network --- in which case it will perform poorly on validation dataset. Pruning unnecesary connections will most probably reduce o overtraining probability. Please see: http://en.wikipedia.org/wiki/Overfitting .
Possible to get a better ANN by removing some connections? In most cases if you remove unnecesary connections you'll get better network. It is easy to overtrain (overfit) the network --- in which case it will perform poorly on validation dataset. Pruning unn
24,974
Possible to get a better ANN by removing some connections?
Yes It is possible. We can consider, connection between computational unites, number of hidden layers, unites per hidden layer etc as hyper-parameters. It possible to find-out optimal values for these parameters by conducting a series of experiments. For example: Your can divide your data set as follows: Training set 60% of data, Cross-validation 20% of data, Testing 20% of data, Then train your NN by using training data set and tuning parameter by using cross-validation data set. Finally you can use your testing data set for evaluate the performance of your NN.
Possible to get a better ANN by removing some connections?
Yes It is possible. We can consider, connection between computational unites, number of hidden layers, unites per hidden layer etc as hyper-parameters. It possible to find-out optimal values for these
Possible to get a better ANN by removing some connections? Yes It is possible. We can consider, connection between computational unites, number of hidden layers, unites per hidden layer etc as hyper-parameters. It possible to find-out optimal values for these parameters by conducting a series of experiments. For example: Your can divide your data set as follows: Training set 60% of data, Cross-validation 20% of data, Testing 20% of data, Then train your NN by using training data set and tuning parameter by using cross-validation data set. Finally you can use your testing data set for evaluate the performance of your NN.
Possible to get a better ANN by removing some connections? Yes It is possible. We can consider, connection between computational unites, number of hidden layers, unites per hidden layer etc as hyper-parameters. It possible to find-out optimal values for these
24,975
Does it make sense to study plots of residuals with respect to the dependent variable?
Suppose that you have the regression $y_i = \beta_0 + \beta_1 x_i + \epsilon_i$, where $\beta_1 \approx 0$. Then, $y_i - \beta_0 \approx \epsilon_i$. The higher the $y$ value, the bigger the residual. On the contrary, a plot of the residuals against $x$ should show no systematic relationship. Also, the predicted value $\hat{y}_i$ should be approximately $\hat{\beta}_0$---the same for every observation. If all the predicted values are roughly the same, they should be uncorrelated with the errors. What the plot is telling me is that $x$ and $y$ are essentially unrelated (of course, there are better ways to show this). Let us know if your coefficient $\hat{\beta}_1$ is not close to 0. As better diagnostics, use a plot of the residuals against the predicted wage or against the $x$ value. You should not observe a distinguishable pattern in these plots. If you want a little R demonstration, here you go: y <- rnorm(100, 0, 5) x <- rnorm(100, 0, 2) res <- lm(y ~ x)$residuals fitted <- lm(y ~ x)$fitted.values plot(y, res) plot(x, res) plot(fitted, res)
Does it make sense to study plots of residuals with respect to the dependent variable?
Suppose that you have the regression $y_i = \beta_0 + \beta_1 x_i + \epsilon_i$, where $\beta_1 \approx 0$. Then, $y_i - \beta_0 \approx \epsilon_i$. The higher the $y$ value, the bigger the residual.
Does it make sense to study plots of residuals with respect to the dependent variable? Suppose that you have the regression $y_i = \beta_0 + \beta_1 x_i + \epsilon_i$, where $\beta_1 \approx 0$. Then, $y_i - \beta_0 \approx \epsilon_i$. The higher the $y$ value, the bigger the residual. On the contrary, a plot of the residuals against $x$ should show no systematic relationship. Also, the predicted value $\hat{y}_i$ should be approximately $\hat{\beta}_0$---the same for every observation. If all the predicted values are roughly the same, they should be uncorrelated with the errors. What the plot is telling me is that $x$ and $y$ are essentially unrelated (of course, there are better ways to show this). Let us know if your coefficient $\hat{\beta}_1$ is not close to 0. As better diagnostics, use a plot of the residuals against the predicted wage or against the $x$ value. You should not observe a distinguishable pattern in these plots. If you want a little R demonstration, here you go: y <- rnorm(100, 0, 5) x <- rnorm(100, 0, 2) res <- lm(y ~ x)$residuals fitted <- lm(y ~ x)$fitted.values plot(y, res) plot(x, res) plot(fitted, res)
Does it make sense to study plots of residuals with respect to the dependent variable? Suppose that you have the regression $y_i = \beta_0 + \beta_1 x_i + \epsilon_i$, where $\beta_1 \approx 0$. Then, $y_i - \beta_0 \approx \epsilon_i$. The higher the $y$ value, the bigger the residual.
24,976
Does it make sense to study plots of residuals with respect to the dependent variable?
Assuming the estimated model is correctly specified... Let's denote $P_X=X(X'X)^{-1}X'$, the matrix $P_X$ is a projection matrix, so $P_X^2=P_X$ and $P_X'=P_X$. $Cov(\hat{Y},\hat{e})=Cov(P_XY,(I-P_X)Y)=P_XCov(Y,Y)(I-P_X)'=\sigma^2P_X(I-P_X)=0$. So the scatter-plot of residuals against predicted dependent variable should show no correlation. But! $Cov(Y,\hat{e})=Cov(Y,(I-P_X)Y)=Cov(Y,Y)(I-P_X)'=\sigma^2(I-P_X)$. The matrix $\sigma^2(I-P_X)$ is a projection matrix, its eigenvalues are 0 or +1, it's positive semidefinite. So it should have non-negative values on the diagonal. So the scatter-plot of residuals against original dependent variable should show positive correlation. As far as i know Gretl produces by default the graph of residuals against original dependent variable (not the predicted one!).
Does it make sense to study plots of residuals with respect to the dependent variable?
Assuming the estimated model is correctly specified... Let's denote $P_X=X(X'X)^{-1}X'$, the matrix $P_X$ is a projection matrix, so $P_X^2=P_X$ and $P_X'=P_X$. $Cov(\hat{Y},\hat{e})=Cov(P_XY,(I-P_X)Y
Does it make sense to study plots of residuals with respect to the dependent variable? Assuming the estimated model is correctly specified... Let's denote $P_X=X(X'X)^{-1}X'$, the matrix $P_X$ is a projection matrix, so $P_X^2=P_X$ and $P_X'=P_X$. $Cov(\hat{Y},\hat{e})=Cov(P_XY,(I-P_X)Y)=P_XCov(Y,Y)(I-P_X)'=\sigma^2P_X(I-P_X)=0$. So the scatter-plot of residuals against predicted dependent variable should show no correlation. But! $Cov(Y,\hat{e})=Cov(Y,(I-P_X)Y)=Cov(Y,Y)(I-P_X)'=\sigma^2(I-P_X)$. The matrix $\sigma^2(I-P_X)$ is a projection matrix, its eigenvalues are 0 or +1, it's positive semidefinite. So it should have non-negative values on the diagonal. So the scatter-plot of residuals against original dependent variable should show positive correlation. As far as i know Gretl produces by default the graph of residuals against original dependent variable (not the predicted one!).
Does it make sense to study plots of residuals with respect to the dependent variable? Assuming the estimated model is correctly specified... Let's denote $P_X=X(X'X)^{-1}X'$, the matrix $P_X$ is a projection matrix, so $P_X^2=P_X$ and $P_X'=P_X$. $Cov(\hat{Y},\hat{e})=Cov(P_XY,(I-P_X)Y
24,977
Does it make sense to study plots of residuals with respect to the dependent variable?
Is it possible you are confusing fitted/predicted values with the actual values? As @gung and @biostat have said, you hope there is no relationship between fitted values and residuals. On the other hand, finding a linear relationship between the actual values of the dependent/outcome variable and the residuals is to be expected and is not particularly informative. Added to clarify the previous sentence: Not just any linear relationship between residuals and actual values of the out come is to be expected... For low measured values of Y, the predicted values of Y from a useful model will tend to be higher than the actual measured values, and vice versa.
Does it make sense to study plots of residuals with respect to the dependent variable?
Is it possible you are confusing fitted/predicted values with the actual values? As @gung and @biostat have said, you hope there is no relationship between fitted values and residuals. On the other h
Does it make sense to study plots of residuals with respect to the dependent variable? Is it possible you are confusing fitted/predicted values with the actual values? As @gung and @biostat have said, you hope there is no relationship between fitted values and residuals. On the other hand, finding a linear relationship between the actual values of the dependent/outcome variable and the residuals is to be expected and is not particularly informative. Added to clarify the previous sentence: Not just any linear relationship between residuals and actual values of the out come is to be expected... For low measured values of Y, the predicted values of Y from a useful model will tend to be higher than the actual measured values, and vice versa.
Does it make sense to study plots of residuals with respect to the dependent variable? Is it possible you are confusing fitted/predicted values with the actual values? As @gung and @biostat have said, you hope there is no relationship between fitted values and residuals. On the other h
24,978
Does it make sense to study plots of residuals with respect to the dependent variable?
The answers offered are giving me some ideas about what's going on here. I do believe there may have been some mistakes made by accident. See if the following story makes sense: To start, I think there is probably a strong relationship between X & Y in the data (here's some code and a plot): set.seed(5) wage <- rlnorm(1000, meanlog=2.3, sdlog=.5) something_else <- .7*wage + rnorm(1000, mean=0, sd=1) plot(wage, something_else, pch=3, col="red", main="Plot X vs. Y") But by mistake Y was predicted just from the mean. Compounding this, the residuals from the mean only model are plotted against X, even though what was intended was to plot against the fitted values (code & plot): meanModel <- lm(something_else~1) windows() plot(wage, meanModel$residuals, pch=3, col="red", main="Plot of residuals from Mean only Model against X") abline(h=0, lty="dotted") We can fix this by fitting the appropriate model and plotting the residuals from that (code & plot): appropriateModel <- lm(something_else~wage) windows() plot(appropriateModel$fitted.values, appropriateModel$residuals, pch=3, col="red", main="Plot of residuals from the appropriate\nmodel against fitted values") lines(lowess(appropriateModel$residuals~appropriateModel$fitted.values)) This seems like just the kinds of goof-ups I made when I was starting.
Does it make sense to study plots of residuals with respect to the dependent variable?
The answers offered are giving me some ideas about what's going on here. I do believe there may have been some mistakes made by accident. See if the following story makes sense: To start, I think the
Does it make sense to study plots of residuals with respect to the dependent variable? The answers offered are giving me some ideas about what's going on here. I do believe there may have been some mistakes made by accident. See if the following story makes sense: To start, I think there is probably a strong relationship between X & Y in the data (here's some code and a plot): set.seed(5) wage <- rlnorm(1000, meanlog=2.3, sdlog=.5) something_else <- .7*wage + rnorm(1000, mean=0, sd=1) plot(wage, something_else, pch=3, col="red", main="Plot X vs. Y") But by mistake Y was predicted just from the mean. Compounding this, the residuals from the mean only model are plotted against X, even though what was intended was to plot against the fitted values (code & plot): meanModel <- lm(something_else~1) windows() plot(wage, meanModel$residuals, pch=3, col="red", main="Plot of residuals from Mean only Model against X") abline(h=0, lty="dotted") We can fix this by fitting the appropriate model and plotting the residuals from that (code & plot): appropriateModel <- lm(something_else~wage) windows() plot(appropriateModel$fitted.values, appropriateModel$residuals, pch=3, col="red", main="Plot of residuals from the appropriate\nmodel against fitted values") lines(lowess(appropriateModel$residuals~appropriateModel$fitted.values)) This seems like just the kinds of goof-ups I made when I was starting.
Does it make sense to study plots of residuals with respect to the dependent variable? The answers offered are giving me some ideas about what's going on here. I do believe there may have been some mistakes made by accident. See if the following story makes sense: To start, I think the
24,979
Does it make sense to study plots of residuals with respect to the dependent variable?
This graph indicates that the model you fitted is not good. As @gung said in the first comments on the main question that there should be no relationship between predicated response and residual. " an analyst should expect a regression model to err in predicting a response in a random fashion; the model should predict values higher than actual and lower than actual with equal probability. See this" I would recommend first plot response vs independent variable to see the relationship between them. It might be reasonable to add polynomial terms in the model.
Does it make sense to study plots of residuals with respect to the dependent variable?
This graph indicates that the model you fitted is not good. As @gung said in the first comments on the main question that there should be no relationship between predicated response and residual. "
Does it make sense to study plots of residuals with respect to the dependent variable? This graph indicates that the model you fitted is not good. As @gung said in the first comments on the main question that there should be no relationship between predicated response and residual. " an analyst should expect a regression model to err in predicting a response in a random fashion; the model should predict values higher than actual and lower than actual with equal probability. See this" I would recommend first plot response vs independent variable to see the relationship between them. It might be reasonable to add polynomial terms in the model.
Does it make sense to study plots of residuals with respect to the dependent variable? This graph indicates that the model you fitted is not good. As @gung said in the first comments on the main question that there should be no relationship between predicated response and residual. "
24,980
Does it make sense to study plots of residuals with respect to the dependent variable?
Isn't this what happens if there is no relationship between the X & Y variable? From looking at this graph, it appears you are essentially predicting Y with it's mean.
Does it make sense to study plots of residuals with respect to the dependent variable?
Isn't this what happens if there is no relationship between the X & Y variable? From looking at this graph, it appears you are essentially predicting Y with it's mean.
Does it make sense to study plots of residuals with respect to the dependent variable? Isn't this what happens if there is no relationship between the X & Y variable? From looking at this graph, it appears you are essentially predicting Y with it's mean.
Does it make sense to study plots of residuals with respect to the dependent variable? Isn't this what happens if there is no relationship between the X & Y variable? From looking at this graph, it appears you are essentially predicting Y with it's mean.
24,981
Does it make sense to study plots of residuals with respect to the dependent variable?
I think OP plotted residuals vs. the original response variable (not the fitted response variable from the model). I see plots like this all the time, with nearly the same exact pattern. Make sure you plot residuals vs. fitted values, as I'm not sure what meaningful inference you could gather from residuals vs. original Y. But I could certainly be wrong.
Does it make sense to study plots of residuals with respect to the dependent variable?
I think OP plotted residuals vs. the original response variable (not the fitted response variable from the model). I see plots like this all the time, with nearly the same exact pattern. Make sure you
Does it make sense to study plots of residuals with respect to the dependent variable? I think OP plotted residuals vs. the original response variable (not the fitted response variable from the model). I see plots like this all the time, with nearly the same exact pattern. Make sure you plot residuals vs. fitted values, as I'm not sure what meaningful inference you could gather from residuals vs. original Y. But I could certainly be wrong.
Does it make sense to study plots of residuals with respect to the dependent variable? I think OP plotted residuals vs. the original response variable (not the fitted response variable from the model). I see plots like this all the time, with nearly the same exact pattern. Make sure you
24,982
Can one validly reduce the numbers of items in a published Likert-scale?
Although there is still some information lacking (No. individuals and items per subscale), here are some general hints about scale reduction. Also, since you are working at the questionnaire level, I don't see why its length matters so much (after all, you will just give summary statistics, like total or mean scores). I shall assume that (a) you have a set of K items measuring some construct related to morale, (b) your "unidimensional" scale is a second-order factor that might be subdivided into different facets, (c) you would like to reduce your scale to k < K items so as to summarize with sufficient accuracy subjects' totalled scale scores while preserving the content validity of the scale. About content/construct validity of this validated scale: The number of items has certainly been choosen so as to best reflect the construct of interest. By shortening the questionnaire, you are actually reducing construct coverage. It would be good to check that the factor structure remains the same when considering only half of the items (which could also impact the way you select them, after all). This can be done using traditional FA techniques. You hold the responsability of interpreting the scale in a spirit similar to that of the authors. About scores reliability: Although it is a sample-dependent measure, scores reliability decreases when decreasing the number of items (cf. Spearman-Brown formula); another way to see that is that the standard error of measurement (SEM) will increase, but see An NCME Instructional Module on Standard Error of Measurement, by Leo M Harvill. Needless to say, it applies to every indicator that depends on the number of items (e.g., Cronbach's alpha which can be used to estimate one form of reliability, namely the internal consistency). Hopefully, this will not impact any between-group comparisons based on raw scores. So, my recommendations (the easiest way) would be: Select your items so as to maximise construct coverage; check the dimensionality with FA and coverage with univariate responses distributions; Compare average interitem correlations to previously reported ones; Compute internal consistency for the full scale and your composites; check that they are in agreement with published statistics on the original scale (no need to test anything, these are sample-dependent measures); Test the linear (or polychoric, or rank) correlations between original and reduced (sub)scores, to ensure that they are comparable (i.e., that individuals locations on the latent trait do no vary to a great extent, as objectivated through the raw scores); If you have an external subject-specific variable (e.g., gender, age, or best a measure related to morale), compare known-group validity between the two forms. The hard way would be to rely on Item Response Theory to select those items that carry the maximum of information on the latent trait -- scale reduction is actually one of its best application. Models for polytomous items were partly described in this thread, Validating questionnaires. Update after your 2nd update Forget about any IRT models for polytomous items with so few subjects. Factor Analysis will also suffer from such a low sample size; you will get unreliable factor loadings estimates. 30 items divided by 2 = 15 items (it's easy to get an idea of the increase in the corresponding SEM for the total score), but it will definitively get worse if you consider subscales (this was actually my 2nd question--No. items per subscale, if any)
Can one validly reduce the numbers of items in a published Likert-scale?
Although there is still some information lacking (No. individuals and items per subscale), here are some general hints about scale reduction. Also, since you are working at the questionnaire level, I
Can one validly reduce the numbers of items in a published Likert-scale? Although there is still some information lacking (No. individuals and items per subscale), here are some general hints about scale reduction. Also, since you are working at the questionnaire level, I don't see why its length matters so much (after all, you will just give summary statistics, like total or mean scores). I shall assume that (a) you have a set of K items measuring some construct related to morale, (b) your "unidimensional" scale is a second-order factor that might be subdivided into different facets, (c) you would like to reduce your scale to k < K items so as to summarize with sufficient accuracy subjects' totalled scale scores while preserving the content validity of the scale. About content/construct validity of this validated scale: The number of items has certainly been choosen so as to best reflect the construct of interest. By shortening the questionnaire, you are actually reducing construct coverage. It would be good to check that the factor structure remains the same when considering only half of the items (which could also impact the way you select them, after all). This can be done using traditional FA techniques. You hold the responsability of interpreting the scale in a spirit similar to that of the authors. About scores reliability: Although it is a sample-dependent measure, scores reliability decreases when decreasing the number of items (cf. Spearman-Brown formula); another way to see that is that the standard error of measurement (SEM) will increase, but see An NCME Instructional Module on Standard Error of Measurement, by Leo M Harvill. Needless to say, it applies to every indicator that depends on the number of items (e.g., Cronbach's alpha which can be used to estimate one form of reliability, namely the internal consistency). Hopefully, this will not impact any between-group comparisons based on raw scores. So, my recommendations (the easiest way) would be: Select your items so as to maximise construct coverage; check the dimensionality with FA and coverage with univariate responses distributions; Compare average interitem correlations to previously reported ones; Compute internal consistency for the full scale and your composites; check that they are in agreement with published statistics on the original scale (no need to test anything, these are sample-dependent measures); Test the linear (or polychoric, or rank) correlations between original and reduced (sub)scores, to ensure that they are comparable (i.e., that individuals locations on the latent trait do no vary to a great extent, as objectivated through the raw scores); If you have an external subject-specific variable (e.g., gender, age, or best a measure related to morale), compare known-group validity between the two forms. The hard way would be to rely on Item Response Theory to select those items that carry the maximum of information on the latent trait -- scale reduction is actually one of its best application. Models for polytomous items were partly described in this thread, Validating questionnaires. Update after your 2nd update Forget about any IRT models for polytomous items with so few subjects. Factor Analysis will also suffer from such a low sample size; you will get unreliable factor loadings estimates. 30 items divided by 2 = 15 items (it's easy to get an idea of the increase in the corresponding SEM for the total score), but it will definitively get worse if you consider subscales (this was actually my 2nd question--No. items per subscale, if any)
Can one validly reduce the numbers of items in a published Likert-scale? Although there is still some information lacking (No. individuals and items per subscale), here are some general hints about scale reduction. Also, since you are working at the questionnaire level, I
24,983
Can one validly reduce the numbers of items in a published Likert-scale?
I guess there's no clear-cut "yes/no" answer to your question. If you arbitrarily drop items from sub-scales to create a short form of the original questionnaire, you lose the long form's psychometric validation. Things that can change are the factorial structure of the questionnaire, reliability of sub-scales, item-total correlations, etc. (you'll note I'm used to classical test theory thinking, not IRT). Plus, you can't use any standardization of the original questionnaire. That's why short forms of established questionnaires have to undergo a separate validation phase. Depending on your requirements, all ist not lost however. You may not need standardization because you may only want to compare results within your sample without making "absolute" judgements with respect to a reference population. IMHO, it would be a plus if you had the chance to validate the short form with the original form at least for a sub-sample of your group. This may allow you to see if results are similar. In general though, results to a questionnaire can be surprisingly sensitive to its item composition. People do not robotically fill out questionnaires but make all sorts of tacit assumptions and cognitive inferences: "what is this really about?", "what am I expected to report here?", "what do they actually want to know?". This can be heavily influenced by the given context of items, cf. Schwarz, N. 1996. Cognition and Communication: Judgmental Biases, Research Methods, and the Logic of Conversation. Mahwah, NJ: Lawrence Erlbaum.
Can one validly reduce the numbers of items in a published Likert-scale?
I guess there's no clear-cut "yes/no" answer to your question. If you arbitrarily drop items from sub-scales to create a short form of the original questionnaire, you lose the long form's psychometric
Can one validly reduce the numbers of items in a published Likert-scale? I guess there's no clear-cut "yes/no" answer to your question. If you arbitrarily drop items from sub-scales to create a short form of the original questionnaire, you lose the long form's psychometric validation. Things that can change are the factorial structure of the questionnaire, reliability of sub-scales, item-total correlations, etc. (you'll note I'm used to classical test theory thinking, not IRT). Plus, you can't use any standardization of the original questionnaire. That's why short forms of established questionnaires have to undergo a separate validation phase. Depending on your requirements, all ist not lost however. You may not need standardization because you may only want to compare results within your sample without making "absolute" judgements with respect to a reference population. IMHO, it would be a plus if you had the chance to validate the short form with the original form at least for a sub-sample of your group. This may allow you to see if results are similar. In general though, results to a questionnaire can be surprisingly sensitive to its item composition. People do not robotically fill out questionnaires but make all sorts of tacit assumptions and cognitive inferences: "what is this really about?", "what am I expected to report here?", "what do they actually want to know?". This can be heavily influenced by the given context of items, cf. Schwarz, N. 1996. Cognition and Communication: Judgmental Biases, Research Methods, and the Logic of Conversation. Mahwah, NJ: Lawrence Erlbaum.
Can one validly reduce the numbers of items in a published Likert-scale? I guess there's no clear-cut "yes/no" answer to your question. If you arbitrarily drop items from sub-scales to create a short form of the original questionnaire, you lose the long form's psychometric
24,984
Can one validly reduce the numbers of items in a published Likert-scale?
I'd add one point. Be aware of the distinction between group (e.g., comparing group means over time) and individual level measurement (e.g., correlating scores on the scale with other scales at the individual-level). Reliability applies differently to the two levels. Perhaps the following simplification helps: Reliability of group-level measurement is heavily influenced by the number of participants you have and the degree to which there is true variability at the group-level. Reliability of individual-level measurement is heavily influenced by the number of items you have and the degree to which individuals truly vary.
Can one validly reduce the numbers of items in a published Likert-scale?
I'd add one point. Be aware of the distinction between group (e.g., comparing group means over time) and individual level measurement (e.g., correlating scores on the scale with other scales at the in
Can one validly reduce the numbers of items in a published Likert-scale? I'd add one point. Be aware of the distinction between group (e.g., comparing group means over time) and individual level measurement (e.g., correlating scores on the scale with other scales at the individual-level). Reliability applies differently to the two levels. Perhaps the following simplification helps: Reliability of group-level measurement is heavily influenced by the number of participants you have and the degree to which there is true variability at the group-level. Reliability of individual-level measurement is heavily influenced by the number of items you have and the degree to which individuals truly vary.
Can one validly reduce the numbers of items in a published Likert-scale? I'd add one point. Be aware of the distinction between group (e.g., comparing group means over time) and individual level measurement (e.g., correlating scores on the scale with other scales at the in
24,985
Can one validly reduce the numbers of items in a published Likert-scale?
One reference that you may find useful for this: STANTON, J. M., SINAR, E. F., BALZER, W. K. and SMITH, P. C. (2002), ISSUES AND STRATEGIES FOR REDUCING THE LENGTH OF SELF-REPORT SCALES. Personnel Psychology, 55: 167–194.
Can one validly reduce the numbers of items in a published Likert-scale?
One reference that you may find useful for this: STANTON, J. M., SINAR, E. F., BALZER, W. K. and SMITH, P. C. (2002), ISSUES AND STRATEGIES FOR REDUCING THE LENGTH OF SELF-REPORT SCALES. Personnel Ps
Can one validly reduce the numbers of items in a published Likert-scale? One reference that you may find useful for this: STANTON, J. M., SINAR, E. F., BALZER, W. K. and SMITH, P. C. (2002), ISSUES AND STRATEGIES FOR REDUCING THE LENGTH OF SELF-REPORT SCALES. Personnel Psychology, 55: 167–194.
Can one validly reduce the numbers of items in a published Likert-scale? One reference that you may find useful for this: STANTON, J. M., SINAR, E. F., BALZER, W. K. and SMITH, P. C. (2002), ISSUES AND STRATEGIES FOR REDUCING THE LENGTH OF SELF-REPORT SCALES. Personnel Ps
24,986
What measure can I use to select a number from a dataset which future values will most likely be closest to?
To make this amenable to a rigorous analysis, you will need to specify a loss function. How bad is it to predict $x$ and obtain $y$, compared to a prediction of $z$? Once you have specified such a loss function, you can do a number of things. You may be able to find the value $x$ that minimizes your expected loss by simulation. For some loss functions, the minimizer is known. I want to return a number that I would bet is the number of times the user is going to use my app tomorrow or awfully close to it This to me sounds very much like you want to minimize the expected Mean Absolute Error (MAE), $$ \text{argmin}_x E_y|x-y|, $$ where we assume that $y$ follows the distribution you have observed in your dataset. If we can agree that the expected MAE is what you want to minimize, you are in luck, because it is known which quantity will do so, namely the median: Why does minimizing the MAE lead to forecasting the median and not the mean? As you observed, the median here is $5$, not $4$, although there are more $4$s than $5$s in your dataset. The reason for this is that all the $15$s "pull" the argmin up - the chance of observing a $15$ means that predicting a $5$ is less costly than predicting a $4$. We can run a very simple simulation of the expected MAE by resampling from your dataset and evaluating the MAE for various candidate predictions. (Actually, for a dataset that is as simple as yours, there is really no need to simulate, you can just tabulate.) In R: dataset <- c(2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 7, 12, 15, 15, 15, 15, 15, 15) set.seed(1) # for reproducibility sims <- sample(dataset,size=1e5,replace=TRUE) candidates <- seq(min(dataset),max(dataset)) emae <- sapply(candidates,function(xx)mean(abs(sims-xx))) plot(candidates,emae,pch=19,xlab="Candidate",ylab="Expected MAE",las=1) As you see, $5$ will lead to a slightly lower expected MAE than $4$. Now, if this is not what makes you happy, then we need to find out what does make you happy... that is, we need to choose a different loss function. Once you do so, you can run a similar simulation and pick the minimizer. If you have tweaked your loss function just right, the minimizer will the $4$. (But of course, it makes more sense to think about what loss function makes more sense, rather than start with your desired outcome.) Alternatively, perhaps your loss is better described by the squared distance $(x-y)^2$ between the prediction $x$ and the outcome $y$. If so, the minimizer would be the mean of your dataset (that the mean minimizes squared distances is a standard result in statistics) - as you observe, that is $7.5$.
What measure can I use to select a number from a dataset which future values will most likely be clo
To make this amenable to a rigorous analysis, you will need to specify a loss function. How bad is it to predict $x$ and obtain $y$, compared to a prediction of $z$? Once you have specified such a los
What measure can I use to select a number from a dataset which future values will most likely be closest to? To make this amenable to a rigorous analysis, you will need to specify a loss function. How bad is it to predict $x$ and obtain $y$, compared to a prediction of $z$? Once you have specified such a loss function, you can do a number of things. You may be able to find the value $x$ that minimizes your expected loss by simulation. For some loss functions, the minimizer is known. I want to return a number that I would bet is the number of times the user is going to use my app tomorrow or awfully close to it This to me sounds very much like you want to minimize the expected Mean Absolute Error (MAE), $$ \text{argmin}_x E_y|x-y|, $$ where we assume that $y$ follows the distribution you have observed in your dataset. If we can agree that the expected MAE is what you want to minimize, you are in luck, because it is known which quantity will do so, namely the median: Why does minimizing the MAE lead to forecasting the median and not the mean? As you observed, the median here is $5$, not $4$, although there are more $4$s than $5$s in your dataset. The reason for this is that all the $15$s "pull" the argmin up - the chance of observing a $15$ means that predicting a $5$ is less costly than predicting a $4$. We can run a very simple simulation of the expected MAE by resampling from your dataset and evaluating the MAE for various candidate predictions. (Actually, for a dataset that is as simple as yours, there is really no need to simulate, you can just tabulate.) In R: dataset <- c(2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 7, 12, 15, 15, 15, 15, 15, 15) set.seed(1) # for reproducibility sims <- sample(dataset,size=1e5,replace=TRUE) candidates <- seq(min(dataset),max(dataset)) emae <- sapply(candidates,function(xx)mean(abs(sims-xx))) plot(candidates,emae,pch=19,xlab="Candidate",ylab="Expected MAE",las=1) As you see, $5$ will lead to a slightly lower expected MAE than $4$. Now, if this is not what makes you happy, then we need to find out what does make you happy... that is, we need to choose a different loss function. Once you do so, you can run a similar simulation and pick the minimizer. If you have tweaked your loss function just right, the minimizer will the $4$. (But of course, it makes more sense to think about what loss function makes more sense, rather than start with your desired outcome.) Alternatively, perhaps your loss is better described by the squared distance $(x-y)^2$ between the prediction $x$ and the outcome $y$. If so, the minimizer would be the mean of your dataset (that the mean minimizes squared distances is a standard result in statistics) - as you observe, that is $7.5$.
What measure can I use to select a number from a dataset which future values will most likely be clo To make this amenable to a rigorous analysis, you will need to specify a loss function. How bad is it to predict $x$ and obtain $y$, compared to a prediction of $z$? Once you have specified such a los
24,987
What measure can I use to select a number from a dataset which future values will most likely be closest to?
Here's the algorithm I would run: Find peaks in the histogram. The data here is $$[0,0,1,4,5,3,0,1,0,0,0,0,1,6],$$ so that the index into the array corresponds to the original data. That is, there are no $0$'s or $1$'s, there is one $2,$ four $3$'s, and so on. Any peak detection algorithm you would have to tweak, particularly with its window size (how many data points does the detector use at a time?). I would expect in this situation to find two peaks: $4$ and $15.$ Caveat: if your peak detector needs a bi-directional tapering off from the peak, then it might not find $15$ as a peak - that won't hurt in this particular scenario. If you need integer values, make sure to round the result, as a peak detector won't necessarily give you integer output. Find the median, which is $5.$ Choose the peak in the first step that is closest (as in, the distance function $d(x,y)=|x-y|$) to the median, which would be $4.$ This strikes me as a reasonable way to get at what you want.
What measure can I use to select a number from a dataset which future values will most likely be clo
Here's the algorithm I would run: Find peaks in the histogram. The data here is $$[0,0,1,4,5,3,0,1,0,0,0,0,1,6],$$ so that the index into the array corresponds to the original data. That is, there ar
What measure can I use to select a number from a dataset which future values will most likely be closest to? Here's the algorithm I would run: Find peaks in the histogram. The data here is $$[0,0,1,4,5,3,0,1,0,0,0,0,1,6],$$ so that the index into the array corresponds to the original data. That is, there are no $0$'s or $1$'s, there is one $2,$ four $3$'s, and so on. Any peak detection algorithm you would have to tweak, particularly with its window size (how many data points does the detector use at a time?). I would expect in this situation to find two peaks: $4$ and $15.$ Caveat: if your peak detector needs a bi-directional tapering off from the peak, then it might not find $15$ as a peak - that won't hurt in this particular scenario. If you need integer values, make sure to round the result, as a peak detector won't necessarily give you integer output. Find the median, which is $5.$ Choose the peak in the first step that is closest (as in, the distance function $d(x,y)=|x-y|$) to the median, which would be $4.$ This strikes me as a reasonable way to get at what you want.
What measure can I use to select a number from a dataset which future values will most likely be clo Here's the algorithm I would run: Find peaks in the histogram. The data here is $$[0,0,1,4,5,3,0,1,0,0,0,0,1,6],$$ so that the index into the array corresponds to the original data. That is, there ar
24,988
What measure can I use to select a number from a dataset which future values will most likely be closest to?
I would use the median, because it should be at or near the most likely number of times the next random user would use your app. Even if there are few occurrences of it in your data now, if you're looking at a random user in the future, then it would be closest. If you want to know how many times the app will likely be used (across all users, not just the next single random user), then the mean would be appropriate. That would give you the average number of usages of the app by all users. You have a wide range of users' usages of the app, with several at 15. If possible, you could do a regression to predict how many times the app will be used by what kind of user. But you would have to have knowledge of the users, such as gender, age, time of day or other things AND these would have to be viable predictors of app usage in a regression model of your data in order for you to use it to predict future usage. If you were a betting man and wanted to bet on the most likely number of times the app would be used, you should use the mode of 15---but be aware that most users would not use it 15 times and you would be wrong most of the time, although less wrong than choosing any other single number. If you choose the median of 5, then 5 and it's nearest neighbors of 4 and 7 would collectively occur 9 times and be more likely than 15, which only occurred 6 times. So it really depends on what your goal is: predicting what the next single user will do approximately, or taking a gamble on the most likely precise number of usages the next single user will do, or predicting the number of usages across all users. You can predict how many times the next single user will use the app appoximately by using the median; or take a gamble on a precise number and go with the mode, but knowing this gamble would be wrong 5 out of 21 times (or 72% of the time). For the predicted average number of usages (across all users) you would use the mean. Of course, all of this is based on your particular data distribution which you provided. With ideal data (which yours isn't), the mean, median and mode would all be the same in a bell-shaped normal distribution and that number would be the one to use. Some of the above answers suggest finding the number you want by incorporating a PREDICTED number in a formula---but you need to find this predicted number in the first place, which is the crux of your question!
What measure can I use to select a number from a dataset which future values will most likely be clo
I would use the median, because it should be at or near the most likely number of times the next random user would use your app. Even if there are few occurrences of it in your data now, if you're lo
What measure can I use to select a number from a dataset which future values will most likely be closest to? I would use the median, because it should be at or near the most likely number of times the next random user would use your app. Even if there are few occurrences of it in your data now, if you're looking at a random user in the future, then it would be closest. If you want to know how many times the app will likely be used (across all users, not just the next single random user), then the mean would be appropriate. That would give you the average number of usages of the app by all users. You have a wide range of users' usages of the app, with several at 15. If possible, you could do a regression to predict how many times the app will be used by what kind of user. But you would have to have knowledge of the users, such as gender, age, time of day or other things AND these would have to be viable predictors of app usage in a regression model of your data in order for you to use it to predict future usage. If you were a betting man and wanted to bet on the most likely number of times the app would be used, you should use the mode of 15---but be aware that most users would not use it 15 times and you would be wrong most of the time, although less wrong than choosing any other single number. If you choose the median of 5, then 5 and it's nearest neighbors of 4 and 7 would collectively occur 9 times and be more likely than 15, which only occurred 6 times. So it really depends on what your goal is: predicting what the next single user will do approximately, or taking a gamble on the most likely precise number of usages the next single user will do, or predicting the number of usages across all users. You can predict how many times the next single user will use the app appoximately by using the median; or take a gamble on a precise number and go with the mode, but knowing this gamble would be wrong 5 out of 21 times (or 72% of the time). For the predicted average number of usages (across all users) you would use the mean. Of course, all of this is based on your particular data distribution which you provided. With ideal data (which yours isn't), the mean, median and mode would all be the same in a bell-shaped normal distribution and that number would be the one to use. Some of the above answers suggest finding the number you want by incorporating a PREDICTED number in a formula---but you need to find this predicted number in the first place, which is the crux of your question!
What measure can I use to select a number from a dataset which future values will most likely be clo I would use the median, because it should be at or near the most likely number of times the next random user would use your app. Even if there are few occurrences of it in your data now, if you're lo
24,989
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf?
Like you say, any (measurable) function of a random variable is itself a random variable. It is easier to just think of $f(x)$ and $F(x)$ as "any old function". They just happen to have some nice properties. For instance, if $X$ is a standard exponential RV, then there's nothing particularly strange about the random variable $$Y = 1 - e^{-X}$$ It just so happens that $Y=F_X(X)$. The fact that $Y$ has an Uniform distribution (given that $X$ is a continuous RV) can be seen for the general case by deriving the CDF of $Y$. \begin{align*} F_Y(y) &= P(Y \leq y) \\ &= P(F_X(X) \leq y) \\ &= P(X \leq F^{-1}_X(y)) \\ &= F_X(F^{-1}_X(y)) \\ &= y \end{align*} Which is clearly the CDF of a $U(0,1)$ random variable. Note: This version of the proof assumes that $F_X(x)$ is strictly increasing and continuous, but it's not too much harder to show a more general version.
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf?
Like you say, any (measurable) function of a random variable is itself a random variable. It is easier to just think of $f(x)$ and $F(x)$ as "any old function". They just happen to have some nice prop
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf? Like you say, any (measurable) function of a random variable is itself a random variable. It is easier to just think of $f(x)$ and $F(x)$ as "any old function". They just happen to have some nice properties. For instance, if $X$ is a standard exponential RV, then there's nothing particularly strange about the random variable $$Y = 1 - e^{-X}$$ It just so happens that $Y=F_X(X)$. The fact that $Y$ has an Uniform distribution (given that $X$ is a continuous RV) can be seen for the general case by deriving the CDF of $Y$. \begin{align*} F_Y(y) &= P(Y \leq y) \\ &= P(F_X(X) \leq y) \\ &= P(X \leq F^{-1}_X(y)) \\ &= F_X(F^{-1}_X(y)) \\ &= y \end{align*} Which is clearly the CDF of a $U(0,1)$ random variable. Note: This version of the proof assumes that $F_X(x)$ is strictly increasing and continuous, but it's not too much harder to show a more general version.
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf? Like you say, any (measurable) function of a random variable is itself a random variable. It is easier to just think of $f(x)$ and $F(x)$ as "any old function". They just happen to have some nice prop
24,990
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf?
A transform of a random variable $X$ by a measurable function $T:\mathcal{X}\longrightarrow\mathcal{Y}$ is another random variable $Y=T(X)$ which distribution is given by the inverse probability transform $$\mathbb{P}(Y\in A) = \mathbb{P}(X\in\{x;\,T(x)\in A\})\stackrel{\text{def}}{=} \mathbb{P}(X\in T^{-1}(A))$$ for all sets $A$ such that $\{x;\,T(x)\in A\}$ is measurable under the distribution of $X$. This property applies to the special case when $F_X:\mathcal{X}\longrightarrow[0,1]$ is the cdf of the random variable $X$: $Y=F_X(X)$ is a new random variable taking its realisations in $[0,1]$. As it happens, $Y$ is distributed as a Uniform $\mathcal{U}([0,1])$ when $F_X$ is continuous. (If $F_X$ is discontinuous, the range of $Y=F_X(X)$ is no longer $[0,1]$. What is always the case is that when $U$ is a Uniform $\mathcal{U}([0,1])$, then $F_X^{-}(U)$ has the same distribution as $X$, where $F_X^{-}$ denotes the generalised inverse of $F_X$. Which is a formal way to (a) understand random variables as measurable transforms of a fundamental $\omega\in\Omega$ since $X(\omega)=F_X^{-}(\omega)$ is a random variable with cdf $F_X$ and (b) generate random variables from a given distribution with cdf $F_X$.) To understand the paradox of $\mathbb{P}(X\le X)$, take the representation $$F_X(x)=\mathbb{P}(X\le x)=\int_0^x \text{d}F_X(x) = \int_0^x f_X(x)\,\text{d}\lambda(x)$$if $\text{d}\lambda$ is the dominating measure and $f_X$ the corresponding density. Then $$F_X(X)=\int_0^X \text{d}F_X(x) = \int_0^X f_X(x)\,\text{d}\lambda(x)$$ is a random variable since the upper bound of the integral is random. (This is the only random part of the expression.) The apparent contradiction in $\mathbb{P}(X\le X)$ is due to a confusion in notations. To be properly defined, one needs two independent versions of the random variable $X$, $X_1$ and $X_2$, in which case the random variable $F_X(X_1)$ is defined by$$F_X(X_1)=\mathbb{P}^{X_2}(X_2\le X_1)$$the probability being computed for the distribution of $X_2$. The same remark applies to the transform by the density (pdf), $f_X(X)$, which is a new random variable, except that it has no fixed distribution when $f_X$ varies. It is nonetheless useful for statistical purposes when considering for instance a likelihood ratio $f_X(X|\hat{\theta}(X))/f_X(X|\theta_0)$ which 2 x logarithm is approximately a $\chi^2$ random variable under some conditions. And the same holds for the score function$$\dfrac{\partial \log f_X(X|\theta)}{\partial \theta}$$which is a random variable such that its expectation is zero when taken at the true value of the parameter $\theta$, i.e.,$$\mathbb{E}_{\theta_0}\left[ \dfrac{\partial \log f_X(X|\theta_0)}{\partial \theta}\right]=\int \dfrac{\partial \log f_X(x|\theta_0)}{\partial \theta}f_X(x|\theta_0)\,\text{d}\lambda(x)=0$$ [Answer typed while @whuber and @knrumsey were typing their respective answers!]
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf?
A transform of a random variable $X$ by a measurable function $T:\mathcal{X}\longrightarrow\mathcal{Y}$ is another random variable $Y=T(X)$ which distribution is given by the inverse probability trans
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf? A transform of a random variable $X$ by a measurable function $T:\mathcal{X}\longrightarrow\mathcal{Y}$ is another random variable $Y=T(X)$ which distribution is given by the inverse probability transform $$\mathbb{P}(Y\in A) = \mathbb{P}(X\in\{x;\,T(x)\in A\})\stackrel{\text{def}}{=} \mathbb{P}(X\in T^{-1}(A))$$ for all sets $A$ such that $\{x;\,T(x)\in A\}$ is measurable under the distribution of $X$. This property applies to the special case when $F_X:\mathcal{X}\longrightarrow[0,1]$ is the cdf of the random variable $X$: $Y=F_X(X)$ is a new random variable taking its realisations in $[0,1]$. As it happens, $Y$ is distributed as a Uniform $\mathcal{U}([0,1])$ when $F_X$ is continuous. (If $F_X$ is discontinuous, the range of $Y=F_X(X)$ is no longer $[0,1]$. What is always the case is that when $U$ is a Uniform $\mathcal{U}([0,1])$, then $F_X^{-}(U)$ has the same distribution as $X$, where $F_X^{-}$ denotes the generalised inverse of $F_X$. Which is a formal way to (a) understand random variables as measurable transforms of a fundamental $\omega\in\Omega$ since $X(\omega)=F_X^{-}(\omega)$ is a random variable with cdf $F_X$ and (b) generate random variables from a given distribution with cdf $F_X$.) To understand the paradox of $\mathbb{P}(X\le X)$, take the representation $$F_X(x)=\mathbb{P}(X\le x)=\int_0^x \text{d}F_X(x) = \int_0^x f_X(x)\,\text{d}\lambda(x)$$if $\text{d}\lambda$ is the dominating measure and $f_X$ the corresponding density. Then $$F_X(X)=\int_0^X \text{d}F_X(x) = \int_0^X f_X(x)\,\text{d}\lambda(x)$$ is a random variable since the upper bound of the integral is random. (This is the only random part of the expression.) The apparent contradiction in $\mathbb{P}(X\le X)$ is due to a confusion in notations. To be properly defined, one needs two independent versions of the random variable $X$, $X_1$ and $X_2$, in which case the random variable $F_X(X_1)$ is defined by$$F_X(X_1)=\mathbb{P}^{X_2}(X_2\le X_1)$$the probability being computed for the distribution of $X_2$. The same remark applies to the transform by the density (pdf), $f_X(X)$, which is a new random variable, except that it has no fixed distribution when $f_X$ varies. It is nonetheless useful for statistical purposes when considering for instance a likelihood ratio $f_X(X|\hat{\theta}(X))/f_X(X|\theta_0)$ which 2 x logarithm is approximately a $\chi^2$ random variable under some conditions. And the same holds for the score function$$\dfrac{\partial \log f_X(X|\theta)}{\partial \theta}$$which is a random variable such that its expectation is zero when taken at the true value of the parameter $\theta$, i.e.,$$\mathbb{E}_{\theta_0}\left[ \dfrac{\partial \log f_X(X|\theta_0)}{\partial \theta}\right]=\int \dfrac{\partial \log f_X(x|\theta_0)}{\partial \theta}f_X(x|\theta_0)\,\text{d}\lambda(x)=0$$ [Answer typed while @whuber and @knrumsey were typing their respective answers!]
What is the intuitive meaning behind plugging a random variable into its own pdf or cdf? A transform of a random variable $X$ by a measurable function $T:\mathcal{X}\longrightarrow\mathcal{Y}$ is another random variable $Y=T(X)$ which distribution is given by the inverse probability trans
24,991
Interpretation of Bayes Theorem applied to positive mammography results
I will answer this question both from a medical and a statistics standpoint. It has received a lot of attention in the lay press, particularly after the best-seller The Signal and the Noise by Nate Silver, as well as a number of articles in publications such as The New York Times explaining the concept. So I'm very glad that @user2666425 opened this topic on CV. First off, let me please clarify that the $p\,(+|C) = 1$ is not accurate. I can tell you that this figure would be a dream come true. Unfortunately there are a lot of false negative mammograms, particularly in women with dense breast tissue. The estimated figure can be $20\%$ or higher, depending on whether you lump all different types of breast cancers into one (invasive v DCIS), and other factors. This is the reason why other modalities based on sonographic or MRI technology are also applied. A difference between $0.8$ and $1$ is critical in a screening test. Bayes theorem tells us that $\small p(C|+) = \large \frac{p(+|C)}{p(+)}\small* p(C)$, and has recently gotten a lot attention as it relates to mammography in younger, low risk women. I realize this is not exactly what you are asking, which I address in the final paragraphs, but it is the most debated topic. Here is a taste of the issues: The prior (or probability of having cancer based on prevalence) in younger patients, say from 40 - 50 years of age is rather small. According to the NCI it would can round it up at $\sim 1.5\%$ (see table below). This relatively low pre-test probability in itself reduces the post-test conditional probability of having cancer given that the mammogram was positive, regardless of the likelihood or data collected. The probability of a false positive becomes a very significant issue on a screening procedure that will be applied to thousands and thousands of a priori healthy women. So, although the false positive rate of $7 - 10\%$ (which is much higher if you focus on the cumulative risk) may not sound so bad, it is actually an issue of colossal psychological and economical costs, particularly given the low pre-test probability in younger, low-risk patients. Your figure of $1\%$ is widely off the mark - the reality is that "scares" are incredibly common due to many factors, including the medicolegal concerns. So, recalculating and very importantly, for younger women without risk factors: $p(C|+) = \frac{p(+|C)}{p(+)}\small* p(C) =$ $= \frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}\small* p(C) = \large \frac{0.8}{0.8*0.015\, +\, 0.07*0.985}\small*\, 0.015 = 0.148$. The probability of having cancer when a screening mammogram has been read as positive can be as low as $15\%$ in young, low-risk women. As an aside, mammographic readings come with an indirect estimate of the confidence in the diagnosis the radiologist has (it is called BI-RADS), and this Bayesian analysis would change radically as we progress from a BI-RADS 3 to a BI-RADS 5 - all of them "positive" tests in the broadest sense. This figure can logically be changed depending on what estimates you consider in your calculation, but the truth is that the recommendations for the starting age to enter a screening mammography program have recently been pushed up from age $40$ to $45$. In older women the prevalence (and hence the pre-test probability) increases linearly with age. According to the current report, the risk that a woman will be diagnosed with breast cancer during the next 10 years, starting at the following ages, is as follows: Age 30 . . . . . . 0.44 percent (or 1 in 227) Age 40 . . . . . . 1.47 percent (or 1 in 68) Age 50 . . . . . . 2.38 percent (or 1 in 42) Age 60 . . . . . . 3.56 percent (or 1 in 28) Age 70 . . . . . . 3.82 percent (or 1 in 26) This results in a life-time cumulative risk of approximately $10\%$: The calculation in older women with a prevalence of $4\%$ would be: $p(C|+)=\large \frac{0.8}{0.8*0.04\, +\, 0.07*0.96}\small*\, 0.04 = 0.32 \sim 32\%$ lower than you calculated. I can't overemphasize how many "scares" there are even in older populations. As a screening procedure a mammogram is simply the first step so it makes sense for the positive mammogram to be basically interpreted as there is a possibility that the patient has breast cancer, warranting further work-up with ultrasound, additional (diagnostic) mammographic testing, follow-up mammograms, MRI or biopsy. If the $p(C|+)$ was very high we wouldn't be dealing with a screening test it would be a diagnostic test, such as a biopsy. Specific answer to your question: It is the "scares", the $p(+|\bar C)$ of $7-10\%$, and not $1\%$ as in the OP, in combination with a relative low prevalence of disease (low pre-test probability or high $p(\bar C)$) especially in younger women, that accounts for this lower post-test probability across ages. Notice that this "false alarm rate" is multiplied by the much larger proportion of cases without cancer (compared with patients with cancer) in the denominator, not the "the tiny 1% chance of a false positive in 1% of the population" you mention. I believe this is the answer to your question. To emphasize, although this would be unacceptable in a diagnostic test, it is still worthwhile in a screening procedure. Intuition issue: @Juho Kokkala brought up the issue that the OP was asking about the intuition. I thought it was implied in the calculations and the closing paragraphs, but fair enough... This is how I would explain it to a friend... Let's pretend we are going hunting for meteor fragments with a metal detector in Winslow, Arizona. Right here: Image from meteorcrater.com ... and the metal detector goes off. Well, if you said that chances are that it is from a coin a tourist dropped off, you'd probably be right. But you get the gist: if the place hadn't been so thoroughly screened, it would be much more likely that a beep from the detector on a place like this came from a fragment of meteor than if we were on the streets of NYC. What we are doing with mammography is going to a healthy population, looking for a silent disease that if not caught early can be lethal. Fortunately, the prevalence (although very high compared with other less curable cancers) is low enough that the probability of randomly encountering cancer is low, even if the results are "positive", and especially in young women. On the other hand, if there were no false positives, i.e. ($p(\bar C|+)=0$, $\frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}\small* p(C) = \frac{p(+|C)}{p(+|C)\,*\,p(C)}\small* p(C) = 1$, much as the probability of having hit a meteor fragment if our metal detector went off would be $100\%$ independent of the area we happened to be exploring if instead of a regular metal detector we were using a perfectly accurate instrument to detect outer-space amino acids in the meteor fragment (made-up example). It would still be more likely to find a fragment in the Arizona desert than in New York City, but if the detector happened to beep, we'd know we had found a meteor. Since we never have a perfectly accurate measuring device or system, the fraction $\frac{\text{likelihood}}{\text{unconditional p(+)}}=\frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}$ will be $<1$, and the more imperfect it is, the lesser the fraction of the $p(C)$, or prior, that will be "passed on" to the LHS of the equation as the posterior. If we settle on a particular type of detector, the likelihood fraction will act as constant in a linear equation of the form, $\text{posterior} = \alpha * \text{prior}$, where the $\text{posterior} < \text{prior}$, and the smaller the prior, the linearly smaller will the posterior be. This is referred to as the dependence on prevalence of the positive predictive value (PPV): probability that subjects with a positive screening test truly have the disease.
Interpretation of Bayes Theorem applied to positive mammography results
I will answer this question both from a medical and a statistics standpoint. It has received a lot of attention in the lay press, particularly after the best-seller The Signal and the Noise by Nate Si
Interpretation of Bayes Theorem applied to positive mammography results I will answer this question both from a medical and a statistics standpoint. It has received a lot of attention in the lay press, particularly after the best-seller The Signal and the Noise by Nate Silver, as well as a number of articles in publications such as The New York Times explaining the concept. So I'm very glad that @user2666425 opened this topic on CV. First off, let me please clarify that the $p\,(+|C) = 1$ is not accurate. I can tell you that this figure would be a dream come true. Unfortunately there are a lot of false negative mammograms, particularly in women with dense breast tissue. The estimated figure can be $20\%$ or higher, depending on whether you lump all different types of breast cancers into one (invasive v DCIS), and other factors. This is the reason why other modalities based on sonographic or MRI technology are also applied. A difference between $0.8$ and $1$ is critical in a screening test. Bayes theorem tells us that $\small p(C|+) = \large \frac{p(+|C)}{p(+)}\small* p(C)$, and has recently gotten a lot attention as it relates to mammography in younger, low risk women. I realize this is not exactly what you are asking, which I address in the final paragraphs, but it is the most debated topic. Here is a taste of the issues: The prior (or probability of having cancer based on prevalence) in younger patients, say from 40 - 50 years of age is rather small. According to the NCI it would can round it up at $\sim 1.5\%$ (see table below). This relatively low pre-test probability in itself reduces the post-test conditional probability of having cancer given that the mammogram was positive, regardless of the likelihood or data collected. The probability of a false positive becomes a very significant issue on a screening procedure that will be applied to thousands and thousands of a priori healthy women. So, although the false positive rate of $7 - 10\%$ (which is much higher if you focus on the cumulative risk) may not sound so bad, it is actually an issue of colossal psychological and economical costs, particularly given the low pre-test probability in younger, low-risk patients. Your figure of $1\%$ is widely off the mark - the reality is that "scares" are incredibly common due to many factors, including the medicolegal concerns. So, recalculating and very importantly, for younger women without risk factors: $p(C|+) = \frac{p(+|C)}{p(+)}\small* p(C) =$ $= \frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}\small* p(C) = \large \frac{0.8}{0.8*0.015\, +\, 0.07*0.985}\small*\, 0.015 = 0.148$. The probability of having cancer when a screening mammogram has been read as positive can be as low as $15\%$ in young, low-risk women. As an aside, mammographic readings come with an indirect estimate of the confidence in the diagnosis the radiologist has (it is called BI-RADS), and this Bayesian analysis would change radically as we progress from a BI-RADS 3 to a BI-RADS 5 - all of them "positive" tests in the broadest sense. This figure can logically be changed depending on what estimates you consider in your calculation, but the truth is that the recommendations for the starting age to enter a screening mammography program have recently been pushed up from age $40$ to $45$. In older women the prevalence (and hence the pre-test probability) increases linearly with age. According to the current report, the risk that a woman will be diagnosed with breast cancer during the next 10 years, starting at the following ages, is as follows: Age 30 . . . . . . 0.44 percent (or 1 in 227) Age 40 . . . . . . 1.47 percent (or 1 in 68) Age 50 . . . . . . 2.38 percent (or 1 in 42) Age 60 . . . . . . 3.56 percent (or 1 in 28) Age 70 . . . . . . 3.82 percent (or 1 in 26) This results in a life-time cumulative risk of approximately $10\%$: The calculation in older women with a prevalence of $4\%$ would be: $p(C|+)=\large \frac{0.8}{0.8*0.04\, +\, 0.07*0.96}\small*\, 0.04 = 0.32 \sim 32\%$ lower than you calculated. I can't overemphasize how many "scares" there are even in older populations. As a screening procedure a mammogram is simply the first step so it makes sense for the positive mammogram to be basically interpreted as there is a possibility that the patient has breast cancer, warranting further work-up with ultrasound, additional (diagnostic) mammographic testing, follow-up mammograms, MRI or biopsy. If the $p(C|+)$ was very high we wouldn't be dealing with a screening test it would be a diagnostic test, such as a biopsy. Specific answer to your question: It is the "scares", the $p(+|\bar C)$ of $7-10\%$, and not $1\%$ as in the OP, in combination with a relative low prevalence of disease (low pre-test probability or high $p(\bar C)$) especially in younger women, that accounts for this lower post-test probability across ages. Notice that this "false alarm rate" is multiplied by the much larger proportion of cases without cancer (compared with patients with cancer) in the denominator, not the "the tiny 1% chance of a false positive in 1% of the population" you mention. I believe this is the answer to your question. To emphasize, although this would be unacceptable in a diagnostic test, it is still worthwhile in a screening procedure. Intuition issue: @Juho Kokkala brought up the issue that the OP was asking about the intuition. I thought it was implied in the calculations and the closing paragraphs, but fair enough... This is how I would explain it to a friend... Let's pretend we are going hunting for meteor fragments with a metal detector in Winslow, Arizona. Right here: Image from meteorcrater.com ... and the metal detector goes off. Well, if you said that chances are that it is from a coin a tourist dropped off, you'd probably be right. But you get the gist: if the place hadn't been so thoroughly screened, it would be much more likely that a beep from the detector on a place like this came from a fragment of meteor than if we were on the streets of NYC. What we are doing with mammography is going to a healthy population, looking for a silent disease that if not caught early can be lethal. Fortunately, the prevalence (although very high compared with other less curable cancers) is low enough that the probability of randomly encountering cancer is low, even if the results are "positive", and especially in young women. On the other hand, if there were no false positives, i.e. ($p(\bar C|+)=0$, $\frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}\small* p(C) = \frac{p(+|C)}{p(+|C)\,*\,p(C)}\small* p(C) = 1$, much as the probability of having hit a meteor fragment if our metal detector went off would be $100\%$ independent of the area we happened to be exploring if instead of a regular metal detector we were using a perfectly accurate instrument to detect outer-space amino acids in the meteor fragment (made-up example). It would still be more likely to find a fragment in the Arizona desert than in New York City, but if the detector happened to beep, we'd know we had found a meteor. Since we never have a perfectly accurate measuring device or system, the fraction $\frac{\text{likelihood}}{\text{unconditional p(+)}}=\frac{p(+|C)}{p(+|C)\,*\,p(C)\, +\, p(+|\bar C)\,*\,p(\bar C)}$ will be $<1$, and the more imperfect it is, the lesser the fraction of the $p(C)$, or prior, that will be "passed on" to the LHS of the equation as the posterior. If we settle on a particular type of detector, the likelihood fraction will act as constant in a linear equation of the form, $\text{posterior} = \alpha * \text{prior}$, where the $\text{posterior} < \text{prior}$, and the smaller the prior, the linearly smaller will the posterior be. This is referred to as the dependence on prevalence of the positive predictive value (PPV): probability that subjects with a positive screening test truly have the disease.
Interpretation of Bayes Theorem applied to positive mammography results I will answer this question both from a medical and a statistics standpoint. It has received a lot of attention in the lay press, particularly after the best-seller The Signal and the Noise by Nate Si
24,992
Interpretation of Bayes Theorem applied to positive mammography results
A key problem with mammography that hasn't been adequately addressed in the discourse is the faulty definition of "positive". This is described in the Diagnosis chapter in http://biostat.mc.vanderbilt.edu/ClinStat - see the link for Biostatistics in Biomedical Research there. One of the most widely used diagnostic coding systems in mammography is the BI-RADS score, and a score of 4 is a frequent "positive" result. The definition of category 4 is "Not characteristic of breast cancer, but reasonable probability of being malignant (3 to 94%); biopsy should be considered." With a risk range that goes all the way from 0.03 to 0.94 for one category, i.e., incredible heterogeneity in what "positive" really means, it is no wonder that we have a mess on our hands. It is also a sign of unclear thinking that the BI-RADS system has no category for someone with an estimated risk of 0.945. As Nate Silver so eloquently argues in The Signal and the Noise, if we were to think probabilistically we would make better decisions all around. Removing terms such as "positive" and "negative" for medical tests would remove false positives and false negatives and convey uncertainty (and justification for more tests before making a diagnosis) optimally.
Interpretation of Bayes Theorem applied to positive mammography results
A key problem with mammography that hasn't been adequately addressed in the discourse is the faulty definition of "positive". This is described in the Diagnosis chapter in http://biostat.mc.vanderbil
Interpretation of Bayes Theorem applied to positive mammography results A key problem with mammography that hasn't been adequately addressed in the discourse is the faulty definition of "positive". This is described in the Diagnosis chapter in http://biostat.mc.vanderbilt.edu/ClinStat - see the link for Biostatistics in Biomedical Research there. One of the most widely used diagnostic coding systems in mammography is the BI-RADS score, and a score of 4 is a frequent "positive" result. The definition of category 4 is "Not characteristic of breast cancer, but reasonable probability of being malignant (3 to 94%); biopsy should be considered." With a risk range that goes all the way from 0.03 to 0.94 for one category, i.e., incredible heterogeneity in what "positive" really means, it is no wonder that we have a mess on our hands. It is also a sign of unclear thinking that the BI-RADS system has no category for someone with an estimated risk of 0.945. As Nate Silver so eloquently argues in The Signal and the Noise, if we were to think probabilistically we would make better decisions all around. Removing terms such as "positive" and "negative" for medical tests would remove false positives and false negatives and convey uncertainty (and justification for more tests before making a diagnosis) optimally.
Interpretation of Bayes Theorem applied to positive mammography results A key problem with mammography that hasn't been adequately addressed in the discourse is the faulty definition of "positive". This is described in the Diagnosis chapter in http://biostat.mc.vanderbil
24,993
Interpretation of Bayes Theorem applied to positive mammography results
There is a nice discussion of this in the book Calculated Risks Much of the book is about finding clearer ways of talking about, and thinking about, probability and risk. An example: The probability that a woman of age 40 has breast cancer is about 1 percent. If she has breast cancer, the probability that she will test positive on a screening mammogram is about 90 percent. If she does not have breast cancer, the probability that she will nevertheless test positive is 9 percent. What are the chances that a woman who tests positive actually has breast cancer? This is the way the book presents the solution, using 'natural frequencies'. Consider 10,000 women, 1% have cancer so that is 100 women. Of these, 90% will return positive tests (i.e. 90 women with cancer will test positive). Of the 9900 without cancer 9% will return positive test or 891 women. So there are 891 + 90 = 981 women with positive tests of which 90 have cancer. So the chance that a woman with a positive test has cancer is 90/981 = 0.092 If 100% of woman with cancer test positive that just changes the numbers a bit to 100/(100 + 891) = 0.1
Interpretation of Bayes Theorem applied to positive mammography results
There is a nice discussion of this in the book Calculated Risks Much of the book is about finding clearer ways of talking about, and thinking about, probability and risk. An example: The probability
Interpretation of Bayes Theorem applied to positive mammography results There is a nice discussion of this in the book Calculated Risks Much of the book is about finding clearer ways of talking about, and thinking about, probability and risk. An example: The probability that a woman of age 40 has breast cancer is about 1 percent. If she has breast cancer, the probability that she will test positive on a screening mammogram is about 90 percent. If she does not have breast cancer, the probability that she will nevertheless test positive is 9 percent. What are the chances that a woman who tests positive actually has breast cancer? This is the way the book presents the solution, using 'natural frequencies'. Consider 10,000 women, 1% have cancer so that is 100 women. Of these, 90% will return positive tests (i.e. 90 women with cancer will test positive). Of the 9900 without cancer 9% will return positive test or 891 women. So there are 891 + 90 = 981 women with positive tests of which 90 have cancer. So the chance that a woman with a positive test has cancer is 90/981 = 0.092 If 100% of woman with cancer test positive that just changes the numbers a bit to 100/(100 + 891) = 0.1
Interpretation of Bayes Theorem applied to positive mammography results There is a nice discussion of this in the book Calculated Risks Much of the book is about finding clearer ways of talking about, and thinking about, probability and risk. An example: The probability
24,994
Interpretation of Bayes Theorem applied to positive mammography results
Perhaps this line of thinking is correct?: For any random person, there is a 1% chance that they have cancer, and so there is then a $.01 * 1$ chance that the mammogram of a random person will be positive. If they do not have cancer, there is a 1% chance that the mammogram will be positive. So it is intuitively close to a coin flip for a random person. I'm not sure how to explain the additional $0.0025$ in favor of cancer given a positive mammogram.
Interpretation of Bayes Theorem applied to positive mammography results
Perhaps this line of thinking is correct?: For any random person, there is a 1% chance that they have cancer, and so there is then a $.01 * 1$ chance that the mammogram of a random person will be posi
Interpretation of Bayes Theorem applied to positive mammography results Perhaps this line of thinking is correct?: For any random person, there is a 1% chance that they have cancer, and so there is then a $.01 * 1$ chance that the mammogram of a random person will be positive. If they do not have cancer, there is a 1% chance that the mammogram will be positive. So it is intuitively close to a coin flip for a random person. I'm not sure how to explain the additional $0.0025$ in favor of cancer given a positive mammogram.
Interpretation of Bayes Theorem applied to positive mammography results Perhaps this line of thinking is correct?: For any random person, there is a 1% chance that they have cancer, and so there is then a $.01 * 1$ chance that the mammogram of a random person will be posi
24,995
Interpretation of Bayes Theorem applied to positive mammography results
Here's an oversimplified but intuitive way to look at it. Consider 100 people. One has cancer and will test positive. Of the 99 who don't, one of them will get a false positive test. So of the two positives, one will have cancer and one won't.
Interpretation of Bayes Theorem applied to positive mammography results
Here's an oversimplified but intuitive way to look at it. Consider 100 people. One has cancer and will test positive. Of the 99 who don't, one of them will get a false positive test. So of the two
Interpretation of Bayes Theorem applied to positive mammography results Here's an oversimplified but intuitive way to look at it. Consider 100 people. One has cancer and will test positive. Of the 99 who don't, one of them will get a false positive test. So of the two positives, one will have cancer and one won't.
Interpretation of Bayes Theorem applied to positive mammography results Here's an oversimplified but intuitive way to look at it. Consider 100 people. One has cancer and will test positive. Of the 99 who don't, one of them will get a false positive test. So of the two
24,996
What does the formula y ~ x + 0 in R actually calculate?
Adding +0 (or -1) to a model formula (e.g., in lm()) in R suppresses the intercept. This is generally considered a bad thing to do; see: When is it OK to remove the intercept in lm()? When forcing intercept of 0 in linear regression is acceptable/advisable The estimated slope is calculated differently depending on whether the intercept is estimated as well, namely: \begin{align} \hat\beta_1 &= \frac{\sum x_iy_i - \frac{\big(\sum x_i\big)\big(\sum y_i\big)}{N}}{\sum x_i^2 - \frac{\big(\sum x_i\big)^2}{N}} \tag{with intercept} \\[15pt] \hat\beta_1 &= \frac{\sum x_iy_i}{\sum x_i^2} \tag{without intercept} \end{align} Since the quantity to be subtracted (the "subtrahend") in both the numerator and denominator are not necessarily $0$, the estimate of the slope is biased when the intercept is suppressed. The value for $R^2$ is also calculated differently; see: Removal of statistically significant intercept term boosts $R^2$ in linear model How can R2 have two different values for the same regression (without an intercept) Here are the underlying formulas: \begin{align} R^2 &= 1 - \frac{\sum (y_i - \hat y_i)^2}{\sum (y_i - \bar y)^2} \tag{with intercept} \\[15pt] R^2 &= 1 - \frac{\sum (y_i - \hat y_i)^2}{\sum y_i^2} \tag{without intercept} \end{align}
What does the formula y ~ x + 0 in R actually calculate?
Adding +0 (or -1) to a model formula (e.g., in lm()) in R suppresses the intercept. This is generally considered a bad thing to do; see: When is it OK to remove the intercept in lm()? When forcing
What does the formula y ~ x + 0 in R actually calculate? Adding +0 (or -1) to a model formula (e.g., in lm()) in R suppresses the intercept. This is generally considered a bad thing to do; see: When is it OK to remove the intercept in lm()? When forcing intercept of 0 in linear regression is acceptable/advisable The estimated slope is calculated differently depending on whether the intercept is estimated as well, namely: \begin{align} \hat\beta_1 &= \frac{\sum x_iy_i - \frac{\big(\sum x_i\big)\big(\sum y_i\big)}{N}}{\sum x_i^2 - \frac{\big(\sum x_i\big)^2}{N}} \tag{with intercept} \\[15pt] \hat\beta_1 &= \frac{\sum x_iy_i}{\sum x_i^2} \tag{without intercept} \end{align} Since the quantity to be subtracted (the "subtrahend") in both the numerator and denominator are not necessarily $0$, the estimate of the slope is biased when the intercept is suppressed. The value for $R^2$ is also calculated differently; see: Removal of statistically significant intercept term boosts $R^2$ in linear model How can R2 have two different values for the same regression (without an intercept) Here are the underlying formulas: \begin{align} R^2 &= 1 - \frac{\sum (y_i - \hat y_i)^2}{\sum (y_i - \bar y)^2} \tag{with intercept} \\[15pt] R^2 &= 1 - \frac{\sum (y_i - \hat y_i)^2}{\sum y_i^2} \tag{without intercept} \end{align}
What does the formula y ~ x + 0 in R actually calculate? Adding +0 (or -1) to a model formula (e.g., in lm()) in R suppresses the intercept. This is generally considered a bad thing to do; see: When is it OK to remove the intercept in lm()? When forcing
24,997
What does the formula y ~ x + 0 in R actually calculate?
It depends on context (of course), in the lm(...) command in R it will suppress the intercept. That is, you do regression though the origin. Note that most textbook on the subject of regression, will tell you that forcing the intercept (to any value) is a bad idea. The interpretation of x does not change, but the value (comparing with and without an intercept) will change, sometimes very significantly.
What does the formula y ~ x + 0 in R actually calculate?
It depends on context (of course), in the lm(...) command in R it will suppress the intercept. That is, you do regression though the origin. Note that most textbook on the subject of regression, will
What does the formula y ~ x + 0 in R actually calculate? It depends on context (of course), in the lm(...) command in R it will suppress the intercept. That is, you do regression though the origin. Note that most textbook on the subject of regression, will tell you that forcing the intercept (to any value) is a bad idea. The interpretation of x does not change, but the value (comparing with and without an intercept) will change, sometimes very significantly.
What does the formula y ~ x + 0 in R actually calculate? It depends on context (of course), in the lm(...) command in R it will suppress the intercept. That is, you do regression though the origin. Note that most textbook on the subject of regression, will
24,998
Identifying filtered features after feature selection with scikit learn
There are two things that you can do: Check coef_ param and detect which column was ignored Use the same model for input data transformation using method transform Small modifications for your example >>> from sklearn.svm import LinearSVC >>> from sklearn.datasets import load_iris >>> from sklearn.cross_validation import train_test_split >>> >>> iris = load_iris() >>> x_train, x_test, y_train, y_test = train_test_split( ... iris.data, iris.target, train_size=0.7 ... ) >>> >>> svc = LinearSVC(C=0.01, penalty="l1", dual=False) >>> >>> X_train_new = svc.fit_transform(x_train, y_train) >>> print(X_train_new.shape) (105, 3) >>> >>> X_test_new = svc.transform(x_test) >>> print(X_test_new.shape) (45, 3) >>> >>> print(svc.coef_) [[ 0. 0.10895557 -0.20603044 0. ] [-0.00514987 -0.05676593 0. 0. ] [ 0. -0.09839843 0.02111212 0. ]] As you see method transform do all job for you. And also from coef_ matrix you can see that last column just a zero vector, so you model ignore last column from data
Identifying filtered features after feature selection with scikit learn
There are two things that you can do: Check coef_ param and detect which column was ignored Use the same model for input data transformation using method transform Small modifications for your examp
Identifying filtered features after feature selection with scikit learn There are two things that you can do: Check coef_ param and detect which column was ignored Use the same model for input data transformation using method transform Small modifications for your example >>> from sklearn.svm import LinearSVC >>> from sklearn.datasets import load_iris >>> from sklearn.cross_validation import train_test_split >>> >>> iris = load_iris() >>> x_train, x_test, y_train, y_test = train_test_split( ... iris.data, iris.target, train_size=0.7 ... ) >>> >>> svc = LinearSVC(C=0.01, penalty="l1", dual=False) >>> >>> X_train_new = svc.fit_transform(x_train, y_train) >>> print(X_train_new.shape) (105, 3) >>> >>> X_test_new = svc.transform(x_test) >>> print(X_test_new.shape) (45, 3) >>> >>> print(svc.coef_) [[ 0. 0.10895557 -0.20603044 0. ] [-0.00514987 -0.05676593 0. 0. ] [ 0. -0.09839843 0.02111212 0. ]] As you see method transform do all job for you. And also from coef_ matrix you can see that last column just a zero vector, so you model ignore last column from data
Identifying filtered features after feature selection with scikit learn There are two things that you can do: Check coef_ param and detect which column was ignored Use the same model for input data transformation using method transform Small modifications for your examp
24,999
Identifying filtered features after feature selection with scikit learn
Alternatively, if you use SelectFromModel for feature selection after fitting your SVC, you can use the instance method get_support. This returns a boolean array mapping the selection of each feature. Next join this with an original feature names array, and then filter on the boolean statuses to produce the set of relevant selected features' names. Hope this helps future readers who also struggled to find the best way to get relevant feature names after feature selection. Example: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X) print(X_new.shape) print(model.get_support())
Identifying filtered features after feature selection with scikit learn
Alternatively, if you use SelectFromModel for feature selection after fitting your SVC, you can use the instance method get_support. This returns a boolean array mapping the selection of each feature.
Identifying filtered features after feature selection with scikit learn Alternatively, if you use SelectFromModel for feature selection after fitting your SVC, you can use the instance method get_support. This returns a boolean array mapping the selection of each feature. Next join this with an original feature names array, and then filter on the boolean statuses to produce the set of relevant selected features' names. Hope this helps future readers who also struggled to find the best way to get relevant feature names after feature selection. Example: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X) print(X_new.shape) print(model.get_support())
Identifying filtered features after feature selection with scikit learn Alternatively, if you use SelectFromModel for feature selection after fitting your SVC, you can use the instance method get_support. This returns a boolean array mapping the selection of each feature.
25,000
Identifying filtered features after feature selection with scikit learn
Based on @chinnychinchin solution, I usually do: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X) print(X.columns[model.get_support()]) which returns something like: Index([u'feature1', u'feature2', u'feature', u'feature4'], dtype='object')
Identifying filtered features after feature selection with scikit learn
Based on @chinnychinchin solution, I usually do: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X)
Identifying filtered features after feature selection with scikit learn Based on @chinnychinchin solution, I usually do: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X) print(X.columns[model.get_support()]) which returns something like: Index([u'feature1', u'feature2', u'feature', u'feature4'], dtype='object')
Identifying filtered features after feature selection with scikit learn Based on @chinnychinchin solution, I usually do: lsvc = LinearSVC(C=0.01, penalty="l1", dual=False,max_iter=2000).fit(X, y) model = sk.SelectFromModel(lsvc, prefit=True) X_new = model.transform(X)