I have a Tikz tree in my Latex document as follows:

`% Set the overall layout of the tree \tikzstyle{level 1}=[level distance=4.5cm, sibling distance=6.5cm] \tikzstyle{level 2}=[level distance=4cm, sibling distance=2.5cm] % Define styles for bags and leafs \tikzstyle{bag} = [text width=8em, text centered] \tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt] \tikzstyle{atom} = [draw=black,thick] % The sloped option gives rotated edge labels. Personally % I find sloped labels a bit difficult to read. Remove the sloped options % to get horizontal labels. \begin{tikzpicture}[grow=right, sloped] \node[bag] {$S_0 = 1$} child { node[bag] {$S_1 = 0.90$} child { node[end, label=right: {$S_2 = 0.810$}] {} edge from parent node[above] {$Y_2 = y_3$} } child { node[end, label=right: {$S_2 = 0.900$}] {} edge from parent node[above] {$Y_2 = y_2$} } child { node[end, label=right: {$S_2 = 0.918$}] {} edge from parent node[above] {$Y_2 = y_1$} } edge from parent node[above] {$Y_1 = y_3$} } child { node[bag] {$S_1 = 1.00$} child { node[end, label=right: {$S_2 = 0.900$}] {} edge from parent node[above] {$Y_2 = y_3$} } child { node[end, label=right: {$S_2 = 1.000$}] {} edge from parent node[above] {$Y_2 = y_2$} } child { node[end, label=right: {$S_2 = 1.020$}] {} edge from parent node[above] {$Y_2 = y_1$} } edge from parent node[above] {$Y_1 = y_2$} } child { node[bag] {$S_1 = 1.02$} child { node[end, label=right: {$S_2 = 0.918$}] {} edge from parent node[above] {$Y_2 = y_3$} } child { node[end, label=right: {$S_2 = 1.020$}] {} edge from parent node[above] {$Y_2 = y_2$} } child { node[end, label=right: {$S_2 = 1.0404$}] {} edge from parent node[above] {$Y_2 = y_1$} } edge from parent node[above] {$Y_1 = y_1$} }; \end{tikzpicture} `

With result:

I would like to draw rounded rectangles around the end nodes of each of the three first-level children. There would therefore be three nodes in each rectangle, with the top three in the first, middle three in the second, and lower three in the last. I would also like labels vertically centered on the right of each rectangle. The final result should be as so:

As I am completely new to Tikz, I do not know how to achieve this result. Help!