Publications by karmaGyatso
Discussion_9
pg. 338 2. Let S200 be the number of heads that turn up in 200 tosses of a fair coin. Estimate (a) P(S200 =100). (b) P(S200 =90). (c) P(S200 =80). # Number of tosses n <- 200 # Probability of getting a head p <- 0.5 # Calculate the mean and standard deviation of the binomial distribution mu <- n * p sigma <- sqrt(n * p * (1 - p)) exp_P <...
18 sym
assignment8
11. A company buys 100 lightbulbs, each of which has an exponential lifetime of 1000 hours. What is the expected time for the first of these bulbs to burn out? (See Exercise 10.) mu <- 1000 n <- 100 (expected_value <- mu/n) ## [1] 10 14. Assume that X1 and X2 are independent random variables, each having an exponential density with parameter λ. S...
659 sym 1 img
Data605_Discussion_wk8
11. Assume that you are playing craps with dice that are loaded in the following way: faces two, three, four, and five all come up with the same probability (1/6) + r. Faces one and six come up with probability (1/6) − 2r, with 0 < r < .02. Write a computer program to find the probability of winning at craps with these dice, and using your progra...
872 sym Python (3356 sym/5 pcs)
assignment7
1. Let X1, X2, . . . , Xn be n mutually independent random variables, each of which is uniformly distributed on the integers from 1 to k. Let Y denote the minimum of the Xi’s. Find the distribution of Y. Solution: Given Y denote the minimum of the \(X_i\)’s. P(Y) = min(\(X_1, X_2, X_3, ….. X_n\)) Assuming each Xi has k possibilities: 1,2,3,�...
915 sym Python (2079 sym/30 pcs)
KGyatso_assignment6
1. A bag contains 5 green and 7 red jellybeans. How many ways can 5 jellybeans be withdrawn from the bag so that the number of green ones withdrawn will be less than 2? Solution: First, lets see in how many ways we can get green jelly beans that is < 2 out of 5. \[\binom{5}{1} = \frac{5!}{(5-1)! \cdot 1!} = \frac{120}{24} = 5\] (Q_1_first <- choos...
1932 sym Python (5256 sym/41 pcs)
discussion_wk6
3.1 page 89 A more refined inequality for approximating n! is given by \[\begin{equation} \sqrt{2πn} (\frac {n}{e})^ne^{1/(12n+1)}<n!<\sqrt{2πn} (\frac {n}{e})^ne^{1/(12n)} \end{equation}\] Write a computer program to illustrate this inequality for n = 1 to 9. fact <- function(n) { if (n == 0) { return(1) } else { return(n * fact(n-...
611 sym
data605_assignment5
(Bayesian). A new test for multinucleoside-resistant (MNR) human immunodeficiency virus type 1 (HIV-1) variants was recently developed. The test maintains 96% sensitivity, meaning that, for those with the disease, it will correctly report “positive” for 96% of them. The test is also 98% specific, meaning that, for those without the disease, 98%...
12964 sym
EigenShoes
## ## Attaching package: 'EBImage' ## The following objects are masked from 'package:OpenImageR': ## ## readImage, writeImage Preparing the dataset We are given data containing of 17 images of shoes of 1200X2500 dimension each. We will first load the data in a variables. num <- length(list.files("/Users/karmagyatso/Documents/cunySps/data605/...
2010 sym Python (2551 sym/21 pcs) 4 img
data605_assignment3
library("pracma") Problem Set 1 1 What is the rank of the matrix A? problem set 1.1 a <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3), nrow= 4) a ## [,1] [,2] [,3] [,4] ## [1,] 1 2 3 4 ## [2,] -1 0 1 3 ## [3,] 0 1 -2 1 ## [4,] 5 4 -2 -3 Rank(a) ## [1] 4 (2) Given an mxn matrix where m > n, wha...
416 sym R (653 sym/15 pcs) 6 img
discussion_wk1
excercise C20 page 190 A <- matrix(c(2,-1,2,5,3,-2), nrow=3, ncol=2) A ## [,1] [,2] ## [1,] 2 5 ## [2,] -1 3 ## [3,] 2 -2 B <- matrix(c(-1,2,5,0,-3,2,4,-3), nrow=2, ncol=4) B ## [,1] [,2] [,3] [,4] ## [1,] -1 5 -3 4 ## [2,] 2 0 2 -3 A %*% B ## [,1] [,2] [,3] [,4] ## [1,] 8 10 4 -7 #...
35 sym 1 img