Displaying 20 results from an estimated 400 matches similar to: "mgcv, gam"
2007 Jun 13
1
lme() doesn't converge on IGF example
Running the Chapter 4 examples in Pinheiro & Bates' "Mixed-Effects
Models in S and S-PLUS" (2000), I get a message that the default
optimizer doesn't converge, but using "optim" for the optimizer
results in convergence:
> > library(nlme)
> > fm1IGF.lis <- lmList(IGF)
> > fm1IGF.lme <- lme(fm1IGF.lis)
> Error in lme.formula(fixed =
2004 Mar 01
1
non-negative least-squares
Hi all,
I am trying to do an inversion of electromagnetic data with non-negative
least squares method (Tikhonov regularisation) and have got it
programmed in S-Plus. However I am trying to move all my scripts from
S-Plus to R.
Is there an equivalent to nnls.fit in R?
I think this can be done with pcls? Right?
S-Plus script: A, L and data are matrices, lambda is a vector of
possible lambda
2010 Dec 06
1
use pcls to solve least square fitting with constraints
Hi,
I have a least square fitting problem with linear inequality
constraints. pcls seems capable of solving it so I tried it,
unfortunately, it is stuck with the following error:
> M <- list()
> M$y = Dmat[,1]
> M$X = Cmat
> M$Ain = as.matrix(Amat)
> M$bin = rep(0, dim(Amat)[1])
> M$p=qr.solve(as.matrix(Cmat), Dmat[,1])
> M$w = rep(1, length(M$y))
> M$C = matrix(0,0,0)
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.
2010 May 05
1
puzzles with assign()
I'm trying to get code along the following lines to work:
temp.name <- paste(TimePt,'df',sep='.') # invent a relevant name/symbol as a
character string.
assign(temp.name,IGF.df[IGF.df$TPt==TimePt,]) # this works. The relevant
variable is now a data frame
lm(b ~ Strain+BWt+PWt+PanPix, data=temp.name)) # this gives an error, namely
Error in eval(predvars, data, env) : invalid
2009 Feb 25
1
monotonic GAM with more than one term
Hi,
Does anyone know how to fit a GAM where one or more smooth terms are
constrained to be monotonic, in the presence of "by" variables or
other terms? I looked at the example in ?pcls but so far have not been
able to adapt it to the case where there is more than one predictor.
For example,
require(mgcv)
set.seed(0)
n<-100
# Generate data from a monotonic truth.
2006 Sep 04
2
Fitting generalized additive models with constraints?
Hello,
I am trying to fit a GAM for a simple model, a simple model, y ~ s(x0) +
s(x1) ; with a constraint that the fitted smooth functions s(x0) and s(x1)
have to each always be >0.
>From the library documentation and a search of the R-site and R-help
archives I have not been able to decipher whether the following is possible
using this, or other GAM libraries, or whether I will have to try
2011 Oct 13
0
1) A memory leak in drivers/rhino.c 2) Wunused-but-set-variable.patch
I would like to have your comments regarding:
1) drivers/rhino.c
------------------
The following patch addresses some problems in drivers/rhino.c. Or
that is what I think. I don't use this hardware. The patch:
1. Eliminates some usefulness definitions.
2. It removes code that evaluate the time. I can't see how the code
actually does useful work.
3. The
2007 Nov 25
1
GAM with constraints
Hi,
I am trying to build GAM with linear constraints, for a general link
function, not only identity. If I understand it correctly, the function
pcls() can solve the problem, if the smoothness penalties are given.
What I need is to incorporate the constraints before calculating the
penalties. Can this be done in R?
Any help would be greately appreciated.
--
View this message in context:
2003 Sep 26
1
least squares regression using (inequality) restrictions
Dear R Users,
I would like to make a lesast squares regression similar to that what is
done by the command "lm". But additionally, I would like to impose some
restrictions:
1) The sum of all regression coefficients should be equal to 1.
2) Each coefficient should assume a value between 0 and 1. (inequality
restrictions)
Which command is the best to use in order to solve this problem
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 Sep 03
2
rsync -append "chunk" size
I'm transferring 1.1 Mb files over very poor GSM EDGE connection. My
rsync command is:
rsync --partial --remove-source-files --timeout=120 --append --progress
--rsh=ssh -z LOCAL_FILE root at SERVER:REMOTE_PATH
File on remote server "grows" in size in steps of 262144 bytes. That is
a lot, because system needs to transfer at least 262144 (before
compression) every time connection
2020 Nov 03
2
Query on constrained regressions using -mgcv- and -pcls-
Hello all,
I'll level with you: I'm puzzled!
How is it that this constrained regression routine using -pcls- runs
satisfactorily (courtesy of Tian Zheng):
library(mgcv)
options(digits=3)
x.1=rnorm(100, 0, 1)
x.2=rnorm(100, 0, 1)
x.3=rnorm(100, 0, 1)
x.4=rnorm(100, 0, 1)
y=1+0.5*x.1-0.2*x.2+0.3*x.3+0.1*x.4+rnorm(100, 0, 0.01)
x.mat=cbind(rep(1, length(y)), x.1, x.2, x.3, x.4)
2006 Mar 05
1
predicted values in mgcv gam
Hi,
In fitting GAMs to assess environmental preferences, I use the part
of the fit where the lower confidence interval is above zero as my
criterion for positive association between the environmental variable
and species abundance. However I like to plot this on the original
scale of species abundance. To do so I extract the fit and SE using
predict.gam.
Lately I compared more
2004 Dec 19
1
PBIB datataset
I'm looking at Pinheiro & Bates "Mixed-Effects Models in
S and S-PLUS" at the moment. Several datasets are used,
one of which is called "PBIB" (a partially balanced
incomplete block design).
All the other datasets can be found somewhere or other in R.
However, I cannot locate PBIB, and it does not seem to
be mentioned in the latest edition of the R Full Reference
2013 Jul 19
0
mgcv: Impose monotonicity constraint on single or more smooth terms
Dear R help list,
This is a long post so apologies in advance. I am estimating a model with the mgcv package, which has several covariates both linear and smooth terms. For 1 or 2 of these smooth terms, I "know" that the truth is monotonic and downward sloping. I am aware that a new package "scam" exists for this kind of thing, but I am in the unfortunate situation that I am
2007 Sep 05
1
Monotone splines
Hello, i have a little problem with R and i hope you can help me.
I want to use splines to estimate a function but i want to force the interpolation to be monotone. Is this possible with R ?
Thank you,
Rémi.
---------------------------------
[[alternative HTML version deleted]]
2005 Mar 01
1
constraining initial slope in smoother.spline
Hello. I want to fit a smoother spline (or an equivalent local
regression method) to a series of data in which the initial value of the
1st derivative (slope) is constrained to a specific value. Is it
possible to do this? If so, how?
Bill Shipley
[[alternative HTML version deleted]]
2002 Mar 27
1
non-decreasing smoother
Hello
Is there a simple way of fitting a 'smooth curve' to a time series with
the additional constraint that the first derivative be not negative?
I know that if I choose a "large enough" window for a moving average
sort of filter on my data I end up with a non-decreasing curve anyway, but
I'm wondering if there is a pre-built method that can include the
constraint from
2013 Mar 23
1
Time trends with GAM
Hi all,
I am using GAM to model time trends in a logistic regression. Yet I would
like to extract the the fitted spline from it to add it to another model,
that cannot be fitted in GAM or GAMM.
Thus I have 2 questions:
1) How can I fit a smoother over time so that I force one knot to be at a
particular location while letting the model to find the other knots?
2) how can I extract the matrix