Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer

Size: px
Start display at page:

Download "Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer"

Transcription

1 Lunds universitet Matematikcentrum Matematisk statistik Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer General information on labs During the rst half of the course MASA01 we will have two labs. is based on programming in R, and will be done in groups of 2-4. The laboratory work It is compulsory to submit a written report for the lab works in the week following the lab. The report should be written so that it can be read independently without the need to use the computer exercise. All graphs should be given descriptive names on the axes. Also all sourcecode should contain comments, and must be included in the report. The report will be due in 2 weeks' time. Exercises marked with asterisk (*) are exercises that can be either partially or fully solved without R. In case of doubts, please contact Debleena Thacker, debleena@maths.lth.se.

2 1 INTRODUCTION TO R Computer Exercise 1 The purpose of this lab is to introduce R as a tool to investigate dierent densities. 1 Introduction to R Following are some useful commands for dierent distributions: Distribution Random numbers Probability-/density function distribution function quantile Normal rnorm dnorm pnorm qnorm Uniform runif dunif punif qunif Binomial rbinom dbinom pbinom qbinom Poisson rpois dpois ppois qpois Exponential rexp dexp pexp qexp Gamma rgamma dgamma pgamma qgamma Quantile functions (fth column) will be used only in the second part of the course. A useful command in R is? or help. Type help(sum) or?sum An extended search is conducted through help.search: help.search("sum") Typical examples A variable is dened by v <- 2 w < The following is an example of how one can use this: u <- (v-w)/5 exp(u) 2

3 1 INTRODUCTION TO R Matrices and vectors Vectors can be dened as functions c() a <- c(12,-4.3,9,5/2) a Sometimes the following are useful: b <- c(6:9) c <- rep(3,4) d <- seq(from = -2, to = 3, by = 0.3) Indexing is done by d[4] the length of a vector can be determined by length() function: length(d) Element-wise operations can be done as follows: a*b 3*a-1 f <- a+b The scalar product of two vectors can be computed as: g <- a%*%b or: sum(a*b) One can use the in-built functions for vectors: exp(a) sin(3*pi)-exp(c) Matrices can be dened in the following manner as follows: fill_number <- c(1:10) m1 <- matrix(fill_number, ncol = 2) m2 <- matrix(fill_number, ncol = 2, byrow = TRUE) m1 m2 What is the dierence between m1 and m2? Also try m3<- cbind(a,b) m4 <- rbind(a,b) The dimension of a matrix : dim(m3) nrow(m3) 3

4 1 INTRODUCTION TO R ncol(m3) Matrices can be indexed by: m1[1,] m1[1,2] m1[,1] Matrix product can be computed by %*% m3%*%m4 m3%*%t(m3) Logical operations are dened element-wise according to the following rules: a <= b a[a<=b] Often one wants to assign values 1 and 0 to TRUE and FALSE. This can be done by as.real as.real(a <= b) The following can be used to dene the indicator variables. Matrix inversion can be done by solve: diag_m <- diag(3, nrow = 4) inv <- solve(diag_m) diag_m%*%inv The type of a variable is given by str function: names <- c("hugo", "Lasse", "Line") str(names) str(d) str(m1) Graphics/Diagrams x <- seq(-10,10,0.1) n <- 15 gaussians <- c(rnorm(100, mean = 0, sd = 1)) y1 <- pnorm(x, mean = 0, sd = 1) y2 <- dnorm(x, mean = 0, sd = 1) plot(x,y1, main = "Standard normal distribution", xlab = "function arguments", ylab = "function values",col = "red", type = "l", xlim = c(-5,5)) lines(x,y2, col = "green", type = "l") legend(-5,0.9, c("density", "distr.function"), col = c("red", "green"), text.col = "blue", lty = c(1, 1)) 4

5 2 DISTRIBUTIONS points(gaussians, rep(0,length(gaussians)), pch = 4) mean(gaussians) sd(gaussians) var(gaussians) help(legend) One plot multiple gures in the same window in the following manner: par(mfrow = c(2,1)) plot(x, sin(x), type = "b") plot(x, sin(x 2), type = "l") One can remove the divisions in the window by: dev.off() or par(mfrow = c(1,1)) One can nish on the R sessions by typing: q() at which point you will be prompted as to whether or not you want to save your workspace. If you do not save it, it will be lost. To save your workspace (type y). 2 Distributions Problem* 2.1. What is the denition of the distribution of a random variable? Problem* 2.2. Dene density and probability functions of a random variable. Problem* 2.3. Let X be a continuous random variable with density function f X (x) = 1 2 x1 [0,2](x). Determine P ( 1 X 2 ). (1 A ( ) denotes the indicator function of A, where 1 A (x) = 1 for x A and 1 A (x) = 0 for x / A. ) Problem* 2.4. Let X be a discrete random variable with probability function Determine c. Calculate P ( 1 X < 4 ). p X (k) = c 0.4 k, k = 0, 1, 2,... Problem* 2.5. Give an example of an experiment such that its outcome can be described by the following Binomial random variable X Bin(n, p). 5

