Showing posts with label Statistics and probability. Show all posts
Showing posts with label Statistics and probability. Show all posts

Wednesday, November 12

Non-parametric tests

Non-parametric tests is useful if population is strongly non-normal, or sample size is too small to say so, or the data is only available on ordinal scale. Concern about quantities other than distribution parameters

Most of these nonparametric tests are specialized and unlikely to be tested in any detail on the CFA Level I exam.

Hypothesis Tests on the Variance

Hypothesis Tests on the Variance of a Normally Distributed Population

Hypothesis
H0: σ2 = σ02 , or σ2 ≥σ02 , or σ2 ≤ σ02
H1: σ2 ≠σ02 , or σ2 < σ02 , or σ2 > σ02


Test statistic : χ2 = (n – 1)*s2 / σ02
Where:
n = sample size
s2 = sample variance
σ02 = population variance from hypothesis


Sample variance s2 is referred to as the square sum of deviations between observed values and sample mean, degrees of freedom, or n – 1
Use Chi-squared test

Critical value comes from chi-squared table. It is an asymmetrical distribution and approaches to a normal distribution when degree of freedom increase, but bound below by zero, i.e. cannot be -ve.
{Look up df=n-1, p=significance for 1-sided test or p=significance/2 for 2-sided test}.



Equality of the Variances

Equality of the Variances of Two Normally Distributed Populations, where both Samples are Random and Independent

Hypothesis
H0: σ12 = σ22 , or σ12 ≥ σ22 , or σ12 ≤ σ22
H1: σ12 ≠σ22 , or σ12 < σ22 , or σ12 > σ22


Test statistic χ2= s12/s22

Use F-test

Critical value comes from F table.

{Look up df1=n1 - 1, df2 = n2 -1, p=significance}.,
F-distritubiton - right skewed, truncated at zero on left hand side,2 separate defree of freedom



Mean difference of two normally distributed populations

Paired comparisons test
In a paired-comparisons test, the two populations have some degree of correlation or co-movement, and the calculation of test statistic takes account of this correlation.

Use t-test based on the variable being the difference between pairs of sample values. {Look up df=n-1, p=significance}.

H0=Ud-Udo

Sample mean difference, denoted by d:


d = (1/n)(d1 + d2 + d3 …. + dn)

where:
n is the number of paired observations
di is the difference between ith observation in the sample.

Sample variance = (sum of all deviations from d )2/(n – 1)

Standard deviation (sd) = (Sample variance)1/2 = [(sum of all deviations from d )2/(n – 1)]1/2
Standard error = sd/(n)1/2.

Equality of the population means

Equality of the population means of two normally distributed populations based on independent random samples with equal variance and unequal variance

With equal variance
Hypothesis
H0: u1 = u2
H1: u1 ≠ u2


Where:
u1 is the population mean of population 1
u2 is the population mean of population 2

Use t-test
Test-statistic = (X1-X2)/Standard error

Standard error = (s2/n1 + s2/n2)1/2
Estimated population variance: s2 = [(n1-1)s12 – (n2-2)s22]/(n1+n2-2)

Critical value: look up df= n1+n2-2, p=significance

Where:

n1, n2 are samples sizes,
X1, X2 are sample means
s12, s22 are sample variances.

With unequal variance
Hypothesis
H0: u1 = u2
H1: u1 ≠ u2


Where:
u1 is the population mean of population 1
u2 is the population mean of population 2

Use t-test
Test-statistic = (X1-X2)/Standard error

Standard error = (s12/n1 + s22/n2)1/2

Critical value: look up df=[ (s12/n1+s22/n2)2]/{( s12/n1)2/n1+( s22/n2)2/n2}, p=significance

Where:
n1, n2 are samples sizes
X1, X2 are sample means
s12, s22 are sample variances



Normally distributed population with unknown variance and known variance

With unkown variance
Use t-test when the population variance is unknown. But, if the sample size is large (>=30), z-test may be used.

With known variance
Use z-test when the population

For details, please see the summary of the applications of z-statisitc and t-distribution

Relation between Confidence Intervals and Hypothesis Tests

Confidence intervals is used to estimate the population parameters as a function of "number of standard deviations away from the mean".

For example:

When we use z-statistic and with 95% confidence that our interval will include the population mean (μ), the interval is:

(-1.96)(standard error) < (sample mean) < (+1.96)(standard error).


Hypothesis tests is used to test the value of population parameters, either reject or not reject based on "number of standard deviations away from the mean".

For example:

To test the null hypothesis at the 5% significance level and use the z-statistic, not reject H0 if:

(-1.96)(standard error) < (sample mean) – (hypothesis population mean) < (+1.96)(standard error).

