I am very new to R and I made a linear model of price based on variables like size and location. I used data from 2005-2010 for the model (Model_Data) and I want to make predictions for 2011-2014 (Test_Data).
model=lm(Price~Size+Location, data=Model_Data)
Test_Data$Predicted_Price = predict(model, Test_Data)
df=data.frame(Test_Data$Predicted_Price)
write.csv(df, file="Predictions.csv")
When I run this and open the csv file, it returns all NA values for the 2011-2014 test data. There are some empty cells for some of the variables, but I thought those are just omitted when predictions are made. Is it something wrong with the code? Any help would be appreciated.
Thanks