Student Data Assignment 2022

   

Added on  2022-09-11

5 Pages1444 Words23 Views
R ASSIGNMENT
STUDENT NAME
4/4/2020
#Make sure that some library(gdata,psych,arsenal,car) are installed in
your program for all outputs.
Question 1
hippodata<-read.csv(file.choose(),header=T)#reads data from location
View(hippodata)#helps to check if all variables are as intended.
attach(hippodata)#calls the variables to be used for analysis.
Question 2
#recode command transfroms the data into the desired variablesand
labels them as instructed.Make sure the packages are installed in
library as communicated.
recode(Age.Group,1= "4 to 7",2 =" 8 to 12",default = NULL, .missing =
NULL)
recode(Severity,1= "mild",2 =" moderate",3 =" severe",default
= NULL, .missing = NULL)
recode(Type,1= "Dip",2 ="Hemi",3 ="Quadri", default = NULL, .missing =
NULL)
Question 3
a.
#Summary command give the descriptive statistics for the variables
mentioned
summary(hippodata$GMFM.E.Pre,GMFM.E.Post)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 0.00 0.00 21.44 47.90 90.20
summary(hippodata$GMFM.E.Post)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 0.00 8.30 25.24 52.05 93.00
b.
#Create two new variables which categorise the GMFM.The
hippodata$GMFM.E.Pre1 allow creation of GMFM.E.Pre1 variable that
Usingthe desired properties.
hippodata$GMFM.E.Pre1 [hippodata$GMFM.E.Pre<=0]="zero"
hippodata$GMFM.E.Pre1 [hippodata$GMFM.E.Pre>0]="greater than zero"
Student Data Assignment 2022_1
hippodata$GMFM.E.Post1 [hippodata$GMFM.E.Post>0]="greater than zero"
hippodata$GMFM.E.Post1 [hippodata$GMFM.E.Post<=0]="zero"
c.
#Cross-tabulate these new variables.First,the attach command helps to
call the new generated variables for use.
Table commandhelps to tabulate the variables
attach(hippodata)
## The following objects are masked from hippodata (pos = 3):
##
## Age.Group, ECAB.Post, ECAB.Pre, GMFM.A.Post, GMFM.A.Pre,
## GMFM.B.Post, GMFM.B.Pre, GMFM.C.Post, GMFM.C.Pre, GMFM.D.Post,
## GMFM.D.Pre, GMFM.E.Post, GMFM.E.Pre, GMFM.TOTAL.Post,
## GMFM.TOTAL.Pre, Participant, Previous.Time, Severity, Type
table(GMFM.E.Pre1,GMFM.E.Post1)
## GMFM.E.Post1
## GMFM.E.Pre1 greater than zero zero
## greater than zero 15 0
## zero 2 14
In both variables, many values were found to be greater than zero
(15).In both variables,14 value were zero.
#Assing p to the table and getting the proportions for each
p<-table(GMFM.E.Pre1,GMFM.E.Post1)
prop.table(p)
## GMFM.E.Post1
## GMFM.E.Pre1 greater than zero zero
## greater than zero 0.48387097 0.00000000
## zero 0.06451613 0.45161290
Checking the column proportions, this would be 48% and 45% respectively.
Question 4
a
#Create a new variable which is the difference between each child’s
post-study ECAB score and their pre-study ECAB score.
#creation of ECAB.Pd1
hippodata$ECAB.Pd1<-hippodata$ECAB.Post-hippodata$ECAB.Pre
attach(hippodata) #calls the new variables for analysis
Student Data Assignment 2022_2

End of preview

Want to access all the pages? Upload your documents or become a member.