Displaying 20 results from an estimated 6000 matches similar to: "Orthogonal Polynomials"
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
2008 Apr 10
1
Orthogonal polynomial contrasts
How do you remove one of the terms from an ordered polynomial contrast in
your linear model. For example, I have significant terms for linear and
cubic but not quadratic, how would i remove the quadratic term from
lm(response~treatment)
Cheers,
Chris
--
View this message in context: http://www.nabble.com/Orthogonal-polynomial-contrasts-tp16608353p16608353.html
Sent from the R help mailing list
2003 Apr 09
3
Reading in multiple files
I apologize if this is a FAQ -- I kind of recall seeing something along
these lines before, but I couldn't find the message when I searched the
archives.
Problem:
1. I have hundreds of small files in a subdirectory ("c:\\temp") and I would
like to combine the files into a single data frame.
2. Individually, it is easy to read each file
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
2003 Feb 28
2
lattice and fitted function error
Platform: WIN2000
Version of R: 1.6.2
I'm interested in plotting fitted values in a trellis xyplot. I believe the
following should work; however, I only get the points (not the fitted
lines).
library(lattice)
trellis.device(bg="white")
xyplot(MULTDV~TIME|SUBNUM,data=TEMP,
panel=function(x,y){
panel.xyplot(x,y)
lines(x,fitted(lm(y~poly(x,1),na.action=na.omit)))
2012 Jun 13
3
How to plot linear, cubic and quadratic fitting curve in a figure?
Hi R experts,
Could you please help me to fit a linear, cubic and quadratic curve in a figure? I was trying to show all these three fitting curves with different colour in one figure.
I spent substantial time to figure it out, but I could not.
I have given here a example and what I did for linear, but no idea for cubic and quadratic fitting curve
> dput(test)
structure(list(sp = c(4L, 5L,
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
2007 Feb 27
2
RDA and trend surface regression
Dear all,
I'm performing RDA on plant presence/absence data, constrained by
geographical locations. I'd like to constrain the RDA by the "extended
matrix of geographical coordinates" -ie the matrix of geographical
coordinates completed by adding all terms of a cubic trend surface
regression- .
This is the command I use (package vegan):
>rda(Helling ~
2001 Sep 30
2
non linear models
Dear Members of the Help List,
Honestly, I feel a little bit stupid - I would like to do something rather
simple: fit a non linear model to existing data, to be more precise I wanted
to start with simple higher order polynomials.
Unfortunately, I do not quite understand the examples in the helpfiles for
the nlm, nls and nlsModel commands.
Could anyone please provide a simple example to get me
2009 Aug 16
1
How to deal with multicollinearity in mixed models (with lmer)?
Dear R users,
I have a problem with multicollinearity in mixed models and I am using lmer
in package lme4. From previous mailing list, I learn of a reply
"http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg38537.html" which
states that if not for interpretation but just for prediction,
multicollinearity does not matter much. However, I am using mixed model to
interpret something,
2010 Jan 05
4
solving cubic/quartic equations non-iteratively
To R-helpers,
R offers the polyroot function for solving mentioned equations
iteratively.
However, Dr Math and Mathworld (and other places) show in detail how to
solve mentioned equations non-iteratively.
Do implementations for R that are non-iterative and that solve mentioned
equations exists?
Regards, Mads Jeppe
2009 Feb 23
3
Insurance data in library(MASS)
I have used the insurance data from R library and I have 2 questions:
I use the following:
>library(MASS)
>data(Insurance)
> m1=glm(Claims ~ District + Group + Age + offset(log(Holders)),data =
Insurance, family = poisson)
>summary(m1)
Call:
glm(formula = Claims ~ District + Group + Age + offset(log(Holders)),
family = poisson, data = Insurance)
Deviance Residuals:
Min
2012 Jan 09
2
Joint confidence interval for fractional polynomial terms
Dear R users,
The package 'mfp' that fits fractional polynomial terms to predictors.
Example:
data(GBSG)
f <- mfp(Surv(rfst, cens) ~ fp(age, df = 4, select = 0.05)
+ fp(prm, df = 4, select = 0.05), family = cox, data = GBSG)
print(f)
To describe the association between the original predictor, eg. age and
risk for different values of age I can plot it the polynomials
2007 Apr 30
0
Intercept Coefficient in a Model with Orthogonal Polynomials
This very likely falls in the category of an unexpected result due to
user ignorance. I generated the following data:
time <- 0:10
set.seed(4302007)
y <- 268 + -9*time + .4*(time^2) + rnorm(11, 0, .1)
I then fit models using both orthogonal and raw polynomials:
fit1 <- lm(y ~ poly(time, 2))
fit2 <- lm(y ~ poly(time, degree=2, raw=TRUE))
> predict(fit1, data.frame(time =
2008 Jan 05
2
Behavior of ordered factors in glm
I have a variable which is roughly age categories in decades. In the
original data, it came in coded:
> str(xxx)
'data.frame': 58271 obs. of 29 variables:
$ issuecat : Factor w/ 5 levels "0 - 39","40 - 49",..: 1 1 1 1...
snip
I then defined issuecat as ordered:
> xxx$issuecat<-as.ordered(xxx$issuecat)
When I include issuecat in a glm model, the result
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)
> #
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.
2007 Feb 12
1
How to get the polynomials out of poly()
Hi Folks!
Im using the function poly to generate orthogonal polynomials, but Id like
to see the actual polynomials so that I could convert it to a polynomial
in my original variable. Is that possible and if so how do I do it?
/E
2011 May 06
2
Confidence intervals and polynomial fits
Hi all! I'm getting a model fit from glm() (a binary logistic regression fit, but I don't think that's important) for a formula that contains powers of the explanatory variable up to fourth. So the fit looks something like this (typing into mail; the actual fit code is complicated because it involves step-down and so forth):
x_sq <- x * x
x_cb <- x * x * x
x_qt <- x * x * x
2013 Jan 03
1
interpreting results of regression using ordinal predictors in R
Dear friends,
Being very new to this, I was wondering if I could get some pointers
and guidance to interpreting the results of performing a linear
regression with ordinal predictors in R.
Here is a simple, toy example:
y <- c(-0.11, -0.49, -1.10, 0.08, 0.31, -1.21, -0.05, -0.40, -0.01,
-0.12, 0.55, 1.34, 1.00, -0.31, -0.73, -1.68, 0.38, 1.22,
-1.11, -0.20)
x <-