Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205343

Set.seed in monte Carlo

$
0
0
#year 2022

R.100<-runif(n=100, min = 40, max = 65)
R.100
summary(R.100)

R.norm.100<-rnorm(length(R.100), mean = 50, sd=7)
R.norm.100`
summary(R.norm.100)

a=0.6
C=100

f<-seq(from=1.10, to=1.18, by=0.005)
B<-NULL
B<-as.data.frame(B)

for(i in 1:length(f)) {
  for(R in 1:length(R.norm.100)) {
    B[i, "degerler"] <- (R.norm.100[R]-(1-a)*C*f[i]) / R.norm.100[R]
  }
}

summary(B)

When running the above loop function and calculating B, I want that the simulated number of R in the numerator would be the same in the denominator. For example, when B is calculated if R is simulated as 55 in the numerator, I want R in the denominator would be 55.

How can I write the R-codes for this function?

And the last thing, I want to repeat this function many times such as 50.

Can you help me please? Best regards Zehra Civan


Viewing all articles
Browse latest Browse all 205343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>