#' Mean function for EM
#'
#' Mean function for EM
#' @param theta parameters to be estimated
#' @param n.mixt number of mixture.
#' @param p.sites the composition of each site.
#' @keywords mean function
#' @export
#' @examples
#' data("wq_analysis_week2")
#' SPTMData(wq.raw.obs, frequency = "quarter")
meanFunc = function(theta, n.mixt = 4, p.sites, season.sites){
season.lu = updateSeason(season.sites, p.sites=p.sites)
n.season = dim(season.sites)[2]
res = matrix(NA, nrow = nrow(season.sites), ncol = n.mixt)
for(j in 1:n.mixt){
idx.j = (0:(n.season-1))*n.mixt + j
res[,j]= season.lu[,idx.j] %*% theta[idx.j]
}
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.