[R] ivprobit what are formula1 and formula2
Dear All, Can some one explain to me what exactly is formula1 and formula2 in the ivprobit(formula1, formula2, data = list(), ...). The manual for ivprobit has quite limited information and i found it difficult to understand. Thank you very much! [[alternative HTML version deleted]] __ R-help@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.
Re: [R] mvProbit error message
sorry for the confusion. I used y1,y2, instead of the real variable names just for emailing purpose (to forward my question in a more clear way). Tree, nothing...are the real variable names in my data set and i actually used Result<-myProbit(cbind(tree,nothing)~x1+x2..,data=mydata) On Wed, Feb 24, 2016 at 10:02 AM, PIKAL Petr <petr.pi...@precheza.cz> wrote: > Hi > > > > Keep your reply to rhelp list. Others can come with better/more > appropriate solution. > > > > Pardon me, but you used > > > > Result<-mvProbit( cbind(y1,y2,y3,y4,y5) ~ x1+x2+x3+..+.x11,data=mydata) > > > > but in mydata there are variables tree and nothing (according what you did > tell us). > > > > So I am rather confused. > > > > Cheers > > Petr > > > > *From:* Betty Betty [mailto:alemines...@gmail.com] > *Sent:* Wednesday, February 24, 2016 9:55 AM > *To:* PIKAL Petr > *Subject:* Re: [R] mvProbit error message > > > > Thank you very much! > > I find the following out put > > 1. If I import the data with read.spss(use.value.lables=FALSE) > str(mydata) shows me: > > > > $ tree : atomic 1 0 1 1 1 1 0 0 1 1 ... > > ..- attr(*, "value.labels")= Named num 1 0 > > .. ..- attr(*, "names")= chr "TRUE" "FALSE" > > $ nothing: atomic 0 0 0 0 0 0 0 1 0 0 ... > > ..- attr(*, "value.labels")= Named num 1 0 > > .. ..- attr(*, "names")= chr "TRUE" "FALSE" > > . > > 2. If I import data with read.spss(use.value.lables=TRUE) > str(mydata) > > shows me: > > > > > > $ tree : Factor w/ 2 levels "FALSE","TRUE": 2 1 2 2 2 2 1 1 2 2 > ... > > $ nothing: Factor w/ 2 levels "FALSE","TRUE": 1 1 1 1 1 1 1 2 1 1 > ... > > regards > > > > On Tue, Feb 23, 2016 at 3:53 PM, PIKAL Petr <petr.pi...@precheza.cz> > wrote: > > Hi > > It shall work, I do not see any problem in the code. So you have to > persuade us that you checked your data properly e.g. by posting result of > > str(mydata) > > Cheers > Petr > > > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Betty > > Betty > > Sent: Tuesday, February 23, 2016 9:37 AM > > To: r-help@r-project.org > > Subject: [R] mvProbit error message > > > > Dear All, > > I am running the mvProbit model to estimate five equation probit > > models. In my data all the dependent variables are dichotomous with > > values 0/1 and lables TRUE/FALSE. The explanatory variables are > > composed of catagorical and countinous variables. I specified the model > > as follows > > > > Result<-mvProbit( cbind(y1,y2,y3,y4,y5) ~ > > x1+x2+x3+..+.x11,data=mydata) > > summary(Result) > > > > However, i get an error message "...Error in > > mvProbit(cbind(y1,y2,y3,y4,y5) ~:all dependent variables must be either > > 0,1,TRUE, or FALSE) > > > > I have checked all the dependent variables and it is coded 0/1 and > > lables TRUE/FALSE. > > Ofcourse there are two missing observation and I attempted to handle > > that with na.action=na.omit but even that didnt solve the problem. My > > second attempt was to tell r that the dichotomous dependent variables > > and the catagorical independent variables as factor as follows > > > > mydata$y1<-factor(mydata$y1) > > ... > > ... > > .. > > . > > mydata$x3<-factor(mydata$x3) > > But still problem not solved. How would I solve this problem? > > Thank you! > > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@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. > > > Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou > určeny pouze jeho adresátům. > Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě > neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie > vymažte ze svého systému. > Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email > jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. > Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi >
[R] mvProbit error message
Dear All, I am running the mvProbit model to estimate five equation probit models. In my data all the dependent variables are dichotomous with values 0/1 and lables TRUE/FALSE. The explanatory variables are composed of catagorical and countinous variables. I specified the model as follows Result<-mvProbit( cbind(y1,y2,y3,y4,y5) ~ x1+x2+x3+..+.x11,data=mydata) summary(Result) However, i get an error message "...Error in mvProbit(cbind(y1,y2,y3,y4,y5) ~:all dependent variables must be either 0,1,TRUE, or FALSE) I have checked all the dependent variables and it is coded 0/1 and lables TRUE/FALSE. Ofcourse there are two missing observation and I attempted to handle that with na.action=na.omit but even that didnt solve the problem. My second attempt was to tell r that the dichotomous dependent variables and the catagorical independent variables as factor as follows mydata$y1<-factor(mydata$y1) ... ... .. . mydata$x3<-factor(mydata$x3) But still problem not solved. How would I solve this problem? Thank you! [[alternative HTML version deleted]] __ R-help@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.
Re: [R] PLS-DA and LV variance with mixOmics
Hi Roberto, I need to do the same..did you manage to figure it out? Thanks. On Thursday, September 27, 2012 8:02:56 PM UTC+1, Roberto wrote: Hi all, I need to obtain the LV variance from my PLS-DA analysis. I tried to read the reference manuale of the package, but I do not found information about that. Someone know a way to do it? Thank you, Roberto -- View this message in context: http://r.789695.n4.nabble.com/PLS-DA-and-LV-variance-with-mixOmics-tp4644415.html Sent from the R help mailing list archive at Nabble.com. __ r-h...@r-project.org javascript: 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@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] seqinr-dist.alignment?
Hi everyone I have got a quick question: I the seqinr package: *dist.alignment(x,identity)* This is calculating the square root of pairwise distances. Does anyone know whether/how gaps are counted in this function? Thank you. Best wishes, Bettina [[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] sum a particular column by group
Dear all, I have a table like this: eds R.ID Region Gender Agegr Time nvisits 11 A F 60--64 1:00 1 22 OF 55--591:20 1 33 OF 55--59 3:45 3 44 SM 60--641:10 3 55 W F 55--59 12:30 1 66 W M 60--64 8:00 2 I got a bootstrap sample using the following code: r-sample(eds[,1],replace=TRUE) r [1] 2 4 3 2 6 4 beds-eds[r,] beds R.ID Region Gender Agegr Time nvisits 2 2 O F 55--59 1:20 1 4 4 S M60--64 1:10 3 3 3 O F 55--59 3:45 3 2.12 O F 55--59 1:20 1 6 6 WM 60--64 8:00 2 4.14 SM 60--64 1:10 3 I want to sum the last column by columns 2,3,and 4(including 0 in some group). I tried the following codes: #1 : only get the freq, not the sum of the last column. table-as.data.frame(with(beds,table(beds[,2],beds[,3],beds[,4]))) table Var1 Var2 Var3 Freq 1 AF 55--590 2 OF 55--593 3 SF 55--590 4 WF 55--590 5 AM 55--590 6 OM 55--590 7 SM 55--590 8 WM 55--590 9 AF 60--640 10OF 60--640 11SF 60--640 12WF 60--640 13AM 60--640 14OM 60--640 15SM 60--642 16WM 60--641 # 2: only got the sum the last column, but miss the group with 0 counts. aggregate(beds[,6],list(beds[,2],beds[,3],beds[,4]),sum) Group.1 Group.2 Group.3 x 1 O F 55--59 5 2 S M 60--64 6 3 W M 60--64 2 In conclusion, the following is what I want: Var1 Var2 Var3 Freq 1 AF 55--590 2 OF 55--595 3 SF 55--590 4 WF 55--590 5 AM 55--590 6 OM 55--590 7 SM 55--590 8 WM 55--590 9 AF 60--640 10OF 60--640 11SF 60--640 12WF 60--640 13AM 60--640 14OM 60--640 15SM 60--646 16WM 60--642 Does anyone know a code to do this or give a hint? Thank you in advance. Betty [[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] sum a particular column by group
Thanks for your help. Finally, I got it. From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Friday, February 05, 2010 12:20 PM To: Fang (Betty) Yang Cc: r-help@r-project.org Subject: Re: [R] sum a particular column by group Hi: This is not an elegant solution by any means, but it gets what you want...using the data frame from your bootstrap sample, # All combinations of the three factors xx - with(beds, expand.grid(Region = levels(Region), Gender = levels(Gender), Agegr = levels(Agegr)) ) dim(xx) [1] 12 3# differs from the 16, but bootstrapping probably explains it... # One way to get a summary (there are others...) library(plyr) yy - ddply(beds, .(Region, Gender, Agegr), summarise, Nvisits = sum(nvisits)) res - merge(xx, yy, all.x = TRUE) res - within(res, Nvisits[is.na(Nvisits)] - 0) res Region Gender Agegr Nvisits 1 O F 55--59 5 2 O F 60--64 0 3 O M 55--59 0 4 O M 60--64 0 5 S F 55--59 0 6 S F 60--64 0 7 S M 55--59 0 8 S M 60--64 6 9 W F 55--59 0 10 W F 60--64 0 11 W M 55--59 0 12 W M 60--64 2 HTH, Dennis On Fri, Feb 5, 2010 at 9:20 AM, Fang (Betty) Yang fang.y...@ualberta.ca wrote: Dear all, I have a table like this: eds R.ID Region Gender Agegr Time nvisits 11 A F 60--64 1:00 1 22 OF 55--591:20 1 33 OF 55--59 3:45 3 44 SM 60--641:10 3 55 W F 55--59 12:30 1 66 W M 60--64 8:00 2 I got a bootstrap sample using the following code: r-sample(eds[,1],replace=TRUE) r [1] 2 4 3 2 6 4 beds-eds[r,] beds R.ID Region Gender Agegr Time nvisits 2 2 O F 55--59 1:20 1 4 4 S M60--64 1:10 3 3 3 O F 55--59 3:45 3 2.12 O F 55--59 1:20 1 6 6 WM 60--64 8:00 2 4.14 SM 60--64 1:10 3 I want to sum the last column by columns 2,3,and 4(including 0 in some group). I tried the following codes: #1 : only get the freq, not the sum of the last column. table-as.data.frame(with(beds,table(beds[,2],beds[,3],beds[,4]))) table Var1 Var2 Var3 Freq 1 AF 55--590 2 OF 55--593 3 SF 55--590 4 WF 55--590 5 AM 55--590 6 OM 55--590 7 SM 55--590 8 WM 55--590 9 AF 60--640 10OF 60--640 11SF 60--640 12WF 60--640 13AM 60--640 14OM 60--640 15SM 60--642 16WM 60--641 # 2: only got the sum the last column, but miss the group with 0 counts. aggregate(beds[,6],list(beds[,2],beds[,3],beds[,4]),sum) Group.1 Group.2 Group.3 x 1 O F 55--59 5 2 S M 60--64 6 3 W M 60--64 2 In conclusion, the following is what I want: Var1 Var2 Var3 Freq 1 AF 55--590 2 OF 55--595 3 SF 55--590 4 WF 55--590 5 AM 55--590 6 OM 55--590 7 SM 55--590 8 WM 55--590 9 AF 60--640 10OF 60--640 11SF 60--640 12WF 60--640 13AM 60--640 14OM 60--640 15SM 60--646 16WM 60--642 Does anyone know a code to do this or give a hint? Thank you in advance. Betty [[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. [[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] keep empty subsets using aggregate
Dear all, I am struggling with a small problem. By using aggregate, the empty subsets are removed. I need each empty subset to be 0. Any suggestions will be appreciated. Code: edref = aggregate(rep(1,times=dim(eds)[1]),list(eds[,11], eds[,7], eds[,27]), sum) Thanks in advance, Betty [[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] problems with read.csv
Dear all, I'd like to ask help on R code to get the same results as the following Splus code: indata-importData(/home/data_new.csv) indata[1:5,4] [1] 0930 1601 1006 1032 1020 I tried the following R code: indata-read.csv(/home/data_new.csv) indata[1:5,4] [1] 930 1601 1006 1032 1020 I'd like the first one to be 0930, too. Thanks in advance, Betty [[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] extract day or month as in Splus
Dear all, I am writing to ask for help to find R code to do the same thing as the following Splus code: dates - c(02/27/1992, 02/27/1992, 01/14/1992, 02/28/1992, 02/01/1992) timeDate(as.character(dates),in.format=%m/%d/%Y,%a) [1] Thu Thu Tue Fri Sat Could anyone give me some R codes to get the same results as above(extract days from dates), please? Thanks in advance! Betty [[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] problems with ace (ape-package)
Hi everyone I am trying to reconstruct ancestral character states with R. I used the ace function of the package ape. I have discrete characters and tried to use the ER and ARD model. The problem is, that I get negative lik$anc values. Does anybody by chance have an idea what might be wrong? Thanks in advance [[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.