search for: cubic

Displaying 20 results from an estimated 483 matches for "cubic".

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 > dp...
2012 Dec 01
3
cubic spline
Hallo, I'm facing a problem and I would really appreciate your support. I have to translate some Matalb code in R that I don't know very well but I would like to. I have to interpolate 5 point with a cubic spline function and then I expect my function returns the Y value as output a specific X value inside the evaluation range. Let's suppose that: 1- *X = [-10, -5, 0, 5, 10]* 2 - *Y = [12, 10, 8, 7, 6]* 3 - *I have to interpolate with a cubic spline assuming x=11* In Matlab I used this...
2010 Feb 13
3
Plot different regression models on one graph
The following variables have the following significant relationships (x is the explanatory variable): linear, cubic, exponential, logistic. The linear relationship plots without any trouble. Cubic is the 'best' model, but it is not plotting as a smooth curve using the following code: cubic.lm<- lm(y~poly(x,3)) lines(x,predict(cubic.lm),lwd=2) How do I plot the data and the estimated curves for all...
2005 May 02
2
Restricted cubic spline function ERROR?: glm(Y~rcs(x,5))
Dear all, Is the restricted cubic spline function working properly in the glm model? We used glm(y~rcs(x,5), family=binomial) but it seems that for some theoretical reasons the rcs, restricted cubic spline function can not be fitted by a glm function. Is this correct? Regards, Jan ((Originally, we used lrm(y~ rcs(x,5)) but we c...
2010 Apr 09
1
How to get the penalty matrix for natural cubic spline?
Hi, all I am trying to get the basis matrix and penalty matrix for natural cubic splines. In the "splines" package of R,"ns" can generate the B-spline basis matrix for a natural cubic spline. How can I get the basis matrix and penalty matrix for natural cubic spline. Thanks a lot! Lee [[alternative HTML version deleted]]
2010 Apr 19
0
Natural cubic splines produced by smooth.Pspline and predict function in the package "pspline"
Hello, I am using R and the smooth.Pspline function in the pspline package to smooth some data by using natural cubic splines. After fitting a sufficiently smooth spline using the following call: (ps=smooth.Pspline(x,y,norder=2,spar=0.8,method=1) [the values of x are age in years from 1 to 100] I tried to check that R in fact had fitted a natural cubic spline by checking that the resulting spline was LINEAR out...
2011 Aug 16
0
Cubic splines in package "mgcv"
re: Cubic splines in package "mgcv" I don't have access to Gu (2002) but clearly the function R(x,z) defined on p126 of Simon Wood's book is piecewise quartic, not piecewise cubic. Like Kunio Takezawa (below) I was puzzled by the word "cubic" on p126. As Simon Wood writes, this...
2004 Nov 10
2
cubic spline/smoother with nlme
Greetings, I would like to use a cubic spline or smoother to model the fixed effects within nlme. So far the only smoother I have been able to get to run successfully in nlme is smooth(). I tried smooth.spline: fixed=list(lKa~1,lCL~smooth.spline(BSA, df=3)) the error I got was the following. Error in model.frame(formula, rown...
2013 Mar 06
1
Constrained cubic smoothing spline
Hello everone,            Anyone who knows how to force a cubic smoothing spline to pass through a particular point?            I found on website  someone said that we can use "cobs package" to force the spline pass through certain points or impose shape           constraints (increasing, decreasing). However,  this package is using  B-spline and can...
2011 Oct 11
1
restricted cubic spline within survfit.cph in the package rms
Hello,   does anyone have an example on how to use restricted cubic splines function rcs within survfit.cph, if cph (Cox Proportional Hazard Regression) was done with restricted cubic splines (which I made to work)? Thank you. > [[alternative HTML version deleted]]
2009 Mar 31
2
How to generate natural cubic spline in R?
Suppose I have two var x and y,now I want to fits a natural cubic spline in x to y,at the same time create new var containing the smoothed values of y. How can I get it?
2007 May 08
1
Piecewise cubic Hermite interpolation
Which function implements the piecewise cubic Hermite interpolation? I am looking for equivalent of matlab's interp1 with the method = 'pchip' Here is the reference http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/interp1.html& -- View this message in context: http://www.nab...
2007 Dec 26
1
Cubic splines in package "mgcv"
R-users E-mail: r-help@r-project.org My understanding is that package "mgcv" is based on "Generalized Additive Models: An Introduction with R (by Simon N. Wood)". On the page 126 of this book, eq(3.4) looks a quartic equation with respect to "x", not a cubic equation. I am wondering if all routines which uses cubic splines in mgcv are based on this quartic equation. In my humble opinion, the '^4' in the first term of the second line of this equation should be '^3'. K. Takezawa -- ***** r.otasuke@gmail.com ***** http://cse.nar...
2010 May 14
1
Cubic B-spline, how to numerically integrate?
...com/articles/meps/149/m149p023.pdf). I want to obtain figures similar to Fig 3 c & f in Limpus & Chaloupka (1997), which according to the figure legend are "expected size-at-age functions" obtained by numerically integrating "size-specific growth rate functions derived using cubic B-spline fit to GAM predicted values". I was able to fit the cubic-B spline, but I do not know how to "numerically integrate" it. Can anybody help please? Code and figures here: https://docs.google.com/fileview?id=0B1cQ7z9xYFl2ZTZhMmMyMjAtYTA3Zi00N2QyLTkxNzMtOGYyMjdiOGU2ZWE4&h...
2011 Nov 22
0
plotting output from LME with natural cubic spline
I have used LME to fit a mixed effects model on my data. The data has 274 subjects with 1 to 6 observations per subject. Time is not linearly associated with the outcome, so I used ns to fit a natural cubic spline with 3 auto knots. Subject and the natural cubic time of spline are both treated as random effects. This model has run without any problem, but now I would like to plot trajectories for subjects using their fitted random effects and incorporating the shape of the natural cubic spline. I am a...
2018 Mar 15
0
cubic complete Scheffe mixture models
Hello everyone I'm trying to use Scheffe's complete cubic model (mixture design). In the bibliographies, they indicate that the term is of the type: A * B * (A-B). But I see that trying to adjust the three cubic terms results in singularities. I know this implies not having the inverse matrix: solve (t (X)% *% X) does not exist. The bibliographies sho...
2008 May 29
2
Plotting a cubic line from a multiple regression
Dear all, I'm attempting to plot a cubic relationship between two variables controlling for the effects of a third variable. In this short example, I'm trying to use AGE to predict CORTEX while controlling for the effects of TIV (total intracranial volume): ######################## cortex = rnorm(100, mean=0.5, sd=0.5) age = rn...
2008 Oct 10
1
how to evaluate a cubic Bezier curve (B-spline?) given the four control points
I'm trying to use R to determine the quality of a cubic Bezier curve approximation of an elliptical arc. I know the four control points and I want to compute (x,y) coordinates of many points on the curve. I can't find anything in either the base distribution or CRAN that does this; all the spline-related packages seem to be about *fitting* piecewis...
2007 May 21
2
comparing fit of cubic spline
I want to compare the fit of a quadratic model to continuous data, with that of a cubic spline fit. Is there a way of computing AIC from for e.g. a GAM with a smoothing spine, and comparing this to AIC from a quadratic model? Cheers ****************************************** Tom Reed PhD Student Institute of Evolutionary Biology 102 Ashworth Laboratories Kings Buildings Unive...
2006 Sep 01
2
Lattice plot with fitted curves
I have some data which consists of time series for a number of sites. It appears that there is not much autocorrelation in the data and I have fitted a cubic for each site using lm. I would like to obtain a lattice plot with one panel for each site and showing the original data, and the fitted cubic. The closest I have got to doing what I want is: fit <- fitted(paraslm1) temp <- cbind(paras, fit) xyplot(Density ~ Year | LocCode, data = temp,...