Displaying 2 results from an estimated 2 matches for "oldsum".
Did you mean:
old_sum
2009 Aug 19
3
R function for Probabilities for the (standard) normal distribution
...= 1/ 2 + ( 1/ sqrt(2¦Ð) ) * ¡Æ (-1)^k*z^(2k+1) / (2^k*k! *(2k+1))
(¡Æ is from n=0 to ¡Þ)
I know how to write the R function for exponential function e^x
expf = function (x)
{
x=ifelse((neg=(x<0)),-x,x)
n=0;term=1
oldsum=0; newsum=1
while(any(newsum != oldsum)) {
oldsum=newsum
n=n+1
term = term*x/n
newsum = newsum+term}
ifelse(neg, 1/newsum, newsum)
}
I know it will be similar to the above c...
2002 Nov 16
0
Wishlist: allow NA values in medpolish (package 'eda') (PR#2298)
...002
@@ -1,4 +1,5 @@
-medpolish <- function (x, eps=0.01, maxiter=10, trace.iter = TRUE)
+medpolish <- function (x, eps=0.01, maxiter=10, trace.iter = TRUE,
+ na.rm = FALSE)
{
z <- as.matrix(x)
nr <- nrow(z)
@@ -8,19 +9,19 @@
c <- numeric(nc)
oldsum <- 0
for(iter in 1:maxiter) {
- rdelta <- apply(z, 1, median)
+ rdelta <- apply(z, 1, median, na.rm = na.rm)
z <- z - matrix(rdelta, nr=nr, nc=nc)
r <- r + rdelta
- delta <- median(c)
+ delta <- median(c, na.rm = na.rm)
c <...