Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limma multifactor experiment design matrix

    Hi, so I am very confused as to how I can make a multifactor design for limma RNA differential expression. I've read other posts in different forums and none of the answers are very explicit (to me) as to how to build a multifactor design

    For examples, say I have p1N, p1T, p2N, and p2T, where p# is patient number and N/T is normal tumor.

    I can build a single factor design matrix like this:

    ------Normal------Tumor
    1 ------ 1 --------- 0
    2 ------ 0 --------- 1
    3 ------ 1 --------- 0
    4 ------ 0 --------- 1

    I am completely lost as to how I can build a numeric matrix with multiple factors, which in this case, the factors would be patient number and N/T.

  • #2
    Code:
    d = data.frame(patient=factor(c("p1", "p1", "p2", "p2", ...)),
                   condition=factor(c("N", "T", "N", "T", ...)))
    design = model.matrix(~patient + condition, d)
    N.B., I've likely made a typo somewhere, but that's the gist.

    Comment


    • #3
      Oh, I thought I had to manually build a numeric matrix for the design matrix. Thanks. I have a followup question. I understand that the intercept column that is resulted is used for pair wise comparison. My question is when to use:

      design = model.matrix(~0+patient + condition, d)
      as opposed to this
      design = model.matrix(~patient + condition, d)

      Ok I found this from another post:

      EDIT:
      "This [design = model.matrix(~0+patient + condition, d)] (a cell means model) simply computes the mean expression for each group, and then you have to make all contrasts explicitly. The [design = model.matrix(~patient + condition, d)] has an implicit contrast (everything is a comparison to control), so you have to make contrasts for some comparisons, but not for others."

      from https://support.bioconductor.org/p/57268/


      So is it safe to say this only matters if I am doing a contrast matrix comparison?
      Last edited by Lugalbanda; 10-18-2016, 09:35 AM.

      Comment


      • #4
        Correct, the "0+" is only needed if you want to specify contrasts, which aren't needed to answer your question.

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Techniques and Challenges in Conservation Genomics
          by seqadmin



          The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

          Avian Conservation
          Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
          03-08-2024, 10:41 AM
        • seqadmin
          The Impact of AI in Genomic Medicine
          by seqadmin



          Artificial intelligence (AI) has evolved from a futuristic vision to a mainstream technology, highlighted by the introduction of tools like OpenAI's ChatGPT and Google's Gemini. In recent years, AI has become increasingly integrated into the field of genomics. This integration has enabled new scientific discoveries while simultaneously raising important ethical questions1. Interviews with two researchers at the center of this intersection provide insightful perspectives into...
          02-26-2024, 02:07 PM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 03-14-2024, 06:13 AM
        0 responses
        34 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 03-08-2024, 08:03 AM
        0 responses
        72 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 03-07-2024, 08:13 AM
        0 responses
        82 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 03-06-2024, 09:51 AM
        0 responses
        68 views
        0 likes
        Last Post seqadmin  
        Working...
        X