On 15/06/17 10:40, lily li wrote:
Hi R users,

I have some data points (Xi, Yi), and they may follow such a pattern Yi =
cCOS(Xi) + d, how to find the c and d in R? which function to use? Also,
how to get the R2 and p value for this correlation? Thanks for any kind of
help.

If I understand you correctly (always a dubious conditional):

    fit <- lm(y ~ cos(x))

where y and x are vectors of the y and x values of your data points, should answer all of your questions.

I am bewildered that you need to ask. You have been posting to this list for quite a while. Have you learned nothing about R? It's time that you did. Read and study carefully "An Introduction to R" from the R web site -> Manuals.

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to