mirror of
https://github.com/Andreaierardi/Master-DataScience-Notes.git
synced 2024-11-30 07:32:56 +01:00
up
This commit is contained in:
parent
a4dbc24681
commit
dd2ac86597
Binary file not shown.
@ -0,0 +1,60 @@
|
||||
f = function(x)
|
||||
{
|
||||
if(x>=0 & x <= 7)
|
||||
{
|
||||
1/7
|
||||
}
|
||||
else
|
||||
{0}
|
||||
}
|
||||
f(0)
|
||||
f(-1)
|
||||
f(7)
|
||||
f(8)
|
||||
ibrary(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
#(i)
|
||||
integrate(d$pdf, lower = -Inf , upper = Inf)
|
||||
ibrary(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
#(i)
|
||||
integrate(f, lower = -Inf , upper = Inf)
|
||||
f = function(x)
|
||||
{
|
||||
(x>=0 & x <= 7) * 1/7
|
||||
}
|
||||
f(2)
|
||||
f(8)
|
||||
integrate(f, lower = -Inf , upper = Inf)
|
||||
ibrary(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
#(i)
|
||||
integrate(d$pdf, lower = -Inf , upper = Inf)
|
||||
#(ii)
|
||||
curve(f)
|
||||
plot(f)
|
||||
plot(d)
|
||||
plot(f)
|
||||
curve(f)
|
||||
curve(f, from= 0, to= 7)
|
||||
curve(f, from= -5, to= 10)
|
||||
curve(f, from= -5, to= 12)
|
||||
f = function(x)
|
||||
{
|
||||
(x>=0 & x <= 7) * 1/7
|
||||
}
|
||||
#(i)
|
||||
integrate(f, lower = -Inf , upper = Inf)
|
||||
#(ii)
|
||||
curve(f, from= -5, to= 12)
|
||||
#(iv)
|
||||
library(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
d$mgf(t = 1)
|
||||
x1 = c(12,11,8,14,10)
|
||||
x2 = c(10,8,5,11,7)
|
||||
x3= c(8,11,11,13,6)
|
||||
m = matrix(c(x1,x2,x3), ncol = 3)
|
||||
vector_means = c(mean(x1), mean(x2), mean(x3))
|
||||
vector_means
|
||||
cov(m)
|
Binary file not shown.
@ -4,19 +4,25 @@
|
||||
#=============
|
||||
#Part.a)
|
||||
|
||||
library(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
f = function(x)
|
||||
{
|
||||
(x>=0 & x <= 7) * 1/7
|
||||
|
||||
}
|
||||
|
||||
|
||||
#(i)
|
||||
integrate(d$pdf, lower = -Inf , upper = Inf)
|
||||
integrate(f, lower = -Inf , upper = Inf)
|
||||
|
||||
#(ii)
|
||||
curve(d)
|
||||
plot(d)
|
||||
curve(f, from= -5, to= 12)
|
||||
|
||||
#(iii)
|
||||
#The random variable is X
|
||||
|
||||
#(iv)
|
||||
library(distr6)
|
||||
d = distr6::Uniform$new(lower = 0 , upper = 7)
|
||||
d$mgf(t = 1)
|
||||
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user