36-724 Homework 1
Due: Monday, January 30, 14:30 EST, by email to Dansci
(724homeworksgohere@gmail.com).
Please submit your raw R code along with your solution set as a PDF (in LaTeX, scannedin pencil/pen, whichever for now). Name your les in the fashion
36-724 Homework 4
Due: Monday February 20, 14:30, by email to Dansci
(724homeworksgohere@gmail.com)
Please submit 1) your R code, set to output your computational solutions, with a name like
yourname hw4.R; 2) your analytical solutions as a PDF (in LaTeX,
36-724 Homework 2
Due: Monday, February 6, 14:30 EST, by email to Dansci
(724homeworksgohere@gmail.com).
pdf("my-file-name.pdf")
plot(.) #your plot commands here
dev.off()
Please submit 1) your R code, set to output your computational solutions, with a na
36-724 Homework 6
Due: Wednesday March 7, 14:30, by email to Dansci
(724homeworksgohere@gmail.com)
Please submit 1) your R code, set to output your computational solutions, with a name like
yourname hw6.R; 2) your analytical solutions as a PDF (in LaTeX,
36-724 Homework 3
Due: Monday, February 13, 14:30 EST, by email to Dansci
(724homeworksgohere@gmail.com).
Please submit 1) your R code, set to output your computational solutions, with a name like yourname hw3.R;
2) your analytical solutions as a PDF (in
36-724 Homework 5
Due: Monday February 27, 14:30, by email to Dansci
(724homeworksgohere@gmail.com)
Please submit 1) your R code, set to output your computational solutions, with a name like
yourname hw5.R; 2) your analytical solutions as a PDF (in LaTeX,
#
#
#36-724: Simulating Random Variables and Introduction to R
#
#
#lines preceded with the # symbol are comments.
#Simulating Bernoulli random variables:
#I want 100 of them in a vector.
length <- 100
pp <- 0.3
berns <- rbinom(length, size=1, prob=pp)
#S
#
#Demo for homework: Draw Cauchy from Uniform!
#
message("Homework Zero: Andrew C. Thomas")
#Define the objects you need.
total.draws <- 100000
c.draw <- tan(pi*(runif(total.draws)-0.5)
c.real <- rt(total.draws,1)
#Output parameters.
trim.count <- 10
tri
#example 8.1 Gelman book, fit a linear regression of radom measurements
#explanatory variables:basement indicator and three counties indicators
#beta_bayesian.regression(nsim=1000)
y.1 <- c(5.0, 13.0, 7.2,6.8,12.8,5.8,9.5,6.0,3.8,14.3,1.8,6.9,4.7,9.5)
y.2
#
#
# 36-724: Using the Gelman-Rubin R metric
#
#
#Simple case:
#install.packages("coda", repos="http:/cran.r-project.org/")
library(coda)
#10 identical, parallel chains.
test <- array(rnorm(10000,0,1),c(1000,10)
#making each chain an "mcmc" object in a s