~ubuntu-branches/ubuntu/trusty/r-cran-vgam/trusty

« back to all changes in this revision

Viewing changes to man/margeff.Rd

  • Committer: Package Import Robot
  • Author(s): Chris Lawrence
  • Date: 2011-11-04 13:13:06 UTC
  • mfrom: (1.2.9)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20111104131306-w9fd83i51rw60gxf
Tags: upstream-0.8-4
ImportĀ upstreamĀ versionĀ 0.8-4

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
}
12
12
\usage{
13
 
margeff(object, subset=NULL)
 
13
margeff(object, subset = NULL)
14
14
}
15
15
%- maybe also 'usage' for other objects documented here.
16
16
\arguments{
97
97
pneumo = transform(pneumo, let = log(exposure.time))
98
98
fit = vglm(cbind(normal, mild, severe) ~ let, multinomial, pneumo)
99
99
fit = vglm(cbind(normal, mild, severe) ~ let,
100
 
           cumulative(reverse=TRUE,  parallel=TRUE),
 
100
           cumulative(reverse = TRUE,  parallel = TRUE),
101
101
           data = pneumo)
102
102
fitted(fit)[ii,]
103
103
 
104
104
mynewdata = with(pneumo, data.frame(let = let[ii]+hh))
105
 
(newp <- predict(fit, newdata=mynewdata, type="response"))
 
105
(newp <- predict(fit, newdata = mynewdata, type = "response"))
106
106
 
107
107
# Compare the difference. Should be the same as hh --> 0.
108
 
round(dig=3, (newp-fitted(fit)[ii,])/hh) # Finite-difference approximation
109
 
round(dig=3, margeff(fit, subset=ii)["let",])
 
108
round(dig = 3, (newp-fitted(fit)[ii,])/hh) # Finite-difference approximation
 
109
round(dig = 3, margeff(fit, subset = ii)["let",])
110
110
 
111
111
# Other examples
112
 
round(dig=3, margeff(fit))
113
 
round(dig=3, margeff(fit, subset=2)["let",])
114
 
round(dig=3, margeff(fit, subset=c(FALSE,TRUE))["let",,]) # recycling
115
 
round(dig=3, margeff(fit, subset=c(2,4,6,8))["let",,])
 
112
round(dig = 3, margeff(fit))
 
113
round(dig = 3, margeff(fit, subset = 2)["let",])
 
114
round(dig = 3, margeff(fit, subset = c(FALSE,TRUE))["let",,]) # recycling
 
115
round(dig = 3, margeff(fit, subset = c(2,4,6,8))["let",,])
116
116
}
117
117
 
118
118