Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: glm
See also: glminvlink

Quantlet: glmscatter
Description: glmscatter computes a scatterplot to explain the marginal influence of a variable on the response.

Link:
Usage: sc = glmscatter(code,x,y)
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary LS).
x n x 1 matrix, explanatory variable.
y n x 1 response.
opt optional, a list with optional input. "glmopt" can be used to set up this parameter. The order of the list elements is not important.
opt.weights string, type of weights. Can be "frequency" for replication counts, or "prior" (default) for prior weights in weighted regression.
opt.wx scalar or n x 1 vector, frequency or prior weights. If not given, set to 1.
opt.pow optional, power for power link.
opt.nbk scalar, extra parameter k for negative binomial distribution. If not given, set to 1 (geometric distribution).
Output:
sc m x 2 discretized or binned x in the first column and the invers link function applied to the averaged y (in bin) in the second column.

Example:
library("glm")
x=normal(50)
y=(x+normal(50) >0)         ; probit model
sc=glmscatter("bipro",x,y)
library("plot")
m=setmask(x~x,"line","red") ; true relation = linear
plot(sc,m)

Result:
The density of x, the marginal influence of x and a
scatter plot of x and y.



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006