Unconfigured Ad

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

    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?:

    Q&A for people interested in statistics, machine learning, data analysis, data mining, and data visualization

    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
          Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
          by SEQadmin2



          Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
          ...
          Today, 11:10 AM
        • SEQadmin2
          Cancer Drug Resistance: The Lingering Barrier to Rising Survival
          by SEQadmin2



          Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

          There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
          Yesterday, 05:17 AM
        • GATTACAT
          Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
          by GATTACAT
          Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
          07-01-2026, 11:43 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, Today, 10:04 AM
        0 responses
        7 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, Yesterday, 10:08 AM
        0 responses
        6 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-07-2026, 11:05 AM
        0 responses
        9 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-02-2026, 11:08 AM
        0 responses
        31 views
        0 reactions
        Last Post SEQadmin2  
        Working...