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 7564221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:51:26+00:00 2026-05-30T13:51:26+00:00

I know how to produce the plots using leveragePlot(), but I can not find

  • 0

I know how to produce the plots using leveragePlot(), but I can not find a way to produce a statistic for leverage for each observation like in megastat output.

  • 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-30T13:51:27+00:00Added an answer on May 30, 2026 at 1:51 pm

    I think you’re looking for the hat values.

    Use hatvalues(fit). The rule of thumb is to examine any observations 2-3 times greater than the average hat value. I don’t know of a specific function or package off the top of my head that provides this info in a nice data frame but doing it yourself is fairly straight forward. Here’s an example:

    fit <- lm(hp ~ cyl + mpg, data=mtcars) #a fake model
    
    hatvalues(fit)
    
    hv <- as.data.frame(hatvalues(fit))
    mn <-mean(hatvalues(fit))
    hv$warn <- ifelse(hv[, 'hatvalues(fit)']>3*mn, 'x3',
       ifelse(hv[, 'hatvalues(fit)']>2*mn, 'x3', '-' ))
    
    hv
    

    For larger data sets you could use subset and/or orderto look at just certain values ranges for the hat values:

    subset(hv, warn=="x3")
    subset(hv, warn%in%c("x2", "x3"))
    hv[order(hv['hatvalues(fit)']), ]
    

    I actually came across a nice plot function that does this in the book R in Action but as this is a copyrighted book I will not display Kabacoff’s intellectual property. But that plot would work even better for mid sized data sets.

    Here is a decent hat plot though that you may also want to investigate:

    plot(hatvalues(fit), type = "h")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody know how to produce an xml element like this in rails using xml
I know Java Date Time is not a good way to go forward but
This question may be too product specifc but I'd like to know if anyone
I would like to find a way to use the LaTeX \ref{} markup to
Does anyone know of a nice way to: produce XSD documents from an SQL
Does anyone know about a PHP library which can produce layered PNG images? (I'm
I'd like to know is there a string hashing function that would produce identical
Does anyone know if it is possible to write a query that can produce
Does anyone know a way to produce a nice publication quality LaTeX table from
Does anyone know of or can anyone please produce a simple example of Django's

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.