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

I am using the lmertree function from the glmertree package to compare the effects of three contexts (l

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)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742372738a4431580.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信