Running a Levene Test Help

How do I run a levene test to test for homogeneity of variance? It doesn’t seem to be working for me?

levenetest(TMS, Placebo)

levene.test(TMS, Placebo)

I have tried the above but nothing seems to work, I cannot even find the ‘help’ documentation for it

Making comparisons between years for a multi-year study

I conducted a study examining bird abundances on and at different distances from an energy development (5 distance “categories” total) over 2 years. I need to determine if there are significant differences in bird abundances 1) for total abundance count and 2) between categories between years (i.e. did bird abundance differ on the entire site, and did bird abundance in category 1 change significantly between year 1 and 2, etc.). I have been using Dunn tests to test for differences in distance categories so far because my data is not normal, but I understand to do a Dunn test I have to use a Levene’s test to look for equal variances between the groups I am testing first. So my problem is that the variances between years are not equal (“av.ab~yr” = “avian abundance by year”):

Levene’st test for equal variances in abundance between years

leveneTest(final.plot$av.ab~yr, data=final.plot)
# Pr(>F)
# 0.0001608

So are there any recommendations on how I could test for a difference between years given that the variance between years is so unequal? Any help would be much appreciated!!

Can a Levene's test be conducted with only summary statistics?

My research question specifically deals with testing the variances of 3+ groups for significant differences. I’m not looking to test an assumption of homoscedasticity for an ANOVA or any other test, but rather my end goal is the testing of variances. Unfortunately, I only have my own complete dataset but the other groups come from previously published works that only reported summary statistics (N, means, standard deviations)

Unfortunately I cannot ask the researchers for their original data since some of these studies are quite old. I’ve managed to simplify most of the Levene’s test formula to only using what I have but I’m stuck at the principal transformation for the test and can’t simplify it further.

Does anyone have any suggestions on how I may either conduct a Levene’s with just this information or other tests of variance that might work for this dilemma. I have wondered about the use of the Hartley’s test, but so many people warn against it that I’m cautious.

Compare sub group Variance to Total Populaion Group [closed]

Suppose I have a salary data for one person for 10 months: 2000,3000,4000,5000,6000,7000,8000,9000,10000 and I want to compare his salary variance in the period to the salary variance of all populaion.

To what should I compare it to? to the average salary?
and what test to use? Levene’s test or somthing else?

Thank you!

Two way ANCOVA with slight heteroscedasticity

I am about to perform a 2-way ANCOVA but I reject the null hypothesis in Levene’s Test with a p-value of 0.023. See standard deviation and sample sizes below.

enter image description here

I googled up and down and found people saying that: 1) I can still perform the ANCOVA because the smaller group ($n=32$) has the smaller variance, and 2) I should be good to go if the smallest variance is not more than 4 times smaller than the biggest variance–> something like this:

enter image description here
Does somebody here know a citable source for these two claims? They would both save me from going crazy!

Thanks a lot in advance!

Calculating Within-group variance

My study is looking at attitudes towards a concept across four different professional groups: Physicians, Nursing, Pharmacy, and Allied Health. I want to see whether there are differences in attitudes between the groups (e.g. across the professions) as well as within the groups (amongst members of the same profession). I used a validated survey instrument, comprised of 27 likert-type items, from which I extracted three components using PCA. I created each component as a new variable in SPSS, by averaging the mean of the items that comprised the component (e.g. Variable 1= average of means of questions 1 to 11; variable 2 = average of means of questions 12 to 24, etc.). To get at the between-group results, I’ve done ANOVA/Welch’s ANOVA and the relevant post-hoc tests (Tukey’s HSD, Games Howell, etc.) to determine where there are statistically significant differences in the mean between the four groups, for each of the three new variables. For example, between physicians-nursing, or between pharmacy-nursing.

I now also want to determine if there are differences in attitudes WITHIN each group. What I mean by this is, amongst all of the, for example, physicians, is there significant difference in the means of all physician respondents, for a particular component? So, I am not comparing two or more groups, but rather, want to look at the variance within a single profession group. Can I even do that? I through that interpreting the SD might give me this, but how do you determine if an SD value is statistically significant?

Test equality of binomial variances across four groups

I have four 100×1 vectors of binary outcomes of a particular experiment. I want to test for equality in variance across all of the four different treatment groups.

At the moment I have used the Levene test to do this. However, I wanted to check whether this is a reasonable thing to do when dealing with binary data?



Homogenity of Variances – F-test and Levene Test yield different results – which one to trust?

I want to perform a t-test on two independent samples with each n = 50. to check the assumptions, I ran an F-test for homogenity, which is significant. then I used SPSS which does a levene test by default and this levene test was not significant. I don’t have the data here, but n = 50 (data are rental prices) is probably normal distributed. which test should I trust and why?
thanks in advance for your answers!

What's the rationale behind the degrees of freedom in Levene's test?

I’ve been reading the Wikipedia page for Levene’s test, and it cites the degrees of freedom as (k – 1, N – k), where k is the number of different groups to which the sampled cases belong, and N is the total number of cases in all groups. However, it does not explain why this is so. There is a very thorough answer here which would suffice to answer this question in relation to the chi square goodness of fit. However, I have not been able to find a satisfactory answer to the question in relation to Levene’s test.

“One-tailed” Levene Test

F-tests can be two-tailed (to test that $s_1^2 ne s_2^2$) or one-tailed (to test that $s_1^2 > s_2^2$).

How can I modify Levene/Brown-Forsythe to be “one-tailed”, that is, to test $s_1^2 > s_2^2$ instead of $s_1^2 ne s_2^2$?

Here is a demo:


The image shows normally distributed training data (n=1000) and a model. An F-test is used to compare the variance of one point’s residuals (n=2) to the variance of all of the residuals (n=2000), so the point is an outlier if its residual variance is “too large.” The points are colored by p-value, where light points fit the model and dark points are outliers, and you can see that the two-tailed Brown-Forsythe rejects points that are too close to the model as well as too far.

Note: A different non-parametric, one-sided variance test would be fine as well.

Glen_b gave the information I needed, but I thought I would leave some implementation details (using scipy).

#basic F-test
F = var(a) / var(b)
Fp = stats.f.sf(F, df1, df2)

#Brown Forsythe
BF, BFp = stats.levene(a, b, center='median')

#two tailed t-test on transformed data
za = abs(a-median(a))
zb = abs(b-median(b))
t, tp_two_tailed = stats.ttest_ind(za, zb)

#the two tailed t test recapitulates the BF test
assert(t**2 == BF)
assert(p_BF == p_two_tailed)

#one tailed t test p value
tp = stats.t.sf(t, df)

scatter plots

Above shows scatter plots of the p values from the one-tailed $F$-test and two-tailed BF-test (left), and the one-tailed $t$ tests (right). Red points are “too close” ($s_1^2 < s_2^2$).

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam