Re: [R] Using optimize with array variables

2009-10-01 Thread Charles C. Berry
On Thu, 1 Oct 2009, Vik wrote: Thanks Charles, I have been able to change the function and to make it work. I have also gotten the same results using nlm(). Now the question I have (and that google has not helped on) is which optimization functions can I use for solving for two distinct variabl

Re: [R] Using optimize with array variables

2009-10-01 Thread Vik
Thanks Charles, I have been able to change the function and to make it work. I have also gotten the same results using nlm(). Now the question I have (and that google has not helped on) is which optimization functions can I use for solving for two distinct variables instead of only one? Thanks aga

Re: [R] Using optimize with array variables

2009-10-01 Thread Charles C. Berry
On Thu, 1 Oct 2009, Vik wrote: Hello, I am trying to figure out how to use optimize() with array variables as inputs. I have a for loop in the function definition: SS <- function(int,slo,x,y){ for(i in 1:length(x)) ((int+slo*x[i])-y[i])^2->squares[i] sum(squares)->>sum_squares output_txt = c (

[R] Using optimize with array variables

2009-10-01 Thread Vik
Hello, I am trying to figure out how to use optimize() with array variables as inputs. I have a for loop in the function definition: SS <- function(int,slo,x,y){ for(i in 1:length(x)) ((int+slo*x[i])-y[i])^2->squares[i] sum(squares)->>sum_squares output_txt = c ("The sum of squares is", sum_squar