[R] Labels in ICLUST
Dear all, I can't get the labels slot in ICLUST to accept a character vector. library(psych) test.data <- Harman74.cor$cov ic.out <- ICLUST(test.data,nclusters =4,labels=letters[1:ncol(test.data)]) ## Error in !labels : invalid argument type ic.out <- ICLUST(test.data,nclusters =4,labels=1:ncol(test.data)) ## OK Any ideas? __ R-help@r-project.org 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] effect size measure for dependent samples
Any advice on which package I can use for calculating effect sizes for two dependent samples? compute.es seems only to consider independent samples. Thanks in advance Steve Powell [[alternative HTML version deleted]] __ R-help@r-project.org 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] "save scores" from sem
Dear Joris, thanks again for these very useful insights. Your point about PCA, sem, FA is clear to me now. And I understand what you say about it not being the point of sem to make corrections in a model and then try to "save the scores" for another analysis. But still I am wondering what would happen if you did? suppose I had: a measured variable A and a latent variable B with indicators B1-B10, and A and B are supposed theoretically to correlate strongly. Then suppose I do a FCA and extract one component B'. If I did a similar CFA in an sem package and added a couple of correlated errors which improve the model, and if I could "save the scores" of the latent variable, wouldn't I expect it to correlate better with A than B' does? Best Wishes Steve www.promente.org | skype stevepowell99 | +387 61 215 997 On Wed, Jun 23, 2010 at 12:36 PM, Joris Meys wrote: > I should have specified: lavaan is not familiar to me. I'm also not > familiar enough with the sem package to tell you how to obtain the > scores, but all information regarding the fit is in the object. With > that, it shouldn't be too difficult to get the scores you want. This > paper might give you some more information, in case you didn't know it > yet : > > http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf > > On a side note, sem with a single latent variable might be seen as a > factor analysis with one component, but definitely not as a PCA. A PCA > is constructed based on the total variance, rendering an orthogonal > space with as many dimensions as there ara variables. Not so for a FA, > as the matrix used to calculate the eigenvectors and eigenvalues is a > reduced matrix, in essence only taking into account part of the > variation in the data for calculation of the loadings. This makes PCA > absolutely defined, but FA only up to a rotation. > > On a second side note, using the saved scores in some subsequent > analysis is in my view completely against the idea behind sem. > Structural equation modelling combines those observed variables > exactly to be able to take the variation on the combined latent > variable into account. If you use those latent variables as input in a > second analysis, you lose the information regarding the variation. > > Cheers > Joris > > > > On Wed, Jun 23, 2010 at 9:53 AM, Steve Powell wrote: >> Dear Joris, >> thanks for your reply - it is the sem case which interests me. Suppose >> for example I use sem to construct a CFA for a set of variables, with >> a single latent variable, then this could be equivalent to a PCA with >> a single component, couldn't it? From the PCA I could "save" the >> scores as new variables; is there an equivalent with sem? This would >> be particularly useful if e.g. in sem I let some of the errors covary >> and then wanted to use the "saved scores" in some subsequent analysis. >> >> By the way, lavaan is at cran.r-project.org/web/packages/lavaan/index.html >> >> Best Wishes >> Steve >> >> www.promente.org | skype stevepowell99 | +387 61 215 997 >> >> >> >> >> On Tue, Jun 22, 2010 at 7:08 PM, Joris Meys wrote: >>> PCA and factor analysis is implemented in the core R distribution, no >>> extra packages needed. When using princomp, they're in the object. >>> >>> pr.c <- princomp(USArrests,scale=T) >>> pr.c$scores # gives you the scores >>> >>> see ?princomp >>> >>> When using factanal, you can ask for regression scores or Bartlett >>> scorse. See ?factanal. >>> Mind you, you will get different -i.e. more correct- results than >>> those obtained by SPSS. >>> >>> I don't understand what you mean with scores in the context of >>> structural equation modelling. Lavaan is unknown to me. >>> >>> Cheers >>> Joris >>> >>> On Tue, Jun 22, 2010 at 3:11 PM, Steve Powell wrote: >>>> Dear expeRts, >>>> sorry for such a newbie question - >>>> in PCA/factor analysis e.g. in SPSS it is possible to save scores from the >>>> factors. Is it analogously possible to "save" the implied scores from the >>>> latent variables in a measurement model or structural model e.g. using the >>>> sem or lavaan packages, to use in further analyses? >>>> Best wishes >>>> Steve Powell >>>> >>>> www.promente.org | skype stevepowell99 | +387 61 215 997 >>>> >>>> __ >>>> R-help@r-project.org mailing list >>>> https://st
Re: [R] "save scores" from sem
Dear Joris, thanks for your reply - it is the sem case which interests me. Suppose for example I use sem to construct a CFA for a set of variables, with a single latent variable, then this could be equivalent to a PCA with a single component, couldn't it? From the PCA I could "save" the scores as new variables; is there an equivalent with sem? This would be particularly useful if e.g. in sem I let some of the errors covary and then wanted to use the "saved scores" in some subsequent analysis. By the way, lavaan is at cran.r-project.org/web/packages/lavaan/index.html Best Wishes Steve www.promente.org | skype stevepowell99 | +387 61 215 997 On Tue, Jun 22, 2010 at 7:08 PM, Joris Meys wrote: > PCA and factor analysis is implemented in the core R distribution, no > extra packages needed. When using princomp, they're in the object. > > pr.c <- princomp(USArrests,scale=T) > pr.c$scores # gives you the scores > > see ?princomp > > When using factanal, you can ask for regression scores or Bartlett > scorse. See ?factanal. > Mind you, you will get different -i.e. more correct- results than > those obtained by SPSS. > > I don't understand what you mean with scores in the context of > structural equation modelling. Lavaan is unknown to me. > > Cheers > Joris > > On Tue, Jun 22, 2010 at 3:11 PM, Steve Powell wrote: >> Dear expeRts, >> sorry for such a newbie question - >> in PCA/factor analysis e.g. in SPSS it is possible to save scores from the >> factors. Is it analogously possible to "save" the implied scores from the >> latent variables in a measurement model or structural model e.g. using the >> sem or lavaan packages, to use in further analyses? >> Best wishes >> Steve Powell >> >> www.promente.org | skype stevepowell99 | +387 61 215 997 >> >> __ >> R-help@r-project.org 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. >> > > > > -- > Joris Meys > Statistical consultant > > Ghent University > Faculty of Bioscience Engineering > Department of Applied mathematics, biometrics and process control > > tel : +32 9 264 59 87 > joris.m...@ugent.be > --- > Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php > __ R-help@r-project.org 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] "save scores" from sem
Dear expeRts, sorry for such a newbie question - in PCA/factor analysis e.g. in SPSS it is possible to save scores from the factors. Is it analogously possible to "save" the implied scores from the latent variables in a measurement model or structural model e.g. using the sem or lavaan packages, to use in further analyses? Best wishes Steve Powell www.promente.org | skype stevepowell99 | +387 61 215 997 __ R-help@r-project.org 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] sample weights in nlme
Dear expeRts Is it not the case that very many multi-level datasets have associated sample weights? But then I don't see a way to include them in the analyses? Or, how can I make nlme talk to the "survey" package? Best Wishes Steve __ R-help@r-project.org 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] two questions for R beginners
For psychologists like me (possibly for others) by far the most time-consuming detail is variable labels. I need them for just about every analysis I do. We can use special packages like Hmisc and its function spss.get to import the labels, but then nearly all the other packages don't respect the labels, even simple things like list. So I find myself either adding them back in at every step or making my own versions of the functions. People coming from SPSS just expect the output of basic functions like factanal to display the labels, or at least to have the option of doing so. Respecting/preserving variable labels in more core functions would be an enormous help for social scientists IMHO. What helped? Lots of things - r-seek and quick-R are my favourites, along with amazing people who reply to problems on r-help. __ R-help@r-project.org 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] multi-stage sampling and hierarchical models: which packages?
Dear wizaRds, I have a dataset to analyse which is causing me problems. It is a sample of parents in schools. First we had a population table of the schools in the country in question divided into five regions, and in each region we have an urban/rural split. The population Ns in these ten cells are known. Then three schools were drawn from each cell according to the Lahirie method, i.e with probability of being selected depending on school size. Students were then drawn randomly from the schools, again with probability proportional to school size. Details of this are below in case this is important. I have calculated the weights. So I have a weighting problem and a mixed levels problem at the same time. Even if I just use the survey package I am not sure how to specify the model, because I have clusters within strata rather than strata within clusters. I guess it would look something like dstrat<-svydesign(id=~schoolC,strata=~region+urbanrural, weights=~newweight, data=mydataset,nest=T), but this gives the same results as dstrat<-svydesign(id=~schoolC,strata=~region, weights=~newweight, data=mydataset,nest=T) And I can't see any way to look at the mixed levels effects using that package. Perhaps I am better advised to use nlme; I guess I can just use the weights as a covariate? My ultimate aims are to conduct various regressions in which I expect the school- and region-level effects to be strong. Ideally I would like to use sem as well, but then I am really stuck. If someone could put me on the right track I could be more specific with reproducible examples etc Best Wishes Steve Powell **details of Lahirie method as we used it: the schools were put into a list in order of ascending size (student population) and this list was divided into three bands containing 25%, 35% and 40% of all the students in the cell, respectively; and three schools were chosen randomly from each size band. Then samples of students were drawn randomly from lists of students at each school, so that more students were chosen from the larger schools: 20, 30 and 40 from each of the smaller, medium and large schools. So we have (20+30+40)*3 students per cell, for 10 cells = 2700 students in this country. www.promente.org | skype stevepowell99 | Thailand +66 8 4438 2667 [[alternative HTML version deleted]] __ R-help@r-project.org 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] using survey weights for correlations
Dear list, I have a data file which includes, alongside various variables representing questionnaire scores, a variable for survey weights computed as the number of observations in the sample drawn from that group divided by the number of observations in the population in the group. I need to calculate a covariance matrix of the questionnaire scores for use in sem. How do I apply the weights? Thanks in advance, Steve Powell www.promente.org proMENTE social research Krančevićeva 35 71000 Sarajevo skype stevepowell99 mob. +387 61 215 997 tel. +387 33 556 865 fax. +387 33 556 866 __ R-help@r-project.org 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] printing name of object inside lapply
Thanks Prof Ripley! How obvious in retrospect! Prof Brian Ripley wrote: On Thu, 4 Sep 2008, Steve Powell wrote: Dear list members, I am trying, within a lapply command, to print the name of the objects in list or data frame. This is so that I can use odfWeave to print out a report with a section for each object, including the object names. I tried e.g. a=b=c=1:5 lis=data.frame(a,b,c) lapply( lis, function (z) { obj.nam <- deparse(substitute(z)) cat("some other text",obj.nam,"and so on","\n") } ) But instead of getting "a" "b" etc. I get X[[1L]] etc. Any ideas? Use a for() loop on the names: lapply is overkill here. But you could use lapply(names(lis), function (z) { cat("some other text", z, "and so on","\n") ## references to lis[[z]] }) www.promente.org proMENTE social research Kran??evi??eva 35 71000 Sarajevo mob. +387 61 215 997 tel. +387 556 865 fax. +387 556 866 [[alternative HTML version deleted]] __ R-help@r-project.org 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] printing name of object inside lapply
Dear list members, I am trying, within a lapply command, to print the name of the objects in list or data frame. This is so that I can use odfWeave to print out a report with a section for each object, including the object names. I tried e.g. a=b=c=1:5 lis=data.frame(a,b,c) lapply( lis, function (z) { obj.nam <- deparse(substitute(z)) cat("some other text",obj.nam,"and so on","\n") } ) But instead of getting "a" "b" etc. I get X[[1L]] etc. Any ideas? www.promente.org proMENTE social research KranÄeviÄeva 35 71000 Sarajevo mob. +387 61 215 997 tel. +387 556 865 fax. +387 556 866 [[alternative HTML version deleted]] __ R-help@r-project.org 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] odf and unzip: unzip not found
hi list members I am trying to use odfWeave with R 2.5.1 on Windows XP. however when running e.g. odfWeave(demoFile, outputFile) I get: Error in odfWeave(demoFile, outputFile) : Error unzipping file In addition: Warning message: unzip not found in: system(zipCmd[2], invisible = TRUE) presumably my zip and unzip are not set up correctly but I dont know how to do that. I installed zip and unzip from info-zip.org as suggested in the help file, and think I managed set my Windows path to include the folders where they are installed, but still no luck. Any ideas? thanks Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org Checked by AVG Free Edition. 0:00 No virus found in this incoming message. Checked by AVG Free Edition. 12.11.2007 21:19 __ R-help@r-project.org 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] Substitute in function calling a function
Dear list members, I am writing some functions to help with printing graphs. If I want to return the name of a variable within a function, for instance to print the label for a graph, I know that I can use substitute: fun=function(x) substitute(x) #plus of course some other processing var=1:3 fun(var) #prints "var" as required, not "x". But if I call this function in another function fun2=function(y) fun(y) #plus of course some other processing fun2(var) #prints "y" when what I wanted was "var" I have tried lots of tricks using eval and expression but can't seem to get it right. Any ideas? Thanks in advance Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org Checked by AVG Free Edition. 19.10.2007 05:10 __ R-help@r-project.org 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] Apply vector of labels to columns of data frame
Thanks Shubha, Petr and Patrick - Erm, yes perhaps I wasn't clear, when I said "label" I didn't mean names, I meant the labels provided by Hmisc. So for example v=c("lab1","lab2","lab3") a<-b<-c<-1:3 df=data.frame(cbind(a,b,c)) I can do label(df$a)="lab1" label(df$b)="lab2" etc Or attributes(df$a)$label="lab1" etc But I would like to do this with a loop or an apply function. Thanks and best wishes Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org -Original Message- From: Patrick Burns [mailto:[EMAIL PROTECTED] Sent: 05 October 2007 11:50 To: Steve Powell Subject: Re: [R] Apply vector of labels to columns of data frame Your question is not very clear, but is this what you want: colnames(v) <- paste('lab', 1:ncol(v), sep='') Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Steve Powell wrote: >Dear list members >I would like to apply a vector of labels >v=c("lab1","lab2","lab3") >to a dataframe >df=data.frame(1:3,1:3,1:3) >using some kind of loop or apply function. >Any ideas? >Thanks > > >Steve Powell > > > >Checked by AVG Free Edition. > >17:03 > > > [[alternative HTML version deleted]] > >__ >R-help@r-project.org 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. > > > > No virus found in this incoming message. Checked by AVG Free Edition. 04.10.2007 17:03 Checked by AVG Free Edition. 04.10.2007 17:03 __ R-help@r-project.org 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] Apply vector of labels to columns of data frame
Dear list members I would like to apply a vector of labels v=c("lab1","lab2","lab3") to a dataframe df=data.frame(1:3,1:3,1:3) using some kind of loop or apply function. Any ideas? Thanks Steve Powell Checked by AVG Free Edition. 17:03 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Separate colour for comments in scripts
Dear Sumit Tinn-R is a little text editor which can do all that and more: http://www.sciviews.org/Tinn-R/ Best wishes Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 24 September 2007 08:49 To: r-help@r-project.org Subject: [R] Separate colour for comments in scripts Hi, Is it possible to assign a separate colour for comments written with #, eg:- #this is a comment . I am looking to colour them differently from the program text in R-Editor (not console). Is it possible to do so? Eg. In Visual basic, the colour for remarks gets green automatically Regards Sumit [[alternative HTML version deleted]] __ R-help@r-project.org 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. No virus found in this incoming message. Checked by AVG Free Edition. 23.09.2007 13:53 Checked by AVG Free Edition. 23.09.2007 13:53 __ R-help@r-project.org 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] SEM - standardized path coefficients? - significant style
Dear John Being an R user is like having Christmas every day and having a direct line to Santa for present suggestions. How about if path.diagram.sem had the ability to print non-significant paths in, for example dotted style? I had a go myself but couldn't see how to get (summary(model)$coeff)$"Pr(>|z|)" into the loop. Very best wishes Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: 19 September 2007 13:55 To: 'Steve Powell' Cc: [EMAIL PROTECTED] Subject: RE: [R] SEM - standardized path coefficients? Dear Steve, My intention was to provide this flexibility via the parameters argument to path.diagram.sem(), but it isn't implemented. Here's a version that should do what you want: - snip path.diagram.sem <- function (model, out.file, min.rank = NULL, max.rank = NULL, same.rank = NULL, variables = model$var.names, parameters, ignore.double = TRUE, edge.labels = c("names", "values"), size = c(8, 8), node.font = c("Helvetica", 14), edge.font = c("Helvetica", 10), rank.direction = c("LR", "TB"), digits = 2, ...) { if (!missing(out.file)) { handle <- file(out.file, "w") on.exit(close(handle)) } else handle <- stdout() edge.labels <- match.arg(edge.labels) rank.direction <- match.arg(rank.direction) cat(file = handle, paste("digraph \"", deparse(substitute(model)), "\" {\n", sep = "")) cat(file = handle, paste(" rankdir=", rank.direction, ";\n", sep = "")) cat(file = handle, paste(" size=\"", size[1], ",", size[2], "\";\n", sep = "")) cat(file = handle, paste(" node [fontname=\"", node.font[1], "\" fontsize=", node.font[2], " shape=box];\n", sep = "")) cat(file = handle, paste(" edge [fontname=\"", edge.font[1], "\" fontsize=", edge.font[2], "];\n", sep = "")) cat(file = handle, " center=1;\n") if (!is.null(min.rank)) { min.rank <- paste("\"", min.rank, "\"", sep = "") min.rank <- gsub(",", "\" \"", gsub(" ", "", min.rank)) cat(file = handle, paste(" {rank=min ", min.rank, "}\n", sep = "")) } if (!is.null(max.rank)) { max.rank <- paste("\"", max.rank, "\"", sep = "") max.rank <- gsub(",", "\" \"", gsub(" ", "", max.rank)) cat(file = handle, paste(" {rank=max ", max.rank, "}\n", sep = "")) } if (!is.null(same.rank)) { for (s in 1:length(same.rank)) { same <- paste("\"", same.rank[s], "\"", sep = "") same <- gsub(",", "\" \"", gsub(" ", "", same)) cat(file = handle, paste(" {rank=same ", same, "}\n", sep = "")) } } latent <- variables[-(1:model$n)] for (lat in latent) { cat(file = handle, paste(" \"", lat, "\" [shape=ellipse]\n", sep = "")) } ram <- model$ram ram[names(model$coeff), 5] <- model$coeff rownames(ram)[model$fixed] <- ram[model$fixed, 5] names <- rownames(ram) values <- round(ram[, 5], digits) heads <- ram[, 1] to <- ram[, 2] from <- ram[, 3] labels <- if (!missing(parameters)){ if (is.numeric(parameters)) round(parameters, digits) else parameters } else if (edge.labels == "names") names else values direction <- ifelse((heads == 2), " dir=both", "") for (par in 1:nrow(ram)) { if ((!ignore.double) || (heads[par] == 1)) cat(file = handle, paste(" \"", variables[from[par]], "\" -> \"", variables[to[par]], "\" [label=\"", labels[par], "\"", direction[par], "];\n", sep = "")) } cat(file = handle, "}\n") } - snip E.g.,
Re: [R] SEM - standardized path coefficients?
Dear list members, In sem, std.coef() will give me standardized coefficients from a sem model. But is there a trick so that path.diagram can use these coefficients rather than unstandardized ones? Thanks Steve Powell From: John Fox Date: Wed 28 Feb 2007 - 14:37:22 GMT Dear Tim, See ?standardized.coefficients (after loading the sem package). Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tim Holland > Sent: Wednesday, February 28, 2007 12:35 AM > To: [EMAIL PROTECTED] > Subject: [R] SEM - standardized path coefficients? > > Hello - > > Does anybody know how to get the SEM package in R to return > standardized path coefficients instead of unstandardized > ones? Does this involve changing the covariance matrix, or > is there an argument in the SEM itself that can be changed? > > Thank you, > Tim > > [[alternative HTML version deleted]] > > __ > [EMAIL PROTECTED] 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. Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org Checked by AVG Free Edition. 18.09.2007 11:53 __ R-help@r-project.org 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] Creating Hmisc labels inside a function
Thanks again Frank for quick reply. True, someobject=2 Test=function(obj,labe) { label(obj)=labe #at this point add the line: obj } Test(someobject,"somelabel") #returns a label. But if you retype someobject #the label has gone. That is what I meant by the label not being permanently changed. Steve proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org -Original Message- From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] Sent: 17 September 2007 17:18 To: Steve Powell Cc: [EMAIL PROTECTED] Subject: Re: [R] Creating Hmisc labels inside a function Steve Powell wrote: > > Thanks, Frank - it doesn't work though. > Your suggestion was: > Test=function(obj,labe) { label(obj)=labe #at this point add the line: obj } > #...but just returning the object does not permanently change the label: > obj It does for me. Please re-run. -Frank > attributes(Test(1:3, 'some label')) $label [1] "some label" $class [1] "labelled" You don't need assign. Frank > > That is why I wanted to use assign. But "assign" will not work with > attributes, labels etc. So > > assign(label(obj),"some label") #doesn't even work outside a function, > at the command prompt. > > Any more ideas anyone? > Best wishes > Steve Powell > > > proMENTE social research > research | evaluation | training & consulting Kranjčevićeva 35, 71000 > Sarajevo > mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 > 866 > skype: stevepowell99 > www.promente.org | www.mojakarijera.com | www.psih.org > > -Original Message- > From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] > Sent: 12 September 2007 14:38 > To: Steve Powell > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Creating Hmisc labels inside a function > > Steve Powell wrote: >> hello list members, >> I am wanting to write a label using the Hmisc package, but inside a >> function. Normally I can do: >> >> library(Hmisc) >> M=2 >> label(M)="lab" >> >> #But inside a function the "=" does not work: >> Test=function(obj,labe) >> { >> label(obj)=labe > > at this point add the line: > > obj > >> } > > The returned object will have what you need. -Frank > >> Test(M,"new label") >> >> I usually use the "assign" function to make assignments inside >> functions, but assign will not work with attributes, labels etc. >> Any ideas? >> Thanks in advance >> >> Steve Powell >> >> >> proMENTE social research >> research | evaluation | training & consulting Kranjčevićeva 35, 71000 >> Sarajevo >> mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 >> 866 >> skype: stevepowell99 >> www.promente.org | www.mojakarijera.com | www.psih.org >> >> >> Checked by AVG Free Edition. >> >> 17:43 >> >> __ >> R-help@r-project.org 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. >> > > -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University No virus found in this incoming message. Checked by AVG Free Edition. 16.09.2007 18:32 Checked by AVG Free Edition. 16.09.2007 18:32 __ R-help@r-project.org 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] Creating Hmisc labels inside a function
Thanks, Frank - it doesn't work though. Your suggestion was: Test=function(obj,labe) { label(obj)=labe #at this point add the line: obj } #...but just returning the object does not permanently change the label: obj That is why I wanted to use assign. But "assign" will not work with attributes, labels etc. So assign(label(obj),"some label") #doesn't even work outside a function, at the command prompt. Any more ideas anyone? Best wishes Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org -Original Message- From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] Sent: 12 September 2007 14:38 To: Steve Powell Cc: [EMAIL PROTECTED] Subject: Re: [R] Creating Hmisc labels inside a function Steve Powell wrote: > hello list members, > I am wanting to write a label using the Hmisc package, but inside a > function. Normally I can do: > > library(Hmisc) > M=2 > label(M)="lab" > > #But inside a function the "=" does not work: > Test=function(obj,labe) > { > label(obj)=labe at this point add the line: obj > } The returned object will have what you need. -Frank > > Test(M,"new label") > > I usually use the "assign" function to make assignments inside > functions, but assign will not work with attributes, labels etc. > Any ideas? > Thanks in advance > > Steve Powell > > > proMENTE social research > research | evaluation | training & consulting Kranjčevićeva 35, 71000 > Sarajevo > mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 > 866 > skype: stevepowell99 > www.promente.org | www.mojakarijera.com | www.psih.org > > > Checked by AVG Free Edition. > > 17:43 > > __ > R-help@r-project.org 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. > -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University No virus found in this incoming message. Checked by AVG Free Edition. 11.09.2007 17:46 Checked by AVG Free Edition. 16.09.2007 18:32 __ R-help@r-project.org 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] Creating Hmisc labels inside a function
hello list members, I am wanting to write a label using the Hmisc package, but inside a function. Normally I can do: library(Hmisc) M=2 label(M)="lab" #But inside a function the "=" does not work: Test=function(obj,labe) { label(obj)=labe } Test(M,"new label") I usually use the "assign" function to make assignments inside functions, but assign will not work with attributes, labels etc. Any ideas? Thanks in advance Steve Powell proMENTE social research research | evaluation | training & consulting Kranjčevićeva 35, 71000 Sarajevo mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866 skype: stevepowell99 www.promente.org | www.mojakarijera.com | www.psih.org Checked by AVG Free Edition. 17:43 __ R-help@r-project.org 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.