Winternitz Parameter in WOTS+ and XMSS What is the parameter for? I read that in XMSS it is a member of the set {4, 16} but what does it exactly mean? I also read that the bigger the w parameter, the shorter the signatures but the keygen, sign and vrfy become slower. How do I pick an optimal w parameter? Is it the height of merkle tree?
This paper answers your question most succinctly:

The size of a Winternitz signature is roughly $mn/w$ bits and signing roughly requires $2^wm/w$
hash operations, where $m$ is the bit length of the hash value to be signed, $n$ is the output length of
the hash function used in the scheme, and $w$ is the Winternitz parameter determining the tradeoff between signature size and signature generation time.

The reference paper here goes into detail on how the parameter $w$ is used in various algorithms.  Per the paper:

The parameter $w$ can be chosen from the set {4, 16}.
A larger value of $w$ results in shorter signatures but slower overall
signing operations; it has little effect on security.  Choices of $w$
are limited to the values 4 and 16 since these values yield optimal
trade-offs and easy implementation.

An example of the parameter being used is in Algorithm 5: WOTS_sign - Generating a signature from a private key and a message.
Section 2.2 of this paper goes into further detail about time-memory tradeoff.
Additionally section 4 goes into further depth with performance comparisons of different parameters.