Questions
Do it in python please! also please use this template please I have provided and below...

Do it in python please! also please use this template please I have provided and below is the activity

def main():


# import the module random


try:

# asking the user to enter a number between 1 and 100

#loop time
while
if
elif


#for loop # generates that number of random integers and stores them in a list
for x in


# computations

# displays the results on the screen

# call try_Again to give the user the opportunity to try again or to end the program

#bit of error catching
except:

# Defining a function tryAgain()

def try_Again():

while
if
elif

# defining a function endProgram that will be called any time the user wants to end the program
def endProgram():

# heading

# Calling the main function
if __name__ =='__main__':
main()


# This will keep the console open at the end of the program
# until the end user hits the Enter key.

This activity is worth 10 total points

This lesson's Group Activities are:

We're going to take the Group Activity from last week and tweak it. Instead of storing the random numbers in a list, we're going to store them in a file. Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a file. It should then display the following data to back to the user:

  • The list of integers
  • The lowest number in the list
  • The highest number in the list
  • The total sum of all the numbers in the list
  • The average number in the list
  • At a minimum, the numbers should range from 0 to 50, but you can use any range you like.

Helpful hint: don't forget about input validation loops and try/catch exceptional handling. Both are very useful when used in conjunction with functions.

In: Computer Science

1) The first task is to review some information that might be useful later: a) Write...

1) The first task is to review some information that might be useful later:

a) Write a brief definition of the word "quartile" as we have used it in previous weeks. Be sure to provide a citation: _____________________________.

b) Write a brief definition of the word "quantile" as it might be used in statistics. Be sure to provide a citation (do not cut and paste... use your own words to summarize what you discovered): ________________________________.

c) From within interactive R, enter the command shown below (the command shows a help page for the pbinom command). Provide a very brief description of the arguments that are passed to the pbinom() command ("arguments" in computer programming are the options that you give to a function so that the function can calculate what you want it to). Note that one of the arguments is lower.tail = TRUE, and because there is a value assigned to it with the equals sign, it means that if you do not enter a new value for lower.tail, it will be set to TRUE by default. Do not type the ">" into R, it is the command prompt:

> ?pbinom

2) You can use the dbinom() command (function) in R to determine the probability of getting 0 heads when you flip a fair coin four times (the probability of getting heads is 0.5):

dbinom(0, size=4, prob=0.5)

Find the equivalent values for getting 1, 2, 3, or 4 heads when you flip the coin four times. TIP: after you run the first dbinom() command, press the up arrow and make a small change and run it again.

probability of getting exactly 1 head: _______

probability of getting exactly 2 heads: _______

probability of getting exactly 3 heads: _______

probability of getting exactly 4 heads: _______

3) Use the pbinom() function in R to show the cumulative probability of getting 0, 1, 2, 3, or 4 heads when you flip the coin 4 times (this is the same as finding the probability than the value is less than or equal to 0, 1, 2, 3, or 4.)

probability of getting no more than 0 heads: ____

probability of getting no more than 1 head: _____

probability of getting no more than 2 heads:_____

probability of getting no more than 3 heads: ____

probability of getting no more than 4 heads: ____

4) The following R command will show the probability of exactly 6 successes in an experiment that has 10 trials in which the probability of success for each trial is 0.5:

dbinom(6, size=10, prob=0.5)
(True/False)____________

5) What is the probability of getting fewer than 2 heads when you flip a fair coin 3 times (round to 2 decimal places) ? ______

6) What is the probability of getting no more than 3 heads when you flip a fair coin 5 times (be sure to understand the wording differences between this question and the previous one—round to 2 decimal places)? ________

---------------------------------------------------

Information

The exponential distribution is a continuous distribution. The main R functions that we will use for the exponential distribution are pexp() and qexp(). Here is an example of the pexp() function. Leaves are falling from a tree at a rate of 10 leaves per minute. The rate is 10, or we can say that lambda = 10 (meaning 10 leaves fall per minute). The leaves do not fall like clockwork, so the time between leaves falling varies. If the time between leaves falling can be modeled with an exponential distribution, then the probability that the time between leaves falling will be less than 5 seconds (which is 5/60 of a minute) would be:

