% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/preprocess.R
\name{diff_expr_make_design}
\alias{diff_expr_make_design}
\title{Function to create design matrix}
\usage{
diff_expr_make_design(
  samp.info,
  groups,
  pairs = NULL,
  block = FALSE,
  use_weights = FALSE
)
}
\arguments{
\item{samp.info}{\code{data.frame}. samp.info object containing information of the project's sample sheet.
vector of sample names.}

\item{groups}{\code{character}. Name of the column in 'samp.info' containing grouping information. If 'samp.info' is not supplied
vector of groups.}

\item{pairs}{\code{character}. Name of the column in 'samp.info' containing paired sample information.}

\item{block}{\code{logical}. Are the samples not independent? See Details section.}

\item{use_weights}{\code{logical}. Are sample-specific quality weights used? See Details section. (Placeholder for future versions)}
}
\value{
A design \code{matrix} as produced by \code{\link[stats]{model.matrix}}: a means model without
  intercept (\code{~0 + groups}) for unpaired or blocked designs, or an additive model with intercept
  (\code{~pairs + groups}) when \option{pairs} enters the model as a fixed effect.
}
\description{
Function to create design matrix
}
\details{
The 'block' argument is used to specify whether the comparisons are to be made within AND between subjects or in the case of
technical replicates, i.e., if the samples are not independent, in other words, correlated.
If sample-specific quality weights are to be estimated by means of 'voomWithQualityWeights()' or 'voomLmFit()' and 'sample.weights' set
to TRUE, 'use_weights' will be TRUE, enforcing a design matrix containing an 'intercept' column, i.e., where the columns reflect contrasts.
The choice of the design matrix type impacts the estimated weights due to the effect of the intercept on the residual variance per sample
in more complex designs, e.g., involving blocking factors, interactions or continuous covariates. The recommendation by the limma authors
is to use the default design matrix, i.e., with intercept. With simple designs, the type of design matrix is not relevant.
NOTE: This argument is not yet functional but a mere place-holder for future versions allowing for readily implemented more complex designs.
}
\examples{
si <- diff_expr_get_samp_info(diffwrap_samp_info, "SampleName", "Group")
groups <- stats::relevel(si$Groups, ref = "control")
diff_expr_make_design(si, groups)
}
\seealso{
[model.matrix()]
}
