1 test_that("on input of sufficient size, β/||β|| is estimated accurately enough",
8 βs_ref <- array( c(1,0,0,1 , 1,-2,3,1), dim=c(d,K,2) )
9 for (i in 1:(dim(βs_ref)[3]))
11 μ_ref <- normalize(βs_ref[,,i])
12 for (link in c("logit","probit"))
14 cat("\n\n",link," :\n",sep="")
16 io <- generateSampleIO(n, p, βs_ref[,,i], rep(0,K), link)
17 μ <- computeMu(io$X, io$Y, list(K=K))
18 μ_aligned <- alignMatrices(list(μ), ref=μ_ref, ls_mode="exact")[[1]]
20 #Some traces: 0 is not well estimated, but others are OK
21 cat("Reference normalized matrix:\n")
23 cat("Estimated normalized matrix:\n")
25 cat("Difference norm (Matrix norm ||.||_1, max. abs. sum on a column)\n")
26 diff_norm <- norm(μ_ref - μ_aligned)
29 # NOTE: 0.5 is loose threshold, but values around 0.3 are expected...
30 expect_lt( diff_norm, 0.5 )