search for: poli

Displaying 20 results from an estimated 726 matches for "poli".

Did you mean: pol
2007 Dec 28
1
logistic mixed effects models with lmer
I have a question about some strange results I get when using lmer to build a logistic mixed effects model. I have a data set of about 30k points, and I'm trying to do backwards selection to reduce the number of fixed effects in my model. I've got 3 crossed random effects and about 20 or so fixed effects. At a certain point, I get a model (m17) where the fixed effects are like this
2008 Apr 25
1
R-devel Digest, Vol 62, Issue 24
The columns of the model matrix are all orthogonal. So the problem lies with poly(), not with lm(). > x = rep(1:5,3) y = rnorm(15) z <- model.matrix(lm(y ~ poly(x, 12))) x = rep(1:5,3) > y = rnorm(15) > z <- model.matrix(lm(y ~ poly(x, 12))) > round(crossprod(z),15) (Intercept) poly(x, 12)1 poly(x, 12)2 poly(x, 12)3 poly(x, 12)4 (Intercept)
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 ~
2007 Jan 25
1
poly(x) workaround when x has missing values
Often in practical situations a predictor has missing values, so that poly crashes. For instance: > x<-1:10 > y<- x - 3 * x^2 + rnorm(10)/3 > x[3]<-NA > lm( y ~ poly(x,2) ) Error in poly(x, 2) : missing values are not allowed in 'poly' > > lm( y ~ poly(x,2) , subset=!is.na(x)) # This does not help?!? Error in poly(x, 2) : missing values are not allowed in
2008 Apr 23
0
poly() can exceed degree k - 1 for k distinct points (PR#11251)
The poly() function can create more variables than can be fitted when there are replicated values. In the example below, 'x' has only 5 distinct values, but I can apparently fit a 12th-degree polynomial with no error messages or even nonzero coefficients: R> x = rep(1:5,3) R> y = rnorm(15) R> lm(y ~ poly(x, 12)) Call: lm(formula = y ~ poly(x, 12)) Coefficients:
2005 Feb 15
3
using poly in a linear regression in the presence of NA f ails (despite subsetting them out)
This smells like a bug to me. The error is triggered by the line: variables <- eval(predvars, data, env) inside model.frame.default(). At that point, na.action has not been applied, so poly() ended being called on data that still contains missing values. The qr() that issued the error is for generating the orthogonal basis when evaluating poly(), not for fitting the linear model itself.
2005 Feb 15
3
using poly in a linear regression in the presence of NA f ails (despite subsetting them out)
This smells like a bug to me. The error is triggered by the line: variables <- eval(predvars, data, env) inside model.frame.default(). At that point, na.action has not been applied, so poly() ended being called on data that still contains missing values. The qr() that issued the error is for generating the orthogonal basis when evaluating poly(), not for fitting the linear model itself.
2012 Mar 14
0
using predict() with poly(x, raw=TRUE)
Dear r-devel list members, I've recently encountered the following problem using predict() with a model that has raw-polynomial terms. (Actually, I encountered the problem using model.frame(), but the source of the error is the same.) The problem is technical and concerns the design of poly(), which is why I'm sending this message to r-devel rather than r-help. To illustrate:
2012 Sep 14
0
problem with user defined panel function in xyplot
Hi everyone, ? I am trying to do a horizonplot using my own time series data. I know that there is a horizonplot function in latticeExtra, but on closer examination i think that the graph itself is slightly wrong (it displays some regions as triangles and i think they should be trapezoids, and the red regions (that are below the baseline) are displayed on top of the blue areas ? while i think
2005 Feb 14
0
using poly in a linear regression in the presence of NA fails (despite subsetting them out)
I ran into a to me surprising result on running lm with an orthogonal polynomial among the predictors. The lm command resulted in Error in qr(X) : NA/NaN/Inf in foreign function call (arg 1) Error during wrapup: despite my using a "subset" in the call to get rid of NA's. poly is apparently evaluated before any NA's are subsetted out of the data. Example code (attached to
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
2008 Mar 07
5
Puzzling coefficients for linear fitting to polynom
Hi, I can not comprehend the linear fitting results of polynoms. For example, given the following data (representing y = x^2): > x <- 1:3 > y <- c(1, 4, 9) performing a linear fit > f <- lm(y ~ poly(x, 2)) gives weird coefficients: > coefficients(f) (Intercept) poly(x, 2)1 poly(x, 2)2 4.6666667 5.6568542 0.8164966 However the fitted() result makes sense: >
2002 Jul 03
0
poly.transform in R
Dear all, I am trying to transform polynomial coefficients from orthogonal form to the standard power basis. There's poly.transform in S-plus. Does anybody know how to do that in R ? I've found question about that in the archives of R-help but no real answer. Example : I'm doing polynomial regression of percentage of one insect in a community on altitude, precipitations,
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
2008 Oct 08
1
Error in spdep: system is computationally singular
...rom matriz** coords1<-matriz[matriz$casos1==1, c(4,5)] coords1<-as.matrix(coords1) **I identify neighbours of region points** nb20<-dnearneigh(coords1,0,20,longlat=TRUE) ** I build a neighbours list with spatial weights** nb20.w<-nb2listw(nb20, glist=NULL, style="W", zero.policy=TRUE) **I run a glm** glm1<-glm(matriz$sp~poly(matriz$iso,3)+poly(matriz$tmax,3)+poly(matriz$mdr,3)+poly(matriz$twq,3)+poly(matriz$tmin,3)+poly(matriz$pdq,3)+poly(matriz$trng,3),data=matriz, subset=matriz$casos1>0, family=binomial) glm.scope<-list("var1"=~1+iso+poly(iso,2)+po...
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
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 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) > #
2013 Apr 01
2
example to demonstrate benefits of poly in regression?
...e columns in X are x1 x2 x3 x3squared then the QR decomposition is doing about the same thing as we would do if we replaced x3 and x3squared by the poly(x3, 2) results. Or not. I'm not arguing that, I'm thinking out loud, hoping you'll correct me. pj -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu [[alternative HTML version deleted]]