polynomial regression

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

polynomial regression

Subhashini Rao Beerisetty
[ Please keep me in CC as I'm not subscribed to the list]

Hi all,

I’m new to R programming.

Can someone help me , how to plot the “y” for the following equations in “R”?

𝑦= 𝑒−5(𝑥−0.3)2+0.5 𝑒−100(𝑥−0.5)2+0.5 𝑒−100(𝑥−0.75)2

𝑦=28−𝑥+10𝑥4−5𝑥9+6𝑥11

Also, I want to extract 50 random points from the function and add
normally distributed noise to the data points to get “noisy data”,
𝑦̂.  How to achieve this?

Is there a function to fit polynomial of degree 5 to the noisy data?


Thanks,

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: polynomial regression

Bert Gunter-2
This looks like homework. This list has a *no homework* policy.

There are extensive R tutorials on the web (and even the Intro to R shipped
with the distro). Study them before asking us to do your work for you. See
the posting guide linked below for what is expected of posters here.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Feb 21, 2020 at 8:51 AM Subhashini Rao Beerisetty <
[hidden email]> wrote:

> [ Please keep me in CC as I'm not subscribed to the list]
>
> Hi all,
>
> I’m new to R programming.
>
> Can someone help me , how to plot the “y” for the following equations in
> “R”?
>
> 𝑦= 𝑒−5(𝑥−0.3)2+0.5 𝑒−100(𝑥−0.5)2+0.5 𝑒−100(𝑥−0.75)2
>
> 𝑦=28−𝑥+10𝑥4−5𝑥9+6𝑥11
>
> Also, I want to extract 50 random points from the function and add
> normally distributed noise to the data points to get “noisy data”,
> 𝑦̂.  How to achieve this?
>
> Is there a function to fit polynomial of degree 5 to the noisy data?
>
>
> Thanks,
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: polynomial regression

Bert Gunter-2
Oh ... and don't cross post.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Feb 21, 2020 at 9:08 AM Bert Gunter <[hidden email]> wrote:

> This looks like homework. This list has a *no homework* policy.
>
> There are extensive R tutorials on the web (and even the Intro to R
> shipped with the distro). Study them before asking us to do your work for
> you. See the posting guide linked below for what is expected of posters
> here.
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Fri, Feb 21, 2020 at 8:51 AM Subhashini Rao Beerisetty <
> [hidden email]> wrote:
>
>> [ Please keep me in CC as I'm not subscribed to the list]
>>
>> Hi all,
>>
>> I’m new to R programming.
>>
>> Can someone help me , how to plot the “y” for the following equations in
>> “R”?
>>
>> 𝑦= 𝑒−5(𝑥−0.3)2+0.5 𝑒−100(𝑥−0.5)2+0.5 𝑒−100(𝑥−0.75)2
>>
>> 𝑦=28−𝑥+10𝑥4−5𝑥9+6𝑥11
>>
>> Also, I want to extract 50 random points from the function and add
>> normally distributed noise to the data points to get “noisy data”,
>> 𝑦̂.  How to achieve this?
>>
>> Is there a function to fit polynomial of degree 5 to the noisy data?
>>
>>
>> Thanks,
>>
>> ______________________________________________
>> [hidden email] 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]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: polynomial regression

Jeff Newmiller
In reply to this post by Subhashini Rao Beerisetty
This looks like homework. There is a clearly-stated no-homework policy in the Posting Guide.

Some hints though (typing a question mark before a function name in the console shows the help file for that function):

- Generate some x values (?seq)
- Calculate y values using x
- plot x against y (?plot)
- fitting can be done many ways, but the most common is using the ?lm function to fit and the ?predict.lm function to obtain points on the fitted equation.


On February 21, 2020 7:18:23 AM PST, Subhashini Rao Beerisetty <[hidden email]> wrote:

>[ Please keep me in CC as I'm not subscribed to the list]
>
>Hi all,
>
>I’m new to R programming.
>
>Can someone help me , how to plot the “y” for the following equations
>in “R”?
>
>𝑦= 𝑒−5(𝑥−0.3)2+0.5 𝑒−100(𝑥−0.5)2+0.5 𝑒−100(𝑥−0.75)2
>
>𝑦=28−𝑥+10𝑥4−5𝑥9+6𝑥11
>
>Also, I want to extract 50 random points from the function and add
>normally distributed noise to the data points to get “noisy data”,
>𝑦̂.  How to achieve this?
>
>Is there a function to fit polynomial of degree 5 to the noisy data?
>
>
>Thanks,
>
>______________________________________________
>[hidden email] 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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] 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.