DOC

technology_for_chapter_3_maple

By Tommy Webb,2014-05-09 10:15
7 views 0
technology_for_chapter_3_maple

Technology for Chapter 3: Model Fitting wit Least Squares We will use the following to illustrate the use of technology.

Proportionality/Geometric Similarity with Model Fitting

1. PURPOSE: To provide the student the opportunity to develop proportionality arguments and test them using technology.

2. OBJECTIVE: Determine if the hearts of mammals are geometrically similar using your knowledge of proportionality models and technology. Provide a summary of your analysis using the following data to support or refute your argument.

Heart Weight Length of cavity of

Animal (in grams) left ventricle (in)

Mouse 0.13 0.55

Rat 0.64 1.00

Rabbit 5.80 2.20

Dog 102.00 4.00

Sheep 210.00 6.50

Ox 2030.00 12.00

Horse 3900.00 16.00

3. PROCEDURE:

a. Develop the proportionality model relating heart weight (HW) to the length (L) 3of the cavity of the left ventricle. You should get HW ; L.

b. Test the proportionality model using the data provided. Testing a proportionality model often involves the following steps:

(1) Enter the raw observed data into your calculator and computer.

(2) Plot the raw data to check for smoothness and potential "outliers", and to give you a "feel" of the type of proportionality you might find.

(3) Make any necessary transformations to the data for the model.

(4) Plot the transformed data to test the proportionality (It must form a straight line through the origin).

(5) Use least squares to find the constant of proportionality.

(6) Obtain an overlay of the actual vs. computed data or find the errors (y-y) to see if your model properly captures the trend of the data. Plot the actualpredicted

errors and comment on the adequacy of the fit.

>

Proportionality Template

Enter the raw data as Xdata and Ydata

Enter the tranformation to X or Y as as needed

Give the point to use in the slope

Interpret the output.

We illustrate with the same lab.

Heart Weight Length of cavity of

Animal (in grams) left ventricle (in)

Mouse 0.13 0.55

Rat 0.64 1.00

Rabbit 5.80 2.20

Dog 102.00 4.00

Sheep 210.00 6.50

Ox 2030.00 12.00

Horse 3900.00 16.00

>

>

> with(plots):with(stats):with(fit):with(linalg):

>

> SLR :=

proc(f,xpts::list,ypts::list,nda::integer,plotLB,plotUB)

> local xcolvec,ycolvec,yrowvec,Id,J,LRegFcn,res,j;

> global

SST,SSE,SSR,MSR,MSE,F_stat,ObsPoints,LR_PredCurve,

> CheckErrors,n,y_pred;

> n:=nda;

> xcolvec:=vector(nda,xpts);

> ycolvec:=vector(nda,ypts);

> yrowvec:=transpose(ycolvec);

> LRegFcn:=evalf(leastsquare[[x,y],f]([xpts,ypts]));

> printf("\n\nEstimated Regression

Equation: %a",LRegFcn);

>

y_pred:=transform[apply[unapply(rhs(LRegFcn),x)]](xpts);

> res:=transform[multiapply[(x,y)->x-y]]([ypts,y_pred]);

> SST:=evalf(evalm(yrowvec&*ycolvec)-

> SSR:=SST-SSE;

> MSR:=SSR/1;

> MSE:=SSE/(nda-2);

> F_stat:=MSR/MSE;

> ObsPoints:=pointplot(zip((x,y)-

>[x,y],xcolvec,ycolvec)):

>

LR_PredCurve:=plot(rhs(LRegFcn),x=plotLB..plotUB,color=blue

,font=[TIMES,BOLD,10],title="Estimated Regression Function

& Observations",labels=["Obs X","Obs

Y"],labelfont=[TIMES,BOLD,9]):

> CheckErrors:=pointplot(zip((x,y)->[x,y],y_pred,res),font=[TIMES,BOLD,10],title="Residuals vs

Predicted Values",labels=["Predicted

Values","Res"],labelfont=[TIMES,BOLD,9]):

>

> printf("\n\n ANOVA Table\n");

> printf(" (F* = %10.4f)",F_stat);

> printf("\n\n df SS

MS");

>

printf("\n_________________________________________________

_________");

> printf("\n\nRegression%9d%20.4f%19.4f",1,SSR,MSR);

> printf("\nError %9d%20.4f%19.4f ",n-2,SSE,MSE);

> printf("\nTotal %9d%20.4f ",n-1,SST);

>

printf("\n_________________________________________________

_________");

> printf("\n\n\n\n");

>

>

> end:

>

>

>

>

>

>

>

>

更多精品文档请关注本人主页？可爱喜洋洋http:///lxn214237830;下载后将页眉去掉即可；

>

>

>

>

>

更多精品文档请关注本人主页？可爱喜洋洋http:///lxn214237830;下载后将页眉去掉即可；

>

>

>

>

>

>

>

> dim:=vectdim(xobs):

User provided regression model equation and domain over which estimated regression

function is plotted:

>fcn:='y=a*x^3':plotLB:=0:plotUB:=50:#fcn:='y=a*x^3':plotLB:

=0:plotUB:=50:

Invoke procedure "SLR" and display:

(1) Least squares estimated regression function and observed values

(2) Plot of residuals against predicted values

> SLR(fcn,xobs,yobs,dim,plotLB,plotUB):

> display(ObsPoints,LR_PredCurve);

> printf("\n\n\n");display(CheckErrors);

Estimated Regression Equation: y = .9850662612*x^3

ANOVA Table

(F* = 522.6585)

df SS MS __________________________________________________________

Regression 1 13676795.4600 13676795.4600 Error 5 130838.7455 26167.7491 Total 6 13807634.2100

__________________________________________________________

更多精品文档请关注本人主页？可爱喜洋洋http:///lxn214237830;下载后将页眉去掉即可；

>

>

> seq(yobs[i]-y_pred[i],i=1..7);

>

Repeat the lab exercises for the following data set:

Report this document

For any questions or suggestions please email
cust-service@docsford.com