Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6351661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:02:57+00:00 2026-05-24T22:02:57+00:00

I’ve never noticed this behavior before, but I’m surprised at the output naming conventions

  • 0

I’ve never noticed this behavior before, but I’m surprised at the output naming conventions for linear model summaries. My question, essentially, is why row names in a linear model summary always seem to carry the name of the column they came from.

An example

Suppose you had some data for 300 movie audience members from three different cities:

  • Chicago
  • Milwaukee
  • Dayton

And suppose all of them were subjected to the stinking pile of confusing, contaminated waste that was Spider-Man 3. After enduring the entirety of that cinematic abomination, they were asked to rate the movie on a 100-point scale.

Because all of the audience members were reasonable human beings, the ratings were all below zero. (Naturally. Anyone who’s seen the movie would agree.)

Here’s what that might look like in R:

> score <- rnorm(n = 300, mean = -50, sd = 10)
> city  <- rep(c("Chicago", "Milwaukee", "Dayton"), times = 100)
> spider.man.3.sucked <- data.frame(score, city)
> head(spider.man.3.sucked)
      score      city
1 -64.57515   Chicago
2 -50.51050 Milwaukee
3 -56.51409    Dayton
4 -45.55133   Chicago
5 -47.88686 Milwaukee
6 -51.22812    Dayton

Great. So let’s run a quick linear model, assign it to lm1, and get its summary output:

> lm1 <- lm(score ~ city, data = spider.man.3.sucked)
> summary(lm1)

Call:
lm(formula = score ~ city, data = spider.man.3.sucked)

Residuals:
     Min       1Q   Median       3Q      Max 
-29.8515  -6.1090  -0.4745   6.0340  26.2616 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)   -51.3621     0.9630 -53.337   <2e-16 ***
cityDayton      1.1892     1.3619   0.873    0.383    
cityMilwaukee   0.8288     1.3619   0.609    0.543    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 9.63 on 297 degrees of freedom
Multiple R-squared: 0.002693,   Adjusted R-squared: -0.004023 
F-statistic: 0.4009 on 2 and 297 DF,  p-value: 0.6701

What’s bugging me

The part I want to highlight is this:

cityDayton      1.1892     1.3619   0.873    0.383    
cityMilwaukee   0.8288     1.3619   0.609    0.543    

It looks like R sensibly concatenated the column name (city, if you remember from above) with the distinct value (in this case either Dayton or Milwaukee). If I don’t want R to output in that format, is there any way to override it? For example, in my case all I’d need is simply:

Dayton      1.1892     1.3619   0.873    0.383    
Milwaukee   0.8288     1.3619   0.609    0.543    

Two questions in one

So,

  1. What’s controlling the format of the output for linear model summary rows, and
  2. Can/should I change it?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:02:58+00:00Added an answer on May 24, 2026 at 10:02 pm

    The extractor function for that component of a summary object is coef. Does this provide the means to control your output acceptably:

    summ <- summary(lm1)
    csumm <- coef(summ)
    rownames(csumm) <- sub("^city", "", rownames(csumm))
    print(csumm[-1,], digits=4)
    #           Estimate Std. Error t value Pr(>|t|)
    # Dayton      0.8133      1.485  0.5478   0.5842
    # Milwaukee   0.3891      1.485  0.2621   0.7934
    

    (No random seed was set so cannot match your values.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.