Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Abraham Mathew
All right, so my dependent variable is sold price, it is theoretically a continuous variable, though most of the values are between 0 and 25 Sold Price = B0 + B1(age) + B2(gender) + B3(marital) + B4(educ) + B5(cars) + B6(license) + B7(credit) + B8(type) + B9(home) + B10(id) age is a numeric var

Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Abraham Mathew
Yes and no. Thanks for that code, it was really useful, though not exactly what i was getting at. So I'm predicting sold on a number of independent variables.I'm trying to find an estimated sold price for each combination of the variables. So what is the expected sold price for each possible vari

Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Abraham Mathew
I looked into what you suggested and got the following results. > y.hat.new 1234567 > 89 10 1144.675 1190.714 1236.753 1157.829 1210.445 1203.868 1128.232 1282.792 1246.619 1154.540 11 12 13 14

Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Tal Galili
Hi Abraham, Please let us take a step back - what is your end goal from this analysis? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebre

Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Tal Galili
Hi Abraham, Isn't this what you wanted: data.frame(all.x, y.hat.new) p.s: it might be safer to use: myData mod1 = lm(sold ~ age + gender, data = myData) Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-727584

Re: [R] Predicting a linear model for all combinations

2011-12-21 Thread Tal Galili
combind ?predict and: expand.grid(weather=1:2,gender=c("male","female")) Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-sta

[R] Predicting a linear model for all combinations

2011-12-21 Thread Abraham Mathew
Lets say I have a linear model and I want to find the average expented value of the dependent variable. So let's assume that I'm studying the price I pay for coffee. Price = B0 + B1(weather) + B2(gender) + ... What I'm trying to find is the predicted price for every possible combination of values