Let's suppose I am surveying $n$ democratic citizens about whether they will vote for Candidate A or Candidate B. Let's suppose my survey yields $x$ for Candidate A and $n-x$ for Candidate B, $x \in \Bbb Z_+$. Let $p$ denote the fraction of voters who prefer Candidate A. Let's suppose I estimate $p$ by using $\hat{p} = \frac{x}{n}$. Suppose my variance is $\hat{p}(1-\hat{p})$. Suppose $H_0 : p = 0.5$ and $H_A : p \ne 0.5$.   For $n=400, x = 215$, the estimator $\hat{p} = \frac{43}{80}$ is and a 95% confidence interval of $$\frac{43}{80} - 1.96 \frac{\sqrt{1591}}{1000}&lt;\hat{p} &lt; \frac{43}{80} + 1.96 \frac{\sqrt{1591}}{1000}$$   $$0.48864 &lt; \hat{p} &lt; 0.58656$$  My Question  Does this confidence interval tell me anything about the validity of my null hypothesis? That is, can I decide whether to accept or reject my null hypothesis based on $0.48864 &lt; \hat{p} &lt; 0.58656$?
63348
I have read about   with some commentators suggesting that hypothesis testing should not be used. Some commentators suggest that confidence intervals should be used instead.    What is the difference between confidence intervals and hypothesis testing? Explanation with reference and examples would be appreciated.
26416
I want to compute whether it is more probable that a patient has a disease or the contrary. If I am given the following information:  $$P(\mathrm{disease})= 0.008$$ $$P(+|\mathrm{disease})= 0.98$$ $$P(-|¬\mathrm{disease})= 0.97$$  To find the answer would it be correct to do the following:  $$\frac{0.008 \times 0.98}{(0.008 \times 0.98)+(0.992 \times 0.03)}=0.2085$$  and then calculate $1-0.2085$ to see which is larger?
42859
According to the Wikipedia article on  the sample SD   $$s = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (x_i - \overline{x})^2}$$  is a biased estimator of the SD of the population. It states that $E(\sqrt{s^2}) \neq \sqrt{E(s^2)}$.   NB. Random variables are independent and each $x_{i} \sim N(\mu,\sigma^{2})$   My question is two-fold:   What is the proof of the biasedness? How does one compute the expectation of the sample standard deviation    My knowledge of maths/stats is only intermediate.
52646
I am using the Kolmogorov&ndash;Smirnov two-sample test to compare distributions, and I noticed a $p$-value is frequently reported as the test statistic. How is this $p$-value determined? I know it's the probability of obtaining a result at least as large as the one obtained, but how is this $p$-value determined given this is a nonparametric test? That is, we can't assume Gaussian fluctuations in the distribution and compute the $p$-value using a $t$-test.  Thanks!
53102
I want to use bootstrapping to estimate confidence intervals for estimated parameters from a panel dataset with N=250 firms and T=50 month. The estimation of parameters is computationally expensive (few days of computation) due to use of Kalman filtering and complex nonlinear estimation. Therefore drawing (with replacement) B (in hundreds or more) samples of M=N=250 firms from original sample and estimating the parameters B times is computationally infeasible, even though this is the basic method for bootstrapping.   So I am considering using smaller M (e.g. 10) for bootstrap samples (rather than the full size of N=250), drawn randomly with replacement from original firms, and then scale the bootstrap-estimated covariance matrix of model parameters with $\frac{1}{\frac{N}{M}}$ (in example above by 1/25) to calculate the covariance matrix for the model parameters estimated on the full sample.   Desired confidence intervals can then be approximated based on normality assumption, or empirical ones for smaller sample scaled using a similar procedure (e.g. scaled down by a factor of $\frac{1}{\sqrt{\frac{N}{M}}}$.   Does this workaround make sense? Are there theoretical results to justify this? Any alternatives to tackle this challenge?
11222
Suppose   $$ (a,b) $$   is a $(1-\alpha)$ level confidence interval for a parameter $\theta$. Suppose $\eta$ is a monotone invertible transformation. Then, is   $$ \left (\eta(a), \eta(b) \right ) $$   a $(1-\alpha)$ level confidence interval for $\eta(\theta)$? Assume the parameter and the confidence interval endpoints are all real numbers.   The answer seems intuitively to be "Yes" for similar reasons to why you can transform random variables do things like, if $Y = g(X)$, then  $$ P( Y \leq y ) = P( g(X) \leq y ) = P(X \leq g^{-1}(y) ) $$   Might also be related to the continuous mapping theorem, as applied to MLEs.   This is not homework and is coming up in the context of whether or not I can nake a 95% for the log odds, then back-transform it and call it a 95% for the probability.   Thanks
14737
Very often, we use data which are derived from some measurements. These measurements usually have a confidence measure associated which tells how reliable the measure is, or how confident we are about the measure. For example, we often see some confidence intervals associated with various polls.  I was wondering if there is a theory or algebra about combining multiple measurements and the resulting confidence measure of the aggregate. For example, if I measure $X$ with a confidence interval $\pm x\%$, $Y$ with confidence interval $\pm y\%$, what can I say about the confidence interval of $X+Y$? Similarly, what can we say about the confidence intervals for other operators?  Is there an algebra for this?
21116
Let ${Y_1,...,Y_n}$ be independent random variables and $Y_i$~$N(\beta x_i, 1)$ where $x_1,...,x_n$ are fixed known constants, and $\beta$ is an unknown parameter.  I'm looking to find the p-value or rejection region for  the test  $$H_0: \beta=0 \quad \text{vs} \quad H_1:\beta\ne0$$  The Likelihood Ratio Test statistic $\Lambda$ is  $$e^{-1/2\left(\frac{\sum_{i=1}^n y_i x_i}{\sum_{i=1}^n x_i^2}\right)^2\sum_{i=1}^n x_i^2}$$  I have already asked a similar question with $H_1: \beta&gt;0$ here: .   After setting $\Lambda &lt; k$ I'm left with $\sum x_iy_i$ after removing constants to the right, which is the same as my previous question. How will finding the p-value or rejection region for this test differ?
1439
The denominator of the (unbiased) variance estimator is $n-1$ as there are $n$ observations and only one parameter is being estimated.  $$ \mathbb{V}\left(X\right)=\frac{\sum_{i=1}^{n}\left(X_{i}-\overline{X}\right)^{2}}{n-1} $$  By the same token I wonder why shouldn't the denominator of covariance be $n-2$ when two parameters are being estimated?  $$ \mathbb{Cov}\left(X, Y\right)=\frac{\sum_{i=1}^{n}\left(X_{i}-\overline{X}\right)\left(Y_{i}-\overline{Y}\right)}{n-1} $$
7936
What is a good rule of thumb for how to choose the question for the null hypothesis. For instance, if I want to check if the hypothesis B is true, should I use B as the null, B as the alternative hypothesis, or NOT B as the null? I hope the question is clear. I know that it has something to do with the error I want to minimize (Type I?), but I keep forgetting how it goes, because I don't have a clear intuition built for it. Thanks.
83631
I have the following problem: two groups A and B.  The proportions of married and single are ($p_1$) and ($p_2$) respectively, and the standard deviations ($s_1$) and ($s_2$). The sample consists of  ($n_1$) A and  ($n_2$) B observations.  Now I want to test whether the proportions are equal. I use the following formula to compute the z-statistic:  z = $abs(p_1 - p_2) / \sqrt{ \frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2} }$  and test the hypothesis: h0: $p_1 \neq p_2$  An alternative approach I tried is to estimate the t-value based on the standard deviations (hence just comparing means), that is by the formula (assuming unequal variances):  t = $abs(p_1-p_2)/\sqrt{ s_1^2/n_1 + s_2^2/n_2 }$  My question are:    do you agree with my approach or; should it be two-sided or one-sided?   Thank you.
65052
I want to perform a two sample test, to see whether theirs means are equals. One of the sample is rather big (#60000 values) and represents the scores of a whole population. This population is partitioned in small classes of less that 1000 people. The other sample of the test is a subsamble of the former. It corresponds to people of the same class. So, each time, there is less than 1000 values in it. I have no idea about the variances, so I'd think of using Welch's t-test.  But I'm concerned regarding the independence hypothesis: can it be valid, considering that the second sample is negligible when compared to the overall population?
30846
Suppose I have a random variable $X$ ~ $Unif(0,\theta)$ where I want to estimate $\theta$. I draw a sample $X_1,...,X_n$.One way is to get a point estimate using e.g.  maximum likelihood estimation via the sufficient statistic $X_{(n)}$.  However, suppose I want a 95% confidence interval of sorts on the value of $\theta$, how should I construct one?  The reason why I am interested in confidence interval is because of the following issue, which is actually my main question (the above prelude on confidence interval is just a suggestion on possible approach). So actually my sample came with some noise, in a sense that I actually observe $X_1+E_1,...,X_n+E_n$ where $E_i$~$N(0,\sigma_i^2)$ independently from each other and from the $X$'s. How should I make some form of statistical estimation about $\theta$? I would prefer some form of confidence estimate.
99912
I have 10 iid r.v. with Bernoulli distribution with $X_{i} = 1$ for a positive result. I'm given $\sum_{i=1}^{10} X_i= 1$ and need to find a two-sided 99% confidence interval for $\theta$.   So $\alpha = 0.01$ and $z_{\alpha/2} = 2.575$ based on the standard normal distribution. The variance is given $\sigma^{2} = \hat{\theta}(1-\hat{\theta})$, with $\theta = 1/10$ from the given information. The confidence interval is: $$ \left(\hat{\theta} - z_{\alpha/2}\frac{\sigma}{\sqrt{n}}, \hat{\theta} + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right) $$ so my confidence interval is $(-0.143, 0.343)$. Have I messed up a calculation somewhere? I'm not sure what this confidence interval tells me ... perhaps that the sample size is too small to really get any useful information on $\theta$?
11953
Let $X_1, \ldots, X_{n_X}$ and $Y_1, \ldots, Y_{n_Y}$ be $n_x$ and $n_Y$ iid observations from two independent Bernoulli populations with probabilities of success $p_X$ and $p_Y$. Define the statistics $T_X = \sum_{i=1}^{n_X}X_i$ and $T_Y = \sum_{i=1}^{n_Y}Y_i$. I am testing the hypothesis:  $$ H_0 : p_X = p_Y \ \ \ \text{and} \ \ \ H_1 : p_X \neq p_Y $$  Consider the test statistic:  $$ T = \dfrac{\hat{p}_X-\hat{p}_Y}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_X}+\frac{1}{n_Y}\right)}} $$  where $\hat{p}_X = \frac{T_X}{n_X}$ and $\hat{p}_Y = \frac{T_Y}{n_Y}$, and $\hat{p} = \frac{T_X+T_Y}{n_X+n_Y}$.   I would like to derive the asymptotic distribution of $T$ under $H_0$ as both $n_X$ and $n_Y$ go to infinity. My works is as follows: By the asymptotic properties of the MLE:  $$ \sqrt{n_X}(\hat{p}_X-p_X) \to_{D}N(0,p_X(1-p_X)) $$  and  $$ \sqrt{n_Y}(\hat{p}_Y-p_Y) \to_{D}N(0,p_Y(1-p_Y)) $$  I would like to find the distribution of $\hat{p}_X-\hat{p}_Y$, but am not sure how. In general two "in distribution" results are not additive. That is, it is genreally NOT the case that $X_n+Y_n \to_{D} X+Y$. Does anyone have any ideas?  I know in general that under the null:  $$ T = \dfrac{\hat{p}_X-\hat{p}_Y}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_X}+\frac{1}{n_Y}\right)}} \to_D N(0,1) $$
10047
Using the inference of mean as an example, the null and alternative hypothesis could be  $$H_0: \mu \le 0 \Leftrightarrow H_1: \mu &gt; 0$$  It is often argued that this makes the calculation of the $p$-value (or critical region) easier, but from my understanding the $p$-value is $P(\bar{X} &gt; 0|H_0) \stackrel{\color{red}{?}}{=} \sup_{\theta \in H_0} P(\bar{X} &gt; 0 | \theta )$. Since I'm taking its supremum, the $p$-value doesn't change regardless of whether the equality sign is included. The same result goes for the critical region. However, I'm not sure if my understanding is correct, and my doubt is marked with a red question mark above.  Anyway, I wonder if it's correct (I know that would be unconventional, though) to write  $$H_0: \mu &lt; 0 \Leftrightarrow H_1: \mu \ge 0$$  If that's OK, what about its $p$-value and critical region? If that's not OK, I would be really surprised, because in that way we are changing the question ("Is $\mu$ less than or equal to zero?") to something different ("Is $\mu$ less than zero?")
107948
I am trying to solve the following question:     Player A won 17 out of 25 games while player B won 8 out of 20 - is   there a significant difference between both ratios?   The thing to do in R that comes to mind is the following:  &gt; prop.test(c(17,8),c(25,20),correct=FALSE)      2-sample test for equality of proportions without continuity correction  data:  c(17, 8) out of c(25, 20) X-squared = 3.528, df = 1, p-value = 0.06034 alternative hypothesis: two.sided 95 percent confidence interval:  -0.002016956  0.562016956 sample estimates: prop 1 prop 2    0.68   0.40    So this test says that the difference is not significant at the 95% confidence level.  Because we know that prop.test() is only using an approximation I want to make things more exact by using an exact binomial test - and I do it both ways around:  &gt; binom.test(x=17,n=25,p=8/20)      Exact binomial test  data:  17 and 25 number of successes = 17, number of trials = 25, p-value = 0.006693 alternative hypothesis: true probability of success is not equal to 0.4 95 percent confidence interval:  0.4649993 0.8505046 sample estimates: probability of success                    0.68   &gt; binom.test(x=8,n=20,p=17/25)      Exact binomial test  data:  8 and 20 number of successes = 8, number of trials = 20, p-value = 0.01377 alternative hypothesis: true probability of success is not equal to 0.68 95 percent confidence interval:  0.1911901 0.6394574 sample estimates: probability of success                     0.4    Now this is strange, isn't it? The p-values are totally different each time! In both cases now the results are (highly) significant but the p-values seem to jump around rather haphazardly.  My questions   Why are the p-values that different each time? How to perform an exact two sample proportions binomial test in R correctly?