Links to all courses

Answers:

Note: the lines starting with hash symbol represent comments. They are not part of the actual codes.

#1

(log(919,2)-3)/log(919,10)-1

#2

#a

y=rchisq(10000,5)

#b

p=y[which(y>2&y<3)]

length(p)

#or in one line

length(y[which(y>2&y<3)])

#c

x=ifelse(y<1,0,ifelse(y>=3,2,1))

#d

mean(y)

median(y)

#e

#we know median of chi-squared dist = k(1-

5*(1-2/(9*5))^2

#3

X=matrix(c(1:14,31:44,61:74),7)

Y=X[4:7,1:4]

solve(Y%*%t(Y))

#4

#a

dpois(2,4)

#b

ppois(2,4)

#c

1-ppois(4,4)

#d

ppois(6,4)-ppois(2,4)

#e

#This is a technique. there may be a better technique

x=0

d=ppois(x,4)

while(d<.5)

{

x=x+1

d=ppois(x,4)

}

x

#Yes! there is a better technique

qpois(0.5,4)

#5

#(i)

dt(3,5)

#(ii)

pt(3,5)

#(iii)

pt(4,5)

#(iv)

1-pt(6,5)

#v)

pt(1,5)-pt(-2,5)

#(vi)

pt(1,50-pt(-1,5)

#(vii)

qt(.7,5)

#6

#new function to find kurtosis

kurt=function(x)

{

mean(x-mean(x))^4/var(x)^2

}

Answers:

Note: the lines starting with hash symbol represent comments. They are not part of the actual codes.

#1

(log(919,2)-3)/log(919,10)-1

#2

#a

y=rchisq(10000,5)

#b

p=y[which(y>2&y<3)]

length(p)

#or in one line

length(y[which(y>2&y<3)])

#c

x=ifelse(y<1,0,ifelse(y>=3,2,1))

#d

mean(y)

median(y)

#e

#we know median of chi-squared dist = k(1-

5*(1-2/(9*5))^2

#3

X=matrix(c(1:14,31:44,61:74),7)

Y=X[4:7,1:4]

solve(Y%*%t(Y))

#4

#a

dpois(2,4)

#b

ppois(2,4)

#c

1-ppois(4,4)

#d

ppois(6,4)-ppois(2,4)

#e

#This is a technique. there may be a better technique

x=0

d=ppois(x,4)

while(d<.5)

{

x=x+1

d=ppois(x,4)

}

x

#Yes! there is a better technique

qpois(0.5,4)

#5

#(i)

dt(3,5)

#(ii)

pt(3,5)

#(iii)

pt(4,5)

#(iv)

1-pt(6,5)

#v)

pt(1,5)-pt(-2,5)

#(vi)

pt(1,50-pt(-1,5)

#(vii)

qt(.7,5)

#6

#new function to find kurtosis

kurt=function(x)

{

mean(x-mean(x))^4/var(x)^2

}

## No comments:

Write comments