Displaying 12 results from an estimated 12 matches similar to: "Precision in R"
2007 Aug 30
2
Incomplete Gamma function
Hello
I am trying to evaluate an Incomplete gamma function
in R. Library Zipfr gives the Igamma function. From
Mathematica, I have:
"Gamma[a, z] is the incomplete gamma function."
In[16]: Gamma[9,11.1]
Out[16]: 9000.5
Trying the same in R, I get
> Igamma(9,11.1)
[1] 31319.5
OR
> Igamma(11.1,9)
[1] 1300998
I know I have to understand the theory and the math
behind it rather
2011 Jan 07
4
how to calculate this natural logarithm
Hello
I want to calculate natural logarithm of sum of combinations as follow: (R code)
{
com_sum=choose(2000000,482)*choose(1000000,118)+choose(2000000,483)*choose(1000000,117)+...+choose(2000000,i)*choose(1000000,600-i)+...+choose(2000000,600)*choose(1000000,0) #calculate the sum
result=log(com_sum) #calculate the log of the sum
}
But
2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello
I have a time-comsuming program which need to simplify, I have tested the annotated program as follow:
> #define function which will be call
> calsta <- function(c, n=100000)
+ {
+ i <- seq(from=0, length=c)
+ logx <- lchoose(NT-n, CT-i) + lchoose(n, i)
+ logmax <- max(logx)
+ logmax + log(sum(exp(logx - logmax)))
+ }
> CT=6000 #assignment to CT
>
2013 Nov 04
1
ggplot2: Add '+' operator for aes (uneval) objects
Dear all,
Is there a reason, why there is no +-operator for aes (i.e. uneval) objects (as there is for themes and gg objects)? I had a couple of cases where such an operator would be useful, for instance to combine the result of aes and aes_string in functions. Any flaws with the following proposition:
`+.uneval` <- function(e1, e2) {
dup <- names(e1) %in% names(e2)
if (any(dup)) {
2010 Apr 02
1
All sub-summands of a vector
Hello,
I'd like to take all possible sub-summands of a vector in the quickest and
most efficient way possible. By "sub-summands" I mean for each sub-vector,
take its sum. Which is to say: if I had the vector
x<-1:4
I'd want the "sum" of x[1], x[2], etc. And then the sum of x[1:2], x[2:3],
etc. And then...so on.
The result would be:
1 2 3 4
2 5 7
6 9
10
I can
2009 Aug 01
4
Likelihood Function for Multinomial Logistic Regression and its partial derivatives
Hi,
I would like to apply the L-BFGS optimization algorithm to compute the MLE
of a multilevel multinomial Logistic Regression.
The likelihood formula for this model has as one of the summands the formula
for computing the likelihood of an ordinary (single-level) multinomial logit
regression. So I would basically need the R implementation for this formula.
The L-BFGS algorithm also requires
2024 Jan 15
2
cwilcox - new version
I am a newbie to C (although I did some programming in Perl and Pascal) so
forgive me for the language that follows. I am writing because I have a
question concerning the *implementation of *(the internal function)*
cwilcox* in
https://svn.r-project.org/R/!svn/bc/81274/branches/R-DL/src/nmath/wilcox.c.
This function is used to determine the test statistics of the
Wilcoxon-Mann-Whitney U-test.
2000 Sep 25
1
No subject
Dear friends. In Carlin and Louis "Bayes and emperical Bayes methods.."
1996 the classical example of 12 independent tosses of a fair coin
producing 9 heads and 3 tails is given. If the situation is seen as a fixed
sample of 12, a binomial lieklihood is used, and Carlin et al reports a
probability of 0.075.
Using sum(dbinom(9:12,12,.5)) I obtain 0.073
Likewise, if the experiment is
2004 Jul 22
2
Standard error of a sum
Folks,
This is so simple is driving me crazy. It's not really an R question is
more an Statistics question.
I applied a chemical in 3 different events during a growing season. I
took 3 samples in each event to estimate mean applied chemical.
Thus, I can easily estimate means and st.err by event. I can then
estimate the total chemical applied for the whole season by adding the 3
means
2011 Feb 12
1
how to improve the precison of this calculation?
Hello
T
I want to order some calculation "result", there will be lots of "result" that need to calculate and order
PS: the "result" is just a intermediate varible and ordering them is the very aim
# problem:
# For fixed NT and CT, and some pair (c,n). order the pair by corresponding result
# c and n are both random variable
CT<-6000 #assignment to CT
2009 Feb 16
2
solve.QP with box and equality constraints
Dear list,
I am trying to follow an example that estimates a 2x2 markov transition
matrix across several periods from aggregate data using restricted least
squares.
I seem to be making headway using solve.QP(quadprog) as the unrestricted
solution matches the example I am following, and I can specify simple
equality and inequality constraints. However, I cannot correctly specify a
constraint
2009 Dec 07
4
Subset sum problem.
Hi,
I'm quite new to the R-project. I was suggested to look into it because I am
trying to solve the "Subset sum" problem", which basically is:
Given a set of integers and an integer s, does any non-empty subset sum to s?
(See http://en.wikipedia.org/wiki/Subset_sum_problem)
I have been searching the web for quite some time now (which is how I
eventually discovered that my