search for: nboot

Displaying 20 results from an estimated 72 matches for "nboot".

Did you mean: boot
2010 Jul 20
1
p-values pvclust maximum distance measure
...F showing the results Here is the code which produces the PDF file: ------------------------------------------------------------------------------------- s <- matrix(runif(1600,0,1000), nrow=20) a.res1 <- pvclust(t(s), method.hclust="complete", method.dist="euclidian", nboot=500) a.res2 <- pvclust(t(s), method.hclust="complete", method.dist="maximum", nboot=500) a.res3 <- pvclust(t(s), method.hclust="complete", method.dist="canberra", nboot=500) a.res4 <- pvclust(t(s), method.hclust="ward", method.dist="eu...
2007 Nov 01
1
loops & sampling
.... After which we would start the process again by remove 20 samples from our data with replacements from the remaining 230 records and so on... Below is a simplified version of the real code which contains most of the basic elements. My main problem is I'm not sure what the 'for(i in 1:nboot)' line is doing, originally I though what this meant was that it removed 1 sample or record from the data which was replaced by a copy of one of the records from the remaining n, such that 'for(i in 10:nboot)' when used in the context of the below code removed 10 samples with replacemen...
2012 Jan 19
1
snow - bootstrapped correlation ranking
I wonder if someone could help me adjusting the following code to parallelized snow code: #Creating a data set (not needed to be parallel) n<-100 p<-100 x<-matrix(rnorm(n*p),p) y<-rnorm(n) # Bootstrapping nboot<-1000 alpha<-0.05 rhoboot <- array(0, dim=c(p,nboot)) bootranks <- array(0, dim=c(p,nboot)) bootsamples <- array( floor(runif(n*nboot)*n+1), dim=c(n,nboot)) for (i in 1:nboot){ rhoboot[,i] <- cor(y[bootsamples[,i]],x[bootsamples[,i],]) bootranks[,i] <- p+1rank(abs(rhoboot[,i]))...
2018 May 21
2
Bootstrap and average median squared error
...lt;-c(12,14,13,24,25,34,45,56,25,34,47,44,35,24,53,44,55,46,36,67) bmi <-c(34,32,12,76,54,34,21,18,92,32,11,13,45,46,56,57,67,87,12,13) glucose <-c(23,54,11,12,13,21,32,12,45,54,65,87,21,23,12,12,23,23,43,54) # Create a list to store the results lst<-list() # Numbers of bootstrap samples nboot=100 bootstrap.MedAESQ =rep(NA,nboot) for(i in 1?:nboot) { fit <- rq( crp ~ bmi+glucose, tau = 0.5) ypred=predict(fit) y=new$crp bootstrap.MedAESQ [i]=median(y-ypred)^2 lst[i]<-bootstrap.MedAESQ } mean(unlist(lst)) ################################### ?
2011 May 16
1
Matrix manipulation in for loop
Hi all, I have a problem with getting my code to do what I want! This is the code I have: create.means.one.size<-function(nsample,var,nboot){ mat.x<-matrix(0,nrow=nboot,ncol=nsample) for(i in 1:nboot){ mat.x[i,]<-sample(var,nsample,replace=T) } mean.mat<-rep(0,nboot) for(i in 1:nboot){ mean.mat[i]<-mean(mat.x[i,]) } sd.mean<-sd(mean.mat) return(mean.mat) } where nsample here is a scalar. Then this is where I have...
2018 May 22
0
Bootstrap and average median squared error
....frame, see how you could do it. library(boot) bootMedianSE <- function(data, indices){ d <- data[indices, ] fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) ypred <- predict(fit) y <- d$crp median(y - ypred)^2 } dat <- data.frame(crp, bmi, glucose) nboot <- 100 medse <- boot(dat, bootMedianSE, R = nboot) medse$t0 mean(medse$t) # This is the value you want Hope this helps, Rui Barradas On 5/22/2018 12:19 AM, varin sacha via R-help wrote: > Dear R-experts, > > I am trying to bootstrap (and average) the median squared error...
2011 Apr 03
2
:HELP
Hello, &nbsp; I want to sum first three terms of each column of matrix. But I don't calculate with "apply" function. &nbsp; skwkrt&lt;-function(N=10000,mu=0,sigma=1,n=100, nboot=1000,alpha=0.05){ x&lt;-rnorm(N,mu,sigma)#population samplex&lt;-matrix(sample(x,n*nboot,replace=T),nrow=nboot) #... } &nbsp; is that: suppose a is a 5x2 matrix. &nbsp;a={1,2,3,4,5 6,7,8,9,10} &nbsp; I want to sum first three terms. sm[1]=1+2+3 sm[2]=6+7+8 But I don't calc...
2012 Oct 12
1
ks.test not working?
Hi, I am performing GEV analysis on temperature/precipitation data and want to use the ks.boot function but I am unsure of how to implement it using the pgev distribution. For example: ks.test(data,pgev,shape,location,scale) ks.boot(data,(distribution parameters?),alternative="pgev",nboots=1000) Any advice? Apologies in advance if I have used the wrong email address. Regards, Louise Wilson Louise Wilson Climate Projections Project Officer CSIRO Climate Adaptation Flagship National Resource Management (NRM) Pacific-Australia Climate Change Science and Adaptation Planning Program (...
2011 Feb 24
1
parallel bootstrap linear model on multicore mac (re-post)
...nt, commented code. I have been ramming my head against this problem, and I wondered if anyone could lend a hand. I want to make parallel a bootstrap of a linear mixed model on my 8-core mac. Below is the process that I want to make parallel (namely, the boot.out<-boot(dat.res,boot.fun, R = nboot) command). This is an extension to lmer of the bootstrapping linear models example in Venables and Ripley. Please excuse my rather terrible programming skills. I am always open to suggestions. Below the example I describe what methods I have tried. library(boot) library(lme4) dat<-read.tabl...
2006 Oct 23
1
Lmer, heteroscedasticity and permutation, need help please
...oscedasticity ? 4/ A last question concerning SAS. My model appears to not converge in SAS, indicating a "structure" in the variance. Is it implying something in lmer or lme ? Many Thanks Here is the function for the permutation : permut<-function(data,vardep,var1,var2,var.random,nboot=10){ # initialisation ms.var1<-numeric(length=nboot) ms.var2<-numeric(length=nboot) ms.var3<-numeric(length=nboot) var1.permut<-numeric(length=length(var1)) var2.permut<-numeric(length=length(var2)) var3.permut<-numeric(length=length(var2)) var1<-factor(var1) var2<-factor(v...
2005 Jun 23
1
errorest
...t(ytrain ~., data=mydata, model=lda, estimator=c("boot","632plus"), predict=mypredict.lda)$error It didn't work. I then tried the following two commands: ce632[i]<-errorest(ytrain ~., data=mydata, model=lda, estimator=c("632plus"), est.para=control.errorest(nboot=B), predict=mypredict.lda)$error ceLOOB[i]<-errorest(ytrain ~., data=mydata, model=lda, estimator=c("cv"), est.para=control.errorest(k=cv.k,nboot=B), predict=mypredict.lda)$error They worked. However, as I didn't specify "boot" in estimator, I am wondering if "b...
2008 Dec 03
1
help on tapply using sample with differing sample-sizes
...here is another way to accomplish what I want to do. Perhaps, tapply is not the best way to go about getting what I want. if so what would all you strong programmers reccommend instead. I am thinking that perhaps loops may be the only way to go. raoboot <- function (datavar, statavar, weight, nboot, ciqntl, ciqntu) { i <- 1 sdatavar <- sort(datavar) sstratavar <- sort(statavar) sweight <- sort(weight) sdatavarwght <- sdatavar*sweight # stramn <- tapply(sdatavar, sstratavar, mean) meanvect <- rep(0, times = nboot) stratasize <- tapply(sdatavarwght, sstratavar, le...
2011 Feb 23
0
parallel bootstrap linear model on multicore mac
People of R(th), I have been ramming my head against this problem, and I wondered if anyone could lend a hand. I want to parallelize a bootstrap of a linear model on my 8-core mac. Below is the process that I want to parallelize (namely, the m2.ph.rlm.boot<-boot(m2.ph,m2.ph.fun, R = nboot) command). This is an extension of the bootstrapping linear models example in Venables and Ripley to lmer. Please excuse my rather terrible programming skills. I am always open to suggestions. Below the example I describe what methods I have tried (which is the reason for all of the unnecessar...
2018 May 22
2
Bootstrap and average median squared error
...> bootMedianSE <- function(data, indices){ > ??? d <- data[indices, ] > ??? fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) > ??? ypred <- predict(fit) > ??? y <- d$crp > ??? median(y - ypred)^2 > } > > dat <- data.frame(crp, bmi, glucose) > nboot <- 100 > > medse <- boot(dat, bootMedianSE, R = nboot) > > medse$t0 > mean(medse$t)??? # This is the value you want > > > Hope this helps, > > Rui Barradas > > > > On 5/22/2018 12:19 AM, varin sacha via R-help wrote: >> Dear R-experts, &...
2001 Nov 29
0
ltsreg warnings (PR#1184)
...e ########## library(bootstrap) data(cell) names(cell) attach(cell) library(lqs) plot(V1, V2) fred <- ltsreg(V2 ~ V1 + I(V1^2)) curve(predict(fred, data.frame(V1 = x)), add = TRUE) coefficients(fred) beta1.hat <- coefficients(fred)[2] beta2.hat <- coefficients(fred)[3] n <- length(V1) nboot <- 1000 beta1.star <- double(nboot) beta2.star <- double(nboot) for (i in 1:nboot) { k <- sample(1:n, replace = TRUE) x.star <- V1[k] y.star <- V2[k] sally <- ltsreg(y.star ~ x.star + I(x.star^2)) curve(predict(sally, data.frame(x.star = x)), add = T...
2006 Jul 06
0
pvclust Error:NA/NaN/Inf in foreign function call (arg 11)
...gain, high level amplification, or loss respectively Based on the documentation for the pvclust package I came up with this code. >ProgenetixCRC.all.pvclust <- pvclust(ProgenetixCRC.all, method.dist="cor", method.hclust="average",use.cor="pairwise.complete.obs",nboot=1000) this results in the following error Bootstrap (r = 0.5)... Error in hclust(distance, method = method.hclust) : NA/NaN/Inf in foreign function call (arg 11) In addition: Warning message: the standard deviation is zero in: cor(x, y, na.method, method == "kendall" I'm not real...
2008 Apr 13
0
R project
...termine which test is required to sample the observations if(test=="t"){ #t-test res<-t.test(dat,alternative="two.sided",mu=H0) } else if(test=="Wilcoxon"){ res<-wilcox.test(dat,alternative="two.sided",mu=H0) } else { nboot<-(K-1) n<-length(dat) bootmean<-NULL for(i in 1:nboot){ rdata<-sample(dat,n,replace=T) bootmean[i]<-mean(rdata) } nlo<-round((nboot+1)*(alpha/2)) nhi<-round((nboot+1)*((1-alpha)/2)) bootmean<-sort(bootmean) low&...
2019 Jun 02
3
Incluir un rango de varias variables explicativas a un modelo
...ya todas las variables de pot23 a pot80 en una ecuación. He intentado lo siguiente, pero no funciona: > pots <- paste("pot",23:321, sep="") > eqreg2 <- lwage~SEXO+EDAD+HLENGUA+ESCOACUM+marr+wageszm14[,pots] > fit <- qregspiv(eqreg2, shpfile = zm15, tau = 0.5, nboot = 70, data = wageszm14) Error: Can't find columns `pot24`, `pot25`, `pot26`, `pot27`, `pot28`, ... (and 273 more) in `.data`. De igual forma, después estaría interesado en obtener el logaritmo de todas esas variables pot~ Gracias de antemano por cualquier tipo de ayuda. -- Rol~ [[alternat...
2012 Nov 14
2
error data frame
...3,=1.-3.row or else) > Fish89PCA [1:3,] StationCode PCA1 1 DE582 -1.5592527 2 DE38 0.3530658 3 FR02116570 2.8057854 > > names (Fish89PCA) [1] "StationCode" "PCA1" > Fish89TiTAN <- titan(Fish89PCA, Fish89Abund, minsplt=5, + numprm=250, nboot=500, boot=TRUE, deviance=TRUE) [1] "Taxa frequency screen complete" [1] "Function definition complete" Error in is.data.frame(x) : subscript out of bounds This essror mesage is killing me. I checked the data tables and the internet, but nowhere any satisfying answer. Can anybo...
2003 Jul 17
0
Silverman modality test
...nbmodes (x, winN) winN1 <- winN if (modes > n) { minw <- winN winN <- (winN + maxw)/2 } else { maxw <- winN winN <- (winN - minw)/2 } } return (winN) } silversignif <- function (x, m, nboot=1000) # Silverman's significance for the null that x has at # most modes. { h <- hcrit (x, m) h0 <- h n <- 0 theta <- function (y, h0=h, sigma2=var(y)) { (y + rnorm (1, mean=0, sd=h0^2)) / sqrt ( 1+ (h0^2/sigma2)) } for (i in 1:nboot) { boot <- theta(s...