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] Reloading old R Environments/Workspaces

2019-07-03 Thread Spencer Brackett
Very interesting I will have to take a look. Thank you very much for the reference to these resources! They will be of great help to me. Many thanks, Spencer On Wed, Jul 3, 2019 at 8:41 PM Jeff Newmiller wrote: > An R file is nothing more than a text file with an R extension instead of > a

Re: [R] Reloading old R Environments/Workspaces

2019-07-03 Thread Jeff Newmiller
An R file is nothing more than a text file with an R extension instead of a TXT extension. Use any text editor you like to rearrange your commands in the order you want and remove false starts (beware of Notepad... it seems to have a tendency to tack on a .txt extension in addition to the .R ext

Re: [R] Reloading old R Environments/Workspaces

2019-07-03 Thread Spencer Brackett
I do have a script available, though it is not in a traditional R script file/document, but an .Rhistory file as well as on Notepad. Is there a way I can convert one or both of these file types into an R script file so that I can run the commands directly to my console? Best, Spencer On Wed, Jul

Re: [R] Reloading old R Environments/Workspaces

2019-07-03 Thread Jeff Newmiller
Saving/loading does not affect the status of packages being loaded or not, which may affect how useful those objects are. This is why I depend on having a script that can reproduce my results at all times, and only use the load/save feature to minimize the number of times I have to re-do long

[R] Reloading old R Environments/Workspaces

2019-07-03 Thread Spencer Brackett
Good evening, I tried loading an R global environment that I had saved so to resume my work on the datasets I manipulated during that particular R session. After loading the file directly, the same items that were contained in the original working environment from the previous session appeared t

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Heather H Kettrey
Thanks to both of you! I will try this and if it does not work I will reach out to the multilevel help page that Marc suggested. Heather Hensman Kettrey, PhD Assistant Professor of Sociology Clemson University From: Wolfgang Viechtbauer Sent: Wednesday, July

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] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Wolfgang Viechtbauer
No need to install metafor for lme4. Best, Wolfgang On July 3, 2019 5:19:13 PM GMT+02:00, Marc Schwartz wrote: >Hi Heather, > >I would defer to the mixed models experts, but I think that the basic >approach using nested random effects seems to make sense. > >I don’t know that there is a depen

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Duncan Murdoch
On 03/07/2019 12:42 p.m., Jeff Newmiller wrote: Dummy columns do have some drawbacks though, if you find yourself working with large data frames. The dummy columns waste memory and time as compared to either reorganizing columns after the `within` or using separate sequential `with` expression

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Jeff Newmiller
Dummy columns do have some drawbacks though, if you find yourself working with large data frames. The dummy columns waste memory and time as compared to either reorganizing columns after the `within` or using separate sequential `with` expressions as I previously suggested. I think mutate avoids

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Eric Berger
Nice suggestion, Richard. On Wed, Jul 3, 2019 at 4:28 PM Richard O'Keefe wrote: > Why not set all the new columns to dummy values to get the order you > want and then set them to their final values in the order that works > for that? > > > On Thu, 4 Jul 2019 at 00:12, Kevin Thorpe > wrote: > >

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Marc Schwartz via R-help
Hi Heather, I would defer to the mixed models experts, but I think that the basic approach using nested random effects seems to make sense. I don’t know that there is a dependency of glmer()/lme4 on metafor for this specific use case, but would defer to Wolfgang on that point. Regards, Marc

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Heather H Kettrey
Hi Marc and Wolfgang, Thanks for your help. Is the following interpretation of your exchange correct? I need to use the glmer() function in the lme4 package (first installing the devel version of metaphor). I can specify both site and matched pairing as random effects using (1 | site / id).

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Richard O'Keefe
Why not set all the new columns to dummy values to get the order you want and then set them to their final values in the order that works for that? On Thu, 4 Jul 2019 at 00:12, Kevin Thorpe wrote: > > > On Jul 3, 2019, at 3:15 AM, Sebastien Bihorel < > sebastien.biho...@cognigencorp.com> wrote:

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Wolfgang Viechtbauer
Ouch, that was a brain fart on my part! But indeed, since we can fit a 'single-site model' using glmer() (as shown), we should be able to just add 'site' as another random effect with (1 | site / id). Best, Wolfgang On July 3, 2019 1:26:54 PM GMT+02:00, Marc Schwartz wrote: >Wolfgang, > >Perh

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Jeff Newmiller
I have found using `with` to create one column at a time to be more clear than using `within` when sticking with base R, though I don't see why `within` couldn't be repaired to behave more like `mutate`. On July 3, 2019 5:24:14 AM PDT, Sebastien Bihorel wrote: >Hi Kevin, > >I was hoping to sta

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Sebastien Bihorel
Hi Eric, I was hoping to avoid post-processing the result of the within call. Sebastien From: "Eric Berger" To: "Sebastien Bihorel" Cc: "R mailing list" Sent: Wednesday, July 3, 2019 8:13:22 AM Subject: Re: [R] Control the variable order after multiple declarations using within Hi

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Sebastien Bihorel
Hi Kevin, I was hoping to stay within base R functionality. Thanks - Original Message - From: "Kevin Thorpe" To: "Sebastien Bihorel" Cc: "R Help Mailing List" Sent: Wednesday, July 3, 2019 8:11:51 AM Subject: Re: [R] Control the variable order after multiple declarations using within

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Eric Berger
Hi Sebastien, Your 'within' command returns a dataframe. So without changing the call to within you have some options such as: df2 <- within(df, {b<-a*2; c<-b*3}) df2[c("a","b","c")] OR within(df, {b<-a*2; c<-b*3})[c("a","b","c")] OR within(df, {b<-a*2; c<-b*3})[c(1,3,2)] HTH, Eric On We

Re: [R] Control the variable order after multiple declarations using within

2019-07-03 Thread Kevin Thorpe
> On Jul 3, 2019, at 3:15 AM, Sebastien Bihorel > wrote: > > Hi, > > The within function can be used to modify data.frames (among other objects). > One can even provide multiple expressions to modify the data.frame by more > than one expression. However, when new variables are created, the

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Marc Schwartz via R-help
Wolfgang, Perhaps I am missing something here, but with clogit(), or Heather's initial attempt at using clogistic(), as both have 'strata' arguments, wouldn't the 'strata' argument need to be able to accept a nested structure, along the lines of strata(id / site)? On the page that you link to

Re: [R] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Viechtbauer, Wolfgang (SP)
Dear Heather, You can do this with clogit() from the 'survival' package, using strata(). See: http://www.metafor-project.org/doku.php/tips:clogit_paired_binary_data You can also use lme4::glmer(), glmmML::glmmML(), or metafor::rma.glmm() for that. [1] [1] Rerunning this example, I noticed a sl

[R] Control the variable order after multiple declarations using within

2019-07-03 Thread Sebastien Bihorel
Hi, The within function can be used to modify data.frames (among other objects). One can even provide multiple expressions to modify the data.frame by more than one expression. However, when new variables are created, they seem to be inserted in the data.frame in the opposite order they were d