0

I am trying to run a nonlinear least squares regression in R and keep coming across the same error message which I can't seem to fix.

My function so far:

nls(y ~ 1033.89+(2461*cos*(2*3.14*(t-18)/24)), 
        data=data.frame, start=list(x=1, y=1))

where t=c(1:24) and data.frame contains x and y variables of equal length.

This error message continues to pop up:

Error in parse(text = x, keep.source = FALSE) :
:2:0: unexpected end of input
1: ~
^
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

Any suggestions?

user20650
  • 24,654
  • 5
  • 56
  • 91
  • 1
    there seems to be some mix up between data and parameters to be estimated. Your starting values suggest the parameters should be `x` & `y` but they are not in your function and in fact the `y` looks like data (as its on the lhs of the tilde) – user20650 Sep 23 '19 at 20:33
  • 1
    ... `cos*(` isn't correct syntax – user20650 Sep 23 '19 at 20:42

0 Answers0