search for: nrep

Displaying 20 results from an estimated 46 matches for "nrep".

Did you mean: grep
2009 Jul 22
1
R extract vertices for polygon
...ea in which each group "wins" and colour it diferentially. I can make a simple point plot, but I would like to add polygons with full colored area. The example is with a 5x5 matrix, but I'm working with 500 x 500 matrix, so hand work is difficult, Any suggestion will be welcomed. Nrep=5 GROUP<-matrix(c(3,3,3,3,7,3,3,3,3,7,1,3,3,3,7,1,3,3,3,7,1,1,4,4,0),Nrep,Nrep) column<- seq(1, 5, length=Nrep) row<- seq(0,10,length=Nrep) colnames(GROUP)<- round(column,3) rownames(GROUP)<- row GROUP grupovec<-as.vector(GROUP) flushvec<-rep(column,rep(Nrep,Nrep)) MORv...
2005 Sep 08
0
Effect of data set size on calculation
Dear listers, I have a piece of code which performs an ANOVA type of analysis on 2D GC data. The code is shown below: # ANOVA 2D GC analysis # maxc <- number of samples # nreps <- number of samples maxc <- 2 nreps <- 4 sscl <- NULL cmean <- NULL # # Initial stat. variable # dftot <- nrow(mat)-1 dfcl <- maxc - 1 dferr <- dftot - dfcl totmean <- mean(mat) sstot <- sd(mat)^2*dftot # # Calculate class-to-class variance #...
2011 Feb 02
2
Help with one of "those" apply functions
Hello there, I'm still struggling with the *apply commands. I have 5 people with id's from 10 to 14. I have varying amounts (nrep) of repeated outcome (value) measured on them. nrep <- 1:5 id <- rep(c("p1", "p2", "p3", "p4", "p5"), nrep) value <- rnorm(length(id)) I want to create a new vector that contains the sum of the values per person. subject.value[1] <...
2004 Mar 30
1
classification with nnet: handling unequal class sizes
...<- table(...)) diag(tab) <- 0 cat("error rate = ", round(100*sum(tab)/length(list(...)[[1]]), 2), "%\n") invisible() } CVnn2 <- function(formula, data, size = c(0,4,4,10,10), lambda = c(0, rep(c(0.001, 0.01),2)), nreps = 1, nifold = 5, verbose = 99, ...) { resmatrix <- function(predict.matrix,learn, data, ri, i) { rae.matrix <- predict.matrix rae.matrix[,] <- 0 rae.vector <- as.numeric(as.factor((predict(learn, data[ri == i,], type = "class")))) for (k...
2004 Sep 23
0
nnet and weights: error analysis using V&R example
...seed(123) rand <- sample(10, dim(fgl)[1], replace = T) fgl1 <- fgl fgl1[1:9] <- lapply(fgl[, 1:9], function(x) {r <- range(x); (x - r[1])/diff(r)}) CVnn2 <- function(formula, data, size = c(0,4,4,10,10), lambda = c(0, rep(c(0.001, 0.01),2)), nreps = 1, nifold = 5, verbose = 99, ...) { CVnn1 <- function(formula, data, nreps=1, ri, verbose, ...) { totalerror <- 0 truth <- data[,deparse(formula[[2]])] res <- matrix(0, nrow(data), length(levels(truth))) if(verbose > 20) cat("...
2004 Sep 23
0
nnet with weights parameter: odd error
...resolve the problem- it is really very strange and I need your help! I tried it very simple in defining the weights as = 1 for each obs (as it is by default)!: CVnn2 <- function(formula, data, size = c(0,4,4,10,10), lambda = c(0, rep(c(0.001, 0.01),2)), nreps = 1, nifold = 5, verbose = 99, ...) { resmatrix <- function(predict.matrix, learn, data, ri, i) { rae.matrix <- predict.matrix rae.matrix[,] <- 0 rae.vector <- as.numeric(as.factor((predict(learn, data[ri == i,],...
2011 Mar 03
3
Probabilities greather than 1 in HIST
Dear all, I am a newbie in R and could not find help on this problem. I am trying to plot an histogram with probabilities in the y axis. This is the code I am using: #TLC uniform n=30 mi=1; mx=6 nrep=1000 xbar=rep(0,nrep) for (i in 1:nrep) {xbar[i]=mean(runif(n,min=mi,max=mx))} hist(xbar,prob=TRUE,breaks="Sturges",xlim=c(1,6),main=paste("n =",n), xlab="Média", ylab="Probabilidade") curve(dnorm(x,mean=mean(xbar),sd=sd(xbar)),add=TRUE,lwd=2,col="red&qu...
2011 Jan 05
0
Nnet and AIC: selection of a parsimonious parameterisation
...s[, 2:8] # excludes names, authors? predictions attach(cpus2) cpus3 <- data.frame(syct = syct-2, mmin = mmin-3, mmax = mmax-4, cach=cach/256,chmin=chmin/100, chmax=chmax/100, perf) detach() CVnn.cpus <- function(formula, data = cpus3[cpus.samp, ], maxSize = 10, decayRange = c(0,0.2), nreps = 5, nifold = 10, alpha= 9/10, linout = TRUE, skip = TRUE, maxit = 1000,...){ #nreps=number of attempts to fit a nnet model with randomly chosen initial parameters # The one with the smallest RSS on the training data is then chosen nnWtsPrunning <-function(nn,data,alpha,i){ trut...
2005 Apr 20
1
negative p-values from fisher's test (PR#7801)
Full_Name: Martha Nason Version: 2.0.1 OS: Windows XP Submission from: (NULL) (137.187.154.154) I am running simulations using fisher's test on 2 x c tables and a very small p.value from fisher's test (<2.2e-16) is returned as a negative number. Code follows. > set.seed(0) > nreps.outer <-7 > pvalue.fisher <- rep(NA,nreps.outer) > > population1 <- c( rep("A",300),seq(1:100)) > > population2 <- c( rep("A",100),seq(101:200)) > > > for (j in 1:nreps.outer){ + n1 <- sample(30:100,1) + n2 <- sample(30:100,1) + +...
2012 Jan 13
0
Example of "task seeds" with R parallel. Critique?
...go wrong? I see danger in conflicts between my effort to manage seeds and the work of parallel functions that try to manage seeds for me. That's why I wish I could integrate task-based seeds into parallel itself. RNGkind("L'Ecuyer-CMRG") set.seed(23456) library(parallel) ## nrep = number of repetitions (or tasks) ## streamsPerRep = number of streams needed by each repetition nReps <- 2000 streamsPerRep <- 2 ## projSeeds=list of lists of stream seeds projSeeds <- vector(mode="list", nReps) for (i in 1:nReps) projSeeds[[i]] <- vector(mode="list&qu...
2006 Aug 24
2
Why are lagged correlations typically negative?
...2, use="complete") [1] -1 > (T1<-rnorm(3)) [1] -0.84258593 -0.49161602 0.03805543 > (T2<-c(T1[2:3],NA)) [1] -0.49161602 0.03805543 NA > cor(T1,T2, use="complete") [1] 1 ########### # More advanced simulation example ########### > lags function(nobs,nreps,rho=1){ OUT<-data.frame(NEG=rep(NA,nreps),COR=rep(NA,nreps)) nran<-nobs+1 #need to generate 1 more random number than there are observations for(i in 1:nreps){ V1<-rnorm(nran) V2<-sqrt(1-rho^2)*rnorm(nran)+rho*V1 #print(cor(V1,V2)) V1<-V1[1:nran-1] V...
2006 Nov 23
1
statistics help
...ean time until you have reached square 1 for p= 0.1,0.2,0.3,0.4 and 0.5. What is the probability of reaching square 10 for these parameters hint simulate each scenario 1000 times and plot on histogram this is the code that i have come up with but its not working very well. rw<-function(sw,p,nrep){ Z=0 T=0 count=0 for (i in 1:nrep) { n<-0 s=sw while (s>0 & s<10) { x<-runif(1, min=0, max=1) if (x<p) {s<-s-1} else{s<-s+1} print (s) n<-n+1 } count<-count+n print (coun...
2012 Oct 20
1
Logistic regression/Cut point? predict ??
...lt;-prediction(pred,z) auc<-performance(rocpreds,"auc")@y.values output<-c(int,slope,cutmid,accuracy,auc) names(output)<-c("Intercept","Slope","CutPoint","Accuracy","AUC") return(output) } y<-fitglm(.05,1) y nreps <- 500; output<-data.frame(matrix(rep(NA),nreps,6,ncol=6)) mysigma<-.5 mytau<-.1 i<-1 for(j in 1:nreps) { output[j,1:5]<-fitglm(mysigma,mytau) output[j,6]<-j } names(output)<-c("Intercept","Slope","CutPoint","Accuracy",&qu...
2018 Feb 15
2
package MonteCarlo error: object 'packages' not found
...ow > A_grid<-rnorm(1000) #probabilities > B_grid<- rnorm(1000) #probabilities > #put parameters in a list > param_list_kud=list("x"=x_grid, "A"=A_grid, "B"=B_grid) > #run MC simulation > MC_result_kud<-MonteCarlo(func=infest_kud_fun,nrep=10000,param_list=param_list_kud) Error in MonteCarlo(func = infest_kud_fun, nrep = 10000, param_list = param_list_kud) : ? object 'packages' not found > sessionInfo() R version 3.4.3 (2017-11-30) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 7 x64 (build 7601) Servi...
2013 Apr 03
0
Help with lmRob function
...esults I'd expect to see. Another potentially useful piece of information is that when I run a model with just the two variables that have an "Estimate" value of 1 (one categorical and one continuous), I get the following error message: 1: In lmRob.fit.compute(x, y, x1.idx = x1.idx, nrep = nrep, robust.control = robust.control, : Sum(psi.weight(wi)) less than 1e-06 in lmRob.ucovcoef. during initial estimation. 2: In lmRob.fit.compute(x, y, x1.idx = x1.idx, nrep = nrep, robust.control = robust.control, : Sum(psi.weight(wi)) less than 1e-06 in lmRob.ucovcoef. during final scal...
2012 Sep 18
2
extracting column and regular interval in R
Dear R users, i have a matrix with 31 rows and 444 columns and i want to extract every 37th column of that matrix starting from 1. more precisely i want to select columns 1, 38,75, 112 and so on. then doing the same by starting from column number 2(2,39,76,113.......). i know that there is a manual way of doing it but i wanted to make it more quickly as i have fairly large data to dealth with.
2006 Jun 18
1
bug with boot.sw98 function (PR#8999)
...ission from: (NULL) (84.9.38.207) I'm using the FEAR library to perform Data Envelopment analysis with a 36,000 obs dataset. The function dea is working fine but then when I try to use the boot.sw98 to come up with some sensitivity analysis I get the following error: boot.sw98(XOBS=x,YOBS=y,NREP=100,DHAT=dhat,RTS=3,ORIENTATION=2) Error in 0:L : NA/NaN argument In addition: Warning message: longer object length is not a multiple of shorter object length in: kappam * Gcounts What does this mean? Is this because I have too many observations? What can I do to fix it? Please let me kn...
2011 May 04
1
hurdle, simulated power
Hi all-- We are planning an intervention study for adolescent alcohol use, and I am planning to use simulations based on a hurdle model (using the hurdle() function in package pscl) for sample size estimation. The simulation code and power code are below -- note that at the moment the "power" code is just returning the coefficients, as something isn't working quite right. The
2006 Jan 12
1
"infinite recursion" in do.call when lme4 loaded only
...Memory used increases beyond bonds in task manager. -- I tested a few S3 based packages (MASS, nlme) and did not get similar problems Current workaround: do lme4-processing in a separate program. ------ #library(lme4) # uncomment this to see the problem np <- 12 nq <- 20 nph <- 3 nrep <- 30 grd <- expand.grid(Pat=as.factor(1:np), Q=as.factor(1:nq), Phase=as.factor(1:nph)) df <- with (grd, data.frame(Pat=Pat,Q=Q,Phase=Phase,Resp = rnorm(np*nq*nph*nrep))) score <- function(x) { data.frame(Pat=x$Pat[1],Phase=x$Phase[1],Q=x$Q[1],score = mean(x...
2006 Jan 12
1
"infinite recursion" in do.call when lme4 loaded only
...Memory used increases beyond bonds in task manager. -- I tested a few S3 based packages (MASS, nlme) and did not get similar problems Current workaround: do lme4-processing in a separate program. ------ #library(lme4) # uncomment this to see the problem np <- 12 nq <- 20 nph <- 3 nrep <- 30 grd <- expand.grid(Pat=as.factor(1:np), Q=as.factor(1:nq), Phase=as.factor(1:nph)) df <- with (grd, data.frame(Pat=Pat,Q=Q,Phase=Phase,Resp = rnorm(np*nq*nph*nrep))) score <- function(x) { data.frame(Pat=x$Pat[1],Phase=x$Phase[1],Q=x$Q[1],score = mean(x...