Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tujchl
    Member
    • Sep 2009
    • 74

    #1

    question about glm in R

    HI
    I know I post my question about R here is somehow not appropriate, but I really hope someone can teach me.

    I use glm in R to do logistic regression. and treat both response and predictor as factor
    In my first try:

    *******************************************************************************
    Call:
    glm(formula = as.factor(diagnostic) ~ as.factor(7161521) +
    as.factor(2281517), family = binomial())


    Deviance Residuals:
    Min 1Q Median 3Q Max
    -1.5370 -1.0431 -0.9416 1.3065 1.4331

    Coefficients:
    Estimate Std. Error z value Pr(>|z|)
    (Intercept) -0.58363 0.27948 -2.088 0.0368 *
    as.factor(7161521)2 1.39811 0.66618 2.099 0.0358 *
    as.factor(7161521)3 0.28192 0.83255 0.339 0.7349
    as.factor(2281517)2 -1.11284 0.63692 -1.747 0.0806 .
    as.factor(2281517)3 -0.02286 0.80708 -0.028 0.9774
    ---
    Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    (Dispersion parameter for binomial family taken to be 1)

    Null deviance: 678.55 on 498 degrees of freedom
    Residual deviance: 671.20 on 494 degrees of freedom
    AIC: 681.2

    Number of Fisher Scoring iterations: 4
    *******************************************************************************

    And I remodel it and want no intercept:
    *******************************************************************************
    Call:
    glm(formula = as.factor(diagnostic) ~ as.factor(2281517) +
    as.factor(7161521) - 1, family = binomial())


    Deviance Residuals:
    Min 1Q Median 3Q Max
    -1.5370 -1.0431 -0.9416 1.3065 1.4331

    Coefficients:
    Estimate Std. Error z value Pr(>|z|)
    as.factor(2281517)1 -0.5836 0.2795 -2.088 0.0368 *
    as.factor(2281517)2 -1.6965 0.6751 -2.513 0.0120 *
    as.factor(2281517)3 -0.6065 0.8325 -0.728 0.4663
    as.factor(7161521)2 1.3981 0.6662 2.099 0.0358 *
    as.factor(7161521)3 0.2819 0.8325 0.339 0.7349
    ---
    Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    (Dispersion parameter for binomial family taken to be 1)

    Null deviance: 691.76 on 499 degrees of freedom
    Residual deviance: 671.20 on 494 degrees of freedom
    AIC: 681.2

    Number of Fisher Scoring iterations: 4
    *******************************************************************************

    As show above in my second model it return no intercept but look this:
    Model1:
    (Intercept) -0.58363 0.27948 -2.088 0.0368 *
    Model2:
    as.factor(2281517)1 -0.5836 0.2795 -2.088 0.0368 *


    They are exactly the same. Could you please tell me what happen?

    Thank you in advance
    Last edited by tujchl; 11-20-2011, 03:15 AM.
  • cjp
    Member
    • Jun 2011
    • 58

    #2
    Maybe try here?:

    http://stats.stackexchange.com/

    Comment

    • tujchl
      Member
      • Sep 2009
      • 74

      #3
      Thank you cjp, I`ll try it on your wesite

      Comment

      • Wolfgang Huber
        Senior Member
        • Aug 2009
        • 109

        #4
        Tujchl,

        the canonical place for such questions is the R-help mailing list on the R-Project's website.

        Your formula expressions look complex to me, and I am not sure I understand your intention with (or the effect of) as.factor(2281517). Is '2281517' an integer constant or a variable name? On the risk of invoking a cliche, but perhaps some reading of the documentation of glm and of R's formula interface would be instructive.

        Best wishes
        Wolfgang
        Wolfgang Huber
        EMBL

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
          by SEQadmin2



          Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

          Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
          ...
          10-14-2026, 09:55 AM
        • SEQadmin2
          New Genomics Technologies Take Aim at Long-Standing Limits
          by SEQadmin2


          Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

          We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
          ...
          09-28-2026, 10:25 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        23 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        20 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-15-2026, 10:52 AM
        0 responses
        36 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-14-2026, 05:39 AM
        0 responses
        42 views
        0 reactions
        Last Post SEQadmin2  
        Working...