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
27,901
Separating the populations in a bimodal distribution
Actually that algorithm sounds like it is using precisely the methodology that Macro was suggesting. The idea is that you have a distribution $$F(x)=pF_{1}(x)+(1-p)F_{2}(x)$$ where $F_1$ and $F_2$ are specified up to a few parameters that are estimated from the data. In your case $F_1$ and $F_2$ are both Gaussian and there would be 5 parameters to estimate from the data, $p, σ_1, σ_2, μ_1$, and $μ_2$ the mixture proportion and the standard deviations and means respectively for the distributions $F_1$ and $F_2$. There is actually no unique separation point since the distributions overlap. But the algorithm probably picks the crossing point for the densities. Since these are Gaussian distributions there will only be one unless one has a very large variance compared to the other. Without knowing the algorithm, I wouldn't know how many of these parameters are estimated. For example both standard deviations could be estimated or they could be assumed equal and only a pooled standard deviation would be estimated. 5 parameters estimated in the first case and 4 in the second. After the parameters of $F_1$ and $F_2$ are estimated you use the distributions specified by the estimates to calculate the crossing point.
Separating the populations in a bimodal distribution
Actually that algorithm sounds like it is using precisely the methodology that Macro was suggesting. The idea is that you have a distribution $$F(x)=pF_{1}(x)+(1-p)F_{2}(x)$$ where $F_1$ and $F_2$ a
Separating the populations in a bimodal distribution Actually that algorithm sounds like it is using precisely the methodology that Macro was suggesting. The idea is that you have a distribution $$F(x)=pF_{1}(x)+(1-p)F_{2}(x)$$ where $F_1$ and $F_2$ are specified up to a few parameters that are estimated from the data. In your case $F_1$ and $F_2$ are both Gaussian and there would be 5 parameters to estimate from the data, $p, σ_1, σ_2, μ_1$, and $μ_2$ the mixture proportion and the standard deviations and means respectively for the distributions $F_1$ and $F_2$. There is actually no unique separation point since the distributions overlap. But the algorithm probably picks the crossing point for the densities. Since these are Gaussian distributions there will only be one unless one has a very large variance compared to the other. Without knowing the algorithm, I wouldn't know how many of these parameters are estimated. For example both standard deviations could be estimated or they could be assumed equal and only a pooled standard deviation would be estimated. 5 parameters estimated in the first case and 4 in the second. After the parameters of $F_1$ and $F_2$ are estimated you use the distributions specified by the estimates to calculate the crossing point.
Separating the populations in a bimodal distribution Actually that algorithm sounds like it is using precisely the methodology that Macro was suggesting. The idea is that you have a distribution $$F(x)=pF_{1}(x)+(1-p)F_{2}(x)$$ where $F_1$ and $F_2$ a
27,902
Separating the populations in a bimodal distribution
For anyone else interested, I used Gaussian Mixture Modeling (GMM) algorithm to determine the means of the two populations and separate them. Details of the techniques used are explained in the paper linked on this page: http://www-personal.umich.edu/~ognedin/gmm/gmm_user_guide.pdf Gnedin, O. (2010). Quantifying bimodality
Separating the populations in a bimodal distribution
For anyone else interested, I used Gaussian Mixture Modeling (GMM) algorithm to determine the means of the two populations and separate them. Details of the techniques used are explained in the paper
Separating the populations in a bimodal distribution For anyone else interested, I used Gaussian Mixture Modeling (GMM) algorithm to determine the means of the two populations and separate them. Details of the techniques used are explained in the paper linked on this page: http://www-personal.umich.edu/~ognedin/gmm/gmm_user_guide.pdf Gnedin, O. (2010). Quantifying bimodality
Separating the populations in a bimodal distribution For anyone else interested, I used Gaussian Mixture Modeling (GMM) algorithm to determine the means of the two populations and separate them. Details of the techniques used are explained in the paper
27,903
Separating the populations in a bimodal distribution
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. You can use the Otsu's method, you can think at your histogram as the histogram of the grey values of pixels in an image. Then, in computer vision and image processing, Otsu's method, named after Nobuyuki Otsu (大津展之 Ōtsu Nobuyuki)1, is used to automatically perform clustering-based image thresholding, or, and that is your case, the reduction of a graylevel image to a binary image. The algorithm assumes that the image contains two classes of pixels following bi-modal histogram (foreground pixels and background pixels), it then calculates the optimum threshold separating the two classes so that their combined spread (intra-class variance) is minimal, or equivalently (because the sum of pairwise squared distances is constant), so that their inter-class variance is maximal. 1Otsu, Nobuyuki. "A threshold selection method from gray-level histograms." IEEE transactions on systems, man, and cybernetics 9.1 (1979): 62-66.
Separating the populations in a bimodal distribution
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
Separating the populations in a bimodal distribution Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. You can use the Otsu's method, you can think at your histogram as the histogram of the grey values of pixels in an image. Then, in computer vision and image processing, Otsu's method, named after Nobuyuki Otsu (大津展之 Ōtsu Nobuyuki)1, is used to automatically perform clustering-based image thresholding, or, and that is your case, the reduction of a graylevel image to a binary image. The algorithm assumes that the image contains two classes of pixels following bi-modal histogram (foreground pixels and background pixels), it then calculates the optimum threshold separating the two classes so that their combined spread (intra-class variance) is minimal, or equivalently (because the sum of pairwise squared distances is constant), so that their inter-class variance is maximal. 1Otsu, Nobuyuki. "A threshold selection method from gray-level histograms." IEEE transactions on systems, man, and cybernetics 9.1 (1979): 62-66.
Separating the populations in a bimodal distribution Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
27,904
Separating the populations in a bimodal distribution
You can use the check to "normality" (there are many packages): The algorithm is simple: split var into bins. count the number of observations and the expected, take the difference, standardize by expected. The bin in which we have the min of standardized res - will contain the desired optimal threshold for dichotomisation! (2 bins with max stdRes= modes of yours 2 distributions ;-). Don't fogot play with (try) differrent bin numbers! Next you try to clarify within this interval via model selection (KLIC/CAIC/BIC/etc).
Separating the populations in a bimodal distribution
You can use the check to "normality" (there are many packages): The algorithm is simple: split var into bins. count the number of observations and the expected, take the difference, standardize by ex
Separating the populations in a bimodal distribution You can use the check to "normality" (there are many packages): The algorithm is simple: split var into bins. count the number of observations and the expected, take the difference, standardize by expected. The bin in which we have the min of standardized res - will contain the desired optimal threshold for dichotomisation! (2 bins with max stdRes= modes of yours 2 distributions ;-). Don't fogot play with (try) differrent bin numbers! Next you try to clarify within this interval via model selection (KLIC/CAIC/BIC/etc).
Separating the populations in a bimodal distribution You can use the check to "normality" (there are many packages): The algorithm is simple: split var into bins. count the number of observations and the expected, take the difference, standardize by ex
27,905
How to forecast based on aggregated data over irregular intervals?
Let's focus on the business problem, develop a strategy to address it, and begin implementing that strategy in a simple way. Later, it can be improved if the effort warrants it. The business problem is to maximize profits, of course. That is done here by balancing the costs of refilling machines against the costs of lost sales. In its current formulation, the costs of refilling the machines are fixed: 20 can be refilled each day. The cost of lost sales therefore depends on the frequency with which machines are empty. A conceptual statistical model for this problem can be obtained by devising some way to estimate the costs for each of the machines, based on previous data. The expected cost of not servicing a machine today approximately equals the chance it has run out times the rate at which it is used. For example, if a machine has a 25% chance of being empty today and on average sells 4 bottles per day, its expected cost equals 25% * 4 = 1 bottle in lost sales. (Translate that into dollars as you will, not forgetting that one lost sale incurs intangible costs: people see an empty machine, they learn not to rely on it, etc. You can even adjust this cost according to a machine's location; having some obscure machines run empty for a while might incur few intangible costs.) It's fair to assume that refilling a machine will immediately reset that expected loss to zero--it should be rare that a machine will get emptied every day (don't you wish...). As time goes by, the expected loss starts to rise until eventually it reaches a limiting value equal to the expected daily sales: an example is shown in the second figure below. A simple statistical model along these lines proposes that fluctuations in a machine's use appear random. This suggests a Poisson model. Specifically, we may posit that a machine has an underlying daily sales rate of $\theta$ bottles and that the number sold during a period of duration $x$ days has a Poisson distribution with parameter $\theta x$. (Other models can be formulated to handle the possibility of clusters of sales; this one supposes that sales are individual, intermittent, and independent of each other.) In the present example, the observed durations are $x=(7, 7, 7, 13, 11, 9, 8, 7, 8, 10)$ and the corresponding sales were $y=(4, 14, 4, 16, 16, 12, 7, 16, 24, 48)$. Maximizing the likelihood gives $\hat{\theta} = 1.8506$: this machine has been selling about two bottles per day. The data history is not long enough to suggest that any more complicated model is needed; this is an adequate description of what has been observed so far. The red dots show the sequence of sales; the blue dots are estimates based on the maximum likelihood estimate of the typical sales rate. Armed with an estimated sales rate, we can go on to compute the chance that a machine may be empty after $t$ days: it is given by the complementary cumulative distribution function (CCDF) of the Poisson distribution, as evaluated at the machine's capacity (presumed to be 50 in the next figure and the examples below). Multiplying by the estimated sales rate gives a plot of the expected daily loss in sales versus time since last refill: Naturally this curve is rising fastest near the time at $50/1.85 = 27$ days when the machine is most likely to run out. What it adds to our understanding is to show that an appreciable rise actually begins a week earlier than that. Other machines with other rates will have steeper or shallower rises: that will be useful information. Given a chart like this for each machine (of which it seems there are a couple hundred), you can easily identify the 20 machines currently experiencing the greatest expected loss: servicing them is the optimal business decision. (Note that each machine will have its own estimated rate and will be at its own point along its curve, depending on when it was last serviced.) Nobody actually has to look at these charts: identifying the machines to service on this basis is easily automated with a simple program or even with a spreadsheet. This is just the beginning. Over time, additional data may suggest modifications to this simple model: you might account for weekends and holidays or other anticipated influences on sales; there may be a weekly cycle or other seasonal cycles; there may be long-term trends to include in the forecasts. You might want to track outlying values representing unexpected one-time runs on the machines and incorporate this possibility in the loss estimates, etc. I doubt, though, that it will be necessary to worry much about serial correlation of sales: it's hard to think of any mechanism to cause such a thing. Oh, yes: how does one obtain the ML estimate? I used a numerical optimizer, but in general you will get very close simply by dividing total sales over a recent period by the length of the period. For these data that's 163 bottles sold from 12/9/2011 through 2/27/2012, a period of 87 days: $\hat{\theta} = 1.87$ bottles per day. Close enough to $1.8506$, and extremely simple to implement, so anyone can start these calculations right away. (R and Excel, among others, will readily compute the Poisson CCDF: model the calculations after 1-POISSON(50, Theta * A2, TRUE) for Excel (A2 is a cell containing the time since last refill and Theta is the estimated daily sales rate) and 1 - ppois(50, lambda = (x * theta)) for R.) The fancier models (which incorporate trends, cycles, etc) will need to use Poisson regression for their estimates. NB For the aficionados: I am purposely avoiding any discussion of uncertainties in the estimated losses. Handling these can significantly complicate the calculations. I suspect that directly using these uncertainties would not add appreciable value to the decision. However, being aware of the uncertainties and their sizes could be useful; that might be depicted by means of error bands in the second figure. In closing, I just want to re-emphasize the nature of that figure: it plots numbers that have a direct and clear business meaning; namely, expected losses; it does not plot more abstract things such as confidence intervals around $\theta$, which may be of interest to the statistician but will just be so much noise to decision maker.
How to forecast based on aggregated data over irregular intervals?
Let's focus on the business problem, develop a strategy to address it, and begin implementing that strategy in a simple way. Later, it can be improved if the effort warrants it. The business problem
How to forecast based on aggregated data over irregular intervals? Let's focus on the business problem, develop a strategy to address it, and begin implementing that strategy in a simple way. Later, it can be improved if the effort warrants it. The business problem is to maximize profits, of course. That is done here by balancing the costs of refilling machines against the costs of lost sales. In its current formulation, the costs of refilling the machines are fixed: 20 can be refilled each day. The cost of lost sales therefore depends on the frequency with which machines are empty. A conceptual statistical model for this problem can be obtained by devising some way to estimate the costs for each of the machines, based on previous data. The expected cost of not servicing a machine today approximately equals the chance it has run out times the rate at which it is used. For example, if a machine has a 25% chance of being empty today and on average sells 4 bottles per day, its expected cost equals 25% * 4 = 1 bottle in lost sales. (Translate that into dollars as you will, not forgetting that one lost sale incurs intangible costs: people see an empty machine, they learn not to rely on it, etc. You can even adjust this cost according to a machine's location; having some obscure machines run empty for a while might incur few intangible costs.) It's fair to assume that refilling a machine will immediately reset that expected loss to zero--it should be rare that a machine will get emptied every day (don't you wish...). As time goes by, the expected loss starts to rise until eventually it reaches a limiting value equal to the expected daily sales: an example is shown in the second figure below. A simple statistical model along these lines proposes that fluctuations in a machine's use appear random. This suggests a Poisson model. Specifically, we may posit that a machine has an underlying daily sales rate of $\theta$ bottles and that the number sold during a period of duration $x$ days has a Poisson distribution with parameter $\theta x$. (Other models can be formulated to handle the possibility of clusters of sales; this one supposes that sales are individual, intermittent, and independent of each other.) In the present example, the observed durations are $x=(7, 7, 7, 13, 11, 9, 8, 7, 8, 10)$ and the corresponding sales were $y=(4, 14, 4, 16, 16, 12, 7, 16, 24, 48)$. Maximizing the likelihood gives $\hat{\theta} = 1.8506$: this machine has been selling about two bottles per day. The data history is not long enough to suggest that any more complicated model is needed; this is an adequate description of what has been observed so far. The red dots show the sequence of sales; the blue dots are estimates based on the maximum likelihood estimate of the typical sales rate. Armed with an estimated sales rate, we can go on to compute the chance that a machine may be empty after $t$ days: it is given by the complementary cumulative distribution function (CCDF) of the Poisson distribution, as evaluated at the machine's capacity (presumed to be 50 in the next figure and the examples below). Multiplying by the estimated sales rate gives a plot of the expected daily loss in sales versus time since last refill: Naturally this curve is rising fastest near the time at $50/1.85 = 27$ days when the machine is most likely to run out. What it adds to our understanding is to show that an appreciable rise actually begins a week earlier than that. Other machines with other rates will have steeper or shallower rises: that will be useful information. Given a chart like this for each machine (of which it seems there are a couple hundred), you can easily identify the 20 machines currently experiencing the greatest expected loss: servicing them is the optimal business decision. (Note that each machine will have its own estimated rate and will be at its own point along its curve, depending on when it was last serviced.) Nobody actually has to look at these charts: identifying the machines to service on this basis is easily automated with a simple program or even with a spreadsheet. This is just the beginning. Over time, additional data may suggest modifications to this simple model: you might account for weekends and holidays or other anticipated influences on sales; there may be a weekly cycle or other seasonal cycles; there may be long-term trends to include in the forecasts. You might want to track outlying values representing unexpected one-time runs on the machines and incorporate this possibility in the loss estimates, etc. I doubt, though, that it will be necessary to worry much about serial correlation of sales: it's hard to think of any mechanism to cause such a thing. Oh, yes: how does one obtain the ML estimate? I used a numerical optimizer, but in general you will get very close simply by dividing total sales over a recent period by the length of the period. For these data that's 163 bottles sold from 12/9/2011 through 2/27/2012, a period of 87 days: $\hat{\theta} = 1.87$ bottles per day. Close enough to $1.8506$, and extremely simple to implement, so anyone can start these calculations right away. (R and Excel, among others, will readily compute the Poisson CCDF: model the calculations after 1-POISSON(50, Theta * A2, TRUE) for Excel (A2 is a cell containing the time since last refill and Theta is the estimated daily sales rate) and 1 - ppois(50, lambda = (x * theta)) for R.) The fancier models (which incorporate trends, cycles, etc) will need to use Poisson regression for their estimates. NB For the aficionados: I am purposely avoiding any discussion of uncertainties in the estimated losses. Handling these can significantly complicate the calculations. I suspect that directly using these uncertainties would not add appreciable value to the decision. However, being aware of the uncertainties and their sizes could be useful; that might be depicted by means of error bands in the second figure. In closing, I just want to re-emphasize the nature of that figure: it plots numbers that have a direct and clear business meaning; namely, expected losses; it does not plot more abstract things such as confidence intervals around $\theta$, which may be of interest to the statistician but will just be so much noise to decision maker.
How to forecast based on aggregated data over irregular intervals? Let's focus on the business problem, develop a strategy to address it, and begin implementing that strategy in a simple way. Later, it can be improved if the effort warrants it. The business problem
27,906
How to forecast based on aggregated data over irregular intervals?
I think you will usually have the first step of converting to a regular time series. You said you take the average of 90 days. Since you have data that is more frequent than that, I think it makes more sense to use the most of what you have by taking the days between each observation and dividing it by the number of items sold for that period (assuming that is what your second column is). As a disclaimer I am a total amateur, so you want to take the advice of an expert like IrishStat over the following code (for example, he said ETS is a bad model, so only treat this as a toy example), but in hopes that this saves you some time, here is some R code you can play with: library("xts") library("forecast") x = read.table(text="27/02/2012 48 17/02/2012 24 09/02/2012 16 02/02/2012 7 25/01/2012 12 16/01/2012 16 05/01/2012 16 23/12/2011 4 16/12/2011 14 09/12/2011 4 02/12/2011 2") #Convert the data into an XTS object which works with irregular time series x.xts = xts(x[,2], as.POSIXct(x[,1], format="%d/%m/%Y")) #Conver to a daily rate by taking the observed data and dividing it by #the number of days between observations daily_rate <- lag(x.xts) / diff(index(x.xts)) #Generate a daily time series for the dates dummy_dates <- seq(from=index(x.xts)[1], to=tail(index(x.xts), 1), by="day") #Combine daily series with observered daily rate m.xts <- merge(daily_rate, dummy_dates) #Interpolate the daily sales -- kind of evil because we "invent" data m.xts.interpolate <- na.approx(m.xts) #Convert to regular time series m.ts <- ts(m.xts.interpolate, freq=365, start=c(2011, 336)) #Clean up dimnames in case of stl forecast (just an R thing when converting from dataframes) dim(m.ts) <- NULL #Fit TS to an ETS model (Rudely ignoring IrishStat's advice that it is a bad model, but this is just an example) fit <- ets(m.ts) #Forecast and Plot plot(forecast(fit, h=30)) The resulting plot is:
How to forecast based on aggregated data over irregular intervals?
I think you will usually have the first step of converting to a regular time series. You said you take the average of 90 days. Since you have data that is more frequent than that, I think it makes mor
How to forecast based on aggregated data over irregular intervals? I think you will usually have the first step of converting to a regular time series. You said you take the average of 90 days. Since you have data that is more frequent than that, I think it makes more sense to use the most of what you have by taking the days between each observation and dividing it by the number of items sold for that period (assuming that is what your second column is). As a disclaimer I am a total amateur, so you want to take the advice of an expert like IrishStat over the following code (for example, he said ETS is a bad model, so only treat this as a toy example), but in hopes that this saves you some time, here is some R code you can play with: library("xts") library("forecast") x = read.table(text="27/02/2012 48 17/02/2012 24 09/02/2012 16 02/02/2012 7 25/01/2012 12 16/01/2012 16 05/01/2012 16 23/12/2011 4 16/12/2011 14 09/12/2011 4 02/12/2011 2") #Convert the data into an XTS object which works with irregular time series x.xts = xts(x[,2], as.POSIXct(x[,1], format="%d/%m/%Y")) #Conver to a daily rate by taking the observed data and dividing it by #the number of days between observations daily_rate <- lag(x.xts) / diff(index(x.xts)) #Generate a daily time series for the dates dummy_dates <- seq(from=index(x.xts)[1], to=tail(index(x.xts), 1), by="day") #Combine daily series with observered daily rate m.xts <- merge(daily_rate, dummy_dates) #Interpolate the daily sales -- kind of evil because we "invent" data m.xts.interpolate <- na.approx(m.xts) #Convert to regular time series m.ts <- ts(m.xts.interpolate, freq=365, start=c(2011, 336)) #Clean up dimnames in case of stl forecast (just an R thing when converting from dataframes) dim(m.ts) <- NULL #Fit TS to an ETS model (Rudely ignoring IrishStat's advice that it is a bad model, but this is just an example) fit <- ets(m.ts) #Forecast and Plot plot(forecast(fit, h=30)) The resulting plot is:
How to forecast based on aggregated data over irregular intervals? I think you will usually have the first step of converting to a regular time series. You said you take the average of 90 days. Since you have data that is more frequent than that, I think it makes mor
27,907
How to forecast based on aggregated data over irregular intervals?
What you have is an "Intermittent Demand Problem". We have solved this by converting demand to a rate by dividing the actual demand by the number of days in the interval between servicing. This rate can then be modelled as a Transfer Function in order to predict a rate given the prediction of the interval. This predicted rate can then be converted to a demand . Care should be taken to detect structural shifts in the rate via Intervention Detection . Try googling "Intermittent Demand modelling approach using a Transfer function methodology" . Sray very clear of the model presumptive approaches of Croston or Exponential Smoothing as they are quite deficient. ADDITIONAL ANALYSIS: When I modelled Rate as a function of Interval I obtained the following. Using a prediction of INTERVAL using it's past this equation can then predict rate , which can the be used to predict demand. This kind of model allows autoregressive structure in rate to be incorporated as well as allowing for Pulses , Level Shifts and/or Local Time Trends in rate. MODEL COMPONENT LAG COEFF STANDARD P T # (BOP) ERROR VALUE VALUE Differencing 1 1CONSTANT .295 .840E-01 .0246 3.51 INPUT SERIES X1 INTERVAL Differencing 1 2Omega (input) -Factor # 1 0 .685E-01 .346E-01 .1193 1.98 INPUT SERIES X2 I~P00002 12/03/11 PULSE Differencing 1 3Omega (input) -Factor # 2 0 1.43 .168 .0010 8.52 INPUT SERIES X3 I~P00007 12/08/11 PULSE Differencing 1 4Omega (input) -Factor # 3 0 -.935 .168 .0051 -5.57 INPUT SERIES X4 I~P00010 12/11/11 PULSE Differencing 1 5Omega (input) -Factor # 4 0 1.37 .260 .0062 5.27
How to forecast based on aggregated data over irregular intervals?
What you have is an "Intermittent Demand Problem". We have solved this by converting demand to a rate by dividing the actual demand by the number of days in the interval between servicing. This rate c
How to forecast based on aggregated data over irregular intervals? What you have is an "Intermittent Demand Problem". We have solved this by converting demand to a rate by dividing the actual demand by the number of days in the interval between servicing. This rate can then be modelled as a Transfer Function in order to predict a rate given the prediction of the interval. This predicted rate can then be converted to a demand . Care should be taken to detect structural shifts in the rate via Intervention Detection . Try googling "Intermittent Demand modelling approach using a Transfer function methodology" . Sray very clear of the model presumptive approaches of Croston or Exponential Smoothing as they are quite deficient. ADDITIONAL ANALYSIS: When I modelled Rate as a function of Interval I obtained the following. Using a prediction of INTERVAL using it's past this equation can then predict rate , which can the be used to predict demand. This kind of model allows autoregressive structure in rate to be incorporated as well as allowing for Pulses , Level Shifts and/or Local Time Trends in rate. MODEL COMPONENT LAG COEFF STANDARD P T # (BOP) ERROR VALUE VALUE Differencing 1 1CONSTANT .295 .840E-01 .0246 3.51 INPUT SERIES X1 INTERVAL Differencing 1 2Omega (input) -Factor # 1 0 .685E-01 .346E-01 .1193 1.98 INPUT SERIES X2 I~P00002 12/03/11 PULSE Differencing 1 3Omega (input) -Factor # 2 0 1.43 .168 .0010 8.52 INPUT SERIES X3 I~P00007 12/08/11 PULSE Differencing 1 4Omega (input) -Factor # 3 0 -.935 .168 .0051 -5.57 INPUT SERIES X4 I~P00010 12/11/11 PULSE Differencing 1 5Omega (input) -Factor # 4 0 1.37 .260 .0062 5.27
How to forecast based on aggregated data over irregular intervals? What you have is an "Intermittent Demand Problem". We have solved this by converting demand to a rate by dividing the actual demand by the number of days in the interval between servicing. This rate c
27,908
Stein's loss for multivariate normal covariance estimator
Wikipedia would seem to confirm your suspicion; Stein's loss is the KLD (up to a 1/2 multiplier): $$D_{KL}(\mathcal{N}_0\Vert\mathcal{N}_1)=\frac{1}{2}\bigg(\text{tr}(\Sigma_1^{-1}\Sigma_0)+(\mu_1-\mu_0)^T \Sigma_1^{-1}(\mu_1-\mu_0) - \ln\bigg(\frac{\text{det}\Sigma_0}{\text{det}\Sigma_1}\bigg)-k\bigg)$$ I'll confess to not having done the math, but I'm pretty sure that you can arrange terms so it's equivalent to the expectation of a quadratic form of Gaussian rv's.
Stein's loss for multivariate normal covariance estimator
Wikipedia would seem to confirm your suspicion; Stein's loss is the KLD (up to a 1/2 multiplier): $$D_{KL}(\mathcal{N}_0\Vert\mathcal{N}_1)=\frac{1}{2}\bigg(\text{tr}(\Sigma_1^{-1}\Sigma_0)+(\mu_1-\mu
Stein's loss for multivariate normal covariance estimator Wikipedia would seem to confirm your suspicion; Stein's loss is the KLD (up to a 1/2 multiplier): $$D_{KL}(\mathcal{N}_0\Vert\mathcal{N}_1)=\frac{1}{2}\bigg(\text{tr}(\Sigma_1^{-1}\Sigma_0)+(\mu_1-\mu_0)^T \Sigma_1^{-1}(\mu_1-\mu_0) - \ln\bigg(\frac{\text{det}\Sigma_0}{\text{det}\Sigma_1}\bigg)-k\bigg)$$ I'll confess to not having done the math, but I'm pretty sure that you can arrange terms so it's equivalent to the expectation of a quadratic form of Gaussian rv's.
Stein's loss for multivariate normal covariance estimator Wikipedia would seem to confirm your suspicion; Stein's loss is the KLD (up to a 1/2 multiplier): $$D_{KL}(\mathcal{N}_0\Vert\mathcal{N}_1)=\frac{1}{2}\bigg(\text{tr}(\Sigma_1^{-1}\Sigma_0)+(\mu_1-\mu
27,909
Stein's loss for multivariate normal covariance estimator
I worked out the details omitted from JMS's answer. Let $P_0 = \Sigma_0^{-1}$ and $P_1 = \Sigma_1^{-1}$ We have $$KL(N_0||N_1) = \int N_0(x) \frac{1}{2}[\ln |P_0| - \ln|P_1| + (x-\mu_0)^T P_0 (x-\mu_0) - (x-\mu_1)^T P_1 (x-\mu_1)] dx$$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| - \frac{1}{2} \mathbb{E}[(x-\mu_0)^T P_0 (x-\mu_0) - (x-\mu_1)^T P_1 (x-\mu_1)] $$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| + \frac{1}{2}(\mu_0-\mu_1)^T P_1 (\mu_0-\mu_1)- \frac{1}{2} \mathbb{E}[x^T P_0 x - x^T P_1 x - \mu_0^T (P_0 - P_1) \mu_0] $$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| + \frac{1}{2}(\mu_0-\mu_1)^T P_1 (\mu_0-\mu_1)- \frac{1}{2} \mathbb{E}[(x-\mu_0)^T (P_0-P_1) (x-\mu_0)] $$ To simplify notation, assume $\mu_0 = 0$. It remains to show that $$\mathbb{E}[x^T P_0x-x^T P_1 x] = k - tr(P_1\Sigma_0)$$ But $x^T P_0 x = x^T \Sigma_0 x$ has a Chi-squared distribution and therefore has expectation $k$. Meanwhile, $$\mathbb{E}[x^T P_1 x] = \mathbb{E}[tr(x^T P_1 x)] = \mathbb{E}[tr(P_1 xx^T )]= tr(\mathbb{E}(P_1 xx^T)) = tr(P_1 \Sigma_0)$$ where the second equality can be obtained by treating $x$ as a square matrix padded by zeroes.
Stein's loss for multivariate normal covariance estimator
I worked out the details omitted from JMS's answer. Let $P_0 = \Sigma_0^{-1}$ and $P_1 = \Sigma_1^{-1}$ We have $$KL(N_0||N_1) = \int N_0(x) \frac{1}{2}[\ln |P_0| - \ln|P_1| + (x-\mu_0)^T P_0 (x-\mu_0
Stein's loss for multivariate normal covariance estimator I worked out the details omitted from JMS's answer. Let $P_0 = \Sigma_0^{-1}$ and $P_1 = \Sigma_1^{-1}$ We have $$KL(N_0||N_1) = \int N_0(x) \frac{1}{2}[\ln |P_0| - \ln|P_1| + (x-\mu_0)^T P_0 (x-\mu_0) - (x-\mu_1)^T P_1 (x-\mu_1)] dx$$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| - \frac{1}{2} \mathbb{E}[(x-\mu_0)^T P_0 (x-\mu_0) - (x-\mu_1)^T P_1 (x-\mu_1)] $$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| + \frac{1}{2}(\mu_0-\mu_1)^T P_1 (\mu_0-\mu_1)- \frac{1}{2} \mathbb{E}[x^T P_0 x - x^T P_1 x - \mu_0^T (P_0 - P_1) \mu_0] $$ $$ = \frac{1}{2}\ln|P_0\Sigma_1| + \frac{1}{2}(\mu_0-\mu_1)^T P_1 (\mu_0-\mu_1)- \frac{1}{2} \mathbb{E}[(x-\mu_0)^T (P_0-P_1) (x-\mu_0)] $$ To simplify notation, assume $\mu_0 = 0$. It remains to show that $$\mathbb{E}[x^T P_0x-x^T P_1 x] = k - tr(P_1\Sigma_0)$$ But $x^T P_0 x = x^T \Sigma_0 x$ has a Chi-squared distribution and therefore has expectation $k$. Meanwhile, $$\mathbb{E}[x^T P_1 x] = \mathbb{E}[tr(x^T P_1 x)] = \mathbb{E}[tr(P_1 xx^T )]= tr(\mathbb{E}(P_1 xx^T)) = tr(P_1 \Sigma_0)$$ where the second equality can be obtained by treating $x$ as a square matrix padded by zeroes.
Stein's loss for multivariate normal covariance estimator I worked out the details omitted from JMS's answer. Let $P_0 = \Sigma_0^{-1}$ and $P_1 = \Sigma_1^{-1}$ We have $$KL(N_0||N_1) = \int N_0(x) \frac{1}{2}[\ln |P_0| - \ln|P_1| + (x-\mu_0)^T P_0 (x-\mu_0
27,910
Stein's loss for multivariate normal covariance estimator
A simple way to compute the integral is to notice that it's equal to $\mathbb{E}[\varepsilon^\top \Lambda \varepsilon]$ with $\varepsilon$ of mean $0$ and covariance $\hat \Sigma$, and $\Lambda = \hat \Sigma^{-1} - \Sigma^{-1}$. Independently on the distribution of $\varepsilon$, this is equal to $\mathrm{tr} [\Lambda \,\mathrm{cov}[\varepsilon]]$ Indeed: \begin{align*} \mathbb{E}[\varepsilon^\top \Lambda \varepsilon] &= \mathbb{E}[\mathrm{tr} \, \varepsilon^\top \Lambda \varepsilon] \\ &= \mathbb{E}[\mathrm{tr} \, \Lambda \varepsilon \varepsilon^\top] \\ &= \mathrm{tr} \, \Lambda \mathrm{cov}[ \varepsilon] \\ &= \mathrm{tr} \, [(\hat \Sigma^{-1} - \Sigma^{-1}) \hat \Sigma] \enspace,\\ \end{align*} which gives the desired result.
Stein's loss for multivariate normal covariance estimator
A simple way to compute the integral is to notice that it's equal to $\mathbb{E}[\varepsilon^\top \Lambda \varepsilon]$ with $\varepsilon$ of mean $0$ and covariance $\hat \Sigma$, and $\Lambda = \ha
Stein's loss for multivariate normal covariance estimator A simple way to compute the integral is to notice that it's equal to $\mathbb{E}[\varepsilon^\top \Lambda \varepsilon]$ with $\varepsilon$ of mean $0$ and covariance $\hat \Sigma$, and $\Lambda = \hat \Sigma^{-1} - \Sigma^{-1}$. Independently on the distribution of $\varepsilon$, this is equal to $\mathrm{tr} [\Lambda \,\mathrm{cov}[\varepsilon]]$ Indeed: \begin{align*} \mathbb{E}[\varepsilon^\top \Lambda \varepsilon] &= \mathbb{E}[\mathrm{tr} \, \varepsilon^\top \Lambda \varepsilon] \\ &= \mathbb{E}[\mathrm{tr} \, \Lambda \varepsilon \varepsilon^\top] \\ &= \mathrm{tr} \, \Lambda \mathrm{cov}[ \varepsilon] \\ &= \mathrm{tr} \, [(\hat \Sigma^{-1} - \Sigma^{-1}) \hat \Sigma] \enspace,\\ \end{align*} which gives the desired result.
Stein's loss for multivariate normal covariance estimator A simple way to compute the integral is to notice that it's equal to $\mathbb{E}[\varepsilon^\top \Lambda \varepsilon]$ with $\varepsilon$ of mean $0$ and covariance $\hat \Sigma$, and $\Lambda = \ha
27,911
Kernel density estimate takes values larger than 1 [duplicate]
You are mistaken. The CDF should not be greater than 1, but the PDF may be. Think, for example, of the PDF of a Gaussian random variable with mean zero and standard deviation $\sigma$: $$f(x) = \frac{1}{\sqrt{2\sigma\pi}}\exp(-\frac{x^2}{2\sigma^2})$$ if you make $\sigma$ very small, then for $x = 0$, the PDF is arbitrarily large!
Kernel density estimate takes values larger than 1 [duplicate]
You are mistaken. The CDF should not be greater than 1, but the PDF may be. Think, for example, of the PDF of a Gaussian random variable with mean zero and standard deviation $\sigma$: $$f(x) = \frac{
Kernel density estimate takes values larger than 1 [duplicate] You are mistaken. The CDF should not be greater than 1, but the PDF may be. Think, for example, of the PDF of a Gaussian random variable with mean zero and standard deviation $\sigma$: $$f(x) = \frac{1}{\sqrt{2\sigma\pi}}\exp(-\frac{x^2}{2\sigma^2})$$ if you make $\sigma$ very small, then for $x = 0$, the PDF is arbitrarily large!
Kernel density estimate takes values larger than 1 [duplicate] You are mistaken. The CDF should not be greater than 1, but the PDF may be. Think, for example, of the PDF of a Gaussian random variable with mean zero and standard deviation $\sigma$: $$f(x) = \frac{
27,912
How to test if the slopes in the linear model are equal to a fixed value?
In linear regression the assumption is that $X$ and $Y$ are not random variables. Therefore, the model $$Z = a X + b Y + \epsilon$$ is algebraically the same as $$Z - \frac{1}{2} X - \frac{1}{2} Y = (a - \frac{1}{2})X + (b - \frac{1}{2})Y + \epsilon = \alpha X + \beta Y + \epsilon.$$ Here, $\alpha = a - \frac{1}{2}$ and $\beta =b - \frac{1}{2}$. The error term $\epsilon$ is unaffected. Fit this model, estimating the coefficients as $\hat{\alpha}$ and $\hat{\beta}$, respectively, and test the hypothesis $\alpha = \beta = 0$ in the usual way. The statistic written at the end of the question is not a chi-squared statistic, despite its formal similarity to one. A chi-squared statistic involves counts, not data values, and must have expected values in its denominator, not covariates. It's possible for one or more of the denominators $\frac{x_i+y_i}{2}$ to be zero (or close to it), showing that something is seriously wrong with this formulation. If even that isn't convincing, consider that the units of measurement of $Z$, $X$, and $Y$ could be anything (such as drams, parsecs, and pecks), so that a linear combination like $z_i - (x_i+y_i)/2$ is (in general) meaningless. It doesn't test anything.
How to test if the slopes in the linear model are equal to a fixed value?
In linear regression the assumption is that $X$ and $Y$ are not random variables. Therefore, the model $$Z = a X + b Y + \epsilon$$ is algebraically the same as $$Z - \frac{1}{2} X - \frac{1}{2} Y =
How to test if the slopes in the linear model are equal to a fixed value? In linear regression the assumption is that $X$ and $Y$ are not random variables. Therefore, the model $$Z = a X + b Y + \epsilon$$ is algebraically the same as $$Z - \frac{1}{2} X - \frac{1}{2} Y = (a - \frac{1}{2})X + (b - \frac{1}{2})Y + \epsilon = \alpha X + \beta Y + \epsilon.$$ Here, $\alpha = a - \frac{1}{2}$ and $\beta =b - \frac{1}{2}$. The error term $\epsilon$ is unaffected. Fit this model, estimating the coefficients as $\hat{\alpha}$ and $\hat{\beta}$, respectively, and test the hypothesis $\alpha = \beta = 0$ in the usual way. The statistic written at the end of the question is not a chi-squared statistic, despite its formal similarity to one. A chi-squared statistic involves counts, not data values, and must have expected values in its denominator, not covariates. It's possible for one or more of the denominators $\frac{x_i+y_i}{2}$ to be zero (or close to it), showing that something is seriously wrong with this formulation. If even that isn't convincing, consider that the units of measurement of $Z$, $X$, and $Y$ could be anything (such as drams, parsecs, and pecks), so that a linear combination like $z_i - (x_i+y_i)/2$ is (in general) meaningless. It doesn't test anything.
How to test if the slopes in the linear model are equal to a fixed value? In linear regression the assumption is that $X$ and $Y$ are not random variables. Therefore, the model $$Z = a X + b Y + \epsilon$$ is algebraically the same as $$Z - \frac{1}{2} X - \frac{1}{2} Y =
27,913
How to test if the slopes in the linear model are equal to a fixed value?
You can test this hypothesis with a full versus reduced model test. Here is how you do this. First, fit the model $Z = aX + bY$ and get the residuals from that model. Square the residuals and sum them up. This is the sum of square error for the full model. Let's call this $SSE_f$. Next, calculate $Z - \hat{Z}$ where $\hat{Z} = 1/2*X + 1/2*Y$. These are your residuals under the null hypothesis. Square them and sum them up. This is the sum of square error for the reduced model. Let's call this $SSE_r$. Now compute: F = $((SSE_r - SSE_f)/2) / (SSE_f / (n-2))$, where $n$ is the sample size. Under $H_0$, this F-statistic follows an F-distribution with $2$ and $n-2$ degrees of freedom. Here is an example using R: x <- rnorm(n) y <- rnorm(n) z <- 1/2*x + 1/2*y + rnorm(n) ### note I am simulating under H0 here res <- lm(z ~ x + y - 1) summary(res) SSE.f <- sum(resid(res)^2) zhat <- 1/2*x + 1/2*y SSE.r <- sum((z-zhat)^2) F <- ((SSE.r - SSE.f) / 2) / (SSE.f / (n-2)) pf(F, 2, n-2, lower.tail=FALSE) ### this is the p-value Reject the null if the p-value is below .05 (if your $\alpha$ is indeed .05). I assume you really meant for your model not to contain an intercept. In other words, I assume you are really working with the model $Z = aX + bY$ and not $Z = c + aX + bY$.
How to test if the slopes in the linear model are equal to a fixed value?
You can test this hypothesis with a full versus reduced model test. Here is how you do this. First, fit the model $Z = aX + bY$ and get the residuals from that model. Square the residuals and sum them
How to test if the slopes in the linear model are equal to a fixed value? You can test this hypothesis with a full versus reduced model test. Here is how you do this. First, fit the model $Z = aX + bY$ and get the residuals from that model. Square the residuals and sum them up. This is the sum of square error for the full model. Let's call this $SSE_f$. Next, calculate $Z - \hat{Z}$ where $\hat{Z} = 1/2*X + 1/2*Y$. These are your residuals under the null hypothesis. Square them and sum them up. This is the sum of square error for the reduced model. Let's call this $SSE_r$. Now compute: F = $((SSE_r - SSE_f)/2) / (SSE_f / (n-2))$, where $n$ is the sample size. Under $H_0$, this F-statistic follows an F-distribution with $2$ and $n-2$ degrees of freedom. Here is an example using R: x <- rnorm(n) y <- rnorm(n) z <- 1/2*x + 1/2*y + rnorm(n) ### note I am simulating under H0 here res <- lm(z ~ x + y - 1) summary(res) SSE.f <- sum(resid(res)^2) zhat <- 1/2*x + 1/2*y SSE.r <- sum((z-zhat)^2) F <- ((SSE.r - SSE.f) / 2) / (SSE.f / (n-2)) pf(F, 2, n-2, lower.tail=FALSE) ### this is the p-value Reject the null if the p-value is below .05 (if your $\alpha$ is indeed .05). I assume you really meant for your model not to contain an intercept. In other words, I assume you are really working with the model $Z = aX + bY$ and not $Z = c + aX + bY$.
How to test if the slopes in the linear model are equal to a fixed value? You can test this hypothesis with a full versus reduced model test. Here is how you do this. First, fit the model $Z = aX + bY$ and get the residuals from that model. Square the residuals and sum them
27,914
When to use (non)parametric test of homoscedasticity assumption?
It seems that the FK test is to be prefered in case of strong departure from the normality (to which the Bartlett test is sensible). Quoting the on-line help, The Fligner-Killeen (median) test has been determined in a simulation study as one of the many tests for homogeneity of variances which is most robust against departures from normality, see Conover, Johnson & Johnson (1981). Generally speaking, the Levene test works well in the ANOVA framework, providing there are small to moderate deviations from the normality. In this case, it outperfoms the Bartlett test. If the distribution are nearly normal, however, the Bartlett test is better. I've also heard of the Brown–Forsythe test as a non-parametric alternative to the Levene test. Basically, it relies on either the median or the trimmed mean (as compared to the mean in the Levene test). According to Brown and Forsythe (1974), a test based on the mean provided the best power for symmetric distributions with moderate tails. In conclusion, I would say that if there is strong evidence of departure from the normality (as seen e.g., with the help of a Q-Q plot), then use a non-parametric test (FK or BF test); otherwise, use Levene or Bartlett test. There was also a small discussion about this test for small and large samples in the R Journal, last year, asympTest: A Simple R Package for Classical Parametric Statistical Tests and Confidence Intervals in Large Samples. It seems that the FK test is also available through the coin interface for permutation tests, see the vignette. References Brown, M. B. and Forsythe, A. B. (1974). Robust Tests for Equality of Variances. JASA, 69, 364-367.
When to use (non)parametric test of homoscedasticity assumption?
It seems that the FK test is to be prefered in case of strong departure from the normality (to which the Bartlett test is sensible). Quoting the on-line help, The Fligner-Killeen (median) test has
When to use (non)parametric test of homoscedasticity assumption? It seems that the FK test is to be prefered in case of strong departure from the normality (to which the Bartlett test is sensible). Quoting the on-line help, The Fligner-Killeen (median) test has been determined in a simulation study as one of the many tests for homogeneity of variances which is most robust against departures from normality, see Conover, Johnson & Johnson (1981). Generally speaking, the Levene test works well in the ANOVA framework, providing there are small to moderate deviations from the normality. In this case, it outperfoms the Bartlett test. If the distribution are nearly normal, however, the Bartlett test is better. I've also heard of the Brown–Forsythe test as a non-parametric alternative to the Levene test. Basically, it relies on either the median or the trimmed mean (as compared to the mean in the Levene test). According to Brown and Forsythe (1974), a test based on the mean provided the best power for symmetric distributions with moderate tails. In conclusion, I would say that if there is strong evidence of departure from the normality (as seen e.g., with the help of a Q-Q plot), then use a non-parametric test (FK or BF test); otherwise, use Levene or Bartlett test. There was also a small discussion about this test for small and large samples in the R Journal, last year, asympTest: A Simple R Package for Classical Parametric Statistical Tests and Confidence Intervals in Large Samples. It seems that the FK test is also available through the coin interface for permutation tests, see the vignette. References Brown, M. B. and Forsythe, A. B. (1974). Robust Tests for Equality of Variances. JASA, 69, 364-367.
When to use (non)parametric test of homoscedasticity assumption? It seems that the FK test is to be prefered in case of strong departure from the normality (to which the Bartlett test is sensible). Quoting the on-line help, The Fligner-Killeen (median) test has
27,915
When to use (non)parametric test of homoscedasticity assumption?
Instead of these tests, you might want to check out the Breusch-Pagan test and White's version of the same. Neither requires a normality assumption and White has shown that his version is quite robust to misspecification.
When to use (non)parametric test of homoscedasticity assumption?
Instead of these tests, you might want to check out the Breusch-Pagan test and White's version of the same. Neither requires a normality assumption and White has shown that his version is quite robust
When to use (non)parametric test of homoscedasticity assumption? Instead of these tests, you might want to check out the Breusch-Pagan test and White's version of the same. Neither requires a normality assumption and White has shown that his version is quite robust to misspecification.
When to use (non)parametric test of homoscedasticity assumption? Instead of these tests, you might want to check out the Breusch-Pagan test and White's version of the same. Neither requires a normality assumption and White has shown that his version is quite robust
27,916
Computing best subset of predictors for linear regression
I've never heard of Kuk's method, but the hot topic these days is L1 minimisation. The rationale being that if you use a penalty term of the absolute value of the regression coefficients, the unimportant ones should go to zero. These techniques have some funny names: Lasso, LARS, Dantzig selector. You can read the papers, but a good place to start is with Elements of Statistical Learning, Chapter 3.
Computing best subset of predictors for linear regression
I've never heard of Kuk's method, but the hot topic these days is L1 minimisation. The rationale being that if you use a penalty term of the absolute value of the regression coefficients, the unimport
Computing best subset of predictors for linear regression I've never heard of Kuk's method, but the hot topic these days is L1 minimisation. The rationale being that if you use a penalty term of the absolute value of the regression coefficients, the unimportant ones should go to zero. These techniques have some funny names: Lasso, LARS, Dantzig selector. You can read the papers, but a good place to start is with Elements of Statistical Learning, Chapter 3.
Computing best subset of predictors for linear regression I've never heard of Kuk's method, but the hot topic these days is L1 minimisation. The rationale being that if you use a penalty term of the absolute value of the regression coefficients, the unimport
27,917
Computing best subset of predictors for linear regression
This is a huge topic. As previously mentioned, Hastie, Tibshirani and Friedman give a good intro in Ch3 of Elements of Statistical Learning. A few points. 1) What do you mean by "best" or "optimal"? What is best in one sense may not be best in another. Two common criteria are predictive accuracy (predicting the outcome variable) and producing unbiased estimators of the coefficients. Some methods, such as Lasso & Ridge Regression inevitably produce biased coefficient estimators. 2) The phrase "best subsets" itself can be used in two separate senses. Generally to refer to the best subset among all predictors which optimises some model building criteria. More specifically it can refer to Furnival and Wilson's efficient algorithm for finding that subset among moderate (~50) numbers of linear predictors (Regressions by Leaps and Bounds. Technometrics, Vol. 16, No. 4 (Nov., 1974), pp. 499-51) http://www.jstor.org/stable/1267601
Computing best subset of predictors for linear regression
This is a huge topic. As previously mentioned, Hastie, Tibshirani and Friedman give a good intro in Ch3 of Elements of Statistical Learning. A few points. 1) What do you mean by "best" or "optimal"? W
Computing best subset of predictors for linear regression This is a huge topic. As previously mentioned, Hastie, Tibshirani and Friedman give a good intro in Ch3 of Elements of Statistical Learning. A few points. 1) What do you mean by "best" or "optimal"? What is best in one sense may not be best in another. Two common criteria are predictive accuracy (predicting the outcome variable) and producing unbiased estimators of the coefficients. Some methods, such as Lasso & Ridge Regression inevitably produce biased coefficient estimators. 2) The phrase "best subsets" itself can be used in two separate senses. Generally to refer to the best subset among all predictors which optimises some model building criteria. More specifically it can refer to Furnival and Wilson's efficient algorithm for finding that subset among moderate (~50) numbers of linear predictors (Regressions by Leaps and Bounds. Technometrics, Vol. 16, No. 4 (Nov., 1974), pp. 499-51) http://www.jstor.org/stable/1267601
Computing best subset of predictors for linear regression This is a huge topic. As previously mentioned, Hastie, Tibshirani and Friedman give a good intro in Ch3 of Elements of Statistical Learning. A few points. 1) What do you mean by "best" or "optimal"? W
27,918
Computing best subset of predictors for linear regression
What I learned it that firstly use Best Subsets Approach as a screening tool, then the stepwise selection procedures can help you finally decide which models might be best subset models (at this time the number of those models is pretty small to handle). If one of the models meets the model conditions, does a good job of summarizing the trend in the data, and most importantly allows you to answer your research question, then congrats your job is done.
Computing best subset of predictors for linear regression
What I learned it that firstly use Best Subsets Approach as a screening tool, then the stepwise selection procedures can help you finally decide which models might be best subset models (at this time
Computing best subset of predictors for linear regression What I learned it that firstly use Best Subsets Approach as a screening tool, then the stepwise selection procedures can help you finally decide which models might be best subset models (at this time the number of those models is pretty small to handle). If one of the models meets the model conditions, does a good job of summarizing the trend in the data, and most importantly allows you to answer your research question, then congrats your job is done.
Computing best subset of predictors for linear regression What I learned it that firstly use Best Subsets Approach as a screening tool, then the stepwise selection procedures can help you finally decide which models might be best subset models (at this time
27,919
How much would you wager for a Cauchy distributed return?
The Cauchy distribution has an infinite range. It is difficult to imagine how you would consider payouts of large sizes that make either the player or the casino go bankrupt. The game has some decent odds for small values of pays. E.g. the odds of you paying 100 versus the casino paying 100 are 1:40001. So it seems a good bet. However the game has a devilish drawback, which is the risk that you have the pay all the wealth that you possess and even more, getting into debts that you will never be able to pay off. To estimate whether this game makes sense to play (for free) one could compute the probability of a gambler's ruin. One could describe the random walk of the gains and profits after $n$ steps as a sum of Cauchy distributed variables $Y(n) = \sum_{i}^n X_i$ and have an absorbing boundary at bankruptcy of the player and of the casino. In the case of a random walk with steps of only +1 and -1, then you can regard this as a Martingale and the ratio of the probability of bankruptcy of for player and casino are equal to the amounts of money that they have at the start. E.g. $$\frac{P(\text{player bankrupt})}{P(\text{casino bankrupt})} = \frac{\text{starting money casino}}{\text{starting money player}}$$ One can imagine a similar ratio for the case of steps according to a Cauchy distribution. But, each step the odds of winning a are larger than the odds of loosing, because the Cauchy distribution has a location of 100. This makes that it is much more likely that the casino goes bankrupt, than the player going bankrupt in comparison to the simple random walk. Most bets will make the profit increase by 100 and this continues untill the casino goes bankrupt. The number of steps before the casino goes bankrupt will be roughly around $M_{casino}/100$ where $M_{casino}$ is the total money of the casino. The danger is is when during the $M_{casino}/100$ steps the player will go bankrupt. We can approximate this by multiplying the probabilities of bankruptcy by the player during each step while assuming that the steps are 100 each time. $$P(\text{player bankrupt}) \approx 1-\prod_{i=0}^{M_{casino}/100-1}1-F(-M_{player}-100i;100,1)$$ where $F$ is the CDF of the Cauchy distribution. If $M_{player} = 100000$ and $M_{casino} = 1000000$ then this probability is 0.76%. A simulation of 200 paths could look like: Here 1 out of 200 players went bankrupt. Do you want to risk that? sample = function(gambler = 100000, casino = 1000000) { X = c(0) while((X[1] > -gambler) * (X[1]< casino)) { X = c(X[1]+rcauchy(1,100,1),X) } X } set.seed(1) plot(-100,-100, type = "l", ylim = c(-10^5,10^6), xlab = "number of gamble's", ylab = "accumulated profit/loss", xlim = c(0,10000*1.1)) pb = 0 for (i in 1:200) { Y = sample() lines(rev(Y), col = rgb(0,0,0,0.1)) if (Y[1]<0) {pb = pb+1} } pb ### estimate computation x = seq(0,1000000/100-1) 1-prod(1-pcauchy(-100000-x*100,100,1))
How much would you wager for a Cauchy distributed return?
The Cauchy distribution has an infinite range. It is difficult to imagine how you would consider payouts of large sizes that make either the player or the casino go bankrupt. The game has some decent
How much would you wager for a Cauchy distributed return? The Cauchy distribution has an infinite range. It is difficult to imagine how you would consider payouts of large sizes that make either the player or the casino go bankrupt. The game has some decent odds for small values of pays. E.g. the odds of you paying 100 versus the casino paying 100 are 1:40001. So it seems a good bet. However the game has a devilish drawback, which is the risk that you have the pay all the wealth that you possess and even more, getting into debts that you will never be able to pay off. To estimate whether this game makes sense to play (for free) one could compute the probability of a gambler's ruin. One could describe the random walk of the gains and profits after $n$ steps as a sum of Cauchy distributed variables $Y(n) = \sum_{i}^n X_i$ and have an absorbing boundary at bankruptcy of the player and of the casino. In the case of a random walk with steps of only +1 and -1, then you can regard this as a Martingale and the ratio of the probability of bankruptcy of for player and casino are equal to the amounts of money that they have at the start. E.g. $$\frac{P(\text{player bankrupt})}{P(\text{casino bankrupt})} = \frac{\text{starting money casino}}{\text{starting money player}}$$ One can imagine a similar ratio for the case of steps according to a Cauchy distribution. But, each step the odds of winning a are larger than the odds of loosing, because the Cauchy distribution has a location of 100. This makes that it is much more likely that the casino goes bankrupt, than the player going bankrupt in comparison to the simple random walk. Most bets will make the profit increase by 100 and this continues untill the casino goes bankrupt. The number of steps before the casino goes bankrupt will be roughly around $M_{casino}/100$ where $M_{casino}$ is the total money of the casino. The danger is is when during the $M_{casino}/100$ steps the player will go bankrupt. We can approximate this by multiplying the probabilities of bankruptcy by the player during each step while assuming that the steps are 100 each time. $$P(\text{player bankrupt}) \approx 1-\prod_{i=0}^{M_{casino}/100-1}1-F(-M_{player}-100i;100,1)$$ where $F$ is the CDF of the Cauchy distribution. If $M_{player} = 100000$ and $M_{casino} = 1000000$ then this probability is 0.76%. A simulation of 200 paths could look like: Here 1 out of 200 players went bankrupt. Do you want to risk that? sample = function(gambler = 100000, casino = 1000000) { X = c(0) while((X[1] > -gambler) * (X[1]< casino)) { X = c(X[1]+rcauchy(1,100,1),X) } X } set.seed(1) plot(-100,-100, type = "l", ylim = c(-10^5,10^6), xlab = "number of gamble's", ylab = "accumulated profit/loss", xlim = c(0,10000*1.1)) pb = 0 for (i in 1:200) { Y = sample() lines(rev(Y), col = rgb(0,0,0,0.1)) if (Y[1]<0) {pb = pb+1} } pb ### estimate computation x = seq(0,1000000/100-1) 1-prod(1-pcauchy(-100000-x*100,100,1))
How much would you wager for a Cauchy distributed return? The Cauchy distribution has an infinite range. It is difficult to imagine how you would consider payouts of large sizes that make either the player or the casino go bankrupt. The game has some decent
27,920
How much would you wager for a Cauchy distributed return?
I think we should always keep in mind the distinction between formal modelling and reality. This affects at least two aspects of the problem given here. Does the Cauchy model appropriately model the real situation? Chances are it doesn't, as both the casino and the player will have upper bounds on the amounts they can pay out, so in fact both players may find out that they cannot do what is required in case of certain results. The problem would then change into a problem with a truncated Cauchy, in which obviously expected values are well defined if you know where the truncation is. How do we model "rationality"? The expected value is a popular candidate of course, but one can well consider other candidates. For example, one could well argue (ignoring problems with item 1) that the problem is symmetric around 100, so the fair price would be 100 because this makes the payout distribution identical for both players. However, considering potential consequences (which would involve reality again, i.e., what exactly would happen if the payout would be very high; also how is utility related to amount of money for both involved), a player may not consider rational playing at all due to a nonzero bankrupt probability and maybe also considering the utility of unbounded gain in terms of money in fact bounded. So one would arguably need to translate money payouts into actual utilities, and these may not be symmetric, and may again depend on the specific situation of everyone involved. On one hand, there definitely should be a way to value this game. Wishful thinking, maybe? You may define one, see above, however this means that you enforce your definition of rationality on the situation at hand. There is no "meta-objective/meta-rational" way to ultimately argue in what unique way rationality should be formally defined.
How much would you wager for a Cauchy distributed return?
I think we should always keep in mind the distinction between formal modelling and reality. This affects at least two aspects of the problem given here. Does the Cauchy model appropriately model the
How much would you wager for a Cauchy distributed return? I think we should always keep in mind the distinction between formal modelling and reality. This affects at least two aspects of the problem given here. Does the Cauchy model appropriately model the real situation? Chances are it doesn't, as both the casino and the player will have upper bounds on the amounts they can pay out, so in fact both players may find out that they cannot do what is required in case of certain results. The problem would then change into a problem with a truncated Cauchy, in which obviously expected values are well defined if you know where the truncation is. How do we model "rationality"? The expected value is a popular candidate of course, but one can well consider other candidates. For example, one could well argue (ignoring problems with item 1) that the problem is symmetric around 100, so the fair price would be 100 because this makes the payout distribution identical for both players. However, considering potential consequences (which would involve reality again, i.e., what exactly would happen if the payout would be very high; also how is utility related to amount of money for both involved), a player may not consider rational playing at all due to a nonzero bankrupt probability and maybe also considering the utility of unbounded gain in terms of money in fact bounded. So one would arguably need to translate money payouts into actual utilities, and these may not be symmetric, and may again depend on the specific situation of everyone involved. On one hand, there definitely should be a way to value this game. Wishful thinking, maybe? You may define one, see above, however this means that you enforce your definition of rationality on the situation at hand. There is no "meta-objective/meta-rational" way to ultimately argue in what unique way rationality should be formally defined.
How much would you wager for a Cauchy distributed return? I think we should always keep in mind the distinction between formal modelling and reality. This affects at least two aspects of the problem given here. Does the Cauchy model appropriately model the
27,921
Estimating probability of attack in Ukraine, given count data
This is not an answer, but rather a side comment: Keep in mind that the new attacks are not independent of the previous ones. Historical data is not necessarily relevant for the future. It is probably worth thinking of the problem in the terms similar to the frames of survivorship bias: the fact that Kyiv was (unsuccessfully) attacked in the past does not necessarily make it more susceptible to the attacks in the future, maybe even the other way around, it is not worth further attacks, as the Russian army concluded by retreating. But this approach also has a flaw, as it assumes a rational actor that learns from mistakes, whereas Russia is not necessarily a rational actor. I'd be cautious with using historical data for such extrapolations.
Estimating probability of attack in Ukraine, given count data
This is not an answer, but rather a side comment: Keep in mind that the new attacks are not independent of the previous ones. Historical data is not necessarily relevant for the future. It is probably
Estimating probability of attack in Ukraine, given count data This is not an answer, but rather a side comment: Keep in mind that the new attacks are not independent of the previous ones. Historical data is not necessarily relevant for the future. It is probably worth thinking of the problem in the terms similar to the frames of survivorship bias: the fact that Kyiv was (unsuccessfully) attacked in the past does not necessarily make it more susceptible to the attacks in the future, maybe even the other way around, it is not worth further attacks, as the Russian army concluded by retreating. But this approach also has a flaw, as it assumes a rational actor that learns from mistakes, whereas Russia is not necessarily a rational actor. I'd be cautious with using historical data for such extrapolations.
Estimating probability of attack in Ukraine, given count data This is not an answer, but rather a side comment: Keep in mind that the new attacks are not independent of the previous ones. Historical data is not necessarily relevant for the future. It is probably
27,922
Estimating probability of attack in Ukraine, given count data
Does anyone know what kind of model I would use for something like this? ... I was just wondering if anyone know some common approaches. Two approaches you may want to look into: "Self exciting Poisson processes" and similar. Quite a bit of literature comes up on a quick Google/Scholar search. "Species range distribution models." This drops your time series framework, but you might find it interesting to associate geospatial features with the attacks, as done in Elith, Jane, et al. "A statistical explanation of MaxEnt for ecologists." Diversity and distributions 17.1 (2011): 43-57.
Estimating probability of attack in Ukraine, given count data
Does anyone know what kind of model I would use for something like this? ... I was just wondering if anyone know some common approaches. Two approaches you may want to look into: "Self exciting Pois
Estimating probability of attack in Ukraine, given count data Does anyone know what kind of model I would use for something like this? ... I was just wondering if anyone know some common approaches. Two approaches you may want to look into: "Self exciting Poisson processes" and similar. Quite a bit of literature comes up on a quick Google/Scholar search. "Species range distribution models." This drops your time series framework, but you might find it interesting to associate geospatial features with the attacks, as done in Elith, Jane, et al. "A statistical explanation of MaxEnt for ecologists." Diversity and distributions 17.1 (2011): 43-57.
Estimating probability of attack in Ukraine, given count data Does anyone know what kind of model I would use for something like this? ... I was just wondering if anyone know some common approaches. Two approaches you may want to look into: "Self exciting Pois
27,923
Does it make sense to interact two uncorrelated independent variables in linear regression?
Definitely! set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) x12 <- x1 * x2 # interaction between x1 and x2 # y <- x1 - x2 + 5*x12 + rnorm(length(x1)) In this example, $x_1$ and $x_2$ are independent (not just uncorrelated) and have opposite signs in the regression model. However, the interaction term is important. Compare the $R^2$ or adjusted $R^2$ your models have when you regress on just $x_1$ and $x_2$ versus regressing on those variables plus their interaction.
Does it make sense to interact two uncorrelated independent variables in linear regression?
Definitely! set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
Does it make sense to interact two uncorrelated independent variables in linear regression? Definitely! set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) x12 <- x1 * x2 # interaction between x1 and x2 # y <- x1 - x2 + 5*x12 + rnorm(length(x1)) In this example, $x_1$ and $x_2$ are independent (not just uncorrelated) and have opposite signs in the regression model. However, the interaction term is important. Compare the $R^2$ or adjusted $R^2$ your models have when you regress on just $x_1$ and $x_2$ versus regressing on those variables plus their interaction.
Does it make sense to interact two uncorrelated independent variables in linear regression? Definitely! set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
27,924
Does it make sense to interact two uncorrelated independent variables in linear regression?
To slightly add to Dave's +1 answer, recall that omitting a regressor from a regression model will not affect the remaining coefficients (something that I would argue is more relevant and less trivial than a "better" (higher) $R^2$, which will always obtain with additional regressors - although Dave of course also points to adjusted $R^2$) if it's uncorrelated (orthogonal) with the remaining regressors. To see this, write the OLS estimate containing two blocks of regressors $X_1$ and $X_2$ (in our example, $X_1$ could consist of x^2 and $X_2$ of x1 and x2) as $$ \hat\beta=\begin{pmatrix}X_1'X_1&X_1'X_2\\ X_2'X_1&X_2'X_2\end{pmatrix}^{-1}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix} $$ That is, if the two blocks are orthogonal ($X_1'X_2=0$), we obtain \begin{eqnarray*} \hat\beta&=&\begin{pmatrix}X_1'X_1&0\\ 0&X_2'X_2\end{pmatrix}^{-1}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix}\\ &=&\begin{pmatrix}(X_1'X_1)^{-1}&0\\ 0&(X_2'X_2)\end{pmatrix}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix}\\ &=&\begin{pmatrix}(X_1'X_1)^{-1}X_1'y\\ (X_2'X_2)^{-1}X_2'y\end{pmatrix}, \end{eqnarray*} i.e. the coefficients of two separate regressions. Now, in Dave's example, the interaction has its own partial effect (equal to 5), and, while x1 and x2 are uncorrelated, x12 is not uncorrelated with x1 nor x2. I slightly extend Dave's example: set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) x12 <- x1 * x2 # interaction between x1 and x2 # y <- x1 - x2 + 5*x12 + rnorm(length(x1)) lm.int <- lm(y ~ x1 + x2 + x12) lm.wo.int <- lm(y ~ x1 + x2) summary(lm.int) summary(lm.wo.int) cor(x1, x2) # zero cor(x12, x2) # not zero cor(x12, x1) # not zero
Does it make sense to interact two uncorrelated independent variables in linear regression?
To slightly add to Dave's +1 answer, recall that omitting a regressor from a regression model will not affect the remaining coefficients (something that I would argue is more relevant and less trivial
Does it make sense to interact two uncorrelated independent variables in linear regression? To slightly add to Dave's +1 answer, recall that omitting a regressor from a regression model will not affect the remaining coefficients (something that I would argue is more relevant and less trivial than a "better" (higher) $R^2$, which will always obtain with additional regressors - although Dave of course also points to adjusted $R^2$) if it's uncorrelated (orthogonal) with the remaining regressors. To see this, write the OLS estimate containing two blocks of regressors $X_1$ and $X_2$ (in our example, $X_1$ could consist of x^2 and $X_2$ of x1 and x2) as $$ \hat\beta=\begin{pmatrix}X_1'X_1&X_1'X_2\\ X_2'X_1&X_2'X_2\end{pmatrix}^{-1}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix} $$ That is, if the two blocks are orthogonal ($X_1'X_2=0$), we obtain \begin{eqnarray*} \hat\beta&=&\begin{pmatrix}X_1'X_1&0\\ 0&X_2'X_2\end{pmatrix}^{-1}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix}\\ &=&\begin{pmatrix}(X_1'X_1)^{-1}&0\\ 0&(X_2'X_2)\end{pmatrix}\begin{pmatrix}X_1'y\\ X_2'y\end{pmatrix}\\ &=&\begin{pmatrix}(X_1'X_1)^{-1}X_1'y\\ (X_2'X_2)^{-1}X_2'y\end{pmatrix}, \end{eqnarray*} i.e. the coefficients of two separate regressions. Now, in Dave's example, the interaction has its own partial effect (equal to 5), and, while x1 and x2 are uncorrelated, x12 is not uncorrelated with x1 nor x2. I slightly extend Dave's example: set.seed(2022) N <- 10 x1 <- rep(c(0, 1), N) # (0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) x2 <- c(rep(0, N), rep(1, N)) # (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) x12 <- x1 * x2 # interaction between x1 and x2 # y <- x1 - x2 + 5*x12 + rnorm(length(x1)) lm.int <- lm(y ~ x1 + x2 + x12) lm.wo.int <- lm(y ~ x1 + x2) summary(lm.int) summary(lm.wo.int) cor(x1, x2) # zero cor(x12, x2) # not zero cor(x12, x1) # not zero
Does it make sense to interact two uncorrelated independent variables in linear regression? To slightly add to Dave's +1 answer, recall that omitting a regressor from a regression model will not affect the remaining coefficients (something that I would argue is more relevant and less trivial
27,925
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it follow a well-known distribution?
Although whuber means there is no simple expression for the probability density distribution of $x^4$ with $x\sim \mathcal{N}(\mu,\sigma^2)$ we can use the CDF from whuber's comments to give a simple expression for the PDF: For the CDF we get $${\rm Pr}\left(x \le t\right)=\Phi\left(\frac{\mu}{\sigma}+\frac{t^{1/4}}{\sigma}\right)-\Phi\left(\frac{\mu}{\sigma}-\frac{t^{1/4}}{\sigma}\right)\\ =\frac{1}{2}\left[1+{\rm erf}\left(\frac{1}{\sqrt{2}}\left(\frac{\mu}{\sigma}+\frac{t^{1/4}}{\sigma}\right)\right)\right]-\frac{1}{2}\left[1+{\rm erf}\left(\frac{1}{\sqrt{2}}\left(\frac{\mu}{\sigma}-\frac{t^{1/4}}{\sigma}\right)\right)\right]\tag{1}$$ and for the PDF $${\rm Pr}\left(t\right){\rm d}t=\frac{{\rm d}}{{\rm d}t}{\rm Pr}\left(x \le t\right){\rm d}t=\frac{1}{4 \sqrt{2 \pi } \sigma t^{3/4}}\left({\rm exp}\left(-\frac{\left(t^{1/4}-\mu\right)^2}{2 \sigma ^2}\right)+{\rm exp}\left(-\frac{\left(t^{1/4}+\mu\right)^2}{2 \sigma ^2}\right)\right){\rm d}t \tag{2}$$ The expected value is $$\mu ^4+6 \mu ^2 \sigma ^2+3 \sigma ^4\tag{3}$$ and variance is $$8 \left(2 \mu ^6 \sigma ^2+21 \mu ^4 \sigma ^4+48 \mu ^2 \sigma ^6+12 \sigma ^8\right)\tag{4}$$ Check by simulation The histogram for 300 million samples with $\mu=4.5,\sigma=0.4$ agrees well with the theoretical PDF (black). The simulated (theoretical) values for the expectation are $429.591 (429.579)$ and for the variance $151.8317^2 (151.8326^2)$.
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it f
Although whuber means there is no simple expression for the probability density distribution of $x^4$ with $x\sim \mathcal{N}(\mu,\sigma^2)$ we can use the CDF from whuber's comments to give a simple
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it follow a well-known distribution? Although whuber means there is no simple expression for the probability density distribution of $x^4$ with $x\sim \mathcal{N}(\mu,\sigma^2)$ we can use the CDF from whuber's comments to give a simple expression for the PDF: For the CDF we get $${\rm Pr}\left(x \le t\right)=\Phi\left(\frac{\mu}{\sigma}+\frac{t^{1/4}}{\sigma}\right)-\Phi\left(\frac{\mu}{\sigma}-\frac{t^{1/4}}{\sigma}\right)\\ =\frac{1}{2}\left[1+{\rm erf}\left(\frac{1}{\sqrt{2}}\left(\frac{\mu}{\sigma}+\frac{t^{1/4}}{\sigma}\right)\right)\right]-\frac{1}{2}\left[1+{\rm erf}\left(\frac{1}{\sqrt{2}}\left(\frac{\mu}{\sigma}-\frac{t^{1/4}}{\sigma}\right)\right)\right]\tag{1}$$ and for the PDF $${\rm Pr}\left(t\right){\rm d}t=\frac{{\rm d}}{{\rm d}t}{\rm Pr}\left(x \le t\right){\rm d}t=\frac{1}{4 \sqrt{2 \pi } \sigma t^{3/4}}\left({\rm exp}\left(-\frac{\left(t^{1/4}-\mu\right)^2}{2 \sigma ^2}\right)+{\rm exp}\left(-\frac{\left(t^{1/4}+\mu\right)^2}{2 \sigma ^2}\right)\right){\rm d}t \tag{2}$$ The expected value is $$\mu ^4+6 \mu ^2 \sigma ^2+3 \sigma ^4\tag{3}$$ and variance is $$8 \left(2 \mu ^6 \sigma ^2+21 \mu ^4 \sigma ^4+48 \mu ^2 \sigma ^6+12 \sigma ^8\right)\tag{4}$$ Check by simulation The histogram for 300 million samples with $\mu=4.5,\sigma=0.4$ agrees well with the theoretical PDF (black). The simulated (theoretical) values for the expectation are $429.591 (429.579)$ and for the variance $151.8317^2 (151.8326^2)$.
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it f Although whuber means there is no simple expression for the probability density distribution of $x^4$ with $x\sim \mathcal{N}(\mu,\sigma^2)$ we can use the CDF from whuber's comments to give a simple
27,926
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it follow a well-known distribution?
Let $Y=X^4$ where $X \sim N(u,\sigma^2)$ so: $G_{Y}(y)=P(Y\leq y)$ $G_{Y}(y)=P(X^4\leq y) \\ \\ G_{Y}(y)=P(\sqrt X^4\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X^2|\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(X^2\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X|\leq y^{1/4}) \\ \\ G_{Y}(y)=P(- y^{1/4}\leq X\leq y^{1/4}) \\ \\ G_{Y}(y)=G_{X}(y^{1/4})-G_{X}(-y^{1/4}) $ Where $G_{X}$ is the cumulative of $X$, remember that $Y$ distribution can be get as $f_{Y}(y)=G_{Y}^{'}(y)$ then: $f_{Y}(y)=4y^{-3/4}f_{X}(y^{1/4})+4y^{-3/4}f_{X}(-y^{1/4})$ where $f_X(.)$ is the $X$ distribution applied to $(.)$ Now we are seeking for its support: As $x^4$ is a non negative function so its minimal is equal to $0$ and its maximum is $\infty$ so $Y$ support is given by: $A_Y=(0,\infty)$
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it f
Let $Y=X^4$ where $X \sim N(u,\sigma^2)$ so: $G_{Y}(y)=P(Y\leq y)$ $G_{Y}(y)=P(X^4\leq y) \\ \\ G_{Y}(y)=P(\sqrt X^4\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X^2|\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(X^2\leq \sqrt{y
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it follow a well-known distribution? Let $Y=X^4$ where $X \sim N(u,\sigma^2)$ so: $G_{Y}(y)=P(Y\leq y)$ $G_{Y}(y)=P(X^4\leq y) \\ \\ G_{Y}(y)=P(\sqrt X^4\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X^2|\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(X^2\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X|\leq y^{1/4}) \\ \\ G_{Y}(y)=P(- y^{1/4}\leq X\leq y^{1/4}) \\ \\ G_{Y}(y)=G_{X}(y^{1/4})-G_{X}(-y^{1/4}) $ Where $G_{X}$ is the cumulative of $X$, remember that $Y$ distribution can be get as $f_{Y}(y)=G_{Y}^{'}(y)$ then: $f_{Y}(y)=4y^{-3/4}f_{X}(y^{1/4})+4y^{-3/4}f_{X}(-y^{1/4})$ where $f_X(.)$ is the $X$ distribution applied to $(.)$ Now we are seeking for its support: As $x^4$ is a non negative function so its minimal is equal to $0$ and its maximum is $\infty$ so $Y$ support is given by: $A_Y=(0,\infty)$
If $x$ is a normally distributed random variable, then what is the distribution of $x^4$ ? Does it f Let $Y=X^4$ where $X \sim N(u,\sigma^2)$ so: $G_{Y}(y)=P(Y\leq y)$ $G_{Y}(y)=P(X^4\leq y) \\ \\ G_{Y}(y)=P(\sqrt X^4\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(|X^2|\leq \sqrt{y}) \\ \\ G_{Y}(y)=P(X^2\leq \sqrt{y
27,927
What distribution do OLS estimators follow when dependent variable is not normally distributed?
I am going to assume that you are referring to the conditional distribution of $Y$ in the regression (i.e., given the explanatory variables), which follows directly from the underlying error distribution. So you are really asking what happens when the underlying error terms are not normally distributed. The distribution of the OLS estimator is quite robust to non-normality of the error terms in the model, so long as you have a reasonable amount of data, and you have non-pathological behaviour in your explanatory variables. To see this, note that the OLS estimator can be written in terms of the error terms in the model as: $$\begin{align} \hat{\boldsymbol{\beta}} &= (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} \mathbf{Y} \\[6pt] &= (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} (\mathbf{x} \boldsymbol{\beta} + \boldsymbol{\varepsilon}) \\[6pt] &= \boldsymbol{\beta} + (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} \boldsymbol{\varepsilon} \\[6pt] &= \boldsymbol{\beta} + \sum_{i=1}^n \varepsilon_i \mathbf{w}_i, \\[6pt] \end{align}$$ where the vectors $\mathbf{w}_i = [(\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T}]_{\cdot, i}$ are weight vectors that are fully determined by $\mathbf{x}$. Observe that the deviation of the OLS estimator from the true coefficient vector is a linear function of the error terms. Now, suppose that the error terms are independent with some distributon that has zero mean and a finite variance $\sigma^2 < \infty$, but which is not a normal distribution. Under broad conditions, we can appeal to the multivariate version of the Lyaponov central limit theorem (CLT) to establish that when $n$ is large we have: $$\sum_{i=1}^n \mathbf{w}_i \varepsilon_i \overset{\text{Approx}}{\sim} \text{N} \Bigg( 0, \sigma^2 (\mathbf{x}^\text{T} \mathbf{x})^{-1} \Bigg).$$ Consequently, for large $n$ you have: $$\hat{\boldsymbol{\beta}} \overset{\text{Approx}}{\sim} \text{N} \Bigg( \boldsymbol{\beta}, \sigma^2 (\mathbf{x}^\text{T} \mathbf{x})^{-1} \Bigg).$$ Now, the specific conditions required to apply the CLT here are a bit complicated. Roughly speaking, you need to show that the Lyapunov condition on the weighted sum is satisfied, which requires limiting conditions on the explanatory variables (see e.g., the Grenander conditions discussed here). However, under non-pathological behaviour for the explanatory variables, and assuming that the error terms are IID with finite variance, this is usually sufficient to allow application of the CLT, which means that the OLS estimator is approximately normally distributed when $n$ is large. Note that this result applies even if the underlying error distribution is not normal. By the way, this is one of the big reasons why most of the standard tests in regression analysis are robust to loss of the normality assumption. All of the coefficient tests and goodness-of-fit tests can be derived using the CLT approximation under broad conditions that do not require the error terms to be normally distributed. The normality assumption for the error terms is important for prediction purposes, and you can et very bad predictions of new response variables if you apply this assumption without proper scrutiny. However, so long as you have a reasonable amount of data to fit your model, the normality assumption is not usually important for the internal T-tests and F-tests, and related distributional results for the coefficient estimators and goodness-of-fit statistics.
What distribution do OLS estimators follow when dependent variable is not normally distributed?
I am going to assume that you are referring to the conditional distribution of $Y$ in the regression (i.e., given the explanatory variables), which follows directly from the underlying error distribut
What distribution do OLS estimators follow when dependent variable is not normally distributed? I am going to assume that you are referring to the conditional distribution of $Y$ in the regression (i.e., given the explanatory variables), which follows directly from the underlying error distribution. So you are really asking what happens when the underlying error terms are not normally distributed. The distribution of the OLS estimator is quite robust to non-normality of the error terms in the model, so long as you have a reasonable amount of data, and you have non-pathological behaviour in your explanatory variables. To see this, note that the OLS estimator can be written in terms of the error terms in the model as: $$\begin{align} \hat{\boldsymbol{\beta}} &= (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} \mathbf{Y} \\[6pt] &= (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} (\mathbf{x} \boldsymbol{\beta} + \boldsymbol{\varepsilon}) \\[6pt] &= \boldsymbol{\beta} + (\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T} \boldsymbol{\varepsilon} \\[6pt] &= \boldsymbol{\beta} + \sum_{i=1}^n \varepsilon_i \mathbf{w}_i, \\[6pt] \end{align}$$ where the vectors $\mathbf{w}_i = [(\mathbf{x}^\text{T} \mathbf{x})^{-1} \mathbf{x}^\text{T}]_{\cdot, i}$ are weight vectors that are fully determined by $\mathbf{x}$. Observe that the deviation of the OLS estimator from the true coefficient vector is a linear function of the error terms. Now, suppose that the error terms are independent with some distributon that has zero mean and a finite variance $\sigma^2 < \infty$, but which is not a normal distribution. Under broad conditions, we can appeal to the multivariate version of the Lyaponov central limit theorem (CLT) to establish that when $n$ is large we have: $$\sum_{i=1}^n \mathbf{w}_i \varepsilon_i \overset{\text{Approx}}{\sim} \text{N} \Bigg( 0, \sigma^2 (\mathbf{x}^\text{T} \mathbf{x})^{-1} \Bigg).$$ Consequently, for large $n$ you have: $$\hat{\boldsymbol{\beta}} \overset{\text{Approx}}{\sim} \text{N} \Bigg( \boldsymbol{\beta}, \sigma^2 (\mathbf{x}^\text{T} \mathbf{x})^{-1} \Bigg).$$ Now, the specific conditions required to apply the CLT here are a bit complicated. Roughly speaking, you need to show that the Lyapunov condition on the weighted sum is satisfied, which requires limiting conditions on the explanatory variables (see e.g., the Grenander conditions discussed here). However, under non-pathological behaviour for the explanatory variables, and assuming that the error terms are IID with finite variance, this is usually sufficient to allow application of the CLT, which means that the OLS estimator is approximately normally distributed when $n$ is large. Note that this result applies even if the underlying error distribution is not normal. By the way, this is one of the big reasons why most of the standard tests in regression analysis are robust to loss of the normality assumption. All of the coefficient tests and goodness-of-fit tests can be derived using the CLT approximation under broad conditions that do not require the error terms to be normally distributed. The normality assumption for the error terms is important for prediction purposes, and you can et very bad predictions of new response variables if you apply this assumption without proper scrutiny. However, so long as you have a reasonable amount of data to fit your model, the normality assumption is not usually important for the internal T-tests and F-tests, and related distributional results for the coefficient estimators and goodness-of-fit statistics.
What distribution do OLS estimators follow when dependent variable is not normally distributed? I am going to assume that you are referring to the conditional distribution of $Y$ in the regression (i.e., given the explanatory variables), which follows directly from the underlying error distribut
27,928
Why is p-value termed as P(Data | Hypothesis/Model)?
The equivalence that you propose represents a fundamental (and often made) error, which the American Statistical Association has been trying to stamp out for some time now. See the statement by Wasserstein, Schirm & Lazar (2019). You have one data set, but there are multiple competing hypotheses. The probability one might assign to one given hypothesis ought to reflect the relative strength of evidence for each hypothesis relative to the competitors. A p-value is nothing like that, in itself. When you look at a hypothesis test generating a low p-value, it can seem plausible that the p-value represents the probability of the hypothesis. But think more generally. Imagine a hypothesis test involving a simple hypothesis with one parameter. That parameter is continuous in value, so the value lies on a continuum. There is a p-value that goes with every single one of the infinity of different values on that continuum, and some of those p-values would be quite high, very close to 1.0. The continuum collectively represents all possibilities for the value of the parameter. When we sum across all probabilities for an event, the sum should be 1. But summing all of these p-values will produce a number much, much larger than 1. Therefore, the p-values are not the probabilities that each different value of the parameter is correct or true.
Why is p-value termed as P(Data | Hypothesis/Model)?
The equivalence that you propose represents a fundamental (and often made) error, which the American Statistical Association has been trying to stamp out for some time now. See the statement by Wasser
Why is p-value termed as P(Data | Hypothesis/Model)? The equivalence that you propose represents a fundamental (and often made) error, which the American Statistical Association has been trying to stamp out for some time now. See the statement by Wasserstein, Schirm & Lazar (2019). You have one data set, but there are multiple competing hypotheses. The probability one might assign to one given hypothesis ought to reflect the relative strength of evidence for each hypothesis relative to the competitors. A p-value is nothing like that, in itself. When you look at a hypothesis test generating a low p-value, it can seem plausible that the p-value represents the probability of the hypothesis. But think more generally. Imagine a hypothesis test involving a simple hypothesis with one parameter. That parameter is continuous in value, so the value lies on a continuum. There is a p-value that goes with every single one of the infinity of different values on that continuum, and some of those p-values would be quite high, very close to 1.0. The continuum collectively represents all possibilities for the value of the parameter. When we sum across all probabilities for an event, the sum should be 1. But summing all of these p-values will produce a number much, much larger than 1. Therefore, the p-values are not the probabilities that each different value of the parameter is correct or true.
Why is p-value termed as P(Data | Hypothesis/Model)? The equivalence that you propose represents a fundamental (and often made) error, which the American Statistical Association has been trying to stamp out for some time now. See the statement by Wasser
27,929
Why is p-value termed as P(Data | Hypothesis/Model)?
The literal definition of a p-value is the probability of finding a test statistic at least as extreme as the observed test statistic, given that the null is true: something like (but not quite the same as) $P(\text{Data}\vert\text{Null is true})$. If such a result is unlikely (low p-value), we see that as evidence against the null hypothesis. Sufficiently strong evidence against the null hypothesis make us say, “No, we’re unlikely to get this result if the null is true, but we did get this result, so the null sure seems false,” kind of a proof by contradiction. You claim that a p-value measures the probability of your null hypothesis given the data you’ve collected. This is a common mistake to make, but it is indeed a mistake.
Why is p-value termed as P(Data | Hypothesis/Model)?
The literal definition of a p-value is the probability of finding a test statistic at least as extreme as the observed test statistic, given that the null is true: something like (but not quite the sa
Why is p-value termed as P(Data | Hypothesis/Model)? The literal definition of a p-value is the probability of finding a test statistic at least as extreme as the observed test statistic, given that the null is true: something like (but not quite the same as) $P(\text{Data}\vert\text{Null is true})$. If such a result is unlikely (low p-value), we see that as evidence against the null hypothesis. Sufficiently strong evidence against the null hypothesis make us say, “No, we’re unlikely to get this result if the null is true, but we did get this result, so the null sure seems false,” kind of a proof by contradiction. You claim that a p-value measures the probability of your null hypothesis given the data you’ve collected. This is a common mistake to make, but it is indeed a mistake.
Why is p-value termed as P(Data | Hypothesis/Model)? The literal definition of a p-value is the probability of finding a test statistic at least as extreme as the observed test statistic, given that the null is true: something like (but not quite the sa
27,930
Solution to German Tank Problem
Likelihood Common problems in probability theory refer to the probability of observations $x_1, x_2, ... , x_n$ given a certain model and given the parameters (let's call them $\theta$) involved. For instance the probabilities for specific situations in card games or dice games are often very straightforward. However, in many practical situations we are dealing with an inverse situation (inferential statistics). That is: the observation $x_1, x_2, ... , x_k$ is given and now the model is unknown, or at least we do not know certain parameters $\theta$. In these type of problems we often refer to a term called the likelihood of the parameters, $\mathcal{L(\theta)}$, which is a rate of believe in a specific parameter $\theta$ given observations $x_1, x_2, .. x_k$. This term is expressed as being proportional to the probability for the observations $x_1, x_2, .. x_k$ assuming that a model parameter $\theta$ would be hypothetically true. $$\mathcal{L}(\theta,x_1, x_2, .. x_k) \propto \text{probability observations $x_1, x_2, .. x_k$ given $\theta$ }$$ For a given parameter value $\theta$ the more probable a certain observation $x_1, x_2, .. x_n$ is (relative to the probability with other parameter values), the more the observation supports this particular parameter (or theory/hypothesis that assumes this parameter). A (relative) high likelihood will reinforce our believes about that parameter value (there's a lot more philosophical to say about this). Likelihood in the German tank problem Now for the German tank problem the likelihood function for a set of samples $x_1, x_2, .. x_k$ is: $$\mathcal{L}(\theta,x_1, x_2, .. x_k ) = \Pr(x_1, x_2, .. x_k, \theta) = \begin{cases} 0 &\text{if } \max(x_1, x_2, .. x_k) > \theta \\ {{\theta}\choose{k}}^{-1} &\text{if } \max(x_1, x_2, .. x_k) \leq \theta, \end{cases}$$ Whether you observe samples {1, 2, 10} or samples {8, 9, 10} should not matter when the samples are considered from a uniform distribution with parameter $\theta$. Both samples are equally likely with probability ${{\theta}\choose{3}}^{-1}$ and using the idea of likelihood the one sample does not tell more about the parameter $\theta$ than the other sample. The high values {8, 9, 10} might make you think/believe that $\theta$ should be higher. But, it is only the value {10} That truly gives you relevant information about the likelihood of $\theta$ (the value 10 tells you that $\theta$ will be ten or higher, the other values 8 and 9 do not contribute anything to this information). Fisher Neyman factorization theorem This theorem tells you that a certain statistic $T(x_1, x_2, … , x_k)$ (ie some function of the observations, like the mean, median, or as in the German tank problem the maximum) is sufficient (contains all information) when you can factor out, in the likelihood function, the terms that are dependent on the other observations $x_1, x_2, … , x_k$, such that this factor does not depend on both the parameter $\theta$ and $x_1, x_2, … , x_k$ (and the part of the likelihood function that relates the data with the hypothetical parameter values is only dependent on the statistic but not the whole of the data/observations). The case of the German tank problem is simple. You can see above that the entire expression for the Likelihood above is already only dependent on the statistic $\max(x_1, x_2, .. x_k)$ and the rest of the values $x_1, x_2, .. x_k$ does not matter. Little game as example Let's say we play the following game repeatedly: $\theta$ is itself a random variable and drawn with equal probability either 100 or 110. Then we draw a sample $x_1,x_2,...,x_k$. We want to choose a strategy for guessing $\theta$, based on the observed $x_1,x_2,...,x_k$ that maximizes our probability to have the right guess of $\theta$. The proper strategy will be to choose 100 unless one of the numbers in the sample is >100. We could be tempted to choose the parameter value 110 already when many of the $x_1,x_2,...,x_k$ tend to be all high values close to hundred (but none exactly over hundred), but that would be wrong. The probability for such an observation will be larger when the true parameter value is 100 than when it is 110. So if we guess, in such situation, 100 as the parameter value, then we will be less likely to make a mistake (because the situation with these high values close to hundred, yet still below it, occurs more often in the case that the true value is 100 rather than the case that the true value is 110).
Solution to German Tank Problem
Likelihood Common problems in probability theory refer to the probability of observations $x_1, x_2, ... , x_n$ given a certain model and given the parameters (let's call them $\theta$) involved. For
Solution to German Tank Problem Likelihood Common problems in probability theory refer to the probability of observations $x_1, x_2, ... , x_n$ given a certain model and given the parameters (let's call them $\theta$) involved. For instance the probabilities for specific situations in card games or dice games are often very straightforward. However, in many practical situations we are dealing with an inverse situation (inferential statistics). That is: the observation $x_1, x_2, ... , x_k$ is given and now the model is unknown, or at least we do not know certain parameters $\theta$. In these type of problems we often refer to a term called the likelihood of the parameters, $\mathcal{L(\theta)}$, which is a rate of believe in a specific parameter $\theta$ given observations $x_1, x_2, .. x_k$. This term is expressed as being proportional to the probability for the observations $x_1, x_2, .. x_k$ assuming that a model parameter $\theta$ would be hypothetically true. $$\mathcal{L}(\theta,x_1, x_2, .. x_k) \propto \text{probability observations $x_1, x_2, .. x_k$ given $\theta$ }$$ For a given parameter value $\theta$ the more probable a certain observation $x_1, x_2, .. x_n$ is (relative to the probability with other parameter values), the more the observation supports this particular parameter (or theory/hypothesis that assumes this parameter). A (relative) high likelihood will reinforce our believes about that parameter value (there's a lot more philosophical to say about this). Likelihood in the German tank problem Now for the German tank problem the likelihood function for a set of samples $x_1, x_2, .. x_k$ is: $$\mathcal{L}(\theta,x_1, x_2, .. x_k ) = \Pr(x_1, x_2, .. x_k, \theta) = \begin{cases} 0 &\text{if } \max(x_1, x_2, .. x_k) > \theta \\ {{\theta}\choose{k}}^{-1} &\text{if } \max(x_1, x_2, .. x_k) \leq \theta, \end{cases}$$ Whether you observe samples {1, 2, 10} or samples {8, 9, 10} should not matter when the samples are considered from a uniform distribution with parameter $\theta$. Both samples are equally likely with probability ${{\theta}\choose{3}}^{-1}$ and using the idea of likelihood the one sample does not tell more about the parameter $\theta$ than the other sample. The high values {8, 9, 10} might make you think/believe that $\theta$ should be higher. But, it is only the value {10} That truly gives you relevant information about the likelihood of $\theta$ (the value 10 tells you that $\theta$ will be ten or higher, the other values 8 and 9 do not contribute anything to this information). Fisher Neyman factorization theorem This theorem tells you that a certain statistic $T(x_1, x_2, … , x_k)$ (ie some function of the observations, like the mean, median, or as in the German tank problem the maximum) is sufficient (contains all information) when you can factor out, in the likelihood function, the terms that are dependent on the other observations $x_1, x_2, … , x_k$, such that this factor does not depend on both the parameter $\theta$ and $x_1, x_2, … , x_k$ (and the part of the likelihood function that relates the data with the hypothetical parameter values is only dependent on the statistic but not the whole of the data/observations). The case of the German tank problem is simple. You can see above that the entire expression for the Likelihood above is already only dependent on the statistic $\max(x_1, x_2, .. x_k)$ and the rest of the values $x_1, x_2, .. x_k$ does not matter. Little game as example Let's say we play the following game repeatedly: $\theta$ is itself a random variable and drawn with equal probability either 100 or 110. Then we draw a sample $x_1,x_2,...,x_k$. We want to choose a strategy for guessing $\theta$, based on the observed $x_1,x_2,...,x_k$ that maximizes our probability to have the right guess of $\theta$. The proper strategy will be to choose 100 unless one of the numbers in the sample is >100. We could be tempted to choose the parameter value 110 already when many of the $x_1,x_2,...,x_k$ tend to be all high values close to hundred (but none exactly over hundred), but that would be wrong. The probability for such an observation will be larger when the true parameter value is 100 than when it is 110. So if we guess, in such situation, 100 as the parameter value, then we will be less likely to make a mistake (because the situation with these high values close to hundred, yet still below it, occurs more often in the case that the true value is 100 rather than the case that the true value is 110).
Solution to German Tank Problem Likelihood Common problems in probability theory refer to the probability of observations $x_1, x_2, ... , x_n$ given a certain model and given the parameters (let's call them $\theta$) involved. For
27,931
Solution to German Tank Problem
You haven't presented a precise formulation of "the problem", so it's not exactly clear what you're asking to be proved. From a Bayesian perspective, the posterior probability does depend on all the data. However, each observation of a particular serial number will support that number the most. That is, given any observation $n$, the odds ratio between posterior and prior will be greater for the hypothesis "the actual number of tanks is $n$" than it will be for "the actual number of tanks is [number other than $n$]". Thus, if we start with a uniform prior, then $n$ will have the highest posterior after seeing that observation. Consider a case where we have the data point $13$, and hypotheses $N=10,13,15$. Obviously, the posterior for $N=10$ is zero. And our posteriors for $N=13,15$ will be larger than their prior. The reason for this is that in Bayesian reasoning, absence of evidence is evidence of absence. Any time we have an opportunity where we could have made an observation that would have decreased our probability, but don't, the probability increases. Since we could have seen $16$, which would have set our posteriors for $N=13,15$ to zero, the fact that we didn't see it means that we should increase our posteriors for $N=13,15$. But note that the smaller the number, the more numbers we could have seen that would have excluded that number. For $N=13$, we would have rejected that hypothesis after seeing $14,15,16,...$. But for $N=15$, we would have needed at least $16$ to reject the hypothesis. Since the hypothesis $N=13$ is more falsifiable than $N=15$, the fact that we didn't falsify $N=13$ is more evidence for $N=13$, than not falsifying $N=15$ is evidence for $N=15$. So every time we see a data point, it sets the posterior of everything below it to zero, and increases the posterior of everything else, with smaller numbers getting the largest boost. Thus, the number that gets the overall largest boost will be the smallest number whose posterior wasn't set to zero, i.e. the maximum value of the observations. Numbers less than the maximum affect how much larger a boost the maximum gets, but it doesn't affect the general trend of the maximum getting largest boost. Consider the above example, where we've already seen $13$. If the next number we see is $5$, what effect will that have? It helps out $5$ more than $6$, but both numbers have already been rejected, so that's not relevant. It helps out $13$ more than $15$, but $13$ already has been helped out more than $15$, so that doesn't affect which number has been helped out the most.
Solution to German Tank Problem
You haven't presented a precise formulation of "the problem", so it's not exactly clear what you're asking to be proved. From a Bayesian perspective, the posterior probability does depend on all the d
Solution to German Tank Problem You haven't presented a precise formulation of "the problem", so it's not exactly clear what you're asking to be proved. From a Bayesian perspective, the posterior probability does depend on all the data. However, each observation of a particular serial number will support that number the most. That is, given any observation $n$, the odds ratio between posterior and prior will be greater for the hypothesis "the actual number of tanks is $n$" than it will be for "the actual number of tanks is [number other than $n$]". Thus, if we start with a uniform prior, then $n$ will have the highest posterior after seeing that observation. Consider a case where we have the data point $13$, and hypotheses $N=10,13,15$. Obviously, the posterior for $N=10$ is zero. And our posteriors for $N=13,15$ will be larger than their prior. The reason for this is that in Bayesian reasoning, absence of evidence is evidence of absence. Any time we have an opportunity where we could have made an observation that would have decreased our probability, but don't, the probability increases. Since we could have seen $16$, which would have set our posteriors for $N=13,15$ to zero, the fact that we didn't see it means that we should increase our posteriors for $N=13,15$. But note that the smaller the number, the more numbers we could have seen that would have excluded that number. For $N=13$, we would have rejected that hypothesis after seeing $14,15,16,...$. But for $N=15$, we would have needed at least $16$ to reject the hypothesis. Since the hypothesis $N=13$ is more falsifiable than $N=15$, the fact that we didn't falsify $N=13$ is more evidence for $N=13$, than not falsifying $N=15$ is evidence for $N=15$. So every time we see a data point, it sets the posterior of everything below it to zero, and increases the posterior of everything else, with smaller numbers getting the largest boost. Thus, the number that gets the overall largest boost will be the smallest number whose posterior wasn't set to zero, i.e. the maximum value of the observations. Numbers less than the maximum affect how much larger a boost the maximum gets, but it doesn't affect the general trend of the maximum getting largest boost. Consider the above example, where we've already seen $13$. If the next number we see is $5$, what effect will that have? It helps out $5$ more than $6$, but both numbers have already been rejected, so that's not relevant. It helps out $13$ more than $15$, but $13$ already has been helped out more than $15$, so that doesn't affect which number has been helped out the most.
Solution to German Tank Problem You haven't presented a precise formulation of "the problem", so it's not exactly clear what you're asking to be proved. From a Bayesian perspective, the posterior probability does depend on all the d
27,932
How can a network with only ReLU nodes output negative values?
Consider the definition of the ReLU: $$ f(x) = \max\{0, x\} $$ The output of a ReLU unit is non-negative, full stop. If the final layer of the network of ReLU units, then the output must be non-negative. If the output is negative, then something has gone wrong: either there's a programming error, or the output layer is not a ReLU. Suppose that the last layer is linear, and this linear layer takes ReLU outputs as its input. Clearly, linear layers have no constraints on their outputs, so the output of the linear layer could be positive, negative or neither.
How can a network with only ReLU nodes output negative values?
Consider the definition of the ReLU: $$ f(x) = \max\{0, x\} $$ The output of a ReLU unit is non-negative, full stop. If the final layer of the network of ReLU units, then the output must be non-negati
How can a network with only ReLU nodes output negative values? Consider the definition of the ReLU: $$ f(x) = \max\{0, x\} $$ The output of a ReLU unit is non-negative, full stop. If the final layer of the network of ReLU units, then the output must be non-negative. If the output is negative, then something has gone wrong: either there's a programming error, or the output layer is not a ReLU. Suppose that the last layer is linear, and this linear layer takes ReLU outputs as its input. Clearly, linear layers have no constraints on their outputs, so the output of the linear layer could be positive, negative or neither.
How can a network with only ReLU nodes output negative values? Consider the definition of the ReLU: $$ f(x) = \max\{0, x\} $$ The output of a ReLU unit is non-negative, full stop. If the final layer of the network of ReLU units, then the output must be non-negati
27,933
How can a network with only ReLU nodes output negative values?
Your final outputs are contingent on the activation function in your output layer. If your network only contains relu activations including the output activation, then the outputs will be non-negative, that's correct. However, a model with relu activations in the hidden layers and another output (e.g. a linear function or tanh) can produce non-negative outputs.
How can a network with only ReLU nodes output negative values?
Your final outputs are contingent on the activation function in your output layer. If your network only contains relu activations including the output activation, then the outputs will be non-negative
How can a network with only ReLU nodes output negative values? Your final outputs are contingent on the activation function in your output layer. If your network only contains relu activations including the output activation, then the outputs will be non-negative, that's correct. However, a model with relu activations in the hidden layers and another output (e.g. a linear function or tanh) can produce non-negative outputs.
How can a network with only ReLU nodes output negative values? Your final outputs are contingent on the activation function in your output layer. If your network only contains relu activations including the output activation, then the outputs will be non-negative
27,934
Help me understand poisson.test?
This is an R function that implements a hypothesis test for differences in means. It is analogous to the ?t.test function, except where that assumes the data are normally distributed (in the population), this assumes the data are counts from a Poisson. The basic idea is that you have two counts from two different conditions, where you know the distributions are Poisson. From there, you can test if the two counts differ by more than you would expect by chance alone. You only need one count per condition (perhaps surprisingly) because the Poisson distribution specifies the variance quite rigidly. If the population distributions aren't perfectly Poisson, the test will not be valid, so you are making a very large assumption that you can't assess. Nonetheless, the test may be useful on occasion. With this basic framework in mind, we can interpret the arguments. x is a vector of two counts. If the counts arise from situations in which one condition has a greater opportunity for the event to occur, you can account for that via the T argument, which serves as an offset (cf., Should I use an offset for my Poisson GLM?). Imagine you compared the counts of bacteria from two Petri dishes, where one was twice the size of the other. The former might yield larger counts without anything going on (I don't know if it actually works this way). In that case, you would want to tell the test that the dishes differed; that's what T does. In addition, you could test against some value of the rate ratio other than unity, which is what r does. You can also do a one-sample test against a specified value of the rate; r allows for that, too. Lastly, you could test that your intervention differs from the control, which would be a 'two-sided test', or that the intervention yields larger counts ('greater than'), or smaller counts ('less than'). In your specific example, you say you want to "test the hypothesis that these data are Poisson". That would be a goodness of fit test, which isn't what poisson.test() does. It also doesn't match what the question is asking for. The question, as stated, is asking if it's reasonable to get a value of 2 from a Poisson distribution with mean 6.1. That would be a one-sample version of the test implemented.
Help me understand poisson.test?
This is an R function that implements a hypothesis test for differences in means. It is analogous to the ?t.test function, except where that assumes the data are normally distributed (in the populati
Help me understand poisson.test? This is an R function that implements a hypothesis test for differences in means. It is analogous to the ?t.test function, except where that assumes the data are normally distributed (in the population), this assumes the data are counts from a Poisson. The basic idea is that you have two counts from two different conditions, where you know the distributions are Poisson. From there, you can test if the two counts differ by more than you would expect by chance alone. You only need one count per condition (perhaps surprisingly) because the Poisson distribution specifies the variance quite rigidly. If the population distributions aren't perfectly Poisson, the test will not be valid, so you are making a very large assumption that you can't assess. Nonetheless, the test may be useful on occasion. With this basic framework in mind, we can interpret the arguments. x is a vector of two counts. If the counts arise from situations in which one condition has a greater opportunity for the event to occur, you can account for that via the T argument, which serves as an offset (cf., Should I use an offset for my Poisson GLM?). Imagine you compared the counts of bacteria from two Petri dishes, where one was twice the size of the other. The former might yield larger counts without anything going on (I don't know if it actually works this way). In that case, you would want to tell the test that the dishes differed; that's what T does. In addition, you could test against some value of the rate ratio other than unity, which is what r does. You can also do a one-sample test against a specified value of the rate; r allows for that, too. Lastly, you could test that your intervention differs from the control, which would be a 'two-sided test', or that the intervention yields larger counts ('greater than'), or smaller counts ('less than'). In your specific example, you say you want to "test the hypothesis that these data are Poisson". That would be a goodness of fit test, which isn't what poisson.test() does. It also doesn't match what the question is asking for. The question, as stated, is asking if it's reasonable to get a value of 2 from a Poisson distribution with mean 6.1. That would be a one-sample version of the test implemented.
Help me understand poisson.test? This is an R function that implements a hypothesis test for differences in means. It is analogous to the ?t.test function, except where that assumes the data are normally distributed (in the populati
27,935
Help me understand poisson.test?
As @gung explained, your question is, if it is reasonable to get a value of 2 form a Poisson-distribution with $\lambda=6.1$. If not, the bacteriacide has reduced $\lambda$. In R you can look up the probability density with the function dpois. So the chance of getting zero from that distribution is > dpois(x=0, lambda=6.1) [1] 0.002242868 The chance of getting 1 is > dpois(x=1, lambda=6.1) [1] 0.01368149 And the chance of getting 0, 1 or 2 is > sum(dpois(x=0:2, lambda=6.1)) [1] 0.05765291 Thus under the $H_0$ the chances of getting 2 or even less is larger then 0.05 which is the usual cutoff (note this is a one-sided test).
Help me understand poisson.test?
As @gung explained, your question is, if it is reasonable to get a value of 2 form a Poisson-distribution with $\lambda=6.1$. If not, the bacteriacide has reduced $\lambda$. In R you can look up the p
Help me understand poisson.test? As @gung explained, your question is, if it is reasonable to get a value of 2 form a Poisson-distribution with $\lambda=6.1$. If not, the bacteriacide has reduced $\lambda$. In R you can look up the probability density with the function dpois. So the chance of getting zero from that distribution is > dpois(x=0, lambda=6.1) [1] 0.002242868 The chance of getting 1 is > dpois(x=1, lambda=6.1) [1] 0.01368149 And the chance of getting 0, 1 or 2 is > sum(dpois(x=0:2, lambda=6.1)) [1] 0.05765291 Thus under the $H_0$ the chances of getting 2 or even less is larger then 0.05 which is the usual cutoff (note this is a one-sided test).
Help me understand poisson.test? As @gung explained, your question is, if it is reasonable to get a value of 2 form a Poisson-distribution with $\lambda=6.1$. If not, the bacteriacide has reduced $\lambda$. In R you can look up the p
27,936
Overview over Reinforcement Learning Algorithms
There is a good survey paper here. As a quick summary, in additional to Q-learning methods, there are also a class of policy-based methods, where instead of learning the Q function, you directly learn the best policy $\pi$ to use. These methods include the popular REINFORCE algorithm, which is a policy gradients algorithm. TRPO and GAE are similar policy gradients algorithms. There are a lot of other variants on policy gradients and it can be combined with Q-learning in the actor-critic framework. The A3C algorithm -- asynchronous advantage actor-critic -- is one such actor-critic algorithm, and a very strong baseline in reinforcement learning. You can also search for the best policy $\pi$ by mimicking the outputs from an optimal control algorithm, and this is called guided policy search. In addition to Q-learning and policy gradients, which are both applied in model free settings (neither algorithm maintains a model of the world), there are also model based methods which do estimate the state of the world. These models are valuable because they can be vastly more sample efficient. Model based algorithms aren't exclusive with policy gradients or Q-learning. A common approach is to perform state estimation / learn a dynamics model, and then train a policy on top of the estimated state. So as for a classification, one breakdown would be Q or V function learning Policy based methods Model based Policy based methods can further be subdivided into Policy gradients Actor Critic Policy search
Overview over Reinforcement Learning Algorithms
There is a good survey paper here. As a quick summary, in additional to Q-learning methods, there are also a class of policy-based methods, where instead of learning the Q function, you directly lear
Overview over Reinforcement Learning Algorithms There is a good survey paper here. As a quick summary, in additional to Q-learning methods, there are also a class of policy-based methods, where instead of learning the Q function, you directly learn the best policy $\pi$ to use. These methods include the popular REINFORCE algorithm, which is a policy gradients algorithm. TRPO and GAE are similar policy gradients algorithms. There are a lot of other variants on policy gradients and it can be combined with Q-learning in the actor-critic framework. The A3C algorithm -- asynchronous advantage actor-critic -- is one such actor-critic algorithm, and a very strong baseline in reinforcement learning. You can also search for the best policy $\pi$ by mimicking the outputs from an optimal control algorithm, and this is called guided policy search. In addition to Q-learning and policy gradients, which are both applied in model free settings (neither algorithm maintains a model of the world), there are also model based methods which do estimate the state of the world. These models are valuable because they can be vastly more sample efficient. Model based algorithms aren't exclusive with policy gradients or Q-learning. A common approach is to perform state estimation / learn a dynamics model, and then train a policy on top of the estimated state. So as for a classification, one breakdown would be Q or V function learning Policy based methods Model based Policy based methods can further be subdivided into Policy gradients Actor Critic Policy search
Overview over Reinforcement Learning Algorithms There is a good survey paper here. As a quick summary, in additional to Q-learning methods, there are also a class of policy-based methods, where instead of learning the Q function, you directly lear
27,937
Overview over Reinforcement Learning Algorithms
The best place to start for a general introduction (including algorithms) is Reinforcement Learning: An Introduction by Sutton & Barto. Another good one, focusing more on the algorithms is Algorithms of Reinforcement Learning by Szepesva. Both are available for free online in PDF, see the links.
Overview over Reinforcement Learning Algorithms
The best place to start for a general introduction (including algorithms) is Reinforcement Learning: An Introduction by Sutton & Barto. Another good one, focusing more on the algorithms is Algorithms
Overview over Reinforcement Learning Algorithms The best place to start for a general introduction (including algorithms) is Reinforcement Learning: An Introduction by Sutton & Barto. Another good one, focusing more on the algorithms is Algorithms of Reinforcement Learning by Szepesva. Both are available for free online in PDF, see the links.
Overview over Reinforcement Learning Algorithms The best place to start for a general introduction (including algorithms) is Reinforcement Learning: An Introduction by Sutton & Barto. Another good one, focusing more on the algorithms is Algorithms
27,938
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works?
There's the problem of sign recovery of model selection consistency (which has answered by statisticians), and there's the problem of inference (constructing good confidence intervals for the estimates), which is till a topic of research.
What do statisticians mean when they say we do not really understand how the LASSO (regularization)
There's the problem of sign recovery of model selection consistency (which has answered by statisticians), and there's the problem of inference (constructing good confidence intervals for the estimate
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works? There's the problem of sign recovery of model selection consistency (which has answered by statisticians), and there's the problem of inference (constructing good confidence intervals for the estimates), which is till a topic of research.
What do statisticians mean when they say we do not really understand how the LASSO (regularization) There's the problem of sign recovery of model selection consistency (which has answered by statisticians), and there's the problem of inference (constructing good confidence intervals for the estimate
27,939
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works?
There is sometimes a lack of communication between working statisticians and the learning theory community that study the foundations of methods like the lasso. The theoretical properties of the lasso are actually very well understood. This document has a summary in Section 4 of many of the properties it enjoys. The results are quite technical, but essentially: It recovers the true support (set of non-zero entries) of a sparse weight vector under some mild assumptions, for large enough datasets, with high probability. It converges to the correct weight vector at the optimal rate as the sample size increases, as long as the columns of $X$ are not too correlated.
What do statisticians mean when they say we do not really understand how the LASSO (regularization)
There is sometimes a lack of communication between working statisticians and the learning theory community that study the foundations of methods like the lasso. The theoretical properties of the lasso
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works? There is sometimes a lack of communication between working statisticians and the learning theory community that study the foundations of methods like the lasso. The theoretical properties of the lasso are actually very well understood. This document has a summary in Section 4 of many of the properties it enjoys. The results are quite technical, but essentially: It recovers the true support (set of non-zero entries) of a sparse weight vector under some mild assumptions, for large enough datasets, with high probability. It converges to the correct weight vector at the optimal rate as the sample size increases, as long as the columns of $X$ are not too correlated.
What do statisticians mean when they say we do not really understand how the LASSO (regularization) There is sometimes a lack of communication between working statisticians and the learning theory community that study the foundations of methods like the lasso. The theoretical properties of the lasso
27,940
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works?
If by understanding why Lasso works, you mean understanding why it performs feature selection (i.e. setting weights for some features to exactly 0), we understand that very well:
What do statisticians mean when they say we do not really understand how the LASSO (regularization)
If by understanding why Lasso works, you mean understanding why it performs feature selection (i.e. setting weights for some features to exactly 0), we understand that very well:
What do statisticians mean when they say we do not really understand how the LASSO (regularization) works? If by understanding why Lasso works, you mean understanding why it performs feature selection (i.e. setting weights for some features to exactly 0), we understand that very well:
What do statisticians mean when they say we do not really understand how the LASSO (regularization) If by understanding why Lasso works, you mean understanding why it performs feature selection (i.e. setting weights for some features to exactly 0), we understand that very well:
27,941
If I have the expected value of the logarithm of a RV, can I obtain the expected value of the RV itself?
No. For example, if $X$ follows a log normal distribution, where $\log(X) \sim N(\mu,\sigma)$, then $E[\log(x)] = \mu$ and is independent of $\sigma$. However, its mean is $E[X] = \exp \left(\mu + \frac{\sigma^2}{2} \right)$. Clearly, you cannot derive a $\sigma$ dependent number from a $\sigma$ independent number.
If I have the expected value of the logarithm of a RV, can I obtain the expected value of the RV its
No. For example, if $X$ follows a log normal distribution, where $\log(X) \sim N(\mu,\sigma)$, then $E[\log(x)] = \mu$ and is independent of $\sigma$. However, its mean is $E[X] = \exp \left(\mu + \fr
If I have the expected value of the logarithm of a RV, can I obtain the expected value of the RV itself? No. For example, if $X$ follows a log normal distribution, where $\log(X) \sim N(\mu,\sigma)$, then $E[\log(x)] = \mu$ and is independent of $\sigma$. However, its mean is $E[X] = \exp \left(\mu + \frac{\sigma^2}{2} \right)$. Clearly, you cannot derive a $\sigma$ dependent number from a $\sigma$ independent number.
If I have the expected value of the logarithm of a RV, can I obtain the expected value of the RV its No. For example, if $X$ follows a log normal distribution, where $\log(X) \sim N(\mu,\sigma)$, then $E[\log(x)] = \mu$ and is independent of $\sigma$. However, its mean is $E[X] = \exp \left(\mu + \fr
27,942
What is a cross validation fold, or does this phrase not make sense?
The wording is definitely awkward there. Recall that cross-validation partitions a dataset into $K$ roughly equal "sub-datasets." Each one of these "sub-datasets" is called a "fold." $K$-fold cross validation requires re-fitting a model $K$ times, omitting exactly one fold from the data each time, so the term "fold" can also be used to refer to each repetition. Since there is a one-to-one correspondence between folds and repetitions, there usually isn't a problem with this lax terminology. It is usually apparent from the context which usage is intended, and other times it doesn't make a difference.
What is a cross validation fold, or does this phrase not make sense?
The wording is definitely awkward there. Recall that cross-validation partitions a dataset into $K$ roughly equal "sub-datasets." Each one of these "sub-datasets" is called a "fold." $K$-fold cross va
What is a cross validation fold, or does this phrase not make sense? The wording is definitely awkward there. Recall that cross-validation partitions a dataset into $K$ roughly equal "sub-datasets." Each one of these "sub-datasets" is called a "fold." $K$-fold cross validation requires re-fitting a model $K$ times, omitting exactly one fold from the data each time, so the term "fold" can also be used to refer to each repetition. Since there is a one-to-one correspondence between folds and repetitions, there usually isn't a problem with this lax terminology. It is usually apparent from the context which usage is intended, and other times it doesn't make a difference.
What is a cross validation fold, or does this phrase not make sense? The wording is definitely awkward there. Recall that cross-validation partitions a dataset into $K$ roughly equal "sub-datasets." Each one of these "sub-datasets" is called a "fold." $K$-fold cross va
27,943
What is a cross validation fold, or does this phrase not make sense?
"Fold" refers to a partition (in the set-theoretic meaning of the word) of the sample, $S$, into a training set, $T_j$, and validation set, $V_j$. This means: $T_j \cap V_j = \emptyset$, $T_j \cup V_j = S$, ($1 \leq j \leq k$). Note that in "classic" $k$-fold cross-validation (CV) an additional condition is placed on the validation sets: $V_i \cap V_j = \emptyset$ ($i \neq j$). Finally, note that the $k$ in classic $k$-fold CV controls both the number of times the train-validate procedure is carried out, as well as the size of the validation and training sets: $|V_j| \approxeq \frac{1}{k} |S|$, therefore $|T_j| \approxeq \frac{k-1}{k} |S|$.
What is a cross validation fold, or does this phrase not make sense?
"Fold" refers to a partition (in the set-theoretic meaning of the word) of the sample, $S$, into a training set, $T_j$, and validation set, $V_j$. This means: $T_j \cap V_j = \emptyset$, $T_j \cup V_
What is a cross validation fold, or does this phrase not make sense? "Fold" refers to a partition (in the set-theoretic meaning of the word) of the sample, $S$, into a training set, $T_j$, and validation set, $V_j$. This means: $T_j \cap V_j = \emptyset$, $T_j \cup V_j = S$, ($1 \leq j \leq k$). Note that in "classic" $k$-fold cross-validation (CV) an additional condition is placed on the validation sets: $V_i \cap V_j = \emptyset$ ($i \neq j$). Finally, note that the $k$ in classic $k$-fold CV controls both the number of times the train-validate procedure is carried out, as well as the size of the validation and training sets: $|V_j| \approxeq \frac{1}{k} |S|$, therefore $|T_j| \approxeq \frac{k-1}{k} |S|$.
What is a cross validation fold, or does this phrase not make sense? "Fold" refers to a partition (in the set-theoretic meaning of the word) of the sample, $S$, into a training set, $T_j$, and validation set, $V_j$. This means: $T_j \cap V_j = \emptyset$, $T_j \cup V_
27,944
What is a cross validation fold, or does this phrase not make sense?
I agree with the OP that this terminology is awkward and confusing. Here's my take on it: native English speakers who are well-educated are used to terms such as "twofold" or "threefold", which sound just a bit antiquated but still usable. Critically, however, we don't see these words as containing the noun "fold"; "fold" is more of a suffix here, a funny special construction that is combined with a number to make a colorful variant on "double" or "triple", etc. It has absolutely nothing to do with the verb "to fold" or the noun "fold" that might come up while doing origami and referring to a folded piece of paper. I suspect that the word "fold" started being used as a noun meaning "partition" in the context of k-fold cross validation when a speaker/writer not as familiar with English or with cross-validation thought that "k-fold" literally meant "making k 'folds' of the data". It's quite understandable that someone would come to this conclusion. However, "k-fold" doesn't mean "making k 'folds'" -- instead, it means "doing cross-validation k times", where the detail of having to also make k partitions of the data is implied. Personally I never use "fold" in this strange way; I call the data segments in question "partitions", and it's much more clear. Also, just because this usage has spread through the community doesn't make it reasonable English usage, IMO. I prefer straightforward and clear communication to inventing and using confusing new jargon.
What is a cross validation fold, or does this phrase not make sense?
I agree with the OP that this terminology is awkward and confusing. Here's my take on it: native English speakers who are well-educated are used to terms such as "twofold" or "threefold", which sound
What is a cross validation fold, or does this phrase not make sense? I agree with the OP that this terminology is awkward and confusing. Here's my take on it: native English speakers who are well-educated are used to terms such as "twofold" or "threefold", which sound just a bit antiquated but still usable. Critically, however, we don't see these words as containing the noun "fold"; "fold" is more of a suffix here, a funny special construction that is combined with a number to make a colorful variant on "double" or "triple", etc. It has absolutely nothing to do with the verb "to fold" or the noun "fold" that might come up while doing origami and referring to a folded piece of paper. I suspect that the word "fold" started being used as a noun meaning "partition" in the context of k-fold cross validation when a speaker/writer not as familiar with English or with cross-validation thought that "k-fold" literally meant "making k 'folds' of the data". It's quite understandable that someone would come to this conclusion. However, "k-fold" doesn't mean "making k 'folds'" -- instead, it means "doing cross-validation k times", where the detail of having to also make k partitions of the data is implied. Personally I never use "fold" in this strange way; I call the data segments in question "partitions", and it's much more clear. Also, just because this usage has spread through the community doesn't make it reasonable English usage, IMO. I prefer straightforward and clear communication to inventing and using confusing new jargon.
What is a cross validation fold, or does this phrase not make sense? I agree with the OP that this terminology is awkward and confusing. Here's my take on it: native English speakers who are well-educated are used to terms such as "twofold" or "threefold", which sound
27,945
Goodness of fit, predictive power, discrimination
One way to look at this issue is that goodness of fit is training error and predictive accuracy is test error. ("Predictive power" is not a very precise term.) That is, goodness of fit is how well a model can "predict" data points you've already used to estimate its parameters, whereas predictive accuracy is how well a model can predict new data points, for which it hasn't yet seen the true value of the dependent variable. Many of the same metrics, such as root mean square error, can be used to quantify goodness of fit as well as predictive accuracy; what distinguishes the two cases is whether the model has been trained with the data in question. Which is more important? Personally, I care a lot more about predictive accuracy. This tells you how useful the model would be for predicting unseen data in the future. Goodness of fit is what you should pay attention to if you think of the model as purely descriptive, as providing a summary of the data, rather than predictive. To be clear, the model with the best fit may not be the most predictively accurate, and vice versa, so there's a real choice to be made here. Now, often, data analysis is done for explanatory reasons, where the researcher isn't interested in describing the data or predicting new observations so much as making inferences about the true underlying data-generating process, that is, the explanation for the data. Whether goodness of fit or predictive accuracy is better for this is unclear, not least because neither does a particularly good job of saying how accurate the model is as an explanation. My opinion is that goodness of fit is better, but it's clear that mindlessly trying to optimize goodness of fit, without regard for content-specific issues, won't get you to good explanations fast. Explanation is ultimately a less statistical and more scientific concept than goodness of fit or predictive accuracy.
Goodness of fit, predictive power, discrimination
One way to look at this issue is that goodness of fit is training error and predictive accuracy is test error. ("Predictive power" is not a very precise term.) That is, goodness of fit is how well a m
Goodness of fit, predictive power, discrimination One way to look at this issue is that goodness of fit is training error and predictive accuracy is test error. ("Predictive power" is not a very precise term.) That is, goodness of fit is how well a model can "predict" data points you've already used to estimate its parameters, whereas predictive accuracy is how well a model can predict new data points, for which it hasn't yet seen the true value of the dependent variable. Many of the same metrics, such as root mean square error, can be used to quantify goodness of fit as well as predictive accuracy; what distinguishes the two cases is whether the model has been trained with the data in question. Which is more important? Personally, I care a lot more about predictive accuracy. This tells you how useful the model would be for predicting unseen data in the future. Goodness of fit is what you should pay attention to if you think of the model as purely descriptive, as providing a summary of the data, rather than predictive. To be clear, the model with the best fit may not be the most predictively accurate, and vice versa, so there's a real choice to be made here. Now, often, data analysis is done for explanatory reasons, where the researcher isn't interested in describing the data or predicting new observations so much as making inferences about the true underlying data-generating process, that is, the explanation for the data. Whether goodness of fit or predictive accuracy is better for this is unclear, not least because neither does a particularly good job of saying how accurate the model is as an explanation. My opinion is that goodness of fit is better, but it's clear that mindlessly trying to optimize goodness of fit, without regard for content-specific issues, won't get you to good explanations fast. Explanation is ultimately a less statistical and more scientific concept than goodness of fit or predictive accuracy.
Goodness of fit, predictive power, discrimination One way to look at this issue is that goodness of fit is training error and predictive accuracy is test error. ("Predictive power" is not a very precise term.) That is, goodness of fit is how well a m
27,946
Goodness of fit, predictive power, discrimination
Just to add my two cents, the goodness of fit is how well your data fits the assumptions used to make the model. For example if you are fitting your data to a linear regression model, the goodness of fit answers the question does your data fit a linear regression model according to the assumptions used to create a linear regression model? If the answer is no, then you will certainly have problems with the statistical inference of the regression coefficients amongst other problems. The goodness of fit can be done by visualizing the data(looking the the QQ plots and various other plot for the normality assumptions ( for linear regression and even for logistic regression), or by performing goodness of fit test Hypothesis Testing Procedure 𝐇_𝟎: the model fits the data vs 𝐇_𝐚: the model does not fit the data Over here the test statistic is [1]: https://i.stack.imgur.com/L1wm0.png And the test statistic should follow a chi-squared distribution to pass the 𝐇_𝟎. My recommendation is that the data or test data should pass the goodness of fit test before going on to the prediction or predictive power test. Otherwise you can get a model that doesn't fit your assumption that the model is based upon. This might be ok if you are NOT interested in the meaning of the coefficients of the model or you not interested in prediction out of the population of your dataset. The predictive power is how well can your model predict data it has not seen. Various matrices can be used to judge the predictive power 1.Mean squared prediction error (MSPE) 2.Mean absolute prediction errors (MAE) 3.Mean absolute percentage error (MAPE) 4.Precision error (PM) 5.Confidence Interval error (CIM) 6.You can even use R2 or adjusted R2 You can use on of these matrices to select one among many models. In summary the goodness of fit test makes sure the model you are using align with the assumptions used to generate that model. The predictive power is what it is: how well your model accounts for the variation of of the observations of errors in the data set. So you can get a model that doesn't pass the goodness of fit test, but does predict very well.
Goodness of fit, predictive power, discrimination
Just to add my two cents, the goodness of fit is how well your data fits the assumptions used to make the model. For example if you are fitting your data to a linear regression model, the goodness of
Goodness of fit, predictive power, discrimination Just to add my two cents, the goodness of fit is how well your data fits the assumptions used to make the model. For example if you are fitting your data to a linear regression model, the goodness of fit answers the question does your data fit a linear regression model according to the assumptions used to create a linear regression model? If the answer is no, then you will certainly have problems with the statistical inference of the regression coefficients amongst other problems. The goodness of fit can be done by visualizing the data(looking the the QQ plots and various other plot for the normality assumptions ( for linear regression and even for logistic regression), or by performing goodness of fit test Hypothesis Testing Procedure 𝐇_𝟎: the model fits the data vs 𝐇_𝐚: the model does not fit the data Over here the test statistic is [1]: https://i.stack.imgur.com/L1wm0.png And the test statistic should follow a chi-squared distribution to pass the 𝐇_𝟎. My recommendation is that the data or test data should pass the goodness of fit test before going on to the prediction or predictive power test. Otherwise you can get a model that doesn't fit your assumption that the model is based upon. This might be ok if you are NOT interested in the meaning of the coefficients of the model or you not interested in prediction out of the population of your dataset. The predictive power is how well can your model predict data it has not seen. Various matrices can be used to judge the predictive power 1.Mean squared prediction error (MSPE) 2.Mean absolute prediction errors (MAE) 3.Mean absolute percentage error (MAPE) 4.Precision error (PM) 5.Confidence Interval error (CIM) 6.You can even use R2 or adjusted R2 You can use on of these matrices to select one among many models. In summary the goodness of fit test makes sure the model you are using align with the assumptions used to generate that model. The predictive power is what it is: how well your model accounts for the variation of of the observations of errors in the data set. So you can get a model that doesn't pass the goodness of fit test, but does predict very well.
Goodness of fit, predictive power, discrimination Just to add my two cents, the goodness of fit is how well your data fits the assumptions used to make the model. For example if you are fitting your data to a linear regression model, the goodness of
27,947
Loss Function of scikit-learn LogisticRegression
These two are actually (almost) equivalent because of the following property of the logistic function: $$ \sigma(x) = \frac{1}{1+\exp(-x)} = \frac{\exp(x)}{\exp(x)+1} $$ Also $$ \sum_{i=1}^n \log ( 1 + \exp( -y_i (X_i^T w + c) ) ) \\ = \sum_{i=1}^n \log \left[ (\exp( y_i (X_i^T w + c) ) + 1) \exp( -y_i (X_i^T w + c) ) \right] \\ = -\sum_{i=1}^n \left[ y_i (X_i^T w + c) - \log (\exp( y_i (X_i^T w + c) ) + 1) \right] $$ Note, though, that your formula doesn't have $y_i$ in the "log part", while this one does. (I guess this is a typo)
Loss Function of scikit-learn LogisticRegression
These two are actually (almost) equivalent because of the following property of the logistic function: $$ \sigma(x) = \frac{1}{1+\exp(-x)} = \frac{\exp(x)}{\exp(x)+1} $$ Also $$ \sum_{i=1}^n \log ( 1
Loss Function of scikit-learn LogisticRegression These two are actually (almost) equivalent because of the following property of the logistic function: $$ \sigma(x) = \frac{1}{1+\exp(-x)} = \frac{\exp(x)}{\exp(x)+1} $$ Also $$ \sum_{i=1}^n \log ( 1 + \exp( -y_i (X_i^T w + c) ) ) \\ = \sum_{i=1}^n \log \left[ (\exp( y_i (X_i^T w + c) ) + 1) \exp( -y_i (X_i^T w + c) ) \right] \\ = -\sum_{i=1}^n \left[ y_i (X_i^T w + c) - \log (\exp( y_i (X_i^T w + c) ) + 1) \right] $$ Note, though, that your formula doesn't have $y_i$ in the "log part", while this one does. (I guess this is a typo)
Loss Function of scikit-learn LogisticRegression These two are actually (almost) equivalent because of the following property of the logistic function: $$ \sigma(x) = \frac{1}{1+\exp(-x)} = \frac{\exp(x)}{\exp(x)+1} $$ Also $$ \sum_{i=1}^n \log ( 1
27,948
Loss Function of scikit-learn LogisticRegression
I don't think that the lack of $y_i$ is a typo: The usual log-loss (cross-entropy loss) is: $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)],$$ where $p_i = \sigma(X^T_i \omega + c)$, and $\sigma(x) = 1/(1+e^{-x})$ is the logistic function. From there, $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)] \\ = -\sum_i [y_i \log\left(\frac{p_i}{1-p_i}\right) + \log(1 - p_i)] \\ = -\sum_i [y_i \left( X^T_i \omega + c \right) + \log(1 - p_i)] \\ = -\sum_i [y_i \left( X^T_i \omega + c \right) - \log\left(1 + \exp({X^T_i \omega + c})\right)].$$ This matches the LLH expression given in the original post, without the $y_i$ factor in the exponential.
Loss Function of scikit-learn LogisticRegression
I don't think that the lack of $y_i$ is a typo: The usual log-loss (cross-entropy loss) is: $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)],$$ where $p_i = \sigma(X^T_i \omega + c)$, and $\sigma(x)
Loss Function of scikit-learn LogisticRegression I don't think that the lack of $y_i$ is a typo: The usual log-loss (cross-entropy loss) is: $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)],$$ where $p_i = \sigma(X^T_i \omega + c)$, and $\sigma(x) = 1/(1+e^{-x})$ is the logistic function. From there, $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)] \\ = -\sum_i [y_i \log\left(\frac{p_i}{1-p_i}\right) + \log(1 - p_i)] \\ = -\sum_i [y_i \left( X^T_i \omega + c \right) + \log(1 - p_i)] \\ = -\sum_i [y_i \left( X^T_i \omega + c \right) - \log\left(1 + \exp({X^T_i \omega + c})\right)].$$ This matches the LLH expression given in the original post, without the $y_i$ factor in the exponential.
Loss Function of scikit-learn LogisticRegression I don't think that the lack of $y_i$ is a typo: The usual log-loss (cross-entropy loss) is: $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)],$$ where $p_i = \sigma(X^T_i \omega + c)$, and $\sigma(x)
27,949
Loss Function of scikit-learn LogisticRegression
It is just a matter of the definition of $y_i$. Defining $y_i$ and $\tilde y_i$ such that $y_i \in \{0, 1\}$ and $\tilde y_i \in \{-1, 1\}$ ($\tilde y_i = 2y_i -1$), and using $p_i = \sigma({X^T_i \omega + c})$ and $1- \sigma(x) = \sigma(-x)$, you get $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)] = \sum_i \log\left(1 + \exp(-\tilde y_i({X^T_i \omega + c}))\right).$$
Loss Function of scikit-learn LogisticRegression
It is just a matter of the definition of $y_i$. Defining $y_i$ and $\tilde y_i$ such that $y_i \in \{0, 1\}$ and $\tilde y_i \in \{-1, 1\}$ ($\tilde y_i = 2y_i -1$), and using $p_i = \sigma({X^T_i \o
Loss Function of scikit-learn LogisticRegression It is just a matter of the definition of $y_i$. Defining $y_i$ and $\tilde y_i$ such that $y_i \in \{0, 1\}$ and $\tilde y_i \in \{-1, 1\}$ ($\tilde y_i = 2y_i -1$), and using $p_i = \sigma({X^T_i \omega + c})$ and $1- \sigma(x) = \sigma(-x)$, you get $$-\sum_i [y_i \log(p_i) + (1-y_i) \log(1 - p_i)] = \sum_i \log\left(1 + \exp(-\tilde y_i({X^T_i \omega + c}))\right).$$
Loss Function of scikit-learn LogisticRegression It is just a matter of the definition of $y_i$. Defining $y_i$ and $\tilde y_i$ such that $y_i \in \{0, 1\}$ and $\tilde y_i \in \{-1, 1\}$ ($\tilde y_i = 2y_i -1$), and using $p_i = \sigma({X^T_i \o
27,950
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
The idea of a non-parametric density estimator is that it should be able to approximate any distribution arbitrarily closely for a large enough sample size. The class of distributions defined by the KDE method is parametric; it arguably has $n+1$ parameters for any $n$ data points (the parameters being the data points themselves and the bandwidth parameter), but if one does not accept that the means are parameters then it still has one parameter (the bandwidth). Under an appropriate estimation method for the bandwidth, as $n \rightarrow \infty$ the KDE will converge towards the true distribution of the observed sequence of values for underlying IID data.
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
The idea of a non-parametric density estimator is that it should be able to approximate any distribution arbitrarily closely for a large enough sample size. The class of distributions defined by the
Why is Kernel Density Estimation still nonparametric with parametrized kernel? The idea of a non-parametric density estimator is that it should be able to approximate any distribution arbitrarily closely for a large enough sample size. The class of distributions defined by the KDE method is parametric; it arguably has $n+1$ parameters for any $n$ data points (the parameters being the data points themselves and the bandwidth parameter), but if one does not accept that the means are parameters then it still has one parameter (the bandwidth). Under an appropriate estimation method for the bandwidth, as $n \rightarrow \infty$ the KDE will converge towards the true distribution of the observed sequence of values for underlying IID data.
Why is Kernel Density Estimation still nonparametric with parametrized kernel? The idea of a non-parametric density estimator is that it should be able to approximate any distribution arbitrarily closely for a large enough sample size. The class of distributions defined by the
27,951
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
Doing a little more reading, I have seen different definitions that change my perspective of non-parametric models. I believed that a non-parametric model/distribution must entirely lack parameters, but some report that non-parametric statistics may or may not have parameters. What distinguishes non-parametric statistics from parametric statistics is that they do not have a fixed or a priori distribution or model structure. To answer the question, KDE with a normal kernel does not assume that the resulting distribution will have a particular shape, and does not assume a model structure (Ex. the number of parameters). Thus, KDE with a normal kernel is non-parametric.
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
Doing a little more reading, I have seen different definitions that change my perspective of non-parametric models. I believed that a non-parametric model/distribution must entirely lack parameters, b
Why is Kernel Density Estimation still nonparametric with parametrized kernel? Doing a little more reading, I have seen different definitions that change my perspective of non-parametric models. I believed that a non-parametric model/distribution must entirely lack parameters, but some report that non-parametric statistics may or may not have parameters. What distinguishes non-parametric statistics from parametric statistics is that they do not have a fixed or a priori distribution or model structure. To answer the question, KDE with a normal kernel does not assume that the resulting distribution will have a particular shape, and does not assume a model structure (Ex. the number of parameters). Thus, KDE with a normal kernel is non-parametric.
Why is Kernel Density Estimation still nonparametric with parametrized kernel? Doing a little more reading, I have seen different definitions that change my perspective of non-parametric models. I believed that a non-parametric model/distribution must entirely lack parameters, b
27,952
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
Maybe this picture helps. Actually, the "parametric" kernels only give weights and do not strongly influence (as @conjectures says) the shape of the density estimate, in the sense that different kernels often produce very similar density estimates. The example shows 20 purple realizations of some mixture of normals. The grey bell curves indicate the weights that each observation yields for the points at which we want density estimates ($[-4,4]$ in the picture). A kernel density estimate at some point $x$ then simply consists of stacking the weights at that point on top of each other. In the picture, we see that at $x=-2.2$, essentially only two observations contribute weights to the estimate at that point (technically, with a normal kernel, all weights are nonzero, but as the normal tails decay quickly, the weights quickly become negligible). These weights are the magenta and green bars. That the orange and red curve agree confirms that this handmade approach to constructing a KDE just reproduces what Rs density command does.
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
Maybe this picture helps. Actually, the "parametric" kernels only give weights and do not strongly influence (as @conjectures says) the shape of the density estimate, in the sense that different kerne
Why is Kernel Density Estimation still nonparametric with parametrized kernel? Maybe this picture helps. Actually, the "parametric" kernels only give weights and do not strongly influence (as @conjectures says) the shape of the density estimate, in the sense that different kernels often produce very similar density estimates. The example shows 20 purple realizations of some mixture of normals. The grey bell curves indicate the weights that each observation yields for the points at which we want density estimates ($[-4,4]$ in the picture). A kernel density estimate at some point $x$ then simply consists of stacking the weights at that point on top of each other. In the picture, we see that at $x=-2.2$, essentially only two observations contribute weights to the estimate at that point (technically, with a normal kernel, all weights are nonzero, but as the normal tails decay quickly, the weights quickly become negligible). These weights are the magenta and green bars. That the orange and red curve agree confirms that this handmade approach to constructing a KDE just reproduces what Rs density command does.
Why is Kernel Density Estimation still nonparametric with parametrized kernel? Maybe this picture helps. Actually, the "parametric" kernels only give weights and do not strongly influence (as @conjectures says) the shape of the density estimate, in the sense that different kerne
27,953
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
KDE is about fitting a density function to data. As the result could be an arbitrary curve (from some wide family) it could be considered nonparametric. I'm not familiar with the video you link but assume the kernel is being used to fit some local part of the overall density function's shape. Therefore the parameters of the kernel function influence but do not dictate the shape of the overall density function which is mainly determined by the data. Contrast this to a regular Normal density function where the parameters absolutely determine the shape of the density.
Why is Kernel Density Estimation still nonparametric with parametrized kernel?
KDE is about fitting a density function to data. As the result could be an arbitrary curve (from some wide family) it could be considered nonparametric. I'm not familiar with the video you link but a
Why is Kernel Density Estimation still nonparametric with parametrized kernel? KDE is about fitting a density function to data. As the result could be an arbitrary curve (from some wide family) it could be considered nonparametric. I'm not familiar with the video you link but assume the kernel is being used to fit some local part of the overall density function's shape. Therefore the parameters of the kernel function influence but do not dictate the shape of the overall density function which is mainly determined by the data. Contrast this to a regular Normal density function where the parameters absolutely determine the shape of the density.
Why is Kernel Density Estimation still nonparametric with parametrized kernel? KDE is about fitting a density function to data. As the result could be an arbitrary curve (from some wide family) it could be considered nonparametric. I'm not familiar with the video you link but a
27,954
Maximum likelihood estimator of location parameter of Cauchy distribution
Ok, Let us say the pdf for the cauchy is : $f(x;\theta)=\frac{1}{\pi}\frac{1}{1+(x-\theta)^2}$ here $\theta$ is median, not mean since for Cauchy mean is undefined. $$L(\theta;x)=\frac{1}{\pi}\frac{1}{1+(x_1-\theta)^2}\frac{1}{\pi}\frac{1}{1+(x_2-\theta)^2}\cdots\frac{1}{\pi}\frac{1}{1+(x_n-\theta)^2}\\=\frac{1}{\pi^n} \frac{1}{\prod[1+(x_i-\theta)^2]}$$ $$\ell(\theta;x)=-n\log\pi-\sum_{i=1}^n\log[1+(x_i-\theta)^2]$$ $$\frac{d\ell(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$$ This is exactly what you got, except here $\theta$ is median, not mean. I suppose $u$ is median in your formula. Next step, in order to find mle we need set $\frac{d\ell(\theta;x)}{d\theta} = \sum_{i=1}^n \frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$ Now $\theta$ is your variable, and $x_is$ are known values, you need to solve equation $\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$ i.e. to solve $\frac{2(x_1-\theta)}{1+(x_1-\theta)^2}+\frac{2(x_2-\theta)}{1+(x_2-\theta)^2}+\cdots+\frac{2(x_n-\theta)}{1+(x_n-\theta)^2}=0$. It seems to solve this equation will be very difficult. Therefore, we need Newton-Raphson method. I think a lot of calculus books talk about the method The formula for Newton-Raphson method can be written as $$\hat{\theta^1}=\hat{\theta^0}-\frac{\ell'(\hat{\theta^0})}{\ell''(\hat{\theta^0})} \tag 1$$ $\hat{\theta^0}$ is your initial guess of $\theta$ $\ell'$ is the first derivative of log likelihood function. $\ell''$ is the second derivative of log likelihood function. From $\hat{\theta^0}$ you can get $\hat{\theta^1}$ then you put $\hat{\theta^1}$ to $(1)$ then you get $\hat{\theta^2}$ and put it to $(1)$ to get $\hat{\theta^3}$...continue this iterations until to there are no big changes between $\hat{\theta^n}$ and $\hat{\theta^{n-1}}$ The followings are R function I wrote to get mle for the Cauchy distribution. mlecauchy=function(x,toler=.001){ #x is a vector here startvalue=median(x) n=length(x); thetahatcurr=startvalue; # Compute first deriviative of log likelihood firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2)) # Continue Newton’s method until the first derivative # of the likelihood is within toler of 0.001 while(abs(firstderivll)>toler){ # Compute second derivative of log likelihood secondderivll=2*sum(((x-thetahatcurr)^2-1)/(1+(x-thetahatcurr)^2)^2); # Newton’s method update of estimate of theta thetahatnew=thetahatcurr-firstderivll/secondderivll; thetahatcurr=thetahatnew; # Compute first derivative of log likelihood firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2)) } list(thetahat=thetahatcurr); } Now suppose your data are $x_1=1.94,x_2=0.59,x_3=-5.98,x_4=-0.08,x_5-0.77$ x<-c(-1.94,0.59,-5.98,-0.08,-0.77) mlecauchy(x,0.0001) Result: #$thetahat #[1] -0.5343968 We also can use R build in function to get mle. optimize(function(theta) -sum(dcauchy(x, location=theta, log=TRUE)), c(-100,100)) #we use negative sign here Results: #$minimum #[1] -0.5343902 The result is almost the same as home-made codes. Ok, as you required, let us do this by hand. First we get an initial guess will be median of data $-5.98, -1.94, -0.77, -0.08, 0.59 $ The median is $-0.77$ Next we already know that $l'(\theta)=\frac{dl(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$ and $$l''(\theta)=\frac{dl^2(\theta;x)}{d(\theta}=\frac{d(\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2})}{d\theta}=2\sum_{i=1}^n\frac{(x_i-\theta)^2-1}{[1+(x_i-\theta)^2]^2}$$ Now we plug in the $\hat{\theta^0}$ i.e median to $l'(\theta)$ and $l''(\theta)$ i.e. replace $\theta$ with $\hat{\theta^0}$ i.e median i.e $-0.77$ \begin{align} \ell'(\theta) = {} & \sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2} \\[10pt] = {} &\frac{2[-5.98-(-0.77)]}{1+[(-5.98-(-0.77)^2]} + \frac{2[-1.94-(-0.77)]}{1+[(-1.94-(-0.77)^2]} + \frac{2[-0.77-(-0.77)]}{1+[(-0.77-(-0.77)^2]} \\[6pt] & {} +\frac{2[-0.08-(-0.77)]}{1+[(-0.08-(-0.77)^2]} +\frac{2[0.59-(-0.77)]}{1+[(0.59-(-0.77)^2]}\\[10pt] = {} & \text{??} \end{align} Next plug in $x_1$ to $x_5$ and $-0.77$ to get $\ell''(\theta)$ then you can get $\hat{\theta^1}$ Ok, I have to stop here, it is too troublesome to calculate these values by hand.
Maximum likelihood estimator of location parameter of Cauchy distribution
Ok, Let us say the pdf for the cauchy is : $f(x;\theta)=\frac{1}{\pi}\frac{1}{1+(x-\theta)^2}$ here $\theta$ is median, not mean since for Cauchy mean is undefined. $$L(\theta;x)=\frac{1}{\pi}\frac{1
Maximum likelihood estimator of location parameter of Cauchy distribution Ok, Let us say the pdf for the cauchy is : $f(x;\theta)=\frac{1}{\pi}\frac{1}{1+(x-\theta)^2}$ here $\theta$ is median, not mean since for Cauchy mean is undefined. $$L(\theta;x)=\frac{1}{\pi}\frac{1}{1+(x_1-\theta)^2}\frac{1}{\pi}\frac{1}{1+(x_2-\theta)^2}\cdots\frac{1}{\pi}\frac{1}{1+(x_n-\theta)^2}\\=\frac{1}{\pi^n} \frac{1}{\prod[1+(x_i-\theta)^2]}$$ $$\ell(\theta;x)=-n\log\pi-\sum_{i=1}^n\log[1+(x_i-\theta)^2]$$ $$\frac{d\ell(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$$ This is exactly what you got, except here $\theta$ is median, not mean. I suppose $u$ is median in your formula. Next step, in order to find mle we need set $\frac{d\ell(\theta;x)}{d\theta} = \sum_{i=1}^n \frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$ Now $\theta$ is your variable, and $x_is$ are known values, you need to solve equation $\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$ i.e. to solve $\frac{2(x_1-\theta)}{1+(x_1-\theta)^2}+\frac{2(x_2-\theta)}{1+(x_2-\theta)^2}+\cdots+\frac{2(x_n-\theta)}{1+(x_n-\theta)^2}=0$. It seems to solve this equation will be very difficult. Therefore, we need Newton-Raphson method. I think a lot of calculus books talk about the method The formula for Newton-Raphson method can be written as $$\hat{\theta^1}=\hat{\theta^0}-\frac{\ell'(\hat{\theta^0})}{\ell''(\hat{\theta^0})} \tag 1$$ $\hat{\theta^0}$ is your initial guess of $\theta$ $\ell'$ is the first derivative of log likelihood function. $\ell''$ is the second derivative of log likelihood function. From $\hat{\theta^0}$ you can get $\hat{\theta^1}$ then you put $\hat{\theta^1}$ to $(1)$ then you get $\hat{\theta^2}$ and put it to $(1)$ to get $\hat{\theta^3}$...continue this iterations until to there are no big changes between $\hat{\theta^n}$ and $\hat{\theta^{n-1}}$ The followings are R function I wrote to get mle for the Cauchy distribution. mlecauchy=function(x,toler=.001){ #x is a vector here startvalue=median(x) n=length(x); thetahatcurr=startvalue; # Compute first deriviative of log likelihood firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2)) # Continue Newton’s method until the first derivative # of the likelihood is within toler of 0.001 while(abs(firstderivll)>toler){ # Compute second derivative of log likelihood secondderivll=2*sum(((x-thetahatcurr)^2-1)/(1+(x-thetahatcurr)^2)^2); # Newton’s method update of estimate of theta thetahatnew=thetahatcurr-firstderivll/secondderivll; thetahatcurr=thetahatnew; # Compute first derivative of log likelihood firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2)) } list(thetahat=thetahatcurr); } Now suppose your data are $x_1=1.94,x_2=0.59,x_3=-5.98,x_4=-0.08,x_5-0.77$ x<-c(-1.94,0.59,-5.98,-0.08,-0.77) mlecauchy(x,0.0001) Result: #$thetahat #[1] -0.5343968 We also can use R build in function to get mle. optimize(function(theta) -sum(dcauchy(x, location=theta, log=TRUE)), c(-100,100)) #we use negative sign here Results: #$minimum #[1] -0.5343902 The result is almost the same as home-made codes. Ok, as you required, let us do this by hand. First we get an initial guess will be median of data $-5.98, -1.94, -0.77, -0.08, 0.59 $ The median is $-0.77$ Next we already know that $l'(\theta)=\frac{dl(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$ and $$l''(\theta)=\frac{dl^2(\theta;x)}{d(\theta}=\frac{d(\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2})}{d\theta}=2\sum_{i=1}^n\frac{(x_i-\theta)^2-1}{[1+(x_i-\theta)^2]^2}$$ Now we plug in the $\hat{\theta^0}$ i.e median to $l'(\theta)$ and $l''(\theta)$ i.e. replace $\theta$ with $\hat{\theta^0}$ i.e median i.e $-0.77$ \begin{align} \ell'(\theta) = {} & \sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2} \\[10pt] = {} &\frac{2[-5.98-(-0.77)]}{1+[(-5.98-(-0.77)^2]} + \frac{2[-1.94-(-0.77)]}{1+[(-1.94-(-0.77)^2]} + \frac{2[-0.77-(-0.77)]}{1+[(-0.77-(-0.77)^2]} \\[6pt] & {} +\frac{2[-0.08-(-0.77)]}{1+[(-0.08-(-0.77)^2]} +\frac{2[0.59-(-0.77)]}{1+[(0.59-(-0.77)^2]}\\[10pt] = {} & \text{??} \end{align} Next plug in $x_1$ to $x_5$ and $-0.77$ to get $\ell''(\theta)$ then you can get $\hat{\theta^1}$ Ok, I have to stop here, it is too troublesome to calculate these values by hand.
Maximum likelihood estimator of location parameter of Cauchy distribution Ok, Let us say the pdf for the cauchy is : $f(x;\theta)=\frac{1}{\pi}\frac{1}{1+(x-\theta)^2}$ here $\theta$ is median, not mean since for Cauchy mean is undefined. $$L(\theta;x)=\frac{1}{\pi}\frac{1
27,955
How can I tell that there is no pattern in the PCA results?
You explained variance plot tells me that PCA is pointless here. 11/18 is 61%, so you need 61% of your variables to explain 85% of variance. That's not the case for PCA, in my opinion. I use PCA when 3-5 factors of 18 explain 95% or so of the variance. UPDATE: Look at the plot of cumulative percent of variance explained by the number of PCs. This is from interest rate term structure modeling field. You see how 3 components explain more than 99% of total variance. This may look like a made up example for PCA advertising :) However, this is a real thing. Interest rate tenors are that much correlated, that's why PCA is very natural in this application. Instead of dealing with a couple of dozens of tenors, you deal with just 3 components.
How can I tell that there is no pattern in the PCA results?
You explained variance plot tells me that PCA is pointless here. 11/18 is 61%, so you need 61% of your variables to explain 85% of variance. That's not the case for PCA, in my opinion. I use PCA when
How can I tell that there is no pattern in the PCA results? You explained variance plot tells me that PCA is pointless here. 11/18 is 61%, so you need 61% of your variables to explain 85% of variance. That's not the case for PCA, in my opinion. I use PCA when 3-5 factors of 18 explain 95% or so of the variance. UPDATE: Look at the plot of cumulative percent of variance explained by the number of PCs. This is from interest rate term structure modeling field. You see how 3 components explain more than 99% of total variance. This may look like a made up example for PCA advertising :) However, this is a real thing. Interest rate tenors are that much correlated, that's why PCA is very natural in this application. Instead of dealing with a couple of dozens of tenors, you deal with just 3 components.
How can I tell that there is no pattern in the PCA results? You explained variance plot tells me that PCA is pointless here. 11/18 is 61%, so you need 61% of your variables to explain 85% of variance. That's not the case for PCA, in my opinion. I use PCA when
27,956
How can I tell that there is no pattern in the PCA results?
If you have $N>1000$ samples and only $p=19$ predictors it would be pretty reasonable to just use all predictors in a model. In that case a PCA step may well be unnecessary. If you are confident that only a subset of the variables are really explanatory, using a sparse regression model, e.g. Elastic Net, could help you to establish this. Also, interpretation of PCA results using mixed type inputs (binary vs real, different scales etc, see CV question here) is not so straightforward and you may wish to avoid it unless there is a clear reason to do so.
How can I tell that there is no pattern in the PCA results?
If you have $N>1000$ samples and only $p=19$ predictors it would be pretty reasonable to just use all predictors in a model. In that case a PCA step may well be unnecessary. If you are confident that
How can I tell that there is no pattern in the PCA results? If you have $N>1000$ samples and only $p=19$ predictors it would be pretty reasonable to just use all predictors in a model. In that case a PCA step may well be unnecessary. If you are confident that only a subset of the variables are really explanatory, using a sparse regression model, e.g. Elastic Net, could help you to establish this. Also, interpretation of PCA results using mixed type inputs (binary vs real, different scales etc, see CV question here) is not so straightforward and you may wish to avoid it unless there is a clear reason to do so.
How can I tell that there is no pattern in the PCA results? If you have $N>1000$ samples and only $p=19$ predictors it would be pretty reasonable to just use all predictors in a model. In that case a PCA step may well be unnecessary. If you are confident that
27,957
How can I tell that there is no pattern in the PCA results?
I'm going to interpret your question as succinctly as I can. Let me know if it changes your meaning. I'm quite confident that 6 of the predicting variables are associated with the binary response [but] I see no significant pattern in the pca I don't see any "significant pattern" either, other than the consistency in your pairplots. They're all just roughly circular blobs. I'm curious what you expected to see. Clearly separate point clusters some of the pairplots? A few plots very close to linear? Your PCA results - the bloblike pairplots and only 85% of variance captured in the top 11 principal components - don't preclude your hunch about 6 variables being sufficient for binary response prediction. Imagine these situations: Say your PCA results show that 99% of variance is captured by 6 principal components. That might seem to support your hunch about 6 predictor variables - maybe you could define a plane or some other surface in that 6 dimensional space which classifies the points very well, and you could use that surface as a binary predictor. Which brings me to number 2... Say your top 6 principal components have pairplots that look like this But let's color code an arbitrary binary response Even though you managed to capture nearly all (99%) of the variance in 6 variables, you still aren't guaranteed to have spatial separation to predict your binary response. You might actually need several numerical thresholds (which could be plotted as surfaces in that 6 dimensional space), and a point's membership to your binary classification might depend on a complex conditional expression made of that point's relationship to each of those thresholds. But that's just an example of how a binary class could be predicted. There are a ton of data structures and methods for representing, training, and predicting. This is a teaser. To quote, Often the hardest part of solving a machine learning problem can be finding the right estimator for the job.
How can I tell that there is no pattern in the PCA results?
I'm going to interpret your question as succinctly as I can. Let me know if it changes your meaning. I'm quite confident that 6 of the predicting variables are associated with the binary response [b
How can I tell that there is no pattern in the PCA results? I'm going to interpret your question as succinctly as I can. Let me know if it changes your meaning. I'm quite confident that 6 of the predicting variables are associated with the binary response [but] I see no significant pattern in the pca I don't see any "significant pattern" either, other than the consistency in your pairplots. They're all just roughly circular blobs. I'm curious what you expected to see. Clearly separate point clusters some of the pairplots? A few plots very close to linear? Your PCA results - the bloblike pairplots and only 85% of variance captured in the top 11 principal components - don't preclude your hunch about 6 variables being sufficient for binary response prediction. Imagine these situations: Say your PCA results show that 99% of variance is captured by 6 principal components. That might seem to support your hunch about 6 predictor variables - maybe you could define a plane or some other surface in that 6 dimensional space which classifies the points very well, and you could use that surface as a binary predictor. Which brings me to number 2... Say your top 6 principal components have pairplots that look like this But let's color code an arbitrary binary response Even though you managed to capture nearly all (99%) of the variance in 6 variables, you still aren't guaranteed to have spatial separation to predict your binary response. You might actually need several numerical thresholds (which could be plotted as surfaces in that 6 dimensional space), and a point's membership to your binary classification might depend on a complex conditional expression made of that point's relationship to each of those thresholds. But that's just an example of how a binary class could be predicted. There are a ton of data structures and methods for representing, training, and predicting. This is a teaser. To quote, Often the hardest part of solving a machine learning problem can be finding the right estimator for the job.
How can I tell that there is no pattern in the PCA results? I'm going to interpret your question as succinctly as I can. Let me know if it changes your meaning. I'm quite confident that 6 of the predicting variables are associated with the binary response [b
27,958
What can we say about models on observational data in the absence of instruments?
So the vast majority of my field (though not the part I work in most) is concerned with just this - the fitting of GLM-type models to observational data. For the most part, instrumental variables are a rarity, either due to a lack of familiarity with the technique or, as importantly, the lack of a good instrument. To address your questions in order: The major issue is, of course, some sort of residual confounding by an unobserved variable that is associated with both the exposure and outcome of interest. The plain language version is that your answer might be wrong, but you don't necessarily know how or why. Decisions made on that information (like whether or not to use a particular treatment, whether X thing in the environment is dangerous, etc.) are decisions made using the wrong information. I'd assert that the answer to this is yes because, for the most part, these studies are trying to get at something where there isn't necessarily a good instrument, or where randomization is impossible. So when it comes down to it, the alternative is "Just guess". These models are, if nothing else, a formalization of our thoughts and a solid attempt at getting close to the answer, and are easier to grapple with. For example, you can ask how serious the bias would have to be in order to qualitatively change your answer (i.e. "Yes, X is bad for you..."), and assess whether or not you think it's reasonable there's an unknown factor of that strength lurking outside your data. For example, the finding that HPV infection is extremely strongly associated with cervical cancer is an important finding, and the strength of an unmeasured factor that would bias that all the way to the null would have to be staggeringly strong. Furthermore, it should be noted that an instrument doesn't fix this - they only work absent some unmeasured associations as well, and even randomized trials suffer from problems (differential dropout between treatment and controls, any behavior change post randomization, generalizability to the actual target population) that also get glossed over a bit. Rothman, Greenland and Lash wrote the latest edition of Modern Epidemiology which is essentially a book devoted to trying to do these in the best way possible.
What can we say about models on observational data in the absence of instruments?
So the vast majority of my field (though not the part I work in most) is concerned with just this - the fitting of GLM-type models to observational data. For the most part, instrumental variables are
What can we say about models on observational data in the absence of instruments? So the vast majority of my field (though not the part I work in most) is concerned with just this - the fitting of GLM-type models to observational data. For the most part, instrumental variables are a rarity, either due to a lack of familiarity with the technique or, as importantly, the lack of a good instrument. To address your questions in order: The major issue is, of course, some sort of residual confounding by an unobserved variable that is associated with both the exposure and outcome of interest. The plain language version is that your answer might be wrong, but you don't necessarily know how or why. Decisions made on that information (like whether or not to use a particular treatment, whether X thing in the environment is dangerous, etc.) are decisions made using the wrong information. I'd assert that the answer to this is yes because, for the most part, these studies are trying to get at something where there isn't necessarily a good instrument, or where randomization is impossible. So when it comes down to it, the alternative is "Just guess". These models are, if nothing else, a formalization of our thoughts and a solid attempt at getting close to the answer, and are easier to grapple with. For example, you can ask how serious the bias would have to be in order to qualitatively change your answer (i.e. "Yes, X is bad for you..."), and assess whether or not you think it's reasonable there's an unknown factor of that strength lurking outside your data. For example, the finding that HPV infection is extremely strongly associated with cervical cancer is an important finding, and the strength of an unmeasured factor that would bias that all the way to the null would have to be staggeringly strong. Furthermore, it should be noted that an instrument doesn't fix this - they only work absent some unmeasured associations as well, and even randomized trials suffer from problems (differential dropout between treatment and controls, any behavior change post randomization, generalizability to the actual target population) that also get glossed over a bit. Rothman, Greenland and Lash wrote the latest edition of Modern Epidemiology which is essentially a book devoted to trying to do these in the best way possible.
What can we say about models on observational data in the absence of instruments? So the vast majority of my field (though not the part I work in most) is concerned with just this - the fitting of GLM-type models to observational data. For the most part, instrumental variables are
27,959
What can we say about models on observational data in the absence of instruments?
In contrast to the view from the epidemiologist's side shown by Fomite, instrumental variables are an essential toolkit in economics that is taught fairly early on. The reason for this is that there is a huge focus on trying to answer causal questions in economic research nowadays which goes to an extend where mere correlations are even regarded as uninteresting. The main limitation is that economics is a field were it is inherently difficult to do randomized experiments. If I want to know what is the effect of an early parental death on a child's long run educational outcomes most people would object to doing this via a randomized control trail - and rightly so. This handout from an MIT course outlines on page 3-5 what other issues there are with experiments. To address each point in turn: Depending on the question that is to be answered it is not just omitted variables that may invalidate analyses on observational data without the use of non-experimental methods. Selection problems, measurement error, reverse causality, or simultaneity may be equally important. The main issue is that the data analyst needs to be aware of the limitations of this setting. This refers mainly to the business case because in an academic scenario this would be uncovered quickly. Sometimes I see market analysts who want to estimate a price elasticity to inform a client (e.g. by how much does demand decrease if we increase prices by $x\%$), so they estimate a demand equation and completely forget or ignore the fact that demand and supply are determined simultaneously, and that one affects the other. So the consequences depend much more on the awareness of the researcher/data analyst with respect to the limitations of the data rather than the data itself, but the resulting consequences can range from something trivial to an extend where they negatively affect peoples' lifes. Showing correlations can be useful sometimes, it just really depends on the question. When looking for a causal effect it is also sufficient if you have a natural experiment. The census data in Chile may be observational but if you want to know how the last earthquake affected educational attainment (where earthquakes are arguably exogenous) then also observational data is fine to answer a causal question. It is also possible to a certain degree to assess the endogeneity without instruments (see page 9 in the above handout, 'Estimating the extent of omitted variables bias'). For a binary non-experimental treatment $D_i$ you can compute the effect of this treatment, do the same for the unobservables and ask how large the shift in the unobservables must be in order to explain away the observed treatment effect. If the unobserved shift must be very large then we can be a little more trustful towards our findings. The reference for this is Altonji, Elder and Taber (2000). Probably any applied economist would recommend Angrist and Pischke (2009) "Mostly Harmless Econometrics". Even though this book is mainly intended for graduate students and researchers it is possible to skip the maths parts of it and just get the intuition which is also nicely explained. They first introduce the idea of an experimental setting, then tend to OLS and its limitations with respect to endogeneity from omitted variables, simultaneity, selection, etc. and then extensively discuss instrumental variables with a good share of examples from the applied literature. They also discuss problems with instrumental variables such as weak instruments or using too many of them. Angrist and Krueger (2001) also provide a non-technical overview of instrumental variables and potential pitfalls, and they also have a table that summarizes several studies and their instruments. Probably all of this was a great deal longer than a typical answer here should be but the question is very broad. I just would like to stress the point that instrumental variables (which are often hard to find) are not the only bullet in our pocket. There are other non-experimental methods to uncover causal effects from observational data such as difference-in-differences, regression discontinuity designs, matching, or fixed effects regression (if our confounders are time-invariant). All of these are discussed in Angrist and Pischke (2009) and in the handout linked to in the beginning.
What can we say about models on observational data in the absence of instruments?
In contrast to the view from the epidemiologist's side shown by Fomite, instrumental variables are an essential toolkit in economics that is taught fairly early on. The reason for this is that there i
What can we say about models on observational data in the absence of instruments? In contrast to the view from the epidemiologist's side shown by Fomite, instrumental variables are an essential toolkit in economics that is taught fairly early on. The reason for this is that there is a huge focus on trying to answer causal questions in economic research nowadays which goes to an extend where mere correlations are even regarded as uninteresting. The main limitation is that economics is a field were it is inherently difficult to do randomized experiments. If I want to know what is the effect of an early parental death on a child's long run educational outcomes most people would object to doing this via a randomized control trail - and rightly so. This handout from an MIT course outlines on page 3-5 what other issues there are with experiments. To address each point in turn: Depending on the question that is to be answered it is not just omitted variables that may invalidate analyses on observational data without the use of non-experimental methods. Selection problems, measurement error, reverse causality, or simultaneity may be equally important. The main issue is that the data analyst needs to be aware of the limitations of this setting. This refers mainly to the business case because in an academic scenario this would be uncovered quickly. Sometimes I see market analysts who want to estimate a price elasticity to inform a client (e.g. by how much does demand decrease if we increase prices by $x\%$), so they estimate a demand equation and completely forget or ignore the fact that demand and supply are determined simultaneously, and that one affects the other. So the consequences depend much more on the awareness of the researcher/data analyst with respect to the limitations of the data rather than the data itself, but the resulting consequences can range from something trivial to an extend where they negatively affect peoples' lifes. Showing correlations can be useful sometimes, it just really depends on the question. When looking for a causal effect it is also sufficient if you have a natural experiment. The census data in Chile may be observational but if you want to know how the last earthquake affected educational attainment (where earthquakes are arguably exogenous) then also observational data is fine to answer a causal question. It is also possible to a certain degree to assess the endogeneity without instruments (see page 9 in the above handout, 'Estimating the extent of omitted variables bias'). For a binary non-experimental treatment $D_i$ you can compute the effect of this treatment, do the same for the unobservables and ask how large the shift in the unobservables must be in order to explain away the observed treatment effect. If the unobserved shift must be very large then we can be a little more trustful towards our findings. The reference for this is Altonji, Elder and Taber (2000). Probably any applied economist would recommend Angrist and Pischke (2009) "Mostly Harmless Econometrics". Even though this book is mainly intended for graduate students and researchers it is possible to skip the maths parts of it and just get the intuition which is also nicely explained. They first introduce the idea of an experimental setting, then tend to OLS and its limitations with respect to endogeneity from omitted variables, simultaneity, selection, etc. and then extensively discuss instrumental variables with a good share of examples from the applied literature. They also discuss problems with instrumental variables such as weak instruments or using too many of them. Angrist and Krueger (2001) also provide a non-technical overview of instrumental variables and potential pitfalls, and they also have a table that summarizes several studies and their instruments. Probably all of this was a great deal longer than a typical answer here should be but the question is very broad. I just would like to stress the point that instrumental variables (which are often hard to find) are not the only bullet in our pocket. There are other non-experimental methods to uncover causal effects from observational data such as difference-in-differences, regression discontinuity designs, matching, or fixed effects regression (if our confounders are time-invariant). All of these are discussed in Angrist and Pischke (2009) and in the handout linked to in the beginning.
What can we say about models on observational data in the absence of instruments? In contrast to the view from the epidemiologist's side shown by Fomite, instrumental variables are an essential toolkit in economics that is taught fairly early on. The reason for this is that there i
27,960
How do I interpret a "difference-in-differences" model with continuous treatment?
Yes, it makes sense and in this case the coefficient for the interaction of the post-treatment indicator and the treatment variable gives you the effect on the outcome that results from an increase in the treatment intensity. An example of this is the paper by Acemoglu, Autor and Lyle (2004), where they estimate the effect of World War II on female labor supply in the US. In their model $$y_{ist} = \delta_s + \gamma d_{1950} + X'_{ist}\beta + \varphi \left(d_{1950}\cdot m_s\right) + \epsilon_{ist}$$ $y$ are weeks worked by female $i$, in state $s$, in year $t$. They have two periods, 1940 and 1950 where $d_{1950}$ is a dummy for the latter year, $X$ is a vector of individual characteristics, $\delta_s$ are state dummies, and $m_s$ is the mobilization rate in each state. Their interaction estimates whether states with higher mobilization rates during WWII saw a stronger rise in females' weeks worked from 1940 to 1950. This is given by the coefficient $\varphi$. This is also a difference in differences (DiD) setting with variable treatment intensity since mobilization rates $m_s$ are continuous and differ across states. They get a point estimate of 11.2 for $\varphi$, i.e. a 10 percentage points increase in the mobilization rate increased female labor supply by 1.1 weeks (note that their mobilization rate is between 0 and 100). States with higher treatment intensity therefore saw a bigger increase in female labor market participation as a result of the "treatment".
How do I interpret a "difference-in-differences" model with continuous treatment?
Yes, it makes sense and in this case the coefficient for the interaction of the post-treatment indicator and the treatment variable gives you the effect on the outcome that results from an increase in
How do I interpret a "difference-in-differences" model with continuous treatment? Yes, it makes sense and in this case the coefficient for the interaction of the post-treatment indicator and the treatment variable gives you the effect on the outcome that results from an increase in the treatment intensity. An example of this is the paper by Acemoglu, Autor and Lyle (2004), where they estimate the effect of World War II on female labor supply in the US. In their model $$y_{ist} = \delta_s + \gamma d_{1950} + X'_{ist}\beta + \varphi \left(d_{1950}\cdot m_s\right) + \epsilon_{ist}$$ $y$ are weeks worked by female $i$, in state $s$, in year $t$. They have two periods, 1940 and 1950 where $d_{1950}$ is a dummy for the latter year, $X$ is a vector of individual characteristics, $\delta_s$ are state dummies, and $m_s$ is the mobilization rate in each state. Their interaction estimates whether states with higher mobilization rates during WWII saw a stronger rise in females' weeks worked from 1940 to 1950. This is given by the coefficient $\varphi$. This is also a difference in differences (DiD) setting with variable treatment intensity since mobilization rates $m_s$ are continuous and differ across states. They get a point estimate of 11.2 for $\varphi$, i.e. a 10 percentage points increase in the mobilization rate increased female labor supply by 1.1 weeks (note that their mobilization rate is between 0 and 100). States with higher treatment intensity therefore saw a bigger increase in female labor market participation as a result of the "treatment".
How do I interpret a "difference-in-differences" model with continuous treatment? Yes, it makes sense and in this case the coefficient for the interaction of the post-treatment indicator and the treatment variable gives you the effect on the outcome that results from an increase in
27,961
Closed form for $\mathbb{E}[\ln (1-p)]$, for $p \sim Beta(\alpha, \beta)$
Denote $$ 1-p = q $$ By the symmetry of the beta distribution, $$ q \sim \text{Beta}(\beta, \alpha) $$ Using the identity in your question, we have $$\mathbb{E}[\ln (1-p)]=\mathbb{E}[\ln q]=\psi(\beta)-\psi(\alpha+\beta)$$
Closed form for $\mathbb{E}[\ln (1-p)]$, for $p \sim Beta(\alpha, \beta)$
Denote $$ 1-p = q $$ By the symmetry of the beta distribution, $$ q \sim \text{Beta}(\beta, \alpha) $$ Using the identity in your question, we have $$\mathbb{E}[\ln (1-p)]=\mathbb{E}[\ln q]=\psi(\be
Closed form for $\mathbb{E}[\ln (1-p)]$, for $p \sim Beta(\alpha, \beta)$ Denote $$ 1-p = q $$ By the symmetry of the beta distribution, $$ q \sim \text{Beta}(\beta, \alpha) $$ Using the identity in your question, we have $$\mathbb{E}[\ln (1-p)]=\mathbb{E}[\ln q]=\psi(\beta)-\psi(\alpha+\beta)$$
Closed form for $\mathbb{E}[\ln (1-p)]$, for $p \sim Beta(\alpha, \beta)$ Denote $$ 1-p = q $$ By the symmetry of the beta distribution, $$ q \sim \text{Beta}(\beta, \alpha) $$ Using the identity in your question, we have $$\mathbb{E}[\ln (1-p)]=\mathbb{E}[\ln q]=\psi(\be
27,962
Simulate from a truncated mixture normal distribution
Simulation from a truncated normal is easily done if you have access to a proper normal quantile function. For instance, in R, simulating $$ \mathcal{N}_a^b(\mu,\sigma^2)$$where $a$ and $b$ denote the lower and upper bounds can be done by inverting the cdf $$\dfrac{\Phi(\sigma^{-1}\{x-\mu\})-\Phi(\sigma^{-1}\{a-\mu\})}{\Phi(\sigma^{-1}\{b-\mu\})-\Phi(\sigma^{-1}\{a-\mu\})} $$ e.g., in R x = mu + sigma * qnorm( pnorm(a,mu,sigma) + runif(1)*(pnorm(b,mu,sigma) - pnorm(a,mu,sigma)) ) Otherwise, I developed a truncated normal accept-reject algorithm twenty years ago. If we consider the truncated mixture problem, with density $$ f(x;\theta) \propto \left\{p\varphi(x;\mu_1,\sigma_1)+(1-p)\varphi(x;\mu_2,\sigma_2)\right\}\mathbb{I}_{[a,b]}(x) $$ it is a mixture of truncated normal distributions but with different weights: $$ f(x;\theta) \propto p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}\dfrac{\sigma_1^{-1}\phi(\sigma_1^{-1}\{x-\mu_1\})}{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\})} \\[15pt] +(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\}\dfrac{\sigma_2^{-1}\phi(\sigma_2^{-1}\{x-\mu_2\})}{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_1^{-1}\{a-\mu_2\})} $$ Therefore, to simulate from a truncated normal mixture, it is sufficient to take $$x=\begin{cases} x_1\sim\mathcal{N}_a^b(\mu_1,\sigma_1^2) &\text{with probability }\\ &\qquad p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}\big/\mathfrak{s}\\ x_2\sim\mathcal{N}_a^b(\mu_2,\sigma_2^2) &\text{with probability }\\ &\qquad(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\}\big/\mathfrak{s} \end{cases} $$ where \begin{align} \mathfrak{s}=&p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}+ \\ &(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\} \end{align}
Simulate from a truncated mixture normal distribution
Simulation from a truncated normal is easily done if you have access to a proper normal quantile function. For instance, in R, simulating $$ \mathcal{N}_a^b(\mu,\sigma^2)$$where $a$ and $b$ denote the
Simulate from a truncated mixture normal distribution Simulation from a truncated normal is easily done if you have access to a proper normal quantile function. For instance, in R, simulating $$ \mathcal{N}_a^b(\mu,\sigma^2)$$where $a$ and $b$ denote the lower and upper bounds can be done by inverting the cdf $$\dfrac{\Phi(\sigma^{-1}\{x-\mu\})-\Phi(\sigma^{-1}\{a-\mu\})}{\Phi(\sigma^{-1}\{b-\mu\})-\Phi(\sigma^{-1}\{a-\mu\})} $$ e.g., in R x = mu + sigma * qnorm( pnorm(a,mu,sigma) + runif(1)*(pnorm(b,mu,sigma) - pnorm(a,mu,sigma)) ) Otherwise, I developed a truncated normal accept-reject algorithm twenty years ago. If we consider the truncated mixture problem, with density $$ f(x;\theta) \propto \left\{p\varphi(x;\mu_1,\sigma_1)+(1-p)\varphi(x;\mu_2,\sigma_2)\right\}\mathbb{I}_{[a,b]}(x) $$ it is a mixture of truncated normal distributions but with different weights: $$ f(x;\theta) \propto p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}\dfrac{\sigma_1^{-1}\phi(\sigma_1^{-1}\{x-\mu_1\})}{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\})} \\[15pt] +(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\}\dfrac{\sigma_2^{-1}\phi(\sigma_2^{-1}\{x-\mu_2\})}{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_1^{-1}\{a-\mu_2\})} $$ Therefore, to simulate from a truncated normal mixture, it is sufficient to take $$x=\begin{cases} x_1\sim\mathcal{N}_a^b(\mu_1,\sigma_1^2) &\text{with probability }\\ &\qquad p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}\big/\mathfrak{s}\\ x_2\sim\mathcal{N}_a^b(\mu_2,\sigma_2^2) &\text{with probability }\\ &\qquad(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\}\big/\mathfrak{s} \end{cases} $$ where \begin{align} \mathfrak{s}=&p\left\{\Phi(\sigma_1^{-1}\{b-\mu_1\})-\Phi(\sigma_1^{-1}\{a-\mu_1\}) \right\}+ \\ &(1-p)\left\{\Phi(\sigma_2^{-1}\{b-\mu_2\})-\Phi(\sigma_2^{-1}\{a-\mu_2\}) \right\} \end{align}
Simulate from a truncated mixture normal distribution Simulation from a truncated normal is easily done if you have access to a proper normal quantile function. For instance, in R, simulating $$ \mathcal{N}_a^b(\mu,\sigma^2)$$where $a$ and $b$ denote the
27,963
Develop a statistical test to distinguish two products
For ranking by different judges, one can use the Friedman test. http://en.wikipedia.org/wiki/Friedman_test You may convert ratings from very bad to very good to numerics of -2, -1, 0, 1 and 2. Then put data in long form and apply friedman.test with customer as the blocking factor: > mm customer variable value 1 1 product1 2 2 2 product1 1 3 3 product1 0 4 4 product1 2 5 5 product1 -1 6 6 product1 0 7 7 product1 -1 8 8 product1 2 9 9 product1 1 10 10 product1 1 11 11 product1 0 12 12 product1 2 13 13 product1 1 14 14 product1 2 15 15 product1 2 16 1 product2 -2 17 2 product2 -1 18 3 product2 -1 19 4 product2 0 20 5 product2 2 21 6 product2 1 22 7 product2 0 23 8 product2 -2 24 9 product2 1 25 10 product2 2 26 11 product2 0 27 12 product2 1 28 13 product2 1 29 14 product2 0 30 15 product2 0 > > friedman.test(value~variable|customer, data=mm) Friedman rank sum test data: value and variable and customer Friedman chi-squared = 1.3333, df = 1, p-value = 0.2482 The ranking of the difference between 2 products is not significant. Edit: Following is the output of regression: > summary(lm(value~variable+factor(customer), data=mm)) Call: lm(formula = value ~ variable + factor(customer), data = mm) Residuals: Min 1Q Median 3Q Max -1.9 -0.6 0.0 0.6 1.9 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.000e-01 9.990e-01 0.400 0.695 variableproduct2 -8.000e-01 4.995e-01 -1.602 0.132 factor(customer)2 6.248e-16 1.368e+00 0.000 1.000 factor(customer)3 -5.000e-01 1.368e+00 -0.365 0.720 factor(customer)4 1.000e+00 1.368e+00 0.731 0.477 factor(customer)5 5.000e-01 1.368e+00 0.365 0.720 factor(customer)6 5.000e-01 1.368e+00 0.365 0.720 factor(customer)7 -5.000e-01 1.368e+00 -0.365 0.720 factor(customer)8 9.645e-16 1.368e+00 0.000 1.000 factor(customer)9 1.000e+00 1.368e+00 0.731 0.477 factor(customer)10 1.500e+00 1.368e+00 1.096 0.291 factor(customer)11 7.581e-16 1.368e+00 0.000 1.000 factor(customer)12 1.500e+00 1.368e+00 1.096 0.291 factor(customer)13 1.000e+00 1.368e+00 0.731 0.477 factor(customer)14 1.000e+00 1.368e+00 0.731 0.477 factor(customer)15 1.000e+00 1.368e+00 0.731 0.477 Residual standard error: 1.368 on 14 degrees of freedom Multiple R-squared: 0.3972, Adjusted R-squared: -0.2486 F-statistic: 0.6151 on 15 and 14 DF, p-value: 0.8194
Develop a statistical test to distinguish two products
For ranking by different judges, one can use the Friedman test. http://en.wikipedia.org/wiki/Friedman_test You may convert ratings from very bad to very good to numerics of -2, -1, 0, 1 and 2. Then p
Develop a statistical test to distinguish two products For ranking by different judges, one can use the Friedman test. http://en.wikipedia.org/wiki/Friedman_test You may convert ratings from very bad to very good to numerics of -2, -1, 0, 1 and 2. Then put data in long form and apply friedman.test with customer as the blocking factor: > mm customer variable value 1 1 product1 2 2 2 product1 1 3 3 product1 0 4 4 product1 2 5 5 product1 -1 6 6 product1 0 7 7 product1 -1 8 8 product1 2 9 9 product1 1 10 10 product1 1 11 11 product1 0 12 12 product1 2 13 13 product1 1 14 14 product1 2 15 15 product1 2 16 1 product2 -2 17 2 product2 -1 18 3 product2 -1 19 4 product2 0 20 5 product2 2 21 6 product2 1 22 7 product2 0 23 8 product2 -2 24 9 product2 1 25 10 product2 2 26 11 product2 0 27 12 product2 1 28 13 product2 1 29 14 product2 0 30 15 product2 0 > > friedman.test(value~variable|customer, data=mm) Friedman rank sum test data: value and variable and customer Friedman chi-squared = 1.3333, df = 1, p-value = 0.2482 The ranking of the difference between 2 products is not significant. Edit: Following is the output of regression: > summary(lm(value~variable+factor(customer), data=mm)) Call: lm(formula = value ~ variable + factor(customer), data = mm) Residuals: Min 1Q Median 3Q Max -1.9 -0.6 0.0 0.6 1.9 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.000e-01 9.990e-01 0.400 0.695 variableproduct2 -8.000e-01 4.995e-01 -1.602 0.132 factor(customer)2 6.248e-16 1.368e+00 0.000 1.000 factor(customer)3 -5.000e-01 1.368e+00 -0.365 0.720 factor(customer)4 1.000e+00 1.368e+00 0.731 0.477 factor(customer)5 5.000e-01 1.368e+00 0.365 0.720 factor(customer)6 5.000e-01 1.368e+00 0.365 0.720 factor(customer)7 -5.000e-01 1.368e+00 -0.365 0.720 factor(customer)8 9.645e-16 1.368e+00 0.000 1.000 factor(customer)9 1.000e+00 1.368e+00 0.731 0.477 factor(customer)10 1.500e+00 1.368e+00 1.096 0.291 factor(customer)11 7.581e-16 1.368e+00 0.000 1.000 factor(customer)12 1.500e+00 1.368e+00 1.096 0.291 factor(customer)13 1.000e+00 1.368e+00 0.731 0.477 factor(customer)14 1.000e+00 1.368e+00 0.731 0.477 factor(customer)15 1.000e+00 1.368e+00 0.731 0.477 Residual standard error: 1.368 on 14 degrees of freedom Multiple R-squared: 0.3972, Adjusted R-squared: -0.2486 F-statistic: 0.6151 on 15 and 14 DF, p-value: 0.8194
Develop a statistical test to distinguish two products For ranking by different judges, one can use the Friedman test. http://en.wikipedia.org/wiki/Friedman_test You may convert ratings from very bad to very good to numerics of -2, -1, 0, 1 and 2. Then p
27,964
Develop a statistical test to distinguish two products
One possibility is you could use the sign test. This relies on the comparisons within customers to see whether their rating from product1 to product2 went up, down, or stayed the same (under the binomial sign test the assumption is that you only get "up" or "down" results, but there are several common ways to approach the within-pair ties, such as customer 9's good vs good). One common approach is to exclude the tied ratings like customer 9's (so that the conclusion is about the relative proportion of up-vs-down differences in the population, assuming random sampling of customers). In this case you had 4 customers who gave higher ratings to the second product, 8 who gave lower, and three who gave the same. In that case, with your data, 4 of one sign and 8 of the other, a two-tailed sign test would not come close to rejection at any typical significance level. Here's the analysis in R: > binom.test(4,12) Exact binomial test data: 4 and 12 number of successes = 4, number of trials = 12, p-value = 0.3877 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.09924609 0.65112449 sample estimates: probability of success 0.3333333 The p-value is quite high. Now if you're prepared to assign scores (or even just to rank) to the relative sizes of the changes in ratings within each pair -- that is to say, whether customer 2's "good" to "bad" change is bigger, smaller or the same as customer 4's "very good" to "okay", and so on, then you could apply a signed rank test on those ranks or by doing a paired permutation test on assigned scores (though you must also deal with heavy ties, this can readily be done by permuting the sets of ranks or scores you actually have). There are some other choices you might consider -- but I don't think choice of analysis will change the outcome; I think they'll all fail to reject at typical significance levels on this data.
Develop a statistical test to distinguish two products
One possibility is you could use the sign test. This relies on the comparisons within customers to see whether their rating from product1 to product2 went up, down, or stayed the same (under the binom
Develop a statistical test to distinguish two products One possibility is you could use the sign test. This relies on the comparisons within customers to see whether their rating from product1 to product2 went up, down, or stayed the same (under the binomial sign test the assumption is that you only get "up" or "down" results, but there are several common ways to approach the within-pair ties, such as customer 9's good vs good). One common approach is to exclude the tied ratings like customer 9's (so that the conclusion is about the relative proportion of up-vs-down differences in the population, assuming random sampling of customers). In this case you had 4 customers who gave higher ratings to the second product, 8 who gave lower, and three who gave the same. In that case, with your data, 4 of one sign and 8 of the other, a two-tailed sign test would not come close to rejection at any typical significance level. Here's the analysis in R: > binom.test(4,12) Exact binomial test data: 4 and 12 number of successes = 4, number of trials = 12, p-value = 0.3877 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.09924609 0.65112449 sample estimates: probability of success 0.3333333 The p-value is quite high. Now if you're prepared to assign scores (or even just to rank) to the relative sizes of the changes in ratings within each pair -- that is to say, whether customer 2's "good" to "bad" change is bigger, smaller or the same as customer 4's "very good" to "okay", and so on, then you could apply a signed rank test on those ranks or by doing a paired permutation test on assigned scores (though you must also deal with heavy ties, this can readily be done by permuting the sets of ranks or scores you actually have). There are some other choices you might consider -- but I don't think choice of analysis will change the outcome; I think they'll all fail to reject at typical significance levels on this data.
Develop a statistical test to distinguish two products One possibility is you could use the sign test. This relies on the comparisons within customers to see whether their rating from product1 to product2 went up, down, or stayed the same (under the binom
27,965
Develop a statistical test to distinguish two products
You have dependent ordinal data. You should use the Wilcoxon signed-rank test to test for significant difference between both products across all customers. But given the data above, the Wilcoxon signed-rank test does not yield significant results.
Develop a statistical test to distinguish two products
You have dependent ordinal data. You should use the Wilcoxon signed-rank test to test for significant difference between both products across all customers. But given the data above, the Wilcoxon sign
Develop a statistical test to distinguish two products You have dependent ordinal data. You should use the Wilcoxon signed-rank test to test for significant difference between both products across all customers. But given the data above, the Wilcoxon signed-rank test does not yield significant results.
Develop a statistical test to distinguish two products You have dependent ordinal data. You should use the Wilcoxon signed-rank test to test for significant difference between both products across all customers. But given the data above, the Wilcoxon sign
27,966
Develop a statistical test to distinguish two products
Use the paired t-test As long you have enough ratings (15 is sufficient, and I would be happy even with fewer) and some variation in the rating differences, there is no problem at all using the paired t-test. Then you get estimates that are very easy to interpret – the mean ratings on a 1–5 numeric scale + its difference (between products). R code It’s very easy to do in R: > ratings = c("very bad", "bad", "okay", "good", "very good") > d = data.frame( customer = 1:15, product1 = factor(c(5, 4, 3, 5, 2, 3, 2, 5, 4, 4, 3, 5, 4, 5, 5), levels=1:5, labels=ratings), product2 = factor(c(1, 2, 2, 3, 5, 4, 3, 1, 4, 5, 3, 4, 4, 3, 3), levels=1:5, labels=ratings)) > head(d) customer product1 product2 1 1 very good very bad 2 2 good bad 3 3 okay bad 4 4 very good okay 5 5 bad very good 6 6 okay good First let’s check the average ratings: > mean(as.numeric(d$product1)) [1] 3.9333 > mean(as.numeric(d$product2)) [1] 3.1333 And the t-test gives us: > t.test(as.numeric(d$product1), as.numeric(d$product2), paired=TRUE) Paired t-test data: as.numeric(d$product1) and as.numeric(d$product2) t = 1.6, df = 14, p-value = 0.13 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.27137 1.87137 sample estimates: mean of the differences 0.8 The $p$-value is 0.13, which does not strongly suggest that products are rated differently, despite the apparent difference of 0.8 (but do note the quite confidence interval – we really need more data). Fake data? Curiously, and unexpectedly, an unpaired t-test gives a lower p-value. > t.test(as.numeric(d$product1), as.numeric(d$product2), paired=FALSE) Welch Two Sample t-test data: as.numeric(d$product1) and as.numeric(d$product2) t = 1.86, df = 27.6, p-value = 0.073 […] This does suggest that the example data are fake. For real data, one would expect a (quite high) positive correlation between ratings from the same customer. Here the correlation is negative (though not statistically significantly so): > cor.test(as.numeric(d$product1), as.numeric(d$product2)) Pearson's product-moment correlation data: as.numeric(d$product1) and as.numeric(d$product2) t = -1.38, df = 13, p-value = 0.19 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.73537 0.18897 sample estimates: cor -0.35794 Missing data When not all customers have rated both products (i.e., unbalanced data), a better approach is using a mixed-effects model: Let’s first convert the data to numeric form: > d2 = d > d2[,-1] = lapply(d2[,-1], as.numeric) And convert it to ‘long’ form: > library(tidyr) > d3 = gather(d2, product, value, -customer) And finally fit a mixed-effects model with customer as a random effect: > l = lme(value~product, random=~1|customer, data=d3) > summary(l) Linear mixed-effects model fit by REML Data: d3 AIC BIC logLik 101.91 107.24 -46.957 Random effects: Formula: ~1 | customer (Intercept) Residual StdDev: 3.7259e-05 1.1751 Fixed effects: value ~ product Value Std.Error DF t-value p-value (Intercept) 3.9333 0.30342 14 12.9633 0.0000 productproduct2 -0.8000 0.42910 14 -1.8644 0.0834 […] The $p$-value is 0.0834. Usually for balanced data it will be almost identical to the p-value from a paired t-test. Here it is closer to the p-value of an unpaired t-test, because of the negative correlation. Note that the variance for the customer effect (random intercept) is almost zero. This would rarely happen with real data. Summary In summary, use the paired t-test. Then you get estimates that are easy to interpret (simple numerical averages). If not all customers have rated both products, use a mixed effects model instead. (This will give approximately the same results as the paired t-test when they have all rated both products, so you might as well always use it.)
Develop a statistical test to distinguish two products
Use the paired t-test As long you have enough ratings (15 is sufficient, and I would be happy even with fewer) and some variation in the rating differences, there is no problem at all using the paired
Develop a statistical test to distinguish two products Use the paired t-test As long you have enough ratings (15 is sufficient, and I would be happy even with fewer) and some variation in the rating differences, there is no problem at all using the paired t-test. Then you get estimates that are very easy to interpret – the mean ratings on a 1–5 numeric scale + its difference (between products). R code It’s very easy to do in R: > ratings = c("very bad", "bad", "okay", "good", "very good") > d = data.frame( customer = 1:15, product1 = factor(c(5, 4, 3, 5, 2, 3, 2, 5, 4, 4, 3, 5, 4, 5, 5), levels=1:5, labels=ratings), product2 = factor(c(1, 2, 2, 3, 5, 4, 3, 1, 4, 5, 3, 4, 4, 3, 3), levels=1:5, labels=ratings)) > head(d) customer product1 product2 1 1 very good very bad 2 2 good bad 3 3 okay bad 4 4 very good okay 5 5 bad very good 6 6 okay good First let’s check the average ratings: > mean(as.numeric(d$product1)) [1] 3.9333 > mean(as.numeric(d$product2)) [1] 3.1333 And the t-test gives us: > t.test(as.numeric(d$product1), as.numeric(d$product2), paired=TRUE) Paired t-test data: as.numeric(d$product1) and as.numeric(d$product2) t = 1.6, df = 14, p-value = 0.13 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.27137 1.87137 sample estimates: mean of the differences 0.8 The $p$-value is 0.13, which does not strongly suggest that products are rated differently, despite the apparent difference of 0.8 (but do note the quite confidence interval – we really need more data). Fake data? Curiously, and unexpectedly, an unpaired t-test gives a lower p-value. > t.test(as.numeric(d$product1), as.numeric(d$product2), paired=FALSE) Welch Two Sample t-test data: as.numeric(d$product1) and as.numeric(d$product2) t = 1.86, df = 27.6, p-value = 0.073 […] This does suggest that the example data are fake. For real data, one would expect a (quite high) positive correlation between ratings from the same customer. Here the correlation is negative (though not statistically significantly so): > cor.test(as.numeric(d$product1), as.numeric(d$product2)) Pearson's product-moment correlation data: as.numeric(d$product1) and as.numeric(d$product2) t = -1.38, df = 13, p-value = 0.19 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.73537 0.18897 sample estimates: cor -0.35794 Missing data When not all customers have rated both products (i.e., unbalanced data), a better approach is using a mixed-effects model: Let’s first convert the data to numeric form: > d2 = d > d2[,-1] = lapply(d2[,-1], as.numeric) And convert it to ‘long’ form: > library(tidyr) > d3 = gather(d2, product, value, -customer) And finally fit a mixed-effects model with customer as a random effect: > l = lme(value~product, random=~1|customer, data=d3) > summary(l) Linear mixed-effects model fit by REML Data: d3 AIC BIC logLik 101.91 107.24 -46.957 Random effects: Formula: ~1 | customer (Intercept) Residual StdDev: 3.7259e-05 1.1751 Fixed effects: value ~ product Value Std.Error DF t-value p-value (Intercept) 3.9333 0.30342 14 12.9633 0.0000 productproduct2 -0.8000 0.42910 14 -1.8644 0.0834 […] The $p$-value is 0.0834. Usually for balanced data it will be almost identical to the p-value from a paired t-test. Here it is closer to the p-value of an unpaired t-test, because of the negative correlation. Note that the variance for the customer effect (random intercept) is almost zero. This would rarely happen with real data. Summary In summary, use the paired t-test. Then you get estimates that are easy to interpret (simple numerical averages). If not all customers have rated both products, use a mixed effects model instead. (This will give approximately the same results as the paired t-test when they have all rated both products, so you might as well always use it.)
Develop a statistical test to distinguish two products Use the paired t-test As long you have enough ratings (15 is sufficient, and I would be happy even with fewer) and some variation in the rating differences, there is no problem at all using the paired
27,967
Interpreting ACF and PACF Plot
In R acf starts with lag 0, that is the correlation of a value with itself. pacf starts at lag 1. Just a peculiarity of her R implementation. You can use the Acf function of the package forecast which does not show the lag 0 if that bothers you.
Interpreting ACF and PACF Plot
In R acf starts with lag 0, that is the correlation of a value with itself. pacf starts at lag 1. Just a peculiarity of her R implementation. You can use the Acf function of the package forecast whic
Interpreting ACF and PACF Plot In R acf starts with lag 0, that is the correlation of a value with itself. pacf starts at lag 1. Just a peculiarity of her R implementation. You can use the Acf function of the package forecast which does not show the lag 0 if that bothers you.
Interpreting ACF and PACF Plot In R acf starts with lag 0, that is the correlation of a value with itself. pacf starts at lag 1. Just a peculiarity of her R implementation. You can use the Acf function of the package forecast whic
27,968
Interpreting ACF and PACF Plot
The putative contradiction is based on the different lag-representation for PACF- and ACF- plots in R: ACF starts at lag 0 and PACF starts at lag 1. In principal, PACF and ACF at lag 1 should be equal. The theoretical ACF for a stationary time series $Y_t$ is just the autocorrelation, so $ACF(1)= Corr(Y_t,Y_{t-1})$. The PACF of lag j is the autocorrelation between $Y_t$ and $Y_{t-j}$ with the linear dependence of $Y_{t-1}$ and $Y_{t-j+1}$ removed. Since for PACF(1) there is no intermediary dependence, its value reduces to the simple autocorrelation: $PACF(1)=Corr(Y_t,Y_{t-1})$.
Interpreting ACF and PACF Plot
The putative contradiction is based on the different lag-representation for PACF- and ACF- plots in R: ACF starts at lag 0 and PACF starts at lag 1. In principal, PACF and ACF at lag 1 should be equal
Interpreting ACF and PACF Plot The putative contradiction is based on the different lag-representation for PACF- and ACF- plots in R: ACF starts at lag 0 and PACF starts at lag 1. In principal, PACF and ACF at lag 1 should be equal. The theoretical ACF for a stationary time series $Y_t$ is just the autocorrelation, so $ACF(1)= Corr(Y_t,Y_{t-1})$. The PACF of lag j is the autocorrelation between $Y_t$ and $Y_{t-j}$ with the linear dependence of $Y_{t-1}$ and $Y_{t-j+1}$ removed. Since for PACF(1) there is no intermediary dependence, its value reduces to the simple autocorrelation: $PACF(1)=Corr(Y_t,Y_{t-1})$.
Interpreting ACF and PACF Plot The putative contradiction is based on the different lag-representation for PACF- and ACF- plots in R: ACF starts at lag 0 and PACF starts at lag 1. In principal, PACF and ACF at lag 1 should be equal
27,969
Posterior distribution of proportional difference of two binomial variables
Since you say that you have a large amount of data, it would be "fairly logical" (or at least easy to defend) the use of a diffuse prior, which in this case is as simple as placing a Beta(1,1) which conveniently is the conjugate prior for the binomial likelihood. In general, if we have that $X\sim \text{Bin}(n,\pi)$ then placing a $\text{Beta}(\alpha,\beta)$ prior on $\pi$ yields the following: \begin{align*} p(\pi|X)&=\frac{p(X|\pi)p(\pi)}{\int p(X|\pi)p(\pi)d\pi}\\ \,\\ &\propto p(X|\pi)p(\pi)\\ \,\\ &\propto \prod_{i=1}^N\text{Bin}(n,\pi)\text{Beta}(\alpha,\beta)\\ \,\\ &\propto \prod_{i=1}^N\pi^{X_i}(1-\pi)^{n_i-X_i}\pi^\alpha(1-\pi)^\beta\\ \,\\ &\propto \pi^{\alpha+\sum_{i=1}^NX_i}(1-\pi)^{\beta+\sum_{i=1}^Nn_i-\sum_{i=1}^NX_i} \end{align*} which is proportional to another beta distribution and so the posterior distribution for $\pi$ is $\pi|X\sim\text{Beta}(\alpha+\sum_{i=1}^NX_i, \beta+\sum_{i=1}^Nn_i-\sum_{i=1}^NX_i)$. You can verify these results here: http://en.wikipedia.org/wiki/Conjugate_prior. Now to make the above have an uninformative prior then you lets $\pi\sim\text{Beta}(\alpha=1,\beta=1)$ which is really saying $\pi\sim\text{Uniform}(0,1)$. Now, returning to your question, we have that independently the posterior distributions for $\pi_1$ and $\pi_2$ are $$\pi_1|X_1\sim\text{Beta}\left(1+X_1,\, 1+n_1-X_{1}\right)$$ and $$\pi_2|X_2\sim\text{Beta}\left(1+X_2,\, 1+n_2-X_{2}\right)$$ and so now, $\pi_1-\pi_2|X_1,X_2$ should just be another distribution with updated parameters (I don't know the distributional parameters of the top of my head but I am sure its easy enough to google for difference (or sum) of beta random variables). However, if you don't care about a closed form solution you can sample from the posterior distribution of $\pi_1$ and $\pi_2$ independently and then literally subtract the posterior sample from each other to obtain posterior samples of $\pi_1-\pi_2$. Algorithmically, what I mean by this is the following: Step 1) Sample $\pi_1^*$ from $\pi_1|X_1$ Step 2) Sample $ \pi_2^*$ from $\pi_2|X_2$ Step 3) Obtain posterior samples of $\pi_1-\pi_2$ by calculating $ \pi_1^*- \pi_2^*$ Not sure if this is helpful or not but here is some R code validating what I am proposing to you. The code is the following: #Both pi's are approximately 2% and their difference is 0.1% pi1 = .02 pi2 = .019 #Sample sizes of 1000 n1 = 1000 n2 = 1000 #X1 and X2 equal to their pi*n x1 = pi1*n1 x2 = pi2*n2 #Sampling 10,000 random variables from the posterior distributions of pi1 and pi2 post1 = rbeta(10000,1+x1,1+n1-x1) post2 = rbeta(10000,1+x2,1+n2-x2) #Calulating posterior samples from pi1 - pi2 posterior = post1 - post2 Now we know that the true difference between $\pi_1-\pi_2=0.02-0.019=.001$ (in my computer code example) so now taking the mean (average) of the posterior samples I obtain for $\pi_1-\pi_2|X_1,X_2$ we obtain > mean(posterior) [1] 0.001002589 which is extremely close to the 0.1% that we expected to see.
Posterior distribution of proportional difference of two binomial variables
Since you say that you have a large amount of data, it would be "fairly logical" (or at least easy to defend) the use of a diffuse prior, which in this case is as simple as placing a Beta(1,1) which c
Posterior distribution of proportional difference of two binomial variables Since you say that you have a large amount of data, it would be "fairly logical" (or at least easy to defend) the use of a diffuse prior, which in this case is as simple as placing a Beta(1,1) which conveniently is the conjugate prior for the binomial likelihood. In general, if we have that $X\sim \text{Bin}(n,\pi)$ then placing a $\text{Beta}(\alpha,\beta)$ prior on $\pi$ yields the following: \begin{align*} p(\pi|X)&=\frac{p(X|\pi)p(\pi)}{\int p(X|\pi)p(\pi)d\pi}\\ \,\\ &\propto p(X|\pi)p(\pi)\\ \,\\ &\propto \prod_{i=1}^N\text{Bin}(n,\pi)\text{Beta}(\alpha,\beta)\\ \,\\ &\propto \prod_{i=1}^N\pi^{X_i}(1-\pi)^{n_i-X_i}\pi^\alpha(1-\pi)^\beta\\ \,\\ &\propto \pi^{\alpha+\sum_{i=1}^NX_i}(1-\pi)^{\beta+\sum_{i=1}^Nn_i-\sum_{i=1}^NX_i} \end{align*} which is proportional to another beta distribution and so the posterior distribution for $\pi$ is $\pi|X\sim\text{Beta}(\alpha+\sum_{i=1}^NX_i, \beta+\sum_{i=1}^Nn_i-\sum_{i=1}^NX_i)$. You can verify these results here: http://en.wikipedia.org/wiki/Conjugate_prior. Now to make the above have an uninformative prior then you lets $\pi\sim\text{Beta}(\alpha=1,\beta=1)$ which is really saying $\pi\sim\text{Uniform}(0,1)$. Now, returning to your question, we have that independently the posterior distributions for $\pi_1$ and $\pi_2$ are $$\pi_1|X_1\sim\text{Beta}\left(1+X_1,\, 1+n_1-X_{1}\right)$$ and $$\pi_2|X_2\sim\text{Beta}\left(1+X_2,\, 1+n_2-X_{2}\right)$$ and so now, $\pi_1-\pi_2|X_1,X_2$ should just be another distribution with updated parameters (I don't know the distributional parameters of the top of my head but I am sure its easy enough to google for difference (or sum) of beta random variables). However, if you don't care about a closed form solution you can sample from the posterior distribution of $\pi_1$ and $\pi_2$ independently and then literally subtract the posterior sample from each other to obtain posterior samples of $\pi_1-\pi_2$. Algorithmically, what I mean by this is the following: Step 1) Sample $\pi_1^*$ from $\pi_1|X_1$ Step 2) Sample $ \pi_2^*$ from $\pi_2|X_2$ Step 3) Obtain posterior samples of $\pi_1-\pi_2$ by calculating $ \pi_1^*- \pi_2^*$ Not sure if this is helpful or not but here is some R code validating what I am proposing to you. The code is the following: #Both pi's are approximately 2% and their difference is 0.1% pi1 = .02 pi2 = .019 #Sample sizes of 1000 n1 = 1000 n2 = 1000 #X1 and X2 equal to their pi*n x1 = pi1*n1 x2 = pi2*n2 #Sampling 10,000 random variables from the posterior distributions of pi1 and pi2 post1 = rbeta(10000,1+x1,1+n1-x1) post2 = rbeta(10000,1+x2,1+n2-x2) #Calulating posterior samples from pi1 - pi2 posterior = post1 - post2 Now we know that the true difference between $\pi_1-\pi_2=0.02-0.019=.001$ (in my computer code example) so now taking the mean (average) of the posterior samples I obtain for $\pi_1-\pi_2|X_1,X_2$ we obtain > mean(posterior) [1] 0.001002589 which is extremely close to the 0.1% that we expected to see.
Posterior distribution of proportional difference of two binomial variables Since you say that you have a large amount of data, it would be "fairly logical" (or at least easy to defend) the use of a diffuse prior, which in this case is as simple as placing a Beta(1,1) which c
27,970
Posterior distribution of proportional difference of two binomial variables
Dan suggested using simulation, which is fine, and another alternative would be to do the convolution itself (one can find results for sums of beta random variables in various places, from which the present result can be obtained); alternatively it can be done numerically fairly easily. Dan asked me to post about the normal approximation I suggested in comments, so I will expand on that possibility here. The process follows his derivation out to the posteriors for the individual $\pi$'s. At that point we notice that (for say a uniform prior or a Jeffreys prior or some similar conjugate prior) we have a pair of $\text{beta}(a_i,b_i)$ with $a$'s near 20 and $b$'s near 1000. They look somewhat like a normal, though very mildly skew, something like this: The distribution of the difference of two such, where $a_1$ is close to $a_2$ will be much more symmetric and the tails will be much nicer. So a normal approximation is probably going to work well. Simulation confirms this. Here's a histogram of a large sample from the difference between a beta(20,1000) and a beta(19,1000): and a Q-Q plot: (those two displays are from different samples, not that you can tell) Given the posteriors for the $\pi$'s, we have the posterior mean and variance for them immediately (See here, which gives them anyway). From there we just use independence, plus elementary properties of mean and variance to get the mean and variance of the difference (the mean is the difference of means, the variance is the sum of the variances). Once we have the mean and variance of the posterior of the difference in proportion, we simply take the posterior distribution to be a normal with that same mean and variance and then use that approximation to do whatever calculations are required. If the samples had been smaller, or the proportions were smaller/more different, I'd be inclined to suggest considering a scaled-shifted-beta approximation (matching the first 4 moments, say), though if we go to that effort, convolution might be as easy.
Posterior distribution of proportional difference of two binomial variables
Dan suggested using simulation, which is fine, and another alternative would be to do the convolution itself (one can find results for sums of beta random variables in various places, from which the p
Posterior distribution of proportional difference of two binomial variables Dan suggested using simulation, which is fine, and another alternative would be to do the convolution itself (one can find results for sums of beta random variables in various places, from which the present result can be obtained); alternatively it can be done numerically fairly easily. Dan asked me to post about the normal approximation I suggested in comments, so I will expand on that possibility here. The process follows his derivation out to the posteriors for the individual $\pi$'s. At that point we notice that (for say a uniform prior or a Jeffreys prior or some similar conjugate prior) we have a pair of $\text{beta}(a_i,b_i)$ with $a$'s near 20 and $b$'s near 1000. They look somewhat like a normal, though very mildly skew, something like this: The distribution of the difference of two such, where $a_1$ is close to $a_2$ will be much more symmetric and the tails will be much nicer. So a normal approximation is probably going to work well. Simulation confirms this. Here's a histogram of a large sample from the difference between a beta(20,1000) and a beta(19,1000): and a Q-Q plot: (those two displays are from different samples, not that you can tell) Given the posteriors for the $\pi$'s, we have the posterior mean and variance for them immediately (See here, which gives them anyway). From there we just use independence, plus elementary properties of mean and variance to get the mean and variance of the difference (the mean is the difference of means, the variance is the sum of the variances). Once we have the mean and variance of the posterior of the difference in proportion, we simply take the posterior distribution to be a normal with that same mean and variance and then use that approximation to do whatever calculations are required. If the samples had been smaller, or the proportions were smaller/more different, I'd be inclined to suggest considering a scaled-shifted-beta approximation (matching the first 4 moments, say), though if we go to that effort, convolution might be as easy.
Posterior distribution of proportional difference of two binomial variables Dan suggested using simulation, which is fine, and another alternative would be to do the convolution itself (one can find results for sums of beta random variables in various places, from which the p
27,971
Why is the Pearson correlation 1 when only two data values are available?
Correlation, meaning Pearson correlation, can be thought of as a numerical answer to the question: Is there a linear relationship between two variables? If you have two distinct data points, the only possible correlation result is $+1$ or $-1$, because two such points define a perfect linear relationship. This matches the observation that a straight line can be found to interpolate two distinct points exactly. The only choice is between a rising and a falling straight line, which give $+1$ or $-1$ respectively. (If your two points are identical on either of the two variables, the correlation is indeterminate.) In scientific terms, a correlation involving just two points is useless by itself.
Why is the Pearson correlation 1 when only two data values are available?
Correlation, meaning Pearson correlation, can be thought of as a numerical answer to the question: Is there a linear relationship between two variables? If you have two distinct data points, the only
Why is the Pearson correlation 1 when only two data values are available? Correlation, meaning Pearson correlation, can be thought of as a numerical answer to the question: Is there a linear relationship between two variables? If you have two distinct data points, the only possible correlation result is $+1$ or $-1$, because two such points define a perfect linear relationship. This matches the observation that a straight line can be found to interpolate two distinct points exactly. The only choice is between a rising and a falling straight line, which give $+1$ or $-1$ respectively. (If your two points are identical on either of the two variables, the correlation is indeterminate.) In scientific terms, a correlation involving just two points is useless by itself.
Why is the Pearson correlation 1 when only two data values are available? Correlation, meaning Pearson correlation, can be thought of as a numerical answer to the question: Is there a linear relationship between two variables? If you have two distinct data points, the only
27,972
Why is the Pearson correlation 1 when only two data values are available?
Besides Nick's intuitive and graphical explanation, I believe it is valid to also point out a mathematical one. Consider two variables with two positive observations each: $X = \{x_1, x_2\}$ $Y = \{y_1, y_2\}$ Now let's calculate the standard deviation of $X$: $S_X = \sqrt{\frac{\sum{X^2} - n\bar{X}^2}{n - 1}} = \sqrt{\frac{x_1^2 + x_2^2 - 2\frac{(x_1 + x_2)^2}{2^2}}{2 - 1}} = \sqrt{x_1^2 + x_2^2 - \frac{1}{2}(x^2 + 2x_1x_2 + x^2)} = \sqrt{\frac{1}{2}(2x_1^2 + 2x_2^2 - x_1 - 2x_1x_2 - x_2)} = \sqrt{\frac{1}{2}(x_1^2 + x_2^2 - 2x_1x_2)} = \sqrt{\frac{1}{2}(x_1 - x_2)^2} = \frac{1}{\sqrt{2}}(x_1 - x_2)$ That means the standard deviation of $Y$ is equal to $\frac{1}{\sqrt{2}}(y_1 - y_2)$. Now let's calculate the covariance of $X$ and $Y$: $S_{XY} = \frac{\sum{XY} - n\bar{X}\bar{Y}}{n - 1} = \frac{x_1y_1 + x_2y_2 - 2\frac{(x_1+x_2)}{2}\frac{(y_1+y_2)}{2}}{2 - 1} = x_1y_1 + x_2y_2 - \frac{1}{2}(x_1+x_2)(y_1+y_2) = \frac{1}{2}(2x_1y_1 + 2x_2y_2 - x_1y_1 - x_1y_2 - x_2y_1 - x_2y_2) = \frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1) = \frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)$ The correlation between $X$ and $Y$, $R_{XY}$, is defined as follows: $R_{XY} = \frac{S_{XY}}{S_XS_Y} = \frac{\frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{\frac{1}{\sqrt{2}}(x_1 - x_2)\frac{1}{\sqrt{2}}(y_1 - y_2)} = \frac{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{(x_1 - x_2)(y_1 - y_2)} = \frac{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)} = 1$ If you define some of those values as negative so that the covariance would yield some negative products, the correlation would be -1. Compare, for instance, the following results in R: > cor(c(1, 2), c(3, 4)) [1] 1 > cor(c(1, 2), c(-3, -4)) [1] -1 > cor(c(1, 2), c(-3, 4)) [1] 1 > cor(c(1, -2), c(-3, 4)) [1] -1 > cor(c(-1, -2), c(-3, -4)) [1] 1
Why is the Pearson correlation 1 when only two data values are available?
Besides Nick's intuitive and graphical explanation, I believe it is valid to also point out a mathematical one. Consider two variables with two positive observations each: $X = \{x_1, x_2\}$ $Y = \{y_
Why is the Pearson correlation 1 when only two data values are available? Besides Nick's intuitive and graphical explanation, I believe it is valid to also point out a mathematical one. Consider two variables with two positive observations each: $X = \{x_1, x_2\}$ $Y = \{y_1, y_2\}$ Now let's calculate the standard deviation of $X$: $S_X = \sqrt{\frac{\sum{X^2} - n\bar{X}^2}{n - 1}} = \sqrt{\frac{x_1^2 + x_2^2 - 2\frac{(x_1 + x_2)^2}{2^2}}{2 - 1}} = \sqrt{x_1^2 + x_2^2 - \frac{1}{2}(x^2 + 2x_1x_2 + x^2)} = \sqrt{\frac{1}{2}(2x_1^2 + 2x_2^2 - x_1 - 2x_1x_2 - x_2)} = \sqrt{\frac{1}{2}(x_1^2 + x_2^2 - 2x_1x_2)} = \sqrt{\frac{1}{2}(x_1 - x_2)^2} = \frac{1}{\sqrt{2}}(x_1 - x_2)$ That means the standard deviation of $Y$ is equal to $\frac{1}{\sqrt{2}}(y_1 - y_2)$. Now let's calculate the covariance of $X$ and $Y$: $S_{XY} = \frac{\sum{XY} - n\bar{X}\bar{Y}}{n - 1} = \frac{x_1y_1 + x_2y_2 - 2\frac{(x_1+x_2)}{2}\frac{(y_1+y_2)}{2}}{2 - 1} = x_1y_1 + x_2y_2 - \frac{1}{2}(x_1+x_2)(y_1+y_2) = \frac{1}{2}(2x_1y_1 + 2x_2y_2 - x_1y_1 - x_1y_2 - x_2y_1 - x_2y_2) = \frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1) = \frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)$ The correlation between $X$ and $Y$, $R_{XY}$, is defined as follows: $R_{XY} = \frac{S_{XY}}{S_XS_Y} = \frac{\frac{1}{2}(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{\frac{1}{\sqrt{2}}(x_1 - x_2)\frac{1}{\sqrt{2}}(y_1 - y_2)} = \frac{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{(x_1 - x_2)(y_1 - y_2)} = \frac{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)}{(x_1y_1 + x_2y_2 - x_1y_2 - x_2y_1)} = 1$ If you define some of those values as negative so that the covariance would yield some negative products, the correlation would be -1. Compare, for instance, the following results in R: > cor(c(1, 2), c(3, 4)) [1] 1 > cor(c(1, 2), c(-3, -4)) [1] -1 > cor(c(1, 2), c(-3, 4)) [1] 1 > cor(c(1, -2), c(-3, 4)) [1] -1 > cor(c(-1, -2), c(-3, -4)) [1] 1
Why is the Pearson correlation 1 when only two data values are available? Besides Nick's intuitive and graphical explanation, I believe it is valid to also point out a mathematical one. Consider two variables with two positive observations each: $X = \{x_1, x_2\}$ $Y = \{y_
27,973
Why do we build the Laplacian graph in Spectral Clustering?
The set of eigenvalues of a adjacency matrix is the spectrum of the corresponding graph. The spectrum is a very important factor in the study of similarity between two graphs. If two graphs are similar, then the adjacency matrix of one can be viewed as a permutation operator implemented on the other, thus their eigenvalues are the same (note that two matrices have the same eigenvalues does not necessarily lead to the two graphs are similar). So if we map each graph node to a value by assigning a function $f$ to them, the eigenvectors of the adjacency matrix $A$ can be a good option (this is also why eigenvectors are calculated in spectral clustering procedures). And it can also be written in a matrix form $$\mathbf{f}^T \mathbf{A} \mathbf{f} = \sum_{e_{ij}} f(i) f(j)$$ If we consider the incidence matrix altogether, such graph mapping will be $f\rightarrow\nabla f$: $$(\nabla \mathbf{f})(e_{ij}) = f(v_j)-f(v_i)$$ this maps on the edges, and $L = D - A$, is just $\nabla ^T \nabla$, will map on the graph by mapping each node again: $$(\mathbf{L}\mathbf{f})(v_i) = \sum_{v_j\sim v_i} w_{ij}\big(f(v_i)-f(v_j)\big)$$
Why do we build the Laplacian graph in Spectral Clustering?
The set of eigenvalues of a adjacency matrix is the spectrum of the corresponding graph. The spectrum is a very important factor in the study of similarity between two graphs. If two graphs are simila
Why do we build the Laplacian graph in Spectral Clustering? The set of eigenvalues of a adjacency matrix is the spectrum of the corresponding graph. The spectrum is a very important factor in the study of similarity between two graphs. If two graphs are similar, then the adjacency matrix of one can be viewed as a permutation operator implemented on the other, thus their eigenvalues are the same (note that two matrices have the same eigenvalues does not necessarily lead to the two graphs are similar). So if we map each graph node to a value by assigning a function $f$ to them, the eigenvectors of the adjacency matrix $A$ can be a good option (this is also why eigenvectors are calculated in spectral clustering procedures). And it can also be written in a matrix form $$\mathbf{f}^T \mathbf{A} \mathbf{f} = \sum_{e_{ij}} f(i) f(j)$$ If we consider the incidence matrix altogether, such graph mapping will be $f\rightarrow\nabla f$: $$(\nabla \mathbf{f})(e_{ij}) = f(v_j)-f(v_i)$$ this maps on the edges, and $L = D - A$, is just $\nabla ^T \nabla$, will map on the graph by mapping each node again: $$(\mathbf{L}\mathbf{f})(v_i) = \sum_{v_j\sim v_i} w_{ij}\big(f(v_i)-f(v_j)\big)$$
Why do we build the Laplacian graph in Spectral Clustering? The set of eigenvalues of a adjacency matrix is the spectrum of the corresponding graph. The spectrum is a very important factor in the study of similarity between two graphs. If two graphs are simila
27,974
Why do we build the Laplacian graph in Spectral Clustering?
I will try to to give a more accessible (complementary) answer. Spectral clustering has two steps. First you determine neighborhood edges between your feature vectors (telling you whether two such vectors are similar or not), yielding a graph. Then you take this graph and you "embed" it, or "rearrange it" in a Euclidean space of d dimensions. Each dimension of this embedding is trying to give a solution to an optimization problem. Informally, this optimization problem is to minimize the number of neighboring graph nodes that appear on opposite sides of 0 (subject to a space filling constraint). Thus each node tends to end up next to its neighbors (as determined by the graph structure), which can be a friendlier space for K-means to work in. If you carry the math through, it turns out that the eigenvectors of the Laplace L give a solution to a "relaxed" version of this optimization problem - that's it.
Why do we build the Laplacian graph in Spectral Clustering?
I will try to to give a more accessible (complementary) answer. Spectral clustering has two steps. First you determine neighborhood edges between your feature vectors (telling you whether two such ve
Why do we build the Laplacian graph in Spectral Clustering? I will try to to give a more accessible (complementary) answer. Spectral clustering has two steps. First you determine neighborhood edges between your feature vectors (telling you whether two such vectors are similar or not), yielding a graph. Then you take this graph and you "embed" it, or "rearrange it" in a Euclidean space of d dimensions. Each dimension of this embedding is trying to give a solution to an optimization problem. Informally, this optimization problem is to minimize the number of neighboring graph nodes that appear on opposite sides of 0 (subject to a space filling constraint). Thus each node tends to end up next to its neighbors (as determined by the graph structure), which can be a friendlier space for K-means to work in. If you carry the math through, it turns out that the eigenvectors of the Laplace L give a solution to a "relaxed" version of this optimization problem - that's it.
Why do we build the Laplacian graph in Spectral Clustering? I will try to to give a more accessible (complementary) answer. Spectral clustering has two steps. First you determine neighborhood edges between your feature vectors (telling you whether two such ve
27,975
Appropriate measure to find smallest covariance matrix
The ordering of matrices you refer to is known as the Loewner order and is a partial order much used in the study of positive definite matrices. A book-length treatment of the geometry on the manifold of positive-definite (posdef) matrices is here. I will first try to address your question about intuitions. A (symmetric) matrix $A$ is posdef if $c^T A c\ge 0$ for all $c \in \mathbb{R}^n$. If $X$ is a random variable (rv) with covariance matrix $A$, then $c^T X$ is (proportional to) its projection on some one-dim subspace, and $\mathbb{Var}(c^T X) = c^T A c$. Applying this to $A-B$ in your Q, first: it is a covariance matrix, second: A random variable with covar matrix $B$ projects in all directions with smaller variance than a rv with covariance matrix $A$. This makes it intuitively clear that this ordering can only be a partial one, there are many rv's which will project in different directions with wildly different variances. Your proposal of some Euclidean norm do not have such a natural statistical interpretation. Your "confusing example" is confusing because both matrices have determinant zero. So for each one, there is one direction (the eigenvector with eigenvalue zero) where they always projects to zero. But this direction is different for the two matrices, therefore they cannot be compared. The Loewner order is defined such that $A \preceq B$, $B$ is more positive definite than $A$, if $B-A$ is posdef. This is a partial order, for some posdef matrices neither $B-A$ nor $A-B$ is posdef. An example is: $$ A=\begin{pmatrix} 1 & 0.5 \\ 0.5 & 1 \end{pmatrix}, \quad B= \begin{pmatrix} 0.5 & 0\\ 0 & 1.5 \end{pmatrix} $$ One way of showing this graphically is drawing a plot with two ellipses, but centered at the origin, associated in a standard way with the matrices (then the radial distance in each direction is proportional to the variance of projecting in that direction): In these case the two ellipses are congruent, but rotated differently (in fact the angle is 45 degrees). This corresponds to the fact that the matrices $A$ and $B$ have the same eigenvalues, but the eigenvectors are rotated. As this answer depends much on properties of ellipses, the following What is the intuition behind conditional Gaussian distributions? explaining ellipses geometrically, can be helpful. Now I will explain how the ellipses associated to the matrices are defined. A posdef matrix $A$ defines a quadratic form $Q_A(c) = c^T A c$. This can be plotted as a function, the graph will be a quadratic. If $A \preceq B$ then the graph of $Q_B$ will always be above the graph of $Q_A$. If we cut the graphs with a horizontal plane at height 1, then the cuts will describe ellipses (that is in fact a way of defining ellipses). This cut ellipses are the given by the equations $$ Q_A(c)=1, \quad Q_B(c)=1$$ and we see that $A \preceq B$ corresponds to the ellipse of B (now with interior) is contained within the ellipse of A. If there is no order, there will be no containment. We observe that the inclusion order is opposite to the Loewner partial order, if we dislike that we can draw ellipses of the inverses. This because $A \preceq B$ is equivalent to $B^{-1} \preceq A^{-1}$. But I will stay with the ellipses as defined here. An ellipse can be describes with the semiaxes and their length. We will only discuss $2\times 2$-matrices here, as they are the ones we can draw ... So we need the two principal axes and their length. This can be found, as explained here with an eigendecomposition of the posdef matrix. Then the principal axes are given by the eigenvectors, and their length $a,b$ can be calculated from the eigenvalues $\lambda_1, \lambda_2$ by $$ a = \sqrt{1/\lambda_1}, \quad b=\sqrt{1/\lambda_2}. $$ We can also see that the area of the ellipse representing $A$ is $\pi a b= \pi \sqrt{1/\lambda_1}\sqrt{1/\lambda_2} = \frac{\pi}{\sqrt{\det A}}$. I will give one final example where the matrices can be ordered: The two matrices in this case were: $$A =\begin{pmatrix}2/3 & 1/5 \\ 1/5 & 3/4\end{pmatrix}, \quad B=\begin{pmatrix} 1& 1/7 \\ 1/7& 1 \end{pmatrix} $$
Appropriate measure to find smallest covariance matrix
The ordering of matrices you refer to is known as the Loewner order and is a partial order much used in the study of positive definite matrices. A book-length treatment of the geometry on the manifold
Appropriate measure to find smallest covariance matrix The ordering of matrices you refer to is known as the Loewner order and is a partial order much used in the study of positive definite matrices. A book-length treatment of the geometry on the manifold of positive-definite (posdef) matrices is here. I will first try to address your question about intuitions. A (symmetric) matrix $A$ is posdef if $c^T A c\ge 0$ for all $c \in \mathbb{R}^n$. If $X$ is a random variable (rv) with covariance matrix $A$, then $c^T X$ is (proportional to) its projection on some one-dim subspace, and $\mathbb{Var}(c^T X) = c^T A c$. Applying this to $A-B$ in your Q, first: it is a covariance matrix, second: A random variable with covar matrix $B$ projects in all directions with smaller variance than a rv with covariance matrix $A$. This makes it intuitively clear that this ordering can only be a partial one, there are many rv's which will project in different directions with wildly different variances. Your proposal of some Euclidean norm do not have such a natural statistical interpretation. Your "confusing example" is confusing because both matrices have determinant zero. So for each one, there is one direction (the eigenvector with eigenvalue zero) where they always projects to zero. But this direction is different for the two matrices, therefore they cannot be compared. The Loewner order is defined such that $A \preceq B$, $B$ is more positive definite than $A$, if $B-A$ is posdef. This is a partial order, for some posdef matrices neither $B-A$ nor $A-B$ is posdef. An example is: $$ A=\begin{pmatrix} 1 & 0.5 \\ 0.5 & 1 \end{pmatrix}, \quad B= \begin{pmatrix} 0.5 & 0\\ 0 & 1.5 \end{pmatrix} $$ One way of showing this graphically is drawing a plot with two ellipses, but centered at the origin, associated in a standard way with the matrices (then the radial distance in each direction is proportional to the variance of projecting in that direction): In these case the two ellipses are congruent, but rotated differently (in fact the angle is 45 degrees). This corresponds to the fact that the matrices $A$ and $B$ have the same eigenvalues, but the eigenvectors are rotated. As this answer depends much on properties of ellipses, the following What is the intuition behind conditional Gaussian distributions? explaining ellipses geometrically, can be helpful. Now I will explain how the ellipses associated to the matrices are defined. A posdef matrix $A$ defines a quadratic form $Q_A(c) = c^T A c$. This can be plotted as a function, the graph will be a quadratic. If $A \preceq B$ then the graph of $Q_B$ will always be above the graph of $Q_A$. If we cut the graphs with a horizontal plane at height 1, then the cuts will describe ellipses (that is in fact a way of defining ellipses). This cut ellipses are the given by the equations $$ Q_A(c)=1, \quad Q_B(c)=1$$ and we see that $A \preceq B$ corresponds to the ellipse of B (now with interior) is contained within the ellipse of A. If there is no order, there will be no containment. We observe that the inclusion order is opposite to the Loewner partial order, if we dislike that we can draw ellipses of the inverses. This because $A \preceq B$ is equivalent to $B^{-1} \preceq A^{-1}$. But I will stay with the ellipses as defined here. An ellipse can be describes with the semiaxes and their length. We will only discuss $2\times 2$-matrices here, as they are the ones we can draw ... So we need the two principal axes and their length. This can be found, as explained here with an eigendecomposition of the posdef matrix. Then the principal axes are given by the eigenvectors, and their length $a,b$ can be calculated from the eigenvalues $\lambda_1, \lambda_2$ by $$ a = \sqrt{1/\lambda_1}, \quad b=\sqrt{1/\lambda_2}. $$ We can also see that the area of the ellipse representing $A$ is $\pi a b= \pi \sqrt{1/\lambda_1}\sqrt{1/\lambda_2} = \frac{\pi}{\sqrt{\det A}}$. I will give one final example where the matrices can be ordered: The two matrices in this case were: $$A =\begin{pmatrix}2/3 & 1/5 \\ 1/5 & 3/4\end{pmatrix}, \quad B=\begin{pmatrix} 1& 1/7 \\ 1/7& 1 \end{pmatrix} $$
Appropriate measure to find smallest covariance matrix The ordering of matrices you refer to is known as the Loewner order and is a partial order much used in the study of positive definite matrices. A book-length treatment of the geometry on the manifold
27,976
Appropriate measure to find smallest covariance matrix
@kjetil b halvorsen gives a nice discussion of the geometric intuition behind positive semi-definiteness as a partial ordering. I'll give a more grubby-handed take on that same intuition. One which proceeds from what sorts of calculations you might like to do with your variance matrixes. Suppose you have two random variables $x$ and $y$. If they are scalars, then we can calculate their variances as scalars, and compare them in the obvious way using the scalar real numbers $V(x)$ and $V(y)$. So if $V(x)=5$ and $V(y)=15$, we say that the random variable $x$ has a smaller variance than does $y$. On the other hand, if $x$ and $y$ are vector-valued random variables (let's say they are two-vectors), how we compare their variances is not so obvious. Say their variances are: \begin{align} V(x) = \left[ \begin{array}{c c} 1 & 0.5 \\ 0.5 & 1 \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} 8 & 3 \\ 3 & 6 \end{array} \right] \end{align} How do we compare the variances of these two random vectors? One thing we could do is just compare the variances of their respective elements. So, we can say that the variance of $x_1$ is smaller than the variance of $y_1$ by just comparing real numbers, like: $V(x_1)=1<8=V(y_1)$ and $V(x_2)=1<6=V(y_2)$. So, maybe we could say that the variance of $x$ is $\le$ the variance of $y$ if the variance of each element of $x$ is $\le$ the variance of the corresponding element of $y$. This would be like saying $V(x) \le V(y)$ if each of the diagonal elements of $V(x)$ is $\le$ the corresponding diagonal element of $V(y)$. This definition seems reasonable at first blush. Furthermore, as long as the variance matrixes we are considering are diagonal (i.e. all covariances are 0), it is the same as using semi-definiteness. That is, if the variances look like \begin{align} V(x) = \left[ \begin{array}{c c} V(x_1) & 0 \\ 0 & V(x_2) \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} V(y_1) & 0 \\ 0 & V(y_2) \end{array} \right] \end{align} then saying $V(y)-V(x)$ is positive-semi-definite (i.e. that $V(x) \le V(y)$) is just the same as saying $V(x_1) \le V(y_1)$ and $V(x_2) \le V(y_2)$. All seems good until we introduce covariances. Consider this example: \begin{align} V(x) = \left[ \begin{array}{c c} 1 & 0.1 \\ 0.1 & 1 \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} 1 & 0 \\ 0 & 1 \end{array} \right] \end{align} Now, using a comparison which only considers the diagonals, we would say $V(x) \le V(y)$, and, indeed, it's still true that element-by-element $V(x_k) \le V(y_k)$. What might start to bother us about this is that if we calculate some weighted sum of the elements of the vectors, like $3x_1 + 2x_2$ and $3y_1 + 2y_2$, then we run into the fact that $V(3x_1 + 2x_2) \gt V(3y_1 + 2y_2)$ even though we are saying $V(x) \le V(y)$. This is weird, right? When $x$ and $y$ are scalars, then $V(x) \le V(y)$ guarantees that for any fixed, non-random $a$, $V(ax) \le V(ay)$. If, for whatever reason, we are interested in linear combinations of the elements of the random variables like this, then we might want to strengthen our definition of $\le$ for variance matrixes. Maybe we want to say $V(x) \le V(y)$ if and only if it is true that $V(a_1x_1 + a_2x_2) \le V(a_1y_1 + a_2y_2)$, no matter what fixed numbers $a_1$ and $a_2$ we pick. Notice, this is a stronger definition than the diagonals-only definition since if we pick $a_1=1,a_2=0$ it says $V(x_1) \le V(y_1)$, and if we pick $a_1=0,a_2=1$ it says $V(x_2) \le V(y_2)$. This second definition, the one which says $V(x) \le V(y)$ if and only if $V(a'x) \le V(a'y)$ for every possible fixed vector $a$, is the usual method of comparing variance matrixes based on positive semi-definiteness: \begin{align} V(a'y) - V(a'x) = a'V(x)a - a'V(y)a = a'\left(V(x) - V(y) \right)a \end{align} Look at the last expression and the definition of positive semi-definite to see that the definition of $\le$ for variance matrixes is chosen exactly to guarantee that $V(x) \le V(y)$ if and only if $V(a'x) \le V(a'y)$ for any choice of $a$, i.e. when $\left( V(y)-V(x) \right)$ is positive semi-definite. So, the answer to your question is that people say a variance matrix $V$ is smaller than a variance matrix $W$ if $W-V$ is positive semi-definite because they are interested in comparing the variances of linear combinations of the elements of the underlying random vectors. What definition you choose follows what you are interested in calculating and how that definition helps you with those calculations.
Appropriate measure to find smallest covariance matrix
@kjetil b halvorsen gives a nice discussion of the geometric intuition behind positive semi-definiteness as a partial ordering. I'll give a more grubby-handed take on that same intuition. One which
Appropriate measure to find smallest covariance matrix @kjetil b halvorsen gives a nice discussion of the geometric intuition behind positive semi-definiteness as a partial ordering. I'll give a more grubby-handed take on that same intuition. One which proceeds from what sorts of calculations you might like to do with your variance matrixes. Suppose you have two random variables $x$ and $y$. If they are scalars, then we can calculate their variances as scalars, and compare them in the obvious way using the scalar real numbers $V(x)$ and $V(y)$. So if $V(x)=5$ and $V(y)=15$, we say that the random variable $x$ has a smaller variance than does $y$. On the other hand, if $x$ and $y$ are vector-valued random variables (let's say they are two-vectors), how we compare their variances is not so obvious. Say their variances are: \begin{align} V(x) = \left[ \begin{array}{c c} 1 & 0.5 \\ 0.5 & 1 \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} 8 & 3 \\ 3 & 6 \end{array} \right] \end{align} How do we compare the variances of these two random vectors? One thing we could do is just compare the variances of their respective elements. So, we can say that the variance of $x_1$ is smaller than the variance of $y_1$ by just comparing real numbers, like: $V(x_1)=1<8=V(y_1)$ and $V(x_2)=1<6=V(y_2)$. So, maybe we could say that the variance of $x$ is $\le$ the variance of $y$ if the variance of each element of $x$ is $\le$ the variance of the corresponding element of $y$. This would be like saying $V(x) \le V(y)$ if each of the diagonal elements of $V(x)$ is $\le$ the corresponding diagonal element of $V(y)$. This definition seems reasonable at first blush. Furthermore, as long as the variance matrixes we are considering are diagonal (i.e. all covariances are 0), it is the same as using semi-definiteness. That is, if the variances look like \begin{align} V(x) = \left[ \begin{array}{c c} V(x_1) & 0 \\ 0 & V(x_2) \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} V(y_1) & 0 \\ 0 & V(y_2) \end{array} \right] \end{align} then saying $V(y)-V(x)$ is positive-semi-definite (i.e. that $V(x) \le V(y)$) is just the same as saying $V(x_1) \le V(y_1)$ and $V(x_2) \le V(y_2)$. All seems good until we introduce covariances. Consider this example: \begin{align} V(x) = \left[ \begin{array}{c c} 1 & 0.1 \\ 0.1 & 1 \end{array} \right] \qquad V(y) = \left[ \begin{array}{c c} 1 & 0 \\ 0 & 1 \end{array} \right] \end{align} Now, using a comparison which only considers the diagonals, we would say $V(x) \le V(y)$, and, indeed, it's still true that element-by-element $V(x_k) \le V(y_k)$. What might start to bother us about this is that if we calculate some weighted sum of the elements of the vectors, like $3x_1 + 2x_2$ and $3y_1 + 2y_2$, then we run into the fact that $V(3x_1 + 2x_2) \gt V(3y_1 + 2y_2)$ even though we are saying $V(x) \le V(y)$. This is weird, right? When $x$ and $y$ are scalars, then $V(x) \le V(y)$ guarantees that for any fixed, non-random $a$, $V(ax) \le V(ay)$. If, for whatever reason, we are interested in linear combinations of the elements of the random variables like this, then we might want to strengthen our definition of $\le$ for variance matrixes. Maybe we want to say $V(x) \le V(y)$ if and only if it is true that $V(a_1x_1 + a_2x_2) \le V(a_1y_1 + a_2y_2)$, no matter what fixed numbers $a_1$ and $a_2$ we pick. Notice, this is a stronger definition than the diagonals-only definition since if we pick $a_1=1,a_2=0$ it says $V(x_1) \le V(y_1)$, and if we pick $a_1=0,a_2=1$ it says $V(x_2) \le V(y_2)$. This second definition, the one which says $V(x) \le V(y)$ if and only if $V(a'x) \le V(a'y)$ for every possible fixed vector $a$, is the usual method of comparing variance matrixes based on positive semi-definiteness: \begin{align} V(a'y) - V(a'x) = a'V(x)a - a'V(y)a = a'\left(V(x) - V(y) \right)a \end{align} Look at the last expression and the definition of positive semi-definite to see that the definition of $\le$ for variance matrixes is chosen exactly to guarantee that $V(x) \le V(y)$ if and only if $V(a'x) \le V(a'y)$ for any choice of $a$, i.e. when $\left( V(y)-V(x) \right)$ is positive semi-definite. So, the answer to your question is that people say a variance matrix $V$ is smaller than a variance matrix $W$ if $W-V$ is positive semi-definite because they are interested in comparing the variances of linear combinations of the elements of the underlying random vectors. What definition you choose follows what you are interested in calculating and how that definition helps you with those calculations.
Appropriate measure to find smallest covariance matrix @kjetil b halvorsen gives a nice discussion of the geometric intuition behind positive semi-definiteness as a partial ordering. I'll give a more grubby-handed take on that same intuition. One which
27,977
Calibration of Cox regression survival analysis
Cox models do not predict outcomes! "Best" methods depend on whether you obtain a risk score (as with Framingham) or absolute risk (as with Gail Breast Cancer Risk). You need to tell us exactly what you're fitting With absolute risk prediction, you can split groups according to their risk deciles and calculate proportions of observed vs. expected outcome frequencies. This is basically the Hosmer Lemeshow test. But, in order to use this test, you need to have an absolute risk prediction! You cannot, say, split the groups by risk score deciles and use the empirical risk as the risk prediction, this strips off too much information and leads to some counter intuitive results. The bioconductor package has a suite of tools related to ROC analyses, predictiveness curves, etc. Nowhere in Ulla's package is mention made of estimating smoothed baseline hazard estimates. This is necessary to obtain risk prediction from survival models... because of censoring! Here's an example of that method being applied. I would accept no less from the package. No, don't use mean follow up. You should report total person years follow-up, along with censoring rate, and event rate. The Kaplan Meier curve kinda shows you all of that. I'm sure Sir David Cox is not fond of G&B's test. The power of the Cox model is that it can give consistent inference without necessarily having predictive accuracy: a tough concept for many to grasp. Tsiatis' book "semiparametric inference" has a lot to say about this. However, if you aim to take the Cox model one step further and create predictions from it, then I think the G&B test is very good for that purpose. Reclassification indices are proportions of individuals being shuffled into different (more discriminating) risk categories comparing two competing risk prediction models (see Pencina). It's important to realize (Kerr 2011) that you can calculate confidence intervals for this value... not using the bootstrap (or any limit theory treating the model as fixed) but using the double bootstrap (bootstrap sample, refit model, bootstrap sample again, calibrate models).
Calibration of Cox regression survival analysis
Cox models do not predict outcomes! "Best" methods depend on whether you obtain a risk score (as with Framingham) or absolute risk (as with Gail Breast Cancer Risk). You need to tell us exactly what y
Calibration of Cox regression survival analysis Cox models do not predict outcomes! "Best" methods depend on whether you obtain a risk score (as with Framingham) or absolute risk (as with Gail Breast Cancer Risk). You need to tell us exactly what you're fitting With absolute risk prediction, you can split groups according to their risk deciles and calculate proportions of observed vs. expected outcome frequencies. This is basically the Hosmer Lemeshow test. But, in order to use this test, you need to have an absolute risk prediction! You cannot, say, split the groups by risk score deciles and use the empirical risk as the risk prediction, this strips off too much information and leads to some counter intuitive results. The bioconductor package has a suite of tools related to ROC analyses, predictiveness curves, etc. Nowhere in Ulla's package is mention made of estimating smoothed baseline hazard estimates. This is necessary to obtain risk prediction from survival models... because of censoring! Here's an example of that method being applied. I would accept no less from the package. No, don't use mean follow up. You should report total person years follow-up, along with censoring rate, and event rate. The Kaplan Meier curve kinda shows you all of that. I'm sure Sir David Cox is not fond of G&B's test. The power of the Cox model is that it can give consistent inference without necessarily having predictive accuracy: a tough concept for many to grasp. Tsiatis' book "semiparametric inference" has a lot to say about this. However, if you aim to take the Cox model one step further and create predictions from it, then I think the G&B test is very good for that purpose. Reclassification indices are proportions of individuals being shuffled into different (more discriminating) risk categories comparing two competing risk prediction models (see Pencina). It's important to realize (Kerr 2011) that you can calculate confidence intervals for this value... not using the bootstrap (or any limit theory treating the model as fixed) but using the double bootstrap (bootstrap sample, refit model, bootstrap sample again, calibrate models).
Calibration of Cox regression survival analysis Cox models do not predict outcomes! "Best" methods depend on whether you obtain a risk score (as with Framingham) or absolute risk (as with Gail Breast Cancer Risk). You need to tell us exactly what y
27,978
Calibration of Cox regression survival analysis
@ AdamO is more knowledgeable than me, but if what you are trying to do is see if adding a biomarker to a model improves the model then this is a case of "nested" models. What's needed is: Define the null hypothesis as H0: No improvement in risk prediction Apply the likelihood ratio test to calculate twice the change in the log-likelihood statistic (D). This difference D follows a chi-squared distribution with n degree of freedom (n=1 in this case if you are adding just 1 biomarker). You look up D in a chi-squared table to find a p value. I've played with assessing the added value of a biomarker risk to a logistic regression model. If you are interested in there are some new statistical metrics (including net reclassification - often poorly applied) and a way of visualising them that are far more informative than merely comparing AUCs (c stats). See my paper Pickering, J. W., & Endre, Z. H. (2012). New Metrics for Assessing Diagnostic Potential of Candidate Biomarkers. Clinical Journal Of The American Society Of Nephrology, 7, 1355–1364. doi:10.2215/CJN.09590911
Calibration of Cox regression survival analysis
@ AdamO is more knowledgeable than me, but if what you are trying to do is see if adding a biomarker to a model improves the model then this is a case of "nested" models. What's needed is: Define th
Calibration of Cox regression survival analysis @ AdamO is more knowledgeable than me, but if what you are trying to do is see if adding a biomarker to a model improves the model then this is a case of "nested" models. What's needed is: Define the null hypothesis as H0: No improvement in risk prediction Apply the likelihood ratio test to calculate twice the change in the log-likelihood statistic (D). This difference D follows a chi-squared distribution with n degree of freedom (n=1 in this case if you are adding just 1 biomarker). You look up D in a chi-squared table to find a p value. I've played with assessing the added value of a biomarker risk to a logistic regression model. If you are interested in there are some new statistical metrics (including net reclassification - often poorly applied) and a way of visualising them that are far more informative than merely comparing AUCs (c stats). See my paper Pickering, J. W., & Endre, Z. H. (2012). New Metrics for Assessing Diagnostic Potential of Candidate Biomarkers. Clinical Journal Of The American Society Of Nephrology, 7, 1355–1364. doi:10.2215/CJN.09590911
Calibration of Cox regression survival analysis @ AdamO is more knowledgeable than me, but if what you are trying to do is see if adding a biomarker to a model improves the model then this is a case of "nested" models. What's needed is: Define th
27,979
Which machine learning algorithms can be scaled using hadoop/map-reduce
Mahout in Action is a good book to read up on Mahout (http://manning.com/owen/). Of course the website has an overview of the algorithms covered ( http://mahout.apache.org/ ).
Which machine learning algorithms can be scaled using hadoop/map-reduce
Mahout in Action is a good book to read up on Mahout (http://manning.com/owen/). Of course the website has an overview of the algorithms covered ( http://mahout.apache.org/ ).
Which machine learning algorithms can be scaled using hadoop/map-reduce Mahout in Action is a good book to read up on Mahout (http://manning.com/owen/). Of course the website has an overview of the algorithms covered ( http://mahout.apache.org/ ).
Which machine learning algorithms can be scaled using hadoop/map-reduce Mahout in Action is a good book to read up on Mahout (http://manning.com/owen/). Of course the website has an overview of the algorithms covered ( http://mahout.apache.org/ ).
27,980
Which machine learning algorithms can be scaled using hadoop/map-reduce
Vowpal Wabbit, a very fast machine learning program focused on online gradient descent learning, can be used with Hadoop: http://arxiv.org/abs/1110.4198 Though, I've never used it this way. If I understand it correctly, it really only uses Hadoop for reliability and providing the data to the Vowpal Wabbit processes. It uses something like MPI's AllReduce to do most of the communication.
Which machine learning algorithms can be scaled using hadoop/map-reduce
Vowpal Wabbit, a very fast machine learning program focused on online gradient descent learning, can be used with Hadoop: http://arxiv.org/abs/1110.4198 Though, I've never used it this way. If I under
Which machine learning algorithms can be scaled using hadoop/map-reduce Vowpal Wabbit, a very fast machine learning program focused on online gradient descent learning, can be used with Hadoop: http://arxiv.org/abs/1110.4198 Though, I've never used it this way. If I understand it correctly, it really only uses Hadoop for reliability and providing the data to the Vowpal Wabbit processes. It uses something like MPI's AllReduce to do most of the communication.
Which machine learning algorithms can be scaled using hadoop/map-reduce Vowpal Wabbit, a very fast machine learning program focused on online gradient descent learning, can be used with Hadoop: http://arxiv.org/abs/1110.4198 Though, I've never used it this way. If I under
27,981
Which machine learning algorithms can be scaled using hadoop/map-reduce
As Jimmy Lin and Chris Dyer point out in the first chapter in their book on Data-Intensive Text Mining with MapReduce, at large data scales, the performance of different algorithms converge such that performance differences virtually disappear. This means that given a large enough data set, the algorithm you'd want to use is the one that is computationally less expensive. It's only at smaller data scales that the performance differences between algorithms matter. That being said, their book (linked above) and Mining of Massive Datasets by Anand Rajaraman, Jure Leskovec, and Jeffrey D. Ullman are probably two books you'll want to check out as well, especially as they're directly concerned with MapReduce for data mining purposes.
Which machine learning algorithms can be scaled using hadoop/map-reduce
As Jimmy Lin and Chris Dyer point out in the first chapter in their book on Data-Intensive Text Mining with MapReduce, at large data scales, the performance of different algorithms converge such that
Which machine learning algorithms can be scaled using hadoop/map-reduce As Jimmy Lin and Chris Dyer point out in the first chapter in their book on Data-Intensive Text Mining with MapReduce, at large data scales, the performance of different algorithms converge such that performance differences virtually disappear. This means that given a large enough data set, the algorithm you'd want to use is the one that is computationally less expensive. It's only at smaller data scales that the performance differences between algorithms matter. That being said, their book (linked above) and Mining of Massive Datasets by Anand Rajaraman, Jure Leskovec, and Jeffrey D. Ullman are probably two books you'll want to check out as well, especially as they're directly concerned with MapReduce for data mining purposes.
Which machine learning algorithms can be scaled using hadoop/map-reduce As Jimmy Lin and Chris Dyer point out in the first chapter in their book on Data-Intensive Text Mining with MapReduce, at large data scales, the performance of different algorithms converge such that
27,982
Which machine learning algorithms can be scaled using hadoop/map-reduce
If you have access to a Hadoop cluster, I'd give Spark a look. https://spark.apache.org/
Which machine learning algorithms can be scaled using hadoop/map-reduce
If you have access to a Hadoop cluster, I'd give Spark a look. https://spark.apache.org/
Which machine learning algorithms can be scaled using hadoop/map-reduce If you have access to a Hadoop cluster, I'd give Spark a look. https://spark.apache.org/
Which machine learning algorithms can be scaled using hadoop/map-reduce If you have access to a Hadoop cluster, I'd give Spark a look. https://spark.apache.org/
27,983
Which machine learning algorithms can be scaled using hadoop/map-reduce
No one has mentioned the following paper - http://papers.nips.cc/paper/3150-map-reduce-for-machine-learning-on-multicore.pdf (Andrew Ng is one of the authors) The paper itself is for multi-core machines, but it is essentially about recasting machine learning problems so that they fit the map-reduce pattern, and can be used for a cluster of computers. (for seeing why that is not a good idea in general, you may want to read this paper - http://arxiv.org/pdf/1006.4990v1.pdf . It has a good overview).
Which machine learning algorithms can be scaled using hadoop/map-reduce
No one has mentioned the following paper - http://papers.nips.cc/paper/3150-map-reduce-for-machine-learning-on-multicore.pdf (Andrew Ng is one of the authors) The paper itself is for multi-core machin
Which machine learning algorithms can be scaled using hadoop/map-reduce No one has mentioned the following paper - http://papers.nips.cc/paper/3150-map-reduce-for-machine-learning-on-multicore.pdf (Andrew Ng is one of the authors) The paper itself is for multi-core machines, but it is essentially about recasting machine learning problems so that they fit the map-reduce pattern, and can be used for a cluster of computers. (for seeing why that is not a good idea in general, you may want to read this paper - http://arxiv.org/pdf/1006.4990v1.pdf . It has a good overview).
Which machine learning algorithms can be scaled using hadoop/map-reduce No one has mentioned the following paper - http://papers.nips.cc/paper/3150-map-reduce-for-machine-learning-on-multicore.pdf (Andrew Ng is one of the authors) The paper itself is for multi-core machin
27,984
Which machine learning algorithms can be scaled using hadoop/map-reduce
Scaling Up Machine Learning: parallel and distributed approaches is a great book by John Langford et. al. that discusses parallel implementations of supervised and unsupervised algorithms. It talks about MapReduce, decision tree ensembles, parallel K-means, parallel SVM, belief propagation, and AD-LDA. https://www.amazon.com/Scaling-Machine-Learning-Distributed-Approaches/dp/0521192242
Which machine learning algorithms can be scaled using hadoop/map-reduce
Scaling Up Machine Learning: parallel and distributed approaches is a great book by John Langford et. al. that discusses parallel implementations of supervised and unsupervised algorithms. It talks ab
Which machine learning algorithms can be scaled using hadoop/map-reduce Scaling Up Machine Learning: parallel and distributed approaches is a great book by John Langford et. al. that discusses parallel implementations of supervised and unsupervised algorithms. It talks about MapReduce, decision tree ensembles, parallel K-means, parallel SVM, belief propagation, and AD-LDA. https://www.amazon.com/Scaling-Machine-Learning-Distributed-Approaches/dp/0521192242
Which machine learning algorithms can be scaled using hadoop/map-reduce Scaling Up Machine Learning: parallel and distributed approaches is a great book by John Langford et. al. that discusses parallel implementations of supervised and unsupervised algorithms. It talks ab
27,985
Convergence of neural network weights
There are a number of questions to ask: do you have the appropriate number of neurons in each layer are you using the appropriate types of transfer functions? are you using the appropriate type of learning algorithm do you have a large enough sample size can you confirm that your samples have the right sorts of relationship with each other to be informative? (not redundant, of relevant dimension, etc...) What can you give in the way of ephemeris? Can you tell us something about the nature of the data? You could make a gradient boosted tree of neural networks. You asked what happens if you stop early. You can try yourself. Run 300x where you start with random initialized weights, and then stop at a specified number of iterations, lets say 100. At that point compute your ensemble error, your training-subset error, and your test-set error. Repeat. After you have 300 values to tell you what the error is, you can get an idea of your error distribution given 100 learning iterations. If you like, you can then sample that distribution at several other values of learning. I suggest 200, 500, and 1000 iterations. This will give you an idea how your SNR changes over time. A plot of the SNR vs iteration count can give you an idea about "cliffs" or "good enough". Sometimes there are cliffs where error collapses. Sometimes the error is acceptable at that point. It takes "relatively simple" data or "pretty good" luck for your system to consistently converge in under 100 iterations. Both of which are not about repeatability nor are they generalizable. Why are you thinking in terms of weights converging and not error being below a particular threshold. Have you ever heard of a voting paradox? (link) When you have cyclic interactions in your system (like feedback in Neural Networks) then you can have voting paradoxes - coupled changes. I don't know if weights alone is a sufficient indicator for convergence of the network. You can think of the weights as a space. It has more than 3 dimensions, but it is still a space. In the "centroid" of that space is your "best fit" region. Far from the centroid is a less good fit. You can think of the current setting of your weights as a single point in that space. Now you don't know where the "good" actually is. What you do have is a local "slope". You can perform gradient descent toward local "better" given where your point is right now. It doesn't tell you the "universal" better, but local is better than nothing. So you start iterating, walking downhill toward that valley of betterness. You iterate until you think you are done. Maybe the value of your weights are large. Maybe they are bouncing all over the place. Maybe the compute is "taking too long". You want to be done. So how do you know whether where you are is "good enough"? Here is a quick test that you could do: Take 30 uniform random subsets of the data (like a few percent of the data each) and retrain the network on them. It should be much faster. Observe how long it takes them to converge and compare it with the convergence history of the big set. Test the error of the network for the entire data on these subsets and see how that distribution of errors compares to your big error. Now bump the subset sizes up to maybe 5% of your data and repeat. See what this teaches you. This is a variation on particle swarm optimization(see reference) modeled on how honeybees make decisions based on scouting. You asked what happens if weights do not converge. Neural Networks are one tool. They are not the only tool. There are others. I would look at using one of them. I work in terms of information criteria, so I look at both the weights (parameter count) and the error. You might try one of those. There are some types of preprocessing that can be useful. Center and Scale. Rotate using principal components. If you look at the eigenvalues in your principal components you can use skree plot rules to estimate the dimension of your data. Reducing the dimension can improve convergence. If you know something about the 'underlying physics' then you can smooth or filter the data to remove noise. Sometimes convergence is about noise in the system. I find the idea of Compressed sensing to be interesting. It can allow radical sub-sampling of some systems without loss of generalization. I would look at some bootstrap re-sampled statistics and distributions of your data to determine if and at what level of sub-sampling the training set becomes representative. This gives you some measure of the "health" of your data. Sometimes it is a good thing that they not converge Have you ever heard of a voting paradox? You might think of it as a higher-count cousin to a two-way impasse. It is a loop. In a 2-person voting paradox the first person wants candidate "A" while the second wants candidate "B" (or not-A or such). The important part is that you can think of it as a loop. Loops are important in neural networks. Feedback. Recursion. It made the perceptron able to resolve XOR-like problems. It makes loops, and sometimes the loops can act like the voting paradox, where they will keep changing weights if you had infinite iterations. They aren't meant to converge because it isn't the individual weight that matters but the interaction of the weights in the loop. Note: Using only 500 iterations can be a problem. I have had NN's where 10,000 iterations was barely enough. The number of iterations to be "enough" is dependent, as I have already indicated, on data, NN-topology, node-transfer functions, learning/training function, and even computer hardware. You have to have a good understanding of how they all interact with your iteration count before saying that there have been "enough" or "too many" iterations. Other considerations like time, budget, and what you want to do with the NN when you are done training it should also be considered. Chen, R. B., Chang, S. P., Wang, W., & Wong, W. K., (2011, September). Optimal Experimental Designs via Particle Swarm Optimization Methods (preprint), Retrieved March 25, 2012, from http://www.math.ntu.edu.tw/~mathlib/preprint/2011-03.pdf
Convergence of neural network weights
There are a number of questions to ask: do you have the appropriate number of neurons in each layer are you using the appropriate types of transfer functions? are you using the appropriate type of le
Convergence of neural network weights There are a number of questions to ask: do you have the appropriate number of neurons in each layer are you using the appropriate types of transfer functions? are you using the appropriate type of learning algorithm do you have a large enough sample size can you confirm that your samples have the right sorts of relationship with each other to be informative? (not redundant, of relevant dimension, etc...) What can you give in the way of ephemeris? Can you tell us something about the nature of the data? You could make a gradient boosted tree of neural networks. You asked what happens if you stop early. You can try yourself. Run 300x where you start with random initialized weights, and then stop at a specified number of iterations, lets say 100. At that point compute your ensemble error, your training-subset error, and your test-set error. Repeat. After you have 300 values to tell you what the error is, you can get an idea of your error distribution given 100 learning iterations. If you like, you can then sample that distribution at several other values of learning. I suggest 200, 500, and 1000 iterations. This will give you an idea how your SNR changes over time. A plot of the SNR vs iteration count can give you an idea about "cliffs" or "good enough". Sometimes there are cliffs where error collapses. Sometimes the error is acceptable at that point. It takes "relatively simple" data or "pretty good" luck for your system to consistently converge in under 100 iterations. Both of which are not about repeatability nor are they generalizable. Why are you thinking in terms of weights converging and not error being below a particular threshold. Have you ever heard of a voting paradox? (link) When you have cyclic interactions in your system (like feedback in Neural Networks) then you can have voting paradoxes - coupled changes. I don't know if weights alone is a sufficient indicator for convergence of the network. You can think of the weights as a space. It has more than 3 dimensions, but it is still a space. In the "centroid" of that space is your "best fit" region. Far from the centroid is a less good fit. You can think of the current setting of your weights as a single point in that space. Now you don't know where the "good" actually is. What you do have is a local "slope". You can perform gradient descent toward local "better" given where your point is right now. It doesn't tell you the "universal" better, but local is better than nothing. So you start iterating, walking downhill toward that valley of betterness. You iterate until you think you are done. Maybe the value of your weights are large. Maybe they are bouncing all over the place. Maybe the compute is "taking too long". You want to be done. So how do you know whether where you are is "good enough"? Here is a quick test that you could do: Take 30 uniform random subsets of the data (like a few percent of the data each) and retrain the network on them. It should be much faster. Observe how long it takes them to converge and compare it with the convergence history of the big set. Test the error of the network for the entire data on these subsets and see how that distribution of errors compares to your big error. Now bump the subset sizes up to maybe 5% of your data and repeat. See what this teaches you. This is a variation on particle swarm optimization(see reference) modeled on how honeybees make decisions based on scouting. You asked what happens if weights do not converge. Neural Networks are one tool. They are not the only tool. There are others. I would look at using one of them. I work in terms of information criteria, so I look at both the weights (parameter count) and the error. You might try one of those. There are some types of preprocessing that can be useful. Center and Scale. Rotate using principal components. If you look at the eigenvalues in your principal components you can use skree plot rules to estimate the dimension of your data. Reducing the dimension can improve convergence. If you know something about the 'underlying physics' then you can smooth or filter the data to remove noise. Sometimes convergence is about noise in the system. I find the idea of Compressed sensing to be interesting. It can allow radical sub-sampling of some systems without loss of generalization. I would look at some bootstrap re-sampled statistics and distributions of your data to determine if and at what level of sub-sampling the training set becomes representative. This gives you some measure of the "health" of your data. Sometimes it is a good thing that they not converge Have you ever heard of a voting paradox? You might think of it as a higher-count cousin to a two-way impasse. It is a loop. In a 2-person voting paradox the first person wants candidate "A" while the second wants candidate "B" (or not-A or such). The important part is that you can think of it as a loop. Loops are important in neural networks. Feedback. Recursion. It made the perceptron able to resolve XOR-like problems. It makes loops, and sometimes the loops can act like the voting paradox, where they will keep changing weights if you had infinite iterations. They aren't meant to converge because it isn't the individual weight that matters but the interaction of the weights in the loop. Note: Using only 500 iterations can be a problem. I have had NN's where 10,000 iterations was barely enough. The number of iterations to be "enough" is dependent, as I have already indicated, on data, NN-topology, node-transfer functions, learning/training function, and even computer hardware. You have to have a good understanding of how they all interact with your iteration count before saying that there have been "enough" or "too many" iterations. Other considerations like time, budget, and what you want to do with the NN when you are done training it should also be considered. Chen, R. B., Chang, S. P., Wang, W., & Wong, W. K., (2011, September). Optimal Experimental Designs via Particle Swarm Optimization Methods (preprint), Retrieved March 25, 2012, from http://www.math.ntu.edu.tw/~mathlib/preprint/2011-03.pdf
Convergence of neural network weights There are a number of questions to ask: do you have the appropriate number of neurons in each layer are you using the appropriate types of transfer functions? are you using the appropriate type of le
27,986
Convergence of neural network weights
To me is hard to say what your problem might be. One point to consider is the concrete implementation you use. Concretely, what optimization algorithm. If your network takes really long to converge, and you are using some form of stochastic gradient descent (or mini-batch) then it could be the case that your network is in a plateau (a region where the energy/error function is very flat so that gradients are very low and thus convergence). If so, please check the magnitude of the gradients to see if this is the case. There are a number of different techniques to deal with this problem, like adding a momentum to the gradient. For a detail overview of techniques and tricks of the trade, take a look at this (must read) paper by Yann LeCun.
Convergence of neural network weights
To me is hard to say what your problem might be. One point to consider is the concrete implementation you use. Concretely, what optimization algorithm. If your network takes really long to converge,
Convergence of neural network weights To me is hard to say what your problem might be. One point to consider is the concrete implementation you use. Concretely, what optimization algorithm. If your network takes really long to converge, and you are using some form of stochastic gradient descent (or mini-batch) then it could be the case that your network is in a plateau (a region where the energy/error function is very flat so that gradients are very low and thus convergence). If so, please check the magnitude of the gradients to see if this is the case. There are a number of different techniques to deal with this problem, like adding a momentum to the gradient. For a detail overview of techniques and tricks of the trade, take a look at this (must read) paper by Yann LeCun.
Convergence of neural network weights To me is hard to say what your problem might be. One point to consider is the concrete implementation you use. Concretely, what optimization algorithm. If your network takes really long to converge,
27,987
Convergence of neural network weights
Make sure that your gradients are not going beyond limits or it is also possible that the gradients are becoming zero. This is popularly known as exploding gradients and vanishing gradients problems. One possible solution is to use a adaptive optimizer such as AdaGrad or Adam. I had faced a similar problem while training a simple neural network when I was getting started with neural networks. Few references: https://en.wikipedia.org/wiki/Vanishing_gradient_problem https://www.youtube.com/watch?v=VuamhbEWEWA
Convergence of neural network weights
Make sure that your gradients are not going beyond limits or it is also possible that the gradients are becoming zero. This is popularly known as exploding gradients and vanishing gradients problems.
Convergence of neural network weights Make sure that your gradients are not going beyond limits or it is also possible that the gradients are becoming zero. This is popularly known as exploding gradients and vanishing gradients problems. One possible solution is to use a adaptive optimizer such as AdaGrad or Adam. I had faced a similar problem while training a simple neural network when I was getting started with neural networks. Few references: https://en.wikipedia.org/wiki/Vanishing_gradient_problem https://www.youtube.com/watch?v=VuamhbEWEWA
Convergence of neural network weights Make sure that your gradients are not going beyond limits or it is also possible that the gradients are becoming zero. This is popularly known as exploding gradients and vanishing gradients problems.
27,988
Convergence of neural network weights
I've had many data sets that converged slowly - probably because the inputs were highly correlated. I wrote my own C++ NN analyzer, and with it, I can vary the learning rate for each weight. For each weight at each edge I do two things that help some. First, I multiply each learning rate by a uniformly distributed random number from [0,1]. I'm guessing that that helps with the correlation problem. The other trick is that I compare the current gradient with the previous gradient at each edge. If the gradient barely lowered percentagewise, then I multiply the learning rate for that edge by up to 5. I don't have any particular justification for either of those tricks, but they seem to work pretty well. Hope this helps.
Convergence of neural network weights
I've had many data sets that converged slowly - probably because the inputs were highly correlated. I wrote my own C++ NN analyzer, and with it, I can vary the learning rate for each weight. For each
Convergence of neural network weights I've had many data sets that converged slowly - probably because the inputs were highly correlated. I wrote my own C++ NN analyzer, and with it, I can vary the learning rate for each weight. For each weight at each edge I do two things that help some. First, I multiply each learning rate by a uniformly distributed random number from [0,1]. I'm guessing that that helps with the correlation problem. The other trick is that I compare the current gradient with the previous gradient at each edge. If the gradient barely lowered percentagewise, then I multiply the learning rate for that edge by up to 5. I don't have any particular justification for either of those tricks, but they seem to work pretty well. Hope this helps.
Convergence of neural network weights I've had many data sets that converged slowly - probably because the inputs were highly correlated. I wrote my own C++ NN analyzer, and with it, I can vary the learning rate for each weight. For each
27,989
Differences in kurtosis definition and their interpretation
The three formulas Three formulas for the kurtosis are generally used by different programs. I will state all three formulas ($g_{2}$, $G_{2}$ and $b_{2}$) and programs that use them. The first formula and the typical definition used in many textbooks is (this is the second formula in the link you've provided) $$ g_{2}=\frac{m_{4}}{m_{2}^{2}} $$ where $m_{r}$ denotes the sample moments: $$ m_{r}=\frac{1}{n}\sum(x_{i}-\bar{x})^{r} $$ Sometimes, a correction term of -3 is added to this formula so that a normal distribution has a kurtosis of 0. The kurtosis formula with a term of -3 is called excess kurtosis (the first formula in the link you've provided). The second formula is (used by SAS, SPSS and MS Excel; this is the third formula in the link you've provided) $$ G_{2} = \frac{k_{4}}{k_{2}^{2}}= \frac{n-1}{(n-2)(n-3)}\left[(n+1)g_{2}+6\right] $$ where $g_{2}$ is the kurtosis as defined in the first formula. The third formula is (used by MINITAB and BMDP) $$ b_{2}=\frac{m_{4}}{s^{4}}-3=\left(\frac{n-1}{n}\right)^{2}\frac{m_{4}}{m_{2}^{2}}-3 $$ where $s^2$ is the unbiased sample variance: $$ s^2=\frac{1}{n-1}\sum(x_{i}-\bar{x})^2 $$ In R the kurtosis can be calculated using the kurtosis function from the e1071 package (link here). The option type determines which one of the three formulas is used for the calculations (1=$g_{2}-3$, 2=$G_{2}$, 3=$b_{2}$). These two papers discuss and compare all three formulas: first, second. Summary of the differences between the formulas Using $g_{2}$, a normal distribution has a kurtosis value of 3 whereas in the formulas involving a correction term -3 (i.e. $G_{2}$ and $b_{2}$), a normal distribution has an excess kurtosis of 0. $G_{2}$ is the only formula yielding unbiased estimates for normal samples (i.e. the expectation of $G_{2}$ under normality is zero, or $\mathbb{E}(G_{2})=0$). For large samples, the difference between the formulas are negligible and the choice does not matter much. For small samples from a normal distribution, the relation of the three formulas in terms of the mean squared errors (MSE) is: $\operatorname{mse}(g_{2})<\operatorname{mse}(b_{2})<\operatorname{mse}(G_{2})$. So $g_{2}$ has the smallest and $G_{2}$ the largest (although only $G_{2}$ is unbiased). That is because $G_{2}$ has the largest variance of the three formulas: $\operatorname{Var}(b_{2})<\operatorname{Var}(g_{2})<\operatorname{Var}(G_{2})$. For small samples from non-normal distributions, the relation of the three formulas in terms of bias is: $\operatorname{bias}(G_{2})<\operatorname{bias}(g_{2})<\operatorname{bias}(b_{2})$. In terms of mean squared erorrs: $\operatorname{mse}(G_{2})<\operatorname{mse}(g_{2})<\operatorname{mse}(b_{2})$. So $G_{2}$ has the smallest mean squared error and the smallest bias of the three formulas. $b_{2}$ has the largest mean squared error and bias. For large samples ($n>200$) from non-normal distributions, the relation of the three formulas in terms of bias is: $\operatorname{bias}(G_{2})<\operatorname{bias}(g_{2})<\operatorname{bias}(b_{2})$. In terms of mean squared erorrs: $\operatorname{mse}(b_{2})<\operatorname{mse}(g_{2})<\operatorname{mse}(G_{2})$. See also the Wikipedia page and the MathWorld page about kurtosis.
Differences in kurtosis definition and their interpretation
The three formulas Three formulas for the kurtosis are generally used by different programs. I will state all three formulas ($g_{2}$, $G_{2}$ and $b_{2}$) and programs that use them. The first formul
Differences in kurtosis definition and their interpretation The three formulas Three formulas for the kurtosis are generally used by different programs. I will state all three formulas ($g_{2}$, $G_{2}$ and $b_{2}$) and programs that use them. The first formula and the typical definition used in many textbooks is (this is the second formula in the link you've provided) $$ g_{2}=\frac{m_{4}}{m_{2}^{2}} $$ where $m_{r}$ denotes the sample moments: $$ m_{r}=\frac{1}{n}\sum(x_{i}-\bar{x})^{r} $$ Sometimes, a correction term of -3 is added to this formula so that a normal distribution has a kurtosis of 0. The kurtosis formula with a term of -3 is called excess kurtosis (the first formula in the link you've provided). The second formula is (used by SAS, SPSS and MS Excel; this is the third formula in the link you've provided) $$ G_{2} = \frac{k_{4}}{k_{2}^{2}}= \frac{n-1}{(n-2)(n-3)}\left[(n+1)g_{2}+6\right] $$ where $g_{2}$ is the kurtosis as defined in the first formula. The third formula is (used by MINITAB and BMDP) $$ b_{2}=\frac{m_{4}}{s^{4}}-3=\left(\frac{n-1}{n}\right)^{2}\frac{m_{4}}{m_{2}^{2}}-3 $$ where $s^2$ is the unbiased sample variance: $$ s^2=\frac{1}{n-1}\sum(x_{i}-\bar{x})^2 $$ In R the kurtosis can be calculated using the kurtosis function from the e1071 package (link here). The option type determines which one of the three formulas is used for the calculations (1=$g_{2}-3$, 2=$G_{2}$, 3=$b_{2}$). These two papers discuss and compare all three formulas: first, second. Summary of the differences between the formulas Using $g_{2}$, a normal distribution has a kurtosis value of 3 whereas in the formulas involving a correction term -3 (i.e. $G_{2}$ and $b_{2}$), a normal distribution has an excess kurtosis of 0. $G_{2}$ is the only formula yielding unbiased estimates for normal samples (i.e. the expectation of $G_{2}$ under normality is zero, or $\mathbb{E}(G_{2})=0$). For large samples, the difference between the formulas are negligible and the choice does not matter much. For small samples from a normal distribution, the relation of the three formulas in terms of the mean squared errors (MSE) is: $\operatorname{mse}(g_{2})<\operatorname{mse}(b_{2})<\operatorname{mse}(G_{2})$. So $g_{2}$ has the smallest and $G_{2}$ the largest (although only $G_{2}$ is unbiased). That is because $G_{2}$ has the largest variance of the three formulas: $\operatorname{Var}(b_{2})<\operatorname{Var}(g_{2})<\operatorname{Var}(G_{2})$. For small samples from non-normal distributions, the relation of the three formulas in terms of bias is: $\operatorname{bias}(G_{2})<\operatorname{bias}(g_{2})<\operatorname{bias}(b_{2})$. In terms of mean squared erorrs: $\operatorname{mse}(G_{2})<\operatorname{mse}(g_{2})<\operatorname{mse}(b_{2})$. So $G_{2}$ has the smallest mean squared error and the smallest bias of the three formulas. $b_{2}$ has the largest mean squared error and bias. For large samples ($n>200$) from non-normal distributions, the relation of the three formulas in terms of bias is: $\operatorname{bias}(G_{2})<\operatorname{bias}(g_{2})<\operatorname{bias}(b_{2})$. In terms of mean squared erorrs: $\operatorname{mse}(b_{2})<\operatorname{mse}(g_{2})<\operatorname{mse}(G_{2})$. See also the Wikipedia page and the MathWorld page about kurtosis.
Differences in kurtosis definition and their interpretation The three formulas Three formulas for the kurtosis are generally used by different programs. I will state all three formulas ($g_{2}$, $G_{2}$ and $b_{2}$) and programs that use them. The first formul
27,990
Differences in kurtosis definition and their interpretation
The link in question talks about SAS too. But in fact nothing in this question, except possibly the poster's own focus, limits it to those particular named programs. I think we need to separate out quite different kinds of problem here, some of which are illusory and some of which are genuine. Some programs do, and some do not, subtract 3 so that the kurtosis measure reported is 3 for Gaussian/normal variables without subtraction and 0 with subtraction. I have seen people puzzled by that, often when the difference turns out to be say 2.999 and not exactly 3. Some programs use correction factors designed to ensure that kurtosis is estimated without bias. These correction factors approach 1 as sample size $n$ gets larger. As kurtosis is not well estimated in small samples any way, this should not be of much concern. So, there is a small issue of formulas, #1 being a much bigger deal than #2, but both minor if understood. The advice clearly is to look at the documentation for the program you are using, and if there is no documentation explaining that kind of detail to abandon that program immediately. But a test case as simple as a variable (1, 2) yields kurtosis of 1 or 4 depending on #1 alone (with no correction factor). The question then asks about interpretation, but this is a much more open and contentious matter. Before we get to the main area of discussion, an often reported but little known difficulty is that kurtosis estimates are bounded as a function of sample size. I wrote a review in Cox, N.J. 2010. The limits of sample skewness and kurtosis. Stata Journal 10(3): 482-495. http://www.stata-journal.com/article.html?article=st0204 Abstract: Sample skewness and kurtosis are limited by functions of sample size. The limits, or approximations to them, have repeatedly been rediscovered over the last several decades, but nevertheless seem to remain only poorly known. The limits impart bias to estimation and, in extreme cases, imply that no sample could bear exact witness to its parent distribution. The main results are explained in a tutorial review, and it is shown how Stata and Mata may be used to confirm and explore their consequences. Now to what is commonly regarded as the nub of the matter: Many people translate kurtosis as peakedness, but others emphasise that it often serves as a measure of tail weight. In fact, the two interpretations could both be reasonable wording for some distributions. It is almost inevitable that there is no simple verbal interpretation of kurtosis: our language is not rich enough on comparisons of sums of fourth powers of deviations from the mean and sums of second powers of the same. In a minor and often overlooked classic, Irving Kaplansky (1945a) drew attention to four examples of distributions with different values of kurtosis and behaviour not consistent with some discussions of kurtosis. The distributions all are symmetric with mean 0 and variance 1 and have density functions, for variable $x$ and $c = \sqrt{\pi}$, $(1)\ \ \ (1 / 3c) (9/4 + x^4) \exp(-x^2)$ $(2)\ \ \ (3 / (c \sqrt8)) \exp(-x^2 / 2) - (1 / 6c) (9/4 + x^4) \exp(-x^2)$ $(3)\ \ \ (1 / 6c) (\exp(-x^2 / 4) + 4 \exp(-x^2))$ $(4)\ \ \ (3 \sqrt3 / 16c) (2 + x^2) \exp(-3x^2 / 4)$ The kurtosis (without subtraction) is (1) 2.75 (2) 3.125 (3) 4.5 (4) 8/3 $\approx$ 2.667: compare the Gaussian or normal value of 3. The density at the mean is (1) 0.423 (2) 0.387 (3) 0.470 (4) 0.366: compare the Gaussian value of 0.399. It's instructive to plot these densities. Stata users can download my kaplansky program from SSC. Using a logarithmic scale for density may help. Without giving away the full details, these examples undermine any simple story that low or high kurtosis has a clear interpretation in terms of peakedness or indeed any other single contrast. If the name Irving Kaplansky rings a bell, it is likely because you know his work in modern algebra. He (1917-2006) was a Canadian (later American) mathematician and taught and researched at Harvard, Chicago and Berkeley, with a wartime year in the Applied Mathematics Group of the National Defense Council at Columbia University. Kaplansky made major contributions to group theory, ring theory, the theory of operator algebras and field theory. He was an accomplished pianist and lyricist and an enthusiastic and lucid expositor of mathematics. Note also some other contributions to probability and statistics by Kaplansky (1943, 1945b) and Kaplansky and Riordan (1945). Kaplansky, I. 1943. A characterization of the normal distribution. Annals of Mathematical Statistics 14: 197-198. Kaplansky, I. 1945a. A common error concerning kurtosis. Journal, American Statistical Association 40: 259 only. Kaplansky, I. 1945b. The asymptotic distribution of runs of consecutive elements. Annals of Mathematical Statistics 16: 200-203. Kaplansky, I. and Riordan, J. 1945. Multiple matching and runs by the symbolic method. Annals of Mathematical Statistics 16: 272-277.
Differences in kurtosis definition and their interpretation
The link in question talks about SAS too. But in fact nothing in this question, except possibly the poster's own focus, limits it to those particular named programs. I think we need to separate out q
Differences in kurtosis definition and their interpretation The link in question talks about SAS too. But in fact nothing in this question, except possibly the poster's own focus, limits it to those particular named programs. I think we need to separate out quite different kinds of problem here, some of which are illusory and some of which are genuine. Some programs do, and some do not, subtract 3 so that the kurtosis measure reported is 3 for Gaussian/normal variables without subtraction and 0 with subtraction. I have seen people puzzled by that, often when the difference turns out to be say 2.999 and not exactly 3. Some programs use correction factors designed to ensure that kurtosis is estimated without bias. These correction factors approach 1 as sample size $n$ gets larger. As kurtosis is not well estimated in small samples any way, this should not be of much concern. So, there is a small issue of formulas, #1 being a much bigger deal than #2, but both minor if understood. The advice clearly is to look at the documentation for the program you are using, and if there is no documentation explaining that kind of detail to abandon that program immediately. But a test case as simple as a variable (1, 2) yields kurtosis of 1 or 4 depending on #1 alone (with no correction factor). The question then asks about interpretation, but this is a much more open and contentious matter. Before we get to the main area of discussion, an often reported but little known difficulty is that kurtosis estimates are bounded as a function of sample size. I wrote a review in Cox, N.J. 2010. The limits of sample skewness and kurtosis. Stata Journal 10(3): 482-495. http://www.stata-journal.com/article.html?article=st0204 Abstract: Sample skewness and kurtosis are limited by functions of sample size. The limits, or approximations to them, have repeatedly been rediscovered over the last several decades, but nevertheless seem to remain only poorly known. The limits impart bias to estimation and, in extreme cases, imply that no sample could bear exact witness to its parent distribution. The main results are explained in a tutorial review, and it is shown how Stata and Mata may be used to confirm and explore their consequences. Now to what is commonly regarded as the nub of the matter: Many people translate kurtosis as peakedness, but others emphasise that it often serves as a measure of tail weight. In fact, the two interpretations could both be reasonable wording for some distributions. It is almost inevitable that there is no simple verbal interpretation of kurtosis: our language is not rich enough on comparisons of sums of fourth powers of deviations from the mean and sums of second powers of the same. In a minor and often overlooked classic, Irving Kaplansky (1945a) drew attention to four examples of distributions with different values of kurtosis and behaviour not consistent with some discussions of kurtosis. The distributions all are symmetric with mean 0 and variance 1 and have density functions, for variable $x$ and $c = \sqrt{\pi}$, $(1)\ \ \ (1 / 3c) (9/4 + x^4) \exp(-x^2)$ $(2)\ \ \ (3 / (c \sqrt8)) \exp(-x^2 / 2) - (1 / 6c) (9/4 + x^4) \exp(-x^2)$ $(3)\ \ \ (1 / 6c) (\exp(-x^2 / 4) + 4 \exp(-x^2))$ $(4)\ \ \ (3 \sqrt3 / 16c) (2 + x^2) \exp(-3x^2 / 4)$ The kurtosis (without subtraction) is (1) 2.75 (2) 3.125 (3) 4.5 (4) 8/3 $\approx$ 2.667: compare the Gaussian or normal value of 3. The density at the mean is (1) 0.423 (2) 0.387 (3) 0.470 (4) 0.366: compare the Gaussian value of 0.399. It's instructive to plot these densities. Stata users can download my kaplansky program from SSC. Using a logarithmic scale for density may help. Without giving away the full details, these examples undermine any simple story that low or high kurtosis has a clear interpretation in terms of peakedness or indeed any other single contrast. If the name Irving Kaplansky rings a bell, it is likely because you know his work in modern algebra. He (1917-2006) was a Canadian (later American) mathematician and taught and researched at Harvard, Chicago and Berkeley, with a wartime year in the Applied Mathematics Group of the National Defense Council at Columbia University. Kaplansky made major contributions to group theory, ring theory, the theory of operator algebras and field theory. He was an accomplished pianist and lyricist and an enthusiastic and lucid expositor of mathematics. Note also some other contributions to probability and statistics by Kaplansky (1943, 1945b) and Kaplansky and Riordan (1945). Kaplansky, I. 1943. A characterization of the normal distribution. Annals of Mathematical Statistics 14: 197-198. Kaplansky, I. 1945a. A common error concerning kurtosis. Journal, American Statistical Association 40: 259 only. Kaplansky, I. 1945b. The asymptotic distribution of runs of consecutive elements. Annals of Mathematical Statistics 16: 200-203. Kaplansky, I. and Riordan, J. 1945. Multiple matching and runs by the symbolic method. Annals of Mathematical Statistics 16: 272-277.
Differences in kurtosis definition and their interpretation The link in question talks about SAS too. But in fact nothing in this question, except possibly the poster's own focus, limits it to those particular named programs. I think we need to separate out q
27,991
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
I would use a latent variable approach, since that's what x an y are. However, its not clear that all four parameters would be identifiable in this case. It would be helpful if you had some prior information for one or two of them. Here's an example: import pymc as pm # Priors mu_x = pm.Normal('mu_x', 0, 0.001, value=0) sigma_x = pm.Uniform('sigma_x', 0, 100, value=1) tau_x = sigma_x**-2 mu_y = pm.Normal('mu_y', 0, 0.001, value=1) sigma_y = pm.Uniform('sigma_y', 0, 100, value=1) tau_y = sigma_y**-2 # Latent variable y = pm.Lognormal('y', mu_y, sigma_y, size=len(z_data)) @pm.observed def Z(value=z_data, mu=mu_x, tau=tau_x, y=y): # Likelihood for x (also latent, but fixed given y and z) return pm.normal_like(value-y, mu, tau)
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
I would use a latent variable approach, since that's what x an y are. However, its not clear that all four parameters would be identifiable in this case. It would be helpful if you had some prior info
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? I would use a latent variable approach, since that's what x an y are. However, its not clear that all four parameters would be identifiable in this case. It would be helpful if you had some prior information for one or two of them. Here's an example: import pymc as pm # Priors mu_x = pm.Normal('mu_x', 0, 0.001, value=0) sigma_x = pm.Uniform('sigma_x', 0, 100, value=1) tau_x = sigma_x**-2 mu_y = pm.Normal('mu_y', 0, 0.001, value=1) sigma_y = pm.Uniform('sigma_y', 0, 100, value=1) tau_y = sigma_y**-2 # Latent variable y = pm.Lognormal('y', mu_y, sigma_y, size=len(z_data)) @pm.observed def Z(value=z_data, mu=mu_x, tau=tau_x, y=y): # Likelihood for x (also latent, but fixed given y and z) return pm.normal_like(value-y, mu, tau)
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? I would use a latent variable approach, since that's what x an y are. However, its not clear that all four parameters would be identifiable in this case. It would be helpful if you had some prior info
27,992
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
I think there are a few approaches here. First Approach As far as I know, there is no way to use @deterministic or @stochastic (without the likelihood). An alternative way is to use the potentials class, which is like multiplying your likelihood by a factor. In this case, we should multiply by the pdf of a lognormal given $Z$ and $X$. import pymc as mc z = -1. #instead of 0 and 1, unknowns can be put here. For example: # mc.Normal( "x", unknown_mu, unknown_std ). X = mc.Normal( "x", 0, 1, value = -2. ) @mc.potential def Y( x =X, z = z): #similar to my comment above, you can place unknowns here in place of 1, 0.2. return mc.lognormal_like( z-x, 1, 0.2, ) mcmc = mc.MCMC( [X] ) mcmc.sample(20000,5000) Notice $Z$ is negative, so this must make $X$ negative too. And we observe this: By symmetry (since $Y = Z-X$) the posterior of $Y$ is similar: Z is a vector of observations If $Z$ is a vector of observations, then the potential function can be modified to look like: z = [2,3,4] #... X = mc.Normal( "x", 0, 1, value = -2., size = 3 ) @mc.potential def Y( x =X, Z = Z): return mc.lognormal_like( Z, 1, 0.2, ) To extend to more than two linear combinations, eg $Z = X_1 + X_2 + ... +X_N$, well to be continued. Second Approach A more specific approach is to notice that as $X$ is normal, we can think of this task as $Z = Y + \text{noise}$: import pymc as mc Z = -1 Y = mc.Lognormal( "y", 1, 0.2 ) obs = mc.Normal( "obs", 0, 1, value = Z, observed = True ) mcmc = mc.MCMC( [Y, obs] ) mcmc.sample( 20000,5000 ) Running this second version did give me some unstable results (was returned a handful incredibly large values )
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
I think there are a few approaches here. First Approach As far as I know, there is no way to use @deterministic or @stochastic (without the likelihood). An alternative way is to use the potentials cla
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? I think there are a few approaches here. First Approach As far as I know, there is no way to use @deterministic or @stochastic (without the likelihood). An alternative way is to use the potentials class, which is like multiplying your likelihood by a factor. In this case, we should multiply by the pdf of a lognormal given $Z$ and $X$. import pymc as mc z = -1. #instead of 0 and 1, unknowns can be put here. For example: # mc.Normal( "x", unknown_mu, unknown_std ). X = mc.Normal( "x", 0, 1, value = -2. ) @mc.potential def Y( x =X, z = z): #similar to my comment above, you can place unknowns here in place of 1, 0.2. return mc.lognormal_like( z-x, 1, 0.2, ) mcmc = mc.MCMC( [X] ) mcmc.sample(20000,5000) Notice $Z$ is negative, so this must make $X$ negative too. And we observe this: By symmetry (since $Y = Z-X$) the posterior of $Y$ is similar: Z is a vector of observations If $Z$ is a vector of observations, then the potential function can be modified to look like: z = [2,3,4] #... X = mc.Normal( "x", 0, 1, value = -2., size = 3 ) @mc.potential def Y( x =X, Z = Z): return mc.lognormal_like( Z, 1, 0.2, ) To extend to more than two linear combinations, eg $Z = X_1 + X_2 + ... +X_N$, well to be continued. Second Approach A more specific approach is to notice that as $X$ is normal, we can think of this task as $Z = Y + \text{noise}$: import pymc as mc Z = -1 Y = mc.Lognormal( "y", 1, 0.2 ) obs = mc.Normal( "obs", 0, 1, value = Z, observed = True ) mcmc = mc.MCMC( [Y, obs] ) mcmc.sample( 20000,5000 ) Running this second version did give me some unstable results (was returned a handful incredibly large values )
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? I think there are a few approaches here. First Approach As far as I know, there is no way to use @deterministic or @stochastic (without the likelihood). An alternative way is to use the potentials cla
27,993
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
Conceptually, to do Bayesian inference, one has to serve a conditional likelihood function, with specific pdf. In your case, you have to provide the actual joint distribution of (X,Y). Perhaps potential function can help but the idea is the same, the final entry point to do MCMC should be a specific log pdf. If X and Y are independent, then the sum of their pdfs is the convolution of the two pdfs. so Z ~ Normal(thetax)*logNormal(thetay). Maybe the convolution integral can be evaluated.
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution?
Conceptually, to do Bayesian inference, one has to serve a conditional likelihood function, with specific pdf. In your case, you have to provide the actual joint distribution of (X,Y). Perhaps potenti
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? Conceptually, to do Bayesian inference, one has to serve a conditional likelihood function, with specific pdf. In your case, you have to provide the actual joint distribution of (X,Y). Perhaps potential function can help but the idea is the same, the final entry point to do MCMC should be a specific log pdf. If X and Y are independent, then the sum of their pdfs is the convolution of the two pdfs. so Z ~ Normal(thetax)*logNormal(thetay). Maybe the convolution integral can be evaluated.
PyMC: how can I define a function of two stochastic variables, with no closed-form distribution? Conceptually, to do Bayesian inference, one has to serve a conditional likelihood function, with specific pdf. In your case, you have to provide the actual joint distribution of (X,Y). Perhaps potenti
27,994
Data mining techniques in Obama's campaign
That area is called microtargeting (if you would like to google for it). Campaigns are pretty secretive about their tools and procedures, so to my knowledge there is not that much published work except Hal Malchow's Political Targeting (2008) or Green & Gerber's (2008) Get out the Vote: How to Increase Voter Turnout (the latter deals more with social science aspects like what ads are effective and such). On more technical matters the literature is even scarcer, but see, e.g, Murray & Scime (2010), the Political Analysis paper by Imai & Strauss (2011) (postprint) or the recent Annals of Applied Statistics paper by us Rusch, Lee, Hornik, Jank & Zeileis (2013) (postprint). What they all have in common is that they make use of data mining techniques, mostly tree based. Murray & Scime use standard classification trees like CART. Rusch et al. use classification trees, logistic models and a hybrid of trees and logistic regression. They also use (among others) random forests, neural networks, support vector machines and Bayesian Additive Regression trees to compare with their tree hybrids, as is described in the rejoinder to the paper. Their hybrid trees performed on par with those other methods on their data sets and offer increased interpretability (we also share their code and data). Imai & Strauss is interesting insofar as they present a comprehensive decision theoretic framework for optimal campaign planning, not just tools for microtargeting as the others do. Thus they are very much focusing on aspects of operational research about how to get the most out of every dollar put into a the campaign. In the aspect of their framework where they employ statistical techniques for microtargeting and turnout estimation, they again rely on classification trees. So, there seems to be some consensus that the usage of tree based methods work well in this area.
Data mining techniques in Obama's campaign
That area is called microtargeting (if you would like to google for it). Campaigns are pretty secretive about their tools and procedures, so to my knowledge there is not that much published work excep
Data mining techniques in Obama's campaign That area is called microtargeting (if you would like to google for it). Campaigns are pretty secretive about their tools and procedures, so to my knowledge there is not that much published work except Hal Malchow's Political Targeting (2008) or Green & Gerber's (2008) Get out the Vote: How to Increase Voter Turnout (the latter deals more with social science aspects like what ads are effective and such). On more technical matters the literature is even scarcer, but see, e.g, Murray & Scime (2010), the Political Analysis paper by Imai & Strauss (2011) (postprint) or the recent Annals of Applied Statistics paper by us Rusch, Lee, Hornik, Jank & Zeileis (2013) (postprint). What they all have in common is that they make use of data mining techniques, mostly tree based. Murray & Scime use standard classification trees like CART. Rusch et al. use classification trees, logistic models and a hybrid of trees and logistic regression. They also use (among others) random forests, neural networks, support vector machines and Bayesian Additive Regression trees to compare with their tree hybrids, as is described in the rejoinder to the paper. Their hybrid trees performed on par with those other methods on their data sets and offer increased interpretability (we also share their code and data). Imai & Strauss is interesting insofar as they present a comprehensive decision theoretic framework for optimal campaign planning, not just tools for microtargeting as the others do. Thus they are very much focusing on aspects of operational research about how to get the most out of every dollar put into a the campaign. In the aspect of their framework where they employ statistical techniques for microtargeting and turnout estimation, they again rely on classification trees. So, there seems to be some consensus that the usage of tree based methods work well in this area.
Data mining techniques in Obama's campaign That area is called microtargeting (if you would like to google for it). Campaigns are pretty secretive about their tools and procedures, so to my knowledge there is not that much published work excep
27,995
Experiment design: Can unbalanced dataset be better than balanced?
How this is answered depends on how the data will be analyzed. But there are general principles that can be applied. The main idea is to identify what is under experimental control and vary that to optimize the ability of the statistical test to detect an effect if one indeed exists. To illustrate how this sort of thing is worked out, let's consider the classic textbook situation evoked by the description in the question: a t-test to compare the treatment mean $\bar{X}_1$ to the control mean $\bar{X}_2$, assuming (at least approximately) equal variances $\sigma^2$ in the two groups. In this situation we can control the numbers of subjects placed into the control group ($n_1$ of them) and the treatment group ($n_2$ of them). The strategy is to do this in a way that maximizes the chances of detecting a difference between the group means in the population, if such a difference really exists. Along the way we are usually willing to make reasonable simplifying assumptions, expecting that the optimal design attained in such idealized circumstances will be close to optimal under true experimental conditions. Watch for those assumptions in the following analysis. In the notation of the linked Wikipedia article, the $t$ statistic is $$t = \frac{1}{\sqrt{1/n_1 + 1/n_2}}\frac{\bar{X}_1 - \bar{X}_2}{s_{12}}$$ where $s_1^2$ and $s_2^2$ are the usual variance estimates in the two groups and $$s_{12}^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n-2}$$ estimates the common variance $\sigma^2$. For assumed normal distributions within the groups and/or for sufficiently large $n_1$ and $n_2$, it is at least approximately the case that: $\bar{X}_1 - \bar{X}_2$, $(n_1-1)s_1^2/\sigma^2$, and $(n_2-1)s_2^2/\sigma^2$ are independent; the former has a Normal distribution with zero mean; and the latter have $\chi^2$ distributions with $n_1-1$ and $n_2-1$ degrees of freedom, respectively. Whence the sum $(n_1-1)s_1^2 + (n_2-1)s_2^2$ will be $\sigma^2$ times a $\chi^2(n-2)$ distribution no matter what values $n_1$ and $n_2$ may take. Accordingly, when the null hypothesis is true, $t$ will have a Student $t$ distribution with $n-2$ degrees of freedom regardless of how we choose $n_1$ and $n_2$. Our choice of $n_1$ and $n_2$ will not affect that. However, when the null hypothesis is false, the ratio $$\frac{\bar{X}_1 - \bar{X}_2}{s_{12}}$$ will tend to be near the standardized effect size--the size of the difference between the groups relative to $\sigma^2$. In computing $t$, that difference is magnified by the coefficient $$\frac{1}{\sqrt{1/n_1 + 1/n_2}}.$$ We obtain the greatest power to detect a difference when the magnification is as great as possible. Given that $n_1+n_2=n,$ the "experimental factor" term $$\frac{1}{\sqrt{1/n_1 + 1/n_2}} = \sqrt{\frac{1}{n}\left(n^2/4 - (n_1 - n/2)^2\right)}$$ obviously is maximized by making $(n_1-n/2)^2$ as small as possible (giving a maximum value close to $\sqrt{n}/2$.) Consequently, the best power to detect a difference between the treatment and control means with this test is attained when the subjects are divided as evenly as possible (but randomly) between the groups. As a further demonstration of this result, I simulated the case where $n=16$, with Normal distributions within each group, using four standardized effect sizes $\delta = 0, 1/2, 1,$ and $3/2$. By running $N=5000$ replications of each experiment for all reasonable values of $n_1$ (ranging from $2$ through $n/2=8$), a Monte-Carlo distribution of $t$ was obtained. The following plots show how its mean value corresponds closely to the experimental factor except when there is no effect ($\delta=0$), exactly as claimed. Because the real world is rarely as nicely behaved as a computer simulation, let's give our analysis a hard time by simulating highly skewed distributions within the groups (which is hard for a $t$ test to deal with). To this end I used a Gamma$(2, 1)$ distribution for the control group and a Gamma$(2, 1+\delta/2)$ distribution for the treatment group. Here are the results: Although these plots are not as perfect as the preceding ones, they come close enough despite the substantial departures from the simplifying assumptions ($n$ is small and the data are nowhere near Normally distributed). Thus we can trust the conclusion that the experiment will be most powerful when subjects are close to equally divided between treatment and control groups. For those who would like to study this further, here is the R code. # # Perform a t-test to compare the first n1 values to the next n2 values of `x`. # f <- function(x, n1, n2) t.test(x[1:n1], x[1:n2+n1], var.equal=TRUE)$statistic # # Perform a full simulation for n1 = 2, 3, ..., n/2 for a given standardized # effect size `delta`. `N` Monte-Carlo iterations will be performed. # sim <- function(delta, n, N=500) { z <- sapply(2:floor(n/2), function(n1) { apply(matrix(rnorm(N*n, mean=c(rep(delta, n1), rep(0, n-n1))), nrow=N, byrow=TRUE), 1, f, n1=n1, n2=n-n1) }) apply(z, 2, mean) # Average t-statistics, one for each of the `N` iterations. } # # Run simulations for various deltas and compare to the "experimental factor," # here stored in `x`. # n <- 16 # Total number of subjects in the experiment x <- sapply(2:floor(n/2), function(x) 1/sqrt(1/x + 1/(n-x))) par(mfrow=c(1, 4)) for (delta in c(0, 1/2, 1, 3/2)) { y <- sim(delta, n) # N=5000 was used for the figure in the text plot(x, y, pch=19, col="Red", main=paste("Delta =", delta)), xlab="Experimental factor", ylab="Mean simulated t statistic") abline(lm(y ~ x)) # Least squares fit for comparison } For the second simulation, the call to rnorm within sim was replaced by rgamma(N*n, shape=2, scale=c(rep(1+delta/2, n1), rep(1, n-n1)))
Experiment design: Can unbalanced dataset be better than balanced?
How this is answered depends on how the data will be analyzed. But there are general principles that can be applied. The main idea is to identify what is under experimental control and vary that to
Experiment design: Can unbalanced dataset be better than balanced? How this is answered depends on how the data will be analyzed. But there are general principles that can be applied. The main idea is to identify what is under experimental control and vary that to optimize the ability of the statistical test to detect an effect if one indeed exists. To illustrate how this sort of thing is worked out, let's consider the classic textbook situation evoked by the description in the question: a t-test to compare the treatment mean $\bar{X}_1$ to the control mean $\bar{X}_2$, assuming (at least approximately) equal variances $\sigma^2$ in the two groups. In this situation we can control the numbers of subjects placed into the control group ($n_1$ of them) and the treatment group ($n_2$ of them). The strategy is to do this in a way that maximizes the chances of detecting a difference between the group means in the population, if such a difference really exists. Along the way we are usually willing to make reasonable simplifying assumptions, expecting that the optimal design attained in such idealized circumstances will be close to optimal under true experimental conditions. Watch for those assumptions in the following analysis. In the notation of the linked Wikipedia article, the $t$ statistic is $$t = \frac{1}{\sqrt{1/n_1 + 1/n_2}}\frac{\bar{X}_1 - \bar{X}_2}{s_{12}}$$ where $s_1^2$ and $s_2^2$ are the usual variance estimates in the two groups and $$s_{12}^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n-2}$$ estimates the common variance $\sigma^2$. For assumed normal distributions within the groups and/or for sufficiently large $n_1$ and $n_2$, it is at least approximately the case that: $\bar{X}_1 - \bar{X}_2$, $(n_1-1)s_1^2/\sigma^2$, and $(n_2-1)s_2^2/\sigma^2$ are independent; the former has a Normal distribution with zero mean; and the latter have $\chi^2$ distributions with $n_1-1$ and $n_2-1$ degrees of freedom, respectively. Whence the sum $(n_1-1)s_1^2 + (n_2-1)s_2^2$ will be $\sigma^2$ times a $\chi^2(n-2)$ distribution no matter what values $n_1$ and $n_2$ may take. Accordingly, when the null hypothesis is true, $t$ will have a Student $t$ distribution with $n-2$ degrees of freedom regardless of how we choose $n_1$ and $n_2$. Our choice of $n_1$ and $n_2$ will not affect that. However, when the null hypothesis is false, the ratio $$\frac{\bar{X}_1 - \bar{X}_2}{s_{12}}$$ will tend to be near the standardized effect size--the size of the difference between the groups relative to $\sigma^2$. In computing $t$, that difference is magnified by the coefficient $$\frac{1}{\sqrt{1/n_1 + 1/n_2}}.$$ We obtain the greatest power to detect a difference when the magnification is as great as possible. Given that $n_1+n_2=n,$ the "experimental factor" term $$\frac{1}{\sqrt{1/n_1 + 1/n_2}} = \sqrt{\frac{1}{n}\left(n^2/4 - (n_1 - n/2)^2\right)}$$ obviously is maximized by making $(n_1-n/2)^2$ as small as possible (giving a maximum value close to $\sqrt{n}/2$.) Consequently, the best power to detect a difference between the treatment and control means with this test is attained when the subjects are divided as evenly as possible (but randomly) between the groups. As a further demonstration of this result, I simulated the case where $n=16$, with Normal distributions within each group, using four standardized effect sizes $\delta = 0, 1/2, 1,$ and $3/2$. By running $N=5000$ replications of each experiment for all reasonable values of $n_1$ (ranging from $2$ through $n/2=8$), a Monte-Carlo distribution of $t$ was obtained. The following plots show how its mean value corresponds closely to the experimental factor except when there is no effect ($\delta=0$), exactly as claimed. Because the real world is rarely as nicely behaved as a computer simulation, let's give our analysis a hard time by simulating highly skewed distributions within the groups (which is hard for a $t$ test to deal with). To this end I used a Gamma$(2, 1)$ distribution for the control group and a Gamma$(2, 1+\delta/2)$ distribution for the treatment group. Here are the results: Although these plots are not as perfect as the preceding ones, they come close enough despite the substantial departures from the simplifying assumptions ($n$ is small and the data are nowhere near Normally distributed). Thus we can trust the conclusion that the experiment will be most powerful when subjects are close to equally divided between treatment and control groups. For those who would like to study this further, here is the R code. # # Perform a t-test to compare the first n1 values to the next n2 values of `x`. # f <- function(x, n1, n2) t.test(x[1:n1], x[1:n2+n1], var.equal=TRUE)$statistic # # Perform a full simulation for n1 = 2, 3, ..., n/2 for a given standardized # effect size `delta`. `N` Monte-Carlo iterations will be performed. # sim <- function(delta, n, N=500) { z <- sapply(2:floor(n/2), function(n1) { apply(matrix(rnorm(N*n, mean=c(rep(delta, n1), rep(0, n-n1))), nrow=N, byrow=TRUE), 1, f, n1=n1, n2=n-n1) }) apply(z, 2, mean) # Average t-statistics, one for each of the `N` iterations. } # # Run simulations for various deltas and compare to the "experimental factor," # here stored in `x`. # n <- 16 # Total number of subjects in the experiment x <- sapply(2:floor(n/2), function(x) 1/sqrt(1/x + 1/(n-x))) par(mfrow=c(1, 4)) for (delta in c(0, 1/2, 1, 3/2)) { y <- sim(delta, n) # N=5000 was used for the figure in the text plot(x, y, pch=19, col="Red", main=paste("Delta =", delta)), xlab="Experimental factor", ylab="Mean simulated t statistic") abline(lm(y ~ x)) # Least squares fit for comparison } For the second simulation, the call to rnorm within sim was replaced by rgamma(N*n, shape=2, scale=c(rep(1+delta/2, n1), rep(1, n-n1)))
Experiment design: Can unbalanced dataset be better than balanced? How this is answered depends on how the data will be analyzed. But there are general principles that can be applied. The main idea is to identify what is under experimental control and vary that to
27,996
Experiment design: Can unbalanced dataset be better than balanced?
Even if the case subjects are more interesting, I would recommend using balanced group sizes. Reason: AN(C)OVA and other analysis methods are more robust when group sizes are equal. See, e.g., Glass, Peckham and Sanders (1972).
Experiment design: Can unbalanced dataset be better than balanced?
Even if the case subjects are more interesting, I would recommend using balanced group sizes. Reason: AN(C)OVA and other analysis methods are more robust when group sizes are equal. See, e.g., Glass,
Experiment design: Can unbalanced dataset be better than balanced? Even if the case subjects are more interesting, I would recommend using balanced group sizes. Reason: AN(C)OVA and other analysis methods are more robust when group sizes are equal. See, e.g., Glass, Peckham and Sanders (1972).
Experiment design: Can unbalanced dataset be better than balanced? Even if the case subjects are more interesting, I would recommend using balanced group sizes. Reason: AN(C)OVA and other analysis methods are more robust when group sizes are equal. See, e.g., Glass,
27,997
Experiment design: Can unbalanced dataset be better than balanced?
As you surmised, your level of interest in accurately describing the treatment vs. control groups is relevant, as is the prior information you have on each. Perhaps you have a theoretical reason to expect higher variance in the treatment group... that could encourage you to make the treatment group larger. One of the downsides of an unbalanced design is that it is harder to explain.
Experiment design: Can unbalanced dataset be better than balanced?
As you surmised, your level of interest in accurately describing the treatment vs. control groups is relevant, as is the prior information you have on each. Perhaps you have a theoretical reason to e
Experiment design: Can unbalanced dataset be better than balanced? As you surmised, your level of interest in accurately describing the treatment vs. control groups is relevant, as is the prior information you have on each. Perhaps you have a theoretical reason to expect higher variance in the treatment group... that could encourage you to make the treatment group larger. One of the downsides of an unbalanced design is that it is harder to explain.
Experiment design: Can unbalanced dataset be better than balanced? As you surmised, your level of interest in accurately describing the treatment vs. control groups is relevant, as is the prior information you have on each. Perhaps you have a theoretical reason to e
27,998
Where did the term "learn a model" come from
I suspect its origins are in the artificial neural network research community, where the neural network can be thought of as learning a model of the data via modification of synaptic weights in a similar manner to that which occurs in the human brain as we ourselves learn from experience. My research career started out in artificial neural networks so I sometimes use the phrase. Perhaps it makes more sense if you think of the model as being encoded in the parameters of the model, rather than the equation, in the same way that a mental model is not an identifiable physical component of the brain as much as a set of parameter settings for some of our neurons. Note that there is no implication that a mental model is necessarily correct either!
Where did the term "learn a model" come from
I suspect its origins are in the artificial neural network research community, where the neural network can be thought of as learning a model of the data via modification of synaptic weights in a simi
Where did the term "learn a model" come from I suspect its origins are in the artificial neural network research community, where the neural network can be thought of as learning a model of the data via modification of synaptic weights in a similar manner to that which occurs in the human brain as we ourselves learn from experience. My research career started out in artificial neural networks so I sometimes use the phrase. Perhaps it makes more sense if you think of the model as being encoded in the parameters of the model, rather than the equation, in the same way that a mental model is not an identifiable physical component of the brain as much as a set of parameter settings for some of our neurons. Note that there is no implication that a mental model is necessarily correct either!
Where did the term "learn a model" come from I suspect its origins are in the artificial neural network research community, where the neural network can be thought of as learning a model of the data via modification of synaptic weights in a simi
27,999
Where did the term "learn a model" come from
The term is quite old in artifical intelligence. Turing devoted a long section on "Learning Machines" in his 1950 Computing Machinery and Intelligence paper in Mind, and qualitatively sketches out supervised learning. Rosenblatt's original paper: The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain paper from 1958 talks extensively about a "Mathematical Model of Learning". Here the perceptron was a "model of learning"; models were not "learned". The Pitts and McCullough 1943 paper - the original "neural networks" paper - wasn't really concerned with learning, more how one could construct a logical calculus (like a Hilbert or Gentzen system, but I think they refer to Russell/Whitehead) which could perform inference. I think it was the "Perceptrons" paper which introduced a numerical, as opposed to symbolic notion of learning in this tradition. Is it possible for a machine to learn how to play chess just from examples? Yes. Does it have a model for chess playing? Yes. Is it the optimal model (assuming there is one)? Almost certainly not. In plain English I've "learned chess" if I can play chess ok - or maybe pretty well. It doesn't mean I'm the optimal chess player. This is the sense in which Turing was describing "learning" when he discussed learning chess in his paper. I'm very inconsistent with what term I use. So (for instance) for learning-in-the-limit I'd say "identify", for SVM-learning I'd say "train", but for MCMC-"learning" I'd say "optimize". And e.g. I just call regression "regression".
Where did the term "learn a model" come from
The term is quite old in artifical intelligence. Turing devoted a long section on "Learning Machines" in his 1950 Computing Machinery and Intelligence paper in Mind, and qualitatively sketches out su
Where did the term "learn a model" come from The term is quite old in artifical intelligence. Turing devoted a long section on "Learning Machines" in his 1950 Computing Machinery and Intelligence paper in Mind, and qualitatively sketches out supervised learning. Rosenblatt's original paper: The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain paper from 1958 talks extensively about a "Mathematical Model of Learning". Here the perceptron was a "model of learning"; models were not "learned". The Pitts and McCullough 1943 paper - the original "neural networks" paper - wasn't really concerned with learning, more how one could construct a logical calculus (like a Hilbert or Gentzen system, but I think they refer to Russell/Whitehead) which could perform inference. I think it was the "Perceptrons" paper which introduced a numerical, as opposed to symbolic notion of learning in this tradition. Is it possible for a machine to learn how to play chess just from examples? Yes. Does it have a model for chess playing? Yes. Is it the optimal model (assuming there is one)? Almost certainly not. In plain English I've "learned chess" if I can play chess ok - or maybe pretty well. It doesn't mean I'm the optimal chess player. This is the sense in which Turing was describing "learning" when he discussed learning chess in his paper. I'm very inconsistent with what term I use. So (for instance) for learning-in-the-limit I'd say "identify", for SVM-learning I'd say "train", but for MCMC-"learning" I'd say "optimize". And e.g. I just call regression "regression".
Where did the term "learn a model" come from The term is quite old in artifical intelligence. Turing devoted a long section on "Learning Machines" in his 1950 Computing Machinery and Intelligence paper in Mind, and qualitatively sketches out su
28,000
Where did the term "learn a model" come from
As a researcher in Bioplausible Machine Learning, I strongly agree that "no model is correct but some are useful", and in fact models and formalisms have the strong failing as used by authors who talk about optimization of the problem, when what they are doing is optimizing a model, i.e. exploring its parameter space and finding a local or hopefully global optimum. This is not in general an optimum for the real problem. While the originator of a model normally uses the correct terminology, and exposes all the assumptions, most users gloss over the assumptions, which most often are known not to hold, and also use less precise language about "learning" and "optimization" and "parameterization". I think this optimal parameterization of a model is what people would mean in Machine Learning, particularly in supervised Machine Learning, although I can't say I've heard "learn a model" a lot - but it does occur, and whereas the person trains the model, the computer learns the parameters of the model. Even in unsupervised learning the "learning" is most often simply parameterization of a model, and hopefully "learning a model" is thus optimal parameterization of a model (although often different ways of searching the parameter space find different solutions even though they can be proven to optimize the same thing). I would indeed rather use "training a model" for this purpose rather than personifying the computer and creating the ambiguity between discovering a new model and parameterizing an old one. In fact, most of my research is about learning the model in terms of discovering a better model, or a more computationally and cognitively/biologically/ecologically plausible model.
Where did the term "learn a model" come from
As a researcher in Bioplausible Machine Learning, I strongly agree that "no model is correct but some are useful", and in fact models and formalisms have the strong failing as used by authors who talk
Where did the term "learn a model" come from As a researcher in Bioplausible Machine Learning, I strongly agree that "no model is correct but some are useful", and in fact models and formalisms have the strong failing as used by authors who talk about optimization of the problem, when what they are doing is optimizing a model, i.e. exploring its parameter space and finding a local or hopefully global optimum. This is not in general an optimum for the real problem. While the originator of a model normally uses the correct terminology, and exposes all the assumptions, most users gloss over the assumptions, which most often are known not to hold, and also use less precise language about "learning" and "optimization" and "parameterization". I think this optimal parameterization of a model is what people would mean in Machine Learning, particularly in supervised Machine Learning, although I can't say I've heard "learn a model" a lot - but it does occur, and whereas the person trains the model, the computer learns the parameters of the model. Even in unsupervised learning the "learning" is most often simply parameterization of a model, and hopefully "learning a model" is thus optimal parameterization of a model (although often different ways of searching the parameter space find different solutions even though they can be proven to optimize the same thing). I would indeed rather use "training a model" for this purpose rather than personifying the computer and creating the ambiguity between discovering a new model and parameterizing an old one. In fact, most of my research is about learning the model in terms of discovering a better model, or a more computationally and cognitively/biologically/ecologically plausible model.
Where did the term "learn a model" come from As a researcher in Bioplausible Machine Learning, I strongly agree that "no model is correct but some are useful", and in fact models and formalisms have the strong failing as used by authors who talk