6 2 DISTRIBUTIONS Problem* 2.6. What is the dierence between hypergeometric and binomial distributions? 6

7 3 PRACTICALS WITH R 3 Practicals with R Problem 3.1. Let X be exponentially distributed with E(X) = 4. Plot (using R) the distribution function F X ( ) of X. Problem 3.2. Determine P (X 4) where X Poisson(3). Compute P (X 3) for same X using R. Problem 3.3. Compute (using R) P (X 5) då X where N (µ = 2, σ 2 = 3). note that the parameters in dnorm are expectation µ and standard deviation σ (and not the variance). Problem 3.4. Compute (using R) P (X 4) where X Bin(10, 0.6) Problem 3.5. Plot the probability functions for Poisson(10) and Bin(n, p n ) where (n, p n ) {(11, 10/11), (20, 1/2), (100, 0.1), (1000, 0.01)}. Plot all of them in the same window: For example start with: x <- seq(0,20,1) plot(x, dpois(x, 10), ylim = c(0,0.5), col = "red", main = "comparision of densities", type = "l") One can use the command lines to add a graphic in a plot window. Use dierent colors for dierent densities. Type colors() for a complete list of available colors). What do you observe? Can you say something about when can one describe a Binomial distribution with the help of Poisson distribution? Problem 3.6. Plot the densities of N (5, 2), unif(0, 10) and Exp(rate = 1/5) in the same window. Use dierent colors. Remember to label them. Histogram A histogram can describe how values in a data set is distributed over an interval. This interval is divided into an (optional) number of subintervals, and we can count the number of values in each subinterval. Using a bar chart, histogram can be easily visualized.. Use R function rexp to simulate a vector X of 1000 exponential random numbers with mean 3. To see how to use function rexp and its parameters, type help(rexp) and read the help text. X <- rexp(1000, rate = 1/3) We want to draw a histogramm of X with 30 classes. Let's type 7

8 3 PRACTICALS WITH R h <- hist(x, breaks = 30, ylab = "counts", main = "Histogram över X Exp(1/3)", col = "lightblue") The break points of the subintervals that has been used in the function hist can be obtained by bryt<-h$breaks and the length of bryt by length(bryt). hist may not use the number of breakpoints as many breakpoints as you enter. Instead, it chooses breakpoints in a "nice" way. It chooses m 30 (usually m 30) equally spaced breakpoints such that their distance is a round value. This is done by the function pretty, type help(pretty) if you want to know more. If you want to control over vertices, then the best way is to choose break points yourself. You can for example write bins <- seq(0, max(x), length.out = 30) h2 <- hist(x, breaks = bins, ylab = "counts", col = "lightblue", main = "Histogram of random numbers with Exp(3)") Type str(h) to get an overview of all values returned by hist. One can obtain the number of data points in each sub-interval by h$counts The histogram shows the number of data points in each subgroup. However, we are interested in comparing the histogram with the theoretical density function and hence, you need to normalize the histogram. Problem 3.7 (Plot normalised histogram). What is the charaterisitics of probability function and how can one scale the histograms in order to be able to relate them to densities. Observe that hist(...)$counts gives the values of the histogram and hist(...)$breaks gives the subinterval break-points. One can plot a bar-diagram using barplot. Hints: The command diff(hist(...)$breaks) gives the dierence between two consecutive break points. Problem 3.8. Generate a sample of size 1000 from N (20, σ 2 = 6). Draw a normalised histogram from this sample. Plot the density of N (20, 6) in the same graph, and compare it with the histogram. Problem 3.9. An alternative way to plot the histogram will be freq = FALSE i hist function: hist(x, 30, freq = FALSE, main = "normalised histogram") Let X be a Normal randon=m variable with mean µ = 1 and variance σ 2 = 2. Y = 2X + 3. What is the distribution of Y? 8 Assume

9 3 PRACTICALS WITH R Generate two samples of size 5000 each, one from the distribution of X, and another from the distribution of Y. Draw the respective normalised histograms using hist and freq = FALSE. Plot the densities of X and Y in the same gure. 9

R Functions for Probability Distributions

R Functions for Probability Distributions R Functions for Probability Distributions Young W. Lim 2018-03-22 Thr Young W. Lim R Functions for Probability Distributions 2018-03-22 Thr 1 / 15 Outline 1 R Functions for Probability Distributions Based

More information

1 Probability Distributions

1 Probability Distributions 1 Probability Distributions A probability distribution describes how the values of a random variable are distributed. For example, the collection of all possible outcomes of a sequence of coin tossing

More information

GOV 2001/ 1002/ E-2001 Section 3 Theories of Inference

GOV 2001/ 1002/ E-2001 Section 3 Theories of Inference GOV 2001/ 1002/ E-2001 Section 3 Theories of Inference Solé Prillaman Harvard University February 11, 2015 1 / 48 LOGISTICS Reading Assignment- Unifying Political Methodology chs 2 and 4. Problem Set 3-

More information

Explore the data. Anja Bråthen Kristoffersen Biomedical Research Group

