시작하기무료로 시작하기

다변량 선형 회귀 (2)

이번에는 이전 연습 문제에서 적합한 혈압 모델 bloodpressure_model을 사용해 예측을 만들어 보겠습니다.

또한 예측값과 실제 값을 그래프로 비교해 볼 거예요. ggplot2는 이미 로드되어 있습니다. 아래와 같은 형태로 그래프를 그린다는 점을 기억해 주세요:

ggplot(dframe, aes(x = pred, y = outcome)) + 
     geom_point() + 
     geom_abline(color = "blue")

bloodpressurebloodpressure_model은 이미 준비되어 있어 바로 사용하실 수 있어요.

이 연습은 강의의 일부입니다

R로 하는 Supervised Learning: 회귀

강의 보기

연습 안내

  • predict()를 사용해 bloodpressure 데이터셋의 혈압을 예측하세요. 예측값은 prediction 열에 저장하세요.
  • 예측값을 실제 혈압과 그래프로 비교하세요. x축에는 예측값을 두세요. 결과가 완벽한 예측선을 얼마나 잘 따르는지 확인해 보세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# bloodpressure is available
summary(bloodpressure)

# bloodpressure_model is available
bloodpressure_model

# Predict blood pressure using bloodpressure_model: prediction
bloodpressure$prediction <- ___

# Plot the results
___ + 
    ___ +
    geom_abline(color = "blue")
코드 편집 및 실행