You should use pinMode() to set pins to INPUT or OUTPUT before you use them. The exception is analogWrite() which will set the pin as an OUTPUT.
Pin 4 is not a PWM (analogWrite()) pin. Use 3, 5, 6, 9, 10, and 11 for analogWrite().
digitalWrite() will set an LED on (HIGH) or off (LOW). To fade, use analogWrite() with values from 0 (off) to 255 (on).