pam.nlm: Prediction Accuracy Measures for Nonlinear Regression Models.

Description Usage Arguments Value Examples

View source: R/pam.nlm.R

Description

This function calculates a pair of measures, R-Squared and L-Squared, for any nonlinear regression model. R-squared is an extension of the classical R2 statistic for a linear model, quantifying the amount of variability in the response that is explained by a corrected prediction based on the original prediction function. L-squared is the proportion of the prediction error of the original prediction function that is explained by the corrected prediction function, quantifying the distance between the corrected and uncorrected predictions. When used together, they give a complete summary of the predictive power of a prediction function.

Usage

1
pam.nlm(y, y.predict)

Arguments

y

A numeric vector containing the response values.

y.predict

A numeric vector containing the predicted response values from a fitted model.

Value

A list containing two components: R-squared and L-squared

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(PAmeasures)

data(moore)

head(moore)

# Transistor count
count <- moore$count

time<-moore$time

# Fit a log-linear model
moore.glm= glm(log2(count) ~ time, family=gaussian(link = "identity") )

# Obtain predicted transistor count
count.predict<-2^(predict(moore.glm,newdata = data.frame(X = time),type = "response" ))

# R.squared and L.squared of log-linear model
pam.nlm(count, count.predict)

Example output

  year time count
1 1971    1  2300
2 1972    2  3500
3 1975    5  3510
4 1974    4  4100
5 1974    4  4500
6 1974    4  5000
$R.squared
[1] "0.6867"

$L.squared
[1] "0.9564"

PAmeasures documentation built on May 2, 2019, 8:22 a.m.