a)
Code:
for(i in 1:5)
{
n<- 100
space < - c("H","T")
p<- c(0.5,0.5)
observation <- sample(space,size= n, prob = p, replace = TRUE)
p.hat<- sum(observation =="H")/n
cat("p.hat = ", p.hat,"\n")
}
Output:
> for(i in 1:5){
+ n<- 100
+ space <- c("H","T")
+ p<- c(0.5,0.5)
+ observation <- sample(space,size= n, prob = p, replace = TRUE)
+ p.hat<- sum(observation =="H")/n
+ cat("p.hat = ", p.hat,"\n")
+ }
p.hat = 0.48
p.hat = 0.45
p.hat = 0.5
p.hat = 0.54
p.hat = 0.46
b) Code:
for(i in 1:5)
{
n<- 1000
space <- c("H","T")
p<- c(0.5,0.5)
observation <- sample(space,size= n, prob = p, replace = TRUE)
p.hat<- sum(observation =="H")/n
cat("p.hat = ", p.hat,"\n")
}
Output:
> for(i in 1:5)
+ {
+ n<- 1000
+ space <- c("H","T")
+ p<- c(0.5,0.5)
+ observation <- sample(space,size= n, prob = p, replace = TRUE)
+ p.hat<- sum(observation =="H")/n
+ cat("p.hat = ", p.hat,"\n")
+ }
p.hat = 0.519
p.hat = 0.508
p.hat = 0.478
p.hat = 0.498
p.hat = 0.477
c) We can see Output from (b) is closer to 0.5 than output from (a). So we noticed that the as n increases proportion of heads gets more closer to 0.5
d) Code:
for(i in 1:5)
{
set.seed(55)
n<- 100
space <- c("H","T")
p<- c(0.5,0.5)
observation <- sample(space,size= n, prob = p, replace = TRUE)
p.hat<- sum(observation =="H")/n
cat("p.hat = ", p.hat,"\n")
}
Output:
> for(i in 1:5)
+ {
+ set.seed(55)
+ n<- 100
+ space <- c("H","T")
+ p<- c(0.5,0.5)
+ observation <- sample(space,size= n, prob = p, replace = TRUE)
+ p.hat<- sum(observation =="H")/n
+ cat("p.hat = ", p.hat,"\n")
+ }
p.hat = 0.53
p.hat = 0.53
p.hat = 0.53
p.hat = 0.53
p.hat = 0.53
e) Answer in part (d) is different from answer in part (a)
When I set seed then I noticed that estimated proportion of head is constant for all 5 times run.
So can conclude that random sample of size n = 100 is same for all 5 times run.
7. This problem will us R. The following code will simulate flipping a coin 100 times....
------------------------------------------------------------------------------------------------------------
CODE ALREADY HAVE
BELOW---------------------------------------------------------------------------------------
public class LinkedQueue<T> implements
QueueADT<T>
{
private int count;
private LinearNode<T> head;
private LinearNode<T> tail;
public LinkedQueue()
{
count = 0;
head = null;
tail = null;
}
@Override
public void enqueue(T element)
{
LinearNode<T> node = new
LinearNode<T> (element);
if(isEmpty())
head =
node;
else
...
Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.) 2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...
Help I have taken this test so many times : These tests are intended for master's and doctoral students. Read these directions carefully! The below test includes 10 questions, randomly selected from a large inventory. Most questions will be different each time you take the test, You must answer at least 9 out of 10 questions correctly to receive your Certificate. You have 40 minutes to complete each test, and you must answer all 10 questions in order to to...
I am really struggling with this assignment, can anyone help? It is supposed to work with two files, one that contains this data: 5 Christine Kim # 30.00 3 1 15 Ray Allrich # 10.25 0 0 16 Adrian Bailey # 12.50 0 0 17 Juan Gonzales # 30.00 1 1 18 J. P. Morgan # 8.95 0 0 22 Cindy Burke # 15.00 1 0 and another that contains this data: 5 40.0 15 42.0 16 40.0 17 41.5...
Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...
All of the following questions are in relation to the following journal article which is available on Moodle: Parr CL, Magnus MC, Karlstad O, Holvik K, Lund-Blix NA, Jaugen M, et al. Vitamin A and D intake in pregnancy, infant supplementation and asthma development: the Norwegian Mother and Child Cohort. Am J Clin Nutr 2018:107:789-798 QUESTIONS: 1. State one hypothesis the author's proposed in the manuscript. 2. There is previous research that shows that adequate Vitamin A intake is required...
Read “Instituionalizing our Demise: America vs Multiculturalism” by
Roger Kimball on pg 268 and “Reinventing America” Call for a new
national indentity” by Elizabeth Martinez on pg 275. Create a
double entry notebook for each reading selection It should be
atleast five observation and responses.
wric 268 PART 2 essay pro. exactly how and why their authors disagree. Instead of with parties in conflict as mediators do, you will nt of view designed to appeal to both sides, mediatn posing...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...