My first question.  I have searched &quot;effect size&quot; and followed the links on &quot;similar questions&quot;.  There may well be a wealth of relevant info there, or even the answer; my problem is that the discussion is way over my level of understanding.  Apologies if that means this is in some way duplicate. I'll try to describe what I'm trying to work out.  If the answer is already floating around, it'd be wonderful if someone could point me at it and dumb it down into language that a stats layman can follow! I've got data about the population of England, carved up into Local Authority areas (i.e. geographically) - there are 127 rows of info. For each row, I have:  the size of the population of interest (over 60s) a score 1-5 for deprivation a categorization of policy 1, 2 or 3. (1 is &quot;no policy&quot;; 2 is &quot;accessible for free&quot;; 3 is &quot;pay for access&quot;) a frequency rate of an occurrence/100,000 of the population of interest.  So a record might be: Bristol; 2; 1; 1,300 Happy to post all 127 rows if helpful! Some excellent help elsewhere has got me to the point where I know that the groups by policy are significantly different (p&lt;0.01).  So policy makes a difference.  This used ANOVA (but not by me!).  I also know that deprivation correlates somewhat with frequency (R^2=0.25 apparently) What I'm trying to get is how much of the total variation in the whole dataset is accounted for by policy, how much by deprivation, and how much by other factors as yet unspecified. I want to be able to say &quot;Group 1 is different to group 2 and group 3, and the policy accounts for X% of the overall variation, whilst deprivation accounts for Y%&quot;. My knowledge is very limited.  I can calculate weighted means...but I'm not even clear if my standard deviation calculations are right, because the populations are all different sizes. I'd be very grateful for any help you might be able to offer, but it will need to be at a &quot;add/subtract&quot; level of complexity - I don't have the foundation tools to follow anything sophisticated unless it's broken down to basics. Thanks again
92298
I have just read a paper in which the authors carried out a multiple regression with two predictors. The overall r-squared value was 0.65. They provided a table which split the r-squared between the two predictors. The table looked like this:              rsquared beta    df pvalue whole model     0.65   NA  2, 9  0.008 predictor 1     0.38 1.01 1, 10  0.002 predictor 2     0.27 0.65 1, 10  0.030   In this model, ran in R using the mtcars dataset, the overall r-squared value is 0.76.  summary(lm(mpg ~ drat + wt, mtcars))  Call: lm(formula = mpg ~ drat + wt, data = mtcars)  Residuals:     Min      1Q  Median      3Q     Max  -5.4159 -2.0452  0.0136  1.7704  6.7466   Coefficients:             Estimate Std. Error t value Pr(&gt;|t|)     (Intercept)   30.290      7.318   4.139 0.000274 *** drat           1.442      1.459   0.989 0.330854     wt            -4.783      0.797  -6.001 1.59e-06 *** --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1  Residual standard error: 3.047 on 29 degrees of freedom Multiple R-squared:  0.7609,    Adjusted R-squared:  0.7444  F-statistic: 46.14 on 2 and 29 DF,  p-value: 9.761e-10   How can I split the r-squared value between the two predictor variables?
19631
I have one independent variable with two levels: Gender (Male and Female), and dependent variables will be composed of three test scores: Impulsivity, Assertiveness, and Social Desirability.  My research question is to know the difference between males and females on all three test scores.  I'm confused about the kind of analysis I should use, and whether or not I've actually labelled the dependent and independent variables correctly? Should I be using a MANOVA?
95093
I'm a newbie at stats, so if I make any mistaken assumptions here please tell me.  There's a population N of people. (For example N can be 1,000,000.) Some of the people are redheads. I take a sample n of people (say 10,) and find that j of them are redheads.  What can I say about the general proportion of redheads in the population? I mean, my best approximation is probably j/n, but what would be the standard deviation of that approximation?  By the way, what is the accepted term for this?
44347
I am trying to understand the . When I try to apply it to the following two samples of data I am unable to understand how to interpret the results.  Let's say sample 1 is ${0, 5, 7, 12, 11, 17}$ and sample 2 is ${10 ,15 ,17 ,22 ,21 ,27}$. Here sample 2 $=$ sample 1 $+\ 10$ as you can see.  Both have the same standard deviation $\sigma_{2} = \sigma_{1}= 5.95539$ but $\mu_{2}=18.67$ and $\mu_{1}=8.66667$.  Now the coefficient of variation ${\sigma}/{\mu}$ will be different. For sample 2 it will be less than for sample 1. But how do I interpret that result? In terms of variance both are the same; only their means are different. So what's the use of the coefficient of variation here? It's just misleading me, or maybe I am unable to interpret the results.
47949
Like, I don't get it. In regression, we say  $$Y_i = a + bX_i + \epsilon$$ where $X_i$ is just a real number for each observation $i$,  and in analysis of variance with two groups, we say $$Y_i = a + bX_i + \epsilon$$ where $X_i$ is again just a real number, but this time either 0 (group 1) or 1 (group 2), so a is mean of group 1, and a+b is mean of group 2.  But despite the interpretation, the model is exactly the same. So why do people split it up into regression and anova? the model is the same?
2496
If you have unequal sample sizes in cells, then the order in which you enter model terms  changes your results for sequential or Type I SS. The first variable to enter the model is allocated its unique variance plus the variance shared by the second variable, then the second variable gets only its unique variance.  If you have two predictor variables, say whether you get a drug or placebo and whether you think you get a drug or placebo, and you want to look at their relationship to some symptom, and you want to ignore the effect of knowing whether you got the drug, because all you are really interested in is the relationship between getting the drug and the symptom, then which predictor variable would enter into the model first?  I have been reading answers to questions on this site, and sometimes people are told to enter what is thought to be the most important variable first, but then in ANCOVA situations they are told to enter the covariate first. Is this contradictory advice, or is the covariate really the most important variable?  Additionally, would an ANCOVA always use Type I SS?  Thanks for your help.
48691
I have results from 5 surveys each 2 years apart and let us assume that no subjects are selected in more than one survey.  The sampling method used in these surveys are biased and I have sampling weights calculated(with respect to the population) for each data point in each study.  The question is, how would I be able to combine the 5 datasets and have the weights recalculated so as to obtain one giant dataset for analysis on this population?  Also, what should I do if subjects appear in more than one survey?   Updates/Further Elaboration:  thank you @user30523, here are some more infomation that might be useful:  Suppose I wish to find out the estimated distribution of height across the population using these 5 datasets.   In some data, younger people are oversampled because of the location where the survey are conducted. Let's assume the weights are calculated with respect to their age.   Eg. assuming 2% of the population are 15 years old, and the location of the survey is at a mall where 15-year-olds made up 5% of all shoppers, then sampling weight for an subject aged 15 in that survey would be calculated as 0.02 / 0.05 = 0.4. For simplicity, each person in the mall has equal chance of being surveyed and all participants complied when asked.  Given that 5 surveys are conducted in 5 different malls and each has their set of weights calculated in the same way, how would I then be able to combine all 5 datasets and recalculate the sampling weights?  P.S: I'm new to the topic on sampling weights so do correct me if I have made errors in the way I have calculated the weights.
108123
I would like to test for the difference of measures between genders. Repeated measures were carried out. What test would you suggest is best for this and what would be the degrees of freedom considering:      there is no change in conditions uneven group size (females=6 and males=4) missing repeated measures (8 levels) between 3 subjects**     The Data Explained There are 6 females and 4 males = 10 subjects in total 28 Repeated measures (events or levels) per person with no change in condition except time.  28 x 10 subjects = 280 repeated measures (rm)  At each level there should be:   19 ordinal independent variables (IV)   from which  7 continuous dependent variables (DV) are recorded  19 (IV) x 7 (DV) =  133 measures (one level per subject) 133 x 28 rm per subject = 3724 measures (all levels per subject) 3724 x 10 subjects  = 37240 total measures of data   Missing data (from the expected totals as described above)  8 levels of data between 3 subjects are missing:  2 events (rm) missing for 2 males  4 events (rm) missing for 1 female 280 rm - 8 rm  = 272 rm in total 8 missing rm x 133 measures per rm = 1064 total measures missing  37240 - 1064 = 36176 total measures of data
9302
Following on from my earlier posts, as far as I can understand, if I have three correlation coefficients, I will have to test them in pairs to see if there is a significant difference among them.   This means that I would have to use Fishers transformation to work out the z score of r and then the p value of z (which the recommended calculators in the earlier posts do, thankfully) and then ascertain if the p value is higher or lower than my alpha value (0.05) for each pair.  i.e. If 21 to 30 years olds is Age Group 1, 31 to 40 years is Age Group 2, and 41 to 50 years is Age Group 2, my comparison of the correlations between their shopping habits and weight loss would be:   Group 1 vs. Group 2 Group 1 vs. Group 3 Group 2 vs. Group 3   Instead of doing three separate calculations, is there a way to do all these calculations in a single step?
74523
It seems that for calculation of Cohen's $d$ (an estimate of effect size), you should use the difference in means (or in one-sample case, from baseline), divided by $SD$, if that information is available: $$ \frac{\bar X_1 - \bar X_2}{SD} $$ However, when you only have the $t$-statistic and the degrees of freedom ($\rm df$) available, what is the formula for Cohen's $d$? In the one-sample / paired-sample case, it's intuitive how to derive $d$ from $t$, since $t$ is calculated as the difference in means over standard error: $$ t = \frac{\bar X_1 - \bar X_2}{SE} = \frac{\bar X_1 - \bar X_2}{\frac{SD}{\sqrt{N}}} $$ so $d$ equals: $$ d = \frac{\bar X_1 - \bar X_2}{SD} = \frac{t}{\sqrt{N}} $$ And that's what you find in online articles such as . But for independent samples, the equation is listed instead as: $$ d = \frac{2t}{\sqrt{\rm df}}  $$ as seen , or even:  $$ d = t \sqrt{\frac 2 N} $$ So where does the "$2$" come from? Is it related to the formula for pooled SD?
62396
I have been reading Geoff Cumming's 2008 paper  [~200 citations in Google Scholar] -- and  am confused by one of its central claims. This is one in the series of papers where Cumming argues against $p$-values and in favour of confidence intervals; my question, however, is not about this debate and only concerns one specific claim about $p$-values.   Let me quote from the abstract:     This article shows that, if an initial   experiment results in two-tailed $p= .05$, there is an $80\%$   chance the one-tailed $p$-value from a replication will fall in   the interval $(.00008, .44)$, a $10\%$ chance that $p &lt; .00008$,   and fully a $10\%$ chance that $p &gt; .44$. Remarkably, the   interval—termed a $p$ interval—is this wide however large   the sample size.   Cumming claims that this "$p$ interval", and in fact the whole distribution of $p$-values that one would obtain when replicating the original experiment (with the same fixed sample size), depend only on the original $p$-value $p_\mathrm{obt}$ and do not depend on the true effect size, power, sample size, or anything else:     [...] the probability distribution of $p$ can be derived without   knowing or assuming a value for $\delta$ (or power). [...] We do not assume any prior knowledge   about $\delta$, and we use only the information $M_\mathrm{diff}$ [observed between-group difference] gives about $\delta$ as   the basis for the calculation for a given $p_\mathrm{obt}$ of the distribution of   $p$ and of $p$ intervals.      $\quad\quad\quad$    I am confused by this because to me it seems that the distribution of $p$-values strongly depends on power, whereas the original $p_\mathrm{obt}$ on its own does not give any information about it. It might be that the true effect size is $\delta=0$ and then the distribution is uniform; or maybe the true effect size is huge and then we should expect mostly very small $p$-values. Of course one can start with assuming some prior over possible effect sizes and integrate over it, but Cumming seems to claim that this is not what he is doing.  Question: What exactly is going on here?    Note that this topic is related to this question:  with an excellent answer by @whuber. Cumming has a paper on this topic to:  -- but that one is clear and unproblematic.  I also note that Cumming's claim is repeated several times in the 2015 Nature Methods paper  that some of you might have come across (it already has ~100 citations in Google Scholar):     [...] there will be substantial variation in the $P$ value of repeated experiments. In reality, experiments are rarely repeated; we do not know how different the next $P$ might be. But it is likely that it could be very different. For example, regardless of the statistical power of an experiment, if a single replicate returns a $P$ value of $0.05$, there is an $80\%$ chance that a repeat experiment would return a $P$ value between $0$ and $0.44$ (and a $20\%$ change [sic] that $P$ would be even larger).   (Note, by the way, how, irrespective of whether Cumming's statement is correct or not, Nature Methods paper quotes it inaccurately: according to Cumming, it's only $10\%$ probability above $0.44$. And yes, the paper does say "20% change". Pfff.)
6266
If I have a dataset with $n$ observations and $p$ variables (dimensions), and generally $n$ is small ($n=12-16$), and $p$ may range from small ($p = 4-10$) to perhaps much larger ($p= 30-50$).  I remember learning that $n$ should be much larger than $p$ in order to run principal component analysis (PCA) or factor analysis (FA), but it seems like this may not be so in my data. Note that for my purposes I am rarely interested in any principal components past PC2.   Questions:   What are the rules of thumb for minimum sample size when PCA is OK to use, and when it is not? Is it ever OK to use the first few PCs even if $n=p$ or $n&lt;p$?  Are there any references on this? Does it matter if your main goal is to use PC1 and possibly PC2 either:    simply graphically, or  as synthetic variable then used in regression?
41294
Here is the article that motivated this question:   I liked this article, and it nicely demonstrates the concept of “controlling for other variables” (IQ, career, income, age, etc) in order to best isolate the true relationship between just the 2 variables in question.    Can you explain to me how you actually control for variables on a typical data set?      E.g., if you have 2 people with the same impatience level and BMI, but different incomes, how do you treat these data?  Do you categorize them into different subgroups that do have similar income, patience, and BMI?  But, eventually there are dozens of variables to control for (IQ, career, income, age, etc)  How do you then aggregate these (potentially) 100’s of subgroups?  In fact, I have a feeling this approach is barking up the wrong tree, now that I’ve verbalized it.  Thanks for shedding any light on something I've meant to get to the bottom of for a few years now...!
44208
Suppose you have a series of n trials, where the probability of success  in each trial is p.  The distribution of the number of successful trials follows a Binomial distribution with parameters (n, p).  The mean is given by np whereas the variance is np(1-p).  So far so good: this is pretty mundane Stats 101 stuff.  But suppose now that I only knew about the successful trials, and had no knowledge of the total number n of trials, which is the variable I am interested in estimating.  For example, I knew I had 100 successful trials, where each trial had a 0.1 chance of success.  Is there a known probability distribution that describes the probable outcomes for n, the total number of trials?  Estimating the mean is easy: if m is the number of successes, then it's just m/p.  But what about variance and other measures?  What if each success had a different (but known) chance of success?  Suppose I had the following records:   success1 (with p=0.1) success2 (with p=0.1) success3 (with p=0.2)   Again, a good estimation of the total number of trials can be obtained by simply summing 1/p for each successful trial.  In this case that number  is 10+10+5=25.  But what about variance and other measures?
19341
The study I am analysing is a pre-and-post intervention questionnaire of students' views before and after studying a module.  The questionnaire was distributed in three different geographical locations, where the same instructor was delivering the same module at different times within one year.  The scale used is a 5-point Likert scale (which I can also convert into a binary agree/disagree variable if needed).   The surveys are anonymous, so I can't match the sample.  However, in some samples, all the students answered both the pre-and-post questionnaires (same $N$) and in others this was different (different $N$).   Overall I have 343 respondents for the pre-intervention questionnaire, and 378 respondents for the post-intervention questionnaire.  However in two of the three locations, I have equal pre and post intervention responses, but they are anonymous: so they are not independent, but not matched. (This is a weakness of the data, and will be reported in the results).  My questions are: a) Given the sample size, would running an unpaired t-test on the full sample be appropriate? Or should I be going for a non-parametric test?  b) Can the subsamples where there are equal respondents (i.e. all students answered both pre-and-post questionnaires) be analysed as non-independent non-matched samples?
54481
How is it that lowering the number of frequence,$n$ by $1$ in the for formula for Population and Sample Variance account for the discrepency of using sample rather than population.  I mean how is dividing the whole expression by $n-1$ in sample variance better than dividing by $n$?  I am referring to the formula $$s^2=\frac{\sum_{i=1}^{n}({x_i-x_{avg}})^2}{n-1}$$ more accurate than $$s^2=\frac{\sum_{i=1}^{n}({x_i-x_{avg}})^2}{n}$$  Thank You.
107887
Accidentally posted this in stackoverflow, so reposting here. I have a repeated-measures design experiment. Each subject took part in some experimental conditions, each one associated with several events. Normally I would analyse this with an ANOVA by grouping across all events, but I want to include those individual events in the model, and also account for subject effects. Example data import numpy as np import pandas as pd  condition = ['A']*3 + ['B']*3 + ['C']*3 events = list(range(1, len(condition)+1)) subject = [1]*len(events)   data = {     'subject':subject+[i+1 for i in subject]+[i+2 for i in subject],     'events':events*3,     'condition':condition*3     }  df = pd.DataFrame(data) np.random.seed(1) df['y'] = [np.random.randint(0,2) for i in range(df.shape[0])]  print(df)   print(df.groupby(['subject', 'condition'], as_index=False)['y'].mean())  So the full data:    subject  events  condition   y 1   1   A   1 1   2   A   1 1   3   A   0 1   4   B   0 1   5   B   1 1   6   B   1 1   7   C   1 1   8   C   1 1   9   C   1 2   1   A   0 2   2   A   0 2   3   A   1 2   4   B   0 2   5   B   1 2   6   B   1 2   7   C   0 2   8   C   0 2   9   C   1 3   1   A   0 3   2   A   0 3   3   A   0 3   4   B   1 3   5   B   0 3   6   B   0 3   7   C   1 3   8   C   0 3   9   C   0   And the grouped data: subject condition   y 1   A   0.666666667 1   B   0.666666667 1   C   1 2   A   0.333333333 2   B   0.666666667 2   C   0.333333333 3   A   0 3   B   0.333333333 3   C   0.333333333  I would like to know how to do a multi-level (logistic regression?) model to account for events and subjects as well as the condition as factors. It's a bit strange to me because when we group together and analyse the means we can use a standard ANOVA, but when we retain the full dataset and analyse it the outcome measure is of course binary, meaning we should use some sort of logistic regression. Is this correct? And if so, is this possible given the within-subjects design? If so, how do we achieve this in python (or R)?