Posts

Showing posts with the label Statistics

The homicide rate in Scotland fell last year to 99 from 115 the year before. Is this reported change really networthy?

The homicide rate in Scotland fell last year to 99 from 115 the year before. Is this reported change really networthy? -Consider the homicides as independent; a Poisson distribution can be a reasonable model -95% interval for the true homicide rate is 115±2×115−−−√=115±22=[94,137]115±2×115=115±22=[94,137] -It's not reasonable to conclude that there has been a reduction in the true rate

Geiger counter records 100 radioactive decays in 5 minutes. Find an approximate 95% interval for the number of decays per hour.

Geiger counter records 100 radioactive decays in 5 minutes. Find an approximate 95% interval for the number of decays per hour. -Start by finding a 95% interval for radioactive decay in a 5 minutes period -The estimated standard deviation is 100−−−√=10100=10 -So the interval is λ^±1.96×10=100±19.6λ^±1.96×10=100±19.6 -So, per hour: [964.8,1435.2]

You are running for office and your pollster polled hundred people. 56 of them claimed they will vote for you. Can you relax?

You are running for office and your pollster polled hundred people. 56 of them claimed they will vote for you. Can you relax? Quick: - Intervals take the form p±z×1n×p×(1−p)−−−−−−−−−−−−−√p±z×1n×p×(1−p) - We know that p(1−p)p(1−p) is maximized at 1212 and z=1.96z=1.96 is the relevant quantile for a 95% confidence interval - So: p±1n√p±1n is a quick estimate for pp - Here: 1100√=0.11100=0.1 so 95% of the intervals would be [46,66][46,66] - It's not enough!

Consider the number of people that show up at a bus station is Poisson with mean 2.5/h. What is the probability that at most three people show up in a four hour period?

Consider the number of people that show up at a bus station is Poisson with mean 2.5/h. What is the probability that at most three people show up in a four hour period? X\~Poisson(λ=2.5×t)X\~Poisson(λ=2.5×t) R code: ppois(3,lambda=2.5*4) ## [1] 0.01033605

A random variable X is normal with mean 1020 and standard deviation 50. Calculate P(X>1200)

A random variable X is normal with mean 1020 and standard deviation 50. Calculate P(X>1200) X\~N(1020,50)X\~N(1020,50) Our new quantile: z=1200−102050=3.6z=1200−102050=3.6 R code: pnorm(3.6,lower.tail=F) ## [1] 0.0001591086

You roll a biased coin (p(head)=0.8) five times. What's the probability of getting three or more heads?

You roll a biased coin (p(head)=0.8) five times. What's the probability of getting three or more heads? 5 trials, p=0.8 P("3ormoreheads")=(35)×0.83×0.8×0.22+(41)×0.84×0.21+(55)∗0.85∗0.20=0.94

Infection rates at a hospital above a 1 infection per 100 person days at risk are considered high. An hospital had 10 infections over the last 1787 person days at risk. Give the p-value of the correct one-sided test of whether the hospital is below the standard

Infection rates at a hospital above a 1 infection per 100 person days at risk are considered high. An hospital had 10 infections over the last 1787 person days at risk. Give the p-value of the correct one-sided test of whether the hospital is below the standard One-sided test, assume a Poisson distribution Ho: lambda=0.01 ; H1:lambda>0.01 R code: ppois(10,1787*0.01) ## [1] 0.03237153

An HIV test has a sensitivity of 99.7% and a specificity of 98.5%. A subject from a population of prevalence 0.1% receives a positive test result. What is the precision of the test (i.e the probability he is HIV positive)?

An HIV test has a sensitivity of 99.7% and a specificity of 98.5%. A subject from a population of prevalence 0.1% receives a positive test result. What is the precision of the test (i.e the probability he is HIV positive)? Bayes rule: P(Actu+|Pred+)=P(Pred+|Actu+)×P(Actu+)P(Pred+|Actu+)×P(Actu+)+P(Pred+|Actu−)P(Actu−)P(Actu+|Pred+)=P(Pred+|Actu+)×P(Actu+)P(Pred+|Actu+)×P(Actu+)+P(Pred+|Actu−)P(Actu−) We have: sensitivity×prevalencesensitivity×prevalence+(1−specificity)×(1−prevalence)=0.997×0.0010.997×0.001+0.15×0.999=0.62

What is A/B testing?

What is A/B testing? -Two-sample hypothesis testing -Randomized experiments with two variants: A and B -A: control; B: variation -User-experience design: identify changes to web pages that increase clicks on a banner -Current website: control; NULL hypothesis -New version: variation; alternative hypothesis

What are confounding variables?

What are confounding variables? -Extraneous variable in a statistical model that correlates directly or inversely with both the dependent and the independent variable -A spurious relationship is a perceived relationship between an independent variable and a dependent variable that has been estimated incorrectly -The estimate fails to account for the confounding factor -See Question 18 about root cause analysis

How do you control for biases?

