Displaying 20 results from an estimated 10000 matches similar to: "model matrix with a spline"
2009 Jun 24
1
"by" question
Hello all
I have a big data frame and I regularly want to break it down into subsets,
calculate some new data, and add it back to the data frame.
At the moment my technique seems a bit ugly and embarrassing. Something
like:
result <- by(mydata, mydata$some_factor, function (x) {
# do something to create a vector v with length(v) == nrow(x)
return(v)
})
# now result has a big list, argh...
2009 Jul 08
1
clogit comparison between Stata and R
Hello all
I'm moving back and forth between stata and R at the moment - of course,
using R whenever possible :-)
I'm running conditional logits on some panel data and I get slightly
different results and different N in the two programs.
In R I run
clogit(trans.dem ~ I(avg.gle_rgdp.500/gle_rgdp) + log(gle_rgdp) +
timesince.dem + I(timesince.dem^2) + timesince.dict + I(timesince.dict^2) +
2009 Jul 01
1
simple question
Hello all
I have a fit resulting from a call to glm. Now, I would like to extract the
model frame MF, and add some variables
from the original data frame DF. To do this, I need to know which rows in DF
correspond to rows in MF (since some were dropped by na.omit). How can I do
this? It''s probably simple but the information is hard to find.
David Hugh-Jones
Post-doctoral Researcher
Max
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) +
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 only do linear and quadratic
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
2001 Apr 26
3
Installing smooth.spline command
Hello
I have installed R-0.90.1 on my Linux (Redhat 6.2) machine,
unfortunately I am not able to use a number of commands like e.g.
smooth.spline and predict.smooth.spline.
The error messages being given by is:
Error: Object "smooth.spline" not found
With the command library() I have checked or the libraries for the
smoothing functions are there, as shown below.
--------
>
2011 Aug 06
1
How to estimate confidential intervals for the derivatives of cubic smoothing spline
Dear all,
I want to use smooth.spline to construct a cubic smoothing spline and its first
derivative to my data. However, the predict.smooth.spline does not seem to
provide a SE for both the fitted values and their derivatives. How should I
calculate it?
Thank you very much,
Bingzhang
2009 Mar 28
1
Find inflection points using smooth.spline
Is there any way to identify or infer the inflection points in a smooth
spline object? I am doing a comparison of various methods of time-series
analysis (polynomial regression, spline smoothing, recursive partitioning)
and I am specifically interested in obtaining the julian dates associated
with the inflection points inferred by the various models.
Tyler
e.g.
2012 Mar 12
1
Fwd: Re[2]: B-spline/smooth.basis derivative matrices
--- On Mon, 3/12/12, aleksandr shfets <a_shfets at mail.ru> wrote:
> From: aleksandr shfets <a_shfets at mail.ru>
> Subject: Fwd: Re[2]: [R] B-spline/smooth.basis derivative matrices
> To: "Vassily Shvets" <shv736 at yahoo.com>
> Received: Monday, March 12, 2012, 5:15 PM
>
>
>
> -------- ???????????? ?????????
> --------
> ?? ????:
1998 May 25
2
RFC: spline / splinefun (etc) amalgamation
At present R has separate functions "spline" and "splinefun". The first
of these carries out spline interpolation of a data set and returns the
interpolated values; the second returns the interpolating function itself
(approx and approxfun are similar).
I would like to combine these into a single function "spline" with
an (optional) argument which determines which
2009 Oct 13
2
How to choose a proper smoothing spline in GAM of mgcv package?
Hi, there,
I have 5 datasets. I would like to choose a basis spline with same knots in
GAM function in order to obtain same basis function for 5 datasets.
Moreover, the basis spline is used to for an interaction of two covarites.
I used "cr" in one covariate, but it can only smooth w.r.t 1 covariate. Can
anyone give me some suggestion about how to choose a proper smoothing spline
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
2011 Sep 20
2
Multivariate spline regression and predicted values
Hello,
I am trying to estimate a multivariate regression of Y on X with
regression splines. Y is (nx1), and X is (nxd), with d>1. I assume the
data is generated by some unknown regression function f(X), as in Y =
f(X) + u, where u is some well-behaved regression error. I want to
estimate f(X) via regression splines (tensor product splines). Then, I
want to get the predicted values for some new
2013 Mar 11
1
Use pcls in "mgcv" package to achieve constrained cubic spline
Hello everyone,
Dr. wood told me that I can adapting his example to force cubic spline to pass through certain point.
I still have no idea how to achieve this. Suppose we want to force the cubic spline to pass (1,1), how can
I achieve this by adapting the following code?
# Penalized example: monotonic penalized regression spline .....
# Generate data from a monotonic truth.
2011 Dec 18
1
Smoothing spline with smoothing parameters selected by "generalized maximum likelihood"
Hi there,
How may I smooth spline two vectors with the smoothing parameter selected
by generalized maximum likelihood (GML) .?
Thanks a lot.
--
View this message in context: http://r.789695.n4.nabble.com/Smoothing-spline-with-smoothing-parameters-selected-by-generalized-maximum-likelihood-tp4210679p4210679.html
Sent from the R help mailing list archive at Nabble.com.
2002 Feb 20
2
How to get the penalized log likelihood from smooth.spline()?
I use smooth.spline(x, y) in package modreg and I would like to get
value of penalized log likelihood and preferable also its two parts. To
make clear what I am asking for (and make sure that I am asking for the
right thing) I clarify my problem trying to use the same notation as in
help(smooth.spline):
I want to find the natural cubic spline f(x) such that
L(f) = \sum_{k=1}{n} w[k](y[k] -
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data
for the predictor variable, y=vector of data for the response variable)
fit <- smooth.spline(x,y)
Now, given a spline fit point y_new, I want to be able to find out what
value of x_new yielded this fit value. How to do so?
(This problem is the inverse of the predict.smooth.spline function, which
takes x_new as input
2012 Feb 24
1
B-spline/smooth.basis derivative matrices
Hello,
I've noticed that SPLUS seems to have a function for evaluating derivative matrices of splines. I've found the R function that evaluates matrices from 'smooth.spline'; maybe someone has written something to do the same with smooth.basis?
regards,
s
2003 Apr 21
3
significant terms in spline model using GAM
Hi.. I'm using gam() to fit a spline model for a data set that has two predictor
variables (say A and B). The results indicate that the higher order interaction
terms are significant. The R^2 jumps from .5 to .9 when I change the maximum
order for the interaction from 10 to 15 (i.e. (AB)^10 to (AB)^15). Is there any
way of finding out which of the terms in the model are really