Posts

Excel Range vs Array

Image
As I worked more with LAMBDA, I discovered that Excel functions that take range parameters do not work with arrays . If a function's parameter mentions "range", you can be sure this will not work with arrays. Some examples of these functions are COUNTIF , COUNTIFS , AVERAGEIF , AVERAGEIFS , SUMIF , and SUMIFS . The other that I am aware of is RANK.AVG . What is an Array? A Range represents a cell, a row, a column, a selection of selections, or blocks of cells. Range will always have an address, for example B2:B5 is a range of values stored in a column. An Array is a set of values constructed using a formula. For example  ={1;2;3;4} is column of values. =VSTACK(1,2,3,4) is also a column of values. The FORMULATEXT function would return #N/A in a range cell that contains only values. On the other hand it returns the formula used to construct the array values. An array can be displayed on a spreadsheet. When displayed on the spreadsheet, the values can be referred by the

Creating One Sample Mean Test with LAMBDA

Image
Suppose you visited a village. The village elders claims to possess a secret elixir that makes their children grower taller! You are aware of the national 12-year old  average height is 150cm. And you could measure the village's 12-year old children's height. Plotting the village's children's height gives you a distribution like in the graph above. At first glance the village's children does seem taller than the national average. Is the village's children really taller? Is the distribution significantly different? One Sample Mean Test A one sample mean test compares a sample distribution's mean against a target value. It is similar to the one proportion test but the sample data is continuous, giving a normal distribution curve instead of a yes/no binary result. We write the Null Hypothesis as the sample mean equal to the population mean. `H_0: mu = mu_0` And the Alternative Hypothesis as the sample mean not equal to the population mean. `H_1: mu != mu_0` We

It's a Red Panda! *Shocker* but I am used to calling myself DC Racoon

Image
I discovered that the above stuff toy represents a Red Panda ! *Shocker* I thought it was a racoon. However I am in good company. I read that scientists in the past also thought the red panda was a racoon. As it turned out, the red panda is no where near the racoon family. If anything it is closer to that of a cat! While DC Red Panda or DC Panda sounds cool, I am too used to calling myself DC Racoon. Next time, I'll check with my child first.

Creating Two Proportion Test with LAMBDA

Image
What is Two Proportion Test Two Proportion Test compares one proportion to determine if it is equal to, lesser than or greater than another proportion. Unlike One Proportion Test , the size of the second proportion can have an effect on the results. Suppose you gave flavour X ice-cream to two groups of people. In the first group 65 of 100 people liked flavour X, and in the second group 90 of 130 people liked. Did this two groups responded similarly? We write our hypothesis statement as the "Did the two groups responded similiarly to flavour X ice-cream?" The Null and Alternative Hypothesis is written as: `H_0: p_1 = p_2` `H_1: p_1 != p_2` where `p_1` is proportion from group 1 `p_2` is proportion from group 2 Test Statistics The equation of a two proportion test statistics is written as `z = (p_1 - p_2) / sqrt( hat p(1 - hat p)(1/n_1 + 1 / n_2) )` where the pooled variance `hat p = (o_1 + o_2)/(n_1 + n_2)` and `p_1 = o_1 / n_1` is the proportion from group 1 `p_2 = o_2 / n_2

Creating One Proportion Test with LAMBDA

Image
What is One Proportion Test The One Proportion Test compares a sample proportion against a target proportion. For example, you observe that you get 6 heads when you flip a coin 10 times (sample). You expect with a fair coin, the probability of getting heads is 0.5 or 50% of the time (target). The One Proportion Test allows you to assess if the flipped coin is a fair coin based on the observations. The test proves this by statistically comparing the observed proportion of heads to number of flipping 0.6, is equal to the expected proportion 0.5. We write the Null Hypothesis as the observed proportion is equal to the hypothesised proportion. `H_0: p = p_0` And the Alternative Hypothesis is that the observed proportion is not equal to the hypothesised proportion (two-tailed test). `H_1: p != p_0` We could also test if the observed proportion is greater than the hypothesised proportion (left tail test). `H_0: p >= p_0` Or if the observed proportion is less than the hypothesised proporti

Hypothesis Testing

Image
Hypothesis testing is the analysis of data using statistical methods, to assess if a statement (hypothesis) is true. Typically you form two possibilities: a Null Hypothesis proposing that there is NO statistical significance in the given set of observations, and an Alternative Hypothesis that contradicts the Null Hypothesis. The Alternative Hypothesis is what you are trying to test. If the finding is statistically significant, you reject the Null Hypothesis. Suppose you want to find out if a group of 11-year old children has the same average weight as the population's 11-year old children (problem). You would state the Null Hypothesis and the Alternative Hypothesis as: `H_0: bar x = mu` `H_1: bar x != mu` where `bar x` is the sample group mean weight of 11-year old children `mu` is the population mean weight of 11-year old children Pictorially you are trying to prove this. Two-Tailed and One-Tailed The above scenario is called a Two-Tailed test, as we are proving equality. A One-T

Z Score, Z Statistics and P value

What is a Z score or Z statistics? Firstly Z score and Z statistics is the same. It is a measure of the number of standard deviations a data point is away from the sample mean. Mathematically this is written as: `z = (x - bar x) / sigma` where `z` = Z score or Z statistics `x` = data point `bar x` = sample mean `sigma` = sample standard deviation The mathematical equation of standard deviation is: `sigma = sqrt((x - bar x)/N)` where `N` = number of sample points What is P value? The P value is the probability that a particular value assuming the null hypothesis is true. Conventionally a P value of less than 0.05 is grounds for rejecting the null hypothesis. For the lower-tailed test or left-tailed test, the P value is expressed as: `P = Pr(TS <=ts | H_0) = cdf(ts)` And for the upper-tailed test or right-tailed test, the P value is expressed as: `P=Pr(TS>=ts |H_0) = 1-cdf(ts)` And the P value for a two-tailed test is `P = 2 xx min{Pr(TS<=ts |H_0), Pr(TS>