How do you control for biases? -Choose a representative sample, preferably by a random method -Choose an adequate size of sample -Identify all confounding factors if possible -Identify sources of bias and include them as additional predictors in statistical analyses -Use randomization: by randomly recruiting or assigning subjects in a study, all our experimental groups have an equal chance of being influenced by the same bias Notes: - Randomization: in randomized control trials, research participants are assigned by chance, rather than by choice to either the experimental group or the control group. - Random sampling: obtaining data that is representative of the population of interest

When you sample, what bias are you inflicting?

When you sample, what bias are you inflicting? Selection bias: - An online survey about computer use is likely to attract people more interested in technology than in typical Under coverage bias: - Sample too few observations from a segment of population Survivorship bias: - Observations at the end of the study are a non-random set of those present at the beginning of the investigation - In finance and economics: the tendency for failed companies to be excluded from performance studies because they no longer exist

How do you calculate needed sample size?

How do you calculate needed sample size? Estimate a population mean: - General formula is ME=t×Sn√ME=t×Sn or ME=z×sn√ME=z×sn - MEME is the desired margin of error - tt is the t score or z score that we need to use to calculate our confidence interval - ss is the standard deviation Example: we would like to start a study to estimate the average internet usage of households in one week for our business plan. How many households must we randomly select to be 95% sure that the sample mean is within 1minute from the true mean of the population? A previous survey of household usage has shown a standard deviation of 6.95 minutes. -Z score corresponding to a 95% interval: 1.96 (97.5%, α2=0.025α2=0.025) -s=6.95s=6.95 -n=(z×sME)2=(1.96×6.95)2=13.622=186n=(z×sME)2=(1.96×6.95)2=13.622=186 Estimate a proportion: - Similar: ME=z×p(1−p)n−−−−−√ME=z×p(1−p)n Example: a professor in Harvard wants to determine the proportion of students who support gay marriage. She asks "how larg...

What is the Law of Large Numbers?

What is the Law of Large Numbers? -A theorem that describes the result of performing the same experiment a large number of times -Forms the basis of frequency-style thinking -It says that the sample mean, the sample variance and the sample standard deviation converge to what they are trying to estimate -Example: roll a dice, expected value is 3.5. For a large number of experiments, the average converges to 3.5

Given two fair dices, what is the probability of getting scores that sum to 4? to 8?

Given two fair dices, what is the probability of getting scores that sum to 4? to 8? -Total: 36 combinations -Of these, 3 involve a score of 4: (1,3), (3,1), (2,2) -So: 336=112336=112 -Considering a score of 8: (2,6), (3,5), (4,4), (6,2), (5,3) -So: 536

Give an example where the median is a better measure than the mean

Give an example where the median is a better measure than the mean When data is skewed

What is root cause analysis? How to identify a cause vs. a correlation? Give examples

What is root cause analysis? How to identify a cause vs. a correlation? Give examples Root cause analysis: - Method of problem solving used for identifying the root causes or faults of a problem - A factor is considered a root cause if removal of it prevents the final undesirable event from recurring Identify a cause vs. a correlation: - Correlation: statistical measure that describes the size and direction of a relationship between two or more variables. A correlation between two variables doesn't imply that the change in one variable is the cause of the change in the values of the other variable - Causation: indicates that one event is the result of the occurrence of the other event; there is a causal relationship between the two events - Differences between the two types of relationships are easy to identify, but establishing a cause and effect is difficult Example: sleeping with one's shoes on is strongly correlated with waking up with a headache. Correlatio...

Give examples of data that does not have a Gaussian distribution, nor log-normal.

Give examples of data that does not have a Gaussian distribution, nor log-normal. Allocation of wealth among individuals Values of oil reserves among oil fields (many small ones, a small number of large ones)

Define: quality assurance, six sigma.

Define: quality assurance, six sigma. Quality assurance: - A way of preventing mistakes or defects in manufacturing products or when delivering services to customers - In a machine learning context: anomaly detection Six sigma: - Set of techniques and tools for process improvement - 99.99966% of products are defect-free products (3.4 per 1 million) - 6 standard deviation from the process mean

What is: lift, KPI, robustness, model fitting, design of experiments, 80/20 rule?

What is: lift, KPI, robustness, model fitting, design of experiments, 80/20 rule? Lift: It's measure of performance of a targeting model (or a rule) at predicting or classifying cases as having an enhanced response (with respect to the population as a whole), measured against a random choice targeting model. Lift is simply: target response/average response. Suppose a population has an average response rate of 5% (mailing for instance). A certain model (or rule) has identified a segment with a response rate of 20%, then lift=20/5=4 Typically, the modeler seeks to divide the population into quantiles, and rank the quantiles by lift. He can then consider each quantile, and by weighing the predicted response rate against the cost, he can decide to market that quantile or not. "if we use the probability scores on customers, we can get 60% of the total responders we'd get mailing randomly by only mailing the top 30% of the scored customers". KPI: - Key perform...