Explore the data. Anja Bråthen Kristoffersen Biomedical Research Group Explore the data Anja Bråthen Kristoffersen Biomedical Research Group density 0.2 0.4 0.6 0.8 Probability distributions Can be either discrete or continuous (uniform, bernoulli, normal, etc) Defined by

More information

Lecture 09: Sep 19, Randomness. Random Variables Sampling Probability Distributions Caching. James Balamuta STAT UIUC

Lecture 09: Sep 19, Randomness. Random Variables Sampling Probability Distributions Caching. James Balamuta STAT UIUC Lecture 09: Sep 19, 2018 Randomness Random Variables Sampling Probability Distributions Caching James Balamuta STAT 385 @ UIUC Announcements hw03 is due on Friday, Sep 21st, 2018 @ 6:00 PM Quiz 04 covers

More information

Explore the data. Anja Bråthen Kristoffersen

Explore the data. Anja Bråthen Kristoffersen Explore the data Anja Bråthen Kristoffersen density 0.2 0.4 0.6 0.8 Probability distributions Can be either discrete or continuous (uniform, bernoulli, normal, etc) Defined by a density function, p(x)

More information

R Based Probability Distributions

R Based Probability Distributions General Comments R Based Probability Distributions When a parameter name is ollowed by an equal sign, the value given is the deault. Consider a random variable that has the range, a x b. The parameter,

More information

Statistical Computing Session 4: Random Simulation

Statistical Computing Session 4: Random Simulation Statistical Computing Session 4: Random Simulation Paul Eilers & Dimitris Rizopoulos Department of Biostatistics, Erasmus University Medical Center p.eilers@erasmusmc.nl Masters Track Statistical Sciences,

More information

GENERALIZED ERROR DISTRIBUTION

GENERALIZED ERROR DISTRIBUTION CHAPTER 21 GENERALIZED ERROR DISTRIBUTION 21.1 ASSIGNMENT Write R functions for the Generalized Error Distribution, GED. Nelson [1991] introduced the Generalized Error Distribution for modeling GARCH time

More information

Introduction to R and Programming

Introduction to R and Programming Introduction to R and Programming Nathaniel E. Helwig Assistant Professor of Psychology and Statistics University of Minnesota (Twin Cities) Updated 04-Jan-2017 Nathaniel E. Helwig (U of Minnesota) Introduction

More information

Chapter 3: Methods for Generating Random Variables

Chapter 3: Methods for Generating Random Variables Chapter 3: Methods for Generating Random Variables Lecturer: Zhao Jianhua Department of Statistics Yunnan University of Finance and Economics Outline 3.1 Introduction Random Generators of Common Probability

More information

STAT 675 Statistical Computing

STAT 675 Statistical Computing STAT 675 Statistical Computing Solutions to Homework Exercises Chapter 3 Note that some outputs may differ, depending on machine settings, generating seeds, random variate generation, etc. 3.1. Sample

More information

Class 04 - Statistical Inference

Class 04 - Statistical Inference Class 4 - Statistical Inference Question 1: 1. What parameters control the shape of the normal distribution? Make some histograms of different normal distributions, in each, alter the parameter values

More information

Introductory Statistics with R: Simple Inferences for continuous data

Introductory Statistics with R: Simple Inferences for continuous data Introductory Statistics with R: Simple Inferences for continuous data Statistical Packages STAT 1301 / 2300, Fall 2014 Sungkyu Jung Department of Statistics University of Pittsburgh E-mail: sungkyu@pitt.edu

More information

Introduction to Statistical Data Analysis Lecture 3: Probability Distributions

Introduction to Statistical Data Analysis Lecture 3: Probability Distributions Introduction to Statistical Data Analysis Lecture 3: Probability Distributions James V. Lambers Department of Mathematics The University of Southern Mississippi James V. Lambers Statistical Data Analysis

More information

The Normal Distribution

The Normal Distribution The Mary Lindstrom (Adapted from notes provided by Professor Bret Larget) February 10, 2004 Statistics 371 Last modified: February 11, 2004 The The (AKA Gaussian Distribution) is our first distribution

More information

TMA4265: Stochastic Processes

TMA4265: Stochastic Processes General information You nd all important information on the course webpage: TMA4265: Stochastic Processes https://wiki.math.ntnu.no/tma4265/2014h/start Please check this website regularly! Lecturers: Andrea

More information

Holiday Assignment PS 531

Holiday Assignment PS 531 Holiday Assignment PS 531 Prof: Jake Bowers TA: Paul Testa January 27, 2014 Overview Below is a brief assignment for you to complete over the break. It should serve as refresher, covering some of the basic

More information

Textbook: Survivial Analysis Techniques for Censored and Truncated Data 2nd edition, by Klein and Moeschberger

Textbook: Survivial Analysis Techniques for Censored and Truncated Data 2nd edition, by Klein and Moeschberger Lecturer: James Degnan Office: SMLC 342 Office hours: MW 12:00 1:00 or by appointment E-mail: jamdeg@unm.edu Please include STAT474 or STAT574 in the subject line of the email to make sure I don t overlook

More information

STT 315 Problem Set #3

