+ Reply to Thread
Results 1 to 2 of 2

Thread: plotting 10 class intervals of frequency distribution.

  1. #1
    Points: 2,074, Level: 27
    Level completed: 50%, Points required for next Level: 76

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    plotting 10 class intervals of frequency distribution.




    I am newbie to R, so I don't know exactly how to plot frequency distribution having 10 class intervals and calculate the proportion of under IQ of 120 using the frequency distribution above. In spite of I have searched many websites and tutorials I could not find out the solution.
    Plz let me know, Thank you all.
    This is continuous data.
    119 87 89 131 122 106 121 100 95 121
    119 89 128 123 84 99 119 105 117 92
    96 85 112 99 90 96 123 102 81 129
    108 109 84 134 130 105 113 103 126 92
    127 97 108 94 122 123 122 82 97 132
    110 89 92 109 131 95 121 94 112 90
    122 95 87 114 130 123 84 109 116 106
    96 109 110 128 102 102 101 113 100 108
    88 109 133 81 107 122 100 100 102 109
    101 109 118 105 118 127 87 119 90 131

  2. #2
    TS Contributor
    Points: 5,565, Level: 48
    Level completed: 8%, Points required for next Level: 185

    Location
    St Albans, UK
    Posts
    257
    Thanks
    0
    Thanked 7 Times in 5 Posts

    You can use the hist function to plot frequency distribution.
    I am not quite sure what you mean by 10 class intervals. The code below shows how to use the hist function with 10 bars. The code then calculates the proportion with IQ < 120, and displays the result on the chart.

    Code: 
    IQ<-scan()
    119 87 89 131 122 106 121 100 95 121
    119 89 128 123 84 99 119 105 117 92
    96 85 112 99 90 96 123 102 81 129
    108 109 84 134 130 105 113 103 126 92
    127 97 108 94 122 123 122 82 97 132
    110 89 92 109 131 95 121 94 112 90
    122 95 87 114 130 123 84 109 116 106
    96 109 110 128 102 102 101 113 100 108
    88 109 133 81 107 122 100 100 102 109
    101 109 118 105 118 127 87 119 90 131
    
    #plot frequency distribution
    intervals<-10
    h<-hist(IQ, breaks=seq(min(IQ), max(IQ), length=intervals+1))
    
    #calculate proportion of class with than IQ<120
    proportion <- length(IQ[IQ<120])/length(IQ)
    
    # show proportion with IQ<120 on plot
    abline(v=120, lty="dashed", col="red")
    text(x=120, y=0.95*max(h$counts), paste("Proportion < 120 =", proportion), pos=2)
    To get the proportion directly from the chart you could have IQ intervals of 10 and the sum the counts for each interval below 120 and divide it by the total number of IQ results, as in the code below
    Code: 
    h2<-hist(IQ, breaks=seq(80,140,by=10))
    text(x=h2$mids, y=h2$counts, labels=h2$counts, pos=1)
    # proportion with IQ<120
    a<-sum(h2$counts[h2$breaks<120])
    b<-sum(h2$counts)
    proportion2<-a/b
    abline(v=120, lty="dashed", col="red")
    text(x=120, y=0.95*max(h2$counts), labels=paste("Proportion < 120 =\n(", paste(h2$counts[h2$breaks<120], collapse="+"),")/",length(IQ),"=",proportion2), pos=4, cex=0.8)

+ Reply to Thread

           




Similar Threads

  1. Plotting probability distribution
    By fool in forum Probability
    Replies: 4
    Last Post: 03-25-2011, 06:07 AM
  2. help with Frequency Distribution
    By shyy in forum Statistics
    Replies: 1
    Last Post: 09-25-2010, 11:15 PM
  3. Replies: 8
    Last Post: 09-11-2010, 06:59 PM
  4. Replies: 2
    Last Post: 08-17-2010, 11:37 AM
  5. help with the plotting of a weibull distribution
    By ginobee2000 in forum Statistics
    Replies: 1
    Last Post: 06-01-2010, 09:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats