Displaying 20 results from an estimated 3000 matches similar to: "treatment effect at specific time point within mixedeffects model"
2006 Sep 26
2
treatment effect at specific time point within mixed effects model
All,
The code below is for a pseudo dataset of repeated measures on patients
where there is also a treatment factor called "drug". Time is treated
as categorical.
What code is necessary to test for a treatment effect at a single time
point,
e.g., time = 3? Does the answer matter if the design is a crossover
design,
i.e, each patient received drug and placebo?
Finally, what would
2007 Jul 06
1
maintaining specified factor contrasts when subsetting in lmer
All,
I'm using lmer for some repeated measures data and have specified
the contrasts for a time factor such that say time 3 is the base. This
works fine. However, when
I next use the subset argument to remove the last two time values, the
output indicates that
the specified contrast is not maintained (see below). I can solve this
by creating a new dataframe
for the subset of interest
2006 May 15
1
anova statistics in lmer
Dear list members,
I am new to R and to the R-help list. I am trying to perform a
mixed-model analysis using the lmer() function. I have a problem with
the output anova table when using the anova() function on the lmer
output object: I only get the numerator d.f., the sum of squares and the
mean squares, but not the denominator d.f., F statistics and P values.
Below is a sample output, following
2007 Jul 05
3
summarizing dataframe at variable/factor levels
All,
Is there an efficient way to apply say "mean" or "median" to a dataframe
according to say all combinations of two variables in the dataframe?
Below is a simple example and the outline of a "manual" solution that
will work but is not very efficient
(could also generalize this to a function). Searched the archives and
docs but didn't see anything close to
2012 Jul 20
1
Extracting standard errors for adjusted fixed effect sizes in lmer
Dear R help list,
I have done a lot of searching but have not been able to find an answer to
my problem. I apologize in advance if this has been asked before.
I am applying a mixed model to my data using lmer. I will use sample data
to illustrate my question:
>library(lme4)
>library(arm)
>data("HR", package = "SASmixed")
> str(HR)
'data.frame': 120 obs.
2009 Jul 24
1
Aggregate, max and time of max
All,
For data consisting of serial measurements on subjects, one may use the
aggregate function to say compute the peak response for each subject for
each design condition. Is there a way to alter this or another one-liner to
also retain the time at which the peak occurred and thus avoid writing a
doing this via a loop? I suppose one could attempt to employ the split
function but that's
2007 Jul 03
1
xyplot and autokey, maintaining colors specified via "col" in key
All,
When specifying colors to xyplot w/ a groups argument, using
auto.key no longer maintains the colors properly. I've searched
the docs and help but haven't found exactly what I need ... I saw
a few examples in the archives involving par.settings but that doesn't
seem to do it. I also saw some people using key instead of auto.key, but
that didn't seem consistent. Is there a
2008 Jul 02
1
auto.key in xyplot in conjunction with panel.text
All,
I can't seem to get auto.key to work properly in an xyplot that is employing
panel.text. Specifically, I often change the default grouping colors then
use auto.key accordingly, but for some reason the same functionality isn't
working for this different type of plot. Any help much appreciated.
Cheers,
David
library("lattice")
dat = data.frame( Y = c(rnorm(18,1),
2008 Jun 26
3
Connecting lines across missing data points, xyplot
All,
I have data across 5 time points that I am graphing via xyplot, along with
error bars. For one of the variables I have missing data for two of the
time points. The code below is okay but I can't seem to get the lines to
connect across the missing time points. Does anyone now how to rectify
this?
Cheers,
David Afshartous
library(lattice)
## the data
junk = data.frame(
Visit =
2008 Feb 05
1
Extracting level-1 variance from lmer()
All,
How does one extract the level-1 variance from a model fit via lmer()?
In the code below the level-2 variance component may be obtained via
subscripting, but what about the level-1 variance, viz., the 3.215072 term?
(actually this term squared) Didn't see anything in the archives on this.
Cheers,
David
> fm <- lmer( dv ~ time.num*drug + (1 | Patient.new), data=dat.new )
2008 Jun 16
1
aggregate() function, strange behavior for augmented data
All,
I'm re-running some analysis that has been augmented with additional data.
When I use the exact same code for the augmented data, the behavior of the
aggregate function is very strange, viz., one of the resulting variables is
now coded as a factor while it was coded as numeric for the original data.
Unfortunately, I cannot provide a reproducible code example since it only
seems to occur
2008 Sep 11
1
plot of all.effects object
All,
I'm trying to plot an all.effects() object, as shown in the help for
all.effects and also Crawley's R book (p.178, 2007). The data has a repeated
measures structure, but I'm using all.effects for the simple lm() fit here.
Below is a reproducible example that yields the error message.
fm.ex = lm(dv ~ time.num*drug*X, data = dat.new)
fm.effects = all.effects(fm.ex, xlevels =
2009 Feb 27
2
Adjusting confidence intervals for paired t-tests of multiple endpoints
Dear R-users,
In a randomized placebo-controlled within-subject design, subjects recieved
a psycho-active drug and placebo. Subjects filled out a questionnaire
containing 15 scales on four different time points after drug
administration. In order to detect drug effects on each time point, I
compared scale values between placebo and drug for all time conditions and
scales, which sums up to
2007 May 14
1
Nicely formatted summary table with mean, standard deviation or number and proportion
Dear all,
The incredibly useful Hmisc package provides a method to generate
summary tables that can be typeset in latex. The Alzola and Harrell book
"An introduction to S and the Hmisc and Design libraries" provides an
example that generates mean and quartiles for continuous variables, and
numbers and percentages for count variables: summary() with method =
'reverse'.
I
2010 Jul 05
1
Linux-Windows problem
Dear All,
I faced the following problem. With the same data.frame the results are
different under Linux and Windows.
Could you help on this topic?
Thanks in advance,
Ildiko
Linux:
> d = read.csv("CRP.csv")
> d$drugCode = as.numeric(d$drug)
> cor(d, use="pairwise.complete.obs")
PATIENT BL.CRP X24HR.CRP X48HR.CRP drug drugCode
PATIENT NA
2008 Jul 08
1
aggregate() function and na.rm = TRUE
All,
I've been using aggregate() to compute means and standard deviations at
time/treatment combinations for a longitudinal dataset, using na.rm = TRUE
for missing data.
This was working fine before, but now when I re-run some old code it isn't.
I've backtracked my steps and can't seem to find out why it was working
before but not now. In any event, below is a reproducible
2007 Jul 08
0
random effect variance per treatment group in lmer
All,
How does one specify a model in lmer such that say the random effect for
the intercept has a different variance per treatment group?
Thus, in the model equation, we'd have say b_ij represent the random
effect
for patient j in treatment group i, with variance depending on i, i.e,
var(b_ij) = tau_i.
Didn't see this in the docs or Pinherio & Bates (section 5.2 is specific
for
2011 Mar 27
2
Hmisc summary.formula formats for binary and continuous variables
Hello,
I am using Hmisc summary.formula, latex and Sweave to produce tables for publication. Is it possible to change the formats for binary and continuous variables? I would prefer to show 35 (10%) and 1.5 (1.2-1.8) rather than 10% (35) and 1.2 / 1.5 / 1.8. Here is a simple example:
sex <- factor(sample(c("m","f"), 500, rep=TRUE))
age <- rnorm(500, 50, 5)
treatment
2005 Feb 10
1
rats in survival package
Dear R-listers,
Does anybody know what is the correct source of "rats" dataset in survival package?
The help gives the following information:
Rat data from survival5
Description:
48 rats were injected with a carcinogen, and then randomized to
either drug or placebo. The number of tumors ranges from 0 to 13;
all rats were censored at 6 months after randomization.
2008 Jul 06
2
Error: cannot use PQL when using lmer
> library(MASS)
> attach(bacteria)
> table(y)
y
n y
43 177
> y<-1*(y=="y")
> table(y,trt)
trt
y placebo drug drug+
0 12 18 13
1 84 44 49
> library(lme4)
> model1<-lmer(y~trt+(week|ID),family=binomial,method="PQL")
Error in match.arg(method, c("Laplace", "AGQ")) :
'arg' should be one of