Hi there,
Does anyone know how I solve for x from a given y in a polynomial
function? Here's some example code:
##example file
a-1:10
b-c(1,2,2.5,3,3.5,4,6,7,7.5,8)
po.lm-lm(a~b+I(b^2)+I(b^3)+I(b^4)); summary(po.lm)
(please ignore that the model is severely overfit- that's not the point).
help.search(polynomial)
---
Jeff NewmillerThe . . Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...
Live:
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm)
realroots - function(model, b){
is.zero - function(x, tol =
1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm)
realroots
-
From: Rui Barradas ruipbarra...@sapo.pt
To: Mike Rennie mikerenni...@gmail.com
Cc: r-help Mailing List r-help@r-project.org
Sent: Friday, March 1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8
-project.org
Sent: Friday, March 1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary
, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm)
realroots
, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2)+I(b^3)+I(b^4), data = dat); summary(po.lm
PM
To: Peter Ehlers
Cc: R help
Subject: Re: [R] solving x in a polynomial function
Hi Peter,
With the edit you suggested, now I'm just getting back the value of a
that I put in, not the expected value of b...
cbind(a,b)
a b
[1,] 1 1.0
[2,] 2 2.0
[3,] 3 2.5
[4,] 4
: r-help Mailing List r-help@r-project.org
Sent: Friday, March 1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7, 7.5, 8)
dat - data.frame(a = a, b = b) # for lm(), it's better to use a df
po.lm - lm(a~b+I(b^2
Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: Mike Rennie mikerenni...@gmail.com
Cc: r-help Mailing List r-help@r-project.org
Sent: Friday, March 1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial function
Hello,
Try the following.
a - 1:10
b - c(1, 2, 2.5, 3, 3.5, 4, 6, 7
11 matches
Mail list logo