LEC. 3: USING R FUNCTIONS

Size: px
Start display at page:

Download "LEC. 3: USING R FUNCTIONS"

Transcription

1 1 / 19 LEC. 3: USING R FUNCTIONS Instructor: SANG-HOON CHO DEPT. OF STATISTICS AND ACTUARIAL SCIENCES Soongsil University

2 1. Reading Data from (or Writing to) Files 2 / 19 Importing or Exporting Data Large data objects will usually be read as values from external files rather than entered during an R session at the keyboard R input/output facilities are simple but their requirements are fairly strict and even rather inflexible.there is a clear presumption by the designers of R that you will be able to modify your input files using other tools, such as file editors or Perl20 to fit in with the requirements of R. Comma delimited text files For Excel, SPSS, SAS format files, there are many packages available but importing CSV files converted by Excel, SPSS, SAS often simplifies unnecessary complication. Excel files: xlsx SPSS files: foreign, Hmisc SAS files: foreign, Hmisc, sas7bdat

3 1. Reading Data from (or Writing to) Files 3 / 19 Comma Delimited Text Files read.table(), write.table() read.table() function is mainly used for importing data in R read.csv(), write.csv()?read.table write.csv(faithful, "faithful.csv", row.names = FALSE) # if row.anmes = T, index column will be added dir( pattern = "faithful" ) # check "faithful.csv" file created in the working directory dat <- read.table( "faithful.csv", header = TRUE, sep = ",") dat <- read.csv( "faithful.csv") # read.csv is a simple alternative str(dat) data.frame : 272 obs. of 2 variables: $ eruptions: num $ waiting : int

4 1. Reading Data from (or Writing to) Files 4 / 19 Excel Files read.xlsx(), write.xlsx() install.packages("xlsx") --- 현재세션에서사용할 CRAN 미러를선택해주세요 --- URL 을시도합니다 Content type application/x-gzip length bytes (391 KB) ================================================== downloaded 391 KB 다운로드된바이너리패키지들은다음의위치에있습니다 /var/folders/ /1wql8x355w5bd3v25vqdp1q80000gn/T//RtmpCrh3nv/downloaded_packages library(xlsx) 필요한패키지를로딩중입니다 : rjava 필요한패키지를로딩중입니다 : xlsxjars write.xlsx( faithful, file = "faithful.xlsx", sheetname ="testsheet", row.names = FALSE ) dir( pattern = "faithful" ) # check "faithful.xlsx" file created in the working directory [1] "faithful.csv" "faithful.xlsx" dat <- read.xlsx( "faithful.xlsx", sheetname = "testsheet" ) str(dat) data.frame : 272 obs. of 2 variables: $ eruptions: num $ waiting : num

5 2. R Functions for Exploratory Analysis 5 / 19 Summary Statistics sum(), length(), mean(), var(), sd(), median(), max(), min() set.seed(1234) age <- sample( x = 1:100, size = 100, replace = TRUE ) sum(age)/length(age) [1] mean(age) [1] sum((age - mean(age))ˆ2)/(length(age) - 1) [1] var(age) [1] sd(age) [1] median(age) [1] 39 max(age) [1] 100 min(age) [1] 1

6 2. R Functions for Exploratory Analysis 6 / 19 Summary Statistics summary(), range(), IQR(), quantile() summary(age) Min. 1st Qu. Median Mean 3rd Qu. Max range(age) [1] IQR(age) [1] quantile(age) 0% 25% 50% 75% 100% quantile(age, probs = c(.25,.50,.75)) 25% 50% 75%

7 2. R Functions for Exploratory Analysis 7 / 19 Data Manipulation: combing data frames or matrices or vectors cbind(), rbind() The functions cbind and rbind combine data frames, matrices or vectors column-wise and row-wise, respectively. id <- c(3, 1, 5, 10); height <- c(180, 120, 160, 150); weight <- c(90, 22, 80, 40) dat <- cbind(id, height, weight) class(dat) [1] "matrix" cbind(dat, dat) id height weight id height weight [1,] [2,] [3,] [4,] rbind(dat, dat) id height weight [1,] [2,] [3,] [4,] [5,] [6,] [7,] [8,] class(cbind(dat, dat)) [1] "matrix"

8 2. R Functions for Exploratory Analysis 8 / 19 Data Manipulation: sorting sort() The functions sort sorts (or order) a vector or factor (partially) into ascending or descending order dat <- data.frame(dat) class(dat) [1] "data.frame" datt <- rbind(dat, dat) class(datt) [1] "data.frame" datt$height [1] sort(datt$height) [1] sort(datt$height, decreasing = TRUE) [1] rev(sort(datt$height)) # reverse the vector [1]

9 2. R Functions for Exploratory Analysis 9 / 19 Data Manipulation: sorting sort.list() The functions sort.list returns a permutation which rearranges into ascending or descending order ind <- sort.list(datt$height); ind [1] datt$height[ind] [1]

10 2. R Functions for Exploratory Analysis 10 / 19 Data Manipulation: sorting order() Basically, the same as sort.list but order takes more than one argument indd <- order(datt$height); indd [1] datt$height[indd] [1] inddd <- order(datt$id, datt$weight) datt[inddd,] id height weight

11 2. R Functions for Exploratory Analysis 11 / 19 Tables: calculating frequencies table() # the default behavior of read.table is to convert character variables (which are not converted to logical, numeric or complex) to factors dat <- read.csv( "income.csv", colclasses = c("character", "factor", "numeric")) #dat <- read.csv( "income.csv", stringsasfactors = F) str(dat) data.frame : 30 obs. of 3 variables: $ state : chr "tas" "sa" "qld" "nsw"... $ state.fac: Factor w/ 8 levels "act","nsw","nt",..: $ incomes : num # states in Australia attach(dat) table(state.fac) state.fac act nsw nt qld sa tas vic wa income.fac <- factor(cut(incomes, breaks = 35+10*(0:7))) table(incomef,statef) statef incomef act nsw nt qld sa tas vic wa (35,45] (45,55] (55,65] (65,75] detach(dat)

