Skip to content

Error in mvregmed.grid(): invalid alpha estimates #1

@aidarripoll

Description

@aidarripoll

Hi,

I used regmed.grid to check whether the effect of an exposure (x1) over an outcome (y1) is mediated by multiple mediators (mediators).

fit.grid_single <- regmed.grid(x1, mediators, y1, lambda_grid, frac.lasso = 0.8)

> lambda_grid <- seq(from = 0.4, to = 0.01, by = -0.05)
> head(x1) #Sex dummy (0=male, 1=female)
[1] 0 0 1 1 1 1
> head(mediators) #CLR transformed cell type proportions (scaled/centered)
     B_intermediate    B_memory    B_naive Plasmablast
[1,]     -0.2230030 -0.71218298 -0.4023354   0.9098591
[2,]     -0.2573671  0.09965716  1.8207424  -1.2761777
[3,]      0.0977724 -0.42916827 -0.5502540   0.6142060
[4,]      1.2688690 -0.43791283  0.7899916  -1.2816000
[5,]     -0.5406937  0.24253059  0.5121418  -0.1433242
[6,]     -0.7383424  0.32146709 -0.7942261   0.9634093
> head(y1) #gene expression of one gene (scaled/centered)
            [,1]
[1,] -0.81420376
[2,] -0.87844074
[3,]  0.92019478
[4,] -0.05620736
[5,]  0.58616247
[6,]  0.29067235
> length(x1)
[1] 32
> dim(mediators)
[1] 32  4
> dim(y1)
[1] 32  1

I repeated the same per each of the outcomes in y, and for all of them alpha*beta!=0. However, when I use mvregmed.grid to consider the multiple outcomes at the same time (y) I get the following error:

fit.grid_mult <- mvregmed.grid(x, mediators, y, lambda_grid)

Error in mvregmed.grid(x, mediators, y, lambda_grid) :
  invalid alpha estimates"

I don't get where the issue can come from, since in the test for each independent outcome using regmed.grid it can estimate the alpha in all cases.

Notice that all variables (x, mediators and y) are scaled and centered, as recommended in your vignette. Also, if I've tried mvregmed.grid with a continuous exposure (Age scaled/centered) and it is working...

> head(x) #Sex dummy (0=male, 1=female) --> in matrix format as `mvregmed.grid` requires it
     Sex
[1,]      0
[2,]      0
[3,]      1
[4,]      1
[5,]      1
[6,]      1
> head(mediators) #CLR transformed cell type proportions (scaled/centered)
     B_intermediate    B_memory    B_naive Plasmablast
[1,]     -0.2230030 -0.71218298 -0.4023354   0.9098591
[2,]     -0.2573671  0.09965716  1.8207424  -1.2761777
[3,]      0.0977724 -0.42916827 -0.5502540   0.6142060
[4,]      1.2688690 -0.43791283  0.7899916  -1.2816000
[5,]     -0.5406937  0.24253059  0.5121418  -0.1433242
[6,]     -0.7383424  0.32146709 -0.7942261   0.9634093
> head(y) #gene expression of different genes (scaled/centered)
            XIST      RPS4X     EIF1AX       EIF2S3      DDX3X     MARCKS
[1,] -0.81420376 -0.3351344 -0.9793981 -0.384665761 -0.6400417 -0.7830787
[2,] -0.87844074 -1.0670184 -0.9249871 -0.858100544 -0.8360354 -1.2021912
[3,]  0.92019478  1.1646280  1.0066036  1.004076268  0.4869217  1.0036642
[4,] -0.05620736 -0.3691290 -0.3808771 -0.132167210 -0.2358048  0.2977905
[5,]  0.58616247  1.0666435  1.1154257  1.067200906  0.8911586  0.5404346
[6,]  0.29067235  0.2497729  0.1904385 -0.005917935 -0.3583009  0.1433806
           STT3B         SDF4       CD99      TMED10     NAP1L1     NDUFB7
[1,] -0.22999538  0.007225538 -0.3516680  0.51016032 -0.4241517 -0.3044673
[2,] -0.92331480 -0.609353688 -0.8187893 -0.94389986 -1.0429747 -0.9019126
[3,]  0.14333046  0.777949569  0.9222992  1.10500312  1.5698338  1.5338259
[4,] -0.65665349 -0.532281284 -0.4790647 -0.61343164 -0.2728838 -0.4882966
[5,]  0.08999819  0.161370344  0.7524369 -0.08468248  1.0885270  0.1091487
[6,] -0.06999860  0.161370344  0.5825746 -0.24991659 -0.1078643 -0.1665953
          IFNGR2   AC016831.7     ATP2B1        CD37        SKIL       OFD1
[1,] -0.85016389  0.365188047 -0.5656745 -0.42888983 -0.44038086 -0.5637288
[2,] -0.85016389 -1.118750684 -0.9519482 -0.94375265 -0.96291851 -1.0147119
[3,]  0.50633030  0.550680388  0.8861818  1.23531322  0.70267026  1.1399849
[4,] -0.09655601 -0.376781318 -0.2193602 -0.01803970 -0.42405155 -0.3131827
[5,]  1.18457739  0.179695706  0.8329027  1.43293733  0.84963398  1.2402034
[6,]  0.20488714 -0.005796636  0.2201927 -0.02324034  0.01683959 -0.1127458
> dim(x)
[1] 32  1
> dim(mediators)
[1] 32  4
> dim(y)
[1] 32 18
> str(x)
 num [1:32, 1] 0 0 1 1 1 1 1 1 1 1 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "Gender"
> str(mediators)
 num [1:32, 1:4] -0.223 -0.2574 0.0978 1.2689 -0.5407 ...
 - attr(*, "scaled:center")= Named num [1:4] -2.95e-17 -3.38e-17 -4.29e-17 2.78e-17
  ..- attr(*, "names")= chr [1:4] "B_intermediate" "B_memory" "B_naive" "Plasmablast"
 - attr(*, "scaled:scale")= Named num [1:4] 1 1 1 1
  ..- attr(*, "names")= chr [1:4] "B_intermediate" "B_memory" "B_naive" "Plasmablast"
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:4] "B_intermediate" "B_memory" "B_naive" "Plasmablast"
> str(y)
 num [1:32, 1:18] -0.8142 -0.8784 0.9202 -0.0562 0.5862 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:18] "XIST" "RPS4X" "EIF1AX" "EIF2S3" ...
 - attr(*, "scaled:center")= Named num [1:18] 68.4 1324.2 49 40.2 83.2 ...
  ..- attr(*, "names")= chr [1:18] "XIST" "RPS4X" "EIF1AX" "EIF2S3" ...
 - attr(*, "scaled:scale")= Named num [1:18] 77.8 1000.2 36.8 31.7 81.6 ...
  ..- attr(*, "names")= chr [1:18] "XIST" "RPS4X" "EIF1AX" "EIF2S3" ...

Thanks in advance!

Aida

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions