Stats 406 Homework 8
1.
Jacob Balicki
UMID: 75134208
sumsal = dbGetQuery(conn, "SELECT yearID, SUM(salary) as sum_salary
FROM Salaries where yearID > 1984 GROUP BY yearID;")
numteams = dbGetQuery(conn
Statistics 406 Midterm Exam
Fall 2007
No calculators, formula cards, computers, or notes may be used. It is best to try every question. Partial credit will be given.
1. Describe in 2-3 sentences what
Monte Carlo Methods: Monte Carlo Integration
Monte Carlo integration
Let be a density on Rd . For example if d = 1, is a density
on R.
Let h : Rd R a function. Suppose we want to evaluate the
integral
Working with relational databases
Why use a database?
Database systems (DBS) are a very popular way of storing
data. They are particularly ecient in dealing with large data
sets.
Think of a DBS as a d
Chap I: Introduction to R: First steps
A general introduction
R is a software for statistical computing and data analysis. It
is also a programming language.
R is freely distributed software (www.r-pr
Monte Carlo Methods PART I: Random Variables
simulation
Random numbers generation
Most commonly used random variables can be generated in R
using appropriate functions. There is a naming convention in
Chap I: Introduction to R: More on the syntax
Control Structures
Control structures are useful to implement repetitive tasks.
R has control structures similar to C .
For loops
Loops are used to carry
Chap I: Introduction to R: Input/Output and
graphics
Data Input/Output
It is important to be capable of moving data in and out of R.
We make a distinction between data les and R variables and
objects.
STAT 406: Introduction to Statistical Computing (Fall 2015)
Web site: ctools.umich.edu.
Instructor: Yves Atchad
e
Ofce: 272 West Hall
Phone: 734-763-5238
E-mail: yvesa@umich.edu Ofce Hours: Mo. 4:30
Page 1
STAT 406: HW3
All computer code should be written using the language R. Type ALL your
code into one PLAIN Text format le. Plain text format is available by
default in R. Please do not use Micr
# Xintong Zhu STAT 406 HW 2
setwd("~/Desktop/STAT406")
# Prob 1
#(a)
#suppose id = 100 has status = infected at the beginning
epidemic_sim=function(pinf,pd,pimm) cfw_
#initialize value and status
s
Page 1
STAT 406: HW2
All computer code should be written using the language R. Type ALL your
code into one PLAIN Text format le. Plain text format is available by
default in R. Please do not use Micr
Chapter I. Introduction to R: the basic objects
In order to work with a language we need to know its syntax
and its objects.
In terms of the syntax, we have seen how to use variables and
functions. We
The bootstrap: an application of Monte Carlo
Methods in Statistical inference
Statistical inference
Suppose we have a sample x1 , . . . , xn .
We assume that x1 , . . . , xn is a (iid) realizations of
Numerical Optimization: some basic algorithms
Basic concepts
We recall few results from calculus. Let f : R R a function.
A point x0 is called a local minimum if there exists an open
interval I contai
Jacob Balicki
UMID: 75134208
Homework 7
1. The graph suggests theta_hat2 is a better estimator than theta_hat1.
k = 1e4 #num replicates
n = 50 #num samples
#Sequence of values of theta
THETA = seq(fro
Page 1
STAT 406: HW7
All computer code should be written using the language R. Type ALL your
code into one PLAIN Text format le. Plain text format is available by
default in R. Please do not use Micr
Page 1
STAT 406: HW8
All computer code should be written using the language R. Type ALL your
code into one PLAIN Text format le. Plain text format is available by
default in R. Please do not use Micr
The EM algorithm
Introduction
The EM (Expectation Maximization) algorithm is an
algorithm developed by statisticians to deal with statistical
models with latent variables or missing data.
missing data
Chapter 2: Monte Carlo Methods
Law of Large Numbers
Theorem
Let X 1, X 2, . . . be a sequence of independent and identically
distributed random variables with mean := E(X ). As n ,
n1 n Xi becomes les
Numerical Optimization and model tting
Introduction
Optimization is a fundamental analytical tool in Statistics.
The other equally important analytical tool is integration and
we have discussed this e
Monte Carlo Methods PART I: Random Variables
simulation
Random numbers generation
Most commonly used random variables can be generated in R
using appropriate functions. There is a naming convention in
Practice exam problems 1. What will be the approximate value of M following execution of each of the following programs? (a) X = array(rnorm(10000), c(1000,10) A = apply(X, 1, mean) M = mean(A) Soluti
Statistics 406 Problem Set 5 Due in lab, Tuesday October 23 1. Suppose we observe iid values X1 , . . . , Xn that are uniformly distributed on the interval (0, a), where a > 0 is an unknown constant.
STATS 406 Fall 2016: Lab 08
1
Law of Large Numbers
iid
Write a function which calculates the empirical distribution function of X1 , , Xm
N (0, 1). The empirical distribution function is defined as
m