Created
May 12, 2017 08:36
-
-
Save peterdalle/2145a3318e47dbf99cecdff4a7a621e9 to your computer and use it in GitHub Desktop.
Konvertera Pearsons r till Cohens d, samt omvänt, och visa det grafiskt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # r till d | |
| rlist <- seq(0, 1, by=0.01) | |
| dlist <- list() | |
| i <- 0 | |
| for (r in rlist) { | |
| i <- i + 1 | |
| dlist[i] <- sqrt(4 * r ^ 2) / (1 - r ^ 2) | |
| } | |
| dlist <- unlist(dlist) | |
| plot(rlist, dlist, type="line", xlab="Pearsons r", ylab="Cohens d", main="Konvertering mellan effektstorlekar") | |
| # d till r | |
| dlist <- seq(-5, 5, by=0.1) | |
| rlist <- list() | |
| i <- 0 | |
| for (d in dlist) { | |
| i <- i + 1 | |
| rlist[i] <- sqrt((d ^ 2) / (4 + d ^ 2)) | |
| } | |
| rlist <- unlist(rlist) | |
| plot(dlist, rlist, type="line", xlab="Cohens d", ylab="Pearsons r", main="Konvertering mellan effektstorlekar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment