Displaying 20 results from an estimated 200 matches similar to: "how to calculate this natural logarithm"
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
>
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
2003 Oct 22
1
: Prediction interval for a Gaussian family log-link model
Hi there fellow R-users,
Can anyone tell me how to build a prediction interval for a gaussian
log-link model for the reponse variable??
I can find the standard error of the predictions but I cant seem to find the
prediction interval. Is there a way I can calculate the
prediction interval from the standard errors??
Here's the example:
logX<-rnorm(100)
2010 Aug 26
3
Using termplot() with transformations of x
Hi all
I was playing with termplot(), and came across what appears to be an inconsistency.
It would appreciate if someone could enlighten me:
> # First, generate some data:
> y <- rnorm(100)
> x <- runif(length(y),1,2)
> # Now find the log of x:
> logx <- log(x)
>
> # Now fit two models that are exactly the same, but specified differently:
> m1 <-
2009 Dec 15
3
RFC: lchoose() vs lfactorial() etc
lgamma(x) and lfactorial(x) are defined to return
ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively.
Unfortunately, we haven't chosen the analogous definition for
lchoose().
So, currently
> lchoose(1/2, 1:10)
[1] -0.6931472 -2.0794415 NaN -3.2425924 NaN -3.8869494
[7] NaN -4.3357508 NaN -4.6805913
Warning message:
In
2011 Jan 03
3
matrices call a function element-wise
Hello
I have 4 1000*1000 matrix A,B,C,D. I want to use the corresponding element of the 4 matrices. Using the "for loop" as follow:
E<-o
for (i in 1:1000)
{for (j in 1:1000)
{
E<-fisher.test(matrix(c(A[i][j],B[i][j],C[i][j],D[i][j]),2))#call fisher.test for every element
}
}
It is so time-consuming
Need vectorization
Yours sincerely
ZhaoXing
Department of
2007 Nov 05
1
Help with cochran.test
Hi,
I have been trying to use the function cochran.test from the Outliers
package to test for homogeneity of variance. This works well except when
I use transformed data. Would anyone have an idea why it doesn't work
and how I could do the cochran test on transformed data?
Thanks,
Stephanie
>library(outliers)
> set.seed(1234)
> x=rnorm(100)
>
2010 Jan 12
1
barplot: border color when stacked
Dear R-users,
I am using R version 2.10.1 under windows.
In a barplot, I want to mark one of the bars with a special border color.
For example:
barplot(c(3, 7, 11), border = c(NA, "red", NA))
But how to do this when the bars are stacked?
for example:
barplot(matrix(1:6, ncol=3)) # border of second bar (i.e. the one with total height = 7) should be red again, I try:
barplot(matrix(1:6,
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
> include/Rmath.h declares a set of 'logspace' functions for use at the C
> level. I don't think there are core R functions that call
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very
small p-values (although the example below may win some kind of a prize:
I've seen people talking about p-values of the order of 10^(-2000), but
never 10^(-(10^8)) !). That said, there are a several tricks for
getting more reasonable sums of very small probabilities. The first is
to scale the p-values by dividing the
2004 Sep 30
1
Vectorising and loop (was Re: optim "a log-likelihood function")
>From: Sundar Dorai-Raj <sundar.dorai-raj at PDF.COM>
>Reply-To: sundar.dorai-raj at PDF.COM
>To: Zhen Pang <nusbj at hotmail.com>
>CC: r-help at stat.math.ethz.ch
>Subject: Vectorising and loop (was Re: [R] optim "a log-likelihood
>function")
>Date: Wed, 29 Sep 2004 18:21:17 -0700
>
>
>
>Zhen Pang wrote:
>
>>
>>I also use
2008 Feb 27
1
dhyper, phyper (PR#10853)
Aloha all,
I know too little about what I'm about to write and hope I'm not
wasting your time.
For a class I'm teaching in archaeological data analysis, I'm trying
to put together a routine that calculates the so-called Petersen
index and, especially, confidence intervals for the index. This was
introduced to archaeologists by N.R.J. Fieller and A. Turner in an
article
2019 Jun 24
1
Calculation of e^{z^2/2} for a normal deviate z
>>>>> jing hua zhao
>>>>> on Mon, 24 Jun 2019 08:51:43 +0000 writes:
> Hi All,
> Thanks for all your comments which allows me to appreciate more of these in Python and R.
> I just came across the matrixStats package,
> ## EXAMPLE #1
> lx <- c(1000.01, 1000.02)
> y0 <- log(sum(exp(lx)))
> print(y0) ## Inf
2011 Jan 11
1
how to use "apply" function partial to each vector of a matrix
Hello
Suppose I have a matrix mat=(1:16,2)
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
I just want to use the "apply" function to the matrix partially
there is a vector end=c(2,3,1,3)
#sum the 1st 2 numbers of the 1st column
#sum the 1st 3 numbers of the 2nd column
#sum the 1st number of the 3rd column
2011 Jan 11
1
how to coerce part of each column of a matrix to a vector and merge them
Hello
Suppose I have a matrix mat=(1:16,2)
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
there is a vector end=c(2,3,1,3)
#coerce the 1st 2 numbers of the 1st column to a vector [1] 1 2
#coerce the 1st 3 numbers of the 2nd column and append it to the previous vector [1] 1 2 5 6 7
#coerce the 1st number of
2014 Mar 19
2
Issue on DEBUG statement
Hi,
I was running samba-4.1.4 successfully on my fedora till the below issue occurs.
I had put some simple DEBUG statements in "lib/util/debug.c" (reopen_logs_internal() and some other funcs) file to understand the logging mechanism.
And the same is compiled fine without any issues. And I started my samba service(both nmbd and smbd), I got "(core dumped) segmentation fault"
2008 Feb 18
2
Huge number
Hi,
I'm trying to calculate p-value to findout definitely expressed genes
compare A to B situation.
I got this data(this is a part of data) from whole organism , and each
number means each expression values (that means, we could think 'a' gene
is 13 in A situation, and it turns 30 in B situation)
To findout probability, I'm going to use Audic - Claverie Method. ( The
significance
2006 Jan 05
4
ylim problem in barplot
R Version 2.2.0
Platform: Windows
When I use barplot but select a ylim value greater than zero, the graph
is distorted. The bars extend below the bottom of the graph.
For instance the command produces a problematic graph.
barplot(c(200,300,250,350),ylim=c(150,400))
Any help would be appreciated.
Paul
[[alternative HTML version deleted]]
2020 Jan 14
4
[R] choose(n, k) as n approaches k
OK, I see what you mean. But in those cases, we don't get the catastrophic failures from the
if (k < 0) return 0.;
if (k == 0) return 1.;
/* else: k >= 1 */
part, because at that point k is sure to be integer, possibly after rounding.
It is when n-k is approximately but not exactly zero and we should return 1, that we either return 0 (negative case) or n
2020 Jan 14
2
[R] choose(n, k) as n approaches k
> On 14 Jan 2020, at 16:21 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> On 14/01/2020 10:07 a.m., peter dalgaard wrote:
>> Yep, that looks wrong (probably want to continue discussion over on R-devel)
>> I think the culprit is here (in src/nmath/choose.c)
>> if (k < k_small_max) {
>> int j;
>> if(n-k < k