STT 315 Problem Set #3 1. A student is asked to calculate the probability that x = 3.5 when x is chosen from a normal distribution with the following parameters: mean=3, sd=5. To calculate the answer, he uses this command: >

More information

Frontier Analysis with R

Frontier Analysis with R Summer School on Mathematical Methods in Finance and Economy June 2010 (slides modified in August 2010) Introduction A first simulated example Analysis of the real data The packages about frontier analysis

More information

Inverse Transform Simulations

Inverse Transform Simulations 0 20000 50000 0 20000 50000 Inverse Transform Simulations (a) Using the Inverse Transform Method, write R codes to draw 100,000 observations from the following distributions (b) Check our simulations with

More information

Probability theory and inference statistics! Dr. Paola Grosso! SNE research group!! (preferred!)!!

Probability theory and inference statistics! Dr. Paola Grosso! SNE research group!!  (preferred!)!! Probability theory and inference statistics Dr. Paola Grosso SNE research group p.grosso@uva.nl paola.grosso@os3.nl (preferred) Roadmap Lecture 1: Monday Sep. 22nd Collecting data Presenting data Descriptive

More information

Generalized Linear Models in R

Generalized Linear Models in R Generalized Linear Models in R NO ORDER Kenneth K. Lopiano, Garvesh Raskutti, Dan Yang last modified 28 4 2013 1 Outline 1. Background and preliminaries 2. Data manipulation and exercises 3. Data structures

More information

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /13/ /12

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /13/ /12 BIO5312 Biostatistics R Session 03: Random Number and Probability Distributions Dr. Junchao Xia Center of Biophysics and Computational Biology Fall 2016 9/13/2016 1 /12 Random Number Generator Random number

More information

Metric Predicted Variable on Two Groups

Metric Predicted Variable on Two Groups Metric Predicted Variable on Two Groups Tim Frasier Copyright Tim Frasier This work is licensed under the Creative Commons Attribution 4.0 International license. Click here for more information. Goals

More information

EE/CpE 345. Modeling and Simulation. Fall Class 10 November 18, 2002

EE/CpE 345. Modeling and Simulation. Fall Class 10 November 18, 2002 EE/CpE 345 Modeling and Simulation Class 0 November 8, 2002 Input Modeling Inputs(t) Actual System Outputs(t) Parameters? Simulated System Outputs(t) The input data is the driving force for the simulation

More information

Math/Stat 3850 Exam 1

Math/Stat 3850 Exam 1 2/21/18 Name: Math/Stat 3850 Exam 1 There are 10 questions, worth a total of 100 points. You may use R, your calculator, and any written or internet resources on this test, although you are not allowed

More information

Maximum Likelihood Exercises SOLUTIONS

Maximum Likelihood Exercises SOLUTIONS Maximum Likelihood Exercises SOLUTIONS Exercise : Frog covariates () Before we can fit the model, we have to do a little recoding of the data. Both ReedfrogPred$sie and ReedfrogPred$pred are text data,

More information

EE/CpE 345. Modeling and Simulation. Fall Class 9

EE/CpE 345. Modeling and Simulation. Fall Class 9 EE/CpE 345 Modeling and Simulation Class 9 208 Input Modeling Inputs(t) Actual System Outputs(t) Parameters? Simulated System Outputs(t) The input data is the driving force for the simulation - the behavior

More information

1 The Normal approximation

1 The Normal approximation Statistics and Linguistic Applications Hale February 3, 2010 1 The Normal approximation Review of frequency Remember frequency? That s how often a particular level appears in a data set. Take Keith Johnson

More information

R STATISTICAL COMPUTING

R STATISTICAL COMPUTING R STATISTICAL COMPUTING some R Examples Dennis Friday 2 nd and Saturday 3 rd May, 14. Topics covered Vector and Matrix operation. File Operations. Evaluation of Probability Density Functions. Testing of

More information

FW 544: Computer Lab Probability basics in R

FW 544: Computer Lab Probability basics in R FW 544: Computer Lab Probability basics in R During this laboratory, students will be taught the properties and uses of several continuous and discrete statistical distributions that are commonly used

More information

Package jmuoutlier. February 17, 2017

Package jmuoutlier. February 17, 2017 Type Package Package jmuoutlier February 17, 2017 Title Permutation Tests for Nonparametric Statistics Version 1.3 Date 2017-02-17 Author Steven T. Garren [aut, cre] Maintainer Steven T. Garren

More information

Lecture 5 : The Poisson Distribution

Lecture 5 : The Poisson Distribution Lecture 5 : The Poisson Distribution Jonathan Marchini November 5, 2004 1 Introduction Many experimental situations occur in which we observe the counts of events within a set unit of time, area, volume,

More information

R in 02402: Introduction to Statistic

R in 02402: Introduction to Statistic R in 02402: Introduction to Statistic Per Bruun Brockhoff DTU Informatics, DK-2800 Lyngby 8. november 2011 Indhold 1 Using R on the Databar-System at DTU 5 1.1 Access.......................................

More information

Quantitative Understanding in Biology Module I: Statistics Lecture II: Probability Density Functions and the Normal Distribution

