Displaying 20 results from an estimated 3000 matches similar to: "beginner's question: group of regressors by name vector?"
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
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
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 11
3
Revolution R and the R Community?
As an end-user, I wonder about Revolution R. Is the relationship
between Revolution R and the R community at-large a positive one? Do
the former contribute to the development efforts of the latter? Is
there a competitive aspect? is their forum competitive with r-help?
any other thoughts? (most of all, I simply hope that they help some
of the many helpful experts on this forum, who have
2010 Feb 09
2
Model matrix using dummy regressors or deviation regressors
The model matrix for the code at the end the email is shown below.
Since the model matrix doesn't have -1, I think that it is made of
dummy regressors rather than deviation regressors. I'm wondering how
to make a model matrix using deviation regressors. Could somebody let
me know?
> model.matrix(aaov)
(Intercept) A2 B2 B3 A2:B2 A2:B3
1 1 0 0 0 0 0
2
2006 Apr 03
4
argv[0] --- again
dear R group: I have the probably fairly common problem that I would
like to have one code.R file do different things if it is invoked from
a symbolic link, which should be easy to uncover.
$ ln -s code.R code-0.R
$ ln -s code.R code-1.R
$ R CMD BATCH code-1.R
what needs to be in code-1.R to put code-1.r into a character vector?
help appreciated.
regards, /ivo welch
PS : I read
2009 Mar 26
1
pgmm (Blundell-Bond) sample needed
Dear R Experts---
Sorry for all the questions yesterday and today. I am trying to use Yves
Croissant's pgmm function in the plm package with Blundell-Bond moments. I
have read the Blundell-Bond paper, and want to run the simplest model
first, d[i,t] = a*d[i,t-1] + fixed[i] + u[i,t] . no third conditioning
variables yet. the full set of moment conditions recommended for
system-GMM,
2009 Apr 16
2
static variable?
dear R experts:
does R have "static" variables that are local to functions? I know
that they are usually better avoided (although they are better than
globals).
However, I would like to have a function print how often it was
invoked when it is invoked, or at least print its name only once to
STDOUT when it is invoked many times.
possible without <<- ?
sincerely,
/iaw
2009 Sep 01
2
"simple" 3-dimensional plots?
dear R experts: I am trying to plot an empirical likelihood function in 3d.
The values are not over a regular grid---I just searched the likelihood
function to find the optimal value, and then computed a few values around
it. (each point in the likelihood function takes a very long time to
compute.)
the likelihood values now sit in a csv file that has three
columns, "mu",
2007 May 17
4
bug or feature?
R version 2.5.0, under gentoo linux. This may be just my ignorance
about naming conventions inside loops and subsets, but the following
appears like a bug to me.
y = c( 1963, 1963, 1964, 1964, 1965, 1965 );
r1= rnorm(6);
d= data.frame ( y=y, r1=r1 );
## note: I am not attach()ing anything anywhere
## this should give me two results, which it does
ahw.y= subset(d, d$y==1963);
2003 Aug 27
1
Problem in step() and stepAIC() when a name of a regressors has b (PR#3991)
Hi all,
I've experienced this problem using step() and stepAIC() when a name of a
regressors has blanks in between (R:R1.7.0, os: w2ksp4).
Please look at the following code:
"x" <-
c(14.122739306734, 14.4831100207131, 14.5556459667089,
14.5777151911177,
14.5285815352327, 14.0217803203846, 14.0732571632964,
14.7801310180502,
14.7839362960477, 14.7862217992577)
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
2007 Jan 01
1
advice on semi-serious attempt to extend summary
Dear R wizards:
I am trying (finally) to build a function that might be useful to
others. In particular, I want to create a summary.lme (extended lm)
method that [a] adds normalized coefficients and [b] white
heteroskedasticity adjusted se's and T's. I believe I already know
how to do the programming to do these two, at least in simple
unweighted cases. Now my challenges are just [1]
2011 Mar 01
3
inefficient ifelse() ?
dear R experts---
t <- 1:30
f <- function(t) { cat("f for", t, "\n"); return(2*t) }
g <- function(t) { cat("g for", t, "\n"); return(3*t) }
s <- ifelse( t%%2==0, g(t), f(t))
shows that the ifelse function actually evaluates both f() and g() for
all values first, and presumably then just picks left or right results
based on t%%2.
2008 Aug 25
8
SQL Primer for R
Dear R wizards:
I decided to take the advice in the R data import/export manual and
want to learn how to work with SQL for large data sets. I am trying
SQLite with the DBI and RSQLite database interfaces. Speed is nice.
Alas, I am struggling to find a tutorial that is geared for the kind
of standard operations that I would want in R. Simple things:
* how to determine the number of rows in a
2005 May 19
1
logistic regression: differential importance of regressors
Hi, All. I have a logistic regression model that I have run. The
question came up: which of these regressors is more important than
another?
(I'm using Design)
Logistic Regression Model
lrm(formula = iconicgesture ~ ST + SSP + magnitude + Condition +
Expertise, data = d)
Coef S.E. Wald Z P
Intercept -3.2688 0.2854 -11.45 0.0000
ST 2.0871 0.2730 7.64
2007 May 05
1
dynamically specifying regressors/RHS variables in a regression
Does anyone know if there is a way to specify regressors dynamically
rather than explicitly?
More specifically, I have a data set in "long format" that details a
number of individuals and their responses to a question (which can be
positive, negative, or no answer). Each individual answers as many
questions as they want, so there are a different number of rows per
individual.
For each
2010 May 05
1
Predict when regressors are passed through a data matrix
Hi everyone,
this should be pretty basic but I need asking for help as I got stuck.
I am running simple linear regression models on R with k regressors where k
> 1. In order to automate my code I packed all the regressors in a matrix X
so that lm(y~X) will always produce the results I want regardless of the
variables in X. I am new to R but I found this advice somewhere so I guess
it is
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