I have this dataframe:
> print(merged)
AgeGroup values ind
1 1 0.2449762 diff_v.ownhigh_avg
2 1 0.2598964 diff_v.ownhigh_avg
3 1 0.2519043 diff_v.ownhigh_avg
4 1 0.2452479 diff_v.ownhigh_avg
5 1 0.2840650 diff_v.ownhigh_avg
6 1 0.2589341 diff_v.ownhigh_avg
7 1 0.3201843 diff_v.ownhigh_avg
8 1 0.3218865 diff_v.ownhigh_avg
9 1 0.2822984 diff_v.ownhigh_avg
10 1 0.3313962 diff_v.ownhigh_avg
I'd like to add two columns: One for the upper bound CI, one for the lower bound CI based on the means of the values column.
There are 8 different types of ind, and 2 age groups - the data would need to be grouped by these.
I'd like my output to look a bit like this ideally:
> print(merged)
AgeGroup values ind Upper_Bound Lower_Bound
1 1 0.2449762 diff_v.ownhigh_avg 0.222 0.444
2 1 0.2598964 diff_v.ownhigh_avg 0.222 0.444
3 1 0.2519043 diff_v.ownhigh_avg 0.222 0.444
4 1 0.2452479 diff_v.ownhigh_avg 0.222 0.444
5 1 0.2840650 diff_v.ownhigh_avg 0.222 0.444
6 1 0.2589341 diff_v.ownhigh_avg 0.222 0.444
7 1 0.3201843 diff_v.ownhigh_avg 0.222 0.444
8 1 0.3218865 diff_v.ownhigh_avg 0.222 0.444
9 1 0.2822984 diff_v.ownhigh_avg 0.222 0.444
10 1 0.3313962 diff_v.ownhigh_avg 0.222 0.444