Quantitative Understanding in Biology Module I: Statistics Lecture II: Probability Density Functions and the Normal Distribution Quantitative Understanding in Biology Module I: Statistics Lecture II: Probability Density Functions and the Normal Distribution The Binomial Distribution Consider a series of N repeated, independent yes/no

More information

Statistical distributions: Synopsis

Statistical distributions: Synopsis Statistical distributions: Synopsis Basics of Distributions Special Distributions: Binomial, Exponential, Poisson, Gamma, Chi-Square, F, Extreme-value etc Uniform Distribution Empirical Distributions Quantile

More information

Probability Distributions & Sampling Distributions

Probability Distributions & Sampling Distributions GOV 2000 Section 4: Probability Distributions & Sampling Distributions Konstantin Kashin 1 Harvard University September 26, 2012 1 These notes and accompanying code draw on the notes from Molly Roberts,

More information

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu MATLAB BASICS Instructor: Prof. Shahrouk Ahmadi 1. What are M-files TA: Kartik Bulusu M-files are files that contain a collection of MATLAB commands or are used to define new MATLAB functions. For the

More information

Prediction problems 3: Validation and Model Checking

Prediction problems 3: Validation and Model Checking Prediction problems 3: Validation and Model Checking Data Science 101 Team May 17, 2018 Outline Validation Why is it important How should we do it? Model checking Checking whether your model is a good

More information

Metric Predicted Variable on One Group

Metric Predicted Variable on One Group Metric Predicted Variable on One Group Tim Frasier Copyright Tim Frasier This work is licensed under the Creative Commons Attribution 4.0 International license. Click here for more information. Prior Homework

More information

Introduction to Statistics and R

Introduction to Statistics and R Introduction to Statistics and R Mayo-Illinois Computational Genomics Workshop (2018) Ruoqing Zhu, Ph.D. Department of Statistics, UIUC rqzhu@illinois.edu June 18, 2018 Abstract This document is a supplimentary

More information

Robustness and Distribution Assumptions

Robustness and Distribution Assumptions Chapter 1 Robustness and Distribution Assumptions 1.1 Introduction In statistics, one often works with model assumptions, i.e., one assumes that data follow a certain model. Then one makes use of methodology

More information

TMA4265: Stochastic Processes

TMA4265: Stochastic Processes General information TMA4265: Stochastic Processes Andrea Riebler August 18th, 2015 You find all important information on the course webpage: https://wiki.math.ntnu.no/tma4265/2015h/start Please check this

More information

Univariate Descriptive Statistics for One Sample

Univariate Descriptive Statistics for One Sample Department of Psychology and Human Development Vanderbilt University 1 Introduction 2 3 4 5 6 7 8 Introduction Our first step in descriptive statistics is to characterize the data in a single group of

More information

Transformations of Standard Uniform Distributions

Transformations of Standard Uniform Distributions Transformations of Standard Uniform Distributions We have seen that the R function runif uses a random number generator to simulate a sample from the standard uniform distribution UNIF(0, 1). All of our

More information

Sampling Inspection. Young W. Lim Wed. Young W. Lim Sampling Inspection Wed 1 / 26

Sampling Inspection. Young W. Lim Wed. Young W. Lim Sampling Inspection Wed 1 / 26 Sampling Inspection Young W. Lim 2018-07-18 Wed Young W. Lim Sampling Inspection 2018-07-18 Wed 1 / 26 Outline 1 Sampling Inspection Based on Background Single Sampling Inspection Scheme Simulating Sampling

More information

f Simulation Example: Simulating p-values of Two Sample Variance Test. Name: Example June 26, 2011 Math Treibergs

f Simulation Example: Simulating p-values of Two Sample Variance Test. Name: Example June 26, 2011 Math Treibergs Math 3070 1. Treibergs f Simulation Example: Simulating p-values of Two Sample Variance Test. Name: Example June 26, 2011 The t-test is fairly robust with regard to actual distribution of data. But the

More information

Metric Predicted Variable With One Nominal Predictor Variable

Metric Predicted Variable With One Nominal Predictor Variable Metric Predicted Variable With One Nominal Predictor Variable Tim Frasier Copyright Tim Frasier This work is licensed under the Creative Commons Attribution 4.0 International license. Click here for more

More information

Package interspread. September 7, Index 11. InterSpread Plus: summary information

Package interspread. September 7, Index 11. InterSpread Plus: summary information Package interspread September 7, 2012 Version 0.2-2 Date 2012-09-07 Title Functions for analysing InterSpread Plus simulation output Author Mark Stevenson A package for analysing

More information

Measurement, Scaling, and Dimensional Analysis Summer 2017 METRIC MDS IN R

Measurement, Scaling, and Dimensional Analysis Summer 2017 METRIC MDS IN R Measurement, Scaling, and Dimensional Analysis Summer 2017 Bill Jacoby METRIC MDS IN R This handout shows the contents of an R session that carries out a metric multidimensional scaling analysis of the

More information

Some hints for the Radioactive Decay lab

