The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 4 Solutions
1. >
>
>
>
>
+
income <- read.table('income.R', header=TRUE)
Income <- income$London
Year <- income$Year
library(gri
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 3 Solution
1. The required functions are:
>
+
+
>
+
+
ddist <- function(x) cfw_
dgeom(x, prob=.8)
rdist <- function(n) cfw_
r
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 1 Model Solutions
1. 11111.012 = 31.25.
2. (a) rep(1:5,1:5)
(b) rep(1:4)+rep(0:2,rep(4,3)
3. indices <- rep(1:4)+rep(0:2,rep(4
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 2
Due: 11 February 2013
1. See the Appendix for the code to read in the ACF data le.
(a) The required plot is below.
ACF of Mult
Minor Assignment 2 Solutions
1. (a) > acf3 <- read.table("http:/www.stats.uwo.ca/faculty/braun/
ss3850/data/acf3.txt",head=T)
> dim(acf3)
[1] 66 13
There are 66 cases in the data set.
(b) There are 13 variables in the data set.
(c) > sum(acf3$INJ=2)
[1] 2
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 1 Solutions
1. Do the following in R:
(a) The volume V of a sphere of radius r is given by
4
V = r3 .
3
Use R to calculate the a
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 4 Model Solutions
1. Write a function called twosampleCI which computes the condence interval for the
true dierence X Y using
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 5 Model Solutions
#1
WHunif <- function(n, x, y, z) cfw_
u <- numeric(n)
for (i in 1:n) cfw_
x <- (171*x)%30269
y <- (172*y)%3
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 3 Model Solutions
1. Write the command which is used to create a plot of the graph of
f (x) = sin
2x
15
for x [10, 20].
Soluti
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 6 Solution
1. Use Monte Carlo integration to estimate the area of the region R contained by the
ellipse
3x2 + 2y 2 = 1.
>
>
>
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 6 Model Solutions
1. The required function is
rquad <- function(n) cfw_
m <- 0
x <- NULL
while (m < n) cfw_
u <- runif(n)
v <-
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 9865B
Minor Assignment 5 Solution
1. Write a function called rnormBM() which takes n, mean and sd as input and outputs
a vector of n independent norm