I have a data set of 91 variables. It is related to a qualitative analysis I made to analyse a few phenomena. For this reason, the questions are grouped in 10 clusters, since they express different aspects of the analysis.
I made a subset using the following R command:
example1<- subset(data, select=c("a1", "a2", "a14", "a21"))
then I made a dependence matrix to check the dependence among the single variables in each cluster:
p1 <- stat1 <- diag(ncol(example1))
colnames(p1) <- rownames(p1) <- colnames(exemple1)
colnames(stat1) <- rownames(stat1) <- colnames(example1)
rn <- rownames(p1)
cn <- colnames(p1)
###loop for the p-values
for(i in 1:ncol(example1)){
for(j in 1:ncol(example1)){
a <- example1[, rn[i]]
b <- example1[, cn[j]]
r <- chisq.test(a,b)$p.value
p1[i, j] <- r
}
}
###loop for the statistic
for(i in 1:ncol(example1)){
for(j in 1:ncol(example1)){
a <- example1[, rn[i]]
b <- example1[, cn[j]]
r <- chisq.test(a,b)$statistic
stat1[i, j] <- r
}
}
### placing the p-values in the upper diagonal of stat
stat1[upper.tri(stat1)] <- p1[upper.tri(p1)]
diag(stat1) <- 1
stat1 # this is for the first subset
But now I have two questions:
- How can I make the dependence hypothesis test among the variables and set my alpha?
- How can I make the regression analysis?