शुरू करेंमुफ़्त में शुरू करें

एक प्रारंभिक मॉडल

आपको एक डेटासेट दिया गया है जिसमें अलग-अलग दूरियों पर दो पिंडों के बीच गुरुत्वाकर्षण बल के माप हैं, और आपसे चुनौती है कि किसी दी गई दूरी पर बल का अनुमान लगाने के लिए एक सरल मॉडल बनाएँ. शुरुआत में, आप simple linear regression तक ही सीमित रहना चाहते हैं. डेटा में distance और force की 120 जोड़ियाँ हैं, और यह आपके लिए newton के रूप में लोड है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

R में Feature Engineering

पाठ्यक्रम देखें

अभ्यास निर्देश

  • base R के linear model फंक्शन का उपयोग करते हुए newton डेटा के लिए एक linear model बनाएँ और उसे lr_force को असाइन करें.
  • prediction मानों को मूल newton डेटा से bind करके नया डेटा फ़्रेम df बनाएँ.
  • ggplot() का उपयोग करके force बनाम distance का एक scatterplot बनाएँ.
  • fitted values के साथ scatterplot में एक regression line जोड़ें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Build a linear model for the newton the data and assign it to lr_force
lr_force <- ___(force ~ distance, data = ___)

# Create a new data frame by binding the prediction values to the original data
df <- newton %>% ___(lr_pred = predict(lr_force))

# Generate a scatterplot of force vs. distance
df %>%
  ggplot(aes(x = distance, y = force)) +
  geom____() +
# Add a regression line with the fitted values
  geom_line(aes(y = ___), color = "blue", lwd = .75) +
  ggtitle("Linear regression of force vs. distance") +
  theme_classic()
कोड संपादित करें और चलाएँ