how to determine whether the point is outside/within the ellipse in PCA

Dear all,

Happy New Year. Wish you a very successful year!

I am creating PCA plots in R in an automated way and need a script to define whether the sample (red dot on the figure) is outside/within the circle. Does anyone have a good solution for it?
So far I've been using mahalanobis distance and then seeing whether the distance for the sample is within 80th percentile or not. The problem is that mahalanobis distance is in the multidimensional space, while pca plot is shown in 2D. So, sometimes, I would get a message that the point is located outside of the ellipse (in multidimensional space), while in 2D it is within the ellipse.

Thanks a lot for your advice!


Sorry, I do not understand what the problem is. Just calculate the Mahalonobis distance and if it's above the 80-th percentile paint the point into the red color... But hey, you've done that already.
Thank you for your comment. It's a little bit different. The red coloured point is my sample and blue coloured - its peers. I've generated report with this PCA plot showing that my red point is within the ellipse, while based on mahalanobis distance it can be outside the ellipse.