Re: [R] Sample size Determination to Compare Three Independent Proportions

2021-08-11 Thread AbouEl-Makarim Aboueissa
Hi Marc: Thank you for your help in this matter. With thanks Abou On Tue, Aug 10, 2021, 9:28 AM Marc Schwartz wrote: > Hi, > > A search would suggest that there may not be an R function/package that > provides power/sample size calculations for the specific scenarios that > you are describi

Re: [R] Sample size Determination to Compare Three Independent Proportions

2021-08-10 Thread Marc Schwartz via R-help
Hi, A search would suggest that there may not be an R function/package that provides power/sample size calculations for the specific scenarios that you are describing. There may be something that I am missing, and there is also other dedicated software such as PASS (https://www.ncss.com/softw

Re: [R] Sample size Determination to Compare Three Independent Proportions

2021-08-10 Thread AbouEl-Makarim Aboueissa
Hi Marc: First, thank you very much for your help in this matter. Will perform an initial omnibus test of all three groups (e.g. 3 x 2 chi-square), possibly followed by all possible 2 x 2 pairwise comparisons (e.g. 1 versus 2, 1 versus 3, 2 versus 3), We can assume *either* the desired sample s

Re: [R] Sample size Determination to Compare Three Independent Proportions

2021-08-09 Thread Marc Schwartz via R-help
Hi, You are going to need to provide more information than what you have below and I may be mis-interpreting what you have provided. Presuming you are designing a prospective, three-group, randomized allocation study, there is typically an a priori specification of the ratios of the sample s

Re: [R] Sample size required to estimate population variance

2019-07-05 Thread Stephen Ellison
> Thanks for the suggestion but I'm not sure that it answers my original > question.I need to know how many samples I need to collect to collect in > order to estimate the sample size needed to achieve a specific margin of > error for confidence intervals for the population variance. I'm not sure

Re: [R] Sample size required to estimate population variance

2019-07-04 Thread Thomas Subia via R-help
Thanks for the suggestion but I'm not sure that it answers my original question.I need to know how many samples I need to collect to collect in order to estimate the sample size needed to achieve a specific margin of error for confidence intervals for the population variance. I'm not sure wheth

Re: [R] Sample size required to estimate population variance

2019-07-04 Thread John via R-help
On Tue, 2 Jul 2019 22:23:18 + (UTC) Thomas Subia via R-help wrote: > Colleagues, > Can anyone suggest a package or code which might help me calculate > the minimum sample size required to estimate the population variance? > I can do this in Minitab but I'd rather do this in R. Thomas Subia Y

Re: [R] Sample size required to estimate population variance

2019-07-03 Thread ruipbarradas
Hello, Sorry for the HTML, I hadn't realised that my cellphone was not sending in plain text. Rui Barradas Citando ruipbarradas : Hello,Maybe I'm not understanding but to compute the sample variance you need at least 2 data points? The ML estimator can be computed with just 1 but

Re: [R] Sample size required to estimate population variance

2019-07-03 Thread ruipbarradas
Hello,Maybe I'm not understanding but to compute the sample variance you need at least 2 data points? The ML estimator can be computed with just 1 but it will be zero.Hope this helps,Rui Barradas Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original De: Thomas Subi

Re: [R] Sample size required to estimate population variance

2019-07-02 Thread Richard O'Keefe
Does this help? https://www.r-bloggers.com/computing-sample-size-for-variance-estimation/ On Wed, 3 Jul 2019 at 10:23, Thomas Subia via R-help wrote: > Colleagues, > Can anyone suggest a package or code which might help me calculate the > minimum sample size required to estimate the population v

Re: [R] Sample function and prob argument

2019-06-05 Thread Duncan Murdoch
On 05/06/2019 4:34 a.m., le Gleut, Ronan wrote: Dear R-help mailing list, First of all, many many thanks for your great work on the R project! I have a very small issue regarding the sample function. Depending if we specify values for the prob argument, we don't get the same result fo

Re: [R] sample (randomly select) to get a number of successive days

2018-12-10 Thread Dagmar Cimiotti
Thank you so much Marc, that is exactly what I need. That will save me weeks of work and additionally I learned a lot. :-) Have a great day! Dagmar Hi, Given that your original data frame example is: myframe <- data.frame (Timestamp=c("24.09.2012 09:00:00", "24.09.2012 10:00:00","25.09.2012

Re: [R] sample (randomly select) to get a number of successive days

2018-12-10 Thread Marc Schwartz via R-help
Hi, Given that your original data frame example is: myframe <- data.frame (Timestamp=c("24.09.2012 09:00:00", "24.09.2012 10:00:00","25.09.2012 09:00:00", "25.09.2012 09:00:00","24.09.2012 09:00:00", "24.09.2012 10:00:00"), Event=c(50,60

Re: [R] sample (randomly select) to get a number of successive days

2018-12-09 Thread Dagmar Cimiotti
Hi Marc, Yes, you got it to the point! That is exactly what I want. But I do not know how to do that. I know how to randomly pick the first day but I do not know how to set a range of values which cover the 25 days starting from that random value. Best, Dagmar Hi, I am confused. As far as

Re: [R] sample (randomly select) to get a number of successive days

2018-12-07 Thread Marc Schwartz via R-help
Hi, I am confused. As far as I can tell, only the first day is selected randomly from your dataset. The subsequent 24 days are deterministic, since they need to be consecutive days from the first day, for a total of 25 consecutive days. Thus, all you need to do is to randomly select 1 day fro

Re: [R] sample (randomly select) from successive days

2018-12-07 Thread Jeff Newmiller
myfirst <- sample( seq.int( nrow(myframe)-1 ), 1 ) mysample <- myframe[seq( myfirst, myfirst+1),] mysample On December 7, 2018 2:24:11 AM PST, Dagmar Cimiotti wrote: >Hi Jim and everyone else, > >Mhm, no this is not what I am looking for. I think in your way I would >randomly sample two values

Re: [R] sample (randomly select) from successive days

2018-12-07 Thread Dagmar Cimiotti
Hi Jim and everyone else, Mhm, no this is not what I am looking for. I think in your way I would randomly sample two values of day 1 and of day 2. But I want the opposite: I want to randomly draw two successive (!) days and put those values in a new dataframe to continue working with them. I

Re: [R] sample (randomly select) from successive days

2018-12-07 Thread Jim Lemon
Hi Dagmar, This will probably involve creating a variable to differentiate the two days in each data.frame: myframe$day<-as.Date(as.character(myframe$Timestamp),"%d.%m.%Y %H:%M:%S") days<-unique(myframe$day) Then just sample the two subsets and concatenate them: myframe[c(sample(which(myframe$da

Re: [R] Sample of a subsample

2017-09-25 Thread Bert Gunter
Yes. Beating a pretty weary horse, a slightly cleaner version of my prior offering using with(), instead of within() is: with(dat, dat[sampleNo[sample(var1[!var1%%2 & !sampleNo], 10, rep=FALSE)], "sampleNo"] <- 2) with() and within() are convenient ways to avoid having to repeatedly name the col

Re: [R] Sample of a subsample

2017-09-25 Thread Eric Berger
Hi David, I was about to post a reply when Bert responded. His answer is good and his comment to use the name 'dat' rather than 'data' is instructive. I am providing my suggestion as well because I think it may address what was causing you some confusion (mainly to use "which", but also the missing

Re: [R] Sample of a subsample

2017-09-25 Thread Bert Gunter
For personal aesthetic reasons, I changed the name "data" to "dat". Your code, with a slight modification: set.seed (1357) ## for reproducibility dat <- data.frame(var1=seq(1:40), var2=seq(40,1)) dat$sampleNo <- 0 idx <- sample(seq(1,nrow(dat)), size=10, replace=F) dat[idx,"sampleNo"] <-1 ## yi

Re: [R] Sample size calculation for three-way incomplete block crossover study.

2017-09-05 Thread Bert Gunter
Sounds like a homework problem. This list has a no homework policy if it is. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Sep 4, 2017 at 10:31

Re: [R] Sample size using residual standard deviation

2017-04-12 Thread peter dalgaard
Or power.t.test() -pd > On 12 Apr 2017, at 18:44 , Bert Gunter wrote: > > Search "sample size power" on rseek.org. Many useful hits, including > "samplesize" package. > > -- Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking thin

Re: [R] Sample size using residual standard deviation

2017-04-12 Thread Bert Gunter
Search "sample size power" on rseek.org. Many useful hits, including "samplesize" package. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Apr 12

Re: [R] Sample size using residual standard deviation

2017-04-12 Thread David Winsemius
> On Apr 12, 2017, at 3:20 AM, Jomy Jose wrote: > > In R how to calculate sample size,where power,residual standard deviation > and treatment difference is given.? Use the non-central t-distribution. The help page has further advice: ?pt > > [[alternative HTML version deleted]] Pleas

Re: [R] sample train and test data using dplyr

2016-12-09 Thread Jim Lemon
Sample without replacement and then split that sample into train and test components. Jim On Fri, Dec 9, 2016 at 4:55 PM, Partha Sinha wrote: > How to get two sets of non overlapping data? > Regards > Parth __ R-help@r-project.org mailing list -- To U

Re: [R] sample train and test data using dplyr

2016-12-08 Thread Ulrik Stervbo
df <- data.frame(x = 1:12, y = rnorm(12)) If you use sample: RowIndex <- sample(1:nrow(df), 5) TrainSet <- df[RowIndex, ] TestSet <- df[-RowIndex, ] Or with dplyr: TrainSet <- sample_n(df, 5) TestSet <- anti_join(TestSet, df) HTH Ulrik On Fri, 9 Dec 2016, 06:56 Partha Sinha, wrote: > How to

Re: [R] sample train and test data using dplyr

2016-12-08 Thread Partha Sinha
How to get two sets of non overlapping data? Regards Parth On 8 December 2016 at 23:23, Ulrik Stervbo wrote: > In addition to 'sample', and if you insist on dplyr, you can use > 'sample_n'. > > Best, > Ulrik > > On Thu, 8 Dec 2016 at 18:47 Bert Gunter wrote: > >> Usually we expect posters to do

Re: [R] sample train and test data using dplyr

2016-12-08 Thread Ulrik Stervbo
In addition to 'sample', and if you insist on dplyr, you can use 'sample_n'. Best, Ulrik On Thu, 8 Dec 2016 at 18:47 Bert Gunter wrote: > Usually we expect posters to do their homework by reading necessary R > documentation and relevant subject matter resources (e.g. on > clustering) and making

Re: [R] sample train and test data using dplyr

2016-12-08 Thread Bert Gunter
Usually we expect posters to do their homework by reading necessary R documentation and relevant subject matter resources (e.g. on clustering) and making a serious attempt to solve the problem by offering their code to us along as part of a reproducible example of how it failed. You have done none

Re: [R] sample within a loop

2016-03-20 Thread DIGHE, NILESH [AG/2362]
lp@r-project.org Subject: Re: [R] sample within a loop Hi, you can try df1<-split(df,df$groups) lapply(df1, function(x) { x<-cbind(x,entry=0) sam <- sample(x$plotno,1) x$entry[which(x$plotno==sam)]<-"CONTROL" x$entry[which(!x$plotno==sam)]<-"TEST" x

Re: [R] sample within a loop

2016-03-19 Thread Mohammad Tanvir Ahamed via R-help
Hi, you can try df1<-split(df,df$groups) lapply(df1, function(x) { x<-cbind(x,entry=0) sam <- sample(x$plotno,1) x$entry[which(x$plotno==sam)]<-"CONTROL" x$entry[which(!x$plotno==sam)]<-"TEST" x } ) Tanvir Ahamed Göteborg, Sweden | mashra...@yahoo.com ___

Re: [R] sample within a loop

2016-03-19 Thread MacQueen, Don
I would change strategies. Create a new variable, say, num.in.grp <- rep(1:12, 4) Then sample from 1:12, and add appropriate amounts so that they become row numbers within the four sets of 12 rows ctrls <- ssample(1:12, 4, replace=TRUE) + c(0,12,24,36) Now that we have four random row number

Re: [R] Sample Weights

2015-07-27 Thread PIKAL Petr
Hi > wrote: > >Dear Sir, > > > >I do appreciate your views. Yes even I was also aware about the non > >clarity in the question. Actaully, I have a large data having lots of > >data of low magnitude and few of very high magnitude. In order to can you explain what is low or high magnitude? Or be

Re: [R] Sample Weights

2015-07-27 Thread Jeff Newmiller
R is a computing tool, and each package has implemented algorithms that have history and books and papers that allow those algorithms to be used in a variety if computing environments... from Fortran to Excel to Java to ... R, and probably beyond. >From your description I am going to hazard a g

Re: [R] Sample Weights

2015-07-26 Thread Jeff Newmiller
If you have a clear idea what meaning those weights have (?) in the context of a specific calculation (?), and you know what the weights are (?), then it is usually trivially easy to do in R. However, your question is vague on all of those points, so offering you a solution seems like an invita

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread tahira jamil
gt; a b c d > [1,] 10 5 5 0 > [2,] 11 4 4 1 > [3,] 12 3 3 2 > [4,] 13 2 2 3 > [5,] 14 1 1 4 > [6,] 15 0 0 5 > > David C > > From: Michael Peng [mailto:michael.gang.p...@gmail.com] > Sent: Tuesday, June 24, 2014 1:32 PM > To: David L Carlson > Cc: Gabor Grot

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
Sent: Tuesday, June 24, 2014 1:32 PM To: David L Carlson Cc: Gabor Grothendieck; Tahira Jamil; r-help@r-project.org Subject: Re: [R] Sample all possible contingency tables both margin fixed David gave a great solution. I think it is better to start from 0 to min(M) instead of from min(M[c(1,3)]) to

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Michael Peng
-- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Gabor Grothendieck > Sent: Tuesday, June 24, 2014 12:07 PM > To: Tahira Jamil > Cc: r-help@r-project.org > Subject: Re: [R] Sample all possible contingency tables both margin fixed > &g

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
Cc: r-help@r-project.org Subject: Re: [R] Sample all possible contingency tables both margin fixed On Tue, Jun 24, 2014 at 10:41 AM, Tahira Jamil wrote: > Hi, > > I am interested in generating all possible contingency table (2 by 2) with > fixed row margins and column margins. Can anyone

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread peter dalgaard
On 24 Jun 2014, at 16:41 , Tahira Jamil wrote: > Hi, > > I am interested in generating all possible contingency table (2 by 2) with > fixed row margins and column margins. Can anyone help me. > It's pretty easy, just find one compatible solution and add or subtract 1 -1 -1 1 until one o

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Gabor Grothendieck
On Tue, Jun 24, 2014 at 10:41 AM, Tahira Jamil wrote: > Hi, > > I am interested in generating all possible contingency table (2 by 2) with > fixed row margins and column margins. Can anyone help me. > If the reason you want this is to sample them then r2dtable can do that directly.

Re: [R] sample size determination - comparing means for different size samples

2013-06-07 Thread Rui Barradas
Hello, At an R prompt, type ?power.t.test Hope this helps, Rui Barradas Em 06-06-2013 20:58, Rebecca Greenblatt escreveu: Looking to determine sample sizes for both my experimental and control groups (I want only a small portion of my participants in my experimental condition) in order to co

Re: [R] sample size determination - comparing means for different size samples

2013-06-06 Thread David Winsemius
This is a duplicate question, right? On Jun 6, 2013, at 12:58 PM, Rebecca Greenblatt wrote: > Looking to determine sample sizes for both my experimental and control > groups (I want only a small portion of my participants in my experimental > condition) in order to compare population means. I wou

Re: [R] sample {base}

2013-06-05 Thread arun
Hi, Try:  fun1<- function(dat,Col1,Col2,number){  lst1<- split(dat,list(dat[,Col1],dat[,Col2]))  lst2<- lst1[lapply(lst1,nrow)>0]  res<- lapply(lst2,function(x) sample(x[,1],if(nrow(x)< number) nrow(x) else number,replace=FALSE))  res} head(fun1(Gpool,"LngtClas","SpCode",5),4) #$`40_49.MERLMER` #[

Re: [R] sample {base}

2013-06-05 Thread Xochitl CORMON
Thank you Sarah for this code, it's exactly what I wanted to reach. Le 05/06/2013 16:49, Sarah Goslee a écrit : What about using instead size = min(5, length(Gpool$SampleNb[Gpool$LngtClas == LngtClas[[4]]& Gpool$SpCode == SpCode[[2]]]) that would make sure your sample is either the size of t

Re: [R] sample {base}

2013-06-05 Thread David Carlson
Something like this? > set.seed(42) > a <- sample.int(10) > b <- sample.int(5) > c <- sample.int(3) > smpl <- function(x) sample(x, ifelse(length(x)<5, length(x), 5)) > smpl(a) [1] 4 8 1 10 2 > smpl(b) [1] 2 3 5 1 4 > smpl(c) [1] 2 1 3 - David L Carlson Ass

Re: [R] sample {base}

2013-06-05 Thread Sarah Goslee
What about using instead size = min(5, length(Gpool$SampleNb[Gpool$LngtClas == LngtClas[[4]] & Gpool$SpCode == SpCode[[2]]]) that would make sure your sample is either the size of the data or 5. Sarah On Wed, Jun 5, 2013 at 10:27 AM, Xochitl CORMON wrote: > Hi all, > > I'm trying to randomly se

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
n Jones > > Sent: Thursday, May 23, 2013 8:30 AM > > To: r-help@r-project.org > > Subject: Re: [R] sample(c(0, 1)...) vs. rbinom > > > > After a bit of playing around, I discovered that > > sample() does something similar in other situations: > > &g

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Albyn Jones > Sent: Thursday, May 23, 2013 8:30 AM > To: r-help@r-project.org > Subject: Re: [R] sample(c(0, 1)...) vs. rbinom > > After a bit of play

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
After a bit of playing around, I discovered that sample() does something similar in other situations: set.seed(105021) sample(1:5,1,prob=c(1,1,1,1,1)) [1] 3 set.seed(105021) sample(1:5,1) [1] 2 set.seed(105021) sample(1:5,5,prob=c(1,1,1,1,1)) [1] 3 4 2 1 5 set.seed(105021) sample(1:5,5)

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-22 Thread peter dalgaard
On May 23, 2013, at 07:01 , Jeff Newmiller wrote: > You seem to be building an elaborate structure for testing the > reproducibility of the random number generator. I suspect that rbinom is > calling the random number generator a different number of times when you pass > prob=0.5 than otherwis

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-22 Thread Jeff Newmiller
You seem to be building an elaborate structure for testing the reproducibility of the random number generator. I suspect that rbinom is calling the random number generator a different number of times when you pass prob=0.5 than otherwise. -

Re: [R] sample size in box plot labels

2013-04-26 Thread PIKAL Petr
.@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Shane Carey > Sent: Friday, April 26, 2013 1:09 PM > To: Rui Barradas > Cc: r-help@r-project.org > Subject: Re: [R] sample size in box plot labels > > This works, great. Cheers > > > On Fri, Apr 2

Re: [R] sample size in box plot labels

2013-04-26 Thread Shane Carey
This works, great. Cheers On Fri, Apr 26, 2013 at 12:02 PM, Rui Barradas wrote: > Hello, > > To count the sample sizes for each factor try > > tapply(DATA$K_Merge, DATA$UnitName_1, FUN = length) > > > Hope this helps, > > Rui Barradas > > Em 26-04-2013 10:48, Shane Carey escreveu: > > Hi, >> >

Re: [R] sample size in box plot labels

2013-04-26 Thread Rui Barradas
Hello, To count the sample sizes for each factor try tapply(DATA$K_Merge, DATA$UnitName_1, FUN = length) Hope this helps, Rui Barradas Em 26-04-2013 10:48, Shane Carey escreveu: Hi, I would like to put the sample number beside each lable in a boxplot. How do I do this? Essentially, I need

Re: [R] sample size in box plot labels

2013-04-26 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Shane Carey > Sent: Friday, April 26, 2013 11:49 AM > To: r-help@r-project.org > Subject: [R] sample size in box plot labels > > Hi, > > I would like to put the sample numbe

Re: [R] sample mean, variance and SD

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 6:58 PM, Jim Lemon wrote: > On 11/11/2012 07:09 AM, Greg Snow wrote: >> This is to all R-helpers (Sarah is just the one that I am replying to), >> >> Have we become a little too draconian on the "not a homework help list" >> issue? >> ... > > As usual, a thoughtful comment o

Re: [R] sample mean, variance and SD

2012-11-10 Thread Jim Lemon
On 11/11/2012 07:09 AM, Greg Snow wrote: This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the "not a homework help list" issue? ... As usual, a thoughtful comment on a problem that does not have a straightforward solution. The ac

Re: [R] sample mean, variance and SD

2012-11-10 Thread Jeff Newmiller
It is not always easy to discern what the instructor wants a student to get out of an assignment. Therefore, I can't see changing the policy as it stands. That said, it is not always easy to discern homework from self-study, and sometimes when the question is well-constructed I don't go out of

Re: [R] sample mean, variance and SD

2012-11-10 Thread Sarah Goslee
I agree with much of what you said. If there is a reasonable effort to have read the documention or otherwise to have solved the problem on their own, and a clear question, I will frequently at least give a hint or a pointer toward a relevant function or two. Also, I wouldn't consider that the firs

Re: [R] sample mean, variance and SD

2012-11-10 Thread Berend Hasselman
On 10-11-2012, at 19:23, parvez_200207 wrote: > hi > could you help me to solve this issue > > Question: > Using command rweibull(100,8,15), simulate n = 100 realizations from > Weibull(8; 15) distribution. Using the simulated sample, compute the sample > mean, variance and standard deviation of

Re: [R] sample mean, variance and SD

2012-11-10 Thread Berend Hasselman
On 10-11-2012, at 21:09, Greg Snow wrote: > This is to all R-helpers (Sarah is just the one that I am replying to), > > Have we become a little too draconian on the "not a homework help list" > issue? Probably. > > Now if someone just states the HW question, gives no indication that they > ha

Re: [R] sample mean, variance and SD

2012-11-10 Thread Greg Snow
This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the "not a homework help list" issue? Now if someone just states the HW question, gives no indication that they have done anything to try to solve it themselves, and expects us to give

Re: [R] sample mean, variance and SD

2012-11-10 Thread Greg Snow
Your code works for me, can you tell us what output you are getting, what output you expect to see, and how they differ? On Sat, Nov 10, 2012 at 11:23 AM, parvez_200207 wrote: > hi > could you help me to solve this issue > > Question: > Using command rweibull(100,8,15), simulate n = 100 realiza

Re: [R] sample mean, variance and SD

2012-11-10 Thread Sarah Goslee
This is not a homework help list. On Saturday, November 10, 2012, parvez_200207 wrote: > hi > could you help me to solve this issue > > Question: > Using command rweibull(100,8,15), simulate n = 100 realizations from > Weibull(8; 15) distribution. Using the simulated sample, compute the sample >

Re: [R] sample from list

2012-11-08 Thread Jean V Adams
an then simulate mutations by changing the > gene values, cause duplications by adding rows of duplicated genes, > or even cause deletions by removing rows. > Once I have this set up for the pathogen I may make a similar array > for the host plants, then perhaps with indexing or s

Re: [R] sample from list

2012-11-08 Thread Benjamin Ward (ENV)
indexing or some such thing I can write functions to do the interactions and immunology and such. Best, Ben W. UEA (ENV) & The Sainsbury Laboratory. ____________ From: Jean V Adams [jvad...@usgs.gov] Sent: 07 November 2012 21:12 To: Benjamin Ward (ENV) Cc: r-help@r-projec

Re: [R] sample from list

2012-11-07 Thread Jean V Adams
Ben, Can you provide a small example data set for inds so that we can run the code you have supplied? It's difficult for me to follow what you've got and where you're trying to go. Jean "Benjamin Ward (ENV)" wrote on 11/06/2012 03:29:52 PM: > > Hi all, > > I have a list of genes p

Re: [R] sample equal number of cases per class

2012-11-04 Thread Rui Barradas
Hello, Function caret::createDatapartition preserves the proportions of classes, like its documentation says, so you should expected the result to be balanced only if the original data.frame is also balanced. A solution is to write a small function that chooses a balanced set of indices. Note

Re: [R] sample with equal probabilities

2012-10-06 Thread R. Michael Weylandt
Please don't double post. And see my response to you here: https://stat.ethz.ch/pipermail/r-help/2012-October/325470.html Michael On Sat, Oct 6, 2012 at 6:51 PM, solafah bh wrote: > Hello > If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one > value from x , and each va

Re: [R] sample

2012-10-06 Thread arun
Hi, They get different results: with the same set.seed()  x=c(3,2,6,1)  n=length(x)  set.seed(1)  sample(x,1,replace=TRUE)  #[1] 2 set.seed(1)  sample(x,1,replace=TRUE,prob=rep(1/n , n) ) #[1] 6  identical(sample(x,1,replace=TRUE),sample(x,1,replace=TRUE,prob=rep(1/n , n) )) #[1] FALSE A.K.

Re: [R] sample

2012-10-06 Thread R. Michael Weylandt
Yes and no. Same effect, but you won't get the same random numbers because -- I believe -- a different algorithm is used. grep the source for sample and sample2 if you're interested. Cheers, Michael On Sat, Oct 6, 2012 at 5:02 PM, solafah bh wrote: > Hello > If I have x=c(3,2,6,1) and n=length(x

Re: [R] sample() from (un-)sorted vectors

2012-08-15 Thread Jeff Newmiller
This seems more theoretical than specific to R, so you should discuss this question in a more theoretical forum such as http://stats.stackexchange.com/. FWIW I believe the results will be equally random either way. That doesn't say either way will be "absolutely" random, since I don't think such

Re: [R] sample() from (un-)sorted vectors

2012-08-15 Thread Bert Gunter
Define: "Absolutely random"; "systematic differences" (All pseudorandom numbers are by definition generated by a deterministic algorithm from a possibly random starting seed set). On Wed, Aug 15, 2012 at 9:11 AM, wrote: > Hello, > > Vector y is an alphabetically sorted version of vector x. Wil

Re: [R] Sample function in R

2012-02-12 Thread Petr Savicky
On Sun, Feb 12, 2012 at 01:57:18PM -0500, SUPAKORN LAOHAPITAKVORN wrote: > This is what I got: > > > sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 > [2] LC_CTYPE=English_United States.1252 > [3] LC_

Re: [R] Sample function in R

2012-02-12 Thread Etienne B. Racine
Supakorn, Try: rm(sample) #then sample(x) Etienne 2012/2/12 SUPAKORN LAOHAPITAKVORN > This is what I got: > > > sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 > [2] LC_CTYPE=English_United States.

Re: [R] Sample function in R

2012-02-12 Thread SUPAKORN LAOHAPITAKVORN
This is what I got: > sessionInfo() R version 2.14.1 (2011-12-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252

Re: [R] Sample function in R

2012-02-12 Thread Jorge I Velez
Hi, The following is what I get: > x =1:12 > x [1] 1 2 3 4 5 6 7 8 9 10 11 12 > sample(x) [1] 9 6 12 5 3 4 1 11 8 7 10 2 > sample(x, size = 2) [1] 9 4 What's the output of sessionInfo() and ls() ? Perhaps you have a different "sample" function in your workspace? HTH, Jorge

Re: [R] Sample function in R

2012-02-12 Thread R. Michael Weylandt
sessionInfo()? Can you replicate this behavior in a R --vanilla session? This seems very odd and I presume you've overwritten sample() somewhere in your workspace. Michael On Sun, Feb 12, 2012 at 12:52 PM, SUPAKORN LAOHAPITAKVORN wrote: > Hi, > Can anyone help me with the sample () in R? > > If

Re: [R] sample points - sp package

2012-02-09 Thread MacQueen, Don
I suggest you ask this question on r-sig-geo. And it would be best if you could create a small self-contained example. For example, what class of object is dataset2? Is there any reason to expect that the coordinates of the sample will be exactly the same as any of the coordinates in dataset2? P

Re: [R] Sample size calculations for one sided binomial exact test

2011-11-03 Thread Marc Schwartz
From: https://stat.ethz.ch/pipermail/r-help/2011-November/294329.html > I'm trying to compute sample size requirements for a binomial exact test. > we want to show that the proportion is at least 90% assuming that it is > 95%, with 80% power so any asymptotic approximations are out of the > quest

Re: [R] sample within groups-slight problem

2011-09-06 Thread Jean-Christophe BOUËTTÉ
2011/9/6 Jean-Christophe BOUËTTÉ : you could tapply function(x) if(length(x)==1) x else sample(x) or something like this > > 2011/9/6 Jean-Christophe BOUËTTÉ : >> Hi there, >> in the third case you get sample(5) which is exactly what you asked for. >> >> from ?sample: >> "If x has length 1, is nu

Re: [R] sample within groups-slight problem

2011-09-06 Thread Jean-Christophe BOUËTTÉ
Hi there, in the third case you get sample(5) which is exactly what you asked for. from ?sample: "If x has length 1, is numeric (in the sense of is.numeric) and x >= 1, sampling via sample takes place from 1:x. Note that this convenience feature may lead to undesired behaviour when x is of varying

Re: [R] sample within groups-slight problem

2011-09-06 Thread Duncan Murdoch
On 11-09-06 8:13 PM, Jack Siegrist wrote: I want to sample within groups, and when a group has only one associated number to just return that number. If I use this code: groups<- c(1, 2, 2, 2, 3) numbers<- 1:5 tapply(numbers, groups, FUN = sample) I get the following output: groups<- c(1,

Re: [R] sample within groups-slight problem

2011-09-06 Thread David Winsemius
On Sep 6, 2011, at 8:13 PM, Jack Siegrist wrote: I want to sample within groups, and when a group has only one associated number to just return that number. And what we supposed to do when it has more than one value? If I use this code: groups <- c(1, 2, 2, 2, 3) numbers <- 1:5 tapp

Re: [R] Sample size AUC for ROC curves

2011-08-14 Thread Karl Knoblick
but I am confused a little Karl  - Ursprüngliche Mail Von: David Winsemius An: Karl Knoblick CC: Greg Snow ; "r-h...@stat.math.ethz.ch" Gesendet: Samstag, den 13. August 2011, 2:18:37 Uhr Betreff: Re: [R] Sample size AUC for ROC curves On Aug 11, 2011, at 5:50 AM, Kar

Re: [R] Sample size AUC for ROC curves

2011-08-12 Thread David Winsemius
- Ursprüngliche Mail Von: Greg Snow An: Karl Knoblick ; "r-h...@stat.math.ethz.ch" Gesendet: Dienstag, den 9. August 2011, 19:45:12 Uhr Betreff: RE: [R] Sample size AUC for ROC curves If you know how to generate random data that represents your null hypothesis (chance, auc=0.5) and

Re: [R] Sample size AUC for ROC curves

2011-08-11 Thread Karl Knoblick
Von: Greg Snow An: Karl Knoblick ; "r-h...@stat.math.ethz.ch" Gesendet: Dienstag, den 9. August 2011, 19:45:12 Uhr Betreff: RE: [R] Sample size AUC for ROC curves If you know how to generate random data that represents your null hypothesis (chance, auc=0.5) and how to do your anal

Re: [R] Sample size AUC for ROC curves

2011-08-09 Thread Greg Snow
If you know how to generate random data that represents your null hypothesis (chance, auc=0.5) and how to do your analysis, then you can do this by simulation, simulate a dataset at a given sample size, analyze it, repeat a bunch of times and see if that sample size is about the right size. If

Re: [R] sample function with different proportions

2011-07-05 Thread Ted Harding
Well, you can have exactly 70:30%, i.e. 70% 1s and 30% 0s, but in random order. For example: Popn <- c(rep(1,70),rep(0,30)) Samp <- sample(Pop) (see '?sample' for this usage -- the result of sample(x) is a random permutation of the elements of x). In probabilistic terms, this is a "condition

Re: [R] sample function with different proportions

2011-07-05 Thread Duncan Murdoch
On 05/07/2011 2:25 PM, Joshua Wiley wrote: Hi Ana, Look at the documentation for ?sample, specifically, the "prob" argument. In your case this should work: sample(c(0,1), 100, replace = TRUE, prob = c(.3, .7)) note that you may not have *exactly* 70% 1 and 30%, in any given sample. And if y

Re: [R] sample function with different proportions

2011-07-05 Thread Joshua Wiley
Hi Ana, Look at the documentation for ?sample, specifically, the "prob" argument. In your case this should work: sample(c(0,1), 100, replace = TRUE, prob = c(.3, .7)) note that you may not have *exactly* 70% 1 and 30%, in any given sample. HTH, Josh On Tue, Jul 5, 2011 at 11:21 AM, Ana Kolar

Re: [R] sample weights in ols

2011-05-11 Thread jour4life
Thanks so much. I really appreciate it. Carlos On 5/11/2011 3:18 PM, Thomas Lumley-2 [via R] wrote: > On Thu, May 12, 2011 at 2:43 AM, jour4life <[hidden email] > > wrote: > > I have a follow up question. When using svyglm, it does not matter > that I am > > not using survey design and only wei

Re: [R] sample weights in ols

2011-05-11 Thread Thomas Lumley
On Thu, May 12, 2011 at 2:43 AM, jour4life wrote: > I have a follow up question. When using svyglm, it does not matter that I am > not using survey design and only weights? > In other words, > > fit<-svyglm(y~x1+x2+...xk,data=dataset,weights=weightvariable) > > Or am I going to have to construct a

Re: [R] sample weights in ols

2011-05-11 Thread jour4life
I have a follow up question. When using svyglm, it does not matter that I am not using survey design and only weights? In other words, fit<-svyglm(y~x1+x2+...xk,data=dataset,weights=weightvariable) Or am I going to have to construct a survey design variable, using only the weight variable? Than

Re: [R] sample weights in ols

2011-05-10 Thread jour4life
On 5/10/2011 3:12 PM, Thomas Lumley-2 [via R] wrote: > On Tue, May 10, 2011 at 2:50 PM, jour4life <[hidden email] > > wrote: > > > Hello all, > > > > I am wondering if there is a way to specify sampling weights for an ols > > model using sample weights. > > > > For instance, right now, my code is:

Re: [R] sample weights in ols

2011-05-10 Thread Thomas Lumley
On Tue, May 10, 2011 at 2:50 PM, jour4life wrote: > Hello all, > > I am wondering if there is a way to specify sampling weights for an ols > model using sample weights. > > For instance, right now, my code is: > > fit.ex<-lm(y~x1+x2+x3+...xk,data=dataset,weights=weightvariable.) > summary(fit.ex)

Re: [R] Sample size estimation for sample surveys

2011-04-04 Thread Thomas Levine
Awesome! Thanks, David and Dennis! And now I know how to search for packages more effectively. Tom On Mon, Apr 4, 2011 at 9:38 PM, Dennis Murphy wrote: > Start here: > > library(sos)  # install first if necessary > findFn('sample size survey') > > I got 238 hits, many of which could be relev

Re: [R] Sample size estimation for sample surveys

2011-04-04 Thread Dennis Murphy
Start here: library(sos) # install first if necessary findFn('sample size survey') I got 238 hits, many of which could be relevant. HTH, Dennis On Mon, Apr 4, 2011 at 6:05 PM, Thomas Levine wrote: > Hi, > > Is there an R package for estimating sample size requirements for > parameter esti

  1   2   3   >