t; Subject: Re: [R] outer() or some other function for regression prediction
> with 2 IVs
> From: pda...@gmail.com
> Date: Tue, 10 Jul 2012 08:46:42 +0200
> CC: michael.weyla...@gmail.com; r-help@r-project.org
> To: joeclar...@hotmail.com
>
>
> On Jul 10, 2012, at 05:35 , Jose
On Jul 10, 2012, at 05:35 , Joseph Clark wrote:
>
> Thanks. I was able to get what I wanted by doing this:
>
>
>
> predxn <- function(s,d) { coef(m3)[1] + coef(m3)[2]*s + coef(m3)[3]*s^2 +
> coef(m3)[4]*d + coef(m3)[5]*d^2 }
>
>
> But it's not very elegant...
>
You didn't take Michael's
Thanks. I was able to get what I wanted by doing this:
predxn <- function(s,d) { coef(m3)[1] + coef(m3)[2]*s + coef(m3)[3]*s^2 +
coef(m3)[4]*d + coef(m3)[5]*d^2 }
But it's not very elegant...
// joseph w. clark , phd candidate
\\ usc marshall school of business
Your problem is the sum() call -- it's not vectorized (in the regular sense) so
it breaks some of the internal assumptions of outer().
Easiest way is probably to do matrix multiplication (%*%) directly here
Michael
On Jul 9, 2012, at 10:19 PM, Joseph Clark wrote:
>
> Hi there, I'm trying to
Hi there, I'm trying to prep some data for a persp() surface plot
representing the predictions from a regression with two 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 generati
5 matches
Mail list logo