(note: this is an explanation of how pexp() works, you will answer a different question below)

pexp(5/60, rate=10)

which is about 0.565 (meaning that the probability is a bit higher than 50% that the next time-span between leaves falling will be less than 5 seconds).

For tasks 7-12, assume that the time interval between customers entering your store can be modeled using an exponential distribution. You know that you have an average of 4 customers per minute, so the rate is 4, or you can say that lambda =4.

It is easiest to keep everything in the original units of measurement (minutes), but you can also translate that to seconds because a rate of “4 customers per minute” is the same as “4 customer per 60 seconds,” and you can divide each number by 4 to get a rate of “1 customer per 15 seconds” or a rate of “1/15 customers per second.”

7) What is the expectation for the time interval between customers entering the store? Be sure to specify the units of measurement in your answer. Round to 3 decimal places: ___________________

8) What is the variance of the the time interval? Be sure to specify the units of measurement in your answer. Round to 3 decimal places:_________________

9) The pexp() function is introduced at the bottom of Yakir, 2011, p. 79, and there are some tips above. What is the probability that the time interval between customers entering the store will be less than 15.5 seconds. Be sure to enter values so that everything is in the same unit of measurement. Be sure to specify the units of measurement in your answer. Round your answer to 3 decimal places: _________________.

10) What is the probability that the time interval between customers entering the store will be between 10.7 seconds and 40.2 seconds?________

11) The qexp() function in R allows you to enter a probability, and it will tell you the criterion value (“cutoff point”) that corresponds to that probability value (e.g., if you enter .05 it tells you the cutoff point below which 5% of the values in the distribution fall).

What value of x would be the criterion value (cut-off point) for the top 5% of time intervals (Round to 3 decimal places, and include the units of measurement)? _______

---------------------------------

12) Describe in your own words the meaning of the number that the following R command produces (you are asked to interpret the resulting number so that we understand what that number means).

pexp(1.2, rate=3)

---------------------------------

Information

You have now had practice with the binomial distribution and the exponential distribution. The approach to solving problems for the normal distribution is similar to that for the exponential function, but obviously you use different R functions (usually pnorm() or qnorm()).

For the following three exercises, assume that you have a normally distributed random variable, called A, with a mean of 7, and a population standard deviation of 3.

13) What is the probability that a randomly selected value from variable A will be greater than 9?_______

14) What value of variable A would be the cutoff point (criterion value) for identifying the lowest 4% of values in variable A (use the qnorm function)?____________

15) What is the probability that a randomly selected value from variable A will be more than one standard deviation above its mean (there are couple ways to solve this, one way is to use the standard normal distribution?________________

In: Math

For a certain river, suppose the drought length Y is the number of consecutive time intervals...

For a certain river, suppose the drought length Y is the number of consecutive time intervals in which the water supply remains below a critical value y0 (a deficit), preceded by and followed by periods in which the supply exceeds this critical value (a surplus). An article proposes a geometric distribution with p = 0.409 for this random variable. (Round your answers to three decimal places.)

(a) What is the probability that a drought lasts exactly 3 intervals? At most 3 intervals?

exactly 3 intervals     .0684
at most 3 intervals    


(b) What is the probability that the length of a drought exceeds its mean value by at least one standard deviation?

In: Math

A health statistics agency in a certain country tracks the number of adults who have health...

A health statistics agency in a certain country tracks the number of adults who have health insurance. Suppose according to the agency, the uninsured rates in a recent year are as follows: 5.3% of those under the age of 18, 12.6% of those ages 18–64, and 1.3% of those 65 and older do not have health insurance. Suppose 22.6% of people in the county are under age 18, and 62.1% are ages 18–64.

(a)

What is the probability that a randomly selected person in this country is 65 or older?

________

(b)

Given that a person in this country is uninsured, what is the probability that the person is 65 or older? (Round your answer to three decimal places.)

_______

In: Statistics and Probability

An attendant at a car wash is paid according to the number of cars that pass...

An attendant at a car wash is paid according to the number of cars that pass through. Suppose the probabilities are 1/12, 1/12, 1/4, 1/4, 1/6, and 1/6, respectively, that the attendant receives $7, $9, $11, $13, $15, or $17 between 4:00 P.M. and 5:00 P.M. on any sunny Friday.

a) What is the probability that the attendant receives more than 15 dollars in this period?

