i just write one for myself,but the result is different from the spss's.
i anyone can send me a copy of function calc the lamda coefficient?(i know i
should google first,but right now i can surf the internet.)
> lamda
function(table){
obs1.y<-sum(apply(table,1,max))
obs2.y<-max(apply(table,1,sum))
obs1.x<-sum(apply(table,2,max))
obs2.x<-max(apply(table,2,sum))
D.x<-(sum(table)-obs2.x)
D.y<-(sum(table)-obs2.y)
lamda.y<-(obs1.y-obs2.y)/D.y
lamda.x<-(obs1.x-obs2.x)/D.x
wt<-c(D.x,D.y)
lamda.xy<-weighted.mean(c(lamda.x,lamda.y),wt/sum(wt))
cat(
"the lamda.y coefficient is :",lamda.y,";","the lamda.x
coefficient is :",lamda.x,";",
"\n",
"the mean lamda coefficient is :",lamda.xy,".",fill=T)
}
> a<-matrix(c(44,20,54,8),2)
> a
[,1] [,2]
[1,] 44 54
[2,] 20 8> lamda(a)
the lamda.y coefficient is : -0.8571429 ; the lamda.x coefficient is :
0.5483871 ;
the mean lamda coefficient is : 0.1111111 .
2005-06-15
------
Deparment of Sociology
Fudan University
Blog:www.sociology.yculblog.com