similar to: custom panel help in lattice

Displaying 20 results from an estimated 20000 matches similar to: "custom panel help in lattice"

2010 Jun 18
1
ow to apply a panel function to each of several data series plotted on the same graph in lattice
Hi is it possible to fit a trend line (or some other panel function) through each of multiple data series plotted on the same graph? Specifically, while one can do something like xyplot(a+b+c~x) which plots three series, a,b & c, but can one automatically fit lines through each of them? I suppose one could generate three more variables afit, bfit, and cfit with a model & predict and
2006 Mar 17
1
Derivative of a splinefun function.
Is there a way of calculating the derivative of a function returned by splinefun()? Such a function is a cubic spline, whence it has a calculable derivative, but is there a (simple) way of getting at it? One workaround that I have thought of is to take a fine grid of points, evaluate the function returned by splinefun() at these points, put an interpolating spline through these points using
2007 Jul 04
3
Problem/bug with smooth.spline and all.knots=T
Dear list, if I do smooth.spline(tmpSec, tmpT, all.knots=T) with the attached data, I get this error-message: Error in smooth.spline(tmpSec, tmpT, all.knots = T) : smoothing parameter value too small If I do smooth.spline(tmpSec[-single arbitrary number], tmpT[-single arbitrary number], all.knots=T) it works! I just don't see it. It works for hundrets other datasets, but not for
2003 Aug 14
2
Using spline parameters to generate data
# I need to generate some data. I'm modeling some time series that follow a # negative exponential decay (mostly). I have 20 samples that can easily be fit with cubic splines. # What I want to do is generate many thousands of similar samples using the parameters from the splines # For instance one data sample looks not unlike this: foo.curve <- 1 * exp(-0.01 * 1:500) + 0.5
2002 Nov 25
2
Pspline smoothing
Dear all, I'm trying to use the Pspline add-on package to fit a quintic spline (norder =3), but I keep running into a Singularity error. > traj.spl <- smooth.Pspline(time, x, norder=3 ) Error in smooth.Pspline(time, x, norder = 3) : Singularity error in solving equations > Playing around with the other parameters produces an "unused arguments" error: > traj.spl
2006 Jul 31
1
questions regarding spline functions
Greetings, A couple general questions regarding the use of splines to interpolate depth profile data. Here is an example of a set of depths, with associated attributes for a given soil profile, along with a function for calculating midpoints from a set of soil horizon boundaries: #calculate midpoints: mid <- function(x) { for( i in 1:length(x)) { if( i > 1) { a[i] = (x[i] -
2007 Oct 05
2
Splines
I want to fit a cubic spline of x on y. where : x [1] 467 468 460 460 450 432 419 420 423 423 y [1] 1 2 3 4 5 6 7 8 9 10 using the syntax spline(y, x) I got following output : $x [1] 1.000000 1.310345 1.620690 1.931034 2.241379 2.551724 2.862069 [8] 3.172414 3.482759 3.793103 4.103448 4.413793 4.724138 5.034483 [15] 5.344828 5.655172
2013 Feb 27
1
Finding the knots in a smoothing spline using nknots
Hi r-helpers. Please forgive my ignorance, but I would like to plot a smoothing spline (smooth.spline) from package "stats", and show the knots in the plot, and I can't seem to figure out where smooth.spline has located the knots (when I use nknots). Unfortunately, I don't know a lot about splines, but I know that they provide me an easy way to estimate the location of local
2009 Sep 24
1
basic cubic spline smoothing
Hello, I come from a non statistics background, but R is available to me, and I needed to test an implementation of smoothing spline that I have written in c++, so I would like to match the results with R (for my unit tests) I am following http://www.nabble.com/file/p25569553/SPLINES.PDF SPLINES.PDF where we have a list of points (xi, yi), the yi points are random such that: y_i = f(x_i) +
2004 Nov 08
1
how lambda is computed in smoot.spline given _df_
Hi, I posted some days ago a question concerning the computation of lambda in the smooth.spline function (which I repreat at the bottom of the mail) given _df_ . Unfortunately the documentation is not clear to me. Maybee someone can help to answer in my view the basic question: If the penalized log likelihood is L = (y - f)' W (y - f) + lambda c' Sigma c how the _lambda_ in the above
2001 Dec 13
1
Code for Hodrick-Prescott Filter: Special Case of smooth. spline?
I've had a play with this and, due to my own short-comings, remain none the wiser. In particular, I'm not sure what value of 'spar' is consistent with the magic lambda=1/1600 for quarterly data. I initially interpreted spar as lambda and tried setting spar=1/1600. This results in almost no smoothing while spar=1600 causes an error. The smooth.spline function seems to want
2005 Jul 12
1
getting panel.loess to use updated version of loess.smooth
I'm updating the loess routines to allow for, among other things, arbitrary local polynomial degree and number of predictors. For now, I've given the updated package its own namespace. The trouble is, panel.loess still calls the original code in package:stats instead of the new loess package, regardless of whether package:loess or package:lattice comes first in the search list. If I
2004 Jul 07
1
Histograms, density, and relative frequencies
R-users, I have been using R for about 1 year, and I have run across a couple of graphics problem that I am not quite sure how to address. I have read up on the email threads regarding the differences between density and relative frequencies (count/sum(count) on the R list, and I am hoping that someone could provide me with some advice/comments concerning my approach. I will admit
2009 Apr 04
2
Help using smooth.spline with zoo object
Can someone please show me how to smooth time series data that I have in the form of a zoo object? I have a monthly economies series and all I really need is to see a less jagged line when I plot it. If I do something like s <- smooth.spline(d.zoo$Y, spar = 0.2) plot(predict(s,index(d.zoo)), xlab = "Year") # not defined for Date objects and if I do something like
2004 Mar 03
8
need help with smooth.spline
Dear R listers, When using smooth.spline to interpolate data, results are generally good. However, some cases produce totally unreasonable results. The data are values of pressure, temperature, and salinity from a probe that is lowered into the ocean, and the objective is to interpolate temperature and salinity to specified pressures. While smooth.spline provides excellent values at the
2009 Nov 06
3
order of points in spline
Hello everyone, I was trying to fit a spline to some points and I was quite surprised to find out that the function spline does not take into account the order of the points themselves, but orders them by x. For instance, I have: x <- c(262, 275, 264, 250, 247, 242, 238, 233) y <- c(422, 389, 359, 308, 269, 229, 191, 176) plot(x, y, xlim=c(0, 500), ylim=c(0,500)) s <- spline(x,y)
2010 May 07
2
smooth line overlap with histogram
Hi r-users,   I would like to overlap a smooth line on the histogram.  I tried using spline but it does not work. sq     <- seq(0,900,by=50) sq.50  <- as.character(sq) datobs <- sum_pos ## first, plot histogram histo <- hist(datobs,breaks=sq,freq=F) ## extract counts from histogram and calculate the probability in ## each specified interval. Also check the length of the interval is
2010 Dec 04
2
Error in calcCurveGrob(x, x$debug) : End points must not be identical
Hi All... I haven?t found mention of this error anywhere. I'm trying to draw spline curves using grid graphics. Most of the time, I have no problems, but I have some data sets that give the error in the subject line. I'm not sure which end points are identical, but the end points passed to the function are definitely not identical. Any assistance appreciated! Bryan tst <-
2005 Jul 07
2
Brewer colours
Anyone who is interested in using optimal colour palettes should look at the work of Cindy Brewer: www.colorbrewer.org I have written code to use her colour schemes in R. It is included below. Perhaps someone may find this interesting enough to work into a package. Included also is a function showpalette, which was posted here a while back. I don't remember who wrote it. I have copied all
2006 Dec 08
1
missing factor levels in a lattice barchart panel cause unexpected failure
Hi all - I'm trying to generate lattice barchart graphs with missing values, and came across the following: This does not run. I would expect it to: library(lattice) D = data.frame(X=1, Y=factor(letters[2], letters[1:2])) barchart(~ X, D, groups=Y) Error in grid.Call.graphics("L_rect", x$x, x$y, x$width, x$height, resolveHJust(x$just, : invalid line type which is simply