Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modeling Minimum Wage Historical Data through Regression and Data Fitting The ob

ID: 3148705 • Letter: M

Question

Modeling Minimum Wage Historical Data through Regression and Data Fitting The objective of this project is to model the Minimum Wage historical data using various functions and determine the most appropriate mathematical model. The minimum wage data is presented in Appendix A. The 4 functions to be considered are as follows 1. 2. 3. 4. Linear function Quadratic functions Polynomial functions [Try at least for n=4, functionfx)= anx" + an-l·Xn-l + al.x + ao ] Exponential ab-exponential function Either function/()= ab' or f(t)= a, e kt] Hints and Guidance 1. Maple is the tool to use to complete this project. 3. Compare the bet-fit models with the real minimum wage date for years 2007, 2008 and 200. 4. Predict the minimum wage for 2020 using all models 5 Analyze and comment on your prediction models. 6. Your project needs to be typed and screen shots from the Maple tools need to be incorporated in your document to support your work. Ensure you deliver complete and neat project. 7.

Explanation / Answer

Topics motivation interpolation linear regression higher order polynomial form exponential form Curve fitting - motivation For root finding, we used a given function to identify where it crossed zero where does ?? Q: Where does this given function come from in the first place? • Analytical models of phenomena (e.g. equations from physics) • Create an equation from observed data 1) Interpolation (connect the data-dots) If data is reliable, we can plot it and connect the dots This is piece-wise, linear interpolation This has limited use as a general function Since its really a group of small s, connecting one point to the next it doesn’t work very well for data that has built in random error (scatter) 2) Curve fitting - capturing the trend in the data by assigning a single function across the entire range. The example below uses a straight line function A straight line is described generically by f(x) = ax + b The goal is to identify the coefficients ‘a’ and ‘b’ such that f(x) ‘fits’ the data well H( ) Z H( ) Z H( ) Z H( ) Z Interpolation Curve Fitting f(x) = ax + b f(x) = ax + b for each line for entire range CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 87 of 99 other examples of data sets that we can fit a function to. Is a straight line suitable for each of these cases ? No. But we’re not stuck with just straight line fits. We’ll start with straight lines, then expand the concept. Linear curve fitting (linear regression) Given the general form of a straight line How can we pick the coefficients that best fits the line to the data? First question: What makes a particular straight line a ‘good’ fit? Why does the blue line appear to us to fit the trend better? • Consider the distance between the data and points on the line • Add up the length of all the red and blue verticle lines • This is an expression of the ‘error’ between data and fitted line • The one line that provides a minimum error is then the ‘best’ straight line time height of dropped object Oxygen in soil temperature soil depth pore pressure Profit paid labor hours H( ) ZCZ D CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 91 of 99 We started the linear curve fit by choosing a generic form of the straight line f(x) = ax + b This is just one kind of function. There are an infinite number of generic forms we could choose from for almost any shape we want. Let’s start with a simple extension to the linear regression concept recall the examples of sampled data Is a straight line suitable for each of these cases ? Top left and bottom right don’t look linear in trend, so why fit a straight line? No reason to, let’s consider other options. There are lots of functions with lots of different shapes that depend on coefficients. We can choose a form based on experience and trial/error. Let’s develop a few options for non-linear curve fitting. We’ll start with a simple extension to linear regression...higher order polynomials Polynomial Curve Fitting Consider the general form for a polynomial of order (1) Just as was the case for linear regression, we ask: How can we pick the coefficients that best fits the curve to the data? We can use the same idea: The curve that gives minimum error between data and the fit is ‘best’ Quantify the error for these two second order curves... • Add up the length of all the red and blue verticle lines • pick curve with minimum total error Error - Least squares approach time height of dropped object Oxygen in soil temperature soil depth pore pressure Profit paid labor hours L H( ) ZCCZ CZ CZ CL Z L CCMZ M M L [ H( ) Z CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 94 of 99 Fit a second order polynomial to the following data Since the order is 2 ( ), the matrix form to solve is Now plug in the given data. Before we go on...what answers do you expect for the coefficients after looking at the data? , , Note: we are using , NOT . There’s a big difference using the inversion method or use Gaussian elimination gives us the solution to the coefficients i123456 0 0.5 1.0 1.5 2.0 2.5 0 0.25 1.0 2.25 4.0 6.25 Z [ L P Z KZK Z KZK ZK ZK ZK ZK C C C [ K ZK [ K ZK [ K P Z K[ K ZK ZK [ K ZK ZK [ K ZK C C C ZK Z K( ) C C C KPX CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 95 of 99 ===> This fits the data exactly. That is, f(x) = y since y = x^2 Example #2: uncertain data Now we’ll try some ‘noisy’ data x = [0 .0 1 1.5 2 2.5] y = [0.0674 -0.9156 1.6253 3.0377 3.3535 7.9409] The resulting system to solve is: giving: So our fitted second order function is: Example #3 : data with three different fits In this example, we’re not sure which order will fit well, so we try three different polynomial orders Note: Linear regression, or first order curve fitting is just the general polynomial form we just saw, where we use j=1, • 2nd and 6th order look similar, but 6th has a ‘squiggle to it. We may not want that... Overfit / Underfit - picking an inappropriate order C C C H( ) Z Z Z C C C KPX C C C H( ) Z Z Z CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 96 of 99 Overfit - over-doing the requirement for the fit to ‘match’ the data trend (order too high) Polynomials become more ‘squiggly’ as their order increases. A ‘squiggly’ appearance comes from inflections in function Consideration #1: 3rd order - 1 inflection point 4th order - 2 inflection points nth order - n-2 inflection points Consideration #2: 2 data points - linear touches each point 3 data points - second order touches each point n data points - n-1 order polynomial will touch each point SO: Picking an order too high will overfit data General rule: pick a polynomial form at least several orders lower than the number of data points. Start with linear and add order until trends are matched. Underfit - If the order is too low to capture obvious trends in the data General rule: View data first, then select an order that reflects inflections, etc. For the example above: 1) Obviously nonlinear, so order > 1 2) No inflcetion points observed as obvious, so order < 3 is recommended =====> I’d use 2nd order for this data Curve fitting - Other nonlinear fits (exponential) overfit Profit paid labor hours Straight line will not predict diminishing returns that data shows CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 97 of 99 Q: Will a polynomial of any order necessarily fit any set of data? A: Nope, lots of phenomena don’t follow a polynomial form. They may be, for example, exponential Example : Data (x,y) follows exponential form Note that neither 2nd nor 3rd order fit really describes the data well, but higher order will only get more ‘squiggly’ We created this sample of data using an exponential function. Why not create a general form of the exponential function, and use the error minimization concept to identify its coefficients. That is, let’s replace the polynomial equation With a general exponential equation where we will seek C and A such that this equation fits the data as best it can. The next line references a separate worksheet with a function inside called Create_Vector. I can use the function here as long as I reference the worksheet first Reference:C:MineMathcadTutorialsMyFunctions.mcd X Create_Vector 2 := ( ) , 4, .25 Y 1.6 exp 1.3 X := ( ) f2 regress X Y := ( ) , , 2 f3 regress X Y := ( ) , , 3 fit2 x( ) interp f2 X := ( ) , ,Y, x fit3 x( ) interp f3 X := ( ) , ,Y, x i 2 := , 1.9.. 4 20 2 4 0 100 200 300 data 2nd order 3rd order H( ) ZCCZ CZ CZ CL Z L CCMZ M M L H( ) Z%G#Z % #ZGZR( ) CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 98 of 99 Again with the error: solve for the coefficients such that the error is minimized: minimize Problem: When we take partial derivatives with respect to and set to zero, we get two NONLINEAR equations with respect to So what? We can’t use Gaussian Elimination or the inverse function anymore. Those methods are for LINEAR equations only... Now what? Solution #1: Nonlinear equation solving methods Remember we used Newton Raphson to solve a single nonlinear equation? (root finding) We can use Newton Raphson to solve a system of nonlinear equations. Is there another way? For the exponential form, yes there is Solution #2: Linearization: Let’s see if we can do some algebra and change of variables to re-cast this as a linear problem... Given: pair of data (x,y) Find: a function to fit data of the general exponential form 1) Take logarithm of both sides to get rid of the exponential 2) Introduce the following change of variables: , , Now we have: which is a LINEAR equation The original data points in the plane get mapped into the plane. This is called data linearization. The data is transformed as: Now we use the method for solving a first order linear curve fit for and , where above , and Finally, we operate on to solve And we now have the coefficients for % #, GTT [K( ) ( ) % #ZGZR( ) K P GTT % #, [ %G#Z NP( ) [%G#Z NP( ) #Z % NP( ) ; [NP( ) : Z$ %NP( ) ; #: $ Z [: ; ( ) Z [, ( ) : ;, ( ) Z [, NP( ) P : :: $ # ; :; # $; [NP( ) : Z $ %NP( ) % G$ [ %G#Z CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 5 - Curve Fitting Techniques page 99 of 99 Example: repeat previous example, add exponential fit C 1.6 = A 1.3 = 20 2 4 0 100 200 300 data 2nd order exp

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote