In this analysis we try to infer the effect of aging on the cell type composition in mouse tissue samples.
library (DirichletReg)
Loading required package: Formula
library(tidyverse)
Registered S3 methods overwritten by 'dbplyr':
method from
print.tbl_lazy
print.tbl_sql
[30m── [1mAttaching packages[22m ─────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──[39m
[30m[32m✓[30m [34mggplot2[30m 3.3.3 [32m✓[30m [34mpurrr [30m 0.3.4
[32m✓[30m [34mtibble [30m 3.0.6 [32m✓[30m [34mdplyr [30m 1.0.4
[32m✓[30m [34mtidyr [30m 1.1.2 [32m✓[30m [34mstringr[30m 1.4.0
[32m✓[30m [34mreadr [30m 1.4.0 [32m✓[30m [34mforcats[30m 0.5.1[39m
[30m── [1mConflicts[22m ────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
[31mx[30m [34mdplyr[30m::[32mfilter()[30m masks [34mstats[30m::filter()
[31mx[30m [34mdplyr[30m::[32mlag()[30m masks [34mstats[30m::lag()[39m
facs_dt <- read_tsv("cells_type_facs_proportions.txt")
[36m──[39m [1m[1mColumn specification[1m[22m [36m────────────────────────────────────────────────────────────────────────────────────────────────────[39m
cols(
musc = [32mcol_double()[39m,
macrophage = [32mcol_double()[39m,
fap = [32mcol_double()[39m,
condition = [31mcol_character()[39m
)
facs_dt <-
facs_dt %>%
relocate(fap, .before =musc ) %>%
mutate(condition=if_else(condition=="yng", 0, 1))
facs_dt
inputData <- facs_dt
inputData$Y <- DR_data(facs_dt[,1:3])
not all rows sum up to 1 => normalization forced
plot(inputData$Y)
fit1 <- DirichReg(Y ~ condition, inputData)
summary(fit1)
Call:
DirichReg(formula = Y ~ condition, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.2876 -0.9208 -0.1898 0.9336 1.6134
musc -1.8891 -0.4261 -0.0371 0.5281 1.5665
macrophage -1.1906 -0.7241 -0.1744 0.6942 1.8624
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.4473 0.5044 4.852 1.23e-06 ***
condition 0.4116 0.7193 0.572 0.567
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.4052 0.5048 6.746 1.52e-11 ***
condition -0.8491 0.7194 -1.180 0.238
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.0841 0.5041 4.134 3.56e-05 ***
condition -1.2559 0.7146 -1.758 0.0788 .
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.74 on 6 df (55 BFGS + 1 NR Iterations)
AIC: -35.48, BIC: -35.01
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit1)
fap musc macrophage
[1,] 0.2324647 0.6058644 0.1616709
[2,] 0.2324647 0.6058644 0.1616709
[3,] 0.2324647 0.6058644 0.1616709
[4,] 0.2324647 0.6058644 0.1616709
[5,] 0.5347745 0.3950431 0.0701824
[6,] 0.5347745 0.3950431 0.0701824
[7,] 0.5347745 0.3950431 0.0701824
[8,] 0.5347745 0.3950431 0.0701824
fit2 <- DirichReg(Y ~ 1 |condition|1, inputData)
summary(fit2)
Call:
DirichReg(formula = Y ~ 1 | condition | 1, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.2748 -0.6187 0.0075 0.5830 1.4535
musc -1.3099 -0.3789 -0.0975 0.2902 0.9938
macrophage -1.4040 -0.8419 0.1303 0.8273 1.7462
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.8398 0.3644 5.049 4.44e-07 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.5724 0.3957 6.500 8.02e-11 ***
condition -0.8279 0.3340 -2.479 0.0132 *
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.7135 0.3596 1.984 0.0473 *
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 17.16 on 4 df (42 BFGS + 1 NR Iterations)
AIC: -26.32, BIC: -26
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit2)
fap musc macrophage
[1,] 0.2937053 0.6110673 0.09522741
[2,] 0.2937053 0.6110673 0.09522741
[3,] 0.2937053 0.6110673 0.09522741
[4,] 0.2937053 0.6110673 0.09522741
[5,] 0.4477481 0.4070796 0.14517235
[6,] 0.4477481 0.4070796 0.14517235
[7,] 0.4477481 0.4070796 0.14517235
[8,] 0.4477481 0.4070796 0.14517235
fit3 <- DirichReg(Y ~ 1 |1 |condition, inputData)
summary(fit3)
Call:
DirichReg(formula = Y ~ 1 | 1 | condition, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.4979 -0.9611 0.0679 0.9565 1.9593
musc -1.6255 -1.1770 -0.0867 1.1874 1.9482
macrophage -0.9468 -0.5843 -0.3345 0.1894 0.8924
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.6769 0.3665 4.575 4.76e-06 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.9866 0.3674 5.407 6.39e-08 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.0178 0.4198 2.425 0.0153 *
condition -0.8322 0.4878 -1.706 0.0880 .
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 15.89 on 4 df (40 BFGS + 1 NR Iterations)
AIC: -23.79, BIC: -23.47
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit3)
fap musc macrophage
[1,] 0.3471766 0.4732138 0.17960966
[2,] 0.3471766 0.4732138 0.17960966
[3,] 0.3471766 0.4732138 0.17960966
[4,] 0.3471766 0.4732138 0.17960966
[5,] 0.3863808 0.5266505 0.08696866
[6,] 0.3863808 0.5266505 0.08696866
[7,] 0.3863808 0.5266505 0.08696866
[8,] 0.3863808 0.5266505 0.08696866
fit4 <- DirichReg(Y ~ condition |1 |1, inputData)
summary(fit4)
Call:
DirichReg(formula = Y ~ condition | 1 | 1, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.4325 -0.7952 -0.2831 1.0118 1.3223
musc -1.5837 -0.3279 -0.0993 0.2424 1.5819
macrophage -1.5535 -0.5274 -0.1409 0.9322 1.6319
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.8168 0.3915 4.640 3.48e-06 ***
condition 1.2881 0.2681 4.804 1.55e-06 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7752 0.3602 7.705 1.31e-14 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.249 0.358 3.488 0.000487 ***
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 22.09 on 4 df (35 BFGS + 2 NR Iterations)
AIC: -36.18, BIC: -35.86
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit4)
fap musc macrophage
[1,] 0.2395629 0.6246963 0.13574079
[2,] 0.2395629 0.6246963 0.13574079
[3,] 0.2395629 0.6246963 0.13574079
[4,] 0.2395629 0.6246963 0.13574079
[5,] 0.5332003 0.3834743 0.08332545
[6,] 0.5332003 0.3834743 0.08332545
[7,] 0.5332003 0.3834743 0.08332545
[8,] 0.5332003 0.3834743 0.08332545
Fit 4 is the best fitting one covariate model
fit5 <- DirichReg(Y ~ 1 |condition |condition, inputData)
summary(fit5)
Call:
DirichReg(formula = Y ~ 1 | condition | condition, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.1579 -1.0202 -0.1285 0.8958 1.7152
musc -2.0454 -0.4069 -0.0242 0.5163 1.7144
macrophage -1.1364 -0.7569 -0.2176 0.7858 1.5758
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.6280 0.3603 7.293 3.03e-13 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.5766 0.3763 9.504 < 2e-16 ***
condition -1.2354 0.2505 -4.931 8.17e-07 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.2483 0.3868 5.813 6.14e-09 ***
condition -1.5961 0.3934 -4.057 4.96e-05 ***
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.58 on 5 df (55 BFGS + 1 NR Iterations)
AIC: -37.16, BIC: -36.76
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit5)
fap musc macrophage
[1,] 0.2344105 0.6052355 0.16035392
[2,] 0.2344105 0.6052355 0.16035392
[3,] 0.2344105 0.6052355 0.16035392
[4,] 0.2344105 0.6052355 0.16035392
[5,] 0.5292959 0.3973182 0.07338587
[6,] 0.5292959 0.3973182 0.07338587
[7,] 0.5292959 0.3973182 0.07338587
[8,] 0.5292959 0.3973182 0.07338587
fit6 <- DirichReg(Y ~ condition | 1 | condition, inputData)
summary(fit6)
Call:
DirichReg(formula = Y ~ condition | 1 | condition, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.4821 -0.8244 -0.2783 1.0759 1.3790
musc -1.3654 -0.5774 -0.0586 0.5894 1.3907
macrophage -1.3303 -0.6411 -0.1085 0.4608 2.3400
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.9761 0.3883 5.089 3.6e-07 ***
condition 1.2054 0.2595 4.645 3.4e-06 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.8967 0.3596 8.056 7.9e-16 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.6242 0.3952 4.110 3.96e-05 ***
condition -0.5239 0.3686 -1.421 0.155
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.06 on 5 df (45 BFGS + 1 NR Iterations)
AIC: -36.13, BIC: -35.73
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit6)
fap musc macrophage
[1,] 0.2372955 0.5958070 0.16689744
[2,] 0.2372955 0.5958070 0.16689744
[3,] 0.2372955 0.5958070 0.16689744
[4,] 0.2372955 0.5958070 0.16689744
[5,] 0.5327840 0.4007381 0.06647788
[6,] 0.5327840 0.4007381 0.06647788
[7,] 0.5327840 0.4007381 0.06647788
[8,] 0.5327840 0.4007381 0.06647788
fit7 <- DirichReg(Y ~ condition | condition | 1, inputData)
summary(fit7)
Call:
DirichReg(formula = Y ~ condition | condition | 1, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.5125 -0.8145 -0.2857 1.0313 1.4135
musc -1.3694 -0.4706 -0.0886 0.3813 1.5497
macrophage -1.5166 -0.6144 -0.1373 0.6769 2.0274
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.7486 0.4184 4.179 2.92e-05 ***
condition 1.4783 0.4012 3.684 0.000229 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.6789 0.4088 6.554 5.61e-11 ***
condition 0.2420 0.3818 0.634 0.526
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.271 0.358 3.549 0.000387 ***
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 22.29 on 5 df (54 BFGS + 1 NR Iterations)
AIC: -34.58, BIC: -34.18
Number of Observations: 8
Link: Log
Parametrization: common
predict(fit7)
fap musc macrophage
[1,] 0.2406582 0.6101354 0.14920646
[2,] 0.2406582 0.6101354 0.14920646
[3,] 0.2406582 0.6101354 0.14920646
[4,] 0.2406582 0.6101354 0.14920646
[5,] 0.5325522 0.3921624 0.07528543
[6,] 0.5325522 0.3921624 0.07528543
[7,] 0.5325522 0.3921624 0.07528543
[8,] 0.5325522 0.3921624 0.07528543
Fit 5 is the best fitting two covariates model
The alternative parametrization consists of two parts: modeled expected values (mu) and their ‘precision’ (phi). As in multinomial logistic regfitsion, one reponse variable is omitted (by default the first) and for the fit a set of predictors is used with a multinomial logit-link. The age covariate affects the musc and fap, and also the the heteroscedasticity of the data.
fit8 <- DirichReg(Y ~ condition | condition, inputData, model="alternative")
summary(fit8)
Call:
DirichReg(formula = Y ~ condition | condition, data = inputData, model = "alternative")
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.2876 -0.9208 -0.1898 0.9336 1.6134
musc -1.8891 -0.4261 -0.0371 0.5281 1.5665
macrophage -1.1906 -0.7241 -0.1744 0.6942 1.8624
MEAN MODELS:
------------------------------------------------------------------
Coefficients for variable no. 1: fap
- variable omitted (reference category) -
------------------------------------------------------------------
Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.9579 0.1704 5.620 1.90e-08 ***
condition -1.2608 0.2483 -5.077 3.83e-07 ***
------------------------------------------------------------------
Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3632 0.2236 -1.624 0.104
condition -1.6676 0.3989 -4.181 2.9e-05 ***
------------------------------------------------------------------
PRECISION MODEL:
------------------------------------------------------------------
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.9063 0.4949 7.893 2.96e-15 ***
condition -0.4215 0.7023 -0.600 0.548
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.74 on 6 df (29 BFGS + 1 NR Iterations)
AIC: -35.48, BIC: -35.01
Number of Observations: 8
Links: Logit (Means) and Log (Precision)
Parametrization: alternative
predict(fit8)
fap musc macrophage
[1,] 0.2324647 0.6058644 0.1616709
[2,] 0.2324647 0.6058644 0.1616709
[3,] 0.2324647 0.6058644 0.1616709
[4,] 0.2324647 0.6058644 0.1616709
[5,] 0.5347745 0.3950431 0.0701824
[6,] 0.5347745 0.3950431 0.0701824
[7,] 0.5347745 0.3950431 0.0701824
[8,] 0.5347745 0.3950431 0.0701824
fit9 <- DirichReg(Y ~ condition | 1, inputData, model="alternative")
summary(fit9)
Call:
DirichReg(formula = Y ~ condition | 1, data = inputData, model = "alternative")
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.4328 -0.8354 -0.2571 1.0046 1.4273
musc -1.6579 -0.4731 -0.0472 0.5549 1.4257
macrophage -1.2734 -0.6677 -0.1435 0.5949 2.1209
MEAN MODELS:
------------------------------------------------------------------
Coefficients for variable no. 1: fap
- variable omitted (reference category) -
------------------------------------------------------------------
Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.9509 0.1901 5.003 5.63e-07 ***
condition -1.2556 0.2515 -4.992 5.96e-07 ***
------------------------------------------------------------------
Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3583 0.2484 -1.443 0.149
condition -1.7041 0.3899 -4.370 1.24e-05 ***
------------------------------------------------------------------
PRECISION MODEL:
------------------------------------------------------------------
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.6752 0.3508 10.48 <2e-16 ***
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.56 on 5 df (37 BFGS + 1 NR Iterations)
AIC: -37.13, BIC: -36.73
Number of Observations: 8
Links: Logit (Means) and Log (Precision)
Parametrization: alternative
predict(fit9)
fap musc macrophage
[1,] 0.2332642 0.6037236 0.16301216
[2,] 0.2332642 0.6037236 0.16301216
[3,] 0.2332642 0.6037236 0.16301216
[4,] 0.2332642 0.6037236 0.16301216
[5,] 0.5363304 0.3954813 0.06818828
[6,] 0.5363304 0.3954813 0.06818828
[7,] 0.5363304 0.3954813 0.06818828
[8,] 0.5363304 0.3954813 0.06818828
anova(fit4, fit1)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ condition | 1 | 1, data = inputData)
Model 2: DirichReg(formula = Y ~ condition, data = inputData)
Deviance N. par Difference df Pr(>Chi)
Model 1 -44.183 4
Model 2 -47.483 6 3.3006 2 0.192
Model 1 is more parsimonous. Fit4 is better
anova(fit4, fit5)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ condition | 1 | 1, data = inputData)
Model 2: DirichReg(formula = Y ~ 1 | condition | condition, data = inputData)
Deviance N. par Difference df Pr(>Chi)
Model 1 -44.183 4
Model 2 -47.159 5 2.9767 1 0.08447 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model 2 is slightly better
anova(fit8, fit9)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ condition | condition, data = inputData, model = "alternative")
Model 2: DirichReg(formula = Y ~ condition | 1, data = inputData, model = "alternative")
Deviance N. par Difference df Pr(>Chi)
Model 1 -47.483 6
Model 2 -47.125 5 0.3581 1 0.5496
Model 2 (fit9 is more parsimonious)
anova(fit9, fit4)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ condition | 1, data = inputData, model = "alternative")
Model 2: DirichReg(formula = Y ~ condition | 1 | 1, data = inputData)
Deviance N. par Difference df Pr(>Chi)
Model 1 -47.125 5
Model 2 -44.183 4 2.9425 1 0.08628 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
anova(fit9, fit5)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ condition | 1, data = inputData, model = "alternative")
Model 2: DirichReg(formula = Y ~ 1 | condition | condition, data = inputData)
Deviance N. par Difference df Pr(>Chi)
Model 1 -47.125 5
Model 2 -47.159 5 0.0342 0 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model 2 (fit5) is the best fitting model
fit5 <- DirichReg(Y ~ 1 |condition |condition, inputData)
summary(fit5)
Call:
DirichReg(formula = Y ~ 1 | condition | condition, data = inputData)
Standardized Residuals:
Min 1Q Median 3Q Max
fap -1.1579 -1.0202 -0.1285 0.8958 1.7152
musc -2.0454 -0.4069 -0.0242 0.5163 1.7144
macrophage -1.1364 -0.7569 -0.2176 0.7858 1.5758
------------------------------------------------------------------
Beta-Coefficients for variable no. 1: fap
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.6280 0.3603 7.293 3.03e-13 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 2: musc
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.5766 0.3763 9.504 < 2e-16 ***
condition -1.2354 0.2505 -4.931 8.17e-07 ***
------------------------------------------------------------------
Beta-Coefficients for variable no. 3: macrophage
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.2483 0.3868 5.813 6.14e-09 ***
condition -1.5961 0.3934 -4.057 4.96e-05 ***
------------------------------------------------------------------
Significance codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-likelihood: 23.58 on 5 df (55 BFGS + 1 NR Iterations)
AIC: -37.16, BIC: -36.76
Number of Observations: 8
Link: Log
Parametrization: common
Aging has an effect on the compostion of cell types by shifting the mean of the components down in two dimensions only (macrophage and MuSC)
inputData$Y
fap musc macrophage
[1,] 0.2522523 0.6176176 0.13013013
[2,] 0.1800900 0.7133567 0.10655328
[3,] 0.3281641 0.4762381 0.19559780
[4,] 0.1711198 0.6254378 0.20344241
[5,] 0.4734261 0.3743369 0.15223701
[6,] 0.6340000 0.3160000 0.05000000
[7,] 0.4240000 0.5010000 0.07500000
[8,] 0.6087914 0.3734855 0.01772304
param <- predict(fit5, data.frame(condition = factor(c(0, 1))), mu = T, alpha = T, phi=T)
param
$mu
[,1] [,2] [,3]
[1,] 0.2344105 0.6052355 0.16035392
[2,] 0.5292959 0.3973182 0.07338587
$alpha
[,1] [,2] [,3]
[1,] 13.84617 35.75008 9.471792
[2,] 13.84617 10.39369 1.919745
$phi
[1] 59.06804 26.15960
plot(inputData$Y, cex = 0.001, reset_par = FALSE)
div.col <- colorRampPalette(c("#023FA5", "#c0c0c0", "#8E063B"))(100)
temp <- (param$alpha/rowSums(param$alpha))
points(toSimplex(param$mu/rowSums(param$mu)),
pch = 23,
bg = div.col[c(1, 100)],
cex = 2,
lwd = 0.25)
points(toSimplex(inputData$Y),
pch = 21,
bg = gl(2, 4, labels=(div.col[c(1, 100)])),
cex = 1, lwd = 0.25)
lines(toSimplex(param$mu/rowSums(param$mu)),
lwd = 3,
col = c("#6E1D34"),
lty = "21")
legend("topright", bty = "n", legend = c("Young", "Aged", NA, "Expected Value Young", "Expected Value Aged"),
pch = c(21, 21, NA, 23, 23), pt.bg = c(div.col[c(1, 100)], NA, div.col[c(1, 100)]))
residuals
round(fit5$Y -predict(fit5), 2)
fap musc macrophage
1 0.02 0.01 -0.03
2 -0.05 0.11 -0.05
3 0.09 -0.13 0.04
4 -0.06 0.02 0.04
5 -0.06 -0.02 0.08
6 0.10 -0.08 -0.02
7 -0.11 0.10 0.00
8 0.08 -0.02 -0.06
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.4 purrr_0.3.4 readr_1.4.0 tidyr_1.1.2
[7] tibble_3.0.6 ggplot2_3.3.3 tidyverse_1.3.0 DirichletReg_0.7-1 Formula_1.2-4
loaded via a namespace (and not attached):
[1] zoo_1.8-8 tidyselect_1.1.0 xfun_0.20 haven_2.3.1 lattice_0.20-41 colorspace_2.0-0
[7] vctrs_0.3.6 generics_0.1.0 rlang_0.4.10 pillar_1.4.7 glue_1.4.2 withr_2.4.1
[13] DBI_1.1.1 dbplyr_2.1.0 modelr_0.1.8 readxl_1.3.1 lifecycle_0.2.0 munsell_0.5.0
[19] gtable_0.3.0 cellranger_1.1.0 rvest_0.3.6 knitr_1.31 miscTools_0.6-26 broom_0.7.4
[25] Rcpp_1.0.6 scales_1.1.1 backports_1.2.1 jsonlite_1.7.2 fs_1.5.0 maxLik_1.5-2
[31] hms_1.0.0 digest_0.6.27 stringi_1.5.3 grid_4.0.3 cli_2.3.0 tools_4.0.3
[37] sandwich_3.0-1 magrittr_2.0.1 crayon_1.4.1 pkgconfig_2.0.3 ellipsis_0.3.1 xml2_1.3.2
[43] reprex_1.0.0 lubridate_1.7.9.2 assertthat_0.2.1 httr_1.4.2 rstudioapi_0.13 R6_2.5.0
[49] compiler_4.0.3