기하분포에서의 시뮬레이션
이번 연습에서는 replications를 rgeom()의 출력과 비교해 보겠습니다.
이 연습은 강의의 일부입니다
R로 배우는 확률 기초
연습 안내
rgeom()함수를 사용해 성공 확률이 0.2인 기하분포에서 100,000번 표본을 추출하세요. 결과를geom_sample에 저장하세요.compare_histograms()함수를 사용해replications와geom_sample을 비교하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Replications from the last exercise
replications <- replicate(100000, which(rbinom(100, 1, .2) == 1)[1])
# Generate 100,000 draws from the corresponding geometric distribution
geom_sample <- rgeom(___)
# Compare the two distributions with compare_histograms