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. [[alternative HTML version deleted]]
Start with the lm() function; i.e., see ?lm -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/14/17, 3:40 PM, "R-help on behalf of lily li" <r-help-bounces at r-project.org on behalf of chocold12 at gmail.com> 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. [[alternative HTML version deleted]] ______________________________________________ R-help at 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.
Thanks. I thought lm() function is for linear model, such as the correlation below: Y= aX + b On Wed, Jun 14, 2017 at 5:25 PM, MacQueen, Don <macqueen1 at llnl.gov> wrote:> Start with the lm() function; i.e., see > > ?lm > > -Don > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > On 6/14/17, 3:40 PM, "R-help on behalf of lily li" < > r-help-bounces at r-project.org on behalf of chocold12 at gmail.com> 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. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. > > >[[alternative HTML version deleted]]
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