search for: 1e3

Displaying 20 results from an estimated 87 matches for "1e3".

Did you mean: 13
2012 Sep 01
2
Computing 'exp(1e3)*0' correctly....
I have some trouble to deal the value of 'NaN'. For example, > exp(1e3) [1] Inf > exp(1e3)*0 [1] NaN The correct answer should be 0 rather than NaN. I will very appreciate if anyone can share some technique to get a correct answer.
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
...a^b f(x) dx where the integrand f: x in IR -> f(x) in IR^p is vector-valued. integrate() only allows scalar integrands, thus I would need to call it many (p=200 typically) times, which sounds suboptimal. The cubature package seems well suited, as illustrated below, library(cubature) Nmax <- 1e3 tolerance <- 1e-4 integrand <- function(x, a=0.01) c(exp(-x^2/a^2), cos(x)) adaptIntegrate(integrand, -1, 1, tolerance, 2, max=Nmax)$integral [1] 0.01772454 1.68294197 However, adaptIntegrate appears to perform quite poorly when compared to integrate. Consider the following example (one-dime...
2008 Jul 17
2
Sampling distribution (PDF & CDF) of correlation
...{ Sigma=matrix(c(1,rho,rho,1),2,2) eS = eigen(Sigma, symmetric = TRUE, EISPACK = TRUE) ev = eS$values fact = eS$vectors %*% diag(sqrt(pmax(ev, 0)), 2) Z = rnorm(2 * N * it) dim(Z) = c(2, N * it) Z = t(fact %*% Z) x = Z[, 1] y = Z[, 2] r = sapply(1:it ,get.cors,x, y, N) return(r) } #Run 1e3 monte carlo iterations, where each obtains the correlation # of 10 pairs of observations from a bivariate normal distribution with # a true correlation of .5. Returns 1e3 values for the observed correlation mc.rs = get.r.dist( N=10 , rho=.5 , it=1e3 ) #plot the PDF & CDF par(mfrow=c(1,2)) hi...
2011 Nov 22
1
arima.sim: innov querry
...d x2 are similar white noise processes with a mean of 5 and a standard deviation of 1. I thought x3 should be an AR1 process but still have a mean of 5 and a sd of 1. Why does x3 have a mean of ~7? Obviously I'm missing something fundamental about the burn in or the innovations. x1 <- rnorm(1e3,mean=5,sd=1) summary(x1) x2 <- arima.sim(list(order=c(0,0,0)),n=1e3,mean=5,sd=1) summary(x2) x3 <- arima.sim(list(order=c(1,0,0),ar=0.3),n=1e3,mean=5,sd=1) summary(x3) # why does x3 have a mean of ~7?
2016 Oct 28
2
Encontrar la primera columna no NA
...p(NA , numero /2e1 )) , size = numero ) , cuatro = sample( c(runif(numero) , rep(NA , numero /1e2 )) , size = numero ) , cinco = sample( c(runif(numero) , rep(NA , numero /2e2 )) , size = numero ) , seis = sample( c(runif(numero) , rep(NA , numero /1e3 )) , size = numero ) ) First_month <- apply(X = dat, MARGIN = 1, FUN = function(x){ return( min( which( !is.na(x) ), na.rm = TRUE ) ) } ) dat[ , First_month := First_month] N_for <- length( unique(Fi...
2020 Sep 08
4
Operations with long altrep vectors cause segfaults on Windows
...#39; related bug inside .Internal(inspect(.)) on Windows. *interestingly*, the above bug I've noticed on (64-bit) Linux does *not* show on Windows (64-bit), at least not for that case: On Windows, things are fine as long as they remain (compacted aka 'ALTREP') INTSXP: > y <- -1e3:2e9 ;.Internal(inspect(y)) @0x000000000a285648 13 INTSXP g0c0 [REF(65535)] -1000 : 2000000000 (compact) > y <- -1e3:2.1e9 ;.Internal(inspect(y)) @0x0000000019925930 13 INTSXP g0c0 [REF(65535)] -1000 : 2100000000 (compact) and here, y is correct, just the printing from .Internal(inspe...
2010 Jan 11
1
Help me! using random Forest package, how to calculate Error Rates in the training set ?
now I am learining random forest and using random forest package, I can get the OOB error rates, and test set rate, now I want to get the training set error rate, how can I do? pgp.rf<-randomForest(x.tr,y.tr,x.ts,y.ts,ntree=1e3,keep.forest=FALSE,do.trace=1e2) using the code can get oob and test set error rate, if I replace x.ts and y.ts with x.tr and y.tr,respectively, is the error rate in the training set ? pgp.rf<-randomForest(x.tr,y.tr,x.tr,y.tr,ntree=1e3,keep.forest=FALSE,do.trace=1e2) this time, I get o...
2001 Nov 06
1
R-devel & ATLAS generates Dr. Watson on NT (was RE: Look, Wa tson! La.svd & ATLAS)
...versions of ATLAS 3.2.1. One was compiled on my old Thinkpad 600E (PII), the other was compiled on my new Thinkpad T22 (PIIISSE1). I compiled R-devel dated 10/31, 11/01 and 11/04, linked against either of the two ATLAS libs. All gave Dr. Watson when given this code: La.svd(matrix(runif(1e5), 1e3, 1e2)) (There's no problem with smaller matrices, say 100x100.) When compiled without ATLAS, the above code ran fine in all three R-devel's. I tried R-1.3.1 with both ATLAS libs, and both ran fine. Any ideas on what could be wrong? Seems like R-devel doesn't like ATLAS, at least on...
2001 Nov 02
1
Look, Watson! La.svd & ATLAS
...()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R. > set.seed(1) > x <- matrix(runif(1e4), 1e2, 1e2) > invisible(La.svd(x)) # This ran fine. > x <- matrix(runif(1e5), 1e3, 1e2) > invisible(La.svd(x)) (Dr. Watson says there's an access violation.) So far La.svd is the only thing I know of that generates Dr. Watson. The version info: _ platform i386-pc-mingw32 arch x86 os Win...
2004 Sep 03
1
how to debug a sudden exit in non-interactive mode
...ly know that it has something to do with me loading my custom library, vor, in .Rprofile. I use R-1.9.1 on RH7.3. Following the posting guide I include an example (note that it may work for you fine since you don't have my .Rprofile). This is debug.R file: #============= dataLength <- 1e3 y <-rnorm(dataLength) x <- rnorm(dataLength) library("mgcv") cat("before\n") xy.gam <- gam(y ~ s(x), knots=list(place.knots(x, 25)), fit=FALSE) cat("after\n") # Here I run it non-interactively from the shell. Note that the last line, cat("af...
2016 Oct 27
4
Encontrar la primera columna no NA
...o /2e1 )) , size = numero ) , cuatro = sample( c(runif(numero) , rep(NA , numero /1e2 )) , size = numero ) , cinco = sample( c(runif(numero) , rep(NA , numero /2e2 )) , size = numero ) , seis = sample( c(runif(numero) , rep(NA , numero /1e3 )) , size = numero ) ) apply(X = dat, MARGIN = 1, FUN = function(x){ return( min( which( !is.na(x) ), na.rm = TRUE ) ) } ) dat[ , First_month := First_month] N_for <- length( unique(First_month )) for( j in...
2012 Feb 02
1
pgfSweave doesn't lazyload my objects
...king something obvious. Below is my .Rnw and sessionInfo. Pointers, suggestions, etc are most welcome. %%%%%%%%%%%%%%% RNW; test_png.Rnw %%%%%%%%%%%%%%%%%%%%%% \documentclass{article} \begin{document} some bla bla text <<large-chunk-no-cache, cache=false>>= mm1 <- matrix(1:1e7, 1e3, 1e4) @ <<c2>>= print(length(mm1)) @ <<large-chunk-do-cache, cache=true>>= mm2 <- matrix(1:1e7, 1e3, 1e4) @ <<c4>>= print(length(mm2)) @ \end{document} %%%%%%%%%%%%%%%%% END RNW %%%%%%%%%%%%%%%%%% I am running the folowing R command: pgfSweave('test...
2009 Dec 06
2
Error in eval(expr, envir, enclos) : object 'N' not found
...n be causing this? I have no object 'N' anywhere in the script. I made an identical version of models states, parameters, and everything just by adding 2 after each one, and I'm still getting this error. Thanks, -Hans ::CODE:: require(odesolve); ###Params for running script ## iniT=1E3; iniN=10; iniM=0; iniC=1E3; num_days = 30; interval_size = .1; OF_prcnt = .10; model <- function(t, state, pars) { with (as.list(c(state, pars)), { dT=(a*T-a*T*b*T) - (c1*N*T) - (Kt*M*T) dN=a1 - (f*N) + g * (T/(h+T)) * N - (p * N * T) - (Kn * M * N) dC=a2 - (beta * C) - (Kc * M * C) dM=...
2020 Sep 08
2
[External] Re: Operations with long altrep vectors cause segfaults on Windows
...gt;> *interestingly*, the above bug I've noticed on (64-bit) Linux >> does *not* show on Windows (64-bit), at least not for that case: >> >> On Windows, things are fine as long as they remain (compacted >> aka 'ALTREP') INTSXP: >> >> > y <- -1e3:2e9 ;.Internal(inspect(y)) >> @0x000000000a285648 13 INTSXP g0c0 [REF(65535)] -1000 : 2000000000 (compact) >> > y <- -1e3:2.1e9 ;.Internal(inspect(y)) >> @0x0000000019925930 13 INTSXP g0c0 [REF(65535)] -1000 : 2100000000 (compact) >> >> and here, y is corr...
2010 Nov 05
0
User defined function and nonlinear least-squares fit
...rectangular functions with an offset dx f <- function (x, x0=0, P=2, w=0.5, dx=1) { .f <- function(.x, .dx=dx, .P=P, .w=w) g(x=(x0+.x), P=.P, w=.w) + g(x=(x0+.x+dx), P=.P, w=.w) return( unlist(lapply(x, .f))) } # generate a data set dataset <- curve(f(x, dx=0.65), 1, 5, n=1e3) # add some noise dataset$x <- dataset$x + rnorm(1e3, 0, 0.02) dataset$y <- dataset$y + rnorm(1e3, 0, 0.05) points(dataset, type='p', cex=0.67, col='blue') # trying to fit only one parameter fit1 <- nls( y ~ f(x, x0=0, P=2, w=0.5, dx), start = list(dx=0....
2003 Nov 26
0
RE: 64-bit R on Opteron [was Re: [R] Windows R 1.8.0 hangs when M em Usage >1.8GB]
> From: Douglas Bates > > How does the Opteron perform on floating point? Can you try something > like > > > mm = matrix(rnorm(1e6), nc = 1e3) > > system.time(crossprod(mm)) > [1] 0.51 0.02 0.53 0.00 0.00 > > system.time(crossprod(mm)) > [1] 0.37 0.03 0.40 0.00 0.00 > > system.time(crossprod(mm)) > [1] 0.38 0.02 0.40 0.00 0.00 > > system.time(crossprod(mm)) > [1] 0.38 0.02 0.40 0.00 0.00 > > (Th...
2015 Jan 02
3
Benchmark code, but avoid printing
Dear all, I am trying to benchmark code that occasionally prints on the screen and I want to suppress the printing. Is there an idiom for this? If I do sink(tempfile) microbenchmark(...) sink() then I'll be also measuring the costs of writing to tempfile. I could also sink to /dev/null, which is probably fast, but that is not portable. Is there a better solution? Is writing to a
2020 Sep 08
1
[External] Re: Operations with long altrep vectors cause segfaults on Windows
...the above bug I've noticed on (64-bit) Linux >> does *not* show on Windows (64-bit), at least not for that case: >> >> On Windows, things are fine as long as they remain (compacted >> aka 'ALTREP') INTSXP: >> >> > y <- -1e3:2e9 ;.Internal(inspect(y)) >> @0x000000000a285648 13 INTSXP g0c0 [REF(65535)] -1000 : 2000000000 (compact) >> > y <- -1e3:2.1e9 ;.Internal(inspect(y)) >> @0x0000000019925930 13 INTSXP g0c0 [REF(65535)] -1000 : 2100000000 (compact) >> >> and...
2006 Feb 14
2
How to access values returned by R functions (to put into vectors)?
...correlated variables: C <- c(457, 1371, 4113, 12339, 37017, 111051, 333153, 999459) E <- c(0.003858377, 0.014334578, 0.014092836, 0.737950754, 0.996371828, 0.997482379, 1.005569257, 0.994382856) # The nls function: A = nls(E~(Em*C^p)/(C50^p + C^p), start = list(Em=0.8, p=3, C50=1e3)) # Returns the following parameter estimates for Em, p and C50: Nonlinear regression model model: E ~ (Em * C^p)/(C50^p + C^p) data: parent.frame() Em p C50 0.9989113 4.7957189 9934.6481397 residual sum-of-squares: 0.0002856567 How do...
2016 Oct 27
2
Encontrar la primera columna no NA
...numero) , rep(NA , numero /2e1 )) , size = numero ) , cuatro = sample( c(runif(numero) , rep(NA , numero /1e2 )) , size = numero ) , cinco = sample( c(runif(numero) , rep(NA , numero /2e2 )) , size = numero ) , seis = sample( c(runif(numero) , rep(NA , numero /1e3 )) , size = numero ) ) t <- Sys.time() First_month <- dat %>% apply( MARGIN = 1, FUN = function(x){ which( !is.na(x) ) %>% min( na.rm = TRUE ) %>% return() } ) First_month %>% table %>% prop.table dat[ , First_month...