Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 442

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

12 votes

Finding the column index by its name in R

For me, grep is more R-ish. Strongly related is the recent package by Hadley Wickhem: stringr, A package for "modern, consistent string processing" including grep like functions. … He recently published a paper on it in the R Journal. See also my answer on stackoverflow on an identical issue. …
Henrik's user avatar
  • 14.4k
8 votes

Most efficient order to learn LaTeX, Sweave, Beamer?

Additionally, there exists a very popular connection to R, ESS, developed by, inter alia, R core members Kurt Hornik and Martin Maechler. … One org-mode buffer with the document, one ESS mode R script to keep code and try out different things, and one R console being accessible from both scripts. This works really great. …
Henrik's user avatar
  • 14.4k
12 votes

Is there a way to maximize/minimize a custom function in R?

Next to optim there is another function in base R that allows for what you want: nlminb. Check ?nlminb and ?optim for examples of the usage. There are a bunch of packages that can do optimizations. …
Henrik's user avatar
  • 14.4k
1 vote

Help with unbalanced 2-factor ANOVA in R

You could analyze this easily in R using package afex (for which you will need an id variable giving a unique code for each object of observation): ez.glm("id", "age", your.data, betwenn = c("gender", …
Henrik's user avatar
  • 14.4k
6 votes

Warning messages from mixed model (glmer)

I think that the main issue is that you need to increase the number of possible iterations the optimizer is allowed to have (in my humble opinion the default of 10,000 is a little low). This is what i …
Henrik's user avatar
  • 14.4k
2 votes

Should I include an argument to request type-III sums of squares in ezANOVA?

The R-world doesn't like Type 3 SS to much. One of the usually cited references is the "Exegeses on Linear Models" by Bill Venables (2000). …
Henrik's user avatar
  • 14.4k
11 votes

Interpreting three forms of a "mixed model"

You should note that T is none of your model's a random effects terms, but a fixed effect. Random effects are only those effects that appear after the | in a lmer formula! A more thorough discussion …
Henrik's user avatar
  • 14.4k
2 votes

Question with R and repeated measures

You could simply use my afex package (on CRAN) with function ez.glm. Alternatively you could use ezANOVA from the ez package (also on CRAN). Both functions are basically wrappers for car::Anova(). H …
Henrik's user avatar
  • 14.4k
9 votes

Is Matlab/octave or R better suited for monte carlo simulation?

Although I almost exclusively use R, I really admire the profiler in Matlab. When your program is kind of slow you normally want to know where the bottleneck is. … Although I recommend R (because it is just great: free, extremely powerful, ...) if you know you have to profile your code a lot, Matlab is way better. …
Henrik's user avatar
  • 14.4k
3 votes
Accepted

testing contrast in two-way ANOVA using multcomp

This can be solved by using the ingenious combination of afex with lsmeans (and also multcomp if one desires so, but this is usually not necessary). Furthermore, thanks to afex functionality to aggreg …
Henrik's user avatar
  • 14.4k
8 votes
Accepted

Why do Anova( ) and drop1( ) provided different answers for GLMMs?

The R-sig-mixed modeling FAQ says the following regarding this: Tests of single parameters From worst to best: Wald Z-tests For balanced, nested LMMs where df can be computed: Wald t-tests …
Henrik's user avatar
  • 14.4k
7 votes

Mixed effects model: Compare random variance component across levels of a grouping variable

One relatively straight-forward way could be to use likelihood-ratio tests via anova as described in the lme4 FAQ. We start with a full model in which the variances are unconstrained (i.e., two diffe …
Henrik's user avatar
  • 14.4k
6 votes
Accepted

Are these maximal linear mixed models (within-subject within-item factorial design) really m...

Models m2 and m3 can only be estimated if you have repetitions on the level of the participant-item combination. For m3 for the full factorial design. Otherwise this random effect is confounded with t …
Henrik's user avatar
  • 14.4k
4 votes

Reference or book on simulation of experimental design data in R

I have the feeling that pretty recent "Introduction to Scientific Programming and Scientific Simulation Using R" by Owen Jones, Robert Maillardet, and Andrew Robinson (2009) could be what you are looking …
18 votes
Accepted

How to perform a 4 by 4 mixed ANOVA with between- and within-subjects contrasts using R?

A sketch of one solution (for another see below): Data needs to be in the long format (i.e., on value per row) instead of in the wide format as in SPSS (i.e., one subject per row), see the reshape p …
Henrik's user avatar
  • 14.4k

15 30 50 per page