fitModel | R Documentation |
This function receives design matrix from makeDesign() and fits the model including all cell types and phenotypes.
fitModel(Design_out, Y)
Design_out |
The output from function makeDesign(). |
Y |
A G*N matrix, G is the number of features, N is the number of subjects; or a SummarizedExperiment object. |
Design_out |
The input Design_out object. |
N |
Number of samples from matrix Y. |
coefs |
Estimated coefficients (beta) in the model. |
coefs_var |
Estimated variance of the coefficients (beta variance) in the model. |
Y |
Observation Y matrix. |
Ypred |
Predicted Y from the fitted model. |
all_coefs |
The names of all phenotypes. |
all_cell_types |
The names of all cell types. |
MSE |
Estimated mean squared error. |
model_names |
The names of all terms in the fitted model. |
Ziyi Li <zli16@mdanderson.org>
Ziyi Li, Zhijin Wu, Peng Jin, Hao Wu. "Dissecting differential signals in high-throughput data from complex tissues."
N = 300 # simulation a dataset with 300 samples K = 3 # 3 cell types P <- 500 # 500 features ### simulate proportion matrix Prop = matrix(runif(N*K, 10,60), ncol=K) Prop = sweep(Prop, 1, rowSums(Prop), FUN="/") colnames(Prop) = c("Neuron", "Astrocyte", "Microglia") Y <- matrix(rnorm(N*P, N, P), ncol = N) ### simulate phenotype names design <- data.frame(disease=factor(sample(0:1, size = N,replace=TRUE)), age=round(runif(N, 30,50)), race=factor(sample(1:3, size = N,replace=TRUE))) Design_out <- makeDesign(design, Prop) ### fit model fitted_model <- fitModel(Design_out, Y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.