Displaying 20 results from an estimated 10000 matches similar to: "polynomial expansion in R"
2005 Aug 08
2
coefficient of polynomial expansion
Hi,
I would like to get the coefficient of polynomial expansion. For example,
(1+ x)^2 = 1 + 2x + x^2, and the coefficients are 1, 2 and 1.
(1 + x + x^2)^3 = 1 + 3*x + 6*x^2 + 7*x^3 + 6*x^4 + 3*x^5 + x^6, and
the coefficients are 1, 3, 6, 7, 6, 3, and 1.
I know that we can use polynom library. Is there any other way to do
it without loading a library.
Thanks a lot for your help.
Peter
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
2006 Mar 29
2
bivariate case in Local Polynomials regression
Hi:
I am using the package "KernSmooth" to do the local polynomial regression. However, it seems the function "locpoly" can only deal with univariate covaraite. I wonder is there any kernel smoothing package in R can deal with bivariate covariates? I also checked the package "lcofit" in which function "lcofit" can indeed deal with bivariate case. The
2006 Nov 22
1
question about the "solve" function in library "Matrix"
Hi:
I have some problems when I use the function "solve" function in a loop. In the following code, I have a diagonal martix "ttt" whose elements change in every iteration in a loop. I defined a "dpoMatrix"class before the loop so I do not need to define this class every time in the loop. The reason is to save some computing time. The code is below. The inverse
2010 Oct 14
1
Fw: Problem to create a matrix polynomial
Awaiting some suggestion. Was my question not very understandable? Please let me know how can I offer more elaborate clarification.
Additionally, I would like to solve the determinant of "p1" for the values of "z" (I am working with some multivariate time series modelling). When I use det() function, it am getting error that, that function is not for objects with class
2010 Oct 05
2
Using as.polynomial() over a matrix
Hello All
First - a warning. I'm not very R or programming savvy.
I am trying to do something without much luck, and have scoured help-pages, but nothing has come up. Here it is:
I have a matrix (m) of approx 40,000 rows and 3 columns, filled with numbers.
I would like to convert the contents of this matrix into another matrix (m_p), where the numbers of (m) have been coerced into a
2003 Oct 21
2
Polynomial lags
Does anybody know if there is a built in fuction to use create polynomial
distributed lags (sometimed called Almon lag) on linear models?
Thanks
Francisco
_________________________________________________________________
See when your friends are online with MSN Messenger 6.0. Download it now
2007 Feb 05
2
"lme" in R and Splus-7
Hi:
I used the function "lme" in R and Splus-7. With the same dataset and same argument for the function, I got quite different estimation results from these two software. Anyone has this experience before?
zhong
---------------------------------
Get your own web address.
[[alternative HTML version deleted]]
2005 Mar 09
3
from long/lat to UTM
Hi:
Is there any function in R which can convert the
long/lat to UTM(Universal Transverse Mercator)?
There are quite a few converters on Internet.
However, the interface is designed as input->output
which I can not convert lots of locations at the same
time.
Another question is whether there is a function in R
which can tell the time zone from the location's
lat/long?
Thank you!
2003 Nov 03
1
svm in e1071 package: polynomial vs linear kernel
I am trying to understand what is the difference between linear and
polynomial kernel:
linear: u'*v
polynomial: (gamma*u'*v + coef0)^degree
It would seem that polynomial kernel with gamma = 1; coef0 = 0 and degree
= 1
should be identical to linear kernel, however it gives me significantly
different results for very simple
data set, with linear kernel
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 +
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
2004 Oct 11
2
memory in R
Hi:
I am doing a MCMC algorithm which is well known to
consume much computer memory. And I have a problem
everytime I run my R program. It stopped at certain
iteration and says "can not allocate a vector of 19
kb".
It seems that the computer's memory has been
exhausted. However, it is said that after each
iteration the objects (such as a huge matrix) can be
set to NULL. And the
2005 Jul 08
2
time series regression
Hi:
I have two time series y(t) and x(t). I want to
regress Y on X. Because Y is a time series and may
have autocorrelation such as AR(p), so it is not
efficient to use OLS directly. The model I am trying
to fit is like
Y(t)=beta0+beta1*X(t)+rho*Y(t-1)+e(t)
e(t) is iid normal random error. Anybody know whether
there is a function in R can fit such models? The
function can also let me specify
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
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 Jul 04
1
Plot 2-d Polynomial without solving it
Hi,
I want to plot a polynomial in the form like ax^2 + bxy + cy^2 + dx + ey + f
=0 without solving it(since I may have 3 or 4 dimensional polynomial and
it's really hard to solve). Is there any way to plot this kind of
polynomial?
Thanks a lot!
--
View this message in context: http://www.nabble.com/Plot-2-d-Polynomial-without-solving-it-tp24331313p24331313.html
Sent from the R help
2006 Oct 09
1
Coefficients of a factorized polynomial
Hi all,
starting from a vector "v[1:n]" I would like to compute the coefficients
of the polynomial (1+x^v[1])*(1+x^v[2])*...*(1+x^v[n]). The following
code works but is extremely slow for a large "n" due to, I believe, the
polynomial being factorized. I wanted to try the package "polynom"
command "unclass" but I could not figure out how to input a
2012 Apr 19
1
How to find a root for a polynomial between [-inf, -3]?
Hi all,
I have a polynomial (a big one) and I would like to find a root of it
between [-inf, -3] (it's known there is one root in this interval)...
How to find that root?
In using "uniroot" I need to supply the bounds....
In using "polyroot" I need to write it in the strict sens polynomial
format... but I cannot... i.e. the polynomial is implicit...
Thank you!
2009 Sep 17
1
Problems with the commands FUNCTION and DERIV to build a polynomial
Hi all,
I need to automate a process in order to prepare a a big loop in the future
but I have a problem with the *command function*
First I fit a model with lm
>
model1<-lm(data2[,2]~data2[,1]+I(data2[,1]^2)+I(data2[,1]^3)+I(data2[,1]^4))
I extract the coefficients to build the polynomial.
coef<-as.matrix(model1$coefficients)
In the next step I need to define the polynomial to