Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 4: Modeling Growth (12 points) In this section, we're going to practice applying a model to the relationship of height and age. This will
Part 4: Modeling Growth (12 points) In this section, we're going to practice applying a model to the relationship of height and age. This will entail combining several of the programming concepts to date Multiple different relationships have been proposed to describe how height changes with age. To start, a simple model would be a linear relationship Question 14: Define a function to compute height according to the relationship: where h is height in cm, a is age in years, and m and b are two parameters. For now, set m and b equal to 5.33 cmlyr and 82.00 cm. As a sanity check, call this function for age-15 years. It should return a height of 162 cm ### Put your code here Question 15: Create a NumPy array called "increase_age" that goes from 2 to 20 in increments of 0.5 using np.arange() . Using the linear relationship function defined above, calculate the height for all values in increase_age and store in an array named "linear_height". Create a scatter plot with the original data of height vs age (same as plot made above). Add a line plot of linear_height vs increase_age on top of the first plot (use a different color than the scatter points). Label your plot with appropriate axis labels. ### Put your code here Additional Models: The ICP-model is a more realistic model of growth with age. This model proposes that during childhood (age 2-12 years old), a quadratic relationship is appropriate where h is height in cm, a is age in years. After puberty >= 12 years old function: there is a growth spurt followed by a plateau, which can be modeled as a logistic P4 h- The parameters [PP2 1, 1lyrs, cm Po P] should be set to [-0.235, 9.6,65.2, 22.5, 16.4, 1.18, 145.3] respectively, with corresponding units [cm/yrs2, cm/yrs, cm, cm Question 16: Define one function to return the childhood height for any given age and one function to return the the post-childhood height for any given age. H ### Put your code here Question 17: Calculate the height using the ICP-model for all the ages in the array increase_age . As a suggestion, inside a loop over all ages in increase_age , you can have a conditional statement to determine if age is pre- or post puberty, and then use the appropriate function above. Create a scatter plot of the original height vs age (same as plot made above). Add this ICP-model height vs increase_age on top of the plot. Label your plot with appropriate axis labels. ### Put your code here Question 18: Does the linear model or ICP-model fit the height to age relationship better. How can you tell? Explain your reasoning. Put your answer here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started