Re: [R] what is the difference between using function predict() and coef() in prediction

2011-12-10 Thread tony333
X8 = c(0.42808332, 0.14058333, 0.30558333, 0.09558333, 0.01808333, -0.09191666, -0.11441666, -0.12941666, 0.13808333, -0.31691666, 0.25308333 ,-0.20941666 ,0.02808333, -0.04441667, -0.43691666) xy.lm = lm(Y~X8) z = predict(xy.lm,list(X8=X8)) sz = coef(xy.lm)[1]+(coef(xy.lm)[2])*X8 is

Re: [R] what is the difference between using function predict() and coef() in prediction

2011-12-10 Thread tony333
X8 = c(0.42808332, 0.14058333, 0.30558333, 0.09558333, 0.01808333, -0.09191666, -0.11441666, -0.12941666, 0.13808333, -0.31691666, 0.25308333 ,-0.20941666 ,0.02808333, -0.04441667, -0.43691666) Y =c(370.6 , 887.6 ,3610.88333 , 435.1 , 1261.38333 , -741.11667,-3231.36667

Re: [R] what is the difference between using function predict() and coef() in prediction

2011-12-10 Thread David Winsemius
On Dec 10, 2011, at 11:48 AM, tony333 wrote: X8 = c(0.42808332, 0.14058333, 0.30558333, 0.09558333, 0.01808333, -0.09191666, -0.11441666, -0.12941666, 0.13808333, -0.31691666, 0.25308333 ,-0.20941666 ,0.02808333, -0.04441667, -0.43691666) xy.lm = lm(Y~X8) z =

Re: [R] what is the difference between using function predict() and coef() in prediction

2011-12-09 Thread Petr PIKAL
Hi Did you find any difference? The results shall be same (with only rounding error). Can you show us some example where you get substantial difference? Regards Petr i do not know what is the difference between predict() and coef() i use the two function give me different result zz =

[R] what is the difference between using function predict() and coef() in prediction

2011-12-08 Thread tony333
i do not know what is the difference between predict() and coef() i use the two function give me different result zz = predict(xy.lm,list(T8=T8)) ss = coef(xy.lm)[1]+(coef(xy.lm)[2])*T8 where is t8 is the data used in prediction did not use in the fitting in training sample where every sample is