######################################################
# a function for calculating the objective function
# associated to the pstr.R file
#
# author: Katrijn Van Deun
# implemented by Zhengguo Gu
#####################################################
pstrLoss <- function(B, Tmat, Target, W){
DEV <- Tmat %*% B - Target
wDEV <- W * DEV
Loss <- sum(wDEV^2)
return(Loss)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.