Generate a vector of 1000 Poisson random numbers with λ = 3. Make a histogram and a boxplot of the 1000 numbers. Find the expected value of the vector in Rstudio
Asked
Active
Viewed 125 times
-1
-
1Welcome to SO! Just for information, SO is not meant to make your homework for you. Instead, we can answer specific programming-related questions. – nicola Jan 20 '21 at 13:15
-
thank you sir for your comment. but first of all, this is not my homework. Randomly I am working on R programming and I have a problem finding expected value. Now I know that why we use set.seed() because I am new in R programming. So I was just getting help from others. that's it. Again this is not my homework. – Shehryar Khan Jan 21 '21 at 01:09
1 Answers
0
Try with this:
set.seed(123)
#Code
v <- rpois(1000,lambda = 3)
#Hist
hist(v)
#Boxplot
boxplot(v)
#Mean
mean(v)

Duck
- 39,058
- 13
- 42
- 84
-
Sir why we use [set.seed(123)] and how to find the expected value. Kindly can you guide me further – Shehryar Khan Jan 20 '21 at 17:59
-
Setting a seed is done in order to reproduce the same results. https://stackoverflow.com/questions/13605271/reasons-for-using-the-set-seed-function – Phil Jan 20 '21 at 18:17
-