r - geom_density total AUC 1, instead of 1 for each group -
i want make density plot using ggplot, of variable (x) showing 2 levels of grouping variable (cat). can geom_density
cat <- factor(sample(letters[1:2], 2000, replace = t, prob = c(.9, .1))) distra <- rnorm(2000, 5, 2) distrb <- rexp(2000, 1/4) x <- ifelse(cat == 'a', distra, distrb) ggplot(data.frame(x, cat), aes(x)) + geom_density(aes(fill = cat), alpha = .4, adjust = 2) 
the problem scales area under curve both groups 1. want total auc (over 2 groups) 1, still showing 2 curves 2 groups. in above example auc of group should around .9 , of group b .1. can tell me if possible, , if so, how it.
Comments
Post a Comment