# NOT RUN {
data(drugtarget)
mod <- tskrr(drugTargetInteraction, targetSim, drugSim)
# Update with the same lambda
mod2 <- update(mod, lambda = 1e-3)
# Use different lambda for rows and columns
mod3 <- update(mod, lambda = c(0.01,0.001))
# A model with the hat matrices stored
lambda <- c(0.001,0.01)
modkeep <- tskrr(drugTargetInteraction, targetSim, drugSim, keep = TRUE)
Hk_1 <- hat(modkeep, which = "row")
modkeep2 <- update(modkeep, lambda = lambda)
Hk_2 <- hat(modkeep2, which = "row")
# Calculate new hat matrix by hand:
decomp <- get_eigen(modkeep, which = "row")
Hk_byhand <- eigen2hat(decomp$vectors,
decomp$values,
lambda = lambda[1])
identical(Hk_2, Hk_byhand)
# }
Run the code above in your browser using DataLab