[R] loglinear model selection

Bernardo Rangel Tura tura at centroin.com.br
Tue Aug 30 12:34:21 CEST 2005


Hi R-masters!

I have a problem and need your help.
I have 9 discrete variables with 2 levels each.
In exploratory analisys I generate one matrix with chi-square for tables 
with 2 ariables each with this script

setwd("F:/")
dados<-read.csv("log.csv")[,2:10]
dados.x<-matrix(NA,ncol=9,nrow=9)
for(i in 1:8){
for(j in (i+1):9){
tab<-table(dados[,i],dados[,j])
dados.x[i,j]<-round(as.numeric(chisq.test(tab)$statistic),3)
dados.x[j,i]<-round(as.numeric(chisq.test(tab)$statistic),3)
  }
}
dados.x

The result is:

        [,1]   [,2]   [,3]   [,4]   [,5]   [,6]   [,7]  [,8]   [,9]
  [1,]    NA  3.589  6.351  3.957  4.269  0.851  2.955 1.188  1.975
  [2,] 3.589     NA  9.664 24.596 12.510 26.284  8.580 3.608  6.574
  [3,] 6.351  9.664     NA 25.054 10.300 12.189 19.811 0.192 11.744
  [4,] 3.957 24.596 25.054     NA 50.032 35.587 22.401 1.950 26.631
  [5,] 4.269 12.510 10.300 50.032     NA 80.876 54.954 0.127 61.573
  [6,] 0.851 26.284 12.189 35.587 80.876     NA 57.346 0.741 49.738
  [7,] 2.955  8.580 19.811 22.401 54.954 57.346     NA 1.520 80.615
  [8,] 1.188  3.608  0.192  1.950  0.127  0.741  1.520    NA  0.311
  [9,] 1.975  6.574 11.744 26.631 61.573 49.738 80.615 0.311     NA

Now I need fit a loglinear model with this variables, but I need know have 
a command with generate ALL models with the set this 8 vairables (ALL minus 
[,8]) incluindind the interactions.

Can Anyone Help me?



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.




More information about the R-help mailing list