Hi all,
Super new to R and finding it fairly daunting since I was an SPSS girl many years ago. My current stats assignment had us fit a model for some data about avocados. Total.Volume (sales), AveragePrice and Type (organic versus regular). We had to log the model (AveragePriceType) as the data was fairly skewed which was fine. However when I come to try and insert some figures for prediction I run into trouble with the R code.
Inserting $0.8 US as an average price to predict total sales by each type was fine but I'm struggling to find the right code to quantify the effect of $0.10 US increase in average price on sales - help!
AveragePriceType.fit2 = lm(log(Total.Volume) ~ AveragePrice + Type, data = avocado.df)
summary(AveragePriceType.fit2)
NewAveragePrice = data.frame(AveragePrice = c(0.8), Type = c("Organic"))
predict(AveragePriceType.fit2, newdata = NewAveragePrice)
predict(AveragePriceType.fit2, newdata = NewAveragePrice, interval = "confidence")
NewAveragePrice = data.frame(AveragePrice = c(0.8), Type = c("Regular"))
predict(AveragePriceType.fit2, newdata = NewAveragePrice)
predict(AveragePriceType.fit2, newdata = NewAveragePrice, interval = "confidence")