Displaying 20 results from an estimated 20000 matches similar to: "How to sort data sets?"
2005 Sep 26
3
How to get the rowindices without using which?
Hi,
I was wondering if it is possible to get the
rowindices without using the function "which" because
I don't have a restriction criteria. Here's an example
of what I mean:
# take 10 randomly selected instances
iris[sample(1:nrow(iris), 10),]
# output
Sepal.Length Sepal.Width Petal.Length Petal.Width
Species
76 6.6 3.0 4.4 1.4
2005 Sep 19
4
factor as seq() in for loop
Dear all,
I would like to use the values in vegaggr.BLMCMR02$colony
str(vegaggr.BLMCMR02)
`data.frame': 1678 obs. of 3 variables:
$ vegtype : Factor w/ 27 levels "2010","2020",..: 3 4 5 19 4 5 19 5
$ colony : Factor w/ 406 levels "0","1","10","100",..: 1 1 1 1 2 2 2
$ Totvegproparea: num 0.00055 0.03956 0.95705
2005 Aug 17
2
Copying rows from a matrix using a vector of indices
Hi,
I am trying to use a vector of indices to select some
rows from a matrix. But before I can do that I somehow
need to convert 'combinations' into a list, since
'mode(combinations)' says it's 'numerical'. Any idea
how I can do that?
library("combinat")
combinations <- t(combn(8,2))
indices <- c(sample(1:length(combinations),10))
# convert
???
2005 Aug 12
3
General expression of a unitary matrix
Hi, all,
Does anybody got the most general expression of a unitary matrix?
I found one in the book, four entries of the matrix are:
(cos\theta) exp(j\alpha); -(sin\theta)exp(j(\alpha-\Omega));
(sin\theta)exp(j(\beta+\Omega)); (cos\theta) exp(j\beta);
where "j" is for complex.
However, since for any two unitary matrices, their product should also
be a unitary matrix. When I
2005 Aug 17
2
power of a matrix
Dear all,
I have a population with three age-classes, at time t=0 the population
is:
n.zero <- c(1,0,0)
I have a transition matrix A which denotes "fertility" and "survival":
A <- matrix(c(0,1,5, 0.3,0,0, 0,0.5,0), ncol=3, byrow=TRUE)
To obtain the population at t=1, I calculate:
A %*% n.zero
To obtain the population t=2, I calculate:
A %*% (A %*% n.zero)
... and so
2005 Jun 28
2
the function of mle
Hi,
I am a user of R computer language.Several days ago,I download R-2.1.0.From
the help manual,I saw there is a function "mle" to find the maximum
likelihood estimators.But when I try to use this function,there is no this
function.Could you help me to solve this problem?
I am looking forward to your answer.
Thank you.
Jun Liu
2005 Dec 16
3
partially linear models
Hey,
I am estiamting a partially linear model y=X\beta+f(\theta) where the f(\theta) is estiamted using wavelets.
Has anyone heard of methods to test if the betas are significant or to address model fit?
Thanks for any thoughts or comments.
Elizabeth Lawson
__________________________________________________
[[alternative HTML version deleted]]
2005 Oct 07
3
panel data unit root tests
Hi,
The question is as follows: has anyone coded panel data unit root tests
with R? Even the "first generation" tests (see e.g. Levin & Lin 1993;
Pesaran, & Smith & Im 1996; Maddala & Wu 1999) would be sufficient for my
needs. To my understanding, these are rather easy to code, but as I have
taken just my first steps in coding with R, existing code would save me
2005 Sep 26
2
quasi-random vector according to an independent graph
Dear R-users,
Is anyone aware of any function/package for generating a random vector from
a joint distribution defined by an independent graph? Or I have to work it
out myself?
Thanks.
Jinfang
------------------------------
Jinfang Wang, Associate Professor
Chiba University, Japan
2005 Jul 08
3
How do you sort a data frame on a selection of columns?
This is what to start with:
Data Frame A B C D
c1 4 y 5
c3 6 d 7
c1 5 t 6
Now sort on A then C
This is what to end with:
Data Frame A B C D
c1 5 t 6
c1 4 y 5
c3 6 d 7
I assume it is something like this:
attach(DF)
sort(DF,partial=c(A,C))
Thanks in advance.
Meredith
[[alternative HTML version deleted]]
2005 Sep 16
6
How do I get the row indices?
Hi,
I was wondering if it's possible to get the row
numbers from a filtering. Here's an example:
# give me the rows with sepal.length == 6.2
iris[(iris[,1]==6.2),]
# output
Sepal.Length Sepal.Width Petal.Length Petal.Width
Species
69 6.2 2.2 4.5 1.5
versicolor
98 6.2 2.9 4.3 1.3
versicolor
127 6.2
2005 Jul 14
2
Variance components from lm?
I often use simple nested random-effect models for interlaboratory data.
The variance components are important things to know.
Is there an R function or package that gets variance components from lm
objects? Or can someone point me to a method of doing so?
2005 Jul 06
2
Plotting confidence intervals for lme
Hello and sorry to disturb.
I'm trying to plot the confidence intervals for the fixed effects of a lme.
I want to obtain graphically, if it is possible, a bar with Estimate, upper
and lower CI for each level of the factors.
I know how to do for a lm model but for a lme one, I tried with
plot(intervals(...)) and plot(ci(...)) from the gmodels package but it
doesn't work well.
Thanks
2005 Nov 03
4
nlme questions
Dear R users;
Ive got two questions concerning nlme library 3.1-65 (running on R 2.2.0 /
Win XP Pro). The first one is related to augPred function. Ive been working
with a nonlinear mixed model with no problems so far. However, when the
parameters of the model are specified in terms of some other covariates,
say treatment (i.e. phi1~trt1+trt2, etc) the augPred function give me the
following
2005 Dec 27
3
parameterization of factor in R
Hi all,
I encountered this problem with parameterization in R:
I have two factors in a regression. how about if I want to
set constraint so that for each factor, the sum of their
coefficients equals to zero(instead of choosing a reference
category)? for example, I have factor(variable) A(with three
categories) and factor(variable) B(with 4 categories), and I want
to parameterize so that the sum
2005 Oct 31
2
nlme error message
Dear Friends,
I am seeking for any help on an error message in lme
functions. I use mixed model to analyze a data with
compound symmetric correlation structure. But I get an
error message: "Error in corMatrix.corCompSymm(object) :
NA/NaN/Inf in foreign function call (arg 1)". If I change
the correlation structure to corAR1, then no error. I have
no clue how to solve this problem.
2005 Oct 03
2
"symbol print-name too long"
All,
I've coded a function and it works manually if I copy it line by line into R.
However, when I try to "load" (copy and paste) the entire function into
R, I get the following error after the listed line of code:
+ N.j.list = lapply(rej.hyp, length)
Error: symbol print-name too long
Does anyone you know what this error means? Strangely, when I copy the
same line verbatim
2005 Dec 22
2
Testing a linear hypothesis after maximum likelihood
I'd like to be able to test linear hypotheses after setting up and running a
model using optim or perhaps nlm. One hypothesis I need to test are that
the average of several coefficients is less than zero, so I don't believe I
can use the likelihood ratio test.
I can't seem to find a provision anywhere for testing linear combinations of
coefficients after max. likelihood.
Cheers
2005 Jun 23
2
solving equation system
Hello,
I want to solve some two dimensional equation system with R. Some systems
are not solvable analytically.
Here is an example:
(I) 1/n*sum{from_i=1_to_n}(Xi) = ln lambda + digamma(c)
(II) mean(X) = x / lambda
I want to find lambda and c,
which R-function could do that task?
Carsten
[[alternative HTML version deleted]]
2005 Sep 29
1
plot.augPred sorted and labelled according second factor
Hi
using this code example:
library(nlme)
fm1 <- lme(Orthodont, random = ~1)
plot(augPred(fm1))
is there any way to have the plots in each cell labelled and ordered
according to Orthodont$Sex? I.e. in addition to the bar with the label for
Orthodont$Subject there is another bar labelling the Sex of the subject?
thanks a lot
christoph
--