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

  • Home
  • SEARCH
  • 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 7951477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:34:21+00:00 2026-06-04T02:34:21+00:00

Suppose I compared two models of nested random effects using anova() , and the

  • 0

Suppose I compared two models of nested random effects using anova(), and the result is below:

new.model: new
current.model: new 
              Df    AIC    BIC  logLik  Chisq Chi Df Pr(>Chisq)    
new.model      8 299196 299259 -149590                             
current.model  9 299083 299154 -149533 115.19      1  < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

I would like to use only the table part (see below):

              Df    AIC    BIC  logLik  Chisq Chi Df Pr(>Chisq)    
new.model      8 299196 299259 -149590                             
current.model  9 299083 299154 -149533 115.19      1  < 2.2e-16 ***

I know I am able to get rid of the heading part (see blow) by setting the heading to null using attributes(anova.object)$heading = NULL, but I don’t know how to get rid of the bottom part: Signif. codes: …..

new.model: new
current.model: new

I crucially do not want to use data.frame (see below) as it changes the blank cells to NAs

data.frame(anova(new.model, current.model))
              Df      AIC      BIC    logLik    Chisq Chi.Df   Pr..Chisq.
new.model      8 299196.4 299258.9 -149590.2       NA     NA           NA
current.model  9 299083.2 299153.6 -149532.6 115.1851      1 7.168247e-27

I wonder if you guys know a way to deal with this situation.

[UPDATE]: I ended up writing a wrapper using print.anova:

anova.print = function(object, signif.stars = TRUE, heading = TRUE){
    if(!heading)
         attributes(object)$heading = NULL
    print.anova(object, signif.stars = signif.stars)
}

Example:

dv = c(rnorm(20), rnorm(20, mean=2), rnorm(20))
iv = factor(rep(letters[1:3], each=20))
anova.object = anova(lm(dv~iv))

Analysis of Variance Table
Response: dv 
          Df Sum Sq Mean Sq F value    Pr(>F)    
iv         2 46.360 23.1798  29.534 1.578e-09 ***
Residuals 57 44.737  0.7849                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 


anova.print(anova.object, F, F)
          Df Sum Sq Mean Sq F value    Pr(>F)
iv         2 46.360 23.1798  29.534 1.578e-09
Residuals 57 44.737  0.7849             
  • 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-06-04T02:34:23+00:00Added an answer on June 4, 2026 at 2:34 am

    We had a similar post the other day about not showing NAs. You could do:

    x <- as.matrix(anova(new.model, current.model))
    print(x, na.print="", quote=FALSE)
    

    A more reproducible example using the mtcars data set:

    x <- as.matrix(anova(lm(hp~mpg+am, data=mtcars)))
    print(x, na.print="", quote=FALSE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you are using the ternary operator, or the null coalescing operator, or nested
Suppose I have a list, in which no new nodes are added or deleted.
In the tree class I'm suppose to compare two node, for you know searching
I have two images that are very similar. So for example suppose I drew
Let's suppose I want to add a new feature to my ASP.NET MVC application
Suppose I have two items, a and b, that compare the same. So a
Suppose I have Dictionary like this: Dictionary<string, string> values = new Dictionary<string, string>() {
Suppose I've got a generic MyClass<T> that needs to compare two objects of type
Suppose I have two text files. The first one, called reference.txt has the following
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage

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.