Displaying 20 results from an estimated 200 matches similar to: "using optimize() correctly ..."
2008 May 09
2
which.max2()
Hello,
which.max() only returns one index value, the one for the
maximum value. If I want the two index values for the two
largest values, is this a decent solution, or is there a
nicer/better R'ish way?
max2 <-function(v)
{
m=which.max(v)
v[m] = -v[m]
m2=which.max(v)
result=c(m, m2)
result
}
Seems to work ok.
Thanks,
Esmail
2008 Jun 12
3
Adding new columns to (output) data - e.g., read 5 cols write 8
Hello, I have the following task I'd like to accomplish:
A file contains 5 columns of data (several hundred rows), let's call
them a, b, c, d and e (ie these are their column headers)
I also have a set of definitions, e.g.,
f = a + b
g = a * 3
h = c + d
etc.
I would like to write out a new .rda file that contains columns
a b c d e f g h etc.
I.e. , the original data plus new columns
2008 May 06
2
building a formula string bit by bit ..
Hello,
Still a newbie with R, though I have learned a lot from reading
this list. I'm hoping someone can help with this question:
I have two vectors, one for variables, and one for bits.
I want to build a string (really a formula) based on the values in my
vector of 1s and 0s in bits. If I have a one, I want to include the
corresponding entry in the vars vector, otherwise ignore it. Of
2008 Jun 11
3
searching for specific row in matrix
Hi,
I have matrix of bits and a target vector. Is there an
efficient way to search the rows of the matrix for the target?
I am interested in the first row index where target is found.
Example:
> source("lookup.R")
[,1] [,2] [,3] [,4] [,5]
[1,] 1 0 1 1 0
[2,] 1 1 0 1 0
[3,] 0 0 1 0 0
[4,] 1 0 0 1 1
[5,]
2012 Nov 09
1
Duda sobre modas en un distribución
Hola a tod en s, estoy intentando averiguar el número de modas en una
distribución. Para ello utilizo diptest. Mi duda es que no acabo de
entender cuando la información suministrada por los test suponen la
existencia o no de unimodalidad/multimodalidad. Una parte de la salidad de
diptest es la que pego a continuación (el resto esta en el fichero adjunto
con las distribuciones kernels y las
2008 May 07
1
Automatically generating new column names (and columns)
Once again I need to tap into the collective knowledge here.
Let's say I have the following columns and data below
Y X1 X2 X3 X4
I would like to generate additional new columns and column names
(ie the data would be squared - and I'd like the column names to
reflect this) like:
Y X1 X2 X3 X4 X1^2 X2^2 X3^2 X4^2
I believe I can compute the values correctly with the code below, but
I
2008 May 27
1
hash or other quick lookup function?
Hello all,
I have a matrix of bit values.
I compute certain values based on the bits in each row. There may be
*duplicate* entries in the matrix, ie several rows may be identical.
These rows change over time, and identical entries may not be next to
each other.
Computing these values is time consuming, so I would like a way to store a
value once it's computed. That way I would be able to
2007 Jan 31
1
Estimation of discrete unimodal density
Dear All,
A method for the estimation is univariate unimodal densities (with unknown
mode) is described in "Statistical Inference under Order Restrictions" by
Barlow et al.. Would anyone know whether there is an R-implementation
(preferably with reference) for the estimation of univariate discrete unimodal
densities (with unknown mode)? Thanks in advance for your help.
Kind
2009 Feb 18
2
how to randomly eliminate half the entries in a vector?
(sorry if this is a duplicate-problems with posting at my end)
----
Hello all,
I need some help with a nice R-idiomatic and efficient solution to a
small problem.
Essentially, I am trying to eliminate randomly half of the entries in
a vector that contains index values into some other vectors.
More details:
I am working with two strings/vectors of 0s and 1s. These will contain
about 200
2008 Apr 20
1
Java->R functions (or possibly C++ -> R)
Hello all,
I am trying to implement a simple Genetic Algorithm using some of the
functions of R (such as lm). I am a total newbie with regard to R, but
not programming or GAs.
I thought I would have to do this in R but now it seems there are ways
to call R functions from Java after all. (C++ would work for me too,
having a compiled language should speed up the program.)
Are there recommended
2009 Aug 28
1
breaking multi-modal histograms down into combinations of unimodal distributions
Dear All,
Does anybody know if there is a functionality in R to break histograms
that show a clear bi-modal (or multi-modal) distribution into a series
of unimodal histograms that added up result in the original histogram?
I was thinking of using QQ-plots (for which tools are available in R),
and then observing the number of times the observed quantiles cross
the 1:1 line, but this only gives an
2004 Mar 29
1
calculate length of gradient ?
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: by amavisd-new
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on hypatia.math.ethz.ch
X-Spam-Level: ****
X-Spam-Status: No, hits=4.2 required=5.0 tests=MSGID_FROM_MTA_HEADER,RCVD_IN_BL_SPAMCOP_NET autolearn=no version=2.63
Dear r-help list,
my question is about ordination technics:
2009 Aug 30
3
test for bimodality&In-Reply-To=
Has a test for bimodality been implemented in R?
Thanks, John
NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.
2008 May 10
2
Random number generation
Colleagues,
I have encountered behavior of random number generation that eludes me.
I generate a random integer in a particular range using the following
code:
sample(1000:9999, size=1)
This code exists within a script that starts with the command:
remove(list=ls())
Each time that I run the script, it yields the same random number:
6420.
I thought that the problem might result from
2010 Dec 20
4
Time Series of Histograms
Dear List,
I have a set of distributions recorded at an equal interval of time and I would like to plot them as series of horizontal histograms (with the x-axis representing time, and y-axis representing the bins) since the distribution shifts from unimodal to multimodal in several occasions. What I would like to see is something close to a violinplot, but I do not want a kernel density
2010 Jan 10
1
lme4 and function 'cholmod_start' not provided by package 'Matrix' / Ubuntu
Hello all,
Using Ubuntu 9.04 and R 2.8.1.
For a project I need to use the Zelig package, which in turn wants to
use the lme4 package. When trying to use Zelig and it tries to its required
packages I get the following error message.
Error in dyn.load(file, DLLpath = DLLpath, ...) :
function 'cholmod_start' not provided by package 'Matrix'
Error in loadModelDeps(model) :
2012 Apr 06
2
Bayesian 95% Credible interval
Hi all,
I have the data from the posterior distribution for some parameter. I want
to find the 95% credible interval. I think "t.test(data)" is only for the
confidence interval. I did not fine function for the Bayesian credible
interval. Could some one suggest me?
Thanks
[[alternative HTML version deleted]]
2009 May 28
1
optima in unimode
Dear all
i could not estimate the optima value or range value in unimodal plot in glm
please help me out
thanking you
regard
madan
_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
orial_WhatsNew1_052009
[[alternative HTML version deleted]]
2009 Feb 03
1
testing for bimodal distribution
I'm not sure where to begin with this, but I was wondering if someone could
refer me to an R package that would test to see if a distribution fits a
bimodal distribution better than a unimodal distribution.
Thanks,
Andrew
[[alternative HTML version deleted]]
2013 Jan 17
2
Explore patterns with GAM
Dear all,
I new to r and I would like your help.
I want to explore the patterns (unimodal, monotonically increased/decreased)
of species richness~altitude using GAM in R. Although I run the gam function
in mgcv package I do not know how to manually define knots and degrees of
freedom.
Any help would be greatly appreciated.
Spyros
--
View this message in context: