I've been told:

For both of the models I've been told to fit the model using the first 100 rows of the data, and then use the fitted models to predict y from the remaining 25 rows of the data.

I used:

petrol.lm4 <- lm(hydrcarb~disptemp+tankpres+tankpres2+disppres2, data=petrol[1:100, ])

and

logpetrol.lm5 <- lm(log(hydrcarb)~disptemp+disppres+tankpres2, data=petrol[1:100, ])

to fit the model using the first 100 rows (is this correct?)

However, I'm now stuck on how to use these models to predict hyrdcarb now?

After that I'm supposed to calculate the root mean square prediction error, any ideas on how to do that? I've been given the formula so I'm not sure if I'm supposed to calculate it manually.

Thanks