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

  A project report on banking system

The objective of this business report is to focus upon evaluating the current portfolio of Baituna home loans product of Bank Muscat and its volumes. It focus upon the current standing of the product in Oman and its performance on the basis of its vo..

  Questions on financial econometrics

Objective and multiple choice questions on Financial Econometrics responsible for creating financial statements.

  Option valuation report

Value Joseph's option position based on Black-Scholes method and analysis needs cover details behind the standard Black - Scholes method and explain detailed adjustment made to the standard BS method

  Conduct a bivariate nonlinear conintegration tests

Conduct a bivariate nonlinear conintegration tests using threshold Vector Error Correction (TVEC) methodology. Need to develop Matlab code.

  Calculate the expected exchange rate

Use a properly labelled IS-LM graph to analyze and illustrate the effect and calculate the expected exchange rate for the end of the year.

  Capm and capital structure

Reflect on the papers. Synthesize the key points they're making and consider the challenges of such points in a given context within your environment.

  Calculate the npv-irr and non-discounted payback period

Calculate the NPV, IRR, and Non-Discounted Payback Period using Excel - Outline and write the essay starting with the evidence-supported defense of your points and slowly transition into an address of opposing points.

  Objectives and principles guiding corporate governance

What is corporate governance and what are the objectives and principles guiding corporate governance?

  What is the capital budgeting process

What is capital budgeting, what is the capital budgeting process, what are the principles of capital budgeting and when do we make a capital investment?

  How do taxes affect the cost of capital

What is the cost of capital, what are WACC and MCC and how do taxes affect the cost of capital?

  How do you create or decrease leverage

What is leverage, how do you create or decrease leverage and why is leverage used?

  Calculate the wacc for both investment

Outline and write the essay starting with the evidence-supported defense of your points and slowly transition into an address of opposing points - Calculate the WACC for both investment. Calculate the NPV for investments discounted at their respec..

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