diff options
author | Prashant S | 2019-10-04 12:27:32 +0530 |
---|---|---|
committer | GitHub | 2019-10-04 12:27:32 +0530 |
commit | ac2986488a9731cff5cbb517d8f0ef98e2561d64 (patch) | |
tree | 7bb3f64824627ef179d5f341266a664fd0b69011 /R_Book_by_R_Author | |
parent | cbb2770fb2f88246175add29623103a56ba338b8 (diff) | |
parent | b3f3a8ecd454359a2e992161844f2fb599f8238a (diff) | |
download | R_TBC_Uploads-ac2986488a9731cff5cbb517d8f0ef98e2561d64.tar.gz R_TBC_Uploads-ac2986488a9731cff5cbb517d8f0ef98e2561d64.tar.bz2 R_TBC_Uploads-ac2986488a9731cff5cbb517d8f0ef98e2561d64.zip |
Added R TBC
Diffstat (limited to 'R_Book_by_R_Author')
-rw-r--r-- | R_Book_by_R_Author/CH4/EX4.1.a/Ex4_1a.R | 30 | ||||
-rw-r--r-- | R_Book_by_R_Author/CH4/EX4.1.c/Ex4_1c.R | 10 | ||||
-rw-r--r-- | R_Book_by_R_Author/README.txt | 18 |
3 files changed, 58 insertions, 0 deletions
diff --git a/R_Book_by_R_Author/CH4/EX4.1.a/Ex4_1a.R b/R_Book_by_R_Author/CH4/EX4.1.a/Ex4_1a.R new file mode 100644 index 00000000..9f5c2c22 --- /dev/null +++ b/R_Book_by_R_Author/CH4/EX4.1.a/Ex4_1a.R @@ -0,0 +1,30 @@ +#install.packages("IPSUR")
+#install.packages("prob")
+library(IPSUR)
+read(IPSUR)
+library(prob)
+read(prob)
+
+#First we set up the sample space with the rolldie function
+S <- rolldie(2, makespace = TRUE)
+#Next, we add random variables U and V with the addrv function.
+S <- addrv(S, FUN = max, invars = c("X1", "X2"), name = "U")
+S <- addrv(S, FUN = sum, invars = c("X1", "X2"), name = "V")
+head(S)
+UV <- marginal(S, vars = c("U", "V"))
+xtabs(round(probs, 3) ~ U + V, data = UV)
+marginal(UV, vars = "U")
+marginal(UV, vars = "V")
+
+temp <- xtabs(probs ~ U + V, data = UV)
+rowSums(temp)
+colSums(temp)
+colSums(temp)
+
+'
+data = sample(1:6,10000000,replace=TRUE)+sample(1:6,10000000,replace=TRUE)
+table(data)/length(data)
+sum(table(data)/length(data))
+
+table(sample(1:6,10000000,replace=TRUE))/length(sample(1:6,10000000,replace=TRUE))
+'
\ No newline at end of file diff --git a/R_Book_by_R_Author/CH4/EX4.1.c/Ex4_1c.R b/R_Book_by_R_Author/CH4/EX4.1.c/Ex4_1c.R new file mode 100644 index 00000000..2977158e --- /dev/null +++ b/R_Book_by_R_Author/CH4/EX4.1.c/Ex4_1c.R @@ -0,0 +1,10 @@ +"
+the random variable X has distribution funtion F
+
+F(x) = 0 -- { x <= 0}
+F(x) = 1 - exp(-x^2) -- {x >0}
+
+P{X>1} = ?
+"
+P = 1 - (1 - exp(-(1^2)))
+P
\ No newline at end of file diff --git a/R_Book_by_R_Author/README.txt b/R_Book_by_R_Author/README.txt new file mode 100644 index 00000000..3783a1bf --- /dev/null +++ b/R_Book_by_R_Author/README.txt @@ -0,0 +1,18 @@ +About The Contributor + +Contributed By: Xyz +Course: B Tech +Branch: Physics +College/Institute/Organization: India + +About The Book + +Book: R Book +Author: R Author +Publisher: R Publisher +Year Of Publication: 2016 +ISBN: R-124-789-256 +Edition: 5 + + +Textbook Companion Project By FOSSEE, IIT Bombay |