modeling - Relationship between price and quantity in R - Cross Validated


i tried figure out how can analyze project. find out how analyze relationships between prices , quantities. think 2 variables can't build models.

for example, 1 pencil company sells 100 pencils 10 dollars, 200 \$15, 300 \$30, 400 \$35, etc/

how can analyse relationship in r?

assuming relationship linear, do:

quantity <- c(100,200,300,400) price <- c(10,15,30,35) plot(quantity~price) fit <- lm(quantity~price) abline(fit) summary(fit) 

Comments