Write your observations from the plot

Assignment Help Python Programming
Reference no: EM133640096

Scientific Computing

Instruction:

You may use MATLAB or Python for writing your programs. You are allowed to use the library function for calculating the matrix inverse, but are not allowed to use any library functions for calculating the pseudo or Moore-Penrose inverse.

Upload all your programs to the homework dropbox (do not put this in a word document or a pdf file. I'll should be able to run your programs for evaluation)

Learning Objective: To understand that there may exist a unique solution for a square matrix system of equations (using matrix inverse) and there exists a unique least squares solution to a rectangular matrix system of equations when there are more number of training data than the number of unknown model parameters to be estimated.

Homework Problem:

Question 1. Write a program to determine a unique polynomial function y(x) that passes through all the given data {(x1, y1), . . . , (xn, yn)}, for an arbitrary choice of n. Confirm that your estimates of the model parameters agree with the data by plotting the model predicted values of yi for various values of xi.

Data Generation : To evaluate your algorithms (programs), generate test data

{(xi, yi)}i=1n that has a cubic relationship as follows:

(a) Let the underlying relationship between variables xi (independent) and yi (dependent) be cubic. i.e. yi = β0 + β1xi + β2x2 + β3x3.

(b) Choose any non-zero values for the model parameters β0, β1, β2 and β3.

(c) Generate exactly 4 unique data points from the cubic model: {(xi, yi)}4i=1, where yi = β0 + β1xi + β2x2 + β3x3. For example, choosei xi = {-2, 0, 2, 4} ; β0 = 3; β1 = -1; β2 = -3 and β3 = 1 and estimate the model predicted values yi. i.e. these data points lie exactly on the cubic model. (ancillary question: how should one choose {xi}4i=1 for simulating the data governed by the model?)

Model validation

(a) Plot the data {(xi, yi)}4 i=1 used for estimating the model parameters {βi, i = 0, . . . , 3}

(b) Once the model parameters are estimated, estimate yˆi for {xi = -2, -1.9, -1.8, . . . , -0.1, 0, 0.1, . . . , 3.8, 3.9, 4.0}

(c) In the same figure, plot the data {(xi, y^i)} predicted by the model in the previous step.

(d) Write your observations from the plot as well as by comparing your parameter estimates with the true model parameters.

Question 2: Write a program to determine a polynomial function y(x) that passes through all the given data {(x1, y1), . . . , (xn, yn)} in a least squared error sense as discussed in class (for an arbitrary choice of n). Confirm that your estimates of the model parameters agree with the data by plotting the model predicted values of yi for various values of xi

Data Generation : To evaluate your algorithms (programs), generate test data {(xi, yi)}ni=1 that has a cubic relationship as follows:

a) Same as in the first problem.
b) Same as in the first problem.
c) Same as in the first problem.
d) Add random variations to each of the data points as follows:

yi = β0 + β1xi + β2x2 + β3x3 + ∈i, where the random variable ∈i follows a normal distribution with 0 mean and σ standard deviation. i.e. ∈i ∼ Normal(0, σ2). You can choose any variance σ, e.g. σ = 2. Hint: In Matlab, you can use eps = normrnd(mu, sigma, n) to draw n random ∈i from a normal distribution with mean mu = 0 and standard deviation sigma.

Model validation:

(a) Plot the data {(xi, yi)}4i=1 used for estimating the model parameters {βi, i = 0, . . . , 3}

(b) Once the model parameters are estimated, estimate yˆi for {xi = -2, -1.9, -1.8, . . . , -0.1, 0, 0.1, . . . , 3.8, 3.9, 4.0}

(c) In the same figure, plot the data {(xi, yˆi)} predicted by the model in the previous step.

(d) Write your observations from the plot as well as by comparing your parameter estimates with the true model parameters.

 

Reference no: EM133640096

Questions Cloud

What are the causes for his cognitive impairment : What are the causes for his cognitive impairment? How does his depression and cognitive problems affect his diabetes self-management?
Identifying assertions at risk and developing appropriate : Research information about the selected company Address particular areas of the audit process and develop appropriate audit procedures
How you will fulfill the requirements of the rfp you chose : Develop a project plan detailing how you will fulfill the requirements of the RFP you chose and the project proposal you created (Milestone Three).
How it impacts the delivery of health care services today : Respond to the following: Select 1 law or regulation and describe its history as well as how it impacts the delivery of health care services today.
Write your observations from the plot : Write your observations from the plot as well as by comparing your parameter estimates with the true model parameters.
What recommendations using theories : Analyse How Zurich insurance group can improve on their sustainability or diversity and inclusion? What recommendations using theories.
Create the project management documents : Create the project management documents needed to successfully lead a project.
Whats example of workplace violence : Whats an example of workplace violence that you have experienced?
Discuss the pricing strategy you plan to use : How you will use the sales cycle to approach it as you establish your consulting business. Discuss the pricing strategy you plan to use.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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