x1 <- bca(tt= matrix(c(1,0,1,1),nrow = 2, byrow = TRUE),
m = c(0.9,0.1), cnames = c("yes", "no"),
varnames = "x", idvar = 1)
x2 <- bca(tt = matrix(c(0,1,1,1),nrow = 2, byrow = TRUE),
m = c(0.5,0.5), cnames = c("yes", "no"),
varnames = "x", idvar = 1)
print("combination of x1 and x2")
x1x2 <- dsrwon(x1,x2, varname = "x")
nzdsr(x1x2)
# Test with sparse matrices
x1s=x1
x2s=x2
x1s$tt <- methods::as(x1$tt, "RsparseMatrix")
x2s$tt <- methods::as(x2$tt, "RsparseMatrix")
x1x2s <- dsrwon(x1s, x2s, use_ssnames = TRUE)
nzdsr(x1x2s)
print("normalization of a bca definition.")
y2 <- bca(tt = matrix(c(0,0,0,1,0,0,1,1,1),nrow = 3,
byrow = TRUE), m = c(0.2,0.5,0.3),
cnames = c("a", "b", "c"), idvar = 1)
cat("y2")
cat("\ ")
y2
nzdsr(y2)
Run the code above in your browser using DataLab