Math 410 Exam 1

pdf

School

Drexel University *

*We aren’t endorsed by this school

Course

410

Subject

Statistics

Date

Jan 9, 2024

Type

pdf

Pages

16

Uploaded by madnan12678

Report
Problem 1 Pond ID 1 2 3 4 5 6 7 8 9 10 11 Bullfrogs 32 70 23 33 21 23 20 73 11 22 35 Rank 7 10 6 8 3 5 2 11 1 4 9 bullfrogs=c(32,70,23,33,21,23,20,73,11,22,35) sort(bullfrogs)#assign each number a rank in numerical order rank(bullfrogs) bullfrogs=c(32,70,23,33,21,23,20,73,11,22,35) sort(bullfrogs)#assign each number a rank in numerical order 11 20 21 22 23 23 32 33 35 70 73 rank(bullfrogs) 7.0 10.0 5.5 8.0 3.0 5.5 2.0 11.0 1.0 4.0 9.0 Problem 2 female=student_data[student_data$Gender=="female",] f=female$Pulse hist(f,breaks=10,xlim=c(20,160),ylim=c(0,35),main="Frequency of Pulse Rates in Females", xlab="Pulse Rates", col="pink")
male=student_data[student_data$Gender=="male",] m=male$Pulse hist(m,breaks=10,xlim=c(40,120),ylim=c(0,25),main="Frequency of Pulse Rates in Males", xlab="Pulse Rates", col="lightblue") The histograms differ slightly from eachother, for example, the male histogram has more pulse rate frequencies while the female histogram is more compact. Furthermore, while the female histogram goes up to the 30’s the male histogram goes up to the 20’s. The one similarity that I can see from the graphs is that their mode would fall somewhere around the value of 80. Problem 3 bass=read.csv(file.choose()) bass lengths=bass$length.mm. bins=seq(50,500, by=50) cut_data=cut(lengths,bins) tlengths=table(cut_data) tfish=transform(tlengths) names(tfish)[1]="Length(mm)"
names(tfish)[2]="Frequency" tfish Length(mm) Frequency 1 (50,100] 3 2 (100,150] 6 3 (150,200] 12 4 (200,250] 18 5 (250,300] 10 6 (300,350] 25 7 (350,400] 15 8 (400,450] 10 9 (450,500] 1 hist(lengths,breaks=20,main="Frequency of the Lengths of Largemouth Bass (mm)",col="lavender",xlim=c(0,500),ylim=c(0,15),xlab="Length(mm)")
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Problem 4 cum_data=cumsum(table(cut_data)) cum_col=transform(cum_data)$X_data cum_tlengths=data.frame(tlengths, cum_col) names(cum_tlengths)[1]="Length(mm)" names(cum_tlengths)[2]="Frequency" names(cum_tlengths)[3]="Cumulative Frequency" table(cum_tlengths) transform(table(cum_tlengths)) data=read.csv2(file.choose()) x=data$length.mm y=cumsum(x) hist_info=hist(y,breaks=20,main="Cumulative Frequencies for Base Lengths", col="turquoise", xlim=c(0,34000),ylim=c(0,10),xlab='Cumulative Sum')
bin=seq(50,500, by=50) bin freq.data=cut(bass$lengths,bin) freq.data hb=transform(table(freq.data)) names(hb)[1]='Length(mm)' names(hb)[2]='Frequency' hb cumbass=cumsum(table(freq.data)) cumbass bruh=data.frame(hb,cumbass) names(bruh)[3]='Cumulative Sum' names(bruh)[1]='Length(mm)' bruh=data.frame(hb,cumbass) Bruh library(LearningStats) freq.pol(bass$length.mm.,main=’Polygon of Cumulative Frequencies for Length’, xlab=’Length(in mm)’, ylab=’Cumulative Frequency’,freq=T)
This data shows the impact that the cumulative frequencies range from 0-8 while on the other hand, the frequencies range from 0-15. Problem 5 kingfisher=read.csv(file.choose()) kingfisher_data=kingfisher$Bill_length Mean mean(kingfisher_data) 55.9119 Median median(kingfisher_data) 56.5 Mode sort(kingfisher_data) [1] 41.6 46.3 46.6 47.5 48.3 49.4 50.8 50.9 51.5 51.6 52.0 53.0 53.4 53.4 [15] 54.5 54.6 54.6 55.0 55.2 55.5 56.5 56.5 56.5 56.6 57.2 57.2 57.5 58.1 [29] 58.8 58.8 58.8 59.4 59.4 60.6 61.2 62.7 62.8 64.0 64.6 64.6 64.8 66.0 freq_dat=kingfisher_data table(x) 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 32 72 1 5 5 4 6 6 3 3 6 1 2 1 1 1 1 2 1 1 transform(table(x)) 1 4 1 2 5 5 3 6 5 4 7 4 5 8 6 6 9 6 7 10 3 8 11 3 9 12 6 10 14 1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
11 15 2 12 16 1 13 18 1 14 19 1 15 20 1 16 21 2 17 32 1 18 72 1 mode=77 Range range(kingfisher_data) 41.6 66.0 IQR summary(kingfisher_data) Min. 1st Qu. Median Mean 3rd Qu. Max. 41.60 52.25 56.50 55.91 59.25 66.00 IQ Range: 59.25-52.25= 7 Variance var(kingfisher_data) 31.45864 Standard Deviation sd(kingfisher_data) 5.6088 Coefficient of Variation cv=sd(kingfisher_data)/ mean(kingfisher_data) cv 0.1003149 boxplot(kingfisher_data,ylab="Bill Length(mm)",main="Lengths of Kingfish",col="red")
Problem 6 turtles=c(92,92,92,103,103,103,103,103,103,103,103,113,113,113,113,113,113,113,113,113,113, 128,128,128,128,133,133,133,133,133,133,133,133,133,133,133,144,144,144,144,144,158,158,1 58,158,167,167,167) table(turtles) hist(turtles,breaks=9,xlim=c(80,180),ylim=c(0,12),main="Frequency of Upper Shell Length for Painted Turtles",xlab="Turtle Shell Length(mm)",col="seagreen") weighted.mean(turtles) 126.2083 The R calculation is off by 2.60, since the weighted mean calculated by R is 126.2 and the actual weighted mean is 123.6.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Problem 7 fish=read.csv(file.choose()) fish mfish=fish$FishLength[1:854] sample10=sample(mfish,10,replace=F) mean(sample10) 24.2 sd(sample10) 2.699794 sample25=sample(mfish,25,replace=F) mean(sample25) 23.76 sd(sample25) 2.169485 sample50=sample(mfish,50,replace=F) mean(sample50) 23.8 sd(sample50) 2.964071 The population mean and the mean that R calculated are similar to eachother. The reason that the standard deviation is not the value of 2.64 is due to the fact that the random choosing of numbers is skewed. Problem 8 prob=dbinom(0,25,0.10) prob 0.0717898
x=c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25) prob=dbinom(x,25,.10) prob [1] 7.178980e-02 1.994161e-01 2.658881e-01 2.264973e-01 1.384150e-01 6.459368e-02 [7] 2.392358e-02 7.215049e-03 1.803762e-03 3.785674e-04 6.730087e-05 1.019710e-05 [13] 1.321846e-06 1.468718e-07 1.398779e-08 1.139746e-09 7.914904e-11 4.655826e-12 [19] 2.299173e-13 9.411820e-15 3.137273e-16 8.299665e-18 1.676700e-19 2.430000e-21 [25] 2.250000e-23 1.000000e-25 sum(prob) 1 num_people=0:25 prob=dbinom(0:25,25,0.10) colorblind=data.frame(num_people,prob) names(colorblind)[1]="Number of People" names(colorblind)[2]="Probability" Colorblind
Number of People Probability 1 0 7.178980e-02 2 1 1.994161e-01 3 2 2.658881e-01 4 3 2.264973e-01 5 4 1.384150e-01 6 5 6.459368e-02 7 6 2.392358e-02 8 7 7.215049e-03 9 8 1.803762e-03 10 9 3.785674e-04 11 10 6.730087e-05 12 11 1.019710e-05 13 12 1.321846e-06 14 13 1.468718e-07 15 14 1.398779e-08 16 15 1.139746e-09 17 16 7.914904e-11 18 17 4.655826e-12 19 18 2.299173e-13 20 19 9.411820e-15 21 20 3.137273e-16 22 21 8.299665e-18 23 22 1.676700e-19 24 23 2.430000e-21 25 24 2.250000e-23 26 25 1.000000e-25
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
barplot(prob,names.arg=0:25,col="purple",xlab="Number of People", ylab="Probability",xlim=c(0,25), ylim=c(0,0.3),main="Binomial Distribution of Poeple who are Colorblind") The graph and the table above show the possibilities of all of the outcomes with the success rate being being colorblind. Problem 9 x=c(0,1,2,3,4,5,6,7,8,9,10) f=c(17,8,7,6,4,5,3,5,4,3,4) mean_value=sum(x*f)/sum(f) mean_value 3.530303 prob=dpois(x,mean_value) prob 0.029296037 0.103423888 0.182558833 0.214829333 0.189603162 0.133871323 0.078767723 0.039724847 0.017530094 0.006876283 0.002427536
sum(prob) 0.9989091 barplot(prob,names.arg=0:10,col="blue",xlab="Number of Worms",ylab="Probability", main="Poisson Distribution of Number of Worms") expected=prob*sum(f) expected 1.9335384 6.8259766 12.0488829 14.1787360 12.5138087 8.8355073 5.1986697 2.6218399 1.1569862 0.4538346 0.1602174
data.frame(x,f,expected) x f expected 1 0 17 1.9335384 2 1 8 6.8259766 3 2 7 12.0488829 4 3 6 14.1787360 5 4 4 12.5138087 6 5 5 8.8355073 7 6 3 5.1986697 8 7 5 2.6218399 9 8 4 1.1569862 10 9 3 0.4538346 11 10 4 0.1602174 As can be observed, the observed and the expected values are not the same thus leading to the Poisson Distribution being false.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help