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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:21:21+00:00 2026-05-31T17:21:21+00:00

I am using the lfe package in R to do some regression with lots

  • 0

I am using the lfe package in R to do some regression with lots of fixed effects, so direct lm is out of the question (and since the fixed effects are not individual-level, so is plm). I get the output with no problems but now I’d like to use it in a LaTeX table. However, none of the packages I tried (like xtable, apsrtable, the latex command in Hmisc and so on) have methods for objects of class felm. So my question is, what do I do? Is there a way to access the lm.method and twist it so it can read felm objects? Is there a way to coerce felm objects into lm form? Any ideas?

  • 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-31T17:21:23+00:00Added an answer on May 31, 2026 at 5:21 pm

    It is possible that doing some transplant surgery on the felm-object will succeed. Determining whether creation of such a chimera is not doing violence to important underlying assumptions is your responsibility:

    # with the first example in the lfe::
    est <- lfe::felm(y ~ x+x2+G(id)+G(firm))
    class(est) <- c("felm", "lm")
    require(xtable)
     xtable(est)
    #----------------
    % latex table generated in R 2.14.0 by xtable 1.6-0 package
    % Sun Mar 18 10:42:04 2012
    \begin{table}[ht]
    \begin{center}
    \begin{tabular}{rrrrr}
      \hline
     & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\ 
      \hline
    x & 1.0937 & 0.0971 & 11.26 & 0.0000 \\ 
      x2 & 0.4597 & 0.1177 & 3.91 & 0.0002 \\ 
       \hline
    \end{tabular}
    \end{center}
    \end{table}
    

    Before doing that class engraftment, I did look at the felm-object to see if it resembled an lm-object and it did. It also appears that summary(est) returns the output that would be expected by a user of lm. (This does not actually do what you asked. The only thing it does is allow lm-targetted functions to attempt to do their work.)

    I’m not a particularly successful user of S4 methods but following a couple of links in the help page and making mods this is what I got after ignoring the warning:

     require(stats)
     setOldClass(c("felm", "lm"))
     setMethod("modelInfo", "summary.felm", function(x) {
       env <- sys.parent()
       digits <- evalq(digits, env)
       model.info <- list(
                          "$N$"=formatC(sum(x$df[1:2]),format="d"),
                          "Resid. sd" = formatC(x$sigma,format="f",digits=digits))
       class(model.info) <- "model.info"
       return(model.info)
     } )
    #in method for ‘modelInfo’ with signature ‘"summary.felm"’: no definition for class “summary.felm”
    #[1] "modelInfo"
     apsrtable(est,est, digits=1, align="l", 
               stars=1, model.counter=0, order="rl",
               coef.rows=1, col.hspace="3em", float="sidewaystable")
    #----------------------
    \begin{sidewaystable}[!ht]
    \caption{}
    \label{} 
    \begin{tabular}{ l D{.}{.}{1}D{.}{.}{1}@{\hspace{3em}}D{.}{.}{1}D{.}{.}{1} } 
    \hline 
      & \multicolumn{ 2 }{ c }{ Model 0 } & \multicolumn{ 2 }{ c }{ Model 1 } \\ \hline
     x      & 1.1 ^* & (0.1)  & 1.1 ^* & (0.1) \\ 
    x2     & 0.5 ^* & (0.1)  & 0.5 ^* & (0.1)  \\
     $N$       & \multicolumn{2}{c}{172} & \multicolumn{2}{c}{172}\\ 
    Resid. sd & \multicolumn{2}{c}{   } & \multicolumn{2}{c}{   } \\ \hline
     \multicolumn{5}{l}{\footnotesize{Robust standard errors in parentheses}}\\
    \multicolumn{5}{l}{\footnotesize{$^*$ indicates significance at $p< 0.05 $}} 
    \end{tabular} 
     \end{sidewaystable}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using jQuery, one can easily find out whether a particular element is visible using
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using Browserlab, it appears that the background image is not centred in Firefox7 for
Using Javascript I'm trying to loop through a 3 level nested array with the
Using LINQ on collections, what is the difference between the following lines of code?
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Nunit, I want to be able to write a test fixture that will
Using a restful resource in Rails, I would like to be able to insert

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.