similar to: add variable in for loop

Displaying 20 results from an estimated 200 matches similar to: "add variable in for loop"

2012 Jun 26
2
MuMIn - assessing variable importance following model averaging, z-stats/p-values or CI?
Dear R users, Recent changes to the MuMIn package now means that the model averaging command (model.avg) no longer returns confidence intervals, but instead returns zvalues and corresponding pvalues for fixed effects included in models. Previously I have used this package for model selection/averaging following Greuber et al (2011) where it suggests that one should use confidence intervals from
2006 Feb 27
2
obtaining means/SD after fitting a mixed model
Hello, I am running (non-balanced) mixed models (using library lme4) such as : model1<-glmmPQL(Y~grouping variable+ covariate, random=~1|yr/month, data=dat, family= gaussian or poisson) and besides the usual output in terms of the statistical significance of the fitted coefficients, I'd like to obtain the adjusted means and standard deviations (as one obtains after fitting a lm model).
2008 Sep 11
2
Save object summary to file
Hi, Am wanting to save the summary of a PCA to file. Have tried: > write.table(summary(PCA), file="PCAvar.txt", sep="\t") but receive: Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class "summary.princomp" into a data.frame What am I doing wrong? Thanks -- View this message in context:
2008 Sep 07
1
Label 2 groups in PCA different colours
Hi, I'm wanting to do a PCA on some data which is comprised of two different groups (to see how well the groups are discriminated). Is there a way to change the colour of the datapoints in a biplot so that I can easily see which group is which (eg objects 1-100, red, 101-200, black). Might be simple, but I'm new to R and can't seem to find how to do this. Thanks. Paul -- View this
2013 Nov 24
1
create a new dataframe with intervals and computing a weighted average for each of its rows
I need you help with this problem, I have a data-frame like this: BHID=c(43,43,43,43,44,44,44,44,44) FROM=c(50.9,46.7,44.2,43.1,52.3,51.9,49.3,46.2,42.38) TO=c(46.7,44.2,43.1,40.9,51.9,49.3,46.2,42.38,36.3) AR=c(45,46,0.0,38.45,50.05,22.9,0,25,9) DF<-data.frame(BHID,FROM,TO,VALUE) #add the length DF$LENGTH=DF$FROM-DF$TO where: + BHID: is the borehole
2008 Jul 25
1
Write lower half of distance matrix only
Hi, I'm very new to R. I want to know if there is any way to write only the lower half of a distance matrix created in R to a csv file for example. I get the 'cannot coerce class "dist" into a data.frame' message when I try. I have used as.matrix and can write to a file this way, but as a full matrix. The reason I only want the lower half is that I've been doing some
2008 Sep 09
4
PCA and % variance explained
After doing a PCA using princomp, how do you view how much each component contributes to variance in the dataset. I'm still quite new to the theory of PCA - I have a little idea about eigenvectors and eigenvalues (these determine the variance explained?). Are the eigenvalues related to loadings in R? Thanks, Paul -- View this message in context:
2002 Apr 17
1
dfree command
Hi I'm using SuSE-Linux 7.3, Kernel 2.4.18 with samba 2.2.3a and XFS with quotas The problem is the quotas won't be displayed in Samba. So I've tried to write my own dfree command and add it in smb.conf. dfree.sh: #!/bin/sh used_space=`/usr/bin/quota -u $1 | tail -1 | awk '{print $2}'` quota_space=`/usr/bin/quota -u $1 | tail -1 | awk '{print $4}'`
2009 Mar 23
1
Help with 'boot'
Hi, I'm wanting to test for a difference in medians between 2 groups using resampling methods. I found the boot package, but don't really understand how to write the 'statistic' function required as the 2nd argument for the bootstrap test. Thanks if you can help, Paul -- View this message in context: http://www.nabble.com/Help-with-%27boot%27-tp22653487p22653487.html Sent from
2009 May 21
2
Re order variables in a dataframe
This is no doubt a very basic question for most R users, but is there an easy way to reorder the variables (columns) in a dataframe (I can't seem to find an answer anywhere). I've generally been creating a new dataframe and selecting the new order I want from the old but this is time-consuming. Thanks, Paul -- View this message in context:
2012 Oct 26
3
summation sign
Hi all, I have a very quick question on how to use the summation sign in R for the function. Here?s a basic example: the function is sum(i=1 to 5)log(1-xi^2) Id be grateful if someone knows how to do this without writing it out 5 times - I am looking sth along the lines of the following: computeR <- function(x) { return (-sum(log(1-x^2)) }^ thank you vm in advance! -- View this
2010 Mar 24
2
Exclude data using logical
Hi, I'm wanting to exclude data more than 2 sd's from the mean before proceeding with further analyses. I've created new logical variables (a and b) and written them to the existing dataframe. I want to be able to subset the TRUE observations based on another 2 factor variable. I'm assuming this is possible, but I don't know what I'm doing wrong, as I get results that
2009 Apr 26
1
help with plotting results of lda
Hi, I've performed an lda and obtained a classification table for some of my data: > efa.dfa<-lda(groups~.,efa.scores.8,CV=T) > str(efa.dfa) List of 5 $ class : Factor w/ 2 levels "1","2": 1 2 1 2 1 1 2 2 1 2 ... $ posterior: num [1:160, 1:2] 0.99083 0.00852 0.93983 0.23186 0.85931 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:160]
2009 Jan 30
3
Q about how to use Anova.mlm
Hi, Am newish to stats and R, so I certainly appreciate any help. Basically I have 50 inidividuals whom I have 6 photos each of their optic nerve head. I want to check that the orientation of the nerve head is consistent, ie the 6 replicates show minimal or preferably no rotation differences. I'll draw an arbitrary line between some blood vessels (same reference in each set of replicates) and
2010 Mar 30
3
use logical in cor.test
Hi, I've got 4 variables that I want to effectively 'stack' so that I have a grand R variable and a grand L variable. This works to achieve that goal: Twin1cor<-with(twin.wide,cbind(ACDepthR.1,ACDepthL.1)) Twin2cor<-with(twin.wide,cbind(ACDepthR.2,ACDepthL.2)) Both<-rbind(Twin1cor,Twin2cor) > str(Both) num [1:1858, 1:2] 3.36 NA NA NA NA NA NA 3.92 3.5 NA ... - attr(*,
2010 Feb 26
3
Preserving lists in a function
Dear R users, A co-worker and I are writing a function to facilitate graph plotting in R. The function makes use of a lot of lists in its defaults. However, we discovered that R does not necessarily preserve the defaults if we were to input them in the form of list() when initializing the function. For example, if you feed the function codes below into R: myfunction=function( list1=list
2012 Jan 02
4
Create variable with AND IF statement
Hello, I'm using SPSS at work but really would like to switch to R. Right now I'm trying to learn R in reproducing calculations I did with SPSS but am stuck with something that is quite simple and comprehensible in SPSS-Syntax: IF (variable1.fac = 0 AND variable2.num = 0) variable3=1. IF (variable1.fac = 0 AND variable2.num >= 1) variable3=2. IF (variable1.fac = 1 AND variable2.num =
2009 Jul 30
3
What is the best method to produce means by categorical factors?
I am attempting to replicate some of my experience from SAS in R and assume there are best methods for using a combination of summary(), subset, and which() to produce a subset of mean values by categorical or ordinal factors. within sas I would write proc means mean data=dataset; class factor1 factor2 var variable1 variable2; RUN; producing an output with means for each variable by factor
2012 Feb 20
0
repeating or looping within an apply statement to handle multiple variables
Dear R experts, I would like to please ask for your help with repeating steps in an apply statement. I have a dataframe that lists multiple variables for a given id and visit, as well as drug treatment. > head(exp) id visit variable1 variable2 variable3 variable4 drug 1 3 1 13 10 7 11 0 2 3 5 10 15 9 9 0 3 3 12
2006 Jul 03
1
analogue of group option of SAS MIXED/random in R
Dear list, I am trying to use lme to build the analogue of the following SAS MIXED random specification: random int+Variable1+Variable2 /subject = Subject group=Condition type=vc; which gives a Condition-blocked heterogeneity in the random effects variance-covariance matrix. Needless to say, I have a hard time in specifying Condition-specific heterogeneities in the variance-covariance