[R] aggregate function with 'NA'
Dear r-help reader, I have some problems with the aggregate function. My datframe looks like frame Day Time V1 V2 1 M0 3 NA 2 M0 4 NA 3 M0 5 2 4 M1 NA 4 5 M1 10 6 6 T0 4 45 7 T1 4 3 8 T1 3 2 9 T1 6 1 I used the aggegate function to obtain the mean in V1 and V2 over the grouping variable Time and Day aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 NA 2 T 00 4.00 45 3 M 11 NA 5 4 T 11 4.33 2 My problem is now that I do not obtain a 'mean' for Day=M/Time=0 and Day=M/Time=1, because aggregate ignores all values for a grouping variable if NA occurs. I'm now hoping for some help so that the mean is still calculated in this group. My table should look like: aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 2 2 T 00 4.00 45 3 M 11 10 5 4 T 11 4.33 2 I hope my description makes sense and appreciate any help. Yours Frank [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] plotting
Anupam Tyagi AnupTyagi at yahoo.com writes: Is there something in R that will display both observed values and their influence on calculated statistics? In general : yes. You may give the example in the lm documentation a first try, and then rephrase your question. Dieter __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] Can I avoid loops here ?
Thanks Gabor, I will be more specific next time. best - Original Message - From: Gabor Grothendieck [EMAIL PROTECTED] Date: Saturday, September 30, 2006 10:38 pm Subject: Re: [R] Can I avoid loops here ? To: Tong Wang [EMAIL PROTECTED] Cc: R help r-help@stat.math.ethz.ch Try: mapply(%*%, mylist1, mylist2, SIMPLIFY = FALSE) Please provide self-contained examples as requested on the last line of every message to r-help. That means the data for X1, X2, Y1, Y2 should be included so one can run the code you post. On 10/1/06, Tong Wang [EMAIL PROTECTED] wrote: Hi, I have two lists of matrices, and I would like to get a list of term by term product, say, mylist1- list( X1,X2); mylist2-list(Y1,Y2) Need: mylist3-list(X1%*%Y1,X2%*%Y2) Is there a way that allows me to do this without loops ? Thanks a lot. best __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
[R] pie() with only 180°
I want to plot the results of today's elections in Austria in this typical 180°-piechart (and not 360°). Unfortunantely pie() has just an argument init.angle and no end.angle. Perhaps you know a workaround. Thomas __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] aggregate function with 'NA'
Frank [EMAIL PROTECTED] writes: aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) My problem is now that I do not obtain a 'mean' for Day=M/Time=0 and Day=M/Time=1, because aggregate ignores all values for a grouping variable if NA occurs. No. But mean() will give an NA result if any vaues are NA. I'm now hoping for some help so that the mean is still calculated in this group. add na.rm=TRUE -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] aggregate function with 'NA'
aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean, na.rm=T) 2006/10/1, Frank [EMAIL PROTECTED]: Dear r-help reader, I have some problems with the aggregate function. My datframe looks like frame Day Time V1 V2 1 M0 3 NA 2 M0 4 NA 3 M0 5 2 4 M1 NA 4 5 M1 10 6 6 T0 4 45 7 T1 4 3 8 T1 3 2 9 T1 6 1 I used the aggegate function to obtain the mean in V1 and V2 over the grouping variable Time and Day aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 NA 2 T 00 4.00 45 3 M 11 NA 5 4 T 11 4.33 2 My problem is now that I do not obtain a 'mean' for Day=M/Time=0 and Day=M/Time=1, because aggregate ignores all values for a grouping variable if NA occurs. I'm now hoping for some help so that the mean is still calculated in this group. My table should look like: aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 2 2 T 00 4.00 45 3 M 11 10 5 4 T 11 4.33 2 I hope my description makes sense and appreciate any help. Yours Frank [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list 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. -- Johan Sandblom N8, MRC, Karolinska sjh t +46851776108 17176 Stockholm m +46735521477 Sweden What is wanted is not the will to believe, but the will to find out, which is the exact opposite - Bertrand Russell __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] aggregate function with 'NA'
See ?mean and note the na.rm= argument: aggregate(frame[-1], frame[1:2], mean, na.rm = TRUE) On 10/1/06, Frank [EMAIL PROTECTED] wrote: Dear r-help reader, I have some problems with the aggregate function. My datframe looks like frame Day Time V1 V2 1 M0 3 NA 2 M0 4 NA 3 M0 5 2 4 M1 NA 4 5 M1 10 6 6 T0 4 45 7 T1 4 3 8 T1 3 2 9 T1 6 1 I used the aggegate function to obtain the mean in V1 and V2 over the grouping variable Time and Day aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 NA 2 T 00 4.00 45 3 M 11 NA 5 4 T 11 4.33 2 My problem is now that I do not obtain a 'mean' for Day=M/Time=0 and Day=M/Time=1, because aggregate ignores all values for a grouping variable if NA occurs. I'm now hoping for some help so that the mean is still calculated in this group. My table should look like: aggregate(frame[,c(-1)],list(frame$Day,frame$Time),mean) Group.1 Group.2 Time V1 V2 1 M 00 4.00 2 2 T 00 4.00 45 3 M 11 10 5 4 T 11 4.33 2 I hope my description makes sense and appreciate any help. Yours Frank [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] Wilcoxon Rank test of Package Coin
[EMAIL PROTECTED] wrote: Hi, I am running the following example which can be found on page 12 of the pdf file of COIN package wt-wilcox_test(pd~age,data=water_transfer,distribution=exact, conf.int=TRUE) wt actually contains the estimate of difference in location and the confidence interval of it. I am just wondering how can I extract these values? From the examples, I understand that the Wilcoxon statistic can be extracted as statitic(wt,linear) and the exact two-sides p-value can be extracted as pvalue(wt) But I haven't been able to find the correct function to extract the estimates of difference median of y-x) and the confidence interval of this estimates. Take a look at the help page for `wilcox_test', where it's clearly spelled out in the `Value:' section that ...Confidence intervals can be extracted by 'confint'. confint(wt) 95 percent confidence interval: -0.76 0.15 sample estimates: difference in location -0.305 Shall I go back to the package ExactRankTest? I do know how to extracted these values from function wilcox.exact there. Compared to `coin', the `exactRankTests' package is very limited in function. HTH, Henric Thank you Jue Wang, Biostatistician Contracted Position for Preclinical Research Biostatistics PrO Unlimited (908) 231-3022 __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] error from pmvnorm
At 20:11 30/09/2006, [EMAIL PROTECTED] wrote: Hi all, Can anyone tell me what the following error message means? Error in mvt(lower = lower, upper = upper, df = 0, corr = corr, delta = mean, : NA/NaN/Inf in foreign function call (arg 6) It was generated when I used the 'pmvnorm' function in the 'mvtnorm' package. You are supposed I think to send questions about contributed packages to the maintainer, but before you do, or repost to this list, it might be a good idea to collect more information. What was the call of pmvnorm? What version of mvtnorm do you have? What version of R? Thanks a lot. Yonghai Li Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list 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.
[R] Re : Complex survey analysis help
Dear Thomas ! Thank you for you help ! I need and explaination. If I suppress second and third stage what become the variance du to second and third stage ? I have try this E3stage-svydesign(ids=~stage1id, weight=~wei ...) and E3stage-svydesign(ids=~stage1id+stage2id+stage3id, weight=~weights...) And I get the same results Sincerly. - Message d'origine De : Thomas Lumley [EMAIL PROTECTED] À : justin bem [EMAIL PROTECTED] Cc : R Maillist r-help@stat.math.ethz.ch Envoyé le : Dimanche, 24 Septembre 2006, 10h04mn 16s Objet : Re: [R] Complex survey analysis help On Sun, 24 Sep 2006, justin bem wrote: Hi dear all, I have a complex survey data to analyse. I have a stratified survey with three stages level. The first stage is a PPS, but all other are SRSWOR. The solution propose in survey package is to considere PPS as SRS with repetion. No, the solution proposed is to consider it as PPS with replacement. I have try this E3stage-svydesign(ids=~stage1id+stage2id+stage3id, fpc=~fpc1+fpc2+fpc3, ...) This is the value for WOR sampling at all stage. What value should I give to fpc1 to have the same value of variance that in sampling with repetion ? I try fpc1-rep(0,length(data)) I get a error message. For sampling with replacement you just omit the fpc and specify the first-stage id and the sampling weights E3stage -svydesign(ids=~stageid1, weights=~weights) -thomas Thomas LumleyAssoc. Professor, Biostatistics [EMAIL PROTECTED]University of Washington, Seattle [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list 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.
[R] if (NULL) is error?
Why this is not valid? test - NULL if (test) test Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] Simple graphics
Jim Holtman wrote: Is this what you want? You have to reset the margins: png(file.png, width=200, height=200) par(mar=c(0,0,0,0)) # reset margins plot(0, xlim=c(0,200), ylim=c(0,200), type='n') polygon(c(50, 50, 150, 150), c(50, 150, 150, 50)) dev.off() Yes and no. This sort-of does what I want, except that it has no precision! After I edit the file.png with a graphic editor, I notice that the rectangle does not have 100 x 100 pixels in the sides, because the vertices are in weird points (instead of (50,50) to (150,150), they are from (53,53) to (146,146)) Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] if (NULL) is error?
On 10/1/2006 12:29 PM, Alberto Vieira Ferreira Monteiro wrote: Why this is not valid? test - NULL if (test) test The test part of an if statement should evaluate to a length 1 logical or numeric value. NULL is length zero. The R Language Definition explains this (although it implies length 1 is okay; in fact, that gives a warning). Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] pie() with only 180°
Thomas Steiner finbref.2006 at gmail.com writes: I want to plot the results of today's elections in Austria in this typical 180°-piechart (and not 360°). Unfortunantely pie() has just an argument init.angle and no end.angle. Perhaps you know a workaround. Thomas Please look up the function fan.plot Jim Lemmon had posted last month in reply to a question by me. You may be able to tweak that and make 180-degree plots. Anupam. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] if (NULL) is error?
Alberto Vieira Ferreira Monteiro albmont at centroin.com.br writes: Why this is not valid? test - NULL if (test) test What are you trying to do with these statements? I think setting test to False may do what you want. Of couse, I am just guessing. Anupam. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] Simple graphics
Yes and no. This sort-of does what I want, except that it has no precision! After I edit the file.png with a graphic editor, I notice that the rectangle does not have 100 x 100 pixels in the sides, because the vertices are in weird points (instead of (50,50) to (150,150), they are from (53,53) to (146,146)) R graphics are fundamentally vector in nature and you are unlikely to be able to get pixel level precision with them without considerable contortions. I'd recommend you look into some other low level graphics drawing package. See for example, ImageMagick and some of the many language bindings it has. Hadley __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] variance functions in glmmPQL or glm?
What are you trying to do with varIdent with logistic regression with variance components? Have you considered the weights argument in glm or glmmPQL? It sounds to me like you are trying to estimate 'size' for a binomial distribution, and I have trouble visualizing a context where that would be reasonable that would NOT be handled by the random effects portion of glmmPQL{MASS} or lmer{lme4}. If you'd like more help from this listserve, please provide commented, minimal, self-contained, reproducible code, as suggested in the posting guide www.R-project.org/posting-guide.html. Hope this helps, even if it doesn't answer your question. Spencer Graves Gretchen wrote: Hello R users- I am new to R, and tried searching the archives and literature for an answer to this - please be patient if I missed something obvious. I am fitting a logistic regression model, and would like to include variance functions (specifically the varIdent function). I cannot figure out how to do this either in glmmPQL (or something similar) for the model with random effects, or in glm for the model without random effects. Is it possible to fit a varIdent function in a generalized linear model? If so, what are the appropriate packages/functions to use? Any help would be appreciated. Thank you, Gretchen Anderson M.Sc. Candidate Dept. of Fisheries and Wildlife Michigan State University 13 Natural Resources Building East Lansing, MI 48824 Phone: (517) 353-0731 E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] Re : Complex survey analysis help
On Sun, 1 Oct 2006, justin bem wrote: Dear Thomas ! Thank you for you help ! I need and explaination. If I suppress second and third stage what become the variance du to second and third stage ? I have try this E3stage-svydesign(ids=~stage1id, weight=~wei ...) and E3stage-svydesign(ids=~stage1id+stage2id+stage3id, weight=~weights...) And I get the same results Yes, just as in the example on the help page for svydesign. When the first stage is sampling with replacement the variance estimator is based on the p-expanded cluster totals being a simple random sample from a population distribution. This is conservative, and better variance estimators are possible in principle. I am hoping to include better estimators in a future version of the package, but I need to do some more reading first -- there does not seem to be agreement on the best variance estimators (except for the impractical one that requires pairwise sampling probabilities). I would welcome suggested references (especially if they are in English). -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] array vs matrix vs dataframe?
On 10/1/2006 7:02 PM, r user wrote: What is the difference among an array, a dataframe and a matrix? Really, r, I think this is pretty well documented. Could you let us know what you've read that left this ambiguous? Why is the size of a dataframe so much larger? (see example below) I suspect it's the row names. Duncan Murdoch a-c(rep(1:100,1)) b-c(rep(1:100,1)) c1-cbind(a,b) cdf-as.data.frame(cbind(a,b)) cm-as.matrix(cbind(a,b)) object.size(a)/100 object.size(b)/100 object.size(c1)/100 object.size(cdf)/100 object.size(cm)/100 __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] array vs matrix vs dataframe?
On 10/1/2006 7:02 PM, r user wrote: What is the difference among an array, a dataframe and a matrix? Why is the size of a dataframe so much larger? (see example below) I forgot to mention: there will be very little difference in 2.4+; the row names were a problem in earlier releases, but Brian Ripley fixed that: a-c(rep(1:100,1)) b-c(rep(1:100,1)) c1-cbind(a,b) cdf-as.data.frame(cbind(a,b)) cm-as.matrix(cbind(a,b)) object.size(a)/100 [1] 4.24 object.size(b)/100 [1] 4.24 object.size(c1)/100 [1] 8.000296 object.size(cdf)/100 [1] 8.000448 object.size(cm)/100 [1] 8.000296 (These are in a recent release candidate of 2.4.0.) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] R 2.3.1 and SPSS 14.0
David Kaplan dkaplan at education.wisc.edu writes: Hi, Are there any incompatibilities with R 2.3.1 and SPSS 14.0 with regard to the read.spss command? Thanks in advance. David David, Version 14 of SPSS doesn't seem to have made any changes to the .sav file format. Therefore read.spss should work as it has. I haven't had any problems importing data files created in SPSS 14.0. Problems can arise when importing data files created by the SPSS Data Entry product (currently at version 4.0), and this is covered in the R Data Import/Export manual. Michael __ R-help@stat.math.ethz.ch mailing list 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.
[R] xyplot Graphic Help
I have the following graphic where I drop unused factors in the x axis, however I cannot get the first point on the second panel. It seems shifted. Any ideas? The example is below: data - data.frame( Room=as.factor(c(132,132,132,132,132,132,132,132,132,196,196)), Sample=as.factor(c(A,B,C,J,K,L,M,N,O,B,C)), Particulates=c(90,300,400,300,400,300,500,200,300,14,52), Class=as.factor(c(10,10,10,10,10,10,10,10,10,1,1)) ) a - data$Class print( xyplot(Particulates~Sample|Room, data=data, # groups=Room, type=p, xlab=list(label=Sample Site,cex=3), ylab=list(label=expression(paste(Particles = 0.5 ,mu,m/ft^2)),cex=3), ylim=c(-100,1200), # index.cond=list(c(2,1)), scales=list(x=list(relation=free, cex=2),y=list(cex=2)), prepanel=function(x,y,... ) { # yy - y[,drop=TRUE] xx - x[,drop=TRUE] list(xlim=levels(xx), # ylim=levels(yy), xat=sort(unique(as.numeric(xx))) # yat=sort(unique(as.numeric(yy))) ) }, panel=function(x,y,subscripts,m=a, ...) { # yy - y[,drop=TRUE] panel.xyplot(x,y,...) panel.abline(h=m[subscripts],col=red) panel.abline(h=mean(y,na.rm=TRUE),col=green) # panel.segments(x,y,...) } ) ) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list 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.
[R] xyplot Graphic Help
I have the following graphic where I drop unused factors in the x axis, however I cannot get the first point on the second panel. It seems shifted. Any ideas? The example is below: data - data.frame( Room=as.factor(c(132,132,132,132,132,132,132,132,132,196,196)), Sample=as.factor(c(A,B,C,J,K,L,M,N,O,B,C)), Particulates=c(90,300,400,300,400,300,500,200,300,14,52), Class=as.factor(c(10,10,10,10,10,10,10,10,10,1,1)) ) a - data$Class print( xyplot(Particulates~Sample|Room, data=data, # groups=Room, type=p, xlab=list(label=Sample Site,cex=3), ylab=list(label=expression(paste(Particles = 0.5 ,mu,m/ft^2)),cex=3), ylim=c(-100,1200), # index.cond=list(c(2,1)), scales=list(x=list(relation=free, cex=2),y=list(cex=2)), prepanel=function(x,y,... ) { # yy - y[,drop=TRUE] xx - x[,drop=TRUE] list(xlim=levels(xx), # ylim=levels(yy), xat=sort(unique(as.numeric(xx))) # yat=sort(unique(as.numeric(yy))) ) }, panel=function(x,y,subscripts,m=a, ...) { # yy - y[,drop=TRUE] panel.xyplot(x,y,...) panel.abline(h=m[subscripts],col=red) panel.abline(h=mean(y,na.rm=TRUE),col=green) # panel.segments(x,y,...) } ) ) __ R-help@stat.math.ethz.ch mailing list 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.
[R] multilevel factor model in lmer
Hello -- I am curious if lmer can be used to fit a multilevel factor model such as a two-parameter item response model. The one parameter model is straightforward. A two-factor model requires a set of factor loadings multiplying a single random effect. For example, a logit model for the ith subject responding correctly to the jth item (j=1,..,J) is logit[p(ij)] = a1*item1(i) + ... + aJ * itemJ(i) + lambda1*item1(i)*u(i) + ... + lambdaJ*itemJ(i)*u(i) where the lambdas are factor loadings, with lambda1 fixed to 1.0 and item1-itemJ are dummy variables for the items. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin 1 University Station A1700 Austin, TX 78712-0118 phone: 512-232-6335 fax: 512-471-1748 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list 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.
Re: [R] xyplot Graphic Help
That's note the only problem. The point (B, 14) is plotted at (C, 14). Your problem is that: factor(letters)[2:3, drop = TRUE] [1] b c Levels: b c so now b has level 1 and c has level 2 so if you try to plot b from the original factors where it was 2 it will show up above c and c will not show up at all since it corresponds to 3. By the way, please reduce your examples to the minimum code necessary to illustrate the point and still be reproducible as requested on the last line of every message on r-help. On 10/1/06, Shawn Way [EMAIL PROTECTED] wrote: I have the following graphic where I drop unused factors in the x axis, however I cannot get the first point on the second panel. It seems shifted. Any ideas? The example is below: data - data.frame( Room=as.factor(c(132,132,132,132,132,132,132,132,132,196,196)), Sample=as.factor(c(A,B,C,J,K,L,M,N,O,B,C)), Particulates=c(90,300,400,300,400,300,500,200,300,14,52), Class=as.factor(c(10,10,10,10,10,10,10,10,10,1,1)) ) a - data$Class print( xyplot(Particulates~Sample|Room, data=data, # groups=Room, type=p, xlab=list(label=Sample Site,cex=3), ylab=list(label=expression(paste(Particles = 0.5 ,mu,m/ft^2)),cex=3), ylim=c(-100,1200), # index.cond=list(c(2,1)), scales=list(x=list(relation=free, cex=2),y=list(cex=2)), prepanel=function(x,y,... ) { # yy - y[,drop=TRUE] xx - x[,drop=TRUE] list(xlim=levels(xx), # ylim=levels(yy), xat=sort(unique(as.numeric(xx))) # yat=sort(unique(as.numeric(yy))) ) }, panel=function(x,y,subscripts,m=a, ...) { # yy - y[,drop=TRUE] panel.xyplot(x,y,...) panel.abline(h=m[subscripts],col=red) panel.abline(h=mean(y,na.rm=TRUE),col=green) # panel.segments(x,y,...) } ) ) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list 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. __ R-help@stat.math.ethz.ch mailing list 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.
[R] How to dowload mod_R.so
i don't know url address how to dowload mod_R.so for use R and Apache webserver. i'm want to try R on the web. please tell me. -- View this message in context: http://www.nabble.com/How-to-dowload-mod_R.so-tf2367406.html#a6595151 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list 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.