Modified RESALI (Corrected score quantile calculation)

main
Corentin Choisy 7 months ago
parent 635c7c081e
commit cd486059c1

@ -15,6 +15,9 @@ resali <- function(df=NULL,items=NULL,group=NULL,verbose=T) {
dat <- df dat <- df
dat$score <- rowSums(dat[,items_n]) dat$score <- rowSums(dat[,items_n])
nqt <- ifelse(length(unique(quantile(dat$score,seq(0,1,0.2))))==6,5,length(unique(quantile(dat$score,seq(0,1,0.2))))-1) nqt <- ifelse(length(unique(quantile(dat$score,seq(0,1,0.2))))==6,5,length(unique(quantile(dat$score,seq(0,1,0.2))))-1)
while (length(unique(quantile(dat$score,seq(0,1,1/nqt))))!=nqt+1) {
nqt <- nqt-1
}
dat$score_q5 <- cut(dat$score,unique(quantile(dat$score,seq(0,1,1/nqt))),labels=1:nqt,include.lowest=T) dat$score_q5 <- cut(dat$score,unique(quantile(dat$score,seq(0,1,1/nqt))),labels=1:nqt,include.lowest=T)
res.anova <- rep(NA,nbitems) res.anova <- rep(NA,nbitems)
pval <- rep(NA,nbitems) pval <- rep(NA,nbitems)

Loading…
Cancel
Save