
Noel,
Thanks for sharing the code to the R community. I am new to biserial correlation, and had just tried your code for the following data:
> cor.biserial(as.factor(c(0,1,0,0,0,1,1,0,1,1,1)), c(1.2, 4.5, 0.97, 1.02, 1.4,3.8,3.97,1.23,3.78,4.23,4.76))


$rbis:
         0 
 -1.233783

$rhobis:
        0 
 0.378785
$z:
         0 
 -3.257211
$alpha:
            0 
 0.0005625642
$N:
[1] 11


 Is it possible to have a biserial correlation greater than 1 or less than -1? I undrestand that normal correlation like Pearson should be between -1 and 1. And if biserial correlation can be beyond the boundary, then how big can be seen as a good correlation? Since if we use Pearson correlation, people can usually claim above 0.8 will be a good correlation though it's arbitrary. 

A small note here, should your first 2 lines in the function be:

x <- x.na[!is.na(y.na) & !is.na(x.na)]
y <- y.na[!is.na(y.na) & !is.na(x.na)]

Thanks

John Chen


 Noel Yvonnick <noel@univ-lille3.fr> wrote:Le Lundi 31 Mars 2003 17:23, Bernd Weiss a écrit :
> On 31 Mar 2003 at 15:07, Noel Yvonnick wrote:
>
> [...]
>
> > Note that the point-biserial correlation is nothing but the standard
> > correlation coefficient when one of the variables is dichotomous, so
> > that cor(.) is OK.
>
> Yes, this is a misleading subject.
>
> > The biserial is different and includes a correction for the so-called
> > "point of dichotomy". The following should work (translating a formula
> > found in a psychometric manual) :
>
> [...]
>
> > # Biserial correlation
> > # Be cautious in interpreting the sign :
> > # depends upon the ordering of levels(x)
> > ((m[1]-m[2])/Sy)*(f[1]*f[2]/dnorm(f[1]-.5))
>
> Thanks a lot for your help. Your code inspired me to do some modifications.
>
> (1) Following a German statistic book (Bortz, Jürgen, 1993: Statistik.
> Heidelberg: Springer) I use the following term "dnorm(qnorm(f[1]))" instead
> of "dnorm(f[1]-.5)".
>
> (2) I added some code for handling NA's.
>
> (3) Finaly, it is now possible to do some significance test for rbis.
>
>
> Bernd
>
>
> # Modification of Noel Yvonnick function for computing biserial
> correlations # x.na: 0/1 variable
> # y.na: continuous variable
> cor.biserial = function(x.na,y.na)
> {
> x <- x[!is.na(y.na) & !is.na(x.na)]
> y <- y[!is.na(y.na) & !is.na(x.na)]
>
> stopifnot(is.factor(x))
> stopifnot(length(levels(x))==2)
> stopifnot(length(x)==length(y))
>
> N = length(y)
>
> # Success / Failure frequencies
> n <- table(x)
> f = table(x)/length(x)
>
> # Means of success/failure groups on the global score
> m = tapply(y,x,mean)
>
> # Variance of the global score
> Sy = sqrt(var(y)*(N-1)/N)
>
> # Biserial correlation
> # Be cautious in interpreting the sign :
> # depends upon the ordering of levels(x)
> rbis <- ((m[1]-m[2])/Sy)*(f[1]*f[2]/dnorm(qnorm(f[1])))
>
> # significance test for rbis
> rhobis <- sqrt(n[1]*n[2])/(dnorm(qnorm(f[1]))*N*sqrt(N))
> z <- rbis/rhobis
> alpha <- ifelse(z<0,pnorm(z),1-pnorm(z))
>
> return(rbis,rhobis,z,alpha,N)
> }

That's great. I like this spontaneous collaboration ! This is the very spirit 
of R and this list. Thank you.

Just in case someone is interested : I am trying to compile as many 
psychometric functions I can in a so-called "Psychom" library. It is just a 
script for my students at that time, with very simple functions, but maybe 
other people could contribute to finalize a formal library ?

http://yvonnick.noel.free.fr/cours/licence/psychometrie/2003/psychom.R


Yvonnick Noel
Dpt. of Psychology
U. of Lille 3
FRANCE

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


---------------------------------


	[[alternate HTML version deleted]]

