Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C/C++ Assignment: linear regression least-squares method Example output: LEAST_SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Quit 1 Please enter the name of

This is C/C++ Assignment:

linear regression least-squares method

image text in transcribedimage text in transcribedimage text in transcribed

Example output:

LEAST_SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Quit 1 Please enter the name of the file to open: data.txt Days Prognostic_index 2 54 5 50 7 45 10 37 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 8 60 4 65 6 There are 15 records. Data summary (Prognostic index): Mean =??? Median=??? Range=??? Mode=??? Standard Deviation=??? Linear Regression Fit: Prognostic_index = ???*exp -???*days Stander Error=??? MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 33 days = 33 Prognostic_index = 16.2 MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 73 days = 73 Prognostic_index = 3.54 MENU 1. Extrapolation 2. Main Menu 2 LEAST_SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Quit

data.txt:

Days Prognostic_index 2 54 5 50 7 45 10 37 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 8 60 4 65 6 
Purpose: Fit data using non-linear regression least-squares method for an exponential function. Discussion: A hospital administrator wished to develop a regression model for predicting the degree of long-term recovery after discharge from the hospital for severely injured patients. The predictor variable to be utilized is number of days of hospitalization (X), and the response variable is a prognostic index for long- term recovery (Y), with large values of the index reflecting a good prognosis. Data for 15 patients were studied and are presented in a file Related earlier studies reported in the literature found the relationship between the predictor variable and the response variable to be exponential. Hence, it was decided to investigate the appropriateness of the two-parameter nonlinear exponential regression mode. Days Prognostic_index 54 2 5 50 7 45 10 37 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 60 4 65 6 For the data in the file, the function has the form N = ae where a and b are constants that are determined from the fit. Until the user wishes to quit the application should do the following: Read data from a file Print the data Print report summary of the data (mean, median, range, mood, and standard Deviation) Do an exponential fit and print the regression equation Compute how accurate your exponential fit (Standard Error) Offer an interpolation/extrapolation of both the prognostic index. The exponential data has to be transformed to have a linear relation. Then find the value of a and b using the equations given in your lecture's slides. Offer the user the option of interpolating / extrapolating the data to find what the prognostic index will be in other days. LEAST SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Quit 1 Please enter the name of the file to open: data.txt Days Prognostic_index 2 5 50 7 45 10 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 E 60 4 65 6 There are 15 records. Data summary Prognostic index): Mean??? Median-??? Range 22 Mode-772 Standard Deviation-272 Linear Regression Fit: Prognostic_index - 777*ox-???days Stander Error-??? MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 33 days 33 Prognostic_index - 16.2 MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 73 days - 7 Prognostic Index - 3.54 MENU 1. Extrapolation 2. Main Menu 2 LEAST SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Ouit Purpose: Fit data using non-linear regression least-squares method for an exponential function. Discussion: A hospital administrator wished to develop a regression model for predicting the degree of long-term recovery after discharge from the hospital for severely injured patients. The predictor variable to be utilized is number of days of hospitalization (X), and the response variable is a prognostic index for long- term recovery (Y), with large values of the index reflecting a good prognosis. Data for 15 patients were studied and are presented in a file Related earlier studies reported in the literature found the relationship between the predictor variable and the response variable to be exponential. Hence, it was decided to investigate the appropriateness of the two-parameter nonlinear exponential regression mode. Days Prognostic_index 54 2 5 50 7 45 10 37 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 60 4 65 6 For the data in the file, the function has the form N = ae where a and b are constants that are determined from the fit. Until the user wishes to quit the application should do the following: Read data from a file Print the data Print report summary of the data (mean, median, range, mood, and standard Deviation) Do an exponential fit and print the regression equation Compute how accurate your exponential fit (Standard Error) Offer an interpolation/extrapolation of both the prognostic index. The exponential data has to be transformed to have a linear relation. Then find the value of a and b using the equations given in your lecture's slides. Offer the user the option of interpolating / extrapolating the data to find what the prognostic index will be in other days. LEAST SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Quit 1 Please enter the name of the file to open: data.txt Days Prognostic_index 2 5 50 7 45 10 14 35 19 25 26 20 31 16 34 18 38 13 45 8 52 11 53 E 60 4 65 6 There are 15 records. Data summary Prognostic index): Mean??? Median-??? Range 22 Mode-772 Standard Deviation-272 Linear Regression Fit: Prognostic_index - 777*ox-???days Stander Error-??? MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 33 days 33 Prognostic_index - 16.2 MENU 1. Extrapolation 2. Main Menu 1 Please enter the days to extrapolate to: 73 days - 7 Prognostic Index - 3.54 MENU 1. Extrapolation 2. Main Menu 2 LEAST SQUARES LINEAR REGRESSION MENU 1. Exponential Fit 2. Ouit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago