search for: predxn

Displaying 1 result from an estimated 1 matches for "predxn".

Did you mean: predx
2012 Jul 10
1
outer() or some other function for regression prediction with 2 IVs
...inddependent variables. The regression model "m3" has an intercept, 2 linear terms, and 2 squared terms. The coefficients are given by coef(m3). My approach to generating the predictions for a range of each of my IVs, "s" and "d" was to use outer() like so: predxn <- function(s,d) { sum( coef(m3) * c(1,s,s^2,d,d^2) ) } z <- outer(s_vector,d_vector,predxn) I can't see what's wrong with this. For each value of s_vector and d_vector, it should multiply each coefficient by its term and give me a nice two-dimensional array "z" cont...