BaşlayınÜcretsiz Başlayın

Motorcycle crash data: linear approach

In this first exercise, you will fit a linear model to a data set and visualize the results to see how well it captures relationships in the data. The data set, stored in a data frame named mcycle, contains measurement of acceleration of a crash-test dummy head during a motorcycle crash. It contains measurements of acceleration (g) in the accel column and time (milliseconds) in the times column.

Bu egzersiz

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the head() and plot() functions to look at the data frame named mcycle.
  • Use the lm() function to fit a model to the mcycle data where the accel variable is a linear function of times.
  • Visualize the model fit using the provided call to termplot().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Examine the mcycle data frame
head(___)
plot(___)

# Fit a linear model
lm_mod <- lm(___, data = mcycle)

# Visualize the model
termplot(lm_mod, partial.resid = TRUE, se = TRUE)
Kodu Düzenle ve Çalıştır