Displaying 20 results from an estimated 10000 matches similar to: "Unexpected behavior of apply() over a 3d array"
2004 Dec 02
6
dropping rows
Hi!
Sorry for asking a trivial questions, but I can't seem to figure this out.
I have a dataframe called master containing 30-odd variables.
In this dataframe, I have observations across these 30 variables from
1930 to 2003 (I've made a "year" variable). How can I drop all rows for
which the year is less than 1960? I'm assuming something with ifelse()
but I can't
2004 Nov 30
6
Combined variable names
I am trying to define a large number of variables through a loop construct.
I have my loop variable i being cycled through 1:100 and I would like
the variables produced by this to be called
vi (i.e. v1 v2 v3 etc)
so, for example I'm going:
for(i in 1:100) {
<blank> <- a[i:N] # or whatever else you want to put on the right side
}
where N is previously defined.
What goes in
2005 Sep 05
4
Dummy variables model
Hi, all!
Anyone know an easy way to specify the following model.
Panel dataset, with stock through time, by firm.
I want to run a model of y on a bunch of explanatory variables, and one
dummy for each firm, which is 1 for observations that come from firm i,
and 0 everywhere else. I have over 200 firms (and a factor variable that
contains a firm identifier).
Any easy way of going about
2004 Nov 30
3
Relative subscripting
Hi!
I'm trying to do the following.
I have monthly a dataset with, among other things, "marketcap", and
"return".
I want to multiply return by the marketcap of the previous month. How do
I do this?
In STATA (which I have used frequently in the past) I would simply use
an expression of the form
return[_n]*marketcap[_n-1]
I believe they call this relative
2005 Mar 01
2
GARCH
Hi, everyone!
Is there a function to do single-variable GARCH in R? If yes, what
library is it in?
Thanks!
Toby
--
**************************************************************************
When Thomas Edison invented the light bulb he tried over 2000
experiments before he got it to work. A young reporter asked
him how it felt to have failed so many times. He said
"I never failed once. I
2005 Aug 23
1
clustering of disturbances
Hi!
I have a dataset of properties that are owned by different firms, each
firm owning multiple properties. I am running a regression of holding
period (how long a property was held in a firm's portfolio) on the left,
and a bunch of factors on the right.
When calculating standard errors, I would like to cluster my disturbance
terms by firm. Any ideas on how to do this?
I'm guessing
2006 Apr 04
2
R performance: different CPUs
Hello!
I need to purchase a new box, which I would like to optimize for good R
performance.
For the record, I will run Fedora Core 5 as and OS, and I wanted to know
if anyone has experience with how the following affects R performance:
- Is there a big advantage to having a 64-bit CPU over having a 32-bit?
- Does an Opteron offer any advantages over an Athlon, and if yes, does
it justify an
2002 Jun 19
3
unexpected results
Is R behaving correctly in this example? I do not understand why column 2
has any 2s in it (and why column 3 has any 1s)
> x<-matrix(0,10,3)
> x[seq(1,10,by=2),2:3]<-c(1,2)
> x
[,1] [,2] [,3]
[1,] 0 1 2
[2,] 0 0 0
[3,] 0 2 1
[4,] 0 0 0
[5,] 0 1 2
[6,] 0 0 0
[7,] 0 2 1
[8,] 0 0 0
[9,] 0 1
2005 May 19
3
Simultaneous estimation of mean and garch eq'n
Is it possible to simultaneously estimate mean and GARCH parameters in R?
In other words, I would like to estimate the normal regression equation
Y = b X + u
and simultaneously do a garch process on the u's to correct the standard
errors.
I was thinking maybe something with systemfit(), but I can't quite come
up with it.
Thanks,
Tobias
--
2005 Jan 17
2
Omitting constant in ols() from Design
Hi!
I need to run ols regressions with Huber-White sandwich estimators and
the correponding standard errors, without an intercept. What I'm trying
to do is create an ols object and then use the robcov() function, on the
order of:
f <- ols(depvar ~ ind1 + ind2, x=TRUE)
robcov(f)
However, when I go
f <- ols(depvar ~ ind1 + ind2 -1, x=TRUE)
I get the following error:
Error in
2017 Apr 27
4
[Bug 100860] New: Dual Monitor display problem, after switching screen positions, with 4.10 Kernels
https://bugs.freedesktop.org/show_bug.cgi?id=100860
Bug ID: 100860
Summary: Dual Monitor display problem, after switching screen
positions, with 4.10 Kernels
Product: xorg
Version: unspecified
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: critical
Priority:
2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
Hi,
(sorry for the wall of text; the issue here appears to be rather complicated)
I'm seeing a somewhat strange case where checking whether an S4 object
inherits from a parent class defined from another package with
'inherits' fails if that object is materialized through a call to
'load'. That's a mouthful, so I've put together a relatively small
reproducible example
2010 Mar 29
4
Confusing concept of vector and matrix in R
Why does R need the concept of "Vector"? In my opinion, it is a useless and
confusing concept. A vector is simply a special case of a matrix whose row
or column number is equal to 1. When I take submatrix from one matrix and
if row or column number is 1, R will automatically convert it into a vector.
It is very straightforward that a submatrix of a matrix should be a matrix.
In
2004 Nov 04
3
keep dimension of a sub matrix
Hi,
is there any way to keep a sub matrix dimension?
exemple :
i1<-1; i2<-1
j1<-2; j2<-3;
ret <-matrix(1,4,4)[i1:i2,j1:j2] ;
dim(ret) is NULL because the submatrix single col or single row is coerce to a vector automaticaly.
How can i bypass this cast : submatrix->vector ???????
Thank you.
---------------------------------
[[alternative HTML version
2012 Oct 22
4
Help with applying a function to all possible 2x2 submatrices
Hi all,
I'm working with a large data set (on the order of 300X300) and trying to
apply a function which compares the elements of all possible 2x2
submatrices. There are rc(r-1)(c-1) such submatrices, so obviously the naive
method of looping through the rows and columns is computationally unfeasible
for my data set:
for(i in 1:(nrow(data)-1)) {
for(j in (i+1):nrow(data)) {
for (m
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
I should add one more item that may be related here -- calling
'methods:::.requirePackage' returns a different result based on
whether the package namespace is already loaded or not.
If the package namespace is not loaded, the package is loaded and
attached, and the package environment is returned:
> methods:::.requirePackage("digest")
Loading required package:
2004 Dec 17
2
Matrix and rownames problem
Hi,
I'm quite new to R, so excuse me if this problem has a simple solution.
I'm working with an array, lets say
i <- array(c(1:3,3:1), dim=c(3,2))
Then I want to give the rows and the columns names:
rownames(i)<-c("a","b","c")
colnames(i)<-c("d","e")
The result is given below:
d e
a 1 3
b 2 2
c 3 1
Here comes my problem.
2004 Feb 09
5
simple question on picking out some rows of a matrix/data frame
Hi,
I have a simple question about matrix/data frame manipulation. I have
a data frame that looks a something like this
X Y Z
1 0 "apples"
-1 -1 "oranges"
...
0 -1 "bananas"
and I'd like to pull out all the rows for which X and Y are (un)equal
into a submatrix.
How can I do that?
Many thanks,
Roger Levy
2016 Jul 31
2
strange behavior in 'inherits' check for loaded S4 object
(Just returning from the "wilds" of Canada, so not able to comment on the specifics, but ...)
There is a basic point about generic functions that may be related to the "private" class question and my earlier remarks that Martin alluded to.
R (and S4 before it) allows packages to define methods for a generic function in another package. Say, for plot() in graphics.
The
2012 Aug 23
1
Why was my R process killed spontaneously?
I tried to use gpuCor function in the gputools package of R to calcuate the
pairwise correlations of a matrix of 40,000 columns.
Becuase there would be memory issues if I use the whole matrix at a time, I
splitted the matrix into submatrix of 10,000 columns and then calculate the
pairwise correlation of different submatrices. There are altogether 4
submatrices, so I need to calculate the pearson