Displaying 20 results from an estimated 5000 matches similar to: "Question about predict function"
2005 Sep 26
4
p-level in packages mgcv and gam
Hi,
I am fairly new to GAM and started using package mgcv. I like the
fact that optimal smoothing is automatically used (i.e. df are not
determined a priori but calculated by the gam procedure).
But the mgcv manual warns that p-level for the smooth can be
underestimated when df are estimated by the model. Most of the time
my p-levels are so small that even doubling them would not result
2011 Nov 29
1
Calculating the probability for a logistic regression
Hi All,
When we run the command : summary ( newmod<-gam(Dlq~ formula,family,,data) )
in R, the output would the effect of smoothness in R.
As of now to calculate the probability I am following the below approach:
1) Run the plot of the GAM , interpret the curves
2) Re Run the Regression as a GLM after taking into account the non linear
terms in step1
3) Calculate the probability from
2011 Oct 08
1
Generalized Additive Models: How to create publication-ready regression tables
Hi -
I have a series of 9 GAM regressions with about 5 parametric effects and
three non-parametric effects in each.
What is a good library or command for turning GAM outputs into
publication-ready regression tables?
I tried apsrtable and the mtable command in memisc but neither seemed to
work with the gam output.
I'd be okay with two separate tables - one for the parametric effects and
2007 Aug 17
2
for plots
Hi, All,
I am a beginner for R. Now I have installed R 2.5.1 in Window
environment. After I run a program such as "gam" I would like to display
a plot for the object. The following is an example. When I did this,
only the last plot was presented on my screen. How can I get a plot
before the last plot? I mean if the object has several plots how can I
get those?
"gam.object <-
2013 Oct 11
1
labeling abscissa using a function of the plotted scale
Is it easy or difficult to label the abscissa of a scatter graph as
1/trueScaleValue at that point?
--
View this message in context: http://r.789695.n4.nabble.com/labeling-abscissa-using-a-function-of-the-plotted-scale-tp4678075.html
Sent from the R help mailing list archive at Nabble.com.
2005 Oct 10
4
plot - no main title and missing abscissa value
Hi all.
I have defined a plot thus:
par(mar=c(5,5,4,5),las=1, xpd=NA)
plot(Day, Ym1Imp, ylim=c(0,100), type="b", bty="l", main="Ym1
Expression", cex=1.3, xaxt="n", yaxt="n") #plot implant data
axis(side=1, at=c(0,1,3,5,7,10,14,21), labels=c(0,1,3,5,7,10,14,21)) #
label x axis
mtext("Day", side =1, at=10, line=3, cex=1.2) # title x
2012 Feb 17
1
Standard errors from predict.gam versus predict.lm
I've got a small problem.
I have some observational data (environmental samples: abiotic explanatory variable and biological response) to which I've fitted both a multiple linear regression model and also a gam (mgcv) using smooths for each term. The gam clearly fits far better than the lm model based on AIC (difference in AIC ~ 8), in addition the adjusted R squared for the gam is
2007 Oct 05
2
question about predict.gam
I'm fitting a Poisson gam model, say
model<-gam(a65tm~as.factor(day.week
)+as.factor(week)+offset(log(pop65))+s(time,k=10,bs="cr",fx=FALSE,by=NA,m=1),sp=c(
0.001),data=dati1,family=poisson)
Currently I've difficulties in obtaining right predictions by using
gam.predict function with MGCV package in R version 2.2.1 (see below my
syntax).
2009 Aug 24
3
Two lines, two scales, one graph
First of all, thanks to everyone who answers these questions - it's
most helpful.
I'm new to R and despite searching have not found an example of what I
want to do (there are some good beginner's guides and a lot of complex
plots, but I haven't found this).
I would like to plot two variables against the same abscissa values. They
have different scales. I've found how to make
2013 Jul 08
1
error in "predict.gam" used with "bam"
Hello everyone.
I am doing a logistic gam (package mgcv) on a pretty large dataframe
(130.000 cases with 100 variables).
Because of that, the gam is fitted on a random subset of 10000. Now when I
want to predict the values for the rest of the data, I get the following
error:
> gam.basis_alleakti.1.pr=predict(gam.basis_alleakti.1,
+
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
2009 Jan 08
2
interpolation to abscissa
Readers,
I have looked at various documents hosted on the web site; I couldn't
find anything on interpolation. So I started r and accessed the help
(help.start()). (by the way is it possible to configure r to open help
in opera instead of firefox?) Initially I read the help for the akima
package but couldn't understand it. Next I tried the asplines package
help.
I tried to copy the
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
2009 Jun 18
3
predict.glm and predict.gam output
Hi all,
I am currently trying to compare different plant occurrence prediction
maps generated in R and exported into GRASS. One of these maps was
generated from a glm fitted to some data, and subsequently applying this
glm model to a wider region using predict.glm. The outcome here was a
probability of occurrence. The second map I generated using a gam
(mgcv), however, this map seems to have
2006 Nov 15
1
can I get standard error from predict.gam()?
Hi everybody,
I am using predict.gam() now. I but it seems there is no such option to get
standard errors of the predicted values. I tried to set se=T or se.fit=T but
no use.
If you know anything about that please let me know. Thanks very much.
Kevin.
[[alternative HTML version deleted]]
2003 Jun 05
6
dynamics of functions
Dear list,
I would like to study the dynamics of
functions using R (instead of mathematica e.g.),
i.e. the behavior of points under iteration
of a function.
So I tried (in vain) writing a function
myfunction <- function(f,n,x){...}
in order to compute f^{n}(x), f^{n}(x) being
the function f composed with itself n-1 times.
n is a natural number, and the argument x is
the abscissa of the point I
2011 Jul 29
1
help with predict.rpart
? data=read.table("http://statcourse.com/research/boston.csv", ,
sep=",", header = TRUE)
? library(rpart)
? fit=rpart (MV~ CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+
PT+B+LSTAT)
predict(fit,data[4,])
plot only reveals part of the tree in contrast to the results on obtains
with CART or C5
-------- Original Message --------
Subject: Re: [R] help with rpart
From: Sarah
2005 Mar 24
1
Prediction using GAM
Recently I was using GAM and couldn't help noticing
the following incoherence in prediction:
> data(gam.data)
> data(gam.newdata)
> gam.object <- gam(y ~ s(x,6) + z, data=gam.data)
> predict(gam.object)[1]
1
0.8017407
>
predict(gam.object,data.frame(x=gam.data$x[1],z=gam.data$z[1]))
1
0.1668452
I would expect that using two types of predict
arguments
2003 Jul 24
1
scatterplot smoothing using gam
All:
I am trying to use gam in a scatterplot smoothing problem.
The data being smoothed have greater 1000 observation and have
multiple "humps". I can smooth the data fine using a function
something like:
out <- ksmooth(x,y,"normal",bandwidth=0.25)
plot(x,out$y,type="l")
The problem is when I try to fit the same data using gam
out <-
2011 Jun 24
2
mgcv:gamm: predict to reflect random s() effects?
Dear useRs,
I am using the gamm function in the mgcv package to model a smooth relationship between a covariate and my dependent variable, while allowing for quantification of the subjectwise variability in the smooths. What I would like to do is to make subjectwise predictions for plotting purposes which account for the random smooth components of the fit.
An example. (sessionInfo() is at