When installing a basketball hoop in the ground you should dig the hole at least 12 to 18 inches deep.
When I installed the basketball hoop and goal in my yard I dug the hole to 18 inches deep and then poured concrete around it and used a level to make sure the pole was level.
Then allow it to sit overnight to let the concrete setup and then it will be ready to use the next day.
If you don't have a concrete pad for the basketball hoop I would recommend pouring one which is easy which will make the basket ball playing more fun although you could play on the grass.
The concrete makes the ball bounce much better and it's not that costly to pour a small concrete slab which you can do by buying bags of concrete and setting a form and then mix the concrete with some water and mix it up.