Re: [R] Problems using lm in combination with predict

2007-08-06 Thread Frede Aakmann Tøgersen
 
 My modelmatrix is of dimension  28x4
 
 Then I want to make use of the function predict because there 
 confidence.intervals are include.
 
 My idea was:
 
 mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
 
 newdate=data.frame(x=c(324,123,0.9,0.1))


Perhaps you want to specify newdate like this

newdate=data.frame(Worktime = 324, Vacation = 123, Illness = 0.9, Bankholidays 
= 0.1))?



Best regards

Frede Aakmann Tøgersen
Scientist


UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers Allé 20, P.O. BOX 50
DK-8830 Tjele

Phone:   +45 8999 1900
Direct:  +45 8999 1878

E-mail:  [EMAIL PROTECTED]
Web:   http://www.agrsci.org

This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of 
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural 
Sciences immediately and delete this email.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problems using lm in combination with predict

2007-08-06 Thread Petr PIKAL
Hi
[EMAIL PROTECTED] napsal dne 04.08.2007 15:04:56:

 Hi, 
 
 I am sorry
 
 
 I meant:
 
 
   mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
 
   newdate=data.frame(x=c(324,123,0.9,0.1))

your data frame shall have correct column names (Worktime, Vacation, ...)

Regards
Petr

   predict(mod,newdate)
 
 And get this error.
 
 Yours,
 
 Maja
 
 
 
 
  Original-Nachricht 
 Datum: Sat, 4 Aug 2007 04:42:14 -0700 (PDT)
 Von: Stephen Tucker [EMAIL PROTECTED]
 An: Maja \\Schröter\\ [EMAIL PROTECTED], 
r-help@stat.math.ethz.ch
 Betreff: Re: [R]  Problems using lm in combination with predict
 
  I think you need 
  
  predict(mod,newdate)
  
  instead of 
  
  predict(y,newdate)
  
  
  --- Maja Schröter [EMAIL PROTECTED] wrote:
  
   Hello everybody,
   
   I'm trying to predict a linear regression model but it does not 
work.
   
   My Model: y = Worktime + Vacation + Illnes + Bankholidays
   
   My modelmatrix is of dimension  28x4
   
   Then I want to make use of the function predict because there
   confidence.intervals are include.
   
   My idea was:
   
   mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
   
   newdate=data.frame(x=c(324,123,0.9,0.1))
   predict(y,newdate)
   
   But I always get the message:
   
   
   'newdata' had 1 rows but variable(s) found have 28 rows
   
   
   What can I do?
   
   Yours, 
   
   Maja
   
   -- 
   Pt! Schon vom neuen GMX MultiMessenger gehört?
   Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
   
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
   
  
  
  
  
  

  Looking for a deal? Find great prices on flights and hotels with 
Yahoo!
  FareChase.
  http://farechase.yahoo.com/
 
 -- 
 Pt! Schon vom neuen GMX MultiMessenger gehört?
 Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problems using lm in combination with predict

2007-08-04 Thread Maja Schröter
Hello everybody,

I'm trying to predict a linear regression model but it does not work.

My Model: y = Worktime + Vacation + Illnes + Bankholidays

My modelmatrix is of dimension  28x4

Then I want to make use of the function predict because there 
confidence.intervals are include.

My idea was:

mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)

newdate=data.frame(x=c(324,123,0.9,0.1))
predict(y,newdate)

But I always get the message:


'newdata' had 1 rows but variable(s) found have 28 rows


What can I do?

Yours, 

Maja

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problems using lm in combination with predict

2007-08-04 Thread Stephen Tucker
I think you need 

predict(mod,newdate)

instead of 

predict(y,newdate)


--- Maja Schröter [EMAIL PROTECTED] wrote:

 Hello everybody,
 
 I'm trying to predict a linear regression model but it does not work.
 
 My Model: y = Worktime + Vacation + Illnes + Bankholidays
 
 My modelmatrix is of dimension  28x4
 
 Then I want to make use of the function predict because there
 confidence.intervals are include.
 
 My idea was:
 
 mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
 
 newdate=data.frame(x=c(324,123,0.9,0.1))
 predict(y,newdate)
 
 But I always get the message:
 
 
 'newdata' had 1 rows but variable(s) found have 28 rows
 
 
 What can I do?
 
 Yours, 
 
 Maja
 
 -- 
 Pt! Schon vom neuen GMX MultiMessenger gehört?
 Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problems using lm in combination with predict

