similar to: No subject

Displaying 20 results from an estimated 20000 matches similar to: "No subject"

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 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
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
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 <-
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
2009 Sep 28
2
Polynomial Fitting
Hello All, This might seem elementary to everyone, but please bear with me. I've just spent some time fitting poly functions to time series data in R using lm() and predict(). I want to analyze the functions once I've fit them to the various data I'm studying. However, after pulling the first function into Octave (just by plotting the polynomial function using fplot() over
2007 Jan 08
2
Contrasts for ordered factors
Dear all, I do not seem to grasp how contrasts are set for ordered factors. Perhaps someone can elighten me? When I work with ordered factors, I would often like to be able to reduce the used polynomial to a simpler one (where possible). Thus, I would like to explicetly code the polynomial but ideally, the intial model (thus, the full polynomial) would be identical to one with an ordered factor.
2013 Nov 28
2
Find the prediction or the fitted values for an lm model
Hi, I would like to fit my data with a 4th order polynomial. Now I have only 5 data point, I should have a polynomial that exactly pass the five point Then I would like to compute the "fitted" or "predict" value with a relatively large x dataset. How can I do it? BTW, I thought the model "prodfn" should pass by (0,0), but I just wonder why the const is
2004 Dec 03
3
Computing the minimal polynomial or, at least, its degree
Hi, I would like to know whether there exist algorithms to compute the coefficients or, at least, the degree of the minimal polynomial of a square matrix A (over the field of complex numbers)? I don't know whether this would require symbolic computation. If not, has any of the algorithms been implemented in R? Thanks very much, Ravi. P.S. Just for the sake of completeness, a
2008 Jan 07
3
Polynomial fitting
I wonder how one in R can fit a 3rd degree polynomial to some data? Say the data is: y <- c(15.51, 12.44, 31.5, 21.5, 17.89, 27.09, 15.02, 13.43, 18.18, 11.32) x <- seq(3.75, 6, 0.25) And resulting degrees of polynomial are: 5.8007 -91.6339 472.1726 -774.2584 THanks in advance! -- Jonas Malmros Stockholm University Stockholm, Sweden
2007 Nov 07
3
Can I replace NA by 0 (if yes, how) ?
Hello, I'm trying to fit some points with a 8-degrees polynom (result of lm is stored in pfit). In most of the case, it is ok but for some others, some coefficients are "NA". I don't really understand the meaning of these "NA". And the problem is that I can't perform a derivation (pderiv<-as.function((deriv(polynomial(pfit$coefficients))))) on pfit due to the
2011 Feb 02
2
unequally spaced factor levels orthogonal polynomial contrasts coefficients trend analysis
Hello [R]-help I am trying to find > a package where you can do ANOVA based trend analysis on grouped data > using orthogonal polynomial contrasts coefficients, for unequally > spaced factor levels. The closest hit I've had is from this web site: >(http://webcache.googleusercontent.com/search?q=cache:xN4K_KGuYGcJ:www.datavis.ca/sasmac/orpoly.html+Orthogonal+polynomial >l but I
2011 Jul 07
1
Polynomial fitting
Hello, i'm fairly familiar with R and use it every now and then for math related tasks. I have a simple non polynomial function that i would like to approximate with a polynomial. I already looked into poly, but was unable to understand what to do with it. So my problem is this. I can generate virtually any number of datapoints and would like to find the coeffs a1, a2, ... up to a given
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,
2004 Feb 03
5
lm coefficients
Dear R experts, Excuse me if my question will be stupid... I'd like to fit data with x^2 polynomial: d <- read.table(file = "Oleg.dat", head = TRUE) d X T 3720.00 4.113 3715.00 4.123 3710.00 4.132 ... out <- lm(T ~ poly(X, 4), data = d) out Call: lm(formula = T ~ poly(X, 2), data = d) Coefficients: (Intercept) poly(X, 2)1 poly(X, 2)2
2013 Apr 27
2
Polynomial Regression and NA coefficients in R
Hey all, I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm(). When I perform polynomial regression like this: fit_poly <- lm(y ~ poly(x,11,raw = TRUE)) I get some NA coefficients. I think this is due to the high correlation between say x and x^2 if x is distributed uniformly on the unit interval
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 Apr 22
1
Bug in poly() (PR#11243)
Full_Name: Russell Lenth Version: 2.6.2 OS: Windows XP Pro Submission from: (NULL) (128.255.132.36) The poly() function allows a higher-degree polynomial than it should, when raw=FALSE. For example, consider 5 distinct 'x' values, each repeated twice. we can fit a polynomial of degree 8: ===== R> x = rep(1:5, 2) R> y = rnorm(10) R> lm(y ~ poly(x, 8)) Call: lm(formula = y ~
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())
2007 Aug 15
1
Polynomial fitting
Hi everybody! I'm looking some way to do in R a polynomial fit, say like polyfit function of Octave/MATLAB. For who don't know, c = polyfit(x,y,m) finds the coefficients of a polynomial p(x) of degree m that fits the data, p(x[i]) to y[i], in a least squares sense. The result c is a vector of length m+1 containing the polynomial coefficients in descending powers: p(x) = c[1]*x^n +