Professional Documents
Culture Documents
A LAB ASSIGNMENT-07
{NAME:RUDRASISH MISHRA} | {SECTION:IT-8} | {ROLL NO:1906649}
Q1. You’ve been given a list of twenty blood types for emergency
surgery patients:
A, O, A, B, B, AB, B, B, O, A, O, O, O, AB, B, AB, AB, A, O, A.
WAP to draw a frequency distribution table consisting of distinct
items, frequency, proportion,percent and cumulative frequency.
SOLUTION:
INPUT:
bloodgroup_649 <- c("A", "O", "A", "B", "B", "AB", "B", "B", "O",
"A", "O", "O", "O", "AB", "B", "AB", "AB", "A", "O", "A")
freqtable_649 <- table(bloodgroup_649)
proportion_649 <- prop.table(freqtable_649)
percentagetable.511 <- proportion_649*100
cumulativefreqtable_649 <- cumsum(freqtable_649)
SOLUTION:
INPUT:
distribution_649 <- data.frame(
Class_Interval = c("0-10", "10-20", "20-30", "30-40", "40-50",
"50-60", "60-70", "70-80"),
Frequency = c(6, 12, 22, 48, 56, 32, 18, 6)
)
distribution_649
median_649 = median(distribution_649$Frequency)
print(median_649)
mean_649 = mean(distribution_649$Frequency)
print(mean_649)
stddeviation_649 = sd(distribution_649$Frequency)
print(stddeviation_649)
skewness_649 = 3*(mean_649-median_649)/stddeviation_649
print(skewness_649)
print("The data is average skewed as skewness is between -1 and –
0.5 or between 0.5 and 1 ")
OUTPUT:
Q3. WAP to comment on the nature of distribution:
❖ 14, 14, 14, 14, 14
❖ 11, 12, 14, 16, 17
❖ 1, 3, 6, 8, 42
SOLUTION:
INPUT:
natdist_649 <- data.frame(
x = c(14,14,14,14,14),
y = c(11,12,14,16,17),
z = c(1,3,6,8,42)
)
natdist_649
print("statistical summary of data:-")
print(summary(natdist_649))
print(class(natdist_649))
print(paste("x is",class(natdist_649$x)))
print(paste("y is",class(natdist_649$y)))
print(paste("z is",class(natdist_649$z)))
)
OUTPUT:
Q4. The following facts were gathered from a firm before and
after an industrial update. By making use of the above data,
compare the position of the firm before and after the dispute as
fully as possible.
SOLUTION:
INPUT:
Before_Dispute_649 <- data.frame(
Mean_wages = 850,
Median_wages = 820,
Number_employed = 600,
Standard_distribution = 30,
First_quartile = 750,
Third_quartile = 920,
Modal_wages = 760
)
After_Dispute_649 <- data.frame(
Mean_wages = 900,
Median_wages = 800,
Number_employed = 550,
Standard_distribution = 110,
First_quartile = 750,
Third_quartile = 950,
Modal_wages = 600
)
print(paste("Numbers of Employers decreased =
",Before_Dispute_649$Number_employed-
After_Dispute_649$Number_employed))
twagebd_649 =
Before_Dispute_649$Number_employed*Before_Dispute_649$Mean_wages
print(paste("Wages before Dispute = Rs.",twagebd_649))
twagead_649 =
After_Dispute_649$Number_employed*After_Dispute_649$Mean_wages
print(paste("Wages after Dispute = Rs.",twagead_649))
print(paste("Total decreased wages = Rs.", twagebd_649 -
twagead_649))
print(paste("The median & modal wage have decreased
",Before_Dispute_649$Median_wages-
After_Dispute_649$Median_wages,"and
",Before_Dispute_649$Modal_wages-After_Dispute_649$Modal_wages))
print(paste("Q1 has not changed but Q2 has decreased slightly
also Q3 has increased ",After_Dispute_649$Third_quartile-
Before_Dispute_649$Third_quartile,"."))
cvbefored_649 =
Before_Dispute_649$Standard_distribution/Before_Dispute_649$Mean_
wages*100
print(paste("C.V. before dispute = ",cvbefored_649,"%"))
cvafterd_649 =
After_Dispute_649$Standard_distribution/After_Dispute_649$Mean_wa
ges*100
print(paste("C.V. after dispute) = ",cvafterd_649,"%"))
SOLUTION:
INPUT:
marks_649 <-
c(55,75,65,30,90,55,40,50,60,80,80,76,95,75,55,45,65,80,30,50,75,85,80
,90,75,75,90,65,78,72,82,52,62,67,66,65,88,45,70)
freq_649 <- table(marks_649)
print(freq_649)
#measures of Position
res_649 <- quantile(marks_649, probs = c(0,0.25,0.5,0.75,1))
print("Quantile =")
print(res_649)
print("Five Number Summary =")
print(summary(marks_649))
print("Z-Score =")
print((marks_649-mean(marks_649))/sd(marks_649))
OUTPUT:
Q7. WAP to determine the types of kurtosis for the data values 0, 3,
4, 1, 2, 3, 0, 2, 1,
3, 2, 0, 2, 2, 3, 2, 5, 2, 3, 999.
SOLUTION:
INPUT:
OUTPUT:
print(paste("Covariance =",cov(infant_649$Gestational_Age_weeks,
infant_649$Birth_weight_gm)))
plot(infant_649$Gestational_Age_weeks,infant_649$Birth_weight_gm, main
= "Birth Weight vs. Gestational Age", pch = 19, frame = FALSE)
abline(lm(infant_649$Birth_weight_gm ~
infant_649$Gestational_Age_weeks), col = "blue")
OUTPUT:
Q9. Nine students held their breath, once after breathing normally and
relaxing for one minute, and once after hyperventilating for one
minute. The table indicates how long (in sec) they were able to hold
their breath. Is there an association between the two variables?
SOLUTION:
INPUT:
OUTPUT:
Q10. Find the Standard Score, Quartile, and The Five Number
Summary of the data in below figure.53
SOLUTION:
INPUT:
OUTPUT:
Q11. Given the following return information, what is the
covariance and correlation coefficient between the return of
Stock A and the return of the market index?
SOLUTION:
INPUT:
OUTPUT:
Q12. Find the covariance and correlation coefficient of eruption
duration and waiting time in the data set is faithful. Observe if
there is any linear relationship between the two variables.
SOLUTION:
INPUT:
data()
data(faithful)
View(faithful)
summary(faithful)
print(paste("Correlation
Coefficient=",cor(faithful$eruptions,faithful$waiting)))
print(paste("Covariance =",cov(faithful$eruptions,faithful$waiting)))
plot(faithful$eruptions,faithful$waiting,col = "blue",main =
"Eruptions & Waiting Regression",pch = 19,frame = FALSE,xlab =
"Faithful$Eruptions",ylab = "Faithful$Waiting")
abline(lm(faithful$waiting~faithful$eruptions),col = "red")
print("Linear Relation =")
association_649 <- lm(faithful$eruptions~faithful$waiting)
print(association_649)
print(summary(association_649))
DATASET:
OUTPUT:
{NAME:RUDRASISH MISHRA} | {SECTION:IT-8} | {ROLL NO:1906649}