b) What is the probability that attendant receives less than 10 dollars in this period?

c) Find the attendant’s expected earnings for this particular period.

d) Find the attendant’s variance of earnings for this particular period

In: Statistics and Probability

A bad marksman takes 10 shots at a target with probability of hitting the target with...

A bad marksman takes 10 shots at a target with probability of hitting the target with each shot of 0.1, independent of other shots. Z is the random variable representing the number of hits.

a) Calculate and plot the PMF of Z.

b) Calculate and plot CDF of Z. (You may desire to manual adjust the plot for our convention)

c) What is the probability that 3 < ?? < 5 shots were hits

d) Find E[Z] and var[Z]

e) If the marksman were to get $x for each shot on target. How much should the marksman expect to get in order to break even on the $10 entry fee?

In: Statistics and Probability

A leading magazine (like Barron's) reported at one time that the average number of weeks an...

A leading magazine (like Barron's) reported at one time that the average number of weeks an individual is unemployed is 36.3 weeks. Assume that for the population of all unemployed individuals the population mean length of unemployment is 36.3 weeks and that the population standard deviation is 7.5 weeks. Suppose you would like to select a random sample of 124 unemployed individuals for a follow-up study.

Find the probability that a single randomly selected value is between 35.8 and 36.1.
P(35.8 < X < 36.1) =

Find the probability that a sample of size n=124 is randomly selected with a mean between 35.8 and 36.1.
P(35.8 < M < 36.1) =

In: Statistics and Probability

A bank has had to repossess 100 homes. Fifty of these repossessed homes are expected to...

  1. A bank has had to repossess 100 homes. Fifty of these repossessed homes are expected to have market values that are less than the outstanding balance on the mortgage. An auditor randomly selects 10 different repossessed homes and records the number of homes which have market values less than the outstanding balance of the mortgage. What is the probability that all of the audited homes will have outstanding balances in excess of their mortgage?

I know for a fact that this is a binomial distribution and that's because it has two different outcomes and independent trials however I am trying to understand finding the probability in excel, can you explain how this is done in excel?

In: Statistics and Probability

Isabel is taking a multiple-choice question quiz. The quiz has 7 questions and each question has...

  1. Isabel is taking a multiple-choice question quiz. The quiz has 7 questions and each question has 4 possible answers (only one of them is a correct answer). Since she didn’t study at all, she will guess all the questions. Let X be the random variable representing the number of answers she’ll guess correctly.

    1. (3 pts) What values does X take on?

    2. (4 pts) Calculate the probability that she guesses 2 questions correctly.

    3. (4 pts) Calculate the probability of passing the quiz. She needs to guess at least 5 questions correctly to pass the quiz. .(show steps and if calculator was used)

In: Statistics and Probability

A group of students gather at Raquel's house to do a statistical assignment. In this group...

A group of students gather at Raquel's house to do a statistical assignment. In this group there are 10 women and 8 men. Of the women 5 study Management and the rest Accounting, while of the men only one studies Management and the rest Accounting.
a. If the first to arrive at the house are three girls, what is the probability that they will study the same?
b. If any three of them make the assignment, what is the probability that they will study the same thing?
c. If two are randomly selected from this set of friends and the random variable X is defined: number of friends who study Accounting between the two chosen, find the expected value and the standard deviation of X

In: Statistics and Probability