12 2. R Functions for Exploratory Analysis 12 / 19 Tables: calculations on cross-classifications tapply() attach(dat) The following objects are masked _by_.globalenv: incomes, state, state.fac tapply(incomes, state.fac, mean) act nsw nt qld sa tas vic wa round(tapply(incomes, state.fac, mean),2) act nsw nt qld sa tas vic wa detach(dat)

13 2. R Functions for Exploratory Analysis 13 / 19 Tables: calculations on cross-classifications apply() str(faithful) data.frame : 272 obs. of 2 variables: $ eruptions: num $ waiting : num apply( faithful, 2, mean) eruptions waiting apply( faithful, 2, function(x) {sum(x) / length(x)}) eruptions waiting apply( faithful, 2, sd) eruptions waiting

14 3. Probability Distribution Functions 14 / 19 Random Samples and Permutations sample() The function sample can be used to generate random samples with or without replacement #toss a coin 10 times. head = 1, tail = 0 sample(x = c(0,1), size = 10, replace = TRUE, p = c(1/2,1/2)) [1] sample(c(0,1), 10, replace = T) [1] #roll a die 10 times. face values = 1, 2, 3, 4, 5, 6. equally likely sample(x = c(1,2,3,4,5,6), size = 10, replace = TRUE, p = rep(1/6,6)) [1] sample(c(1,2,3,4,5,6), 10, replace = T) [1]

15 3. Probability Distribution Functions 15 / 19 d, p, q, r Functions R has four types of functions for getting information about a family of distributions d(): p.d.f (probability distribution function) p(): c.d.f (cumulative distribution function) q(): quantiles r(): random samples

16 3. Probability Distribution Functions 16 / 19 d, p, q, r Functions Binomial distribution #X: num of successes in n = 10, p = 1/2 Bernoulli trials choose(10,5) * (1/2)ˆ(10) [1] dbinom(x = 5, size = 10, prob = 1/2) [1] pbinom(q = 5, size = 10, prob = 1/2) [1] sum( dbinom(x = 0:5, size = 10, prob = 1/2) ) [1] pbinom(q = 5, size = 10, prob = 1/2, lower.tail = T) [1] pbinom(q = 5, size = 10, prob = 1/2, lower.tail = F) [1] pbinom(q = 5, size = 10, prob = 1/2, lower.tail = T) [1] pbinom(q = 5, size = 11, prob = 1/2) [1] 0.5 qbinom(p = 0.5, size = 11, prob = 1/2) [1] 5

17 3. Probability Distribution Functions 17 / 19 d, p, q, r Functions Binomial distribution prob <- dbinom(0:10, size = 10, prob = 1/2) plot(0:10, prob, type = "h", col = 4, lwd = 4) points(0:10, prob, col = 4, pch = 16) cumprob <- pbinom(0:10, size = 10, prob = 1/2, lower.tail = T) plot(0:10, cumprob, type = "s", col = 4) plot(0:10, cumsum(prob), type = "s", col = 4) dat.bin <- rbinom(n = 1000, size = 10, prob = 1/2) hist(dat.bin) mean(dat.bin) [1] sd(dat.bin) [1]

18 3. Probability Distribution Functions 18 / 19 d, p, q, r Functions Normal distribution #X N(0,1) dnorm(x = 0, mean = 0, sd = 1) [1] pnorm(q = 0, mean = 0, sd = 1) [1] 0.5 qnorm(p = 0.5, mean = 0, sd = 1) [1] 0 dat.norm <- rnorm(n = 1000, mean = 0, sd = 1) hist(dat.norm, freq = F) mean(dat.norm) [1] sd(dat.norm) [1] xx <- seq(min(dat.norm), max(dat.norm), by = 0.1) yy <- dnorm(x = xx, mean = mean(dat.norm), sd = sd(dat.norm)) lines( xx, yy, col = 2, lwd = 3 )

19 19 / Probability Distribution Functions 1.1 Probability Distributions R function Table names 1.1: Function and parameters names and parameters for standard for probability standard probability distributions distributions. Distribution Name Parameters beta beta shape1, shape2 binomial binom size, prob Cauchy cauchy location, scale chi-squared chisq df exponentila exp rate F f df1, df2 gamma gamma shape, rate geometric geom prob hypergeometric hyper m, n, k log-normal lnorm meanlog, sdlog logistic logis location, scale negative binomial nbinom size, prob normal norm mean, sd normal range nrange size Poisson pois lambda stable stab index, skewness T t df uniform unif min, max Weibull weibull shape, scale Wilcoxon wilcox m, n multivariate normal mvnorm mean, cov...

4. Basic distributions with R

4. Basic distributions with R 4. Basic distributions with R CA200 (based on the book by Prof. Jane M. Horgan) 1 Discrete distributions: Binomial distribution Def: Conditions: 1. An experiment consists of n repeated trials 2. Each trial

More information

It is common in the field of mathematics, for example, geometry, to have theorems or postulates

It is common in the field of mathematics, for example, geometry, to have theorems or postulates CHAPTER 5 POPULATION DISTRIBUTIONS It is common in the field of mathematics, for example, geometry, to have theorems or postulates that establish guiding principles for understanding analysis of data.

More information

Package cbinom. June 10, 2018

