Generally, statistics questions are off topic here, although they do
sometimes intersect R programming issues, as perhaps here.
Nevertheless, I believe your post would fit better on the
r-sig-mixed-models list, where repeated measures and other mixed
effects (/variance components) models are discussed. It sounds like
you may also want to do some reading about mixed effects models to
understand the issues involved, but as I found your post confusing,
maybe I'm wrong about that. is another online venue for mostly statistics


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, Apr 9, 2018 at 5:58 AM, Wolfgang Raffelsberger
<> wrote:
> Dear list,
> this seemed to me like a very trivial question, but finally I haven't found
> any similar postings with suitable solutions on the net ...
> Basically, instead of regressing two simple series of measures 'a' and 'b'
> (like b ~ a), I would like to use independent replicate measurements for
> each variable at each level (ie, instead of having just one 'a' and one 'b'
> I have independent replicates for all measures of 'a' and 'b', 'a1' could
> be as well compared to 'b1' as to 'b2' etc.)
> In analogy one could think of a procedure claiming to act and increase a
> given output value by eg 30% (compared to not emplying this procedure).
> Now I have indepedent repeated measures (since the measures themselves are
> considered not very precise) for a (large) number of individuals with and
> without the treatment.
> Basically, I want to test the hypthesis that applying the procedure
> increases values in a linear way by a given factor, thus test the
> parameters of a linear regression (eg slope=1.3, offset may be different to
> 0). In extension to this, how could I make a confidence-interval for the
> estimated slop (due to the treatment) to check if the claimed value is
> indeed inside ?
> # Here some toy data, my real data are much larger and might ressemble
> somehow to this.
> # Lines are for subjects and columns for 2 groups and repeat-measurements.
> # in this case I introduce a toy-factor of 1.3 to the 2nd part of my data
> (in the real data such a factor is just a hypothesis), which I would like
> to investigate/confirm
> dat <- matrix(rep(1:12,7)+rnorm(84),nc=7)
> dat[,4:7] <- 1.3*dat[,4:7]+runif(48)
> # some individual measures may be missing :
> dat[2:3,4] <- NA
> colnames(dat) <- paste(rep(c("a","b"),3:4),c(1:3,1:4),sep="")
> # In analogy to the ample documentation of lm() :
> datMean <- cbind(aM=rowMeans(dat[,1:3]),bM=rowMeans(dat[,4:7]))
> (lmMean <- lm(bM ~ aM,
> # I suppose the estimated parameters (intercet & slope) may be correct but
> sice the degrees of freedom are not made of means I am convinced they are
> incorrect and thus any statistics using them will be so, too ...
> df.residual(lmMean)
> summary(lmMean)
> # I also thought about a workaround reorganizing the data into a 'simple'
> two-column setup using somthing like stack() and allowing b ~ a, but again,
> I suppose the degrees of freedom won't be correct neither.
> # 1) should I simply correct the degrees of freedom in my lm-object, would
> this be the correct number of degrees of freedom
> lmMean$df.residual <- nrow(dat)*5-2
> # then I suppose I would need to change the standard errors, I'm shur what
> is the best way to do so
> # or 2) is there a package allowing to do these steps, thus returning
> correct DF, Std Err and Pr(>|t) ?
> Thanks in advance,
> Wolfgang Raffelsberger
> for completeness :
> sessionInfo()
>> sessionInfo()
> R version 3.4.4 (2018-03-15)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
> Matrix products: default
> locale:
> [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
> LC_MONETARY=French_France.1252
> [4] LC_NUMERIC=C                   LC_TIME=French_France.1252
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] limma_3.34.9    lme4_1.1-15     Matrix_1.2-12   TinnRcom_1.0.20
> formatR_1.4     svSocket_0.9-57
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.16    lattice_0.20-35 MASS_7.3-49     grid_3.4.4
> nlme_3.1-131.1  minqa_1.2.4
>  [7] nloptr_1.0.4    svMisc_0.9-70   splines_3.4.4   tools_3.4.4
>  compiler_3.4.4  tcltk_3.4.4
>         [[alternative HTML version deleted]]
> ______________________________________________
> mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________ mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Reply via email to