1. Introduction
Human Body weight varies according to different human group. In this project; we are interested in human body weight in female within the age of 27. A weight equation for the female group in terms of body builds variables was found using multiple regression technique. Also series of T test have been executed to verify the relative significant importance of each variable, determining variable entries. The whole procedure can be described as follow figure1-1.
2. Procedure

DATAFILE= "C:\Documents and Settings\Administrator\desktop\Project\body.dat";
DBMS=TAB REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;
/*----------------------------------------
sifting data: gender=female, age less than 27
-----------------------------------------*/
proc iml;
use sasuser.body ;
read all var {'biacromial' 'pelvic_breadth' 'bitrochanteric' 'chest_depth' 'chest_diam' 'elbow_diam' 'wrist_diam'
'knee_diam' 'ankle_diam' 'shoulder_girth' 'chest_girth' 'waist_girth' 'navel_girth' 'hip_girth' 'thigh_girth' 'bicep_girth' 'forearm_girth' 'knee_girth' 'calf_girth' 'ankle_girth' 'wrist_girth' 'height' 'age' }into x;
read all var {'weight'} into y;
run;data sasuser.bodysl;
set sasuser.body;
if 0 le age le 27 & gender='1'; run;
/*----------------------------
Normality Test of Weigth
-----------------------------*/proc univariate data=sasuser.bodysl normal;
var weight;
histogram/normal;
run;/*---------------------------------
Correlation between variables
----------------------------------*/
proc corr data=sasuser.bodysl;
var biacromial pelvic_breadth bitrochanteric chest_depth chest_diam elbow_diam wrist_diam knee_diam ankle_diam shoulder_girth chest_girth waist_girth navel_girth hip_girth thigh_girth
bicep_girth forearm_girth knee_girth calf_girth ankle_girth wrist_girth height;
run;
data sasuser.body;
set sasuser.bodysl;
keep weight biacromial pelvic_breadth bitrochanteric chest_depth wrist_diam knee_diam ankle_diam chest_girth thigh_girth calf_girth ankle_girth height;
run;/*----------------------------------
Initial multiple regression Model
-----------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'pelvic_breadth' 'bitrochanteric' 'chest_depth' 'wrist_diam' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' 'ankle_girth' 'height' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
print beta;
run;/*-------------------------------------
First round t-test for coefficient
--------------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'pelvic_breadth' 'bitrochanteric' 'chest_depth' 'wrist_diam' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' 'ankle_girth' 'height' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
print beta;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
print varbeta;
do i=2 to 13;
g=varbeta[i,i];
sqr=sqrt(g);
ttest1=beta[i,1]/sqr;
if ttest1<0 p="2*probt(ttest1,89);">0 then p=2*(1-probt(ttest1,89));
print p;
end;
run;
/*------------------------------------------------------------------
P value of variable Pelvic_breadth=0.7289, drop pelvic_breadth
------------------------------------------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'bitrochanteric' 'chest_depth' 'wrist_diam' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' 'ankle_girth' 'height' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
print varbeta;
do i=2 to 12;
g=varbeta[i,i];
sqr=sqrt(g);
ttest1=beta[i,1]/sqr;
if ttest1<0 p="2*probt(ttest1,90);">0 then p=2*(1-probt(ttest1,90));
print p;
end;
run;
/*-----------------------------------------------------------
P value of variable Wrist_diam=0.49385, drop Wrist_diam
-----------------------------------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'bitrochanteric' 'chest_depth' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth'
'calf_girth' 'ankle_girth' 'height' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
print varbeta;
do i=2 to 11;
g=varbeta[i,i];
sqr=sqrt(g);
ttest1=beta[i,1]/sqr;
if ttest1<0 p="2*probt(ttest1,91);">0 then p=2*(1-probt(ttest1,91));
print p;
end;
run;
/*------------------------------------------------
P value of variable Height=0.58, drop height
-------------------------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'bitrochanteric' 'chest_depth' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' 'ankle_girth'} into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
print varbeta;
do i=2 to 10;
g=varbeta[i,i];
sqr=sqrt(g);
ttest1=beta[i,1]/sqr;
if ttest1<0 p="2*probt(ttest1,92);">0 then p=2*(1-probt(ttest1,92));
print p;
end;
run;
/*-------------------------------------------------------------
P value of variable ankle_girth=0.6952, drop ankle_girth
-------------------------------------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'bitrochanteric' 'chest_depth' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
print varbeta;
do i=2 to 9;
g=varbeta[i,i];
sqr=sqrt(g);
ttest1=beta[i,1]/sqr;
if ttest1<0 p="2*probt(ttest1,93);">0 then p=2*(1-probt(ttest1,93));
print p;
end;
run;
/*----------------------
Confidence Interval
-----------------------*/
proc iml;
use sasuser.bodysl;
read all var{'biacromial' 'bitrochanteric' 'chest_depth' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth'
'calf_girth' } into x;
read all var{'weight'} into y;
t=tinv(0.975,93);
print t;
n=nrow(x);
m=ncol(x);
x=j(n,1,1)x;
beta=inv(x`*x)*x`*y;
sse=y`*y-beta`*x`*y;
df_sse=n-m-1;
mse=sse/df_sse;
varbeta=inv(x`*x)*mse;
upperb=j(9,1);
lowerb=j(9,1);
do i=1 to 9;
g=varbeta[i,i];
sqr=sqrt(g);
upperb[i,1]=beta[i,1]+t*sqr;
lowerb[i,1]=beta[i,1]-t*sqr;
end;
print upperb;
print lowerb;
run;
/*------------------------------
ANOVA Table Using Proc IML
-------------------------------*/
proc iml;
use sasuser.bodysl;
read all var {'biacromial' 'bitrochanteric' 'chest_depth' 'knee_diam' 'ankle_diam' 'chest_girth' 'thigh_girth' 'calf_girth' } into x;
read all var{'weight'} into y;
n=nrow(x);
m=ncol(x);
vector=j(102,8);
do i=1 to 8;
xbar=mean(x[:,i]);
do count=1 to 102;
vector[count,i]=xbar;
end;
end;
print vector;
cenX=j(102,8);
do k=1 to 102;
do q=1 to 8;
cenX[k,q]=x[k,q]-vector[k,q];
end;
end;
print cenX;
ybar=mean(y[:,1]);
print ybar;
cenbeta=inv(cenX`*cenX)*cenX`*y;
ssr=cenbeta`*cenX`*y;
sse=y`*y-n*(ybar*ybar)-cenbeta`*cenX`*y;
sst=y`*y-n*ybar*ybar;
df_sse=n-m-1;
df_ssr=m;
mse=sse/df_sse;
print ssr;
msr=ssr/df_ssr;
f=msr/mse;
print beta;
print sse ssr df_sse df_ssr;
print mse msr;
print f;
pvalue=1-probf(125.008,8,93);
print pvalue;
run;/*----------------------------
ANOVA Table Using PROC REG
----------------------------*/
proc reg data=sasuser.body ;
model weight=biacromial bitrochanteric chest_depth knee_diam ankle_diam chest_girth thigh_girth calf_girth/clb;
run;Request for final report, please send email to stefanie.cao@gmail.com with title: ''Request for Human Weight Research Report''.
No comments:
Post a Comment