Package cbinom. June 10, 2018 Package cbinom June 10, 2018 Type Package Title Continuous Analog of a Binomial Distribution Version 1.1 Date 2018-06-09 Author Dan Dalthorp Maintainer Dan Dalthorp Description Implementation

More information

BIOINFORMATICS MSc PROBABILITY AND STATISTICS SPLUS SHEET 1

BIOINFORMATICS MSc PROBABILITY AND STATISTICS SPLUS SHEET 1 BIOINFORMATICS MSc PROBABILITY AND STATISTICS SPLUS SHEET 1 A data set containing a segment of human chromosome 13 containing the BRCA2 breast cancer gene; it was obtained from the National Center for

More information

This chapter reviews basic probability concepts that are necessary for the modeling and statistical analysis of financial data.

This chapter reviews basic probability concepts that are necessary for the modeling and statistical analysis of financial data. Chapter 1 Probability Concepts This chapter reviews basic probability concepts that are necessary for the modeling and statistical analysis of financial data. 1.1 Random Variables We start with the basic

More information

STATISTICAL LABORATORY, May 18th, 2010 CENTRAL LIMIT THEOREM ILLUSTRATION

STATISTICAL LABORATORY, May 18th, 2010 CENTRAL LIMIT THEOREM ILLUSTRATION STATISTICAL LABORATORY, May 18th, 2010 CENTRAL LIMIT THEOREM ILLUSTRATION Mario Romanazzi 1 BINOMIAL DISTRIBUTION The binomial distribution Bi(n, p), being the sum of n independent Bernoulli distributions,

More information

Lab 9 Distributions and the Central Limit Theorem

Lab 9 Distributions and the Central Limit Theorem Lab 9 Distributions and the Central Limit Theorem Distributions: You will need to become familiar with at least 5 types of distributions in your Introductory Statistics study: the Normal distribution,

More information

Describing Uncertain Variables

Describing Uncertain Variables Describing Uncertain Variables L7 Uncertainty in Variables Uncertainty in concepts and models Uncertainty in variables Lack of precision Lack of knowledge Variability in space/time Describing Uncertainty

More information

Model efficiency is an important area of model management,

Model efficiency is an important area of model management, Roll Your Own By Bob Crompton Model efficiency is an important area of model management, and model compression is one of the dimensions of such efficiency. Model compression improves efficiency by creating

More information

Lecture 2. Probability Distributions Theophanis Tsandilas

Lecture 2. Probability Distributions Theophanis Tsandilas Lecture 2 Probability Distributions Theophanis Tsandilas Comment on measures of dispersion Why do common measures of dispersion (variance and standard deviation) use sums of squares: nx (x i ˆµ) 2 i=1

More information

