how can calculate sum of quadratic difference in gnu r between 2 variables considering following random data?
set.seed(100) <- sample(1:100, 10) b <- sample(100:1, 10) i have not found it.
i'm not sure phrase "sum quadratic difference" means since both "-" , "^" functions vectorized, can get:
> (a-b)^2 [1] 49 169 324 3136 324 81 16 1024 1849 225 so if working residuals might "say":
> sum( resid <- (a-b)^2 ) [1] 7197 > resid [1] 49 169 324 3136 324 81 16 1024 1849 225 if instead means summing differences of squares might use:
> sum( resid <- a^2 - b^2 ) [1] -5149
Comments
Post a Comment