Suppose the birth-weight of babies (bwt, in grams as z-axis) is related to mater
ID: 3325552 • Letter: S
Question
Suppose the birth-weight of babies (bwt, in grams as z-axis) is related to maternal height (ht, in centimeters as x-axis) and weight (wt, in kilograms as y-axis) by the following function:
bwt = 7,627 – 72ht + 25wt + 0.25ht2 - 0.13wt2.
Plot this function using [130, 200] as the range for ht, and [40, 110] for wt. Put green color on the graph.
Hint: Use bwt <- outer(ht, wt, function(ht, wt) { 7627 – 72*ht + 25*wt + 0.25*ht^2 - 0.13*wt^2 }
Also use the function
persp(ht,wt,bwt/1000,xlab=:”height”,ylab=”weight”, zlab=”birth weight”)
(use R to solve with code)
Explanation / Answer
bwt=function(ht,wt){7627-72*ht+25*wt+0.25*(ht^2)-0.13*(wt^2)}
ht=seq(130,200,1)
wt=seq(40,110,1)
Mol=matrix(0,nrow=length(ht),ncol=length(wt))
for(i in 1:length(ht)){
for(j in 1:length(wt)){
Mol[i,j]=bwt(ht[i],wt[j])
}}
persp(ht,wt,Mol,col="green",xlab="height",ylab="weight", zlab="birth weight",ticktype="detailed",theta=30,phi=30)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.