시작하기무료로 시작하기

수확량 예측하기

모델링의 재미는 모델을 사용해 예측해 보는 데 있어요. 다음 형태로 predict()를 호출해 예측할 수 있어요.

predict(model, cases_to_predict, type = "response")

mgcvdplyr는 로드되어 있고, 옥수수와 밀 데이터셋의 GAM은 각각 corn_model, wheat_model로 제공돼요. 인구조사 지역의 문자형 벡터는 census_regions에 저장되어 있어요.

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

R 함수 작성 입문

강의 보기

실습형 인터랙티브 연습

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

# Make predictions in 2050  
predict_this <- data.frame(
  year = ___,
  census_region = census_regions
) 

# Predict the yield
pred_yield_kg_per_ha <- ___(___, ___, type = "response")

predict_this %>%
  # Add the prediction as a column of predict_this 
  ___(pred_yield_kg_per_ha = ___)
코드 편집 및 실행