Beacon Hill residents were on edge Sunday, a day after a woman was sexually assaulted and robbed inside her apartment there, while police urged the public to be vigilant after that attack and two assaults on teenage girls in Roxbury last week.

“It’s sort of nerve-racking, because I always thought of this as a safe neighborhood,” said Julia Probert, 23, as she walked with friends Sunday afternoon near the scene of the Beacon Hill attack. The assault occurred Saturday at about 3:15 a.m. near the corner of Joy and Myrtle streets, where stately brick homes are located close to shops and a public playground.

According to police, a man forced his way into the woman’s apartment and brandished a weapon that may have been a knife before assaulting and robbing her. Police have not identified the woman, who is in her 20s, but said Sunday that she did not know her attacker.

Boston Police Deputy Superintendent Kelly Nee said during a news conference at police headquarters Sunday afternoon that investigators do not believe the Beacon Hill assault is related to the Roxbury cases, and she offered some advice: If attacked, shout as the victims did on Monday and Tuesday evenings in Roxbury.

“They screamed and they were able to prevent the assault from getting any further,” Nee said. “So yelling, ‘Fire,’ ‘Help,’ ‘Rape’ – anything like that – scream. It’s a way of drawing attention to yourself and alerting people that you need help.”

People should not walk alone at night when possible and avoid distracting activity on cellphones, Nee said. Whistles also can be helpful in warding off an assailant, she said.

An attack similar to the Saturday assault occurred on Joy Street in November 2004, when a 16-year-old boy forced a woman into her apartment and raped her repeatedly at gunpoint.

According to preliminary crime statistics from Boston police, through Nov. 5 there had been 234 reports of rape or attempted rapes in the city, up from 221 at this time last year.

There were 18 such reports through Nov. 5 in the police district that includes Beacon Hill, compared to 17 at the same time last year. There were 48 such reports in the Roxbury district though Nov. 5, compared to 34 at the same time in 2011.

Police believe the same suspect, described alternately as a baby-faced Hispanic male in his late teens and a non-Hispanic black with a Haitian accent and a medium build, may have committed both assaults. Both victims fought off their attackers.

Near the scene of the Beacon Hill attack Sunday, Rose Parsons, 53, a cashier at Beacon Capitol Market, said the news caught him off guard, even though Saturday’s assault is not without precedent.

“I was really surprised,” he said. “Over the years we’ve had a couple of incidents, but it is a little disturbing.”

Meaghan Elliott, 26, was also alarmed.

“It’s kind of scary because you think it’s a safe neighborhood,” she said. “There are people walking around at all times of day.”

Helen Sulkowski, another neighborhood resident, who was walking her dog, said she got a whistle after the 2004 case. She pulled a key ring out of her pocket to display the blue whistle. “It’s scary,” Sulkowski said. “It is.”