shakthydoss shakthydoss - 1 year ago 105
R Question

R : How to find data only within 1 standard deviation

I have a vector of data and it is normally distributed.
I get a clear bell shape from the chart.

Question is how do I get data only belonging to 1sd (68% of data)

Answer Source

Suppose you vector is x, you can use x[abs(x - mean(x)) < sd(x)] to extract data distributed around 1 standard error of the mean.

An alternative method (maybe more preferred) is x[abs(scale(x)) < 1], where scale(x) gives standardized / normalized x.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download