Search Results
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 |
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`.
7
votes
Discrete-Time Event History (Survival) Model in R
For most book chapters there is R sample code (see chapters 11ff) available that demonstrates how your data has to be structured ("person-period format") and how to analyze that kind of data. …
17
votes
Statistical methods to more efficiently plot data when millions of points are present?
For further references, see
Graphics of Large Datasets by Unwin/Theus/Hofmann
Quick-R on "High Density Scatterplots"
ggplot2's stat_hexbin …
4
votes
How to interpret a negative correlation of random effects in a mixed-effects model (in R)?
In addition to the explanation @BenBolker provided, you might find this graph on "Covariance between intercepts and slopes" by the Centre for Multilevel Modelling useful.
7
votes
Accepted
Is it possible to construct a discrete-time multilevel hazard model in R?
Yes, you can use R and lme4 for fitting discrete-time multilevel hazard models. According to Hox (2010, p. 163) "[t]he discrete or grouped survival model extends readily to multilevel models [...]". … Please find below the table from Hox' book:
And here is the corresponding R code and the results based on lme4. …
6
votes
Accepted
Forest plot for meta-analysis displaying the mean ES with and without outliers
Here is an update of the R code and the plot:
library(metafor)
data(dat.bcg)
## REM (k = 13)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
slab=paste(author, …
2
votes
After trying various optimzers, model simplification running more iterations, when fitting G...
Variable Set has only 6 categories. My guess is that this is not enough information to appropriately estimate the variance of the random effects. Most books on multilevel modeling suggest sample sizes …
5
votes
Accepted
Get a desired percentage of censored observations in a simulation of Cox PH Model
with:
## R: A p x p correlation matrix
## mu: Vector of means
## SD: Vector of standard deviations
## S: Variance-covariance matrix
R <- matrix(c(rep(r, p^2)), ncol = p)
diag(R … ) <- 1
R
mu <- rep(0, p)
SD <- rep(1, p)
S <- R * (SD %*% t(SD))
X <- mvrnorm(n, mu, S)
cov(X)
cor(X)
sqrt(diag(cov(X)))
## Calculate survival times
T <- (-log( …
23
votes
Accepted
What are efficient ways to organize R code and output?
Managing a statistical analysis project – guidelines and best practices
A workflow for R
R Workflow: Slides from a Talk at Melbourne R Users by Jeromy Anglim (including another much longer list of webpages … dedicated to R Workflow)
My own stuff: Dynamic documents with R and LATEX as an important part of reproducible research
More links to project organization: How to efficiently manage a statistical analysis …
21
votes
How to draw funnel plot using ggplot2 in R?
If you are looking for this (meta-analysis) type of funnel plot, then the following might be a starting point:
library(ggplot2)
set.seed(1)
p <- runif(100)
number <- sample(1:1000, 100, replace = TR …
6
votes
Accepted
Using glmer to replicate result from lmer for mulitlevel modelling in R
Did you check the help page of lmer? It is pretty clear about the relationship between lmer and glmer:
The ‘lmer’ and ‘glmer’ functions are nearly interchangeable. If
‘lmer’ is called with a no …
4
votes
Accepted
R software implementation of combining mixed treatment comparisons and meta-regression
I cannot help you with an R implementation of the Nixon et al. paper. …
4
votes
Estimating population average models in lmer or geepack
You might want to search for R packages that can fit generalized estimating equations (GEE), for example the package geepack or gee. …
7
votes
Accepted
Multilevel regression using lmer function in R and Stata
Fitting varying intercept/slope models in Stata and R
@Jens already has pointed out how to write Stata's xtmixed model in R. … to estimate simple MLMs in Stata and R. …
2
votes
Accepted
Test in R of whether three or more correlations from independent samples are equal
Most meta-analysis packages in R can do this test, for instance, meta or metafor. … I will provide an example for the meta package (differences are due to rounding errors):
library(meta)
library(psychometric)
dfr <- data.frame(r=c(0.2, 0.5, 0.6), n=c(200, 150, 75))
dfr$z <- r2z(dfr$r …
14
votes
Are misses in my data distributed completely at random?
The second question is about (an) appropriate R package(s). … ]
(2) (Some) Missing data related R packages
Some of these packages also have functions to explore patterns of missingness (e.g., missing.pattern.plot() in the mi package). …