最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

r - Why does Brown-Forsythe test return different results in bf.test (onewaytests) and leveneTest(..., center = median)? - Stack

programmeradmin1浏览0评论

I am using the lmertree function from the glmertree package to compare the effects of three contexts (levels of a factor called 'source') on acceleration.

Because visual inspection showed heteroscedasticity, I decided to log transform my dependent variable 'acceleration'. Though visual inspection shows improvement, I notice that leveneTest still points to a significant difference.

A colleague suggested using Brown–Forsythe test instead. We both tried but with different functions and obtained different results:

  • Using the bf.test function from 'onewaytests', no significant difference is found.
  • using the leveneTest while specifying the parameter 'center = median' still results in a significant difference.

I am wondering what is causing the difference between the two test results. Many thanks for your help!

Here is the code:

# Add a new column with log-transformed values of acceleration
CA_degrees_PT$log_acce_RHwri_norm_mean <- log(CA_degrees_PT$acce_RHwri_norm_mean)

log_acce_RHwri_norm_mean_lmertree <- lmertree(log_acce_RHwri_norm_mean ~ 1|duration_nFrames + (1|participant)|source , data = CA_degrees_PT) 
plot(log_acce_RHwri_norm_mean_lmertree, which = "tree", gp = gpar(cex = .9))

hist(residuals(log_acce_RHwri_norm_mean_lmertree))

qqnorm(residuals(log_acce_RHwri_norm_mean_lmertree))
qqline(residuals(log_acce_RHwri_norm_mean_lmertree))

resids_log_acce <- residuals(log_acce_RHwri_norm_mean_lmertree)
preds_log_acce <- predict(log_acce_RHwri_norm_mean_lmertree)
plot(CA_degrees_PT$source, resids_log_acce)

leveneTest(resids_log_acce ~ groups, center = median)
bf.test(resids_log_acce ~ groups, data = CA_degrees_PT)

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论