2007-08-04 Thread Maja Schröter
Hi, 

I am sorry


I meant:


  mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
   
  newdate=data.frame(x=c(324,123,0.9,0.1))
  predict(mod,newdate)

And get this error.

Yours,

Maja




 Original-Nachricht 
Datum: Sat, 4 Aug 2007 04:42:14 -0700 (PDT)
Von: Stephen Tucker [EMAIL PROTECTED]
An: Maja \\Schröter\\ [EMAIL PROTECTED], r-help@stat.math.ethz.ch
Betreff: Re: [R]  Problems using lm in combination with predict

 I think you need 
 
 predict(mod,newdate)
 
 instead of 
 
 predict(y,newdate)
 
 
 --- Maja Schröter [EMAIL PROTECTED] wrote:
 
  Hello everybody,
  
  I'm trying to predict a linear regression model but it does not work.
  
  My Model: y = Worktime + Vacation + Illnes + Bankholidays
  
  My modelmatrix is of dimension  28x4
  
  Then I want to make use of the function predict because there
  confidence.intervals are include.
  
  My idea was:
  
  mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
  
  newdate=data.frame(x=c(324,123,0.9,0.1))
  predict(y,newdate)
  
  But I always get the message:
  
  
  'newdata' had 1 rows but variable(s) found have 28 rows
  
  
  What can I do?
  
  Yours, 
  
  Maja
  
  -- 
  Pt! Schon vom neuen GMX MultiMessenger gehört?
  Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
  
 
 
 

 
 Looking for a deal? Find great prices on flights and hotels with Yahoo!
 FareChase.
 http://farechase.yahoo.com/

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problems using lm in combination with predict

2007-08-04 Thread Gabor Grothendieck
Here is an example using the builtin Loblolly data frame

 mod - lm(height ~., Loblolly)
 predict(mod, data.frame(age = 10, Seed = 301))
[1] 25.47510


On 8/4/07, Maja Schröter [EMAIL PROTECTED] wrote:
 Hi,

 I am sorry


 I meant:


  mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)

  newdate=data.frame(x=c(324,123,0.9,0.1))
  predict(mod,newdate)

 And get this error.

 Yours,

 Maja




  Original-Nachricht 
 Datum: Sat, 4 Aug 2007 04:42:14 -0700 (PDT)
 Von: Stephen Tucker [EMAIL PROTECTED]
 An: Maja \\Schröter\\ [EMAIL PROTECTED], r-help@stat.math.ethz.ch
 Betreff: Re: [R]  Problems using lm in combination with predict

  I think you need
 
  predict(mod,newdate)
 
  instead of
 
  predict(y,newdate)
 
 
  --- Maja Schröter [EMAIL PROTECTED] wrote:
 
   Hello everybody,
  
   I'm trying to predict a linear regression model but it does not work.
  
   My Model: y = Worktime + Vacation + Illnes + Bankholidays
  
   My modelmatrix is of dimension  28x4
  
   Then I want to make use of the function predict because there
   confidence.intervals are include.
  
   My idea was:
  
   mod - lm(y~Worktime+Vacation+Illnes+Bankholidays)
  
   newdate=data.frame(x=c(324,123,0.9,0.1))
   predict(y,newdate)
  
   But I always get the message:
  
  
   'newdata' had 1 rows but variable(s) found have 28 rows
  
  
   What can I do?
  
   Yours,
  
   Maja
  
   --
   Pt! Schon vom neuen GMX MultiMessenger gehört?
   Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
  
 
 
 
 
  
  Looking for a deal? Find great prices on flights and hotels with Yahoo!
  FareChase.
  http://farechase.yahoo.com/

 --
 Pt! Schon vom neuen GMX MultiMessenger gehört?
 Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.