Recall that in our first lecture on regression, we talked about the Gauss-Markov Assumptions. If all these assumptions are met, the OLS estimator is the Best Linear Unbiased Estimator (BLUE). In a simple bivariate case, if the “true” data-generating process is Y = β0 + β1X + . The Gauss-Markov Assumptions can be state as the following:(a) Linearity: A linear relationship between X and Y hold in the sample. (b) Exogeneity of Predictors: The conditional mean of the error term, given the predictor, is zero (x = [x1, x2, …, xn] > is the value vector of X): E[i |x] = 0, for all i = 1, 2, …, n.(c) No Perfect Collinearity: Explanatory variables cannot be perfectly correlated. (d) Homoskedasticity: • No Heteroskedasticity: The conditional variance of the error term, given the predictor, is constant: V ar[i |x] = σ 2 , for all i = 1, 2, …, n.• No Autocorrelation: Conditional on the predictor, the error terms are uncorrelated across the observations: Cov[i , j |x] = 0 , i 6= j.1. [15pts] For each of the assumptions, discuss what will go wrong when the assumption is violated. Be brief in your answers. Note: In addition to class materials, you can learn more about these assumptions in the Wikipedia article on the Gauss–Markov theorem, particularly the “Gauss–Markov theorem as stated in econometrics” section. (You can skip all the mathematical proofs and remarks.) [Your Answer Here]2. [5pts] Let β0 = −0.25, β1 = 1.2, X ∼ Γ(5, 4), and ∼ Normal(0, 1). Here, Γ(α, ψ) denotes the Gamma distribution with shape parameter α and rate parameter ψ. (You can search how to use R to simulate from this distribution.)Simulate a dataset of size n = 3, 000 from this process in which all of the assumptions you’ve discussed above hold. Estimate a OLS model and plot regression diagnostics of this model.# Your code here Bonus Question [10pts]: From assumption (a), (b) and (d), choose one assumption and simulate a data that violates that assumption (all other assumptions should be satisfied). Create a plot which illustrates how the violation of the assumption affects the regression results.This can be a scatterplot with both the “true” and “false” OLS lines, a sampling distribution of the OLS estimator (comparing your estimate model results with actual simulations), or anything that shows how the violation leads us to false decisions if we assume the assumption is true. (The point is to demonstrate a contrast between the “true” and the “false”, not just diagnostics of the “false”.)When simulating data, you don’t have to use the parameters set in the previous problem. Hint: You can search how to use + stat_function() to plot a nonlinear line when plotting with ggplot(), or search how to use the base R functions such as plot() and curve(). # Your code hereA study on COVID-19 constructed a “COVID risk factor” score based on the COVID infection rate of a given area (defined by zip code). A researcher wants to estimate the effect of having a vaccination center in the area on that area’s COVID risk factor score. She compiled a dataset that contains each area’s COVID risk factor score and whether the area has a vaccination center. She then estimated the effect of having a vaccination center using the “naive estimator” we discussed in class.You noted that the quality of information residents have about COVID and the vaccine can be a confounding variable that affects both the area’s infection rate and whether there is a vaccination center in the area. Assume that you are able to estimate the relationships this “informedness” confounder (info) and the original “vaccination center” predictor (vaccine) have with the COVID risk factor score (covid_risk), which can be simulated using the following code (n is sample size): set.seed(1234) # set the same seed to ensure identical results e = rnorm(n, 0, 0.5) covid_risk = rescale( 0 – 7*vaccine – 2*info + e, to = c(0, 100))1. [5pts] Import the data covid.csv, according to the counterfactual framework, constructing a counterfactual “risk factor” in the dataframe. # Your code here2. [10pts] Fill out the table below (round to 1 decimal points): Group Y T Y C Treatment Group (D = 1) E[Y T |D = 1] =? E[Y C |D = 1] =? Control Group (D = 0) E[Y T |D = 0] =? E[Y C |D = 0] =?3. [15pts]Estimate the following: (a) The Naive Estimator of ATE (b) Treatment Effect on the Treated (c) Treatment Effect on the Control (d) Selection Bias4. [15pts] Write a non-technical, short summary reporting your results in response to the above mentioned researcher who used the naive estimation. Imagine that you are explaining this to an audience who may not be familiar with the specific terminologies of the counterfactual framework (such as ATE or Treatment Effect on the Treated), but is interested in your substantive findings. [Your Answer Here]admin.csv contains a dataset of graduate school admission results with the following variables: Variable Name Variable Detail admit Admission Dummy (Admitted is 1) gre GRE score gpa GPA rank Institution Tier (Tier 1 to 4)1. [10pts] Import admin.csv to your R environment. Estimate (a) a linear probability model and (b) a logistic regression model to predict the probability of being admitted based on the applicant’s GRE, GPA, and institution tier. Display the two modeling results in a table. # Your code here2. [10pts] In one or two paragraphs, summarize your modeling result for each model. [Your Answer Here] 3. [15pts] Plot the predicted probability of admission based on one’s GPA percentile and institution rank (holding GRE at the mean) for the logistic regression model. For the purpose of this exercise, please set the value of gpa to range from 1 to 4. Make sure to add appropriate title and labels to your figure.# Your code hereAt this point, you should complete most of the data cleaning and start replicating the descriptive tables and figure. You can submit an additional PDF file if you have made progress in replication Table A1a, Table A1b, and Figure 1.
Load multiple packages to your environment using the following code (you can add more packages to the current list as per your need): knitr::opts_chunk$set(echo = TRUE) library(pacman) p_load(tidyverse, foreign, corrplot, stargazer, coefplot, effects)This week, we will begin familiarizing ourselves with the replication exercise. Download and save the paper that we will be replicating. Make sure to download and save the Online Appendix (you will find it on the ASR website).1. Read the paper closely and respond to the following questions:(a) What are the authors’ research questions? (b) What is the gap in the literature that the authors aim to fill? How does their analysis advance the literature?(c) What is the population that they are making inferences about? Be specific and make sure to identify the geographical region that they are focusing on, the time period, demographic characteristics, and so on.(d) Do they have data on all individuals in the population? If they don’t, how do they solve this? (e) Did the authors collect the data themselves? If they did, describe their sampling procedure. If they didn’t, identify and describe the data source and discuss the sampling procedure that was used to collect this data.2. As you read the text, make a list of all variables or characteristics of the population that the authors mention throughout the paper (e.g., gender, age, wages, occupation, . . . ). Submit a list with all the variables and characteristics that you have identified in the text. Note: Make sure to read footnotes and table notes; they contain important information to understand who is in the sample.3. Based on your answers to prior questions, select the samples and variables that you think you will need to replicate the paper in your IPUMS account. Submit a screenshot of the page where you can see the samples and variables that you have selected. Note: you can obtain this from your “Data Cart”.Import the dataset sat_math.dta to your R environment and examine the effect of IQ and other variables on SAT math score. Hint: use read.dta() Variable Name Variable Detail sat_math SAT Math Score female The Female Dummy (Male = 0)black/other Two Racial Dummies (White as the Reference Group) meduy Mother’s Years of Schooling feduy Father’s Years of Schooling hours Average Weekly Study Hours IQ IQ Score (0 to 100)1. Report descriptive statistics: (a) Create a table that reports descriptive statistics (you should at least report the means) of all the variables grouped by gender. Its structure should look similar to the “1970” column of Table A1a in the replication paper, except that we are using gender instead of race as the grouping variable. Note: You can either use tidyverse (group_by() and summarise) then transpose the table, or search other R packages that can generate descriptive statistics table for you. At this point, don’t worry too much about the specific formatting issues of the table. In practice, we will format the table in LaTeX instead of R Markdown.(b) Create a correlation matrix and display it. Then visualize the matrix using any one plot option that you think can effectively communicate the result from the corrplot package as demonstrated in this webpage.2. Create scatter plots: • Besides the key dependent variable (DV) sat_math, choose one numeric independent variable (IV) that seems to have a meaningful relation to the DV based on the correlation matrix you created, and then create the following plots. Note: Make sure to add appropriate titles, axis labels, and plot legend for each plot.(a) A scatter plot of the DV and IV (b) A scatter plot of the DV and IV with a fitted linear regression line(c) A scatter plot of the DV and IV, and each observation is color coded by gender (make sure to coerce your gender variable to a character or factor using as.character() or as.factor(), or recode your gender variable to a character variable with values “Male” and “Female” using mutate() and ifelse().)(d) On top of plot (c), fit a linear regression line for each gender group, the lines should also be color coded3. Additional exploratory data analysis: (a) What are your preliminary findings/reflections on the data based on the descriptive statistics, the correlation matrix, and the scatter plots? (b) What other exploratory data analysis will be useful for you to better understand the data before modeling? Please implement some additional exploratory data analysis and discuss your preliminary findings.4. Nested models: • Build five nested models that use sat_math as the DV and report regression results in a table using stargazer() from the stargazer package.Note: You can set type = “text” in stargazer() when viewing the table in R, but before knitting to PDF you should set type = “latex” (a) Model 1: Baseline (only add “IQ” as the independent variable) (b) Model 2: Model 1 + Demographic Characteristics (c) Model 3: Model 2 + Parental Education (d) Model 4: Model 3 + Weekly Study Hours (e) Model 5: Model 4 + An Interaction Between IQ and the Female Dummy5. For the result of Model 1: (a) What are the hypotheses that you are testing in this model with your t-values in the (Intercept) and IQ row of the modeling results? (b) Create a 95% confidence interval for the parameter βIQ based on Model 1 result.6. Interpret regression coefficients: (a) How does the coefficient of “IQ” change across models? What could be the possible reason(s) for such changes? (b) Interpret the coefficient of “black” in Model 4.(c) Interpret the coefficient of “meduy” in Model 4. (d) Interpret the coefficient of the interaction effect between IQ and the Female Dummy in Model 5.7. Create a coefficient plot for Model 5 with appropriate title and labels. 8. On the basis of Model 5, by holding other variables at their means, create a figure demonstrating the predicted SAT math score by gender and IQ levels (with confidence interval).Simulation is a fun and effective way to learn about statistical inference. You will get a better understanding of how each population parameter affects the shape of the distribution.Now that we have learned about how to identify interactions from a given sample, you can try simulate a data whose true data generating process involves interaction between two variables. For example, you can try to reproduce a similar scatter plot we saw in class (the right panel) by simulating a data whose variables have such associations:Or, you can try to reproduce a scatter plot that demonstrates the Simpson’s Paradox: Note: Your output does not need to replicate the exact layout of the example graphs. You will get extra credit as long as you generate a similar graph that illustrates the relationship (either a positive or negative interaction, or the Simpson’s Paradox) clearly. Remember to use set.seed() for any random process.
Recall the formulas for population mean: µ = 1 N X N i=1 xi (1) and variance: σ 2 = 1 N X N i=1 (xi − µ) 2 (2) where N is the population size.1. Write a function in R that calculates the population mean according to Equation 1 without using any R functions that directly calculate the mean. For example, you cannot use mean() from base R, or summarise(., mean = mean()) from tidyverse. • Name your function pop mean. • The function should take a numeric vector as its input. • The function should return a numeric variable that is the population mean calculated based on the vector input.2. Write a function in R that calculates the population variance according to Equation 2 without using any R functions that directly calculate the variance. For example, you cannot use var() from base R, or summarise(., var = var()) from tidyverse. • Name your function pop var. • The function should take a numeric vector as its input. • The function should return a numeric variable that is the population variance calculated based on the vector input. • You can use the pop mean() function you just created for your pop var() function.3. Import gapminder.csv to your R environment. • Apply the two functions you just created to the lifeExp variable in gapminder. • Use R functions that directly calculate mean and variance to the same lifeExp variable vector. • Report your results of the above two steps either in text or in a table. The results for the mean should be equal, but the results for variance should be different. Find out and explain why the results in variance differ.Note: For this exercise, we will assume that there is no missing values (i.e. no NAs) in the vector, so you don’t need to consider how to deal with NA values. Hint: You can format tables using kbl() from the kableExtra package.2 Data transformation using tidyverse Import parent inc.csv to your R environment. The data frame looks like this: famid father name mother name father income mother income 1 Arthur Jess 42000 45000 2 Harry Pam 35000 24000 3 Matt Mary 78000 55000Use tidyverse functions and the piping syntax to transform the data frame to the following structure: famid type name income 1 father Arthur 42000 1 mother Jess 45000 2 father Harry 35000 2 mother Pam 24000 3 father Matt 78000 3 mother Mary 55000 Make sure to document the steps you take in your code and display the tidied data frame in your PDF document.Hints: • You can review how to use the pivoting functions here. • You can use str remove() or str extract() functions for mutating a new variable that extracts part of the text from a string, for example extracting “father” from “father name”. • You can separate the original data frame into parts and then combine them if you cannot figure out how to transform it altogether. • You can format tables using kbl() from the kableExtra package.3 Population, sample, and sampling distribution To make your code reproducible, use the set.seed() function whenever you are generating random numbers or sampling randomly. Read the documentation of this function in R if you do not know how it works.1. Create a population data frame that has one variable called “value”, whose value follows a normal distribution with population mean µ = 5 and population variance σ 2 = 1 with 100,000 observations. 2. Create a histogram of the population with appropriate title and labels. Add a vertical line at the population mean.3. Draw a random sample from the population, with sample size n = 50. 4. Plot a histogram of the sample with appropriate title and labels. Add a vertical line at your point estimate of the population mean. How does this histogram compare to the one you created in question 2?5. Based on your sample, report your point estimate of the population mean ˆµ, the standard error of this estimate, and its 95% confidence interval. Show the formulas you used for calculating these statistics. 6. Simulate the sampling distribution of the sample mean (n = 50) using 1,000 draws. That is, repeat the action you took for question 3 for 1,000 times and save the mean you get for each repetition to a data object. Hint: Use for loop.7. Create a histogram of the sampling distribution of the sample mean you simulated in question 6 with appropriate title and labels. Add a vertical line at your point estimate of the population mean.8. Using the sampling distribution you obtained in question 6, report your point estimate of the population mean ˆµ, the standard error of this estimate, and the 95% confidence interval of this estimate. Show the definitions or formulas you used for calculating these statistics. Hint: The standard error in this question should be worked out based on the properties of the sampling distribution.9. Repeat questions 3 to 8 increasing the size of your sample to n = 1,000. Plot and report your results. Then, using the concepts that we learned in class, summarize the differences with respect to what you obtained with a sample of 50. Hint: Which law or theorem that we learned in class is being demonstrated here?
Graphs are the most general of the common data structures; consider that a scalar object is a degenerate list, which is a degenerate tree, which is itself a degenerate graph, or in other words, every data structure we’ve discussed this semester can be represented as a graph. Due to their extreme generality, it’s rare that you’ll use a generic “graph” data structure. The limited set of things you might do with a list make two generic list implementations—an array based- and a linked-structure—good enough for most implementations, and it’s only if you are doing, e.g., low-level system programming that you might have a good reason to write a custom, one-off list. But there is so much variation in graphs that it is perhaps impossible to write a good and useful generic graph implementation.Hash tables provide a means to get constant-time look-up performance on a collection. Usually, the data comes to us at runtime, often in an on-line fashion. In this case, we take what foreknowledge we can to inform best practices in hash table construction, choosing a hash function, etc., to build a data structure with as close to optimal performance as possible; however, if the keys in the table are known beforehand, it’s always possible to construct a perfect hash table, a table in which every key maps to a unique slot.There are many algorithms to construct such a table and the associated hash function; almost all of them are implemented using graphs.For this project, you will be implementing a perfect hash table construction algorithm1 . This algorithm generates a pair of tables of random numbers. Keys are hashed with the values in each these tables, giving two integers (one for each table). These integers are then taken as node indices in a graph, with an edge between them. So long as the resultant graph—after hashing all of the keys—contains no cycles, the algorithm is ready to generate the hash table as a function of the tables (the T tables) used in the graph generation and a function g() on those tables.Algorithm Example NOTE: This algorithm looks pretty intimidating at first glance. With some careful reading and workingthrough of examples, you should find it’s actually fairly straightforward. That said, you don’t necessarily have to understand it at all! If you find yourself getting anxious about all this “scary-looking stuff”, jump down to the Requirements sections, read that, then come back here with a more relaxed mindset. It is very common for professional programmers to be required to implement solutions to problems that they don’t actually understand, so if you find yourself doing that, here or elsewhere, please know that it is normal.This is not to advocate for ignorance, however–it’s always better to understand something than not to understand it–only to recognize that sometimes the cost-benefit of understanding is too high!The example below was generated by hand, and uses an optimization that would be very difficult to implement in program control. We note that our original keys (the number names from “one” to “ten”) 1The algorithm is presented in: Zbigniew J. Czech, George Havas, and Bohdan S. Majewski, “An optimal algorithm for generating minimal perfect has functions”, Information Processing Letters, 43(5):257-264, October 1992.are unambiguously differentiable by the first two letters. Thus, we can simplify the presentation by using only the first two letters of the keys. In your Java program, you will always use the entirety of every word; however, the method that hashes the words is already implemented for you, so you don’t need to concern yourself with it unless you are endeavoring to fully understand the implementation.Our keys and the “sub-keys” that we’re using in this example follow: Key Minimum Unique Sub-key one on two tw three th four fo five fi six si seven se eight ei nine ni ten te A modulus must be chosen, giving a maximum number in our tables, and a maximum number of nodes in the resultant graph. The paper authors choose a value that is one more than twice the number of keys, so we do too. This choice has implications on the runtime of the algorithm (smaller moduli increase the probability of cycles in the resultant graph, forcing a restart of the algorithm). If the modulus is too small, the algorithm will enter an infinite loop.Next, we populate our tables, T1 and T2, with random numbers less than the modulus. Each of the two tables will have the same number of rows as the length l of the sub-key. The i th row, 0
The objective of this exercise is to decode/unzip a message archived with a binary-tree-based algorithm. The program should ask for a single filename at the start: “Please enter filename to decode: “, decode the message in the file and print it out to the console. The name of the compressed message file will end in .arch, e.g. “monalisa.arch”. The file consists of two or three lines: the first one or two lines contain the encoding scheme, and the second or third line contains the archived message.The archival algorithm uses a binary tree. The edges of the tree represent bits, and the leaf nodes contain one character each. Internal nodes are empty. An edge to a left child always represents a 0, and an edge to a right child always represents a 1. Characters are encoded by the sequence of bits along a path from the root to a particular leaf. The below tree serves as an example.The tree on the left encodes these characters: Character Encoding a 0 ! 100 d 1010 c 1011 r 110 b 111 With the above encoding, the bit string: 10100101010110110111100 is parsed as 1010|0|1010|1011|0|110|111|100 which is decoded as: dadcarb! With this encoding, we can automatically infer where one character ends and another begins.That is because no character code can be the start of another character code. For example, if you have a character with the code 111, you cannot have the codes 1 and 11, as they would be internal nodes.The following steps decode one character from the bit string: Start at root Repeat until at leaf Scan one bit Go to left child if 0; else go to right child Print leaf payload3. Input Format The archive file consists of two lines: the first line contains the encoding scheme, and the second line contains the compressed string. For ease of development and to make the archive file human-readable, each bit is represented as the character ‘0’ or ‘1’, rather than as an actual bit from a binary file.The encoding scheme can be represented as a string. For example, the tree from section 2 can be represented as: ^a^^!^dc^rb where ^ indicates an internal node. The above code represents a preorder traversal of the tree.The dadcarb! message is encoded in the following file (“dadcarb.arch”): ^a^^!^dc^rb 10100101010110110111100There are four test files in project3_Test_Files.zip. Note the encoding scheme representations may include a space character and a newline character, thereby breaking the tree string into two lines! The newline character needs to be parsed correctly if the encoding file has three lines in total.4.1. Read in the first line (and possibly second line, if newline is part of the tree) of the file and construct the character tree. Convert the line input into a MsgTree structure using preorder traversal. The tree should be in a class MsgTree with the following members: public class MsgTree{ public char payloadChar; public MsgTree left; public MsgTree right;//Need static char idx to the tree string for recursive solution private static int staticCharIdx = 0; //Constructor building the tree from a string public MsgTree(String encodingString){} //Constructor for a single node with null children public MsgTree(char payloadChar){} //method to print characters and their binary codes public static void printCodes(MsgTree root, String code){} }When building the tree, try a recursive solution where staticCharIdx tracks the location within the tree string. You can pass the same tree string during recursive calls, and update the staticCharIdx to point to the next character to be read.If you decide to implement an iterative solution, you will receive a 15% bonus, as it is considerably more difficult. In that case, you cannot get the 5% bonus for printing statistics. printCodes() does a recursive preorder traversal of the MsgTree and prints all the characters and their bit codes: character code ————————- c 1011 r 110 b 111 You are allowed to print the header of the table (character, code, —-) in main().4.2. Write a method public void decode(MsgTree codes, String msg) to decode the message. It would print the decoded message to the console: MESSAGE: The quick brown fox jumped over the lazy dog. You are allowed to print “MESSAGE:” in main(). The overall output of the program should be the output of printCodes() followed by the output of decode(): character code ————————- c 1011 r 110 b 111 MESSAGE: The quick brown fox jumped over the lazy dog.5. Submission Put your java class code in the edu.iastate.cs228.hw4 package. Do not submit your class files. Please follow the guideline posted under Documents & Links on Canvas. Include the Javadoc tag @author in each class source file. Your zip file should be named Firstname_Lastname_HW4.zip.No template files are provided other than Section 4.1.6. Extra credit (5% or 15%) Print the following statistics after the rest of the program output: 6.8 179 STATISTICS: Avg bits/char: Total characters: Space savings: 57.5%The space savings calculation assumes that an uncompressed character is encoded with 16 bits. It is defined as (1 – compressedBits/uncompressedBits)*100. To earn a 15% non-cumulative bonus (either 5% for statistics or 15%), you can create an non-recursive, iterative solution for building the tree, but be advised that it will require hours of more effort than the recursive solution.Name your submission Firstname_Lastname_HW4_extra.zip if you completed the work for extra credit.
The purposes of this assignment are to practice working with a linked data structure to become intimately familiar with the List and ListIterator interfacesThis assignment will also provide many opportunities to practice your debugging skills. 1.1. Summary of Tasks Implement a class StoutList that extends AbstractSequentialList along with inner classes for the iterators. A skeleton is provided. See the implementation and suggestions for getting started sections for details.In this assignment you will implement a somewhat peculiar-looking linked list. The list will be a doubly-linked list with dummy nodes for the head and tail. An empty list has the following form: Figure 1- an empty list So far so good. Now, let M be a fixed, positive even number. The twist is that each node can store up to M data elements, so the number of linked nodes may not correspond to the number of elements.For example, after some sequence of add and remove operations, one of these lists might have the following form: Figure 2 – a possible list of size 6, where M=4 Note that there are 6 elements, and their logical indices are shown below the nodes. The number of actual linked nodes may vary depending on the exact sequence of operations. Each node contains an array of the element type having fixed length M. Therefore, each logical index within the list is represented by two values: the node n containing the element, and the offset within that node’s array. For example, the element E shown above at logical index 4 is in node at offset2. There are special rules for adding and removing elements to ensure that all nodes, except possibly the last one, have at least elements. These rules are described in detail in a later section. Note that you can get started and make significant progress on the assignment without needing all the add and remove rules. See the section suggestions for getting started. 2. Implementation of StoutList For the implementation, you must implement the class StoutList extending AbstractSequentialList . AbstractSequentialList is a partial implementation of the List interface in which the size() and listIterator() methods are abstract.All other operations have default implementations using the list iterator. The StoutList should NOT allow null elements. Your add methods (those within the iterator as well as those implemented without the iterator) should explicitly throw a NullPointerException if a client attempts to add a null element. A skeleton of the code can n1 M/2 be found in project3_template.zip. The skeleton code includes a constructor, an inner class Node, and two methods toStringInternal() . There is also some code in place to support logging.2.1. Methods to override In addition to implementing the iterators described below, you must override the following methods of AbstractList without using the iterator: int size() boolean add(E item) void add(int pos, E item) E remove(int pos) Iterator iterator() ListIterator listIterator() ListIterator listIterator(int pos) The methods above must conform to the List interface, with the added restriction that the add() methods must throw a NullPointerException if the item argument is null . The purpose of asking you to override add() and remove() is primarily to help ensure that you can get partial credit for implementing the split and merge strategies even if your iterator isn’t completely correct.2.2. The Node inner class A minimal Node class is provided for you. It has methods for adding an element at a given offset and removing an element at a given offset. Note that empty cells within the array (i.e., those with index >= count) should always be null . You can add additional features to this class if you find it helpful to do so.2.3. The toStringInternal methods These methods show the internal structure of the nodes and are useful for debugging. Normally, such a method would not be public (since it reveals implementation details), but we are making it public to simplify unit testing. For example, if the list of Figure 3 contained String objects “A”, “B”, “C”, “D” and “E”, an invocation of toStringInternal() would return the string: [(A, B, -, -), (C, D, E, -)] where the elements are displayed by invoking their own toString() methods and empty cells in the array inside each node (which should always be null ) are displayed as “-”. A second version takes a ListIterator argument and will show the cursor position as a character “|” according to the nextIndex() method of the iterator. For example, if iter is a ListIterator for the list above and has nextIndex() = 3, the invocation toStringInternal(iter) would return the string: [(A, B, -, -), (C, | D, E, -)] Do not modify these methods.2.4. Finding indices Your index-based methods remove(int pos) , add(int pos, E item) and listIterator(int pos) method must not traverse every element in order to find the node and offset for a given index; you should be able to skip over nodes just by looking at the number of elements in the node. For example, for the list of Figure 9, to find the node and offset for logical index 7, you can see 3 elements in the first node, plus 2 in the second node, which makes 5, plus 4 in the third node, which is 9. Since 7 is greater than 5 and less than or equal to 9, index 7 must be in the third node. You may find it helpful to represent a node and offset using a simple inner class similar to the following: private class NodeInfo { public Node node; public int offset; public NodeInfo(Node node, int offset) { this.node = node; this.offset = offset; } } Then you can create a helper method something like the following: // returns the node and offset for the given logical index NodeInfo find(int pos){…}You must provide a complete implementation of an inner class StoutIterator implementing Iterator and a class StoutListIterator implementing ListIterator . The StoutIterator does NOT need to implement remove() (can throw UnsupportedOperationException ). Optionally, if you are confident that your StoutListIterator is correct, you can return an instance of StoutListIterator from your iterator() method and forget about StoutIterator . However, you are encouraged to keep them separate when you first start development, since the basic onedirectional Iterator, without a remove operation, is relatively simple, while the add and remove operations for the full ListIterator are tricky.4. Suggestions for Getting Started 1. Implement add(E item) . Adding an element at the end of the list is relatively straightforward and does not require any split operations. (e.g. see Figures 3 – 5). You can use toStringInternal() to check.2. Implement the hasNext() and next() methods of StoutIterator and implement the iterator() method. At this point the List methods contains(Object) and toString() should work. 3. Start StoutListIterator. Implement ListIterator methods nextIndex() , previousIndex() , hasPrevious() , and previous() . These methods are straightforward. Implement the listIterator() method. You should then be able to iterate forward and backward, and you can check your iterator position using toStringInternal(iter) . The indexOf(Object obj) method of List should work now.4. Implement the set() method of StoutListIterator . You will need to keep track of whether to act on the element before or after the cursor (and possibly throw an IllegalStateException ), but the method is not complicated since it doesn’t have to change the structure of the list or reposition the cursor. 5. Implement a helper method such as the “find” method described above under finding indices. Then you can easily implement the listIterator(int pos) method. After that, the get(int pos) of List should work. 6. Implement the add(int pos, E item) method. Now you will need to carefully review the rules for adding elements. Here is a suggestion for keeping things organized. Write a helper method whose arguments include the node and offset containing the index pos at which you want to add, e.g., private NodeInfo add(Node n, int offset, E item){…} (If pos = size, the arguments should be the tail node and offset 0.) The return value should be the actual node and offset at which the new element was placed. (In some cases this will be the given node and offset, in some cases it will be the previous node, and in case of a split there might be a completely new node.) You don’t need the return value for the add method, but you will need it in the iterator.7. Implement the remove(int pos) method. Again, you will need to carefully review the rules for removing elements and merging. 8. Implement the add() method of listIterator. This is not too bad if you have the helper method from (6). The catch is that after adding an element, you have to update the logical cursor position to the element after the one that was added. 9. Implement the remove() method of listIterator. The tricky part is that you have to update the cursor position differently depending on whether you are removing ahead of the cursor or behind the cursor, and depending on whether there was a merge operation.5. The add and remove Rules 5.1. Adding an element (see Figures 3 – 8) The rules for adding an element X at index are as follows. Remember that adding an element without specifying an index is the same as adding at index i = size. For the sake of discussion, assume that the logical index = size corresponds to node = tail and offset = 0. Suppose that index occurs in node n and offset off. (Assume that index = size means n = tail and off = 0) if the list is empty, create a new node and put X at offset 0 otherwise if off = 0 and one of the following two cases occurs, if n has a predecessor which has fewer than M elements (and is not the head), put X in n’s predecessor if n is the tail node and n’s predecessor has M elements, create a new node and put X at offset 0 otherwise if there is space in node n, put X in node n at offset off, shifting array elements as necessary otherwise, perform a split operation: move the last M/2 elements of node n into a new successor node n’, and then if , put X in node n at offset off if , put X in node n’ at offset5.2. Removing an element (see Figures 9 – 14) The rules for removing an element are: if the node n containing X is the last node and has only one element, delete it; otherwise, if n is the last node (thus with two or more elements) , or if n has more than elements, remove X from n, shifting elements as necessary; otherwise (the node n must have at most elements), look at its successor n’ (note that we don’t look at the predecessor of n) and perform a merge operation as follows: if the successor node n’ has more than elements, move the first element from n’ to n. (mini-merge) if the successor node n’ has or fewer elements, then move all elements from n’ to n and delete n’ (full merge)5.3 Examples: adding some elements to a list off ≤ M/2 off > M/2 (off − M/2) M/2 M/2 M/2 M/2 Figure 3- an example list Figure 4 – after add(V) Figure 5 – after add(W) Figure 6 – after add(2, X) Figure 7 – after add(2, Y) Figure 8 – after add(2, Z) 5.4. Examples: removing some elements from a list Figure 9 – example list Figure 10 – after removing W Figure 11 – after removing Y (mini-merge) Figure 12 – after removing X (mini-merge) Figure 13 – after removing E (no merge with predecessor node) Figure 14 – after removing C (full merge with successor node)6. Sorting Implement the following two sorting methods within the StoutList class: public void sort(); public void sortReverse(); The sort() method implements insertion sort by calling a private generic method: private void insertionSort(E[] arr, Comparator
Sorting is of enormous importance in the practice of computing. Rare is the application that does not include sorting in its implementation. Everything from word processing (spell checking, indexing) and image processing (color histograms), to operating systems (page tables) and computer graphics (depth culling);indeed, the greater challenge is coming up with real-world computing problem that do not require sorting in an efficient solution. Even non-computing applications rely on sorted data; imagine a business with unsorted filing cabinets. If you can’t, that’s because that business probably wouldn’t operate for very long.Owing to its ubiquity, sorting is among the most studied and well-understood problems in all of computing. Despite this extensive analysis, we cannot definitively claim to have found a “best sort”! QUICKSORT is usually the go-to algorithm, but it is unstable—and sometimes we want stability—and it has highly undesirable O(n 2 ) worst case behavior, which, while easy to avoid in the degenerate case (through randomization), is impossible to avoid in all cases. MERGESORT is the defacto second choice.It avoids QUICKSORT’s problems, being Θ(n lg n) (best- and worst-case asymptotic running times are proportional to n lg n), and it is stable, but it is not in-place (a big problem when either resources are highly limited or data is very large), and it has larger constants, such that it will lose to QUICKSORT in the average case. Adding to this confusion is that both of these sorts tend to lose to well written O(n) sorts like INSERTION SORT and SELECTION SORT on small data sets! This is because with small n the constants that big-O brushes aside tend to dominate.The problem of writing a general sorting algorithm is further complicated by the fact that precisely how to compare two items cannot be known by the library developer. Java gets around the latter problem with the Comparable and Comparator interfaces. All other popular (and reasonable) languages have ways of dealing with this, too. And Java uses a hybrid approach in its choice of algorithm. With certain datatypes it uses a modified QUICKSORT, and with others a variation of MERGESORT1 .You are an API developer at Oracle in charge of choosing the sorting algorithm(s) for Java 10. Your analysis has already eliminated many sorts from the competition. You’re left with QUICKSORT, MERGESORT, and INSERTIONSORT. You decide to build a front-end to these algorithms which compares their performance head-to-head. The current testing is concerned only with sorting text, but even text can be sorted in many different ways: Is is case sensitive or insensitive? Do we want lexicographical order?Alphabetical? Something else entirely? Does it include characters from different alphabets? You decide to pass a configuration file listing character order to your program. You build a lookup table from the configuration alphabet. Your sorts will use a Comparator to sort according to the order in the configuration. Finding the relative positions of alphabet characters within your comparator will require BINARYSEARCH, which you must also implement.1Rather unsatisfying explanations for these choices are available in the Java 7 API documentation for public static void sort(byte[] a) and public static void sort(Object[] a).You will be implementing three sorts—QUICKSORT, MERGESORT, and INSERTIONSORT—and BINARYSEARCH, as well as a framework for testing and timing them, using the classes described below.You will time their performance using the supplied timer class and compare their actual performance over a range of input sizes compared with their expected performance as predicted by big-O analysis. Required classes, interfaces, and methods All classes, interfaces, and methods appearing in the template are required and described therein. Input main() takes two file names as arguments.The first file, the configuration file, contains an alphabet—a list of characters, one character per line— defining sorted order. There are no invalid characters, except that newlines are used as the seperator and thus cannot be a character in the sorted order.The second file, the wordlist, is a list of words to be sorted according to the order defined in the configuration file. The words are newline seperated and may contain only characters that appear in the configuration file. In particular, note that whitespace characters, like space and tab, are valid letters in our alphabets and do not delimit words!main() will read both files, process the configuration file as needed, then proceed to sort the word list with each of the three sorts. Each list may be sorted multiple times, until such time as each sort algorithm has sorted at least 1 million words.It is difficult to accurately time very short activities on a computer, because the operating system often does other things to the detriment of your performance analysis. Over long periods of time, these other activities get averaged out, but short programs that happen to run when OS activity spikes do not get the benefit of that implicit filter. Sorting inputs multiple times will reduce the noise in this processes by allowing you to measure an average over many runs.Output After all three sorts have finished, report the following statistics to the terminal for each sort: • Length of the word list • Total number of words sorted • Total time spent sorting • Total number of comparisons • Average time required to sort the word list • Words sorted per second Times should be reported to at least millisecond resolution.We will supply word lists of lengths n = 10, 100, 1000, 10000, 100000, and 10000002 . You will run your sorts on all lengths and analyze their performance over these varied ns. Write a discussion analyzing the 2An O(n 2 ) sort with n = 1000000 may not finish in a reasonable time for your analysis. If you have the time to let it finish, that’s great, and if you don’t, that’s fine too. In the latter case, simply leave that datapoint out of you analysis. measured performance compared with expected performance as per big-O. Your discussion should be no longer than 500 words and in plain text format.Classes Complete documentation of the classes and methods appear in the code templates. All classes and methods described in the templates are required; however, you may write additional classes and methods as you deem necessary.Alphabet The Alphabet class encodes the character order. AlphabetComparator The AlphabetComparator class provides an “alphabetical order” string comparator based on an Alphabet object. InsertionSorter This is a subclass of Sorter that implements INSERTIONSORT in the sort() method.MergeSorter This is a subclass of Sorter that implements MERGESORT. QuickSorter This is a subclass of Sorter that implements QUICKSORT.Sorter The Sorter class implements all the common elements of the sorts, provides an interface for an abstract Sort() method, and orchestrates statistic gathering of the various sorts.SorterFramework SorterFramework contains the main() method. It’s responsible for initializing all of the classes and running the sorts.WordList The WordList class holds the words to be sorted. It implements the Cloneable interface so that we have a straightforward method to run sorts multiple times.Submission You are required to include, in your submission, the source code for each of the classes in the code template, as well as any additional classes or methods you may have written to complete the assignment (you shouldn’t need any). You need to write proper documentation with JavaDoc for each method in each class. Write your class so that its package name is edu.iastate.cs228.hw2.Your source files (.java files) will be placed in the directory edu/iastate/cs228/hw2 (Linux) or eduiastatecs228hw2 (Windows), as defined in the template code. Be sure to put down your name after the @author tag in each class source file. Your zip file should be named Firstname_Lastname_HW2.zip. Your discussion should be in a file named analysis.txt and stored in the edu directory.
You were hired by a fictional internet provider called Blaze to compute yearly profits. Customers pay fixed monthly fees. Blaze makes a profit when customers do not use all the bandwidth they are allowed. Such users are called “Casual’ users. The region to which Blaze supplies internet is in the form of an n x m grid. Blaze can provide internet to each cell in the grid if desired.Each cell in the grid has either customers (one of three types as given below) or is in “Empty” or “Outage” states. Therefore, a cell can have one of five states: C: Casual customer: checks their email 13 times a day S: Streamer customer: an aspiring e-celebrity with an appetite for bandwidth R: Reseller customer: provides lower-cost, lower-bandwidth internet to users off the grid E: Empty grid cell O: Outage grid cellFor example, below is a 4 x 4 grid: O R O R E E C O E S O S E O R RRow and column indices start from 0. The top left cell is at coordinates (0,0). Coordinates are in the form (RowIndex,ColumnIndex). In the example above, the cell at coordinates (1,1) is E (Empty). It has a 3 x 3 neighborhood centered at the square: O R O E E C E S OPlease note that the cell itself is not counted as its own neighbor, so it can have a maximum of 8 neighbors.Cells which are on the edge of the grid will have smaller neighborhoods. In the above example, the cell at the upper left corner, (0, 0), has 3 neighbors in a 2 x 2 neighborhood: O R E E Similarly, the cell at (3, 2), Reseller, has a 2 x 3 neighborhood which is: S O S O R R In the example neighborhood, a cell with a 3 x 2 neighborhood is (1,0): O R E E E S2. Cell Update Rules: Each month, the state of the cell can change depending on its current state and the state of its neighbors. The rules for those are: 1. C: Casual: If the current cell is occupied by a casual user and a. If there is any reseller in its neighborhood, then the reseller causes outage in the casual user cell. Thus, the state of the cell changes from C (Casual) to O (Outage). b. Otherwise, if there is any neighbor who is a streamer, then the casual user also becomes a streamer, in the hopes of making it big on the internet.2. S: Streamer: a. If there is any reseller in the neighborhood, the reseller causes outage for the streamer as well. b. Otherwise, if there is any Outage in the neighborhood, then the streamer leaves and the cell becomes Empty.3. R: Reseller a. If there are 3 or fewer casual users in the neighborhood, then Reseller finds it unprofitable to maintain the business and leaves, making the cell Empty. b. Also, if there are 3 or more empty cells in the neighborhood, then the Reseller leaves, making the cell Empty. Resellers do not like unpopulated regions.4. O: Outage: An Outage cell becomes an Empty cell, meaning internet access is restored on the billing cycle after an outage. 5. E: Empty: If the cell is empty, then a Casual user takes it and it becomes a C.6. Additional rules: a. Any cell that (1) is not a Reseller or Outage and (2) has at most one empty neighbor OR one outage neighbor converts to Reseller. b. If none of the above rules apply, any cell with 5 or more casual neighbors becomes a Streamer.7. If none of the rules apply, then the cell state remains unchanged for the next iteration. All cells update concurrently: each new state of a cell is based on the previous state of its neighbors.3. Determining Profit: Blaze makes a profit of $1 from casual customers. Blaze does not make a profit from streamers or resellers.Profit utilization is calculated as a percentage of potential profit for each billing cycle. For example If the region grid is 12×10, then potential profit is $120 per month, as each cell is occupied by a casual user. Thus, in a single month, profit utilization is 100*C/120, where C is the number of Casual cells. The software for this project needs to compute the profit utilization over 12 billing cycles (equivalent to one year), as a percentage of maximum profit, e.g. 23.4. Implementation Details: 1. Implement the abstract class TownCell to represent a generic cell. It has five subclasses, one for each cell type, specifically: Casual, Streamer, Reseller, Empty and Outage. These 5 subclasses need to be implemented as well. 2. The Town class has a public member variable named grid, which is a 2D array of TownCell. It stores the state of each cell and holds the objects of subclasses of TownCell.3. State is an enum for the cell’s state. You may not modify this file. 4. Implement an ISPBusiness class, which simulates the changes in the grid for an entire year (12 monthly cycles). Note that all its functions are static. This class should: 4.1. Create the Town object and populate the grid inside it. 4.2. The main method needs to ask the user about grid generation: “How to populate grid (type 1 or 2): 1: from a file. 2: randomly with seed”4.2.1. If the user chooses Option 1, take a file path as input. “Please enter file path:” The format of the file is given in ISP4x4.txt. The first line contains the number of rows and columns, separated by space. After the first line, the file contains lines equal to the number of rows, and each line contains as many characters as there are columns. Each character can be: C, S, R, E, or O (upper case only). The file will not deviate from this format.4.2.2. To generate the grid randomly, ask the user for three integer values for number of rows, number of columns and seed for random number generator (in order). “Provide rows, cols and seed integer separated by spaces: “ Populate the grid with an array of size: rows x cols. Then assign each cell in it using random number generator with the given seed.Java provides a random number generator. To use it, you need to import the package java.util.Random. Next, declare and initiate a Random object like below: Random generator = new Random(); Then, random numbers can be obtained by: int newRandomValue = generator.nextInt(5);The above instruction will generate a random number between 0 and 4 that corresponds to one of the cell type as given by static variables in the TownCell class. ● Templates are provided for all classes, except subclasses. You should create 5 subclasses extending TownCell. Names of those 5 classes should be exactly: Casual, Streamer, Reseller, Empty and Outage, including case. Also use the package name exactly as: edu.iastate.cs228.hw1.● Below is state of the grid as it changes for 12 billing cycles. This is just for illustration – you should not output the grid state but just the profit percentage. That is only output 38 for this case.How to populate grid (type 1 or 2): 1: from a file. 2: randomly with seed 2 Provide rows, cols and seed integer separated by space: 4 4 10 Start: O R O R E E C O E S O S E O R R Profit:1After itr: 1 E E E E C C O E C O E O C E E E Profit: 4 After itr: 2 R C C C C C E C C E C E C C C C Profit: 12 After itr: 3 E R R R R O C C R R S R R R C R Profit: 3 After itr: 4 R E E E E E R R E E R E E E R E Profit: 0 After itr: 5 E C C R C C E E C C E R C C E R Profit: 8 After itr: 6 R C O E R S C C R S C E R C R E Profit: 5 After itr: 7 E R E R E R S C E R O R E R E R Profit: 1 After itr: 8R E R E C E O O C E E E R E R E Profit: 2 After itr: 9 E C E C O C E E O C C C E C E C Profit: 8 After itr: 10 R C C C E C C C E C S C R C R R Profit: 9 After itr: 11 E R R R R O R R R O R R E R E E Profit: 0 27.604166666666668 //only output a double as the profit %!!● The only value returned by your software is profit utilization in %, as a double. ● While you may add more classes, variables and helper functions, please do not modify access specifiers or function signature for any of the given functions. Failure to abide by this rule is considered breach of contract in the real world and carries a 50% penalty. Any helper functions introduced need to be properly commented. ● You need not worry about validating the values of rows and columns input by the user. We are assuming that user is only providing positive integers for these.5. Junit Classes: JUnit classes include CasualTest, StreamerTest, ResellerTest, EmptyTest, OutageTest, ISPBusinessTest, TownTestand TownCellTest. You also need to create all these classes. There should be at least one test method for each function for the respective classes. You should use jUnit5.6. Submission Write your classes and JUnit test classes in the edu.iastate.cs228.hw1 package. Also submit the text files with your JUnit tests. Your text files should be directly inside the project folder (i.e., along with src folder). Turn in the zip file, not your class files. Please follow the guideline posted under Documents & Links on Canvas. Include the Javadoc tag @author in each class source file. Your zip file should be named Firstname_Lastname_HW1.zip.
The objective of this exercise is to reconstruct/unzip a message archived with a binary-treebased algorithm. The program should ask for a single filename at the start: “Please enter filename to decode: “, decode the message in the file and print it out to the console. The name of the compressed message file will end in .arch, e.g. “monalisa.arch”. The file consists of two or three lines: the first one or two lines contain the encoding scheme, and the second or third line contains the archived message.The archival algorithm uses a binary tree. The edges of the tree represent bits, and the leaf nodes contain one character each. Internal nodes are empty. An edge to a left child always represents a 0, and an edge to a right child always represents a 1. Characters are encoded by the sequence of bits along a path from the root to a particular leaf. The below tree serves as an example.The tree on the left encodes these characters: Character Encoding a 0 ! 100 d 1010 c 1011 r 110 b 111 With the above encoding, the bit string: 10110101011101101010100 is parsed as 1011|0|1010|111|0|110|1010|100 which is decoded as: cadbard!With this encoding, we can automatically infer where one character ends and another begins. That is because no character code can be the start of another character code. For example, if you have a character with the code 111, you cannot have the codes 1 and 11, as they would be internal nodes.The following steps decode one character from the bit string: Start at root Repeat until at leaf Scan one bit Go to left child if 0; else go to right child Print leaf payload3. Input Format The archive file consists of two lines: the first line contains the encoding scheme, and the second line contains the compressed string. For ease of development and to make the archive file human-readable, each bit is represented as the character ‘0’ or ‘1’, rather than as an actual bit from a binary file.The encoding scheme can be represented as a string. For example, the tree from section 2 can be represented as: ^a^^!^dc^rb where ^ indicates an internal node. The above code represents a preorder traversal of the tree.The cadbard! message is encoded in the following file (“cadbard.arch”): ^a^^!^dc^rb 10110101011101101010100There are four test files in HW4S2021_Test_Files.zip. Note: the encoding scheme representations may include a space character and a newline character, thereby breaking the tree string into two lines! The newline character needs to be parsed correctly if the encoding file has three lines in total.4.1. Read in the first line (and possibly second line, if newline is part of the tree) of the file and construct the character tree. Convert the line input into a MsgTree structure using preorder traversal. The tree should be in a class MsgTree with the following members: public class MsgTree{ public char payloadChar; public MsgTree left; public MsgTree right;/*Can use a static char idx to the tree string for recursive solution, but it is not strictly necessary*/ private static int staticCharIdx = 0; //Constructor building the tree from a string public MsgTree(String encodingString){} //Constructor for a single node with null children public MsgTree(char payloadChar){} //method to print characters and their binary codes public static void printCodes(MsgTree root, String code){} }When building the tree, try a recursive solution where staticCharIdx tracks the location within the tree string. You can pass the same tree string during recursive calls, and update the staticCharIdx to point to the next character to be read. Note: if you decide to implement an iterative solution, you will receive a 15% bonus, as it is considerably more difficult. In that case, you cannot get the 5% bonus for printing statistics.printCodes() performs recursive preorder traversal of the MsgTree and prints all the characters and their bit codes: character code ————————- c 1011 r 110 b 111 You are allowed to print the header of the table (character, code, —-) in main().4.2. Write a method public void decode(MsgTree codes, String msg) to decode the message. It would print the decoded message to the console: MESSAGE:The quick brown fox jumped over the lazy dog. You are allowed to print “MESSAGE:” in main(). The overall output of the program should be the output of printCodes() followed by the output of decode(): character code ————————- c 1011 r 110 b 111 MESSAGE: The quick brown fox jumped over the lazy dog.5. Submission Put your classes in the edu.iastate.cs228.hw4 package. Turn in the zip file and not your class files. Please follow the guideline in submission_guide.pdf. Include the Javadoc tag @author in each class source file. Your zip file should be named Firstname_Lastname_HW4.zip. No template files will be provided other than the skeleton in Section 4.1.6. Extra credit (5% or 15%) Print the following statistics after the rest of the program output: 8.0 1180 STATISTICS: Avg bits/char: Total characters: Space savings: 50.0%The space savings calculation assumes that an uncompressed character is encoded with 16 bits. It is defined as (1 – compressedBits/uncompressedBits)*100. To earn a 15% non-cumulative bonus (either 5% for statistics or 15%), you can create an non-recursive, iterative solution for building the tree, but be advised that it will require hours of extra effort compared to the recursive solution.The bonus for early submission will stack with the 5/15% bonus. Name your submission Firstname_Lastname_HW4_extra.zip if you completed the iterative solution.
The purposes of this assignment are to practice working with a linked data structure to become intimately familiar with the List and ListIterator interfacesThis assignment will also provide many opportunities to practice your debugging skills. 1.1. Summary of Tasks Implement a class StoutList that extends AbstractSequentialList along with inner classes for the iterators. A skeleton is provided. See the implementation and suggestions for getting started sections for details.1.2. Overview In this assignment you will implement a somewhat peculiar-looking linked list. The list will be a doublylinked list with dummy nodes for the head and tail. An empty list has the following form: Figure 1- an empty list So far so good. Now, let M be a fixed, positive even number. The twist is that each node can store up to M data elements, so the number of linked nodes may not correspond to the number of elements.For example, after some sequence of add and remove operations, one of these lists might have the following form: Figure 2 – a possible list of size 6, where M=4 Note that there are 6 elements, and their logical indices are shown below the nodes. The number of actual linked nodes may vary depending on the exact sequence of operations. Each node contains an array of the element type having fixed length M. Therefore, each logical index within the list is represented by two values: the node n containing the element, and the offset within that node’s array. For example, the element E shown above at logical index 4 is in node at offset2. There are special rules for adding and removing elements to ensure that all nodes, except possibly the last one, have at least elements. These rules are described in detail in a later section. Note that you can get started and make significant progress on the assignment without needing all the add and remove rules. See the section suggestions for getting started.2. Implementation of StoutList For the implementation, you must implement the class StoutList extending AbstractSequentialList. AbstractSequentialList is a partial implementation of the List interface in which the size() and listIterator() methods are abstract. All other operations have default implementations using the list iterator. The StoutList should NOT allow null elements. Your add methods (those within the iterator as well as those implemented without the iterator) should explicitly throw a NullPointerException if a client attempts to add a null element. A skeleton of the code can be found in project3_template.zip. The skeleton code includes a constructor, an inner class Node, and two methods toStringInternal(). There is also some code in place to support logging.2.1. Methods to override In addition to implementing the iterators described below, you must override the following methods of AbstractList without using the iterator: int size() boolean add(E item) void add(int pos, E item) E remove(int pos) Iterator iterator() ListIterator listIterator() ListIterator listIterator(int pos) The methods above must conform to the List interface, with the added restriction that the add() methods must throw a NullPointerException if the item argument is null. The purpose of asking you to override add() and remove() is primarily to help ensure that you can get partial credit for implementing the split and merge strategies even if your iterator isn’t completely correct. n1 M/22.2. The Node inner class A minimal Node class is provided for you. It has methods for adding an element at a given offset and removing an element at a given offset. Note that empty cells within the array (i.e., those with index >= count) should always be null. You can add additional features to this class if you find it helpful to do so.2.3. The toStringInternal methods These methods show the internal structure of the nodes and are useful for debugging. Normally, such a method would not be public (since it reveals implementation details), but we are making it public to simplify unit testing. For example, if the list of Figure 3 contained String objects “A”, “B”, “C”, “D” and “E”, an invocation of toStringInternal() would return the string: [(A, B, -, -), (C, D, E, -)] where the elements are displayed by invoking their own toString() methods and empty cells in the array inside each node (which should always be null) are displayed as “-”. A second version takes a ListIterator argument and will show the cursor position as a character “|” according to the nextIndex() method of the iterator. For example, if iter is a ListIterator for the list above and has nextIndex() = 3, the invocation toStringInternal(iter) would return the string: [(A, B, -, -), (C, | D, E, -)] Do not modify these methods.2.4. Finding indices Your index-based methods remove(int pos), add(int pos, E item) and listIterator(int pos) method must not traverse every element in order to find the node and offset for a given index; you should be able to skip over nodes just by looking at the number of elements in the node. For example, for the list of Figure 9, to find the node and offset for logical index 7, you can see 3 elements in the first node, plus 2 in the second node, which makes 5, plus 4 in the third node, which is 9. Since 7 is greater than 5 and less than or equal to 9, index 7 must be in the third node. You may find it helpful to represent a node and offset using a simple inner class similar to the following: private class NodeInfo { public Node node; public int offset; public NodeInfo(Node node, int offset) { this.node = node; this.offset = offset; } } Then you can create a helper method something like the following: // returns the node and offset for the given logical index NodeInfo find(int pos){…}3. Implementation of StoutIterator and StoutListIterator You must provide a complete implementation of an inner class StoutIterator implementing Iterator and a class StoutListIterator implementing ListIterator. The StoutIterator does NOT need to implement remove() (can throw UnsupportedOperationException). Optionally, if you are confident that your StoutListIterator is correct, you can return an instance of StoutListIterator from your iterator() method and forget about StoutIterator. However, you are encouraged to keep them separate when you first start development, since the basic one-directional Iterator, without a remove operation, is relatively simple, while the add and remove operations for the full ListIterator are tricky.4. Suggestions for Getting Started 1. Implement add(E item). Adding an element at the end of the list is relatively straightforward and does not require any split operations. (e.g. see Figures 3 – 5). You can use toStringInternal() to check. 2. Implement the hasNext() and next() methods of StoutIterator and implement the iterator() method. At this point the List methods contains(Object) and toString() should work. 3. Start StoutListIterator. Implement ListIterator methods nextIndex(), previousIndex(), hasPrevious(), and previous(). These methods are straightforward. Implement the listIterator() method.You should then be able to iterate forward and backward, and you can check your iterator position using toStringInternal(iter). The indexOf(Object obj) method of List should work now. 4. Implement the set() method of StoutListIterator. You will need to keep track of whether to act on the element before or after the cursor (and possibly throw an IllegalStateException), but the method is not complicated since it doesn’t have to change the structure of the list or reposition the cursor.5. Implement a helper method such as the “find” method described above under finding indices. Then you can easily implement the listIterator(int pos) method. After that, the get(int pos) of List should work. 6. Implement the add(int pos, E item) method. Now you will need to carefully review the rules for adding elements. Here is a suggestion for keeping things organized. Write a helper method whose arguments include the node and offset containing the index pos at which you want to add, e.g., private NodeInfo add(Node n, int offset, E item){…} (If pos = size, the arguments should be the tail node and offset 0.) The return value should be the actual node and offset at which the new element was placed. (In some cases this will be the given node and offset, in some cases it will be the previous node, and in case of a split there might be a completely new node.) You don’t need the return value for the add method, but you will need it in the iterator.7. Implement the remove(int pos) method. Again, you will need to carefully review the rules for removing elements and merging. 8. Implement the add() method of listIterator. This is not too bad if you have the helper method from (6). The catch is that after adding an element, you have to update the logical cursor position to the element after the one that was added.9. Implement the remove() method of listIterator. The tricky part is that you have to update the cursor position differently depending on whether you are removing ahead of the cursor or behind the cursor, and depending on whether there was a merge operation. 5. The add and remove Rules 5.1. Adding an element (see Figures 3 – 8) The rules for adding an element X at index are as follows. Remember that adding an element without specifying an index is the same as adding at index i = size. For the sake of discussion, assume that the logical index = size corresponds to node = tail and offset = 0. Suppose that index occurs in node n and offset off. (Assume that index = size means n = tail and off = 0) if the list is empty, create a new node and put X at offset 0 otherwise if off = 0 and one of the following two cases occurs, if n has a predecessor which has fewer than M elements (and is not the head), put X in n’s predecessor if n is the tail node and n’s predecessor has M elements, create a new node and put X at offset 0 otherwise if there is space in node n, put X in node n at offset off, shifting array elements as necessary otherwise, perform a split operation: move the last M/2 elements of node n into a new successor node n’, and then if , put X in node n at offset off if , put X in node n’ at offset5.2. Removing an element (see Figures 9 – 14) The rules for removing an element are: if the node n containing X is the last node and has only one element, delete it; otherwise, if n is the last node (thus with two or more elements) , or if n has more than elements, remove X from n, shifting elements as necessary; otherwise (the node n must have at most elements), look at its successor n’ (note that we don’t look at the predecessor of n) and perform a merge operation as follows: if the successor node n’ has more than elements, move the first element from n’ to n. (mini-merge) if the successor node n’ has or fewer elements, then move all elements from n’ to n and delete n’ (full merge)5.3 Examples: adding some elements to a list off ≤ M/2 off > M/2 (off− M/2) M/2 M/2 M/2 M/2 Figure 3- an example list Figure 4 – after add(V) Figure 5 – after add(W) Figure 6 – after add(2, X) Figure 7 – after add(2, Y) Figure 8 – after add(2, Z) 5.4. Examples: removing some elements from a list Figure 9 – example list Figure 10 – after removing W Figure 11 – after removing Y (mini-merge) Figure 12 – after removing X (mini-merge) Figure 13 – after removing E (no merge with predecessor node) Figure 14 – after removing C (full merge with successor node) 6. Sorting Implement the following two sorting methods within the StoutList class: public void sort(); public void sortReverse(); The sort() method implements insertion sort by calling a private generic method: private void insertionSort(E[] arr, Comparator
Question I A linear circuit has poles at S=-5, -3, -2, -7, and -8. i. If the circuit is simulated using the Forward Euler method with step size h, for what values of h is the simulation stable? ii. If the circuit is simulated using the Backward Euler method with step size h, for what values of h is the simulation stable? iii. If the circuit is simulated using the Trapezoidal Rule with step size h, for what values of h is the simulation stable?Question II Consider the following Adams-Moulton integration method: �” = �”$% + ‘( %) �”̇ + +( %) �̇ “$% + ( %) �̇ “$) Derive the difference equation corresponding the to the above method.Question III Your circuit simulator needs to perform an AC analysis at 1000 frequency points, as well as compute the sensitivity of 5 output nodes with respect to three different parameters. What is the total number of Sparse orderings, L/U factorizations and forward backward substitutions required for the full computation (including both the frequency response and its sensitivity) if: 1. We use the perturbation method. 2. We use the differentiation method. 3. We use the Adjoint method. Preliminaries 1. You can reuse and build upon your previous code for this assignment. 2. We provide you with the following additional functions that help handle time domain sources.a. volsine.m and cursine.m are two functions that add time domain sinusoidal voltage and current sources respectively. They are used in the netlist. The netlists used in the questions below should provide examples. Also read the comments in the functions for the required syntax. b. BTime.m is a function that evaluates and returns the time domain value of the right hand side vector b(t) as a function of time.3. In your submission please provide all code in a zip file in a way that allows us to run the testbenches ourselves (include all code, not just the recent one).4. Also submit a pdf file containing the answers to the questions, the output plots and the code for functions you have written for this assignment.Question I: Backward Euler Write a function called transient_beuler.m with the following header: function [tpoints,r] = transient_beuler(t1,t2,h,out) % [tpoints,r] = beuler(t1,t2,h,out) % Perform transient analysis for LINEAR Circuits using Backward Euler % assume zero initial condition. % Inputs: t1 = starting time point (typically 0) % t2 = ending time point % h = step size % out = output node% Outputs tpoints = are the time points at which the output % was evaluated % r = value of the response at above time points % plot(tpoints,r) should produce a plot of the transient responseYour function should use Backward Euler with a constant step size to compute the transient response of a linear circuit. 1. Test your function by running the provided Testbench_Question1.m file. This file simulates the netlists Circuit_chebychev_filter_TD.m (provided in the assignment) in the time domain (transient) and Circuit_chebychev_filter (also provided – this is the same circuit you used before to test your fsolve) in the frequency domain using your fsolve.m function which you developed in past assignments. In your submission, include the code for the new function transient_beuler.m as well as the output plot of the testbench function. 2. Explain the relation between the two plots in the output figure.Question II Trapezoidal Rule Write a function transient_trapez.m with the following header: function [tpoints,r] = transient_trapez(t1,t2,h,out) % [tpoints,r] = Transient_trapez(t1,t2,h,out) % Perform Transient Analysis using the Trapezoidal Rule for LINEAR % circuits. % assume zero initial condition. % Inputs: t1 = starting time point (typically 0) % t2 = ending time point % h = step size % out = output node % Outputs tpoints = are the time points at which the output % was evaluated % r = value of the response at above time points % plot(tpoints,r) should produce a plot of the transient responseYour function should use Trapezoidal Rule with a constant step size to compute the transient response of a linear circuit. 1. Test your function by running the provided Testbench_Question2.m file. This scripts also runs your code from Question 1 and compares BE to TR. In your submission, provide the code for the function you wrote as well as the plot from the testbench.2. By examining the plot, what can you deduce about the BE and TR methods?Question III Forward Euler Write a function transient_feuler.m with the following header: function [tpoints,r] = transient_feuler(t1,t2,h,out) % [tpoints,r] = Transient_feuler(t1,t2,h,out) % Perform Transient analysis for LINEAR circuit using Forward Euler % This function assumes the C matrix is invertible and will not work % for circuits where C is not invertible. % assume zero initial condition. % Inputs: t1 = starting time point (typically 0) % t2 = ending time point % h = step size % out = output node % Outputs tpoints = are the time points at which the output % was evaluated % r = value of the response at above time points % plot(tpoints,r) should produce a plot of the transient responseYour function should use the Forward Euler method with a constant step size to compute the transient response of a linear circuit. You may assume that the C matrix of your MNA is invetible for the purposes of this assignment (this means that your function will not work for most circuits).1. In order to test your code, run the provided test bench script Testbench_Question3.m which simulates the circuit in the provided netlist Q3BEcircuit.m. 2. Examine and comment on what you learn from the output files.3. It can be shown that, when the C matrix is invertible, the poles of the circuit are the eigenvalues of the matrix −�#$� (note the negative sign). Determine the stability condition of the forward euler method for this circuit and experimentally verify your results by running simulations (note the eig function in matlab computes the eigenvalues of a matrix).Question IV Nonlinear Circuits Write a function nl_transient_beuler.m with the following header: function [tpoints,r] = nl_transient_beuler(t1,t2,h,out) % [tpoints,r] = beuler(t1,t2,h,out)% Perform transient analysis for NONLINEAR Circuits using Backward Euler % Assume zero initial condition. % Inputs: t1 = starting time point (typically 0) % t2 = ending time point % h = step size % out = output node % Outputs tpoints = are the time points at which the output % was evaluated % r = value of the response at above time points % plot(tpoints,r) should produce a plot of the transient responseYour function should use Backward Euler with a constant step size to compute the transient response of a nonlinear circuit. For now, you only need to support diodes and you can reuse the code you wrote before and that we have supplied to you.Test your circuit by running the provided script Testbench_Question4 which simulates the rectifier circuit in netlist Circuit_Rectifier.m also provided.
Question I Write a matlab function dcsolvealpha.m that finds the dc solution of the augmented system: �� + �(�) = ��*+ The functions is defined as follows: function Xdc = dcsolvealpha(Xguess,alpha,maxerr) % Compute dc solution using newtwon iteration for the augmented system % G*X + f(X) = alpha*b % Inputs: % Xguess is the initial guess for Newton Iteration % alpha is a paramter (see definition in augmented system above) % maxerr defined the stopping criterion from newton iteration: Stop the % iteration when norm(deltaX)
Questions: 1. Write the following matlab functions: ind.m à adds an inductor to the MNA equations vcvs.m à adds a voltage controlled voltage source to the MNA equations vccs.m à adds a voltage controlled current source to the MNA equations fsolve.m à performs a frequency domain analysis to obtain the frequency response. See the attached matlab files with the same names for more precise definitions of these functions.2. Run all Benchmark functions provided in order to test your simulator.Deliverables: 1. A pdf file containing the results of all benchmark functions (all plots), as well as the matlab code for the functions your have written. 2. The matlab m files for ind.m, vcvs.m, vccs.m, fsolve.m
In order to simplify parsing, we will use our own netlist format in ECSE597/ECSE472. For example consider the following netlist. % CIR1.M % Description of Circuit 1 % Author: R. K. % Date: Sept 17, 2019 % Comment lines start with % just like in matlab (this is in fact a matlab % script). global G C %define global variables global b; G = zeros(4,4); % Define G, 4 node circuit (do not include additional variables) C = zeros(4,4); % Define C, 4 node circuit (do not include additional variables)b = zeros(4,1); % Define b, 4 node circuit (do not include additional variables) % Try changing zeros(4,4) with sparse(4,4) for sparse routines. % See matlab help for info about sparse matrix support. vol(1,0,1); % add voltage source between nodes 0 and 1 (value =1) res(1,2,50); % add 50 ohm resistor between nodes 1 and 2 res(4,0,50);cap(2,0,0.319e-6); cap(3,4,64.72e-12); cap(4,0,0.319e-6); ind(2,0,0.317e-6); ind(2,3,1.59e-6); ind(4,0,0.317e-6);The above netlist corresponds to the following circuit which has 4 nodes. You will find on myCourses the following functions: cap.m, res.m, cur.m, vol.m, and diode.m which allow you to generate the MNA equations for circuits containing capacitors, resistors, current sources, voltage sources and diodes. You will also find the function f_vector.m which computes the nonlinear vector of the MNA, f(x), as a function of x. The file Circuit_diodeckt1.m is the netlist of a simple diode circuit. nlJacobian.m and dcsolve.m are the definitions of functions that you will need to write. Finally, Test_bench_diode1.m is the test bench that you should be able to run once you complete the assignment.Questions: 1. Draw the circuit in the netlist Circuit_diodeckt1.m. 2. Write a matlab function nlJacobian.m (see function definition provided). This function should compute and return the Jacobian of the nonlinear vector f(x)3. Write a matlab function dcsolve.m (see function definition provided). This function should use the Newton-Raphson method to compute the dc solution. It should also return the interim values of detlaX for each iteration (see function definition for details). 4. Run the script Test_bench_diode1.m to test your code.Deliverables: 1. A pdf file containing a) the schematic of the circuit in Circuit_diodeckt1.m, b) dc values computed after running test bench, c) the figure that was plotted when you ran the test bench, and d) the matlab code for nlJacobian.m and dcsolve.m. 2. The matlab m files for nlJacobian.m and dcsolve.m
Consider the matrix A � = ⎣ ⎢ ⎢ ⎢ ⎡ 2 4 6 2 1 4 9 14 8 8 2 6 12 12 21 4 10 20 17 32 8 17 30 18 34⎦ ⎥ ⎥ ⎥ ⎤1. Use the Doolittle algorithm to decompose the matrix into L and U such that � = ��. Show intermediate results after each row and each column. 2. Use the Gaussian version of the Doolittle algorithm to decompose the matrix into L and U such that � = ��. Show the intermediate steps after each sub-matrix. 3. Comment on the similarities and difference between the above two methods. Note: You can type the assignment but you do not need to. You can scan your written work and submit a pdf.Write a matlab function doolittleLU such that [L,U]=doolittleLU(A) returns the LU decomposition of A using the Doolittle algorithm. The algorithm need not do any pivoting. Submit the matlab .m file as your answer.Write a matlab function gaussianLU such that [L,U]=gaussianLU(A) returns the LU decomposition of A using the Gaussian version of the Doolittle algorithm. The algorithm need not do any pivoting. Submit the matlab .m file as your answer.
EAP I: Writing Across Cultures Fall 2024 Instructions: For this project, you will create a portrait of yourself as a writer, similar to the portrait that you created of an author. Answer the guiding questions to complete your portrait. There will be TWO steps in this project. Step #1, the essay requirement for your portrait is 2 ½-3 pages. Step #2, you will present this portrait in PPT. Including text and other modes, as well as images, the final format should be in PPT presentation. You will refer to previous assignments and your professor’s feedback to develop this project. Your self-portrait should not only describe but demonstrate your strengths and the unique qualities of your writing. Engage your reader! Be creative! Guiding Questions 1. How do you identify culturally? Referring to cultural pattern descriptions from class and other sources, how do you personally fit into the characteristics and patterns of your cultures? Use specific terminology from our texts and lectures. Add images to engage the reader and illustrate your point. 2. Describe your history with understanding the power of words and writing. Tell a story of a specific instance where you realized the impact that writing can have in one’s life (2-3 paragraphs). You can revise and expand previous assignments here. 3. How do cultural values and beliefs affect your communication and writing? Compare your writing process in English with that of an additional language: How does your writing differ across languages and audiences? How does your writing process differ across languages? How do you feel writing in English and your additional language? How does what you like to write about differ in each language? What are your strengths and unique qualities in each language? Are they the same or do they differ? 4. Compare yourself to the author in your portrait. What do you have in common with the author? Do you write about similar themes? Do you have a similar style? In what ways did the author you chose influence your perspective on writing and culture? Did they influence your own writing? Explain. 5. What are your strengths and unique qualities as a writer? For this question, you will review comments and conversations with your professor. What do you want the reader to notice, understand and feel? Describe an assignment from this semester that demonstrates this aspect. 6. What three words best describe you as a writer? 7. How have you grown as a writer? In what ways did you develop and grow as a writer during this class? Be specific and give an example to illustrate this. Self-Portrait as a Writer Outline An outline is a map of your essay. It tells you what is needed in your essay and what order it should be in. You do not need full sentences for an outline, just key words, phrases, or notes. However, if you already have a full sentence from a previous assignment, you may insert that here. You will be able to use your outline in the future to expand on your ideas. Think of the outline as a place to temporarily set aside your ideas so that you can revisit it later! Introduction Paragraph a. An engaging hook (introduce your general topic and briefly explain it) 2. OR what you learned about yourself from reading their texts) e. (If you are using a quote, analysis of the quote (How does this quote support the topic of this paragraph?) 3. OR what you learned about yourself from reading their texts) e. (If you are using a quote, analysis of the quote (How does this quote support the topic of this paragraph?) 4. b. Background building: Further reflection and additional information on your topic sentence idea c. Connection to the writer you chose for the Portrait of a Writer essay assignment (e.g.: similarities or differences from your writer, similarities of writing styles, topics, word choices, and so on, how the writer inspires you, d. Quote from author’s text (optional) [Remember to use proper citations] 5.
Business Analysis for Investment (FNCE2003) Assessment 2 (Case Study) This assessment aims to check on the understanding of concepts covered in topics from module 1-7 in the Business Analysis for Investment (FNCE2003) unit. This • Is a group assignment, each group should comprise 3-5 students; • Answer all the questions in parts A and B; • Represents 50% of the overall marks of this unit; • Should be submitted via Turnitin to the link provided on the Blackboard by due date listed in the unit outline; • Answer all the questions in the assignment, and don’t forget to provide detailed calculations/justifications; • Submit your answer script with the Assignment Cover Sheet, don’t forget to mention question members clearly and correctly; • Your report should be a readily comprehensible and condense report of your work. Accordingly, your report should be limited to 25 pages of A4 (Size 12 font, 1.5 spaced) including all tables and appendices. Please cite any sources used; • Submit only ONE copy per group; • You can use Excel for calculations. However, you are not allowed to submit Excel worksheets. Screenshot is allowed (as appendix); • If there are any problems with your group, you should inform. your local instructor before week 8. Any dispute after week 8 will not be addressed. If you do not contribute equally to the completion of the project, then you will receive a penalty up to 50%. I would also remind you of your obligations under the University rules on academic integrity; if you are unsure of your responsibilities then please check the relevant section of the Curtin website:http://academicintegrity.curtin.edu.au/. This assessment (both Part A & Part B) requires you to conduct financial statement analysis of an Australian publicly listed company for the year 2023. By now, one of the following companies should be allocated by your local instructor (if not, please contact your local instructor ASAP). • Harvey Norman (Stock Code: HVN) • JB HI-FI (Stock Code: JBH) An important element of this project is the requirement of identifying and obtaining relevant, publicly available information. Therefore, you should ensure that you are able to access sufficient information for your selected company. I have uploaded the relevant annual reports on Blackboard for your convenience. Part A: Primary Investigation (15 marks) Part A requires students to analyse the most recent annual report of the allocated firm (Harvey Norman or JB Hi-Fi). Please answer the following questions to demonstrate your understanding of financial statement analysis, financial reporting standards and principal financial statements of your allocated company. Question 1 What is the name of the company that you/your group members were assigned for this project? In which industry does your company operate? What is the management’s view on the future outlook and performance of the company? [0+1+1=2 Marks] Question 2 Assume you are analysing the financial statements of your allocated company for the year 2023, where can you find the information to examine its performance? How would you comment on the performance of this firm for the year 2023? What additional information do you need to draw a reasonable conclusion about the performance of the firm? [1+1+1=3 Marks] Question 3 Identify two pieces of information not included in the major financial statements (but still within the annual report) that you think would be important to someone considering investing in the company. Discuss your reasons for believing that this information would be important in making an investment decision. [1+1=2 marks] Question 4 Using the latest annual report of your allocated firm, analyse the revenue streams of the firm as disclosed in its income statements. Discuss the primary sources of revenue for the company and any noted trends or changes from the previous fiscal year. Examine the structure of the balance sheet for the firm. Highlight the major categories of assets and liabilities, noting any significant components or unusual items. [2+2=4 Marks] Question 5 Analyse investing and financing activities of your allocated firm for the year 2023 as identified in the statement of cash flows, specifically identifying the two largest investing activities and the two largest financing activities. Evaluate the cash flow from operating activities of the firm. Specifically analyse whether the company is performing better over the years. Discuss whether the cash flow from operating activities appears to be satisfactory, given the current business environment and the firm’s stage in its life cycle. [1+1+2=4 Marks] Part B: Evaluation and Recommendation (35 marks) Part B is focused on the valuation and investment recommendation for a publicly listed company. This part requires students to employ various valuation methods to estimate the company's value. Question 6 Assume that, as a credit analyst, you are evaluating your allocated company. Using the MOST appropriate ratios from the 2023 annual report, evaluate whether to provide long-term debt to this company. [Use at least 4 ratios] [6 marks] Question 7 Assume you are considering buying stock in this company. Use the MOST appropriate ratios from the annual report to evaluate whether this company is a suitable candidate for investment purposes. [Select and analyse a maximum of three ratios from each category you deem most relevant for the analysis.] [6 marks] Question 8 Perform. a valuation of your allocated company using the Method of Comparables. Include at least two comparable firms, providing justification for your choices, and use at least three financial multiples in your analysis. Based on your findings, make an investment recommendation. [10 marks] Question 9 Perform a valuation of the company you have been allocated using the Free Cash Flow (FCF) model. Use the provided template to assist in completing this process. Detail and justify the assumptions used for selecting inputs in your model, particularly focusing on the cost of equity. For simplicity, assume a growth rate of 12% for Stage 1 and define a growth rate for Stage 2, justifying your chosen rate. Based on your valuation, make an investment recommendation. Indicate whether to buy, hold, or sell the company's stock, supporting your decision with the analysis conducted. [10 marks] 2023 (current) 2024 (stage 1) 2025 (stage 1) 2026 (stage 1) 2027 (stage 1) 2028 (stage 2) CFO FCInv Net Borrowing FCFE Discount rate PV of FCFE CV PV of CV Total PV No. of shares Value per share Question 10 Compare and contrast the valuations and investment recommendations for your assigned company using the Method of Comparables and the Free Cash Flow model. Conclude by choosing your preferred valuation method and justify your selection. [3 marks]
MTH 219 Complex Functions Coursework 2 AY 2024/2025 Problems 1. Find the residue of the function z3ez/1 at z = 0 and show that it has no anti-derivative on the punctured complex plane C {0}. (18 marks) 2. Find the Laurent series of z2 - 3z + 2/1 valid in following the regions respectively: (20 = 10 + 10 marks) A1 = {z ∈ C | 0