Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Rui Barradas
Hello, Yes, sorry for my previous post, I had forgotten about boot.array. That's a much better solution for your problem. Rui Barradas Às 20:29 de 28/01/21, Marna Wagley escreveu: Thank you Rui, This is great. How about the following? SimilatedData<-boot.array(b, indices=T) seems it is

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Marna Wagley
Thank you Rui, This is great. How about the following? SimilatedData<-boot.array(b, indices=T) seems it is giving the rows ID which are used in the calculation, isn't it? On Thu, Jan 28, 2021 at 12:21 PM Rui Barradas wrote: > Hello, > > I don't know why you would need to see the indices

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Rui Barradas
Hello, I don't know why you would need to see the indices but rewrite the function bootprop as bootprop_ind <- function(data, index){ d <- data[index, ] #sum(d[["BothTimes"]], na.rm = TRUE)/sum(d[["Time1"]], na.rm = TRUE) index } and call in the same way. It will now return a matrix

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Marna Wagley
Hi Rui, I am sorry for asking you several questions. In the given example, randomizations (reshuffle) were done 1000 times, and its 1000 proportion values (results) are stored and it can be seen using b$t; but I was wondering how the table was randomized (which rows have been missed/or repeated

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-23 Thread Marna Wagley
Yes Rui, I can see we don't need to divide by square root of sample size. The example is great to understand it. Thank you. Marna On Sat, Jan 23, 2021 at 12:28 AM Rui Barradas wrote: > Hello, > > Inline. > > Às 07:47 de 23/01/21, Marna Wagley escreveu: > > Dear Rui, > > I was wondering whether

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-23 Thread Rui Barradas
Hello, Inline. Às 07:47 de 23/01/21, Marna Wagley escreveu: Dear Rui, I was wondering whether we have to square root of SD to find SE, right? No, we don't. var already divides by n, don't divide again. This is the code, that can be seen by running the function name at a command line. sd

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-22 Thread Marna Wagley
Dear Rui, I was wondering whether we have to square root of SD to find SE, right? bootprop <- function(data, index){ d <- data[index, ] sum(d[["BothTimes"]], na.rm = TRUE)/sum(d[["Time1"]], na.rm = TRUE) } R <- 1e3 set.seed(2020) b <- boot(daT, bootprop, R) b b$t0 # original sd(b$t) #

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-22 Thread Rui Barradas
Hello, Something like this, using base package boot? library(boot) bootprop <- function(data, index){ d <- data[index, ] sum(d[["BothTimes"]], na.rm = TRUE)/sum(d[["Time1"]], na.rm = TRUE) } R <- 1e3 set.seed(2020) b <- boot(daT, bootprop, R) b b$t0 # original sd(b$t) # bootstrapped