FAQ
How do you calculate the percentage of data within 2SD, 3SD, 4SD, 5SD, and
6SD of the mean? I used the following link as the data I'm working with:
nb10 <- read.table("http://www.adjoint-functors.net/su/web/314/R/NB10") if
this helps answer my question. Can you please explain how to calculate the
SD's? Please be specific in which part of the function changes when
calculating the next SD up.

Thanks.

--
View this message in context: http://r.789695.n4.nabble.com/How-to-Calculate-Percentage-of-Data-within-certain-SD-of-Mean-tp4359551p4359551.html
Sent from the R help mailing list archive at Nabble.com.

Search Discussions

  • Pete Brecknock at Feb 5, 2012 at 9:13 pm
    How about ....

    # Read Data
    nb10 <- read.table("http://www.adjoint-functors.net/su/web/314/R/NB10")

    # Calculate Stats
    total = length(nb10[,1])
    mean = mean(nb10[,1])
    sd = sd(nb10[,1])

    # Function ... nSD is the number of SD you are looking at
    pData <- function(nSD){
    lo = mean - nSD/2*sd
    hi = mean + nSD/2*sd
    percent = sum(nb10[,1]>=lo & nb10[,1]<=hi)/total *100
    }

    # Output ...
    print(paste("Percent of data within 2 SD is ",pData(2),"%", sep="")) # 86%
    print(paste("Percent of data within 3 SD is ",pData(3),"%", sep="")) # 93%
    print(paste("Percent of data within 4 SD is ",pData(4),"%", sep="")) # 96%
    print(paste("Percent of data within 5 SD is ",pData(5),"%", sep="")) # 97%
    print(paste("Percent of data within 6 SD is ",pData(6),"%", sep="")) # 98%

    HTH

    Pete


    Ajata Paul wrote
    How do you calculate the percentage of data within 2SD, 3SD, 4SD, 5SD, and
    6SD of the mean? I used the following link as the data I'm working with:
    nb10 <- read.table("http://www.adjoint-functors.net/su/web/314/R/NB10") if
    this helps answer my question. Can you please explain how to calculate
    the SD's? Please be specific in which part of the function changes when
    calculating the next SD up.

    Thanks.

    --
    View this message in context: http://r.789695.n4.nabble.com/How-to-Calculate-Percentage-of-Data-within-certain-SD-of-Mean-tp4359551p4359809.html
    Sent from the R help mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedFeb 5, '12 at 7:05p
activeFeb 5, '12 at 9:13p
posts2
users2
websiter-project.org
irc#r

2 users in discussion

Pete Brecknock: 1 post Ajata Paul: 1 post

People

Translate

site design / logo © 2017 Grokbase