# How to estimate parameter in simulation?

I am fairly new to R and is exploring simulation to estimate the parameter n:

1) Z is a vector of n draws from N(0,1)

2) Probability of max(Z)>4 equals 0.25

What is the best way in R to estimate the parameter n to satisfy these two conditions? I got stuck trying to avoid looping or exhaustive search in the code. Thanks!

## migrated from quant.stackexchange.comApr 3 '18 at 4:46

This question came from our site for finance professionals and academics.

• - Is this homework? -What have you tried? -You did not try googling "distribution of the maximum of normal random variables" - This is unrelated to Quant Finance! Anyway have a look here: math.stackexchange.com/questions/89030/… – g g Apr 2 '18 at 20:21

Find the CDF of $\max(Z)$
$$Pr(\max(Z)>4)=1-Pr(Z_1 \le 4, \ldots, Z_n \le 4)$$
then use the independence of $Z_i$ to get an expression in terms of CDF of $N(0,1)$.