俺的学习笔记

Saturday, November 24, 2018

F Test

A “F Test” is a catch-all term for any test that uses the F-distribution. In most cases, when people talk about the F-Test, what they are actually talking about is The F-Test to Compare Two Variances.
However, the f-statistic is used in a variety of tests including regression analysis, the Chow test and the Scheffe Test (a post-hoc ANOVA test).
F分布:

参见这里(这个网站有几本ebook可以参考)。
F分布怎么算的不重要,因为它是用来做判断的界限值用,一般用查F-table表的方法得到F值即可。

F test指的是任何用F分布(来得到界限值)来进行的测试。但通常情况下说的F test指的是比较两个方差
其实F statistic可以用在很多test中,包括回归分析,Chow test,Scheffe Test和ANOVA test。

F-Test的做法

1.定义元假设(null hypothesis)和代替假设(alternative hypothesis)。
2.计算F值。F = s21 / s22
3.根据自由度(自由度=样本数减一)和显著水平(significance level),查表找出Fα。
4.比较计算的F值和Fα,如果F>Fα,就可以拒绝元假设。
详细点儿:
H0: (no change, no difference)
※有的书上对于upper one tailed定义为≦,lower one tailed定义为≧。
H1:
  Upper one tailed:
  Lower one tailed:
  Two tailed:
判断基准:
  Upper one tailed:
  Lower one tailed:
  Two tailed:
最简单的方法还是直接用工具(比如R)来做F test。因为计算F值是一个繁琐的过程。
教材里面说,F-test适用于正态分布(别的教科书似乎没有这么说)。
非正态分布的方差比较,教材里面说用levene test

F Test in R

F Test to Compare Two Variances

Description

Performs an F test to compare the variances of two samples from normal populations.

Usage

var.test(x, ...)

## Default S3 method:
var.test(x, y, ratio = 1,
         alternative = c("two.sided", "less", "greater"),
         conf.level = 0.95, ...)

## S3 method for class 'formula'
var.test(formula, data, subset, na.action, ...)

Arguments

x, ynumeric vectors of data values, or fitted linear model objects (inheriting from class "lm").
ratiothe hypothesized ratio of the population variances of x and y.
alternativea character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.
conf.levelconfidence level for the returned confidence interval.
formulaa formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding groups.
dataan optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken fromenvironment(formula).
subsetan optional vector specifying a subset of observations to be used.
na.actiona function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").
...further arguments to be passed to or from methods.

Details

The null hypothesis is that the ratio of the variances of the populations from which x and y were drawn, or in the data to which the linear models x and ywere fitted, is equal to ratio.

Value

A list with class "htest" containing the following components:
statisticthe value of the F test statistic.
parameterthe degrees of the freedom of the F distribution of the test statistic.
p.valuethe p-value of the test.
conf.inta confidence interval for the ratio of the population variances.
estimatethe ratio of the sample variances of x and y.
null.valuethe ratio of population variances under the null.
alternativea character string describing the alternative hypothesis.
methodthe character string "F test to compare two variances".
data.namea character string giving the names of the data.
http://www.socr.ucla.edu/applets.dir/f_table.html
https://www.statisticshowto.datasciencecentral.com/probability-and-statistics/hypothesis-testing/f-test/

Labels: , ,

0 Comments:

Post a Comment

<< Home