Displaying 20 results from an estimated 7000 matches similar to: "help with GAM"
2008 Jul 09
1
plot gam "main effect functions" in one graph
Dear R users,
I have a question about the plot with the package gam.
I need to plot different main effect functions, related to different
gam models, in the same graphics (i.e. the same covariate about
different models).
I used the plot.gam e preplot.gam documentations. Using preplot.gam I
can plot the single function but I'm not able to put all the functions
together.
Does anybody can help
2006 Jan 19
2
gam
Dear R users,
I'm new to both R and to this list and would like to get
advice on how to build generalized additive models in R.
Based on the description of gam, which I found on the R
website, I specified the following model:
model1<-gam(ST~s(MOWST1),family=binomial,data=strikes.S),
in which ST is my binary response variable and MOWST1 is a
categorical independent variable.
I get the
2009 Aug 05
4
for loop
I am trying to get the function "Models" to work each time there is an
instance of k. This code will stop after the first model is complete. I need
it to come back and pass the next value of c into the "Initial.State"
function. any ideas?
col<-c(23:28)
#Setup
for(k in col){
Initial.State(Response=zample[,c(k,29)],
Explanatory=zample[,variable_columns],
2007 Oct 08
2
variance explained by each term in a GAM
Hello fellow R's,
I do apologize if this is a basic question. I'm doing some GAMs using the mgcv package, and I am wondering what is the most appropriate way to determine how much of the variability in the dependent variable is explained by each term in the model. The information provided by summary.gam() relates to the significance of each term (F, p-value) and to the
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
2009 Jul 09
9
Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I
2008 Jan 03
1
GLM results different from GAM results without smoothing terms
Hi, I am fitting two models, a generalized linear model and a generalized
additive model, to the same data. The R-Help tells that "A generalized
additive model (GAM) is a generalized linear model (GLM) in which the linear
predictor is given by a user specified sum of smooth functions of the
covariates plus a conventional parametric component of the linear
predictor." I am fitting the GAM
2009 Jul 24
4
CI wiskers
I have a matrix containing means and CIs (lower and upper in two columns, so
three columns for every data point) for several points. I have to build a
graph of these means accompained by the CIs (as wiskers). No problems with
making the graph of means, but I don't know how to introduce CIs.
Can anybody advise?
--
View this message in context:
2007 Dec 13
1
Gaussian Smoothing
Hello,
I'm new to R, and I would like to know if there is a way to smooth a curve
using a Gaussian smoothing with R.
Thank you very much,
TDB
--
View this message in context: http://www.nabble.com/Gaussian-Smoothing-tp14321313p14321313.html
Sent from the R help mailing list archive at Nabble.com.
2008 Feb 27
4
Error in cor.default(x1, x2) : missing observations in cov/cor
Hello,
I'm trying to do cor(x1,x2) and I get the following error:
Error in cor.default(x1, x2) : missing observations in cov/cor
A few things:
1. I've used cor() many times and have never encountered this error.
2. length(x1) = length(x2)
3. is.numeric(x1) = is.numeric(x2) = TRUE
4. which(is.na(x1)) = which(is.na(x2)) = integer(0) {the same goes for
is.nan()}
5. I also try
2012 Nov 29
1
[mgcv][gam] Manually defining my own knots?
Dear List,
I'm using GAMs in a multiple imputation project, and I want to be able
to combine the parameter estimates and covariance matrices from each
completed dataset's fitted model in the end. In order to do this, I
need the knots to be uniform for each model with partially-imputed
data. I want to specify these knots based on the quantiles of the
unique values of the non-missing
2009 Sep 20
1
How to choose knots for GAM?
Hi, all
I want to choose same knots in GAM for 10 different studies so that they has
the same basis function. Even though I choose same knots and same dimensions
of basis smoothing, the basis representations are still not same.
My command is as follows:
data.gam<-gam(y~s(age,bs='cr',k=10)+male,family=binomial,knots=list(age=seq(45,64,length=10)))
What is my mistake for choice of
2009 Sep 20
3
statistics
The myoglobin sequence, with reference number NM_005368 in Gen bank, has the
following
frequencies of DNA nucleotides:
A C G T
237 278 309 242
Do these data provide sufficient evidence, at the 1% level of significance,
that the DNA nucleotides
have an unequal distribution, that is the DNA nucleotides are not evenly
utilised?
Clearly state your hypothesis, test statistic and conclusion.
2008 Feb 26
3
OLS standard errors
Hi,
the standard errors of the coefficients in two regressions that I computed
by hand and using lm() differ by about 1%. Can somebody help me to identify
the source of this difference? The coefficient estimates are the same, but
the standard errors differ.
####Simulate data
happiness=0
income=0
gender=(rep(c(0,1,1,0),25))
for(i in 1:100){
happiness[i]=1000+i+rnorm(1,0,40)
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
2010 Apr 08
2
Problem using elements in a vector
Hi
So my particular problem is this:
I have a row vector of length 5200 elements - specifically created by
x<-rbinom(5200,1,0.5)
y<-matrix(x,nrow=1,ncol=5200)
y
now, each element is either a 0 or a 1 - e.g. it could be
(0,1,1,1,1,0,0,0,1,1,1) e.t.c.
when the element is a 1, i need to multiply a number (say 1000) by 1.005,
and if it is 1 again, multiply it _again_ by 1.005.
so for
2009 Nov 11
3
how to use # in a rd doc in url address
I am writing a rd doc, and need to use "#" in a url adress. This would make:
\url{http://www.xxxx.org/myfolder/#myanchor}
Of course, I suppose this will not work because # is a special character
starting a comment line in the rd dialect. I did not found a similar
example in "Writing R exentions". I am not sure bout using \dQuote{a
quotation}), and use \sQuote and \dQuote
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 Jun 25
1
gam function in the mgcv library
I would like to fit a logistic regression using a smothing spline, where the spline is a piecewise cubic polynomial. Is the knots option used to define the subintervals for each piece of the cubic spline? If yes and there are k knots, then why does the coefficients field in the returned object from gam only list k coefficients? Shouldn't there be 4k -4 coefficients?
Sincerely,
Bill
2010 Jun 03
4
gam error
Hi all,
I'm trying to use a gam (mgcv package) to analyse some data with a roughly U
shaped curve. My model is very simple with just one explanatory variable:
m1<-gam(CoT~s(incline))
However I just keep getting the error message
"Error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
A term has fewer unique covariate combinations than specified maximum
degrees of