PowerPoint Presentation

W
Shared by: yaEpHDN
Categories
Tags
-
Stats
views:
0
posted:
11/7/2012
language:
English
pages:
17
Document Sample
scope of work template
							        R_SimuSTAT_1

         Prof. Ke-Sheng Cheng
Dept. of Bioenvironmental Systems Eng.
      National Taiwan University
• Outline
   – Conducting random experiment using the
     “sample” function.
   – Histograms of sample mean, median, and
     standard deviation.
   – Calculation of sample quantiles.
   – Box-and-whisker plot.




               Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                   2
• Key aspects of a random experiment
   – Conducted under uniform conditions
   – Unpredictable outcomes

              Random                    Sample                    Event                Probability
             experiment                  space                    space                  space




                   Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012       Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                                3
             Random experiment
• Using the “sample” function in R
• “sample” takes a sample of the specified size
  from the elements of x using either with or
  without replacement. [The default is sampling
  without replacement.]
• Simulation of lotto draw using the sample
  function.



                 Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012     Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                     4
              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  5
              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  6
• Calculation of the sample mean, median, and
  standard deviation.
• Assessing variation of the sample means
  (median, standard deviation) from different
  samples.
• Plot histograms of sample mean, median, and
  standard deviation.
• How about the maximum values of random
  samples?
   – Observe differences in histograms.

               Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                   7
              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  8
              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  9
• hist(x, freq=FALSE, breaks=…)
   – breaks=
        • a vector giving the breakpoints between histogram
          cells,
        • a single number giving the number of cells for the
          histogram.
   – freq=
        • If TRUE, the histogram graphic is a representation of
          frequencies, the counts component of the result,
        • if FALSE, probability densities, component density, are
          plotted (so that the histogram has a total area of one).

                  Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012      Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                      10
            Sample quantiles




                                     Linear interpolation




              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  11
Not linear
interpolation!

                                                                 These three numbers define
                                                                 the box. Whiskers are defined
                                                                 differently.




                       Laboratory for Remote Sensing Hydrology and Spatial Modeling,
         11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                           12
                  The boxplot in R
• boxplot(x,range=0)
• boxplot(x) [Default, range=1.5]
• boxplot(x,range=3)
• A box-and-whisker plot includes two major parts – the
  box and the whiskers.
• The parameter range determines how far the plot
  whiskers extend out from the box. If range is positive,
  the whiskers extend to the most extreme data point
  which is no more than range times the interquartile
  range from the box. A value of zero causes the
  whiskers to extend to the data extremes.

                  Laboratory for Remote Sensing Hydrology and Spatial Modeling,
    11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                      13
•




                  Laboratory for Remote Sensing Hydrology and Spatial Modeling,
    11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                      14
              Laboratory for Remote Sensing Hydrology and Spatial Modeling,
11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                  15
• Comparison of multiple boxplots




               Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012   Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                   16
Can also use
boxplot(x1,x2,x3,names=c(“x1”, ”x2”, ”x3”))




                 Laboratory for Remote Sensing Hydrology and Spatial Modeling,
 11/7/2012     Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.
                                                                                     17

						
Related docs
Other docs by yaEpHDN
PARTNERSHIP DETAILS
Views: 0  |  Downloads: 0
8 Davies
Views: 0  |  Downloads: 0
Breast Cancer Entry 2013
Views: 2  |  Downloads: 0
University of California - DOC
Views: 0  |  Downloads: 0
SUBPART 231.1�APPLICABILITY
Views: 0  |  Downloads: 0
Le marketing strat�gique
Views: 0  |  Downloads: 0
youth engage logic sb
Views: 0  |  Downloads: 0
Pennsylvania
Views: 3  |  Downloads: 0
Introduction To Atomic Theory
Views: 0  |  Downloads: 0