Displaying 20 results from an estimated 1000 matches similar to: "equivalent of group command of the egen function in Stata"
2011 Aug 17
1
multinomRob - error message
Hi,
I would like to use the multinomRob function to test election results.
However, depending on which independent variables I include and how
many categories I have in the dependent variable, the model cannot be
estimated.
My data look like this (there are 68 observations):
> head(database)
RESTE09 GAUCHE09 PDC09 PLR09 UDC09 MCG09 RESTE05 GAUCHE05 PDC05
D1 1455
2010 Nov 08
1
unknown dimensions for loglm
Dear R-help community,
I am working with multidimensional contingency tables and I am having
trouble getting loglm to run on all dimensions without typing out each
dimension.
I have generated random data and provided output for the results I want
below:
d1.c1 <- rnorm(20, .10, .02)
d1.c2 <- rnorm(20, .10, .02)
d2.c1 <- rnorm(20, .09, .02)
d2.c2 <- rnorm(20, .09, .02)
d3.c1 <-
2012 Dec 07
1
points3d and ordirgl
Hello all, I have been using the function ordirgl to plot 3D dynamic
ordinations. The ordirgl function works just fine. IN fact, I was even
able to write a function that allows me to identify points in the 3D plot:
identify.rgl<-function(env_var,ord,dim1,dim2,dim3)
{
tmp<-select3d(button="left")
tmp.keep<-tmp(ord[,dim1],ord[,dim2],ord[,dim3])
2010 Jan 20
1
Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements
Hi,
See my example below.
a<-array(1:12,c(2,3,2))
> a
, , 1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
, , 2
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
I want to get a result something like
dim1 dim2 dim3 elements
1 1 1
1 2 1
1 3 2
2 1 2
I tried the data.frame and expand.grid functions,
2004 Jul 16
1
labels for 3d Plots
High!
How can I add variable labels (rownames for instance) to a plot created
with ‚clouds’ ( clouds(dim3~dim1*dim2)) – package lattice?
Thanks in advance!
Martina Renninger
[[alternative HTML version deleted]]
2010 Feb 10
2
system.time provides inaccurate sys.child (PR#14210)
Full_Name: Manuel L?pez-Ib??ez
Version: R version 2.6.2 (2008-02-08)
OS: linux-gnu
Submission from: (NULL) (164.15.10.156)
This is only relevant for CPU intensive child processes. Otherwise, the problem
is not obvious.
Therefore, we need a CPU intensive program like this one:
/************************************/
/*** Compile with: gcc -o timer-test -O0 timer-test.c -lm */
#include
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12)
dim(foo) <- c(30, 34, 12)
I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame.
I know how this can be done in a very slow way using for loops, like this:
x <- rep(seq(from = 1, to = 30), 34)
y <- as.vector(sapply(1:34, function(x) {rep(x, 30)}))
month <- as.vector(sapply(1:12,
2003 Sep 25
1
apply on a 4D array
I am trying to multiply a 3D array of 4x4x4 by the 4 3D arrays of a 4D array
with dimensions 4x4x4x4 (the last dimension being the one that I want to
split by).
(4x4x4 array)
> hiaAry
, , a1
i1 i2 i3 i4
h1 9.5936098 6.001040 0.08772 0.3138600
h2 1.2003500 1.454570 2.79248 0.0000000
h3 0.1346500 0.201220 0.39256 0.5464000
h4 0.0109000 0.012270 0.16417 0.2766900
,
2001 Dec 31
2
Extracting/setting elements from/in a matrix/array
Dear all,
I had to extracts/set elements from/in a matrix. Let say I have two
vectors dim1 and dim2 of indices in the respective two dimensions of a
matrix: I want to extract all the corresponding elements. I the case of a
nxn matrix, dim1 <- 1:n and dim2 <- 1:n would extract the diagonal.
I know one way would be to use the functions 'row' and 'col', but the
matrixes I
2006 Dec 17
2
question
Dear R users,
I'am using marray and Limma packages to analyze genepix output.
1) how can I filter bad spots from my data (data contains 3 types of bad
spots).
my experiment contains 12 samples and the bad spot are not associated to the
same probes
2) how can I remove control probes from my data ?
I'm sorry, i'm new with R and I can't find answer in packages doc.
best regards,
2012 Apr 05
0
Multi part problem...array manipulation and sampling
Ok, I have a new, multipart problem that I need help figuring out.
Part 1. I have a three dimensional array (species, sites, repeat counts
within sites). Sampling effort per site varies so the array should be
ragged.
Maximum number of visits at any site = 22
Number of species = 161
Number of sites = 56
I generated the array first by;
2011 May 10
3
metaMDS and envfit: Help reading output
Hello R experts,
I've used metaMDS to run NMDS on some fish abundance data, and am also working on correlating environmental data to the NMDS coordinates. I'm fairly new to metaMDS and NMDS in general, so I have what are probably some very basic questions. My fish abundance data consists of 66 sites for which up to 20 species of fish were identified and counted. I ran metaMDS on this data
2010 Dec 27
2
Finding indexes of minum and maximum elements of an array
Hello there
I wish to get the "coordinates" of the minimum element of an array.
For example, if the array were
> H = array(c(8:5,1:4),dim=c(2,2,2))
> H
, , 1
[,1] [,2]
[1,] 8 6
[2,] 7 5
, , 2
[,1] [,2]
[1,] 1 3
[2,] 2 4
then
> min(H)
[1] 1
and
> max(H)
[1] 8
Say "idx" were the function I'm looking for. Then, what
2011 Feb 05
1
different results in MASS's mca and SAS's corresp
Dear list:
I have tried MASS's mca function and SAS's PROC corresp on the
farms data (included in MASS, also used as mca's example), the
results are different:
R: mca(farms)$rs:
1 2
1 0.059296637 0.0455871427
2 0.043077902 -0.0354728795
3 0.059834286 0.0730485572
4 0.059834286 0.0730485572
5 0.012900181 -0.0503121890
6
2011 Jan 16
1
Equivalent to Stata egen tag
What are the R equivalents to the Stata command egen tag
and
egen count?
egen station_week_tag = tag(station week)
Thank you
2006 Jun 02
2
basic array question
I have a large array and would like to extract from it the row and
column indices just of values for which a particular boolean condition
is true. I assume there's a simple way to do this, but I haven't
figured it out yet. Any help would be appreciated.
Tim
2010 Apr 22
3
using which to select range of values
Hi all,
I would like to get the array index for a range of values, say 0 < x <
1.5. I'm wondering if there is an alternative for the following which
I've done
x0 <- rnorm(100)
x1 <- ifelse(x0 > 0 & x0 < 1.5,"t","f")
x2 <- which(x1=="t",arr.ind=TRUE)
x0[x2]
Thanks.
--
Muhammad
2008 Sep 10
1
Return dimension index from array with n-dimensions
Hi,
I have been dealing with some problems finding a fast way of getting to
know in what dimension a specific value is located out of an array (like
the 'which' function for a vector returns its position).
Unable to find anything about this on the internet I wrote a function
myself.
Could you please comment if such a function already exists, and if not,
please feel free to comment the
2012 Dec 21
2
how to recode an ordered factor
Dear R helpers,
I'm trying to recode an ordered factor to reverse its scale, but I can't
figure out how to make it. I am using the Recode function provided by the
Car package.
I've created an ordered variable:
data$o.var1 <- ordered(data$var1, levels=c(1,2,3,4), labels =c("very
satisfied", "fairly satisfied", "not very satisfied", "not at all
2007 Dec 19
3
array addition
Hi
suppose I have two arrays x1,x2 of dimensions a1,b1,c1 and
a2,b2,c2 respectively.
I want x = x1 "+" x2 with dimensions c(max(a1,a2), max(b1,b2),max
(c1,c2))
with
x[a,b,c] = x1[a1,b1,c1] + x2[a2,b2,c2] if a <=min(a1,a2) , b<=min
(b1,b2), c<=min(c1,c2)
and the other bits either x1 or x2 or zero according to whether the
coordinates
are "in range" for