fido icon indicating copy to clipboard operation
fido copied to clipboard

More usage info on maltipoo()

Open danfulop opened this issue 5 years ago • 13 comments

Thanks for the amazing compositional package! I'm starting to check it out. Writing with a small feature request to post a bit more usage-related information on the maltipoo() function, particularly in terms of specifying variance components. A vignette would be awesome, though example code in the function's help page could suffice. I'd be happy to help knit a vignette.

danfulop avatar Sep 24 '20 15:09 danfulop

Hi Daniel, That sounds like a great idea. Maltipoo has been a work in progress for a long time. Honestly I think it works well (may not be as fast as it could be) but I had been waiting on a collaborator to finish the associated manuscript. Since it looks like that may never happen I think this could be a good time for maltipoo.

I currently don't have the bandwidth to write a vignette for this (at least not in the near future) but if you wanted to try to put one together I would be happy to help answer questions / tackle parts here and there. Especially if you have a use case I could help you put something together. 

Best, Justin

On Sep 24, 2020, at 11:31 AM, Daniel Fulop [email protected] wrote:

Thanks for the amazing compositional package! I'm starting to check it out. Writing with a small feature request to post a bit more usage-related information on the maltipoo() function, particularly in terms of specifying variance components. A vignette would be awesome, though example code in the function's help page could suffice. I'd be happy to help knit a vignette.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jsilve24/fido/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADOORX4IVLTYP54GETFLCTSHNQ3VANCNFSM4RYOMD6Q.

jsilve24 avatar Sep 24 '20 15:09 jsilve24

Presently I just need to accommodate a single variance component for a simple repeated measures experiment, but do have uses for more complex (eg nested) hierarchical structure. As for the vignette I'd need to find 1 or 2 suitable public datasets to illustrate different variance component setups. Perhaps you know of such datasets already?

danfulop avatar Sep 24 '20 20:09 danfulop

The data in https://www.frontiersin.org/articles/10.3389/fpls.2020.00599/full may be good for a vignette.

danfulop avatar Sep 25 '20 15:09 danfulop

What I am unsure of is how to specify U in fido::maltipoo()

danfulop avatar Sep 25 '20 20:09 danfulop

U is specified by stacking each variance component.

If each variance component is N x N (the number of samples) and you have p variance components... then U is Np x N e.g.,

| U_1 | | U_2 | | U_3 |

  •    -
    

(trying to denote row stacking / row binding of the different variance components but its not going well :)

On Sep 25, 2020, at 4:19 PM, Daniel Fulop [email protected] wrote:

What I am unsure of is how to specify U in fido::maltipoo()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jsilve24/fido/issues/1#issuecomment-699135501, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADOORSPA5XIVEH3QXKUU6DSHT3N3ANCNFSM4RYOMD6Q.

jsilve24 avatar Sep 25 '20 21:09 jsilve24

If I have a variance component whereby samples covary due to originating from the same (multiply measured) biological replicate and have 3 biological replicates overall, how should U_1 be structured?

Would this do to specify U_1? model.matrix(~ 0 + biological_rep, data=dat)

...it seems like perhaps not given that the dimensions are not NxN, but rather N x number of biological replicates.

danfulop avatar Sep 25 '20 21:09 danfulop

I would probably say some correlation ρ between biological replicates 1 on the diagonal and 0 other wise.

There are many options though.

Justin

On Sep 25, 2020, at 5:55 PM, Daniel Fulop [email protected] wrote:

If I have a variance component whereby samples covary due to originating from the same (multiply measured) biological replicate and have 3 biological replicates overall, how should U_1 be structured?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jsilve24/fido/issues/1#issuecomment-699174482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADOORXWTABSOR7HEFVXLLTSHUGVRANCNFSM4RYOMD6Q.

jsilve24 avatar Sep 25 '20 22:09 jsilve24

Gotcha. That makes perfect sense. Thanks!

danfulop avatar Sep 26 '20 11:09 danfulop

I'm getting a dimensions mismatch error when I input U as discussed:

> fido::maltipoo(Y = Y,
+                X = X,
+                upsilon = upsilon,
+                Theta = Theta,
+                U = U_1,
+                Xi = Xi)
Error in try_set_dims(c(nrow(X), ncol(Theta), ncol(U), args[["Q"]])) : 
  Dimension missmatch in arguments: [4,4,108]

U has 108 columns i.e. equal to the number of samples N as discussed. I setup the rest of the function's inputs as in the fido::pibble() vignette, but for my data and design matrix.

What am I missing?

danfulop avatar Sep 26 '20 13:09 danfulop

Very sorry for the delay.

Have you checked the dimensions of the other parts? e.g., are you sure that

nrow(X) == ncol(Theta) == ncol(U)?

Justin

jsilve24 avatar Oct 01 '20 14:10 jsilve24

Oh shit! I said the wrong thing, U has dimension Q x Q - number of covariates (its just for many of these models Q == N).

My apologies!

Same as before (Row stacking of U's but each U_i is QxQ).

jsilve24 avatar Oct 01 '20 14:10 jsilve24

Thanks! The fido::maltipoo documentation refers to QxQ as well. However, I'm now again unsure of how to construct U_i. What do the rows and columns of the U_i matrices represent? The covariates?

danfulop avatar Oct 16 '20 20:10 danfulop

So in general mixed effects models (and associated variance components do not need a distinct random effect for each sample). You can, for example, have multiple samples sharing a random effect. I took the tact of making it as general as possible and essentially QxQ is a covariance matrix over the covariates -- since this is Bayesian all covariates are associated with random effects.

Does that make sense? (Q is the number of covariates)

Justin

On Oct 16, 2020, at 4:59 PM, Daniel Fulop [email protected] wrote:

Thanks! The fido::maltipoo documentation refers to QxQ as well. However, I'm now again unsure of how to construct U_i. What do the rows and columns of the U_i matrices represent? The covariates?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jsilve24/fido/issues/1#issuecomment-710625336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADOORWKBU4LI7LWZTL3U2TSLCX4LANCNFSM4RYOMD6Q.

jsilve24 avatar Oct 16 '20 22:10 jsilve24