Displaying 20 results from an estimated 4000 matches similar to: "How to get the polynomials out of poly()"
2008 Jul 01
1
Orthogonal polynomials and poly
Dear All,
I have found in the poly help this sentence:
The orthogonal polynomial is summarized by the coefficients, which can be
used to evaluate it via the three-term recursion given in Kennedy & Gentle
(1980, pp. 343–4), and used in the predict part of the code.
My question: which type of orthogonal polynomials are used by this function?
Hrmite, legendre..
TIA
Giovanni
[[alternative HTML
2001 Jul 09
1
polynomial regression and poly
When doing polynomial regression I believe it is a good idea to use the poly
function to generate orthogonal polynomials. When doing this in Splus there
is a handy function (transform.poly I think) to convert the coefficients
produced by regression with the poly function back to the original scale.
Has somebody written something similar for R ?
Robert
2008 Feb 13
1
use of poly()
Hi,
I am curious about how to interpret the results of a polynomial regression--
using poly(raw=TRUE) vs. poly(raw=FALSE).
set.seed(123456)
x <- rnorm(100)
y <- jitter(1*x + 2*x^2 + 3*x^3 , 250)
plot(y ~ x)
l.poly <- lm(y ~ poly(x, 3))
l.poly.raw <- lm(y ~ poly(x, 3, raw=TRUE))
s <- seq(-3, 3, by=0.1)
lines(s, predict(l.poly, data.frame(x=s)), col=1)
lines(s,
2002 Oct 08
2
Orthogonal Polynomials
Looking to the wonderful statistical advice that this group can offer.
In behavioral science applications of stats, we are often introduced to
coefficients for orthogonal polynomials that are nice integers. For
instance, Kirk's experimental design book presents the following
coefficients for p=4:
Linear -3 -1 1 3
Quadratic 1 -1 -1 1
Cubic -1 3 -3 1
In R orthogonal
2005 Jun 29
1
poly() in lm() leads to wrong coefficients (but correct residuals)
Dear all,
I am using poly() in lm() in the following form.
1> DelsDPWOS.lm3 <- lm(DelsPDWOS[,1] ~ poly(DelsPDWOS[,4],3))
2> DelsDPWOS.I.lm3 <- lm(DelsPDWOS[,1] ~ poly(I(DelsPDWOS[,4]),3))
3> DelsDPWOS.2.lm3 <-
lm(DelsPDWOS[,1]~DelsPDWOS[,4]+I(DelsPDWOS[,4]^2)+I(DelsPDWOS[,4]^3))
1 and 2 lead to identical but wrong results. 3 is correct. Surprisingly
(to me) the residuals
2005 Nov 10
2
polynomials transformation
Dear All,
Need some help in polynomials transformation to get the coefficients. I have tried "poly.transform" as applied in S-plus but it does not work.
Thanks in advanced for any helps.
Regards.
Abd. Rahman Kassim (PhD)
Head Forest Ecology Branch
Forest Management & Ecology Program
Forestry and Conservation Division
Forest Research Institute Malaysia
Kepong 52109
Selangor,
2006 Sep 07
1
legend problems in lattice
Hi!
Im sorry to bother you but I cant fix this.
I use the lattice function levelplot and I want the colorkey at the
bottom, how do I get it there? I have tried changing colorkey.space and
changing in legend but I cant get it right, plz help
btw I'd like to speceify strings to appear at the tick marks and also
there I fail any thoughts?
cheers
Ernst
2006 Jan 26
2
Prediction when using orthogonal polynomials in regression
Folks,
I'm doing fine with using orthogonal polynomials in a regression context:
# We will deal with noisy data from the d.g.p. y = sin(x) + e
x <- seq(0, 3.141592654, length.out=20)
y <- sin(x) + 0.1*rnorm(10)
d <- lm(y ~ poly(x, 4))
plot(x, y, type="l"); lines(x, d$fitted.values, col="blue") # Fits great!
all.equal(as.numeric(d$coefficients[1] + m
2003 Apr 29
1
polynomial fitting
I'm trying to find a way to fit a polynomial of degree n in x and y to
a set of x, y, and z data that I have and obtain the coefficients for
the terms of the fitted polynomial. However, when I try to use the
surf.ls function I'm getting odd results.
> x <- seq(0, 10, length=50)
> y <- x
> f <- function (x, y) {x^2 + y}
> library(spatial)
> test <-
2002 Oct 09
1
Summary Orthogonal Polynomials
As usual, the R newsgroup set me straight (thanks to Douglas Bates, Robert
Balshaw and Albyn Jones).
There is really no difference between using orthogonal polynomials of the
form:
Linear -3 -1 1 3
Quadratic 1 -1 -1 1
Cubic -1 3 -3 1
Versus
> poly(c(1:4),3)
1 2 3
[1,] -0.6708204 0.5 -0.2236068
[2,] -0.2236068 -0.5 0.6708204
[3,] 0.2236068
2005 Jun 14
2
ordinary polynomial coefficients from orthogonal polynomials?
How can ordinary polynomial coefficients be calculated
from an orthogonal polynomial fit?
I'm trying to do something like find a,b,c,d from
lm(billions ~ a+b*decade+c*decade^2+d*decade^3)
but that gives: "Error in eval(expr, envir, enclos) :
Object "a" not found"
> decade <- c(1950, 1960, 1970, 1980, 1990)
> billions <- c(3.5, 5, 7.5, 13, 40)
> #
2015 Jul 17
1
Improvements (?) in stats::poly and stats::polym.
Dear Keith,
>>>>> <Keith.Jewell at campdenbri.co.uk>
>>>>> on Thu, 16 Jul 2015 08:58:11 +0000 writes:
> Dear R Core Team,
> Last week I made a post to the R-help mailing list
> ?predict.poly for multivariate data?
> <https://stat.ethz.ch/pipermail/r-help/2015-July/430311.html>
> but it has had no responses so I?m
2013 Apr 01
2
example to demonstrate benefits of poly in regression?
Here's my little discussion example for a quadratic regression:
http://pj.freefaculty.org/R/WorkingExamples/regression-quadratic-1.R
Students press me to know the benefits of poly() over the more obvious
regression formulas.
I think I understand the theory on why poly() should be more numerically
stable, but I'm having trouble writing down an example that proves the
benefit of this.
I
2003 Jun 23
1
precision matrix for polynomial growth curves
What does the warning message
"1: Singular precision matrix in level -1, block 1" mean?
I get this warning 50+ times when I try to fit the following
model
lme( response ~ covariateA + poly(covariateB,3), ~poly(covariateB,3)|group )
It's not a small dataset - a set of up to 20 blood pressure
readings on just over 2000 people, and I don't get the error
message when I try to fit
2004 May 06
5
Orthogonal Polynomial Regression Parameter Estimation
Dear all,
Can any one tell me how can i perform Orthogonal
Polynomial Regression parameter estimation in R?
--------------------------------------------
Here is an "Orthogonal Polynomial" Regression problem
collected from Draper, Smith(1981), page 269. Note
that only value of alpha0 (intercept term) and signs
of each estimate match with the result obtained from
coef(orth.fit). What
2005 Feb 01
3
polynomials REML and ML in nlme
Hello everyone,
I hope this is a fair enough question, but I don’t have access to a copy
of Bates and Pinheiro. It is probably quite obvious but the answer might
be of general interest.
If I fit a fixed effect with an added quadratic term and then do it as
an orthogonal polynomial using maximum likelihood I get the expected
result- they have the same logLik.
2009 Dec 22
2
use of lm() and poly()
Hi all,
I want to fit data called "metal" with a polynominal function as dP ~ a.0 +
a.1 * U0 + a.2 * U0^2 + a.3 * U0^3 + a.4 * U0^4
The data set includes, the independant variable U0 and the dependant
variable dP.
I've seen that the combination of lm() and poly() can do that instead of
using the nls() function.
But I don't get how to interpret the results from the linear
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
Full_Name: Renaud Lancelot
Version: Version 2.3.0 (2006-04-24)
OS: MS Windows XP Pro SP2
Submission from: (NULL) (82.239.219.108)
I think there is a bug in predict.lme, when a polynomial generated by poly() is
used as an explanatory variable, and a new data.frame is used for predictions. I
guess this is related to * not * using, for predictions, the coefs used in
constructing the orthogonal
2003 Jan 16
2
polynomial contrasts in R
In S-Plus, I can obtain polynomial contrasts for an ordered factor with
contr.poly(). The function also exists in R, however is limited to factors
where the levels are equally spaced. In S-Plus, one can obtain the contrasts
for a set of numeric values representing unequally spaced ordered factors.
Has anyone implemented this in R? I see that the S-Plus function calls
another function (poly.raw())
2009 Nov 28
1
R function that duplicates Octave's poly function?
By any chance is anyone aware of an R function that duplicates Octave's poly function?
Here is a description of Octave's poly function:
Function File: poly (A)
If A is a square N-by-N matrix, `poly (A)' is the row vector of
the coefficients of `det (z * eye (N) - a)', the characteristic
polynomial of A. As an example we can use this to find the
eigenvalues