Description Usage Arguments Details Value Note Examples
get multiple single-factor-scores and the combined-factor-score.#'
1 2 3 4 5 6 7 8 9 10 11 12 | getMultiFactor(TS, FactorLists, wgts, silence = FALSE)
getMultiFactorbyTSFs(TSFs, wgts, factorNames = names(TSFs))
getRawMultiFactor(TS, FactorLists, name_suffix = FALSE)
MultiFactor2CombiFactor(mTSF, wgts, factorNames = guess_factorNames(mTSF),
na_deal = c("ignore", "rm"), keep_single_factors = TRUE)
TSFs2mTSF(TSFs, factorNames = names(TSFs))
mTSF2TSFs(mTSF, factorNames = guess_factorNames(mTSF))
|
FactorLists |
a list, with elements of FactorList(See detail in |
wgts |
a numeric vector with the same length of FactorLists(if the sum of wgts not equals to 1, the wgts will be rescaled to sum 1). If 'eq', |
TSFs |
a TSFs object. see /code/linkModel.TSFs |
mTSF |
a dataframe of 'TS & MultiFactors' |
Function getMultiFactor
firstly get all the single-factor-scores and then calculating the weighted sum of them to get the combined-factor-score.
getMultiFactor
return a mTSF object including cols of all the single-factor-scores, and (if param wgts
not missing) the raw combined-factor-score .
getMultiFactorbyTSFs
return a TSF object including cols of all the single-factor-scores, and (if param wgts
not missing) the raw combi-factor-score, from a TSFs list. (If param TSFs is a TSFRs object, then will return a TSFR object.)
Function getMultiFactor
not only could be used to get the "raw" combined-factor-score, but also could be used as the "factorFun"
parametre in function getTSF
to get the "clean and standardized" combined-factor-score. See more detail in the examples.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # -- get multi-factor by FactorLists
FactorLists <- list(
buildFactorList(factorFun="gf.PE_ttm",
factorPar=list(),
factorDir=-1),
buildFactorList(factorFun="gf.pct_chg_per",
factorPar=list(N=20),
factorDir=-1),
buildFactorList(factorFun="gf.pct_chg_per",
factorPar=list(N=60),
factorDir=-1),
buildFactorList(factorFun="gf.pct_chg_per",
factorPar=list(N=120),
factorDir=-1))
wgts <- c(0.25,0.25,0.25,0.25)
# -- 0. get the all the single-factor-scores
TSF <- getMultiFactor(TS,FactorLists)
# -- 1. get the "raw" combined-factor-score
TSF.multi <- getMultiFactor(TS,FactorLists,wgts)
# -- 2. get the "clean and standardized" combined-factor-score
# --- 2.1 by \code{getTSF}
TSF.multi2 <- getTSF(TS,factorFun="getMultiFactor",factorPar=list(FactorLists,wgts),factorRefine=refinePar_default("scale"))
# --- 2.2 by \code{Model.TSF}
modelPar <- modelPar.factor(modelPar.default(),factorFun="getMultiFactor",factorPar=list(FactorLists,wgts),factorRefine=refinePar_default("scale"))
TSF.multi3 <- Model.TSF(modelPar)
TSF.multi4 <- Model.TSF_byTS(modelPar, TS)
# -- get multi-factor by TSFs
MPs <- getMPs_FactorLists(FactorLists, modelPar.default())
TSFs <- Model.TSFs(MPs)
TSF.multi5 <- getMultiFactorbyTSFs(TSFs,wgts)
#-- TSFs2mTSF
mTSF <- TSFs2mTSF(TSFs)
mTSFR <- TSFs2mTSF(TSFRs)
#-- mTSF2TSFs
TSFs <- mTSF2TSFs(mTSF)
TSFRs <- mTSF2TSFs(mTSFR)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.