Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Overview This assignment will give you more experience on the use of functions and dictionaries. You will practice them by processing a le from

image text in transcribed
Assignment Overview This assignment will give you more experience on the use of functions and dictionaries. You will practice them by processing a le from a reallife dataset. In general, any time you nd yourself copying and pasting your code, you should probably place the copied code into a separate function and then call that function. Problem Statement Given a data file of 507 individuals and their physical attributes (weight, height, etc. from the body dataset at http://www.amstat.org/publications/jse/datasets/I, create two linear regression models and their correlation: - between a person's BMI and their age. - between a person's weight and a combination of physical attributes. The authors propose the following formula: 0 110 + 1.34(ChestDiarneter) + 1.54(ChestDepth) + 1.20(BitrochantericDiameter) + 1.1 1(W1istGirth) + 1.15(AnkleGirth) + 0.177(Height) Background BMI is short for Body Mass Index, is a measure based on a person's weight and height. It is used as a estimator of healthy body weight (see http://enwikigdiaorg/wiki/Body mass index ) Linear regression is a form of regression analysis in which the relationship between one or more independent variables and another variable, called the dependent variable, is modeled by a least squares function, called a linear regression equation. A linear regression equation with one independent variable represents a straight line when the predicted value (i .e. the dependant variable from the regression equation) is plotted against the independent variable: this is called a simple linear regression. For example, suppose that a straight line is to be t to the points (ya, xi), where i = I, n; y is called the dependent variable and x is called the independent variable, and we want to predict y from x. Least Squares and Correlation The method we are going to use is called the least squares method. It takes a list of x values and y values (the same number of each) and calculates the slope and intercept of a line that best matches those values. See hgp:l/easycalculation.com/statistics/learnregression.php for an example. To calculate the least squares line, we need to calculate the following values from the data: 0 sumX and sumY: the sum of all the X values and the sum of all the Y values - sumXY: the sum of all the products of each corresponding X,Y pair - sumXSquared and sumYSquared: the sum of the square of every X value and the sum of the square of every Y value a N: the number of pairs The calculation then is: . slope=(N*sumXY - (sumX*sumY))/(N*sumXSquared - (sumX)2) - intercept = (sumY (slope*sumX)) / N

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

Students also viewed these Programming questions