similar to: transforming data frame for use with persp

Displaying 20 results from an estimated 9000 matches similar to: "transforming data frame for use with persp"

2012 Sep 11
1
plotting smoother function on raw data
Hi, I have used the mgcv library to generate a simple additive model. I want to know how to plot the function on the raw data with confidence intervals whan I have TWO variables in the model. I get it to work with one variable but not with two. I am on the limit for what I understand in R, so be gentle. I have read the help file on predict.gam, but did not get any help out of it. #My model:
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 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
2005 Oct 05
3
testing non-linear component in mgcv:gam
Hi, I need further help with my GAMs. Most models I test are very obviously non-linear. Yet, to be on the safe side, I report the significance of the smooth (default output of mgcv's summary.gam) and confirm it deviates significantly from linearity. I do the latter by fitting a second model where the same predictor is entered without the s(), and then use anova.gam to compare the
2011 Oct 27
2
vis.gam zlab problem
I am using the mgcv package to develop vis.gam plots and having trouble figuring out how to relabel the z-axis (image attached). It is currently labeled as "linear predictor," but I would like to change it to a different name. Currently I am using this code: vis.gam(model1,theta=320,ticktype="detailed",color="gray",nCol=12, zlab="BCS") However, when run
2010 Aug 05
1
plot points using vis.gam
Hello, I'm trying to illustrate the relationships between various trait and environment data gathered from a number of sites. I've created a GAM to do this: gam1=gam(trait~s(env1)+s(env2)+te(env1,env2)) and I know how to create a 3D plot using vis.gam. I want to be able to show points on the 3D plot indicating the sites that the data came from. I can do this on a 2D plot when there is one
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
2006 Feb 05
1
how to extract predicted values from a quantreg fit?
Hi, I have used package quantreg to estimate a non-linear fit to the lowest part of my data points. It works great, by the way. But I'd like to extract the predicted values. The help for predict.qss1 indicates this: predict.qss1(object, newdata, ...) and states that newdata is a data frame describing the observations at which prediction is to be made. I used the same technique I used
2010 Aug 30
1
'mgcv' package, problem with predicting binomial (logit) data
Dear R-help list, I?m using the mgcv package to plot predictions based on the gam function. I predict the chance of being a (frequent) participant at theater plays vs. not being a participant by age. Because my outcome variable is dichotomous, I use the binomial family with logit link function. Dataset in attachment, code to read it in R: data <- read.spss("pas_r.sav") attach(data)
2005 May 06
1
persp( ) Question
I have successfully fitted the model loess.fit1 <- loess(response ~ X*Y) and plotted it in 3D using X.grid <- seq(0,10,length=100) Y.grid <- seq(0,1000,length=100) pred.loess1 <- predict(loess.fit1, expand.grid(x = X.grid, y = Y.grid)) persp(X.grid, Y.grid, pred.loess1, theta = 0, phi = 12) I would like to add a series of points along the fitted surface at X.grid =
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
2009 Oct 13
1
vis.gam() contour plots
Greetings, I have what I hope is a simple question. I would like to change my contour interval on the vis.gam( plot.type="contour") in the mgcv package. Is this a situation where I need to modify the function or is there a default value I can change? Thanks
2007 Feb 13
1
Missing variable in new dataframe for prediction
Hi, I'm using a loop to evaluate several models by taking adjacent variables from my dataframe. When i try to get predictions for new values, i get an error message about a missing variable in my new dataframe. Below is an example adapted from ?gam in mgcv package library(mgcv) set.seed(0) n<-400 sig<-2 x0 <- runif(n, 0, 1) x1 <- runif(n, 0, 1) x2 <- runif(n, 0, 1) x3 <-
2003 Jun 03
3
gam questions
Dear all, I'm a fairly new R user having two questions regarding gam: 1. The prediction example on p. 38 in the mgcv manual. In order to get predictions based on the original data set, by leaving out the 'newdata' argument ("newd" in the example), I get an error message "Warning message: the condition has length > 1 and only the first element will be used in: if
2010 Jun 07
2
mgcv
Hello Sir, I am using mgcv package for my data. My model is y~x1+f(x2),I want to find out the function f(x2) . Following is the code.   sm1=gam(y~x1+s(x2),family=binomial, f) summary(sm1) plot(sm1,residuals=TRUE, xlab="AGE",pch=20)   In this plot I am getting S(x2,1.93) on y axixs  How should I get the function for x2 from this plot.or Is there anyother procedure in R  to get this
2013 Dec 16
1
log transforming predictor variables in a binomial GAM?
Hi all, I am applying a Presence/absence Generalized additive model to model the distribution of marine algae species in R. I have found that log transforming the environmental variables improves the explained deviance of the model considerably. While log transforming is common practice in GLM, I have been unable to find any papers where this is performed in a GAM. Im wondering whether this
2004 Oct 20
2
Plotting a 3D surface
Hi Does R have a function or has someone written a function to draw a 3d surface from a scatter plot of values using either ksmooth or locpoly. OR a transform function a that merges x relation z and y relation z to (x,y) relation z? I tried out scatterplot3d but it seems it would take a bit of work to get scatterplot3d to draw a curved surface. Lawrence
2002 Aug 01
4
What does persp() return?
I want to plot some 3D points on top of the grid produced by persp(). On 2/22/01, Paul Murrell <paul at stat.auckland.ac.nz> wrote in R-help: > In S-Plus, persp() returns a value that can be used to transform 3D > locations to 2D, but this sort of thing is not (yet) available in R. But persp() does return something (in R-1.5.1): a 4x4 matrix which in the C code is called the
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).
2013 Oct 15
1
plotting a marginal distribution on the plane behind a persp() plot
R'istas: I am trying to plot a marginal distribution on the plane behind a persp() plot. My existing code is: library(MASS) X <- mvrnorm(1000,mu=c(0,0),Sigma=matrix(c(1,0,0,1),2)) X.kde <- kde2d(X[,1],X[,2],n=25) # X.kde is list: $x 1*n, $y 1*n, $z n*n persp(X.kde,phi=30,theta=60,xlab="x_b",ylab="x_a",zlab="f") ->res Any suggestions are very