Clinical and psychosocial factors associated with depression in patients with psychosis according to stage of illness