[R] [FORGED] about fitting a regression line
Rolf Turner
r.turner at auckland.ac.nz
Thu Jun 15 01:32:12 CEST 2017
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
More information about the R-help
mailing list