ComeçarComece de graça

Making yield predictions

The fun part of modeling is using the models to make predictions. You can do this using a call to predict(), in the following form.

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

mgcv and dplyr are loaded; GAMs of the corn and wheat datasets are available as corn_model and wheat_model. A character vector of census regions is stored as census_regions.

Este exercício faz parte do curso

Introduction to Writing Functions in R

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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 = ___)
Editar e executar o código