Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to deal with a quadratic model that has too many fitted values?

$
0
0

I'm trying to fit a quadratic regression model to a dataset and then plot the curve on a scatterplot. The dataset is about number of episodes and screentime for characters in a TV show.

I plotted a scatterplot with episodes on x axis and screentime on y axis this worked fine.

Then I create the model as follows:

model <- lm(screentime~episodes+I(episodes^2), data = got)
lines(fitted(model))

This gives me a model with correct coeefficients however there are too many fitted.values, I assume due to the fact that some characters have the same number of episodes this leads to the lines not being plotted fully.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>