Displaying 20 results from an estimated 10000 matches similar to: "esthetics --- extending the lm command to fixed effects?"
2013 Feb 26
1
Light Libraries
Dear R-Help group:
I have been tinkering with how I want my personal standard library
functions to look like. They are not designed to be professional and
heavyweight, but lightweight. There are probably dozens of little bugs,
because I don't know or have not properly taken care of a variety of
internal R code issues. still, I like how this ended up, and there is no
learning curve, so I
2012 May 09
2
big quasi-fixed effects OLS model
dear R experts---now I have a case where I want to estimate very large
regression models with many fixed effects---not just the mean type, but
cross-fixed effects---years, months, locations, firms. Many millions of
observations, a few thousand variables (most of these variables are
interaction fixed effects). could someone please point me to packages, if
any, that would help me estimate such
2010 May 24
1
Fixed Effects Estimations (in Panel Data)
dear readers---I struggled with how to do nice fixed-effects
regressions in large economic samples for a while. Eventually, I
realized that nlme is not really what I needed (too complex), and all
I really wanted is the plm package. so, I thought I would share a
quick example.
################ sample code to show fixed-effects models? in R
# create a sample panel data set with firms and years
2010 Apr 29
1
lm() with non-linear coefficients constraints? --- nls?
dear R experts---quick question. I need to estimate a model that looks like
y = (b*T+d*T^3) + (1-b-3*d*T^2)*x + (3*d*T)*x^2 + (-d)*x^3
I only have three parameters. Is nls() the right tool for the job, or is
there something faster/better?
/iaw
----
Ivo Welch (ivo.welch@brown.edu, ivo.welch@gmail.com)
[[alternative HTML version deleted]]
2010 Jan 08
4
fast lm se?
dear R experts---I am using the coef() function to pick off the coefficients
from an lm() object. alas, I also need the standard errors and I need them
fast. I know I can do a "summary()" on the object and pick them off this
way, but this computes other stuff I do not need. Or, I can compute (X'
X)^(-1) s^2 myself. Has someone written a fast se() function?
incidentally, I think
2010 Jun 11
3
lm without error
this is not an important question, but I wonder why lm returns an
error, and whether this can be shut off. it would seem to me that
returning NA's would make more sense in some cases---after all, the
problem is clearly that coefficients cannot be computed.
I know that I can trap the lm.fit() error---although I have always
found this to be quite inconvenient---and this is easy if I have only
2006 Mar 25
2
data frame as X in linear model lm() ?
Dear R wizards: This must have an obvious solution, but I am stumped.
I can run a linear regression giving a matrix as the independent set
of variables, but if I give a data frame (which I would like to give,
because it should tell the linear model the names of the variables), R
does not like it. An example is:
N=20; y= rnorm(N);
x.m <- (matrix( nrow=N, ncol=2 ));
x.m[,1]=rnorm(N);
2024 Nov 14
1
[EXT] Mac ARM for lm() ?
Not a direct answer but you may find lm.fit worth experimenting with.
Also try the high-performance computing task view on CRAN
Cheers,
Andrew
--
Andrew Robinson
Chief Executive Officer, CEBRA and Professor of Biosecurity,
School/s of BioSciences and Mathematics & Statistics
University of Melbourne, VIC 3010 Australia
Tel: (+61) 0403 138 955
Email: apro at unimelb.edu.au
Website:
2012 Mar 30
4
list assignment syntax?
Dear R wizards: is there a clean way to assign to elements in a list?
what I would like to do, in pseudo R+perl notation is
f <- function(a,b) list(a+b,a-b)
(c,d) <- f(1,2)
and have c be assigned 1+2 and d be assigned 1-2. right now, I use the clunky
x <- f(1,2)
c <- x[[1]]
d <- x[[2]]
rm(x)
which seems awful. is there a nicer syntax?
regards, /iaw
----
Ivo Welch
2024 Nov 16
1
[EXT] Mac ARM for lm() ?
Thanks, and all well taken. But are my beautiful GPUs (with integrated
memory architecture) really nothing more than a cooling area for the chip?
On Fri, Nov 15, 2024 at 6:06?AM Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> >>>>> Andrew Robinson via R-help
> >>>>> on Thu, 14 Nov 2024 12:45:44 +0000 writes:
>
> > Not a direct
2024 Nov 15
1
[EXT] Mac ARM for lm() ?
>>>>> Andrew Robinson via R-help
>>>>> on Thu, 14 Nov 2024 12:45:44 +0000 writes:
> Not a direct answer but you may find lm.fit worth
> experimenting with.
Yes, lm.fit() is already faster, and
.lm.fit() {added to base R by me, when a similar question
was asked years ago ...}
is even an order of magnitude faster in some cases.
See
2010 Aug 22
2
on abort error, always show call stack?
Dear R Wizards---is it possible to get R to show its current call
stack (sys.calls()) upon an error abort? I don't use ESS for
execution, and it is often not obvious how to locate how I triggered
an error in an R internal function. Seeing the call stack would make
this easier. (right now, I sprinkle "cat" statements everywhere, just
to locate the line where the error appears.) Of
2009 Sep 11
1
constrOptim parameters
Dear R wizards: I am playing (and struggling) with the example in the
constrOptim function. simple example. let's say I want to constrain my
variables to be within -1 and 1. I believe I want a whole lot of
constraints where ci is -1 and ui is either -1 or 1. That is, I have 2*N
constraints. Should the following work?
N=10
x= rep(1:N)
ci= rep(-1, 2*N)
ui= c(rep(1, N), rep(-1, N))
2006 Mar 28
3
fixed effects
dear R wizards:
X is factor with 20,000*20=800,000 observations of 20,000 factors.
I.e., each factor has 20 observations. y is 800,000 normally
distributed data points. I want to see how much R^2 the X factors can
provide. Easy, right?
> lm ( y ~ X)
and
> aov( y ~ X)
Error: cannot allocate vector of size 3125000 Kb
is this computationally infeasible? (I am not an expert, but
2013 Aug 20
7
Extending suggestion for stopifnot
I am using a variant of stopifnot a lot. can I suggest that base R
extends its functionality? I know how to do this for myself. this is
a suggestion for beginners and students. I don't think it would break
anything.
first, I think it would be more useful if it had an optional character
string, so users could write
stopifnot( is.matrix(m), "m is not a matrix" )
this would
2009 Sep 15
2
why is nrow() so slow?
dear R wizards: here is the strange question for the day. It seems to me
that nrow() is very slow. Let me explain what I mean:
ds= data.frame( NA, x=rnorm(10000) ) ## a sample data set
> system.time( { for (i in 1:10000) NA } ) ## doing nothing takes
virtually no time
user system elapsed
0.000 0.000 0.001
## this is something that should take time; we need to add 10,000
2009 Sep 14
1
64-bit OSX binary for 2.9.2
dear R wizards: I am looking for a binary package distribution of R 2.9.2
for OSX . Looking at http://r.research.att.com/ , there seems to be only a
binary for 2.9.0 . is the 2.9.2 version binary package available
somewhere? (at this point, would it make sense to elevate the 64-bit
version to a "standard recommended" rather than just a "boutique" version?)
sincerely, /iaw
2010 Jan 22
2
sorted reshaping?
dear R wizards:? I am wrestling with reshape.? I have a long data set
that I want to convert into a wide data set, in which rows are firms
and columns are years.
> summary(rin)
firm fyear sim1
Min. :1004.00 Min. :1964.0 Min. : -1.00000
1st Qu.:1010.00 1st Qu.:1979.0 1st Qu.: -0.14334
Median :1016.00 Median :1986.0 Median : 0.00116
Mean
2010 Aug 18
1
Fwd: \ell symbol (log-likelihood)
I sent this privately to ivo welch yesterday, and he thinks it might
be useful to someone else as well. Since I'm on a Mac the screen
device is quartz():
> quartz()
> plot( c(0,1), c(0,1) );
> text( 0.5, 0.5, "\u2113" )
# and then File/Save As/
--
David.
Begin forwarded message:
> From: David Winsemius <dwinsemius at comcast.net>
> Date: August 17,
2010 Aug 30
4
different interface to by (tapply)?
dear R experts:
has someone written a function that returns the results of by() as a
data frame? ??of course, this can work only if the output of the
function that is an argument to by() is a numerical vector.
presumably, what is now names(byobject) would become a column in the
data frame, and the by object's list elements would become columns.
it's a little bit like flattening the by()