A molecular line study of NGC 1333 IRAS 4