Pdf download excel simulations:solve prob w excel by verschuuren
On the descriptive statistics dialog, click on Summary Statistic. In the Output Range box enter B1 or what ever location you desire. Now click on OK. This mean is based on this sample information.
Smal Sample Size say less than 30 If the sample n is less than 30 or we must use the small sample procedure to develop a confidence interval for the mean of a population. The general formula for developing confidence intervals for the population mean based on small a sample is: In this formula is the mean of the sample.
Now you would like to see how Excel is used to develop a certain confidence interval of a population mean based on this small sample information. As you see, to evaluate this formula you need "the mean of the sample" and the margin of error Excel will automatically calculate these quantities the way it did for large samples. Again, the only things you have to do are: add the margin of error to the mean of the sample, , find the upper limit of the interval and to subtract the margin of error from the mean to find the lower limit of the interval.
To demonstrate how Excel finds these quantities we will use the data set, which contains the hourly incomes of 10 work-study students here, at the University of Baltimore. These numbers appear in cells A1 to A10 on an Excel work sheet. After entering the data we follow the descriptive statistic procedure to calculate the unknown quantities exactly the way we found quantities for large sample.
Here you are with the procedures in step-by-step form: Step 1. Enter data in cells A1 to A10 on the spreadsheet Step 2. Click on Data Analysis then choose the Descriptive Statistics option. In the Output Range box, enter B1 or whatever location you desire. The screen shot will look like the following: Now, like the calculation of the confidence interval for the large sample, calculate the confidence interval of the population based on this small sample information.
The confidence interval is: 6. Test of Hypothesis Concerning the Population Mean Again, we must distinguish two cases with respect to the size of your sample Large Sample Size say, over 30 : In this section you wish to know how Excel can be used to conduct a hypothesis test about a population mean.
We will use the hourly incomes of different work-study students than those introduced earlier in the confidence interval section. Data are entered in cells A1 to A I will repeat the steps taken in descriptive statistics and at the very end will show how to find the value of the test statistics in this case, z, using a cell formula.
Select the Output Range box, enter B1 or whichever location you desire. Now click OK. To calculate the value of the test statistics search for the mean of the sample then the standard error.
In this output, these values are in cells C3 and C4. The screen shot should look like the following: The value in cell D1 is the value of the test statistics. Since this value falls in acceptance range of Small Sample Size say, less than 30 : Using steps taken the large sample size case, Excel can be used to conduct a hypothesis for small-sample case. Let's use the hourly income of 10 work-study students at UB to conduct the following hypothesis. I will repeat the steps taken in descriptive statistics and at the very end will show how to find the value of the test statistics in this case "t" using a cell formula.
Click OK. Select the Output Range boxes, enter B1 or whatever location you chose. Again, click on OK. To calculate the value of the test statistics search for the mean of the sample then the standard error, in this output these values are in cells C3 and C4. Difference Between Mean of Two Populations In this section we will show how Excel is used to conduct a hypothesis test about the difference between two population means assuming that populations have equal variances.
The data in this case are taken from various offices here at the University of Baltimore. I collected the hourly income data of 36 randomly selected work-study students and 36 student assistants. The main objective in this hypothesis testing is to see whether there is a significant difference between the means of the two populations.
Referring to the spreadsheet, I chose A1 and A2 as label centers. The work-study students' hourly income for a sample size 36 are shown in cells A2:A37 , and the student assistants' hourly income for a sample size 36 is shown in cells B2:B37 Data for Work Study Student: 6, 6, 6, 6, 6, 6, 6, 6. Data for Student Assistant: 6, 6, 6, 6, 6, 6. Use the Descriptive Statistics procedure to calculate the variances of the two samples.
The Excel procedure for testing the difference between the two population means will require information on the variances of the two populations. Since the variances of the two populations are unknowns they should be replaced with sample variances. From the menus select Tools then click on the Data Analysis option. When the z-Test: Two Sample for means dialog box appears: Enter A1:A36 in the variable 1 range box work-study students' hourly income Enter B1:B36 in the variable 2 range box student assistants' hourly income Enter 0 in the Hypothesis Mean Difference box if you desire to test a mean difference other than 0, enter that value Enter the variance of the first sample in the Variable 1 Variance box Enter the variance of the second sample in the Variable 2 Variance box and select Labels Enter 0.
The rejection rule for this test is z 1. We can also draw this conclusion by comparing the p-value for a two tail -test and the alpha value. Since p-value 0. Overall we can say, based on the sample results, the two populations' means are different. Small Samples: n 1 OR n 2 are less than 30 In this section we will show how Excel is used to conduct a hypothesis test about the difference between two population means. Similar to the above case, the data in this case are taken from various offices here at the University of Baltimore.
I collected hourly income data of 11 randomly selected work-study students and 11 randomly selected student assistants. The main objective in this hypothesis testing is similar too, to see whether there is a significant difference between the means of the two populations. The work-study students' hourly income for a sample size 11 are shown in cells A2:A12 , and the student assistants' hourly income for a sample size 11 is shown in cells B2:B Unlike previous case, you do not have to calculate the variances of the two samples, Excel will automatically calculate these quantities and use them in the calculation of the value of the test statistic.
Similar to the previous case, but a bit different in step 2, to conduct the desired test hypothesis with Excel the following steps can be taken: Step 1. We can also draw this conclusion by comparing the p-value for a two-tail test and the alpha value.
Since the p-value 0. Overall we can say, based on sample results, the two populations' means are equal. Assuming independents samples are taken from normally distributed populations with equal variances, Excel would do this analysis if you choose one way anova from the menus.
We can also choose Anova: two way factor with or without replication option and see whether there is significant difference between means when different factors are involved. Single-Factor ANOVA Test In this case we were interested to see whether there a significant difference among hourly wages of student assistants in three different service departments here at the University of Baltimore.
The following steps should be taken to find the proper output for interpretation. From the menus select Tools and click on Data Analysis option. When data analysis dialog appears, choose Anova single-factor option; enter A2:C8 in the input range box. Select labels in first row. Select any cell as output in here we selected A This means there is a significant difference between means of hourly incomes of student assistants in these departments.
The Two-way ANOVA Without Replication In this section, the study involves six students who were offered different hourly wages in three different department services here at the University of Baltimore. The objective is to see whether the hourly incomes are the same. Therefore, we can consider the following:.
When data analysis box appears: select Anova two-factor without replication then Enter A2: D8 in the input range. In this case there are three replications. Mean hourly income differ by department. Interaction is not significant. However, in this section we would like to test and see how close a sample results are to the expected results. Example: The Multinomial Random Variable In this example the objective is to see whether or not based on a randomly selected sample information the standards set for a population is met.
There are so many practical examples that can be used in this situation. A randomly selected sample of US employees shows the following results that is summarized in a table. Is this a clear sign of discrimination with respect to ethnic background?
Well depends on how much lower the expected values are. The lower amount might not statistically be significant. If this value falls within the acceptance region we can assume that the guidelines are met otherwise they are not. Now lets enter these numbers into Excel spread- sheet. To calculate the expected frequency for a category, you can multiply the proportion of that category by the sample size in here To find other entries in the expected value column, use the copy and the paste menu as shown in the following picture.
These are important values for the chi-square test. The observed range in this case is C7: C9 while the expected range is D7: D9. We chose cell D From the menus, select insert then click on the Function option, Paste Function dialog box appears. The p-value will appear in the selected cell, D As you see the p value is 0. Hence the null hypothesis should be rejected. This means based on the sample information the guidelines are not met. For example based on sample data you might want to see whether smoking and gender are independent events for a certain population.
The variables of interest in this case are smoking and the gender of an individual. Another example in this situation could involve the age range of an individual and his or her smoking habit.
Similar to case one data may appear in a table but unlike the case one this table may contains several columns in addition to rows.
The initial table contains the observed values. To find expected values for this table we set up another table similar to this one. To find the value of each cell in the new table we should multiply the sum of the cell column by the sum of the cell row and divide the results by the grand total.
The grand total is the total number of observations in a study. Now based on the following table test whether or not the smoking habit and gender of the population that the following sample taken from are independent. On the other hand is that true that males in this population smoke more than females? In column F, we calculate how often we had a hit of 2 eyes in total, 3 eyes, and so on, up to 12 eyes. The frequencies are plotted in a graph.
Cell F14 calculates the average of column C. It turns color for extreme values. The average is also plotted in the graph as a vertical line—based on the two sets of coordinates shown in EF The curve keeps changing each time we hit Shift F9. Very rarely does it come close to a normal distribution with a mean somewhere in the center. The chance for this to happen would increase if we would have used more dice and more repeats. This is a so-called array function more on this in Simulations 62 and Such functions return an array or require an array for intermediate calculations.
All array functions have to be implemented with three keys at the same time: Ctr Sh Enter. In this case, the bins are in column E. To make this function work, you need to select all the cells that are going to hold the frequency values all at once, before you use the array function. Do not type the braces; they come automatically. Cerrar sugerencias Buscar Buscar. Saltar el carrusel. Carrusel anterior. Carrusel siguiente.
Puedes cancelar cuando quieras. Editorial: Independent Publishers Group. Publicado: Nov 1, ISBN: Formato: Libro. Aplicaciones empresariales. Sobre el autor GV.
Relacionado con Excel Simulations Libros relacionados. Excel for Budgeting: Budgeting for Beginners, 2 de M. Learn Excel from Mr. Excel for Scientists and Engineers de Dr. Episodios de Podcast relacionados. They're both Excel formats, and many of us might just use one or the other. After all, the latest versions of Excel work with both, and if you've been using a spreadsheet for years, perhaps you stick Learning from Sim Part I: Critical Moments in the Prehospital Setting - Clare Richmond: This talk is the start of a three day smacc journey into simulation, introducing Leah before she enters the hospital system, beginning where life happens - the prehospital world.
Simulation is a tool which allows us to rehearse our skills and Ed Leadership Sims with Ken Spero Transformative Principal Ken Spero of edleadershipsim seeks to help leaders develop their decision-making ability by running simulations of realistic situations. Experience is the best teacher What simulations in a box look like.
Simulation in Surgical Education: In this episode, Dr Bin Zheng discusses simulation and its application in surgical education. How to recognize ML generated images. Excel gains OCR capabilities. He has an Excel blog over at www. Ekev : The Parasha Story of Ekev is the strongest connection to life's most powerful secret — the spiritual dimension within events, people or objects. Are We Living in a Computer Simulation?
What is the purpose of Humanity? What is Free Will about? Now, we debrief. But would! Again, we are dealing with probabilities here, so results may vary! ClearContents Range "H5:H23".
ClearContents Application. Columns 3. Columns 4. Columns 5. Range Cells 1, i - 1 , Cells 20, i. Table , Range "B1" 'to prevent each table from recalculating, replace with values:. This Monte Carlo simulation deals with risks we encounter when we have project costs that we anticipate to be between a maximum value and a minimum value for several sub-projects or various products. As usual, results may vary since there is randomness involved. But a Monte Carlo simulation can reduce this risk.
Manually changing maximum and minimum costs in rows 2 and 3 should affect the outcome. What you need to know. The number of runs J6 is determined by the values in the cells above it: 1. Count Application. Cells iRuns, 5 oRange. Cells iRuns, 1 oRange. Value If MsgBox "Delete the calculations that were generated? Cells iRuns, 6. If the demand for this product is regulated by a range of probabilities, then we can determine our optimal production by simulating demand within that range of probabilities and calculating profit for each level of demand.
The simulation uses three tables to set up this calculation. The table top right E:F sets up the assumed probabilities of various demand levels. The table top left A:B calculates the profit for one trial production quantity. Cell B1 contains the trial production quantity. Cell B2 has a random number. The third table, on the lower left, is a Data Table which simulates each possible production quantity 20,, 30,, to 70, some 1, times and calculates profits for each trial number 1 to 1, and each production quantity 10,, etc.
Finally, row 13 calculates the mean profit for the six different production quantities. In cell A18 starts a Data Table. A18 has a link to the profit in B Then it uses cell B1 20, for the row input, and an empty cell say, H12 for the column input.
What you need to know The VBA code creates each time a new sheet and plots range AH16 six times after recalculation on this new sheet. At the bottom of the new sheet, it calculates the average for the upper and lower bounds. These averages are essentially based on 6x1, runs. A real Monte Carlo simulation would need more iterations, of course. Setting the CutCopyMode fo False is usually wise after a copy operation—otherwise the copied area remains highlighted. Add , Sheets Sheets.
Range "AJ16" oRange. Copy oWS. Cells i, 1. AutoFit oWS. As said before, Monte Carlo simulations are computerized mathematical techniques that allow people to account for risks in quantitative analysis and decision making. In this case, the decision-maker supplies sales data and probabilities the shaded cells in columns A and B. Based on this information, the macro simulates some 10, distributions with a range of possible outcomes center section and with the probabilities they will occur for any choice of action right section.
At the end, a MsgBox reports for every new trial what the average sales are for each consecutive loop. The results are pretty close to each other. What you need to know The situation is basically simple. Again we use 1, simulations in the center section F:I to reach more reliable predictions. Offset 2, 0. Count - 2,.
Count End With oTable. Offset 0, 0. Resize n, Columns. Count oTable. The profit of a certain company depends on a fluctuating exchange rate between the American and Australian dollar—or any other foreign currency.
The average profit we predict in cell B14 is based on a fixed exchange rate B5. But in reality this rate has normally distributed fluctuations with a Standard Deviation shown in cell B6. So we need to simulate such variations. This simulation is done by using a Data Table combined with repeated calculations in arrays operating in the background.
First the user is asked how many rows the Data Table should have—by default 1, The Data Table shows what the profits would be for different exchange rates. The MsgBox displays what the average profit would be, plus the percentile and percentile profit values. Then the user has a chance to run the Data Table repeatedly. The results of each run are added to the MsgBox. When the user decides to stop any further runs, the average and two percentile values are calculated from all these runs.
So the end result in the above picture is based on 10 x 1, normally distributed calculations. The column input cell of the Data Table is the exchange rate value in cell B5. You also should know that we need variables of the Double type for mathematical calculations, but if we want to format them as currency, we need variables of the String type as well.
This is done with a ReDim statement, but make sure you include also the Preserve keyword, otherwise the array loses its previous contents. Average oRange. Percentile oRange. Columns 3 , 0. Percentile arr25, 0. Percentile arr75, 0. This simulation shows what the probability is that an individual still has chromosomes derived from one particular grandparent.
But the outcome can vary between 0 chromosomes or the entire set of 23 chromosomes—but these extremes are very unlikely. Genetics, the science of inheritance of traits and characteristics, is modeled probabilistically.
As an aside, the situation is much more complicated. One problem is that chromosomes do not remain identical during the formation of reproductive cells, but they can exchange parts between the two of a pair— which is called crossing-over or recombination. In this simulation, we stay clear of that issue.
INV in this simulation. There is no pre version of this function, so if you use a file with this function in , you will get an error message. Make sure to divide by This sheet simulates what happens when a father XY and a mother XX have one descendant, who has in turn another descendant, and so forth. It is something like a family tree. If the descendant is a female XX , that cell gets marked with a color. The macro asks the user first how many generations they want to simulate the maximum is set to The macro keeps asking that question by calling itself again, and it does so until the user hits the Cancel button of the Inputbox.
It is possible, by mere change, that the paternal X-chromosome persists for six generations see picture below —or even longer. It either holds two similar chromosomes XX or two unalike chromosomes XY; Y is actually a very short chromosome. The presence of the Y-chromosome determines maleness. If the egg cell—which has always one X-chromosome—is fertilized by a sperm cell with a Y- chromosome, the descendant will be a male. ClearContents: oCell. Certain diseases, such as a particular form of dwarfism, are based on a dominant allele say, A.
Anyone who carries such an allele Aa is called a heterozygote and has the disease. Other diseases, such as cystic fibrosis, are based on a recessive allele say, a. Only people with two of those alleles aa show the disease and is called a homozygote. So someone can be a carrier Aa of the disease without showing its symptoms. Then there are also diseases, such as a known form of hemophilia, that are called sex-linked because they are based on a recessive allele say, h located on the X-chromosome; such alleles come always to expression in males XY —because there is no second chromosome to counteract it—but in females XX only when both X-chromosomes have that recessive allele.
The simulation applies Mendelian laws each time for 10, cases. Because of such a large sample, the results come very close to what we would expect. Besides, the user can repeat these 10, runs again and again. There will be differences, but they fluctuate within a very narrow margin see below. All of this is based on simple Mendelian rules. When the allele does come to expression, it is marked with conditional formatting. A gene can carry various alleles. Let us assume there are only two alleles, A and a.
People who have two of the same alleles are homozygotes AA or aa. Those who carry both alleles are heterozygotes Aa. Let us take the example of an allele for albinism a , which is recessive, so albinos must be aa, whereas individuals with the genotypes AA and Aa are not albinos. As a consequence, the frequency would be p2 for the homozygotes AA cell D4 , q2 for the homozygotes aa cell D2 , and 2pq for the heterozygotes in cell D3: pq for Aa and qp for aA. We are going to simulate this with a macro.
We know, based on Mendelian laws, what the offspring would be of certain pairs of parents see H1:L The macro is going to randomly make these combinations and randomly determine what their offspring would be. The result, based on 10, runs, is displayed in a MsgBox. Notice how the frequencies in the next generation are extremely close to the frequencies of the parent generation—which is exactly what the Hardy-Weinberg law states.
The Hardy-Weinberg law see Chapter 44 states that allele frequencies remain the same over the next generations. Even in case of a recessive allele, it will not entirely disappear. However, by random chance, the percentage of alleles may, and usually does, change in the next generations. During this ongoing process, recessive homozygotes aa may eventually, by mere chance, disappear from stage, to the advantage of the dominant homozygotes AA. This happened in the picture above.
The macro does part of its work by temporarily using the range D8:D, which it deletes later. It is through this range that curves can be plotted in a chart. Because a chart cannot display anything after its source data are deleted, we change the chart into a picture before the macro deletes its source data. What you need to know If the frequency of allele A is 0. So the frequency of genotype AA would be p2 and the frequency of genotype aa would be q2.
The frequency of Aa and aA would then be 2pq. When some error occurs, this line skips over the line that caused the error, and executes the next line in the VBA code. That can easily be troubling, though. The label is something you chose in our case: ErrTrap. Place that label at the end after Exit Sub but before End Sub. Usually after the label, we place a line that is based on the Err object, which deals with the latest error. One option is: MsgBox Err. Description, which tells the user what the actual error was.
It is always wise to have some kind of Error Handling in every macro you create. I skipped this part for most macros in this book. SetSourceData oRange oChart. Copy Sheets 2. ScaleWidth 0. ScaleHeight 0. IncrementLeft Selection. IncrementTop Application. Delete oRange.
Clear Application. The most well-known case is sickle-cell anemia. Because there is strong selection pressure s against the homozygote aa , who suffers from anemia, we would expect allele a to disappear from the population. However, in malaria areas it has a rather stable frequency q.
The explanation is that there is also a selection pressure t against the other homozygote AA , who is more vulnerable to malaria than the other individuals, especially the heterozygotes Aa. Our simulation loops through six different settings for the selective factors s and t, shown in range A4:F The first two settings come close to the situation for sickle-cell anemia; the first one is shown in the figure above, where we see the frequencies of the heterozygotes increase at the cost of both types of homozygotes.
See the formulas here above. The columns D:F derive their information from the calculations in these columns J:N. Range Cells i, 1 , Cells i, 4. This simulation is similar to the previous one. So gradually, up to a certain point, the frequency of AS will increase, while the frequency of genotype SS sickle cell anemia, for instance will decrease in future generations.
All the gray cells on the sheet have formulas in it. We assume that each combination of parents has up to 4 children each generation columns F:I.
Most formulas are identical to the ones used in Chapter The main difference is that the range P2:S10 is based on the different fitness factors for each genotype.
This will obviously affect frequencies in the next generation. The simulation calculates the average frequencies of the three genotypes based on 10, couples with each couple having up to 4 children. The simulation calculates the results for the next generation and compares them with the original frequencies in the 1st generation of the parents.
It is to be expected that there is a change of frequencies—but again, not always, for there is still randomness involved. Sometimes, the effect is quite dramatic see the picture below. What you need to know Only the gray cells on the sheet have formulas in it; the rest is manual input. To mark the cells with formulas in them, conditional formatting can be a helpful tool.
Genes may undergo changes, called mutations. Mutations to non- essential portions of the DNA are useful for measuring time—the so-called molecular clock. It is assumed that such mutations occur with a uniform probability per unit of time in a particular portion of DNA, because they are not exposed to selection.
If P is the percentage of no-mutations in a year, then PN is the probability of no-mutations over N years. On average, given two individuals who had a common ancestor many generations ago, you would expect—assuming that mutations are so rare that it is very unlikely that a mutation in the same segment has occurred in two individuals—that the percentage of segments that are mutated in one or the other is, on average, 2 1 — PN.
This is an estimate of the percentage of segments to be found different when comparing two individuals with a common ancestor N years ago. This macro provides a simplified version of the technique that has been used to locate the first common ancestors of all human beings in evolution—the first female and the first male, so to speak. This is the mutation percentage after a certain numbers of years this case 50, years as shown in cell C4.
So small differences in mutation rate can have an enormous impact. Apparently, the accuracy of the molecular clock depends heavily on the accuracy of the mutation rate. This is a very simple simulation of what was done in the Human Genome Project. The composition of a DNA string is randomly generated in column A. It is clear that this composition is not known yet until we use a technique in the middle section that we are going to describe soon. The end result is shown in the columns AQ and AR by using formulas on the sheet, but the macro also does this work in the background and then displays the outcome in a MsgBox.
In the next step, a new DNA strand is made, complementary to the template strand, by using the bacterial enzyme DNA polymerase. Then follows a key step. In addition to the four regular single nucleotides, the reaction mixture also contains small amounts of four dideoxy-nucleotides which lack a group necessary for chain extension.
Once in a while—by low chance, because of its much lower concentration—a dideoxy-nucleotide will be incorporated into the growing DNA strand instead of the regular nucleotide. This will prevent the DNA chain from growing further. Since each of these four special nucleotides is labeled with a different fluorescent dye, a certain type of laser can later detect them. So DNA chains end up being very short, very long, and of every possible length in between.
The newly synthesized DNA strands are then passed through a laser beam that excites the fluorescent dye attached to the dideoxy-nucleotide at the end of each strand.
This color is then detected by a photocell, which feeds the information to a computer. Finally, the computer does the rest of the work by piecing the short sequences together like a puzzle. VLookup WorksheetFunction. If you need to solve equations, it can be helpful to use matrixes. This file has a few examples of such equations.
The equation uses four different coefficients for a, as shown in matrix [A] CF These four equations should equate to the Y-values shown in matrix [Y] HH You need to determine what the four X-values must be to solve the equations. Here's what you do. Thanks to this technique of matrix elimination, you can solve the equations and find the four X-values for a1 through a4 in the cells CF These four X-values make the four equations, based on the a values specified in the first matrix, equate to the Y-values specified in the second matrix.
What you need to know The VBA code applies all these formulas in the background, without using formulas on the sheet, but be aware that they are array functions, so we need the VBA property FormulaArray.
In addition we used a different type of InputBox: Application. This kind of InputBox lets the user select manually and directly a certain range of cells by using the mouse.
If you want the InputBox to return a range—instead of a range address or so—you must set its last argument to the number 8. You can also include a default range address for what the user had selected already.
Rows oMatrixA. Description Err. Instead of performing integration the mathematical way, you can also use a simulation.
With a large number of runs, you can get very close to the analytic result found based on an integral. To do so, consider a circle inscribed within a square with sides of s units. Now, ten-thousand darts F2 are randomly thrown at the diagram and then we count the number of darts that fall inside the circle F3. Although this is basically an integration problem that has an analytical solution, we can also simulate it with a Monte Carlo technique that gives us an approximation of the analytical integral.
This formula is used in cell F5. The graph plots the analytic solution based on columns I and J. The curve is within a 10 by rectangle. After each trial, the macro shows the previous results and the new result in a MsgBox. They are plotted in the left graph. Then another set of two arrays, according to the formulas shown in VBA. Those two are plotted in the right graph. All of this is done , times.
Select Else Sheet2. This simulation estimates what Pi is by using a custom user-defined function PiEstimate, which has one argument: the number of times you want to run this calculation. By default it runs two random numbers internally 10, times. The function PiEstimate is used in a Sub called PiSimulation which places that function in three columns of 1, rows. And then it calculates the average of these 3, cells. Notice that the results in each of these cells can vary quite a bit, but their average in E1 is rather stable.
What you need to know Because Excel has also a PI function, we can compare its value cell A1 with the value we received through our simulation E1. There are only very minor deviations, because of the large number of runs. Notice that the custom function has Application.
Volatile not enforced. What that line would do is recalculating the function each time something on the sheet changes. AutoFit Cells.
This simulation shows how a population pyramid may change over the course of years. The simulation is based on several grossly oversimplified assumptions. Assumption 1: The population starts at , cell D Assumption 2: The birth rate is partially randomized row 12 and is based on participation by everyone over 20 years old. With three InputBoxes you can determine your randomize factor by default 0. Then the macro loops through years in steps of 10 and shows the situation after that number of years.
What you need to know The cells BB25 use the function HLOOKUP, which searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. So it finds the number of years horizontally in the first row of D1:N11, and then returns the 2nd cell down, 3rd cell, etc.
For years, BB25 should be the same as N2:N Value Range "DN12". On the other hand, the change in growth of the predator population is fueled by the food supply, minus natural death E3. The equations that were used are explained on the sheet. Based on these settings, it plots the corresponding charts next to each other on a new sheet. The title of each chart specifies what the specific three values for A2:C2 were see also Chapter Add With oChart. SetSourceData oRange:.
Range "C2". Name End With oWS. Count With oWS. I decided not to use that function, because in pre Excel versions this function was only available through the Analysis Toolpak. To generate a new random number, you either hit the key F9 or the combination of the Shift key and the F9 key. In this file, I would recommend the latter option Shift F9 , since that would only recalculate the current sheet—otherwise you would recalculate all sheets in this file, which may take lots of calculating time.
Finally, we need to regulate which eyes should pop up for each new random number. This is done inside some of the die cells by using the IF function. This function is a decision maker, which determines whether a specific eye should be on or off.
Nested functions are very common in Excel; for more information, see Appendix 2. The two double quotes in the last argument return an empty string, showing up as nothing. In this case, the function OR is nested inside IF.
The function OR returns true if any of the enclosed arguments is true. This shortcut toggles the sheet, back and forth, between value-view and formula-view. Open file 1-Gambling.
This time we have six different dice. Each die listens to a random number above it, to its left. The settings for each die are similar to what we did in Simulation 1. The number of eyes for each die is plotted in a column chart below the dice. A die that shows six eyes gets marked with a color. When there are at least 2 dice in a row with six eyes, all dice get marked at the same time.
There is not much new on this sheet. The main difference is that we need 6 different cells with a RAND function in order to control the six die displays. Each die has the same structure as the one used in Simulation 1.
In addition, we use conditional formatting to change colors of the dice when they show six eyes, or contain at least two dice with six eyes. Make sure all six dice are set up as was done in Simulation 1, but each die is connected to the random cell just above it. By using Sh F9 , you may hit a situation like below where at least two dice have six eyes F9 recalculates all the sheets of the entire file, whereas Sh F9 only does so for the current sheet and may take less time.
This time we cast two dice at once and sum the number of eyes in column C; we repeat this process 9 more times. In column F, we calculate how often we had a hit of 2 eyes in total, 3 eyes, and so on, up to 12 eyes. The frequencies are plotted in a graph. Cell F14 calculates the average of column C. It turns color for extreme values. The average is also plotted in the graph as a vertical line—based on the two sets of coordinates shown in EF The curve keeps changing each time we hit Shift F9.
Very rarely does it come close to a normal distribution with a mean somewhere in the center. The chance for this to happen would increase if we would have used more dice and more repeats.
This is a so-called array function more on this in Simulations 62 and Such functions return an array or require an array for intermediate calculations. All array functions have to be implemented with three keys at the same time: Ctr Sh Enter. In this case, the bins are in column E.
To make this function work, you need to select all the cells that are going to hold the frequency values all at once, before you use the array function.
Do not type the braces; they come automatically. Open navigation menu. Close suggestions Search Search. User Settings. Skip carousel. Carousel Previous. Carousel Next. What is Scribd? Cancel anytime. Start your free 30 days Read preview.
0コメント