visualiseGroupweights {ecpc} | R Documentation |
Visualise estimated group weights
Description
Plot group weights from multiple cross-validation folds.
Usage
visualiseGroupweights(dfGrps, Groupset, groupset.grouplvl, values,
widthBoxplot = 0.05, boxplot = TRUE, jitter = TRUE,
ps = 1.5, ls = 1)
Arguments
dfGrps |
Data frame containing the following variables; 'Group': factor with group names; 'Group.weight': group weight of each group; 'Fold': number indicating which fold in the cross-validation is used. |
Groupset |
List of G elements containing covariate indices for each group |
groupset.grouplvl |
(optional): groups on group level, e.g. defining a hierarchical structure. |
values |
(optional): values of continuous co-data. If given, group weights are plotted against these value. |
widthBoxplot |
Width of boxplot. |
boxplot |
Should a boxplot be plotted? |
jitter |
Should point estimates be jittered? |
ps |
Point size. |
ls |
Line size. |
Value
Plot in ggplot object.
See Also
visualiseGroupset
to visualise group sets and visualiseGroupsetweights
to plot estimated group set weights.
Examples
#discrete groups
groupset1 <- list(1:20,21:40)
dfGrps1 <- data.frame(Group=as.factor(rep(c(1,2),each=10)),
Group.weight=c(rnorm(10,0.5,0.01),rnorm(10,2,0.05)),
Fold=rep(1:10,2))
visualiseGroupweights(dfGrps1, Groupset=groupset1)
#continous co-data groups
cont.codata <- seq(0,1,length.out=40) #continuous co-data
#only split at lower continous co-data group
groupset2 <- splitMedian(values=cont.codata,split="lower",minGroupSize=10)
#obtain groups on group level defining the hierarchy
groupset.grouplvl <- obtainHierarchy(groupset2)
#simulate random group weights around 1
dfGrps2 <- data.frame(Group=as.factor(rep(1:length(groupset2),each=10)),
Group.weight=c(rnorm(10*length(groupset2),1,0.01)),
Fold=rep(1:10,length(groupset2)))
#plot group weights per group
visualiseGroupweights(dfGrps2, Groupset=groupset2, groupset.grouplvl=groupset.grouplvl)
#plot group weights per leaf group in the hierarchical tree
visualiseGroupweights(dfGrps2, Groupset=groupset2, groupset.grouplvl=groupset.grouplvl,
values=cont.codata)
[Package ecpc version 3.1.1 Index]