(# of die rolls that satisfy the criteria) (# of possible die rolls)

(# of die rolls that satisfy the criteria) (# of possible die rolls) BMI 713: Computational Statistics for Biomedical Sciences Assignment 2 1 Random variables and distributions 1. Assume that a die is fair, i.e. if the die is rolled once, the probability of getting each

More information

ME3620. Theory of Engineering Experimentation. Spring Chapter III. Random Variables and Probability Distributions.

ME3620. Theory of Engineering Experimentation. Spring Chapter III. Random Variables and Probability Distributions. ME3620 Theory of Engineering Experimentation Chapter III. Random Variables and Probability Distributions Chapter III 1 3.2 Random Variables In an experiment, a measurement is usually denoted by a variable

More information

Lean Six Sigma: Training/Certification Books and Resources

Lean Six Sigma: Training/Certification Books and Resources Lean Si Sigma Training/Certification Books and Resources Samples from MINITAB BOOK Quality and Si Sigma Tools using MINITAB Statistical Software A complete Guide to Si Sigma DMAIC Tools using MINITAB Prof.

More information

4 Random Variables and Distributions

4 Random Variables and Distributions 4 Random Variables and Distributions Random variables A random variable assigns each outcome in a sample space. e.g. called a realization of that variable to Note: We ll usually denote a random variable

More information

Frequency Distribution Models 1- Probability Density Function (PDF)

Frequency Distribution Models 1- Probability Density Function (PDF) Models 1- Probability Density Function (PDF) What is a PDF model? A mathematical equation that describes the frequency curve or probability distribution of a data set. Why modeling? It represents and summarizes

More information

Study 2: data analysis. Example analysis using R

Study 2: data analysis. Example analysis using R Study 2: data analysis Example analysis using R Steps for data analysis Install software on your computer or locate computer with software (e.g., R, systat, SPSS) Prepare data for analysis Subjects (rows)

More information

Introduction to Computational Finance and Financial Econometrics Descriptive Statistics

Introduction to Computational Finance and Financial Econometrics Descriptive Statistics You can t see this text! Introduction to Computational Finance and Financial Econometrics Descriptive Statistics Eric Zivot Summer 2015 Eric Zivot (Copyright 2015) Descriptive Statistics 1 / 28 Outline

More information

Chapter 4: Commonly Used Distributions. Statistics for Engineers and Scientists Fourth Edition William Navidi

Chapter 4: Commonly Used Distributions. Statistics for Engineers and Scientists Fourth Edition William Navidi Chapter 4: Commonly Used Distributions Statistics for Engineers and Scientists Fourth Edition William Navidi 2014 by Education. This is proprietary material solely for authorized instructor use. Not authorized

More information

Commonly Used Distributions

Commonly Used Distributions Chapter 4: Commonly Used Distributions 1 Introduction Statistical inference involves drawing a sample from a population and analyzing the sample data to learn about the population. We often have some knowledge

More information

The actuar Package. March 24, bstraub... 1 hachemeister... 3 panjer... 4 rearrangepf... 5 simpf Index 8. Buhlmann-Straub Credibility Model

The actuar Package. March 24, bstraub... 1 hachemeister... 3 panjer... 4 rearrangepf... 5 simpf Index 8. Buhlmann-Straub Credibility Model The actuar Package March 24, 2006 Type Package Title Actuarial functions Version 0.1-3 Date 2006-02-16 Author Vincent Goulet, Sébastien Auclair Maintainer Vincent Goulet

More information

1 PMF and CDF Random Variable PMF and CDF... 4

1 PMF and CDF Random Variable PMF and CDF... 4 Summer 2017 UAkron Dept. of Stats [3470 : 461/561] Applied Statistics Ch 3: Discrete RV Contents 1 PMF and CDF 2 1.1 Random Variable................................................................ 3 1.2

More information

Statistics & Flood Frequency Chapter 3. Dr. Philip B. Bedient

Statistics & Flood Frequency Chapter 3. Dr. Philip B. Bedient Statistics & Flood Frequency Chapter 3 Dr. Philip B. Bedient Predicting FLOODS Flood Frequency Analysis n Statistical Methods to evaluate probability exceeding a particular outcome - P (X >20,000 cfs)

More information

Data Analytics (CS40003) Practice Set IV (Topic: Probability and Sampling Distribution)

Data Analytics (CS40003) Practice Set IV (Topic: Probability and Sampling Distribution) Data Analytics (CS40003) Practice Set IV (Topic: Probability and Sampling Distribution) I. Concept Questions 1. Give an example of a random variable in the context of Drawing a card from a deck of cards.

More information

Lecture 3: Probability Distributions (cont d)

Lecture 3: Probability Distributions (cont d) EAS31116/B9036: Statistics in Earth & Atmospheric Sciences Lecture 3: Probability Distributions (cont d) Instructor: Prof. Johnny Luo www.sci.ccny.cuny.edu/~luo Dates Topic Reading (Based on the 2 nd Edition

More information

Lecture Data Science

Lecture Data Science Web Science & Technologies University of Koblenz Landau, Germany Lecture Data Science Statistics Foundations JProf. Dr. Claudia Wagner Learning Goals How to describe sample data? What is mode/median/mean?

More information

book 2014/5/6 15:21 page 261 #285

book 2014/5/6 15:21 page 261 #285 book 2014/5/6 15:21 page 261 #285 Chapter 10 Simulation Simulations provide a powerful way to answer questions and explore properties of statistical estimators and procedures. In this chapter, we will

More information

Probability and distributions

Probability and distributions 2 Probability and distributions The concepts of randomness and probability are central to statistics. It is an empirical fact that most experiments and investigations are not perfectly reproducible. The

More information

Normal distribution Approximating binomial distribution by normal 2.10 Central Limit Theorem

Normal distribution Approximating binomial distribution by normal 2.10 Central Limit Theorem 1.1.2 Normal distribution 1.1.3 Approimating binomial distribution by normal 2.1 Central Limit Theorem Prof. Tesler Math 283 Fall 216 Prof. Tesler 1.1.2-3, 2.1 Normal distribution Math 283 / Fall 216 1

More information

Statistics/BioSci 141, Fall 2006 Lab 2: Probability and Probability Distributions October 13, 2006

Statistics/BioSci 141, Fall 2006 Lab 2: Probability and Probability Distributions October 13, 2006 Statistics/BioSci 141, Fall 2006 Lab 2: Probability and Probability Distributions October 13, 2006 1 Using random samples to estimate a probability Suppose that you are stuck on the following problem:

More information

Lab #7. In previous lectures, we discussed factorials and binomial coefficients. Factorials can be calculated with:

Lab #7. In previous lectures, we discussed factorials and binomial coefficients. Factorials can be calculated with: Introduction to Biostatistics (171:161) Breheny Lab #7 In Lab #7, we are going to use R and SAS to calculate factorials, binomial coefficients, and probabilities from both the binomial and the normal distributions.

More information

Statistical Computing (36-350)

Statistical Computing (36-350) Statistical Computing (36-350) Lecture 14: Simulation I: Generating Random Variables Cosma Shalizi 14 October 2013 Agenda Base R commands The basic random-variable commands Transforming uniform random

More information

IMPORTING DATA IN R. readxl (1)

IMPORTING DATA IN R. readxl (1) IMPORTING DATA IN R readxl (1) Microsoft Excel Common data analysis tool Many R packages to interact with Excel readxl - Hadley Wickham Typical Structure Excel Data Different sheets with tabular data Capital

More information

LAB 2 INSTRUCTIONS PROBABILITY DISTRIBUTIONS IN EXCEL

LAB 2 INSTRUCTIONS PROBABILITY DISTRIBUTIONS IN EXCEL LAB 2 INSTRUCTIONS PROBABILITY DISTRIBUTIONS IN EXCEL There is a wide range of probability distributions (both discrete and continuous) available in Excel. They can be accessed through the Insert Function

More information

2 of PU_2015_375 Which of the following measures is more flexible when compared to other measures?

2 of PU_2015_375 Which of the following measures is more flexible when compared to other measures? PU M Sc Statistics 1 of 100 194 PU_2015_375 The population census period in India is for every:- quarterly Quinqennial year biannual Decennial year 2 of 100 105 PU_2015_375 Which of the following measures

More information

Binomial and Normal Distributions

Binomial and Normal Distributions Binomial and Normal Distributions Bernoulli Trials A Bernoulli trial is a random experiment with 2 special properties: The result of a Bernoulli trial is binary. Examples: Heads vs. Tails, Healthy vs.

More information

Probability Theory and Simulation Methods. April 9th, Lecture 20: Special distributions

Probability Theory and Simulation Methods. April 9th, Lecture 20: Special distributions April 9th, 2018 Lecture 20: Special distributions Week 1 Chapter 1: Axioms of probability Week 2 Chapter 3: Conditional probability and independence Week 4 Chapters 4, 6: Random variables Week 9 Chapter

More information

Chapter 3 Statistical Quality Control, 7th Edition by Douglas C. Montgomery. Copyright (c) 2013 John Wiley & Sons, Inc.

Chapter 3 Statistical Quality Control, 7th Edition by Douglas C. Montgomery. Copyright (c) 2013 John Wiley & Sons, Inc. 1 3.1 Describing Variation Stem-and-Leaf Display Easy to find percentiles of the data; see page 69 2 Plot of Data in Time Order Marginal plot produced by MINITAB Also called a run chart 3 Histograms Useful

More information

Subject CS1 Actuarial Statistics 1 Core Principles. Syllabus. for the 2019 exams. 1 June 2018

Subject CS1 Actuarial Statistics 1 Core Principles. Syllabus. for the 2019 exams. 1 June 2018 ` Subject CS1 Actuarial Statistics 1 Core Principles Syllabus for the 2019 exams 1 June 2018 Copyright in this Core Reading is the property of the Institute and Faculty of Actuaries who are the sole distributors.

More information

The normal distribution is a theoretical model derived mathematically and not empirically.

The normal distribution is a theoretical model derived mathematically and not empirically. Sociology 541 The Normal Distribution Probability and An Introduction to Inferential Statistics Normal Approximation The normal distribution is a theoretical model derived mathematically and not empirically.

More information

2011 Pearson Education, Inc

2011 Pearson Education, Inc Statistics for Business and Economics Chapter 4 Random Variables & Probability Distributions Content 1. Two Types of Random Variables 2. Probability Distributions for Discrete Random Variables 3. The Binomial

More information

Introduction to the Practice of Statistics using R: Chapter 4

Introduction to the Practice of Statistics using R: Chapter 4 Introduction to the Practice of Statistics using R: Chapter 4 Nicholas J. Horton Ben Baumer March 10, 2013 Contents 1 Randomness 2 2 Probability models 3 3 Random variables 4 4 Means and variances of random

More information

Package optimstrat. September 10, 2018

Package optimstrat. September 10, 2018 Type Package Title Choosing the Sample Strategy Version 1.1 Date 2018-09-04 Package optimstrat September 10, 2018 Author Edgar Bueno Maintainer Edgar Bueno

More information

ก ก ก ก ก ก ก. ก (Food Safety Risk Assessment Workshop) 1 : Fundamental ( ก ( NAC 2010)) 2 3 : Excel and Statistics Simulation Software\

ก ก ก ก ก ก ก. ก (Food Safety Risk Assessment Workshop) 1 : Fundamental ( ก ( NAC 2010)) 2 3 : Excel and Statistics Simulation Software\ ก ก ก ก (Food Safety Risk Assessment Workshop) ก ก ก ก ก ก ก ก 5 1 : Fundamental ( ก 29-30.. 53 ( NAC 2010)) 2 3 : Excel and Statistics Simulation Software\ 1 4 2553 4 5 : Quantitative Risk Modeling Microbial

More information

23.1 Probability Distributions

23.1 Probability Distributions 3.1 Probability Distributions Essential Question: What is a probability distribution for a discrete random variable, and how can it be displayed? Explore Using Simulation to Obtain an Empirical Probability

More information

Loss Simulation Model Testing and Enhancement

Loss Simulation Model Testing and Enhancement Loss Simulation Model Testing and Enhancement Casualty Loss Reserve Seminar By Kailan Shang Sept. 2011 Agenda Research Overview Model Testing Real Data Model Enhancement Further Development Enterprise

More information

STAT 825 Notes Random Number Generation

STAT 825 Notes Random Number Generation STAT 825 Notes Random Number Generation What if R/Splus/SAS doesn t have a function to randomly generate data from a particular distribution? Although R, Splus, SAS and other packages can generate data

More information

Statistics for Managers Using Microsoft Excel 7 th Edition

Statistics for Managers Using Microsoft Excel 7 th Edition Statistics for Managers Using Microsoft Excel 7 th Edition Chapter 5 Discrete Probability Distributions Statistics for Managers Using Microsoft Excel 7e Copyright 014 Pearson Education, Inc. Chap 5-1 Learning

More information

Portfolio modelling of operational losses John Gavin 1, QRMS, Risk Control, UBS, London. April 2004.

Portfolio modelling of operational losses John Gavin 1, QRMS, Risk Control, UBS, London. April 2004. Portfolio modelling of operational losses John Gavin 1, QRMS, Risk Control, UBS, London. April 2004. What is operational risk Trends over time Empirical distributions Loss distribution approach Compound

More information

is the bandwidth and controls the level of smoothing of the estimator, n is the sample size and

is the bandwidth and controls the level of smoothing of the estimator, n is the sample size and Paper PH100 Relationship between Total charges and Reimbursements in Outpatient Visits Using SAS GLIMMIX Chakib Battioui, University of Louisville, Louisville, KY ABSTRACT The purpose of this paper is

More information

Statistical Tables Compiled by Alan J. Terry

Statistical Tables Compiled by Alan J. Terry Statistical Tables Compiled by Alan J. Terry School of Science and Sport University of the West of Scotland Paisley, Scotland Contents Table 1: Cumulative binomial probabilities Page 1 Table 2: Cumulative

More information

First Midterm Examination Econ 103, Statistics for Economists February 16th, 2016

First Midterm Examination Econ 103, Statistics for Economists February 16th, 2016 First Midterm Examination Econ 103, Statistics for Economists February 16th, 2016 You will have 70 minutes to complete this exam. Graphing calculators, notes, and textbooks are not permitted. I pledge

More information

Chapter 4 and 5 Note Guide: Probability Distributions

Chapter 4 and 5 Note Guide: Probability Distributions Chapter 4 and 5 Note Guide: Probability Distributions Probability Distributions for a Discrete Random Variable A discrete probability distribution function has two characteristics: Each probability is

More information

CS145: Probability & Computing

CS145: Probability & Computing CS145: Probability & Computing Lecture 8: Variance of Sums, Cumulative Distribution, Continuous Variables Instructor: Eli Upfal Brown University Computer Science Figure credits: Bertsekas & Tsitsiklis,

More information

Session Window. Variable Name Row. Worksheet Window. Double click on MINITAB icon. You will see a split screen: Getting Started with MINITAB

Session Window. Variable Name Row. Worksheet Window. Double click on MINITAB icon. You will see a split screen: Getting Started with MINITAB STARTING MINITAB: Double click on MINITAB icon. You will see a split screen: Session Window Worksheet Window Variable Name Row ACTIVE WINDOW = BLUE INACTIVE WINDOW = GRAY f(x) F(x) Getting Started with

More information

Probability mass function; cumulative distribution function

Probability mass function; cumulative distribution function PHP 2510 Random variables; some discrete distributions Random variables - what are they? Probability mass function; cumulative distribution function Some discrete random variable models: Bernoulli Binomial

More information

One sample z-test and t-test

One sample z-test and t-test One sample z-test and t-test January 30, 2017 psych10.stanford.edu Announcements / Action Items Install ISI package (instructions in Getting Started with R) Assessment Problem Set #3 due Tu 1/31 at 7 PM

More information

Basic Probability Distributions Tutorial From Cyclismo.org

Basic Probability Distributions Tutorial From Cyclismo.org Page 1 of 8 Basic Probability Distributions Tutorial From Cyclismo.org Contents: The Normal Distribution The t Distribution The Binomial Distribution The Chi-Squared Distribution We look at some of the

More information

Contents Part I Descriptive Statistics 1 Introduction and Framework Population, Sample, and Observations Variables Quali

Contents Part I Descriptive Statistics 1 Introduction and Framework Population, Sample, and Observations Variables Quali Part I Descriptive Statistics 1 Introduction and Framework... 3 1.1 Population, Sample, and Observations... 3 1.2 Variables.... 4 1.2.1 Qualitative and Quantitative Variables.... 5 1.2.2 Discrete and Continuous

More information

Application of the Bootstrap Estimating a Population Mean

Application of the Bootstrap Estimating a Population Mean Application of the Bootstrap Estimating a Population Mean Movie Average Shot Lengths Sources: Barry Sands Average Shot Length Movie Database L. Chihara and T. Hesterberg (2011). Mathematical Statistics

More information

Continuous Probability Distributions

Continuous Probability Distributions 8.1 Continuous Probability Distributions Distributions like the binomial probability distribution and the hypergeometric distribution deal with discrete data. The possible values of the random variable

More information

STATISTICAL DATA ANALYSIS USING FUNCTIONS

STATISTICAL DATA ANALYSIS USING FUNCTIONS STATISTICAL DATA ANALYSIS USING FUNCTIONS Excel provides an extensive range of Statistical Functions, that perform calculations from basic mean, median & mode to the more complex statistical distribution

More information

Discrete Probability Distributions and application in Business

Discrete Probability Distributions and application in Business http://wiki.stat.ucla.edu/socr/index.php/socr_courses_2008_thomson_econ261 Discrete Probability Distributions and application in Business By Grace Thomson DISCRETE PROBALITY DISTRIBUTIONS Discrete Probabilities

More information

4-1. Chapter 4. Commonly Used Distributions by The McGraw-Hill Companies, Inc. All rights reserved.

4-1. Chapter 4. Commonly Used Distributions by The McGraw-Hill Companies, Inc. All rights reserved. 4-1 Chapter 4 Commonly Used Distributions 2014 by The Companies, Inc. All rights reserved. Section 4.1: The Bernoulli Distribution 4-2 We use the Bernoulli distribution when we have an experiment which

More information

Probability and Statistics

Probability and Statistics Kristel Van Steen, PhD 2 Montefiore Institute - Systems and Modeling GIGA - Bioinformatics ULg kristel.vansteen@ulg.ac.be CHAPTER 3: PARAMETRIC FAMILIES OF UNIVARIATE DISTRIBUTIONS 1 Why do we need distributions?

More information

A useful modeling tricks.

A useful modeling tricks. .7 Joint models for more than two outcomes We saw that we could write joint models for a pair of variables by specifying the joint probabilities over all pairs of outcomes. In principal, we could do this

More information

Fitting parametric distributions using R: the fitdistrplus package

Fitting parametric distributions using R: the fitdistrplus package Fitting parametric distributions using R: the fitdistrplus package M. L. Delignette-Muller - CNRS UMR 5558 R. Pouillot J.-B. Denis - INRA MIAJ user! 2009,10/07/2009 Background Specifying the probability

More information

Descriptive Statistics Bios 662

Descriptive Statistics Bios 662 Descriptive Statistics Bios 662 Michael G. Hudgens, Ph.D. mhudgens@bios.unc.edu http://www.bios.unc.edu/ mhudgens 2008-08-19 08:51 BIOS 662 1 Descriptive Statistics Descriptive Statistics Types of variables

More information

UMPU, Equal-Tailed, and Pratt Fuzzy Confidence Intervals

UMPU, Equal-Tailed, and Pratt Fuzzy Confidence Intervals UMPU, Equal-Tailed, and Pratt Fuzzy Confidence Intervals Charles J. Geyer Glen D. Meeden August 28, 2005 This note provides a detailed example of three fuzzy confidence intervals proposed in Geyer and

More information

Package tailloss. August 29, 2016

Package tailloss. August 29, 2016 Package tailloss August 29, 2016 Title Estimate the Probability in the Upper Tail of the Aggregate Loss Distribution Set of tools to estimate the probability in the upper tail of the aggregate loss distribution

More information

Intro to Likelihood. Gov 2001 Section. February 2, Gov 2001 Section () Intro to Likelihood February 2, / 44

Intro to Likelihood. Gov 2001 Section. February 2, Gov 2001 Section () Intro to Likelihood February 2, / 44 Intro to Likelihood Gov 2001 Section February 2, 2012 Gov 2001 Section () Intro to Likelihood February 2, 2012 1 / 44 Outline 1 Replication Paper 2 An R Note on the Homework 3 Probability Distributions

More information

Testing the significance of the RV coefficient

Testing the significance of the RV coefficient 1 / 19 Testing the significance of the RV coefficient Application to napping data Julie Josse, François Husson and Jérôme Pagès Applied Mathematics Department Agrocampus Rennes, IRMAR CNRS UMR 6625 Agrostat

More information

Exploring Data and Graphics

Exploring Data and Graphics Exploring Data and Graphics Rick White Department of Statistics, UBC Graduate Pathways to Success Graduate & Postdoctoral Studies November 13, 2013 Outline Summarizing Data Types of Data Visualizing Data

More information

1/2 2. Mean & variance. Mean & standard deviation

1/2 2. Mean & variance. Mean & standard deviation Question # 1 of 10 ( Start time: 09:46:03 PM ) Total Marks: 1 The probability distribution of X is given below. x: 0 1 2 3 4 p(x): 0.73? 0.06 0.04 0.01 What is the value of missing probability? 0.54 0.16

More information

4.3 Normal distribution

4.3 Normal distribution 43 Normal distribution Prof Tesler Math 186 Winter 216 Prof Tesler 43 Normal distribution Math 186 / Winter 216 1 / 4 Normal distribution aka Bell curve and Gaussian distribution The normal distribution

More information

Background. opportunities. the transformation. probability. at the lower. data come

Background. opportunities. the transformation. probability. at the lower. data come The T Chart in Minitab Statisti cal Software Background The T chart is a control chart used to monitor the amount of time between adverse events, where time is measured on a continuous scale. The T chart

More information

The Browse Price Export File Format will conform to the following layout:

The Browse Price Export File Format will conform to the following layout: Browse s Export File Specification In the Pricing & Execution Whole Loan (PE Whole Loan) application, you can export the price results from your Browse s sessions for up to 20 products, four commitment

More information

x is a random variable which is a numerical description of the outcome of an experiment.

x is a random variable which is a numerical description of the outcome of an experiment. Chapter 5 Discrete Probability Distributions Random Variables is a random variable which is a numerical description of the outcome of an eperiment. Discrete: If the possible values change by steps or jumps.

More information

R is a collaborative project with many contributors. Type contributors() for more information.

R is a collaborative project with many contributors. Type contributors() for more information. R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type license() or licence() for distribution details. R is a collaborative project

More information

STA 6166 Fall 2007 Web-based Course. Notes 10: Probability Models

STA 6166 Fall 2007 Web-based Course. Notes 10: Probability Models STA 6166 Fall 2007 Web-based Course 1 Notes 10: Probability Models We first saw the normal model as a useful model for the distribution of some quantitative variables. We ve also seen that if we make a

More information

BloxMath Library Reference

BloxMath Library Reference BloxMath Library Reference Release 3.9 LogicBlox April 25, 2012 CONTENTS 1 Introduction 1 1.1 Using The Library... 1 2 Financial formatting functions 3 3 Statistical distribution functions 5 3.1 Normal

More information

Maximum Likelihood Estimates for Alpha and Beta With Zero SAIDI Days

Maximum Likelihood Estimates for Alpha and Beta With Zero SAIDI Days Maximum Likelihood Estimates for Alpha and Beta With Zero SAIDI Days 1. Introduction Richard D. Christie Department of Electrical Engineering Box 35500 University of Washington Seattle, WA 98195-500 christie@ee.washington.edu

More information

Module 3: Sampling Distributions and the CLT Statistics (OA3102)

Module 3: Sampling Distributions and the CLT Statistics (OA3102) Module 3: Sampling Distributions and the CLT Statistics (OA3102) Professor Ron Fricker Naval Postgraduate School Monterey, California Reading assignment: WM&S chpt 7.1-7.3, 7.5 Revision: 1-12 1 Goals for

More information

Model Paper Statistics Objective. Paper Code Time Allowed: 20 minutes

Model Paper Statistics Objective. Paper Code Time Allowed: 20 minutes Model Paper Statistics Objective Intermediate Part I (11 th Class) Examination Session 2012-2013 and onward Total marks: 17 Paper Code Time Allowed: 20 minutes Note:- You have four choices for each objective

More information

Manual for the TI-83, TI-84, and TI-89 Calculators

Manual for the TI-83, TI-84, and TI-89 Calculators Manual for the TI-83, TI-84, and TI-89 Calculators to accompany Mendenhall/Beaver/Beaver s Introduction to Probability and Statistics, 13 th edition James B. Davis Contents Chapter 1 Introduction...4 Chapter

More information

CS 361: Probability & Statistics

CS 361: Probability & Statistics March 12, 2018 CS 361: Probability & Statistics Inference Binomial likelihood: Example Suppose we have a coin with an unknown probability of heads. We flip the coin 10 times and observe 2 heads. What can

More information

Chapter 4 Probability and Probability Distributions. Sections

Chapter 4 Probability and Probability Distributions. Sections Chapter 4 Probabilit and Probabilit Distributions Sections 4.6-4.10 Sec 4.6 - Variables Variable: takes on different values (or attributes) Random variable: cannot be predicted with certaint Random Variables

More information

FAV i R This paper is produced mechanically as part of FAViR. See for more information.

FAV i R This paper is produced mechanically as part of FAViR. See  for more information. The POT package By Avraham Adler FAV i R This paper is produced mechanically as part of FAViR. See http://www.favir.net for more information. Abstract This paper is intended to briefly demonstrate the

More information

A First Course in Probability

A First Course in Probability A First Course in Probability Seventh Edition Sheldon Ross University of Southern California PEARSON Prentice Hall Upper Saddle River, New Jersey 07458 Preface 1 Combinatorial Analysis 1 1.1 Introduction

More information

Business Statistics 41000: Probability 3

Business Statistics 41000: Probability 3 Business Statistics 41000: Probability 3 Drew D. Creal University of Chicago, Booth School of Business February 7 and 8, 2014 1 Class information Drew D. Creal Email: dcreal@chicagobooth.edu Office: 404

More information

Some Discrete Distribution Families

Some Discrete Distribution Families Some Discrete Distribution Families ST 370 Many families of discrete distributions have been studied; we shall discuss the ones that are most commonly found in applications. In each family, we need a formula

More information

yuimagui: A graphical user interface for the yuima package. User Guide yuimagui v1.0

yuimagui: A graphical user interface for the yuima package. User Guide yuimagui v1.0 yuimagui: A graphical user interface for the yuima package. User Guide yuimagui v1.0 Emanuele Guidotti, Stefano M. Iacus and Lorenzo Mercuri February 21, 2017 Contents 1 yuimagui: Home 3 2 yuimagui: Data

More information

The Normal Distribution & Descriptive Statistics. Kin 304W Week 2: Jan 15, 2012

The Normal Distribution & Descriptive Statistics. Kin 304W Week 2: Jan 15, 2012 The Normal Distribution & Descriptive Statistics Kin 304W Week 2: Jan 15, 2012 1 Questionnaire Results I received 71 completed questionnaires. Thank you! Are you nervous about scientific writing? You re

More information

4-2 Probability Distributions and Probability Density Functions. Figure 4-2 Probability determined from the area under f(x).

4-2 Probability Distributions and Probability Density Functions. Figure 4-2 Probability determined from the area under f(x). 4-2 Probability Distributions and Probability Density Functions Figure 4-2 Probability determined from the area under f(x). 4-2 Probability Distributions and Probability Density Functions Definition 4-2

More information

Research Methodology and Statistic Chapter 9: Data processing (Scilab) Dr. Supakit Nootyaskool IT-KMITL

Research Methodology and Statistic Chapter 9: Data processing (Scilab) Dr. Supakit Nootyaskool IT-KMITL 9 Research Methodology and Statistic Chapter 9: Data processing (Scilab) Dr. Supakit Nootyaskool IT-KMITL supakitnootyaskool@gmail.com Topics Introducing Scilab variables, vector, matrix arithmetic and

More information

Appendix A. Selecting and Using Probability Distributions. In this appendix

Appendix A. Selecting and Using Probability Distributions. In this appendix Appendix A Selecting and Using Probability Distributions In this appendix Understanding probability distributions Selecting a probability distribution Using basic distributions Using continuous distributions

More information

5.4 Normal Approximation of the Binomial Distribution

5.4 Normal Approximation of the Binomial Distribution 5.4 Normal Approximation of the Binomial Distribution Bernoulli Trials have 3 properties: 1. Only two outcomes - PASS or FAIL 2. n identical trials Review from yesterday. 3. Trials are independent - probability

More information

Epidemiology Principle of Biostatistics Chapter 5 Probability Distributions (continued) John Koval

Epidemiology Principle of Biostatistics Chapter 5 Probability Distributions (continued) John Koval Epidemiology 9509 Principle of Biostatistics Chapter 5 Probability Distributions (continued) John Koval Department of Epidemiology and Biostatistics University of Western Ontario What was covered previously

More information

Contents. An Overview of Statistical Applications CHAPTER 1. Contents (ix) Preface... (vii)

Contents. An Overview of Statistical Applications CHAPTER 1. Contents (ix) Preface... (vii) Contents (ix) Contents Preface... (vii) CHAPTER 1 An Overview of Statistical Applications 1.1 Introduction... 1 1. Probability Functions and Statistics... 1..1 Discrete versus Continuous Functions... 1..

More information

Web Science & Technologies University of Koblenz Landau, Germany. Lecture Data Science. Statistics and Probabilities JProf. Dr.

Web Science & Technologies University of Koblenz Landau, Germany. Lecture Data Science. Statistics and Probabilities JProf. Dr. Web Science & Technologies University of Koblenz Landau, Germany Lecture Data Science Statistics and Probabilities JProf. Dr. Claudia Wagner Data Science Open Position @GESIS Student Assistant Job in Data

More information

Package GenOrd. September 12, 2015

Package GenOrd. September 12, 2015 Package GenOrd September 12, 2015 Type Package Title Simulation of Discrete Random Variables with Given Correlation Matrix and Marginal Distributions Version 1.4.0 Date 2015-09-11 Author Alessandro Barbiero,

More information