Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 255903

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

0 votes

Fit a sinusoidal term to data

.**0.5 offset = mean(data$y) fest <- 1/calc.period(y,t) guess = c( amp, fest, 0, offset) #res <- optim(par=guess, fn = min.RSS, data=data ) r<-nls(y~offset+A*sin(2*pi*f*t+phi), start … =list(A=amp, f=fest, phi=0, offset=offset)) res <- list(par=as.vector(r$m$getPars())) return(res) } genSine <- function(t, params) return( params[1]*sin(2*pi*params[2]*t+ params[3])+params[4 …
NMech's user avatar
  • 101