gamfit {spgam} | R Documentation |
~~ A concise (1-5 lines) description of what the function does. ~~
gamfit(form, gam.data, pts, region, h = 0, hvals = NA, ngrid = 4000)
form |
~~Describe form here~~ |
gam.data |
~~Describe gam.data here~~ |
pts |
~~Describe pts here~~ |
region |
~~Describe region here~~ |
h |
~~Describe h here~~ |
hvals |
~~Describe hvals here~~ |
ngrid |
~~Describe ngrid here~~ |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
....
~~further notes~~
~Make other sections like Warning with section{Warning }{....} ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function(form,gam.data,pts,region,h=0,hvals=NA,ngrid=4000){ formul=formula(form) termos<-terms(formul) at<-as.character(attr(termos,"variables"))[-1] data<-as.data.frame(gam.data[,at]) why<-data[,at[1]] ny<-nrow(data) g2=rep(0,ny) fit=glm(formul,family=binomial,data=data) g1=predict(fit) fhat <- g1 + g2 phat <- exp(fhat)/(1+exp(fhat)) w <- phat*(1-phat) z <- fhat + (why-phat)/w if(h!=0){ new=waddmod(formul,data,pts,g2=g2,z=z,w=w,hopt=h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=h,hvals=hvals,region=region,ngrid=ngrid,sameh=T) } else{ new=waddmod(formul,data,pts,g2=g2,z=z,w=w,hvals=hvals,region=region);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=old$h,hvals=hvals,region=region);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=old$h,hvals=hvals,region=region);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=old$h,hvals=hvals,region=region);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=old$h,hvals=hvals,region=region,sameh=T);old=new new=waddmod(formul,data,pts,g2=old$g2,z=old$z,w=old$w,hopt=old$h,hvals=hvals,region=region,ngrid=ngrid,sameh=T) } new }