Solution - HW1-2022
Solution - HW1-2022
a=0.25
b=2.5
c=1.6
x=seq(-1,1,length.out = 15000)
y = (a*cos((b*pi*x)/2)) + ((1-a)*sin((c*pi*x)/2))
plot(x,y,type="l",ylim=c(-1,0.8))
a=0.5
b=2.5
c=1.6
x=seq(-1,1,length.out = 15000)
y = (a*cos((b*pi*x)/2)) + ((1-a)*sin((c*pi*x)/2))
lines(x,y,type="l",col="red")
a=0.75
b=2.5
c=1.6
x=seq(-1,1,length.out = 15000)
y = (a*cos((b*pi*x)/2)) + ((1-a)*sin((c*pi*x)/2))
lines(x,y,type="l",col="blue")
legend("bottom",legend=c("a=0.25","a=0.5","a=0.75"),col=c("black","red","blue"),lty=1)
2.a) 12.5 points
(
45+ Pr \{ x ≥ 22 \} ( 1.2 )=45+ 1−
22! )
e−35.6 ( 35.6 )22
( 1.2 )=46.194 $
3.a) 6 points
rm(list=ls())
library(datasets)
head(women)
hist(women$height)
sum(women$height>66)/dim(women)[1] []?
hist(women$weight)
library(fitdistrplus)
plotdist(women$weight,histo=TRUE,demp=TRUE)
Histogram of weight data looks like uniform distribution. Arguments The arguments given below
also support this. Empirical and theoretical densities are close to each other. You can find the
graph and the code below.
Parameters:
min 115 NA
max 164 NA
colvect=rep("black",dim(women)[1])
colvect[(women$height>68)&(women$weight>150)]="red"
colvect[(women$height<62)&(women$weight<129)]="blue"
plot(women$height,women$weight,col=colvect)
3.d) 6 points
cor(women$height,women$weight)
The correlation value is 0.9954948. So, there is a strong positive relationship between height and
weight.
4.a) 6 points
( k−1)
pmf =( 1− p ) p
The geometric distribution gives the probability that the first occurrence of success requires k
independent trials, each with success probability p.
Likelihood function;
n
4.b) 6 points
Log-likelihood function;
(∑ )
n
lnL ( p )=nlnp+ x i−n ln ( 1− p )
i=1
Take derivative;
n
∑ x −n
d ( lnL ( p ) ) n i=1 i
= − =0
dp p 1− p
n
p= n
∑ xi
i=1
4.c) 6 points
p.data=dim(women)[1]/sum(women$height)
D=rgeom(15,p.data)
table(D)
>t.test(D)
R output:
data: D
19.91296 87.28704
sample estimates:
mean of x
53.6
> chisq.test(D)
R output:
data: D
p.data=dim(women)[1]/sum(women$height)
probability=((1-p.data)^(70-1))*p.data