shakthydoss
shakthydoss

Reputation: 2631

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)

Upvotes: 3

Views: 9206

Answers (1)

Zheyuan Li
Zheyuan Li

Reputation: 73385

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.

Upvotes: 7

Related Questions