In Hypothesis testing, an interval within which the null will not be rejected is created, and we are 95% confident in this interval (i.e. there's a 5% chance of a type I error).

Step 7 - Make economic decision

The statistical result is one of many considerations for our final decision and might not be our investment decision as other factors such as risk tolerance of the client, volatility measures of the fund, transaction cost, etc. would also be taken into account.

Step 6 - Make statistical decision

If test statistic is greater than the critical value, then reject Ho and accept Ha.

If test statistic is smaller than the critical value, do not reject Ho {do NOT accept Ho either}.

Statistical decision does not automatically lead to economic decision, other factors may need to be considered.

Step 5 - Collect samples & Calculate test statistic

Collect the sample sand calcuate test statistic as:

Test statistic = (Sample statistic - Hypothesized value) / Standard error

Where: Standard error = Sample standard deviation / n1/2

Tuesday, November 11

Step 4. State decision rule

If test statistic is greater than the critical value, then reject Ho and accept Ha.

If test statistic is smaller than the critical value, do not reject Ho {do NOT accept Ho either}.

Statistical decision does not automatically lead to economic decision, other factors may need to be considered.

Step 3 - Specify significance level

Significance level
Denoted by α, or alpha, the significance level is the probability of making a type I error, or the probability that we will reject the null hypothesis when it is true. The common values used are 0.1, 0.05,and 0.01.

Type I error
Reject the null hypothesis when it is true.

Type II error
Fail to reject the null hypothesis when it is false.

Note:

  • Decrease in Type 1 error leads to increase in Type 2 error.

p-value :
Lowest significance level at which Ho can be rejected. Lower the p-value, stronger the evidence to reject H0. If p is smaller than α, reject H0; If p is greater than α, do not reject H0


Power of a test
It is the probability of correctly rejecting Ho when it is false. The formula is as:

Power of a test = 1 - probability of Type II error

Step 2 - Identify test statistic and its probability distribution

t-statistic:
It can be used when the population variance is unknown for large samples and small samples with normally distributed population. Comparing the t-statistic with critical value that comes from Student’s t table.

Critical value from Student’s t table

  • Look up df=n-1, p=significance for 1-sided test or p=significance/2 for 2-sided test

Note:

  • Since it is flatter, it's more difficult to reject H0 than using z-distribution.

z- statistic:
Same test statistic as t-test but critical value comes from normal distribution. It can be used when population is normally distributed with known variance; also for large samples with unknown variance.

Test statistic
A quantity taken from a sample that is used as the basis for testing the null hypothesis (rejecting or failing to reject the null).
Test statistic = (Sample statistic - Hypothesized value) / Standard error

Where: Standard error = Sample standard deviation / n1/2

My tips:
Be remembered some commonly used values from z-table:


Singificant level Critical Value (1-sided) Critical Value (2-sided)
0.10 1.280 1.645
0.05 1.645 1.960
0.01 2.330 2.575

Step 1 - State the hypothesis

Null Hypothesis (Ho):
The hypothesis to be tested and that you want to disprove it. It is initially regarded as true until gathering enough proof to either reject the null hypothesis, or fail to reject the null hypothesis. To support or reject the hypothesis but NOT to accept it.

Alternative Hypothesis (Ha):
A statement to be accepted if the null hypothesis is rejected.

Two-tailed tests:
Ho: Mean = X

One-tailed tests:
Ho: Mean ≤X, or Ho: Mean ≥ X

Hypothesis Testing

A hypothesis is a statement made about a population parameter. It involves the process to test whether the statement is true or not at certain confidence level.

7-Steps of hypothesis testing:

  1. State the hypothesis
  2. Identify test statistic and its probability distribution
  3. Specify significance level
  4. State decision rule
  5. Collect sample & Calculate test statistic
  6. Make statistical decision
  7. Make economic decision

Sample size and Potential mistake in sampling

Sample size
Increasing sample size benefits increase the confidence and reliability of the confidence interval, and thus the precision with which the population parameter can be estimated.

Factors that make larger sample size undesirable

  • Additional expenses
  • Population parameters have a tendency to change over time

Potential mistakes in sampling:
Data-snooping bias

  • Conclusions of one analyst are guided by conclusions of others.

Data-mining bias

  • Analyst keeps searching for patterns & trading rules until he find one that matches the data.

Sample selection bias

  • Refer to the tendency to exclude a certain part of a population simply because the data is not
    available.

Survivorship bias

  • Only funds/stocks that have survived to date are included. Big problem with stock indices.

Look-ahead bias

  • Based on information that do not actually exist at the time of analysis, just based on analyst’s
    assumptions.

Time-period bias

Conclusions may apply only to a specific time period and are not repeatable over longer
time periods. Either too short or too long.

t-statistic vs. z-statistic

t-statistic:
It can be used when the population variance is unknown for large samples and small samples with normally distributed population. Comparing the t-statistic with critical value that comes from Student’s t table.

Critical value from Student’s t table
Look up df=n-1, p=significance for 1-sided test or p=significance/2 for 2-sided test

t-distribution is less peaked and flater tails than normal distribution but move closer at higher degrees of freedom.

z-statistic:
It is based on the standard normal distribution and can be used when population is normally distributed with known variance; also for large samples with unknown variance.

Summary of the applications of z-statisitc and t-distribution



My tips:

  • Memorize the following commonly used values (from z-table):
  • Confidence Interval Reliability factor
    90% 1.65 ;
    95% 1.96 ; 99% 2.58
  • Be able to look up Student's table given degrees of freedom and probability in the right tail.




Reliability Factor, Degree of freedom (df)

Reliability factor
For small samples from a population with unknown variance, reliability factor should be looked up from Student's t table {Look up df=n-1, p=significance/2 = (1-confidence)/2}.

For known variance or for large samples, you can use z-statistic.

Degree of freedom (df)
Used to determine the reliability factor of the confidence interval with the t–distribution. Degrees of freedom = n – 1, where n is the sample size.

Points estimators vs. Confidence interval (CI)

Point estimators
Use single(sample) values to estimate population paramenters

Confidence interval
Estimate range of value within which the actual parameters will lie, given the probability of 1-α
. (1- α) is the degree of confidence.

Desirable properties of an estimate

  • Lack of bias, i.e. expected value of estimator = true value of population parameter)
  • Efficiency, i.e. low variance
  • Consistency, i.e. accuracy must increase with sample size

Construct Confidence Intervals
The general structure for a (1 – α) confidence interval is given by:
CI= Point estimate ± Reliability factor x Standard error.

Standard error of the sample mean

This refers to the standard deviation of the sample statistic.

If the population standard deviation (σ) is given, standard error is calculated as:

Standard error =σ/(n)1/2

If population standard deviation is unknown, the sample standard deviation (s) is used:

Standard error = s/(n)1/2