Some hints for the Radioactive Decay lab Some hints for the Radioactive Decay lab Edward Stokan, March 7, 2011 Plotting a histogram using Microsoft Excel The way I make histograms in Excel is to put the bounds of the bin on the top row beside

More information

10.1 Generate n = 100 standard lognormal data points via the R commands

10.1 Generate n = 100 standard lognormal data points via the R commands STAT 675 Statistical Computing Solutions to Homework Exercises Chapter 10 Note that some outputs may differ, depending on machine settings, generating seeds, random variate generation, etc. 10.1 Generate

More information

Continuous random variables

Continuous random variables Continuous random variables Continuous r.v. s take an uncountably infinite number of possible values. Examples: Heights of people Weights of apples Diameters of bolts Life lengths of light-bulbs We cannot

More information

Lab 2: Photon Counting with a Photomultiplier Tube

Lab 2: Photon Counting with a Photomultiplier Tube Lab 2: Photon Counting with a Photomultiplier Tube 1 Introduction 1.1 Goals In this lab, you will investigate properties of light using a photomultiplier tube (PMT). You will assess the quantitative measurements

More information

3. Shrink the vector you just created by removing the first element. One could also use the [] operators with a negative index to remove an element.

3. Shrink the vector you just created by removing the first element. One could also use the [] operators with a negative index to remove an element. BMI 713: Computational Statistical for Biomedical Sciences Assignment 1 September 9, 2010 (due Sept 16 for Part 1; Sept 23 for Part 2 and 3) 1 Basic 1. Use the : operator to create the vector (1, 2, 3,

More information

Package depth.plot. December 20, 2015

Package depth.plot. December 20, 2015 Package depth.plot December 20, 2015 Type Package Title Multivariate Analogy of Quantiles Version 0.1 Date 2015-12-19 Maintainer Could be used to obtain spatial depths, spatial ranks and outliers of multivariate

More information

Outline PMF, CDF and PDF Mean, Variance and Percentiles Some Common Distributions. Week 5 Random Variables and Their Distributions

Outline PMF, CDF and PDF Mean, Variance and Percentiles Some Common Distributions. Week 5 Random Variables and Their Distributions Week 5 Random Variables and Their Distributions Week 5 Objectives This week we give more general definitions of mean value, variance and percentiles, and introduce the first probability models for discrete

More information

Statistical Simulation An Introduction

Statistical Simulation An Introduction James H. Steiger Department of Psychology and Human Development Vanderbilt University Regression Modeling, 2009 Simulation Through Bootstrapping Introduction 1 Introduction When We Don t Need Simulation

More information

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 You can work this exercise in either matlab or mathematica. Your choice. A simple harmonic oscillator is constructed from a mass m and a spring

More information

Hierarchical Modeling

Hierarchical Modeling Hierarchical Modeling Tim Frasier Copyright Tim Frasier This work is licensed under the Creative Commons Attribution 4.0 International license. Click here for more information. General Idea One benefit

More information

Lecture 4: Random Variables and Distributions

Lecture 4: Random Variables and Distributions Lecture 4: Random Variables and Distributions Goals Random Variables Overview of discrete and continuous distributions important in genetics/genomics Working with distributions in R Random Variables A

More information

Generating Random Numbers

Generating Random Numbers Generating Random Numbers Seungchul Baek Department of Mathematics and Statistics, UMBC STAT 633: Statistical Computing 1 / 67 Introduction Simulation is a very powerful tool for statisticians. It allows

More information

ST417 Introduction to Bayesian Modelling. Conjugate Modelling (Poisson-Gamma)

ST417 Introduction to Bayesian Modelling. Conjugate Modelling (Poisson-Gamma) ST417 Introduction to Bayesian Modelling Conjugate Modelling (Poisson-Gamma) Slides based on the source provided courtesy of Prof. D.Draper, UCSC ST417 Intro to Bayesian Modelling 1 Integer-Valued Outcomes

More information

Assignments. Statistics Workshop 1: Introduction to R. Tuesday May 26, Atoms, Vectors and Matrices

Assignments. Statistics Workshop 1: Introduction to R. Tuesday May 26, Atoms, Vectors and Matrices Statistics Workshop 1: Introduction to R. Tuesday May 26, 2009 Assignments Generally speaking, there are three basic forms of assigning data. Case one is the single atom or a single number. Assigning a

More information

Computer Assignment 8 - Discriminant Analysis. 1 Linear Discriminant Analysis

Computer Assignment 8 - Discriminant Analysis. 1 Linear Discriminant Analysis Computer Assignment 8 - Discriminant Analysis Created by James D. Wilson, UNC Chapel Hill Edited by Andrew Nobel and Kelly Bodwin, UNC Chapel Hill In this assignment, we will investigate another tool for

More information

Online Appendix to Mixed Modeling for Irregularly Sampled and Correlated Functional Data: Speech Science Spplications

Online Appendix to Mixed Modeling for Irregularly Sampled and Correlated Functional Data: Speech Science Spplications Online Appendix to Mixed Modeling for Irregularly Sampled and Correlated Functional Data: Speech Science Spplications Marianne Pouplier, Jona Cederbaum, Philip Hoole, Stefania Marin, Sonja Greven R Syntax

More information

Biostatistics Xinhai Li Probability distribution

Biostatistics Xinhai Li Probability distribution Probability distribution 1 Table of content Probability theory Some distributions Binomial distribution Poisson distribution Negative binomial distribution Uniform distribution Normal distribution Chi-square

More information

Markov processes, lab 2

Markov processes, lab 2 Lunds Universitet Matematikcentrum Matematisk statistik FMSF15/MASC03 Markovprocesser Markov processes, lab 2 The first part of the lab is about simple Poisson processes. You will simulate and analyse

More information

Maximum Likelihood Estimation

Maximum Likelihood Estimation Maximum Likelihood Estimation Guy Lebanon February 19, 2011 Maximum likelihood estimation is the most popular general purpose method for obtaining estimating a distribution from a finite sample. It was

More information

Geology Geomath Computer Lab Quadratics and Settling Velocities

Geology Geomath Computer Lab Quadratics and Settling Velocities Geology 351 - Geomath Computer Lab Quadratics and Settling Velocities In Chapter 3 of Mathematics: A simple tool for geologists, Waltham takes us through a brief review of quadratic equations and their

More information

Learning Packet. Lesson 5b Solving Quadratic Equations THIS BOX FOR INSTRUCTOR GRADING USE ONLY

Learning Packet. Lesson 5b Solving Quadratic Equations THIS BOX FOR INSTRUCTOR GRADING USE ONLY Learning Packet Student Name Due Date Class Time/Day Submission Date THIS BOX FOR INSTRUCTOR GRADING USE ONLY Mini-Lesson is complete and information presented is as found on media links (0 5 pts) Comments:

More information

MAT300/500 Programming Project Spring 2019

MAT300/500 Programming Project Spring 2019 MAT300/500 Programming Project Spring 2019 Please submit all project parts on the Moodle page for MAT300 or MAT500. Due dates are listed on the syllabus and the Moodle site. You should include all neccessary

More information

Tabulation means putting data into tables. A table is a matrix of data in rows and columns, with the rows and the columns having titles.

Tabulation means putting data into tables. A table is a matrix of data in rows and columns, with the rows and the columns having titles. 1 Tabulation means putting data into tables. A table is a matrix of data in rows and columns, with the rows and the columns having titles. 2 converting the set of numbers into the form of a grouped frequency

More information

Math 98 - Introduction to MATLAB Programming. Spring Lecture 3

Math 98 - Introduction to MATLAB Programming. Spring Lecture 3 Reminders Instructor: Chris Policastro Class Website: https://math.berkeley.edu/~cpoli/math98/fall2016.html Assignment Submission: https://bcourses.berkeley.edu Homework 2 1 Due September 8th by 11:59pm

More information

Senior astrophysics Lab 2: Evolution of a 1 M star

Senior astrophysics Lab 2: Evolution of a 1 M star Senior astrophysics Lab 2: Evolution of a 1 M star Name: Checkpoints due: Friday 13 April 2018 1 Introduction This is the rst of two computer labs using existing software to investigate the internal structure

More information

EEE161 Applied Electromagnetics Laboratory 1

EEE161 Applied Electromagnetics Laboratory 1 Dr. Milica Marković Applied Electromagnetics Laboratory page 1 EEE161 Applied Electromagnetics Laboratory 1 Instructor: Dr. Milica Marković Office: Riverside Hall 3028 Email: milica@csus.edu Web:http://gaia.ecs.csus.edu/

More information

Using R in 200D Luke Sonnet

Using R in 200D Luke Sonnet Using R in 200D Luke Sonnet Contents Working with data frames 1 Working with variables........................................... 1 Analyzing data............................................... 3 Random

More information

Stat 135, Fall 2006 A. Adhikari HOMEWORK 6 SOLUTIONS

Stat 135, Fall 2006 A. Adhikari HOMEWORK 6 SOLUTIONS Stat 135, Fall 2006 A. Adhikari HOMEWORK 6 SOLUTIONS 1a. Under the null hypothesis X has the binomial (100,.5) distribution with E(X) = 50 and SE(X) = 5. So P ( X 50 > 10) is (approximately) two tails

More information

AMS 132: Discussion Section 2

AMS 132: Discussion Section 2 Prof. David Draper Department of Applied Mathematics and Statistics University of California, Santa Cruz AMS 132: Discussion Section 2 All computer operations in this course will be described for the Windows

More information

Chapter Learning Objectives. Probability Distributions and Probability Density Functions. Continuous Random Variables

Chapter Learning Objectives. Probability Distributions and Probability Density Functions. Continuous Random Variables Chapter 4: Continuous Random Variables and Probability s 4-1 Continuous Random Variables 4-2 Probability s and Probability Density Functions 4-3 Cumulative Functions 4-4 Mean and Variance of a Continuous

More information

Matter & Interactions I Fall 2016

Matter & Interactions I Fall 2016 33-151 Matter & Interactions I Fall 2016 Name (Printed) Instructor Signature for 9.P70 (a): Instructor Signature for 9.P70 (b): Instructor Signature for 9.P70 (c): Instructor Signature for 9.P71: Due Date:

More information

Chapter 3. Chapter 3 sections

Chapter 3. Chapter 3 sections sections 3.1 Random Variables and Discrete Distributions 3.2 Continuous Distributions 3.4 Bivariate Distributions 3.5 Marginal Distributions 3.6 Conditional Distributions 3.7 Multivariate Distributions

More information

Even and odd functions

Even and odd functions Connexions module: m15279 1 Even and odd functions Sunil Kumar Singh This work is produced by The Connexions Project and licensed under the Creative Commons Attribution License Even and odd functions are

More information

Munitions Example: Negative Binomial to Predict Number of Accidents

Munitions Example: Negative Binomial to Predict Number of Accidents Math 37 1. Treibergs Munitions Eample: Negative Binomial to Predict Number of Accidents Name: Eample July 17, 211 This problem comes from Bulmer, Principles of Statistics, Dover, 1979, which is a republication

More information

R Demonstration ANCOVA

R Demonstration ANCOVA R Demonstration ANCOVA Objective: The purpose of this week s session is to demonstrate how to perform an analysis of covariance (ANCOVA) in R, and how to plot the regression lines for each level of the

More information

Exponential Functions and Graphs - Grade 11 *

Exponential Functions and Graphs - Grade 11 * OpenStax-CNX module: m30856 1 Exponential Functions and Graphs - Grade 11 * Rory Adams Free High School Science Texts Project Heather Williams This work is produced by OpenStax-CNX and licensed under the

More information

Package misctools. November 25, 2016

Package misctools. November 25, 2016 Version 0.6-22 Date 2016-11-25 Title Miscellaneous Tools and Utilities Author, Ott Toomet Package misctools November 25, 2016 Maintainer Depends R (>= 2.14.0) Suggests Ecdat

More information

ECE 650. Some MATLAB Help (addendum to Lecture 1) D. Van Alphen (Thanks to Prof. Katz for the Histogram PDF Notes!)

ECE 650. Some MATLAB Help (addendum to Lecture 1) D. Van Alphen (Thanks to Prof. Katz for the Histogram PDF Notes!) ECE 65 Some MATLAB Help (addendum to Lecture 1) D. Van Alphen (Thanks to Prof. Katz for the Histogram PDF Notes!) Obtaining Probabilities for Gaussian RV s - An Example Let X be N(1, s 2 = 4). Find Pr(X

More information

The Poisson Distribution

The Poisson Distribution The Poisson Distribution Mary Lindstrom (Adapted from notes provided by Professor Bret Larget) February 5, 2004 Statistics 371 Last modified: February 4, 2004 The Poisson Distribution The Poisson distribution

More information

Math Computer Lab 4 : Fourier Series

Math Computer Lab 4 : Fourier Series Math 227 - Computer Lab 4 : Fourier Series Dylan Zwick Fall 212 This lab should be a pretty quick lab. It s goal is to introduce you to one of the coolest ideas in mathematics, the Fourier series, and

More information

Likelihood and Bayesian Inference for Proportions

Likelihood and Bayesian Inference for Proportions Likelihood and Bayesian Inference for Proportions September 18, 2007 Readings Chapter 5 HH Likelihood and Bayesian Inferencefor Proportions p. 1/24 Giardia In a New Zealand research program on human health

More information

Math493 - Fall HW 4 Solutions

Math493 - Fall HW 4 Solutions Math493 - Fall 2017 - HW 4 Solutions Renato Feres - Wash. U. Preliminaries We have up to this point ignored a central aspect of the Monte Carlo method: How to estimate errors? Clearly, the larger the sample

More information

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Generating random numbers MATLAB has many built-in functions

More information

Week 9 The Central Limit Theorem and Estimation Concepts

Week 9 The Central Limit Theorem and Estimation Concepts Week 9 and Estimation Concepts Week 9 and Estimation Concepts Week 9 Objectives 1 The Law of Large Numbers and the concept of consistency of averages are introduced. The condition of existence of the population

More information

Minimum and maximum values *

Minimum and maximum values * OpenStax-CNX module: m17417 1 Minimum and maximum values * Sunil Kumar Singh This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 2.0 In general context, a

More information

Linear Equations in One Variable *

Linear Equations in One Variable * OpenStax-CNX module: m64441 1 Linear Equations in One Variable * Ramon Emilio Fernandez Based on Linear Equations in One Variable by OpenStax This work is produced by OpenStax-CNX and licensed under the

More information

TMA 4265 Stochastic Processes Semester project, fall 2014 Student number and

TMA 4265 Stochastic Processes Semester project, fall 2014 Student number and TMA 4265 Stochastic Processes Semester project, fall 2014 Student number 730631 and 732038 Exercise 1 We shall study a discrete Markov chain (MC) {X n } n=0 with state space S = {0, 1, 2, 3, 4, 5, 6}.

More information

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression Type Package Version 1.3.1 Date 2016-04-07 Title Model-Based Sliced Inverse Regression Package April 7, 2016 An R package for dimension reduction based on finite Gaussian mixture modeling of inverse regression.

More information