SpaNormFit

An S4 class to store a SpaNorm model fit

Description

An S4 class to store a SpaNorm model fit

Usage

## S4 method for signature 'SpaNormFit'
x\$name

Arguments

x an object of class SpaNormFit.
name a character, specifying the name of the slot to retrieve.

Value

Return value varies depending on method.

Slots

ngenes
a numeric, specifying the number of genes in the dataset.
ncells
a numeric, specifying the number of cells/spots in the dataset.
gene.model
a character, specifying the gene-specific model to used (see getGeneModels()).
df.tps
an integer, specifying the degrees of freedom to used for the thin plate spline.
sample.p
a numeric, specifying the proportion of samples used to approximated the model.
lambda.a
a numeric, specifying the shinkage parameter used.
batch
a vector or matrix, specifying the batch design used (if any).
W
a matrix, specifying the covariate matrix of the linear model.
alpha
a matrix, specifying the coefficients of the linear model.
gmean
a numeric, specifying the mean estimate for each gene in the linear model.
psi
a numeric, specifying the over-dispersion parameter for each gene if a negative binomial model was used (or a vector of NAs if another gene model is used).
wtype
a factor, specifying the covariate types of columns in the covariate matrix, W. These could be "biology", "ls", or "batch".
loglik
a numeric, specifying the log-likelihood of the model at each external iteration.
sampling
a factor, specifying the cells/spots used for dispersion estimation (‘dispersion’), GLM fitting (‘glm’ and ‘dispersion’), all other cells/spots (‘all’).
polish
a list, specifying the convergence diagnostics from the per-gene polish stage (see polishSpaNorm()): settings (the polish call’s configuration) and genes (a per-gene diagnostics data frame). An empty list for a fit that has not been polished; see isPolished().

Examples

Note

The code below runs when the site is built, on a small pre-fitted subset of HumanDLPFC (301 genes x 4015 spots; SpaNorm(sample.p = 0.05, df.tps = 2), SpaNormSVG() and SpaNormPCA() already applied) that is fitted once per build. The outputs are those of the code shown.

# the model fitted by SpaNorm() is stored in the metadata of the object
fit <- S4Vectors::metadata(HumanDLPFC)$SpaNorm
fit
SpaNormFit
Data: 301 genes, 4015 cells/spots
Gene model: nb
Degrees of freedom for TPS (y,x): Biology (2,2), LS (1,1)
Spots/cells sampled: 5%
Regularisation parameter: Biology (1e-04), LS (1e-04)
Batch:  NULL
log-likelihood (per-iteration):  num [1:2] -119358 -119237
W:  num [1:4015, 1:6] 0.3051 0.5028 0.0962 -0.1819 0.6169 ...
W:  - attr(*, "dimnames")=List of 2
W:   ..$ : chr [1:4015] "1" "2" "3" "4" ...
W:   ..$ : chr [1:6] "logLS" "bs.xy.bio1" "bs.xy.bio2" "bs.xy.bio3" ...
alpha:  num [1:301, 1:6] 0.97 0.97 0.97 0.97 0.97 ...
gmean:  num [1:301] 0.65 0.765 0.863 1.311 0.828 ...
psi:  num [1:301] 0.02069 0.00517 0.03287 0.0348 0.04418 ...
wtype:  Factor w/ 3 levels "batch","biology",..: 3 2 2 2 2 3
sampling: all (4015), glm (201), dispersion (201)
isPolished(fit)
[1] FALSE