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

« back to all changes in this revision

Viewing changes to R/family.loglin.R

  • 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:
36
36
                stop("some combinations of the response not realized") 
37
37
        }
38
38
    }),
39
 
    inverse = function(eta, extra = NULL) {
 
39
    linkinv = function(eta, extra = NULL) {
40
40
        u1 <-  eta[,1]
41
41
        u2 <-  eta[,2]
42
42
        u12 <- eta[,3]
48
48
    },
49
49
    last = expression({
50
50
        misc$link = c("u1" = "identity", "u2" = "identity", "u12" = "identity")
51
 
        misc$earg = list(u1=list(), u2=list(), u12=list())
 
51
        misc$earg = list(u1 = list(), u2 = list(), u12 = list())
52
52
    }),
53
 
    link = function(mu, extra = NULL)  {
 
53
    linkfun = function(mu, extra = NULL)  {
54
54
        u0 <-  log(mu[,1]) 
55
55
        u2 <-  log(mu[,2]) - u0
56
56
        u1 <-  log(mu[,3]) - u0
67
67
          stop("loglikelihood residuals not implemented yet") else
68
68
        sum(w*(u0 + u1*y[,1] + u2*y[,2] + u12*y[,1]*y[,2]))
69
69
    },
70
 
    vfamily=c("loglinb2"),
 
70
    vfamily = c("loglinb2"),
71
71
    deriv = expression({
72
72
        u1 <-  eta[,1]
73
73
        u2 <-  eta[,2]
156
156
                stop("some combinations of the response not realized") 
157
157
        }
158
158
    }),
159
 
    inverse= function(eta, extra = NULL) {
 
159
    linkinv= function(eta, extra = NULL) {
160
160
        eval(extra$my.expression)
161
161
        cbind("000" = 1,
162
162
              "001" = exp(u3),
168
168
              "111" = exp(u1+u2+u3+u12+u13+u23)) / denom
169
169
    },
170
170
    last = expression({
171
 
        misc$link = rep("identity", length=M)
 
171
        misc$link = rep("identity", length = M)
172
172
        names(misc$link) = predictors.names
173
 
        misc$earg = list(u1=list(), u2=list(), u3=list(),
174
 
                         u12=list(), u13=list(), u23=list())
 
173
        misc$earg = list(u1  = list(), u2  = list(), u3  = list(),
 
174
                         u12 = list(), u13 = list(), u23 = list())
175
175
    }),
176
 
    link = function(mu, extra = NULL)  {
 
176
    linkfun = function(mu, extra = NULL)  {
177
177
        u0  <- log(mu[,1])
178
178
        u3  <- log(mu[,2]) - u0
179
179
        u2  <- log(mu[,3]) - u0
191
191
        sum(w*(u0 + u1*y[,1] + u2*y[,2] + u3*y[,3] +u12*y[,1]*y[,2] +
192
192
               u13*y[,1]*y[,3] + u23*y[,2]*y[,3]))
193
193
    },
194
 
    vfamily=c("loglinb3"),
 
194
    vfamily = c("loglinb3"),
195
195
    deriv = expression({
196
196
        eval(extra$my.expression)
197
197
        eval(extra$deriv.expression)