Write a s function

Assignment Help Financial Econometrics
Reference no: EM131231675

The first question concerns the computation in S-Plus of the square root of a symmetric nonnegative-definite square matrix.

1. Write an S-function, call it msqrt, with argument A which:

  • checks that A is a square matrix and exits if not;
  • checks that A is symmetric and exits if not;
  • diagonalizes the matrix by computing the eigenvalues and the matrix of eigenvectors
  • checks that all the eigenvalues are nonnegative and exits, if not;
  • returns a symmetric matrix of the same size as A, with the same eigenvectors, the eigenvalue corresponding to a given eigenvector being the square root of the corresponding eigenvalue of A

The matrix returned by such a function msqrt is called the square root of the matrix A and it will be denoted by A1/2.

The second question concerns the generation of normal random vectors in S-Plus. In other words, we write an S-Plus function to play the role of the function rnorm in the case of multidimensional random vectors. Such a function does exist in the S-Plus distribution. It is called mvrnorm. The goal of this second question is to understand how such a generation method works

2. Write an S-function, call it vnorm, with arguments Mu, Sigma and N which:

  • checks that Mu is a vector, exits if not, and otherwise reads its dimension, say L;
  • checks that Sigma is an LxL symmetric matrix with nonnegative eigenvalues and exits, if not;
  • creates a numeric array with N rows and L columns and fills it with independent random numbers with the standard normal distribution N(0, 1);
  • treats each row of this array as a vector, and multiplies it by the square root of the matrix Sigma (as computed in question I.1 above) and adds the vector Mu to the result;
  • returns the random array modified in this way. The array produced by the function vnorm is a sample of size N of L-dimensional random vectors (arranged as rows of the matrix outputted by vnorm) with the normal distribution with mean Mu and variance/covariance matrix Sigma. Indeed, this function implements the following simple fact reviewed during the lectures:

If X is an L-dimensional normal vector with mean 0 and covariance matrix given by the L×L identity matrix (i.e. if all the L entries of X are independent N(0, 1) random variables), then:

is an L-dimensional normal vector with mean µ and variance/covariance matrix Σ.

Reference no: EM131231675

Questions Cloud

What is the approximate atmospheric pressure : The peak of a certain mountain is 13 500 ft above sea level. What is the approximate atmospheric pressure
Compute the correlation coefficient : onstruct a vector of 100 increasing and regularly spaced numbers starting from .1 and ending at 20. - Compute the correlation coefficient.
Estimate the amount of energy that could be saved : Estimate the amount of energy that could be saved in August by turning the lights on when the sun sets and turning them off when it becomes light.
How do the students actually feel about the intervention : How do their students actually feel about the intervention? and How do students view the influence of the intervention on their learning inside and outside of the classroom (if applicable)?
Write a s function : Write an S-function, call it msqrt, with argument A which: - checks that A is a square matrix and exits if not; - checks that A is symmetric and exits if not;
Do these products have social media presence : Pick two products currently available in the marketplace, the products do not have to be similar to each other. One should be from a well-established company that is at least 25 years old, and one should be from a young company established less than ..
How does this article fit in with your paper : Discuss the advantages and disadvantages of at least 2 different sampling methods. Describe how researchers go about selecting a sampling strategy. What role does the research question play in choosing the sample? What does it mean to have a repre..
What respirators do we use to protect ourselves : The presentation should explain the chemical formula, physical and chemical properties, common concerns, where can we find it, what respirators do we use to protect ourselves, training program, how to reduce exposure.
Estimate the equilibrium temperature of the plate : If you could operate a heat engine between the plate temperature calculated in part (a) and the environment at 10°C, estimate the plate surface area required to generate power equal to the coal-fired power plant. Then comment on the result and com..

Reviews

Write a Review

Financial Econometrics Questions & Answers

  Research the following laws that relate to computer crime

research the following laws that relate to computer crime. write a 12-16 page paper discussing the role they play in

  Determine what is the after-tax salvage value

Your firm needs a computerized machine tool lathe which costs $48,000 and requires $11,800 in maintenance for each year of its 3-year life. After three years, this machine will be replaced.

  Find how many common shares are currently outstanding

Henderson Industries has $500 million of common equity; its stock price is $44 per share; and its Market Value Added (MVA) is $50 million. How many common shares are currently outstanding

  Calculate the price and modified duration of the three bonds

Consider three zero-coupon bonds with 2, 10, and 30 years to maturity and with required yields 4%, 7%, and 9%, respectively. Calculate the price and modified duration of the three bonds using annual compounding.

  At what level of pretax cost savings would be indifferent

Your firm is contemplating the purchase of a new $703,000 computer-based order entry system. The system will be depreciated straight-line to zero over its 5-year life. It will be worth $68,400 at the end of that time.

  Determine the redemption value compounded monthly

Face value of a bond with monthly coupons is $1000. The coupon rate is a nominal annual rate of 4.8% compounded monthly. The yield rate is a nominal annual rate of 3.6% compounded monthly.

  Explain how to compare the two sets of requirements

two recent articles on accounting for multinational operations. You can use one that focuses on IFRS requirements and one that focuses on GAAP. Or you can use two articles that compare the two sets of requirements.

  Determine what would be the cost of new equity

The growth rate is a constant 8.4%, and the company has an expected dividend yield of 3%. The expected long-run dividend payout ratio is 40%, and the expected return on equity (ROE) is 14%.

  Preparing accurate and reliable financial reports

Articulate standards addressed in PCAOB regarding the concept of material weaknesses in development of internal control compliance. Ensurethat you demonstrate the requirements of SOX from inception in 2002.

  What are some problems with this given type of analysis

you estimated that your fellow students were collectively willing to pay $12 million to double the amount of oncampus parking. What are some problems with this type of analysis?

  Compute the probability that a person in the united states

The federal Health Care Financing Administration supports this conclusion through its forecast that annual prescription drug expenditures will reach $366 billion by 2010, up from $117 billion in 2000.

  Determine what will the monthly payment be

ou want to buy a new sports car from Muscle Motors for $73,000. The contract is in the form of a 60-month annuity due at a 7.00 percent APR. What will your monthly payment be

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd