Skip to content

Commit

Permalink
Update PO2PLS_gen3.R
Browse files Browse the repository at this point in the history
  • Loading branch information
selbouhaddani committed Feb 20, 2024
1 parent 1774be4 commit 7defe6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/PO2PLS_gen3.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gen_par3 <- function(p1, p2, p3, r, rx1, rx2, rx3, alpha = 0.1){
)
}

gen_dat3 <- function(N, params, alpha_out = 0.1){
gen_dat3 <- function(N, params, alpha_out = 0.1, sparse = FALSE){
W1 <- params$W1
W2 <- params$W2
W3 <- params$W3
Expand All @@ -50,6 +50,13 @@ gen_dat3 <- function(N, params, alpha_out = 0.1){
p2 <- nrow(W2)
p3 <- nrow(W3)

if(sparse){
W1[-(1:(p1/4)),] <- 0
W2[-(1:(p2/4)),] <- 0
W3[-(1:(p3/4)),] <- 0
}
# print(W1)

SigT = params$SigT
SigTo1 = params$SigTo1 + 1e-06 * SigT[1] * (params$SigTo1[1] == 0)
SigTo2 = params$SigTo2 + 1e-06 * SigT[1] * (params$SigTo2[1] == 0)
Expand Down Expand Up @@ -93,7 +100,7 @@ gen_dat3 <- function(N, params, alpha_out = 0.1){


# prm <- gen_par3(10, 11, 12, 2, 1, 1, 1, alpha = 0.1)
# dat <- gen_dat3(100, prm)
# dat <- gen_dat3(100, prm, sparse = TRUE)



0 comments on commit 7defe6f

Please sign in to comment.