search for: loglm

Displaying 20 results from an estimated 50 matches for "loglm".

Did you mean: logl
2010 Nov 08
1
unknown dimensions for loglm
Dear R-help community, I am working with multidimensional contingency tables and I am having trouble getting loglm to run on all dimensions without typing out each dimension. I have generated random data and provided output for the results I want below: d1.c1 <- rnorm(20, .10, .02) d1.c2 <- rnorm(20, .10, .02) d2.c1 <- rnorm(20, .09, .02) d2.c2 <- rnorm(20, .09, .02) d3.c1 <- rnorm(20, .11, ....
1999 Apr 14
2
No LOGLM coefficients
...for 12 months each (factors for the models). One of the aims is to predict the missing values in this dataset with model predictions. Ive first tried to work with GLM's, that worked fine except for models with one or more interaction-terms. The GLMs run, run .. for hours. So I switched to using LOGLM (MASS-library), and that worked swift. The deviances were the same so that worked well. The only problem is that my data contains both zero's (rarely) and quite a lot of NA's. LOGLM doesn't report the params in these cases (the help file reports this) but I still want to use them for p...
1999 Feb 18
1
[R] possible bug in loglm (PR#122)
Bug report: there is a problem with loglm (or some underlying code) when used with updating within a function. For example, this code works as expected, when used outside a function: ------------------------------------------------- library(MASS) cts<-c(25,13,99,45,128,78,151,153,173,171,49,62,1308,236,989,264,622,201,492,244,382,237,...
2003 Oct 30
0
loglm() uses only a reference to data, and not data itsel f - is that on purpose??
loglm() is a port of an original written for S-PLUS. The fact that it carries only a reference to the data frame is neither intentional nor unintentional, but an unnoticed side-effect. I can see advantages both ways. (I'm not so sure, either, that what you say is standard behaviour for model fitti...
2013 Jul 06
0
fitting the null loglinear model with MASS::loglm??
The null loglinear model is an intercept-only model for log frequency, log(f) = \mu For a one-way table the test of the null model is the same as the chisq.test. This can be fit using loglin(), but I don't think there is any way to specify this using MASS::loglm > t1<- margin.table(Titanic,1) > t1 Class 1st 2nd 3rd Crew 325 285 706 885 > loglin(t1, NULL) 0 iterations: deviation $lrt [1] 475.8113 $pearson [1] 467.8069 $df [1] 3 $margin NULL > chisq.test(t1) Chi-squared test for given probabilities data: t1 X-squ...
2009 Jan 14
1
loglm fitting
Dear all, sorry to bother you all with this but I've been trying to use the loglm in MASS package (v2.8.0) and cannot get any sensible output. I'm wondering am I doing something very foolish or missing something obvious. For example, I tried the documentation help(loglm) example - here's the code # Case 1: frequencies specified as an array. sapply(min...
2006 Nov 26
2
Fixed zeros in tables
Hello All R Users, Function loglm() in library MASS can be cajoled to accomodate structural zeros in a cross-classification table. An example from Fienberg demonstrates how this can be done. My question is: Can the function glm() perform the same task? Can glm() estimate a log-linear model with fixed zeros like loglm()? Thanks fo...
2010 Apr 14
1
Sig differences in Loglinear Models for Three-Way Tables
...On No 4998 3 BB Off Yes 25 4 BB Off No 339 5 AA On Yes 305 6 AA On No 2752 7 AA Off Yes 31 8 AA Off No 692 9 CC On Yes 251 10 CC On No 1677 11 CC Off Yes 17 12 CC Off No 557 First, I run the independence model and found a poor fit: > library(MASS) > loglm(n~A+T+L) Call: loglm(formula = n ~ A + T + L) Statistics: X^2 df P(> X^2) Likelihood Ratio 1001.431 7 0 Pearson 1006.287 7 0 Thus, I went on and run the two-way association model and found a good fit: > loglm(n~A:T+A:L+T:L) Call: loglm(formu...
2010 Mar 01
0
MASS::loglm - exploring a collection of models with add1, drop1
...t; - attr(*, "class")= chr [1:2] "xtabs" "table" - attr(*, "call")= language xtabs(formula = as.formula(paste("freq ~", paste(tvars, collapse = "+"))), data = table) # fit baseline log-linear model for Status as response hoyt.mod0 <- loglm(~ Status + (Sex*Rank*Occupation), data=Hoyt1) > (hoyt.add1 <- add1(hoyt.mod0, ~.^2, test="Chisq")) Single term additions Model: ~Status + (Sex * Rank * Occupation) Df AIC LRT Pr(Chi) <none> 2166.36 Status:Sex 1 2129.54 38.82 4.658e-10 *** Status:Rank 2 1430.03 740.33 < 2...
2007 May 23
0
Replicated LR goodness-of-fit tests, heterogeneity G, with loglm?
...divided by its degrees of freedom to heterogeneity G divided by its degrees of freedom. The F ratio would (I think) test the hypothesis that the badness-of-fit in the pooled data is greater than would be expected by chance from the heterogeneity among replicates. It seems that the function loglm is the closest within R to what I want. But I can¢t see how it can be used when the expected proportions are externally provided. I¢ve appended here a function I wrote that more or less does what I want (with the nesting factor ignored) but I would prefer to use something like loglm because...
2013 Sep 12
6
declaring package dependencies
...Extra are not > declaring their dependence on colorspace/MASS: see > > http://cran.r-project.org/web/checks/check_results_vcdExtra.html But, I can't see what to do to avoid this, nor understand what has changed in R devel. Sure enough, CRAN now reports errors in examples using MASS::loglm(), using R Under development (unstable) (2013-09-11 r63906) > Caesar.mod0 <- loglm(~Infection + (Risk*Antibiotics*Planned), data=Caesar) Error: could not find function "loglm" In DESCRIPTION I have Depends: R (>= 2.10), vcd, gnm (>= 1.0.3) Suggests: ca,gmodels,Fahrmeir,e...
2005 Sep 16
1
How to make two figures in one plot - package vcd
Dear all, I have a problem to make figures with two columns in package vcd. Here an example code I take from "\library\vcd\html\plot.loglm.html" What I need, I want to make two figures in one plot. How could I do that. I have tried with layout(rbind(c(1, 1, 2, 2))) but the same result, two plot. Best wishes, Muhammad Subianto library(vcd) oldpar <- par(mfrow=c(1, 2)) ## mosaic display for PreSex model data(PreSex) fm <- l...
2010 Aug 30
0
Posthoc test for 3-way interaction (log-linear model)
...ot;No") > tk <- c("On","Off") > ats <- c("S","V","M") > L <- gl(2,1,12,yes.no) > T <- gl(2,2,12,tk) > A <- gl(3,4,12,ats) > n <- c(1056,4774,22,283,326,2916,27,360,274,1770,15,226) > library(MASS) > l.loglm <- data.frame(A,T,L,n) > l.loglm A T L n 1 S On Yes 1056 2 S On No 4774 3 S Off Yes 22 4 S Off No 283 5 V On Yes 326 6 V On No 2916 7 V Off Yes 27 8 V Off No 360 9 M...
1999 May 23
0
Bug in loglin with variable called "c" (PR#198)
...rent major version (6.1 not 5.3) and please don't use it unless you like testing pre-release software. BTW, the name is MASS, not mass or Mass: it is an acronym. > have encountered a minor problem you might want to be informed about : > > If used the following command: > mydata.loglm <- loglm(n~ s+c+m, mydata) > > I got an the following error : Error in get(x, envir, mode, inherits) : > variable "FUN" was not found > > traceback() > [1] "get(as.character(f), mode = \"function\")" > [2] "match.fun(FUN)" > [3]...
2013 Apr 24
2
Regression on stratified count data
Hi all: For stratified count data,how to perform regression analysis? My data: age case oc count 1 1 1 21 1 1 2 26 1 2 1 17 1 2 2 59 2 1 1 18 2 1 2 88 2 2 1 7 2 2 2 95 age: 1:<40y 2:>40y case: 1:patient 2:health oc: 1:use drug 2:not use drug My purpose: Anaysis whether case and
2006 Jan 18
0
Loading of namespace on load of .Rdata (was strange behaviour of load)
...circumstances: when the workspace contains a formula object, a terms object, a function, or some other object with a non-NULL environment, which has been created in the environment of a packaged function. In particular, this would not always occur with a packaged model fitting function, e.g. (from ?loglm in MASS) > library(MASS) > minn38a <- array(0, c(3,4,7,2), lapply(minn38[, -5], levels)) > minn38a[data.matrix(minn38[,-5])] <- minn38$f > fm <- loglm(~1 + 2 + 3 + 4, minn38a) > environment(fm$terms) <environment: R_GlobalEnv> in this case because the terms compone...
2002 Jan 30
1
mosaicplot(formula, data)--- bugged?
....ans)) 4: apply(x, margin, sum) 3: margin.table(data, match(varnames, names(dimnames(data)))) 2: mosaicplot.formula(~Hair + Eye + Sex + Hair:Eye, data = HairEyeColor) 1: mosaicplot(~Hair + Eye + Sex + Hair:Eye, data = HairEyeColor) > but this works correctly: > library(MASS) > lm1 <- loglm(~Hair*Eye + Sex, HairEyeColor) > lm1 Call: loglm(formula = ~Hair * Eye + Sex, data = HairEyeColor) Statistics: X^2 df P(> X^2) Likelihood Ratio 29.34982 15 0.01449443 Pearson 28.99286 15 0.01611871 > Can anyone help? -- Michael Friendly fri...
2002 Aug 11
1
Ordinal categorical data with GLM
...satisfied", "Little dissatisfied", "Moderately satisfied", "Very satisfied")) dimnames(data.3) <- list.3 ftable(data.3) I am able to obtain Agresti's results for the independence model which assumes the data is nominal, not ordinal, using either glm() or loglm(). library(MASS) options(contrasts=c("contr.sum", "contr.poly")) X <- as.integer(gl(4, 4, 16)) - 1 Y <- as.integer(gl(4, 1, 16)) - 1 data.2 <- data.frame(Freq, X = factor(X), Y = factor(Y)) summary(fm3 <- glm(Freq ~ X + Y, data = data.2, family = poisson())) dumm...
2006 Jan 18
2
Loading of namespace on load of .Rdata (was strange behaviour of load)
...circumstances: when the workspace contains a formula object, a terms object, a function, or some other object with a non-NULL environment, which has been created in the environment of a packaged function. In particular, this would not always occur with a packaged model fitting function, e.g. (from ?loglm in MASS) > library(MASS) > minn38a <- array(0, c(3,4,7,2), lapply(minn38[, -5], levels)) > minn38a[data.matrix(minn38[,-5])] <- minn38$f > fm <- loglm(~1 + 2 + 3 + 4, minn38a) > environment(fm$terms) <environment: R_GlobalEnv> in this case because the terms compone...
2009 Feb 18
2
indicator or deviation contrasts in log-linear modelling
I am fairly new to log-linear modelling, so as opposed to trying to fit modells, I am still trying to figure out how it actually works - hence I am looking at the interpretation of parameters. Now it seems most people skip this part and go directly to measuring model fit, so I am finding very few references to actual parameters, and am of course clear on the fact that their choice is irelevant for