similar to: negative prediction by gam (mgcv package)

Displaying 20 results from an estimated 8000 matches similar to: "negative prediction by gam (mgcv package)"

2005 Feb 27
1
prediction, gam, mgcv
I fitted a GAM model with Poisson distribution using the function gam() in the mgcv package. My model is of the form: mod<-gam(y~s(x0)+s(x1)+s(x2),family=poisson). To extract estimates at a specified set of covariate values I used the gam `predict' method. But I want to get estimate and standard error of the difference of two fitted values. Can someone explain what should I do? Thank
2008 Nov 13
0
Negative prediction by gam
Gam in mgcv package is predicting negative values which should not be the case despite all the predictors and response variables are positive. Tried to use log link function but it did not help. Please help ------------------------------------------------------------------------ ---------------- Sunil Kumar Sharma Australia ******************************* IMPORTANT MESSAGE
2008 Apr 09
1
mgcv::predict.gam lpmatrix for prediction outside of R
This is in regards to the suggested use of type="lpmatrix" in the documentation for mgcv::predict.gam. Could one not get the same result more simply by using type="terms" and interpolating each term directly? What is the advantage of the lpmatrix approach for prediction outside R? Thanks. -- View this message in context:
2013 Jul 23
1
Help with using unpenalised te smooth in negative binomial mgcv gam
Hi, I have been trying to fit an un-penalised gam in mgcv (in order to get more reliable p-values for hypothesis testing), but I am struggling to get the model to fit sucessfully when I add in a te() interaction. The model I am trying to fit is: gam(count~ s(x1, bs = "ts", k = 4, fx = TRUE) + s(x2, bs = "ts", k = 4, fx = TRUE) + te(x2, x3, bs =
2008 Jun 11
1
mgcv::gam error message for predict.gam
Sometimes, for specific models, I get this error from predict.gam in library mgcv: Error in complete.cases(object) : negative length vectors are not allowed Here's an example: model.calibrate <- gam(meansalesw ~ s(tscore,bs="cs",k=4), data=toplot, weights=weight, gam.method="perf.magic") > test <- predict(model.calibrate,newdata) Error in
2008 Apr 06
0
mgcv::gam prediction using lpmatrix
The documentation for predict.gam in library mgcv gives an example of using an "lpmatrix" to do approximate prediction via interpolation. However, the code is specific to the example wrt the number of smooth terms, df's for each,etc. (which is entirely appropriate for an example) Has anyone generalized this to directly generate code from a gam object (eg SAS or C code)? I wanted to
2011 Mar 28
2
mgcv gam predict problem
Hello I'm using function gam from package mgcv to fit splines. ?When I try to make a prediction slightly beyond the original 'x' range, I get this error: > A = runif(50,1,149) > B = sqrt(A) + rnorm(50) > range(A) [1] 3.289136 145.342961 > > > fit1 = gam(B ~ s(A, bs="ps"), outer.ok=TRUE) > predict(fit1, newdata=data.frame(A=149.9), outer.ok=TRUE) Error
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
2005 Feb 14
1
gam(mgcv) starting values
Hi all! I?ve got some problems with the function gam (library mgcv). For some models I get the error message : Error: no valid set of coefficients has been found:please supply starting values In addition: Warning message: NaNs produced in: log(x) This is a shortened code I used: gam(y ~ M1 + M3 + M4 + M5 + M6 + sex + M1*M3 + s(age), family=Gamma(link ="identity"), weights=days) If
2007 Dec 13
1
Two repeated warnings when runing gam(mgcv) to analyze my dataset?
Dear all, I run the GAMs (generalized additive models) in gam(mgcv) using the following codes. m.gam <-gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbinary,family=binomial(logit),data=point) And two repeated warnings appeared. Warnings$B!'(B 1: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : Algorithm did not converge 2: In gam.fit(G,
2012 Feb 03
1
GAM (mgcv) warning: matrix not positive definite
Dear list, I fitted the same GAM model using directly the function gam(mgcv) ... then as a parameter of another function that capture the warnings messages (see below). In the first case, there is no warning message printed, but in the last one, the function find two warning messages stating "matrix not positive definite" So my question is: Do I have to worry about those warnings and
2009 Mar 24
2
help: what are the basis functions in {mgcv}: gam?
I am writing my thesis with the function gam(), with the package {mgcv}. My command is: gam(y~s(x1,bs="cr")+s(x2, bs="cr")). I need help to know what are the default basis funcitons for gam. I have not found any detailed reference for this. Can anyone help me with this?? -- View this message in context:
2012 Aug 14
1
Random effects in gam (mgcv 1.7-19)
Hi, I am using the gam function in the mgcv package, I have random effects in my model (bs="re") this has worked fine, but after I updated the mgcv package to version 1.7-19 I recive an error message when I run the model. > fit1<-gam(IV~s(RUTE,bs="re")+s(T13)+s(H40)+factor(AAR)+s(V3)+s(G1)+s(H1)+s(V1)+factor(LEDD),data=data5,method="ML") > summary.gam(fit1)
2007 Dec 13
1
Probelms on using gam(mgcv)
Dear all, Following the help from gam(mgcv) help page, i tried to analyze my dataset with all the default arguments. Unfortunately, it can't be run successfully. I list the errors below. #m.gam<-gam(mark~s(x,y)+s(lstday2004)+s(slope)+s(ndvi2004)+s(elevation)+s(disbinary),family=binomial(logit),data=point)
2012 Jul 23
1
mgcv: Extract random effects from gam model
Hi everyone, I can't figure out how to extract by-factor random effect adjustments from a gam model (mgcv package). Example (from ?gam.vcomp): library(mgcv) set.seed(3) dat <- gamSim(1,n=400,dist="normal",scale=2) a <- factor(sample(1:10,400,replace=TRUE)) b <- factor(sample(1:7,400,replace=TRUE)) Xa <- model.matrix(~a-1) ## random main effects Xb <-
2011 Feb 16
1
retrieving partial residuals of gam fit (mgcv)
Dear list, does anybody know whether there is a way to easily retrieve the so called "partial residuals" of a gam fit with package mgcv? The partial residuals are the residuals you would get if you would "leave out" a particular predictor and are the dots in the plots created by plot(gam.object,residuals=TRUE) residuals.gam() gives me whole model residuals and
2012 Jul 30
2
mgcv 1.7-19, vis.gam(): "invalid 'z' limits'
Hi everyone, I ran a binomial GAM consisting of a tensor product of two continuous variables, a continuous parametric term and crossed random intercepts on a data set with 13,042 rows. When trying to plot the tensor product with vis.gam(), I get the following error message: Error in persp.default(m1, m2, z, col = col, zlim = c(min.z, max.z), xlab = view[1], : invalid 'z' limits In
2008 May 06
1
mgcv::gam shrinkage of smooths
In Dr. Wood's book on GAM, he suggests in section 4.1.6 that it might be useful to shrink a single smooth by adding S=S+epsilon*I to the penalty matrix S. The context was the need to be able to shrink the term to zero if appropriate. I'd like to do this in order to shrink the coefficients towards zero (irrespective of the penalty for "wiggliness") - but not necessarily all the
2012 Apr 03
1
A contour plot question - vis.gam () function in "mgcv"
Hi, Please see the attached contour plot (I am sorry about the big file). This was created using the vis.gam() function in "mgcv" package. However, my question is somewhat broader. In generating this figure, I first created the contours using vis.gam() and then I plotted the points. These point are plotted on top of the contours so that some of the contour lines are only partially
2004 Sep 27
2
passing formula arg to mgcv::gam
Hi, I have a function, callGam, that fits a gam model to a subset of a dataframe. The argument to callGam is a formula, the subset is determined inside the function itself. My na??ve approach generates and error, see below. I guess this is because 'idx' is loocked up in the environment of 'formula', but I am too ignorant about environments to be able to tell for sure. Could