In this exercise we will implement a simplified version of a Moran process. A Moran process...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this exercise we will implement a simplified version of a Moran process. A Moran process is a "stochastic process" used in biology to describe finite populations. It was first proposed by statistician Patrick Moran in 1958. Assume we have a population of N individuals. The number N of individuals is assumed to be constant throughout the whole process. Each individual can be of type 0 (thought of as the "standard" type) or of type 1 (thought of as the "mutant" type). Initially there will be N-1 individuals of type 0 and 1 individual of type 1. The process consists of a sequence of "generations". In each generation, one individual, chosen randomly, "dies" and is "replaced" by a copy of another individual, also chosen randomly. This will continue until either the mutant individuals disappear or the population is taken over by the mutants. (a) Write a function in R called simulate moran. It should receive as input n (which is assumed to be a positive integer). This function starts by creating a vector of size n containing (n - 1) 0-entries and 1 1-entry: population <- c(rep(0, n - 1), 1) This vector will represent the population (of size n). So the population initially has n - 1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last? population <- c(rep(0, n-1), 1) This vector will represent the population (of size n). So the population initially has n-1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last? can you help, especially in b) using R In this exercise we will implement a simplified version of a Moran process. A Moran process is a "stochastic process" used in biology to describe finite populations. It was first proposed by statistician Patrick Moran in 19581. Assume we have a population of N individuals. The number N of individuals is assumed to be constant throughout the whole process. Each individual can be of type 0 (thought of as the "standard" type) or of type 1 (thought of as the "mutant" type). Initially there will be N -1 individuals of type 0 and 1 individual of type 1. The process consists of a sequence of "generations". In each generation, one individual, chosen randomly, "dies" and is "replaced" by a copy of another individual, also chosen randomly. This will continue until either the mutant individuals disappear or the population is taken over by the mutants. (a) Write a function in R called simulate moran. It should receive as input n (which is assumed to be a positive integer). This function starts by creating a vector of size n containing (n - 1) 0-entries and 1 1-entry: population <- c(rep(0, n - 1), 1) This vector will represent the population (of size n). So the population initially has n - 1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last? In this exercise we will implement a simplified version of a Moran process. A Moran process is a "stochastic process" used in biology to describe finite populations. It was first proposed by statistician Patrick Moran in 1958. Assume we have a population of N individuals. The number N of individuals is assumed to be constant throughout the whole process. Each individual can be of type 0 (thought of as the "standard" type) or of type 1 (thought of as the "mutant" type). Initially there will be N-1 individuals of type 0 and 1 individual of type 1. The process consists of a sequence of "generations". In each generation, one individual, chosen randomly, "dies" and is "replaced" by a copy of another individual, also chosen randomly. This will continue until either the mutant individuals disappear or the population is taken over by the mutants. (a) Write a function in R called simulate moran. It should receive as input n (which is assumed to be a positive integer). This function starts by creating a vector of size n containing (n - 1) 0-entries and 1 1-entry: population <- c(rep(0, n - 1), 1) This vector will represent the population (of size n). So the population initially has n - 1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last? population <- c(rep(0, n-1), 1) This vector will represent the population (of size n). So the population initially has n-1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last? can you help, especially in b) using R In this exercise we will implement a simplified version of a Moran process. A Moran process is a "stochastic process" used in biology to describe finite populations. It was first proposed by statistician Patrick Moran in 19581. Assume we have a population of N individuals. The number N of individuals is assumed to be constant throughout the whole process. Each individual can be of type 0 (thought of as the "standard" type) or of type 1 (thought of as the "mutant" type). Initially there will be N -1 individuals of type 0 and 1 individual of type 1. The process consists of a sequence of "generations". In each generation, one individual, chosen randomly, "dies" and is "replaced" by a copy of another individual, also chosen randomly. This will continue until either the mutant individuals disappear or the population is taken over by the mutants. (a) Write a function in R called simulate moran. It should receive as input n (which is assumed to be a positive integer). This function starts by creating a vector of size n containing (n - 1) 0-entries and 1 1-entry: population <- c(rep(0, n - 1), 1) This vector will represent the population (of size n). So the population initially has n - 1 individuals of type 1 and 1 individual of type 1. This function will then run a simulation according to the description above. Notice this will involve a while loop that will run while the population still contains at least one type 0 individual and at least one type 1 individual. This function then returns a vector containing two entries: the first one should be the number of generations it took for the process to stop, and the second one should be the type that took over the whole population (either 0 or 1). Make sure you test the function is working properly by calling it with small values of n (for instance 5, 10, 50). (b) Write a for loop that calls the function above 1000 times with n = 100. What percentage of the time was the population taken over by the mutants? On average, how many generations did each simulation last?
Expert Answer:
Related Book For
Posted Date:
Students also viewed these finance questions
-
For function: =3x+4, y(0)=0 a) (5%) Solve the derivative using forward differences from 0 to 5 with stepsize of 0.1 b) (5%) Solve the derivative using central finite differences c) (5%) Plot all...
-
According the Medical Health Association (MHA) data the number of non-government not-for-Profit community hospitals comprising of 2946 and entrepreneurial investor-owned for-profits comprising of...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
One persons reform in some cases may be considered an attack on another persons vital interests. Describe how the antebellum reform movementsparticularly temperance, colonization, and womens...
-
Yougi Corp. is an animation studio operating in South Florida. A recent press release contained the following information: April 1 Yougi Corp. today announced that its Board of Directors has declared...
-
For each obtained value stated below, (1) What is the decision for each if = .05 (one-tailed test, upper-tail critical), (2) What is the decision for each if = .01 (two-tailed test)? (a) zobt =...
-
Blue Mountain sells plastic tubes used in underground sprinkler systems. The company had a total finished goods inventory of 5,000 units on hand at the end of 2011. During 2011, variable...
-
Consider a composite wall that includes an 8-mm-thick hardwood siding. 40-mm by 130-mm hardwood studs on 0.65-m centers with glass fiber insulation (paper faced, 28 kg/m 3 ) and a 12-mm layer of...
-
On May 10, a company issued for cash 1,300 shares of no-par common stock (with a stated value of $2) at $14, and on May 15, it issued for cash 2,000 shares of $15 par preferred stock at $58....
-
A company transport assembles pieces of equipment. its normal costing system has two direct cost categories (direct materials and direct labor). Company uses machine hours its allocation base. For...
-
You are asked to design a combinational circuit whose inputs are two 8-bit unsigned binary integers, X and Y, and a control signal MIN/MAX. You can use logic gates such as NAND and XOR, multiplexers,...
-
At least five times a year At least once a year At least three times a year At least once a month each year. How often must Congress meet each year? How often must Congress meet each year?
-
Complete a research proposal that assesses the feasibility of your international business. Stick to 1 or 2 countries. Ensure your research objectives and research questions are clear. 1. The chosen...
-
Problem 1: In the circuit below AVbat = 4V and C = 1 F, C=2 F, C3 = 3 F, C=3 F. (a) What is Ceq? (b) What is Q1, the charge on C? (c) What is Q2, the charge on C? (d) What is Q3, the charge on C3?...
-
1. A company is considering a project which will initially cost $335090. It believes this project will generate a stream of cash flows of $30804 per annum forever. Calculate the IRR (%) of this...
-
The trial balance of Hadden Company as of December 31, the end of its current fiscal year, is as follows: Hadden Company ADJUSTED TRIAL BALANCE December 31, 20-- ACCOUNT TITLE DEBIT CREDIT 1 Cash...
-
Marc Company assembles products from a group of interconnecting parts. The company produces some of the parts and buys some from outside vendors. The vendor for Part X has just increased its price by...
-
In the U.S. the Federal Bureau of Investigation (FBI) uses a Uniform Crime Reporting (UCR) system to track violent crimes (like murder) and property crimes (such as theft of motor vehicles or...
-
Assume that you own and manage a small clothing store. A. What kinds of financial information would you want to run your business? B. What kinds of nonfinancial information would you want (for...
-
One of the first U.S. major industries to be regulated was the railroads. Farmers and manufacturers depended on railroads to get their products to market, and often there was only one railroad...
Study smarter with the SolutionInn App