Solve all the problem using R Studio

Project Details Q1) Write a function that will take Bid and ask price in dollars, and a) return dollar bid-ask spread (name the function fn_dollar_bidask) b) compute proportional bid-ask spread (name the function fn_dollar_bidask) c) Write test code to test a) and b) Q2) write a function that will compute the cost of liquidation during normal times for one position namely: 1 2 sa. Where s is the proportional bid-ask spread and a is the total investment in the position. Such a function will take three inputs (investment, bid, and ask). Please call the function in Q1-b in this function to compute s. Also write the test code so that you can test the function Q3) Use function written in Q2) to solve problem in page number (540-541) Suppose that a nancial institution has bought 10 million shares of one company and 50 million ounces of a commodity. The shares are bid $89.5, oer $90.5. The commodity is bid $15, oer $15.1. The mid-market value of the position in the shares is 90 Ö 10 = $900 million. The mid-market value of the position in the commodity is 15.05 Ö 50 = $752.50 million. The proportional bidoer spread for the shares is 1/90 or 0.01111. The proportional bidoer spread for the commodity is 0.1/15.05 or 0.006645. The cost of liquidation in a normal market is: Please note that you have to call the function in Q2) multiple times and add the returns. Q4) Under Stressed market conditions, we assume that s ~ N(µ, s). and for one position the liquidation is given by 1 2 (µ + ?s)a. Here ? is the z score of the condence level (say 99%) It is given by the function ? = qnorm(0.99). This function should take the following inputs: {mean, standard_deviation, condence_interval, total investment} and return the liquidation cost under stressed condition. Q5)Use the function written in Q4) to compute Suppose that in Example 24.1 the mean and standard deviation for the bidoer spread for the shares are $1.0 and $2.0, respectively. Suppose 1further that the mean and standard deviation for the bidoer spread for the commodity are both $0.1. The mean and standard deviation for the proportional bidoer spread for the shares are 0.01111 and 0.02222, respectively. The mean and standard deviation for the proportional bidoer spread for the commodity are both 0.006645. Assuming the spreads are normally distributed, the cost of liquidation that we are 99% condent will not be exceeded is: Please note that you have to call the function in Q4) multiple times and add the returns.
Solve all the problem using R Studio

find the cost of your paper

The 4th Amendment

The 4th Amendment The Fourth Amendment to The Constitution of the United States reads: “The right of the people to be secure in their persons, houses, papers, and effects, against….

Execution, Monitoring, and Controlling

Execution, Monitoring, and Controlling Assignment Overview: For this assignment, you will be assessing a proposed change to the scope of the project, proposing an overview of a change management process,….

Law of Associations

Law of Associations assignment 2000 words excluding bibliography. Compulsory Assignment Question Bathroom Design Pty Limited (in liq) (Company) was wound up in September 2021. The Company operated a business of….