gppr: Generalised projection pursuit regression

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/gppr.R

Description

Performs generalized projection pursuit regression for binary and Poisson response variables. Wraps ppr from package stats in an iterative re-weighting algorithm. Included in package gsg to support inference of the form of natural selection, and for inference of selection gradients from projection pursuit regression-based inference of fitness functions.

Usage

1
2
gppr(y, xterms, data, nterms = 1, tol = 0.001, gcvpen = 1, 
      maxit = 50, family = 'binomial', max.terms = 2)

Arguments

y

response variable, e.g., absolute fitness

xterms

names of predictor variables in data

data

a data frame containing columns with names matching xterms

nterms

number of terms to include in the final model

tol

maximum sum of relative changes in linear predictors between iterations

gcvpen

penalty used for each degree of freedom in GCV selection for spline ridge functions

maxit

maximum number if iterations of the iterative re-weighting procedure

family

distribution of the response variable, currently 'binomial' and 'Poisson' are supported

max.terms

the maximum number of terms to choose from when building the model

...

other parameters passed to ppr

Value

A gppr object, which contains a ppr object, plus information information pertaining to the iterative re-weighting procedure. Most of these repeat arguments passed to gppr(), also included are:

iterations

the number of iterations of the iterative re-weighting procedure that were performed

f

the formula passed to ppr, constructed from xterms

Author(s)

Michael Morrissey michael.morrissey@st-andrews.ac.uk

References

M.B. Morrissey. in prep.

See Also

predict.gppr, ppr,gppr.gradients

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# simulated data (two traits, stabilizing selection on trait 1)
n<-250
z<-cbind(rnorm(n,0,1),rnorm(n,0,1))
W<-rpois(n,exp(2-0.6*z[,1]^2))
d<-as.data.frame(cbind(W,z))
names(d)<-c("W","z1","z2")

fit.func<-gppr(y="W",xterms=c("z1","z2"),data=d,family="poisson",
   nterms=2,max.terms=2)

# direction of axes, and their loadings
fit.func$alpha
fit.func$beta

## not run - plot ridge functions (linear predictor scale)
# par(mfrow=c(1,2))
# plot(fit.func)

Example output


gsg documentation built on May 2, 2019, 9:37 a.m.