Re: [R] Re: point-biserial correlation

About this list Date view Thread view Subject view Author view Attachment view

From: array chip (arrayprofile@yahoo.com)
Date: Fri 04 Apr 2003 - 09:40:02 EST


Message-id: <20030403234002.72259.qmail@web41203.mail.yahoo.com>


Also, can you generalize it to polyserial correlation to handle when x has more than 3 categories?
 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]]

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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:40 EST