Displaying 5 results from an estimated 5 matches for "numsim".
2008 Jan 29
1
for loop help
Hi,
I have written the following code which works fine
step<-5
numSim<-15
N<-double(numSim)
A<-double(numSim)
F<-double(numSim)
M<-double(numSim)
genx<-double(numSim)
for (i in 1:numSim) {
N[i]<-20
PN<-(runif(N[i], 0, 1))
A[i]<-sum(ifelse(PN>0.2, 1, 0))
PF<- runif((A[i]*0.5), 0, 1)
F[i]<-sum(ifelse(PF>0.2, 1,...
2011 Feb 28
1
Transforming list into an array
Hello. I have the following object which is a list of length NumSim with
each entry being a matrix of dimensions Ncurvas x 3:
dW =
replicate(NumSim,cbind(rnorm(Ncurvas),rnorm(Ncurvas),rnorm(Ncurvas)),simplify=F)
I would like to transform it into an array of dimension Ncurvas x 3 x
NumSim. Does anybody does how to do this? or how to generate directly and
array co...
2011 Nov 23
2
avoiding the sample in built function
...,6,7,8)
sample(data)
> data <- c(5,4,6,7,8)
> sample(data)
[1] 4 6 7 8 5
> sample(data)
[1] 6 8 4 7 5
> sample(data)
[1] 6 5 4 8 7
Herefore I made a for loop which you can see here:
This for loop is supposed to do the same as the sample() function, 3 times.
data <- c(5,4,6,7,8)
numsim <- 3
n <- length(data)
sample <- matrix(0,numsim,1)
for (i in 1:numsim) {indices <- runif(pool, min = 1, max = n)
sample[i,] <- data[indices]
}
the idea behind this for loop is dat it first creates randomly data by
runif, and then it should...
2011 May 06
1
Uniroot - error
...rror in uniroot(f, c(0, 2),
maxiter = 1000, tol = 0.001) :
f() values at end points not of opposite sign
I have also tried interval of (lower=min(U), upper=max(U)) and it won't work
as well.
Can anyone help me as I have struggled for few days already and I have to
finish it soon. Thanks.
numsim=10000
set.seed(12345)
P = c()
for (m in 1:numsim) {
Y = rnorm(140,0.0125,(0.005^(1/2)))
U = exp(X1)
.............
.............(sorry i have to skip the code in between otherwise
..............my assignment will get penalty for plagarism according to
those screening sotware)
............
S = sum...
2013 Apr 01
1
lognormal sampleing using covariance matrix
Dear All,
wondering if someine can access the link to the randsamp code referenced in the R-help archive here: http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg75645.html ? I have tried but for whatever reason I can not get trough. My problem seems to be similar to what the author originally described there, so having access to it would be great. Else, if you have any thougths on sampling