0
$\begingroup$

i have some sample testing data as shown below.

N_TC    P_TC    P_B  P_Val  P_Fun   N_TC    N_B     N_Val   N_Fun
565     430     144   100    186     135    45       30      60
489     378      98   130    150     111    37       25      49
659     562     230   190    142      97    32       33      32
370     263      90    87    86      107    36       36      35
452     351     117   130    104     101    37       34      30
289     173     60    57     56      116    39       30      47
490     340     115   120    105     100    33       30      36
475     355     120   110    125     120    40       35      45
520     400     149   153     98     120    30       50      40

Following are the steps i have followed.

t_design<-read.csv("/home/appsadmin/analytics/T_design.csv",header=TRUE,sep=",")
m1<-lm(N_TC~P_TC+P_B+P_Val+P_Fun+N_TC+N_B+N_Val+N_Fun,data=t_design)
m11<-lm( N_TC~P_TC+N_TC+N_B+N_Val+N_Fun,data=test_design_prod) # Removed some predictors as they have very low correlation.
c1<-predict(m11,interval = "confidence")

And the output

c1
fit lwr upr
1 565 565 565
2 489 489 489
3 659 659 659
4 370 370 370
5 452 452 452
6 289 289 289
7 490 490 490
8 475 475 475
9 520 520 520. 

I am planning to predict N_TC. but i got the predicted values same as original/observed values (input value).

can some one guide me how to get predicted values for my data set? and which are the further steps i need to perform.

$\endgroup$
  • $\begingroup$ When you have almost as many explanatory variables as you have data, your fit is likely to be almost perfect. You have neglected to tell us that your second call to lm produced warnings. You also have posted output that disagrees with your code. As far as I can tell, your output is for model m1, not m11--and that uses eight variables to explain just nine data points! $\endgroup$ – whuber Jun 11 '15 at 17:03
1
$\begingroup$

I think the problem is that you have far too many independent variables for the amount of data that you have. Your N = 9. So, by the usual rule of thumb of having 10 observations for each IV, you should only use one IV at a time. Either that, or get a lot more data.

$\endgroup$
0
$\begingroup$

You have no degrees of freedom left after using so many independent variables. If you take get more observations or drop some predictors you'll get the prediction intervals.

$\endgroup$
  • $\begingroup$ Removed some predictors and tried this. m11<-lm( N_TC~P_TC+N_TC+N_Fun,data=t_design) c1<-predict(m11,interval = "confidence") then got some predicted values. Please suggest me how to find this model accuracy and how to find out that this model is best suited to my data set. $\endgroup$ – Naveena Jun 11 '15 at 13:46
  • $\begingroup$ I'd keep it simple and plot your data points and then plot the fitted line. See if it looks reasonable. $\endgroup$ – Kristofersen Jun 11 '15 at 13:55
  • $\begingroup$ Also, check your r^2. $\endgroup$ – Kristofersen Jun 11 '15 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.