I have a data-set which has 3 columns: date, amount
, and a factor/cluster
. For example:
date;amount;cluster_id
02.10.10;-13,86;3
04.10.10;-66,28;3
06.10.10;-14,99;3
25.10.10;-20,96;3
30.10.10;-408,99;3
31.01.11;-29,5;2
07.02.11;-652,85;3
19.09.11;-277,48;3
30.09.11;-6,18;3
03.10.11;-242,47;3
04.11.11;-299,77;3
20.02.12;-367,85;3
03.10.12;-4,99;4
13.09.13;-6,59;4
14.10.13;-1043,46;3
24.10.13;-373,99;3
24.10.13;-1321,91;3
18.12.13;-24,45;4
03.02.14;-66,87;3
30.08.14;-7,6;2
28.10.14;-115;3
13.12.14;-8,99;3
15.12.14;-352,44;3
19.12.14;115;3
08.07.15;-59;2
The following code:
ggplot(data, aes(x=date, y=amount, colour=factor(mycluster))) +
stat_smooth(method = "rlm", formula = y ~ x)
simply performs a rlm
per group/factor. And looks like:
How can I combine each separate regression model into one big (added) model in order to plot one "combined" model in an easy way e.g. without looping over all the rlm models manually.