[R] Marg.fct function

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sun Feb 5 22:47:07 CET 2017


It is not part of "R". You can dig through all of the packages that the author mentions,  or send an email to the author. 
-- 
Sent from my phone. Please excuse my brevity.

On February 5, 2017 11:44:40 AM PST, James Henson <jfhenson1 at gmail.com> wrote:
>Greetings R Community,
>
>An attempt to reproduce the results from code in the source below
>fails.  R cannot find the function ‘Marg.fct’. An Internet search for
>the ‘Marg.fct’ function was not fruitful.  I appreciate your help.
>Best regards, James F. Henson.
>
>R (and S-PLUS) Manual to Accompany Agresti’s Categorical Data Analysis
>(2002) 2nd edition Laura A. Thompson, 2009©
>
>http://www.stat.ufl.edu/~aa/cda/Thompson_manual.pdf  page 181
>
>The code is:
>
># Code from Manual to Accompany Agresti’s Categorical Data Analysis
>(2002) 2nd edition Laura A. Thompson, 2009
>
>y <- c(144, 33, 84, 126, 2, 4, 14, 29, 0, 2, 6, 25, 0, 0, 1, 5)
>
>ZF <- Z <- matrix(1,16,1)
>
>#
>
>M1 <- Marg.fct(1,rep(4,2)) # used to get m1+, etc
>
>Error: could not find function "Marg.fct"
>
>
>
>M2 <- Marg.fct(2,rep(4,2)) # used to get m+1, etc
>
>#
>
>C.matrix <- matrix(c(
>
>  1, 0, 0, 0, -1, 0, 0, 0, # y1+ = y+1
>
>  0, 1, 0, 0, 0, -1, 0, 0, # y2+ = y+2
>
>  0, 0, 1, 0, 0, 0, -1, 0), # y3+ = y+3
>
>  3,8,byrow=T)
>
>h.fct <- function(m) { # constraint function
>
> marg <- rbind(M1%*%m, M2%*%m) # y1+, y2+, y3+, y4+, y+1, y+2, y+3, y+4
>
>  C.matrix%*%marg # y1+ = y+1, y2+ = y+2, etc
>
>}
>
>#
>
>a <- mph.fit(y=y,Z=Z,ZF=ZF,h.fct=h.fct)
>
>mph.summary(a)
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list