predintNNET: Function predintNNET

predintNNETR Documentation

Function predintNNET

Description

Returns and plots prediction interval for a neural network.

Usage

predintNNET(nnet = NULL, xTrain = NULL, yTrain = NULL,
  xTest = NULL, yTest = NULL, alpha = 0.05, lambda = 0.5,
  funName = "sigmoid", fun2Name = "linear",
  main = "Nonlinear Regression",
  sub = "shaded area represent prediction interval.",
  xlab = "Predictor", ylab = "Criterion", plot = T, col1 = rgb(0,
  0, 0, 0.8), col2 = rgb(0, 0, 1), col3 = rgb(0, 0, 1, 0.2),
  pch = 16, lwd = 2, cex.sub = 0.7, ...)

Arguments

nnet

A nnet object.

xTrain

data.frame with one or more numeric vectors.

yTrain

numeric vector.

xTest

data.frame with one or more numeric vectors. If NULL (default) equals xTrain.

yTest

numeric vector. If NULL (default) equals xTrain.

alpha

Alpha level. Defaults to 0.05.

lambda

lambda. Defaults to 0.5.

funName

Activation function for the hidden-layer of the nnet-object ("sigmoid","tanh","linear"). Defaults to "sigmoid".

fun2Name

Activation function for the output-layer of the nnet-object ("sigmoid","tanh","linear"). Defaults to "sigmoid".

color1

Color of points in the scattergram. Defaults to rgb(0,0,0,.7).

color2

Color of the regression line. Defaults to rgb(0,0,1).

color3

Color of the prediction interval. Defaults to rgb(0,0,1,.2).

color1

Color of points in the scattergram. Defaults to rgb(0,0,0,.7).

color2

Color of the regression line. Defaults to rgb(0,0,1).

color3

Color of the prediction interval. Defaults to rgb(0,0,1,.2).

Details

Returns and plots prediction interval for a neural network. This function is a modification of nnetpredint::nnetPredInt version 1.2. The code was modified by Andreas Fischer to allow for prediction intervals of nnet-objetcs with linear output units (i.e., parameter linout=T in nnet::nnet). The nnetpredint-package (https://cran.r-project.org/package=nnetpredint) was written by Xichen Ding <rockingdingo at gmail.com> under GPL-License (>= 2). There is no waranty for the work whatsoever.

Examples

set.seed(0);
d=data.frame(x=scale(rnorm(100)*10+1:100),y=scale(rnorm(100)*10+1:100),z=scale(rnorm(100)*10+1:100));
d=d[order(d[,"x"]),]
dev.new();
n=nnet::nnet(y ~ ., data=d, size=2, rang=0.1, decay=5e-4, maxit=500, linout=T)
p=predintNNET(nnet=n, xTrain=d[c("x","z")], yTrain=d["y"], alpha = 0.05, funName = "sigmoid", fun2Name = "linear")
dev.new();
n=nnet::nnet(y ~ x, data=d, size=2, rang=0.1, decay=5e-4, maxit=500, linout=T)
p=predintNNET(nnet=n, xTrain=d[c("x")], yTrain=d["y"], alpha = 0.05, funName = "sigmoid", fun2Name = "linear")

AndreasFischer1985/quantqual documentation built on June 20, 2022, 4:55 p.m.