Try the EEV model with 3 clusters where temp is the large dataset: Mclust(temp, 3, modelNames = "EEV")
On Tue, Feb 2, 2016 at 8:13 AM, PIKAL Petr <petr.pi...@precheza.cz> wrote: > Hi > > Thanks, it work for my example, which is actually a subset of a bigger data > (4000 rows) with the same characteristics. For the whole problem it does not > give correct clustering. I tried to set G to 3 but it did not help either. > > I attached the whole dataset (dput) that you can use, however after quick > tour through Mclust it seems to me that it is designed for slightly different > problem. > > Here is the result with whole data. > > fm <- Mclust(temp) > g <- fm$classification > plot(1/temp[,1], temp[,2], pch = g, col = g) > > I will go through the docs more thoroughly, to be 100% sure I did not miss > anything. > > Cheers > Petr > > >> -----Original Message----- >> From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] >> Sent: Tuesday, February 02, 2016 1:20 PM >> To: PIKAL Petr >> Cc: R Help R >> Subject: Re: [R] fancy linear model and grouping >> >> Try the mclust package: >> >> library(mclust) >> temp.na <- na.omit(temp) >> fm <- Mclust(temp.na) >> g <- fm$classification >> plot(temp.na, pch = g, col = g) >> >> >> >> On Tue, Feb 2, 2016 at 6:35 AM, PIKAL Petr <petr.pi...@precheza.cz> >> wrote: >> > Dear all >> > >> > I have data like this >> > >> >> dput(temp) >> > >> > temp <- structure(list(X1 = c(93, 82, NA, 93, 93, 79, 79, 93, 93, 85, >> > 82, 93, 87, 93, 92, NA, 87, 93, 93, 93, 74, 77, 87, 93, 82, 87, 75, >> > 82, 93, 92, 68, 93, 93, 73, NA, 85, 81, 79, 75, 87, 93, NA, 87, 87, >> > 85, 92, 87, 92, 93, 87, 87, NA, 69, 87, 93, 87, 93, 87, 82, 79, 87, >> > 93, 87, 80, 87, 87, 87, 92, 93, 69, 76, 87, 82, 93, 82, NA, 54, 87, >> > 77, 73, 93, 82, 73, 93, 92, 82, 77, 93, 87, 75, 87, 87, 87, 60, 92, >> > 87, 87, NA, 77, 78), X2 = c(224, 624, NA, 224, 224, 642, 642, 224, >> > 224, 599, 622, 224, 239, 224, 225, NA, 239, 224, 224, 224, 688, 657, >> > 239, 224, 624, 239, 672, 254, 224, 225, 499, 224, 224, 692, NA, 599, >> > 627, 642, 677, 239, 224, NA, 239, 239, NA, 375, 239, 375, 224, 239, >> > 239, NA, 299, 239, 224, 239, 224, 239, 621, 642, 239, 224, 239, 638, >> > 239, 239, 239, 225, 224, 299, 672, 239, 618, 224, 620, NA, 626, 239, >> > 657, 693, 224, 624, 693, 224, 225, 621, 657, 224, 239, 673, 239, 239, >> > 239, 569, 224, 239, 239, NA, 657, 651)), .Names = c("X1", "X2"), >> > row.names = c(NA, -100L), class = "data.frame") >> >> >> > >> > You can see there are 3 distinct linear relationships of those 2 >> variables. >> > >> > plot(1/temp[,1], temp[,2]) >> > >> > Is there any simple way how to evaluate such data without grouping >> variable? I know that in case I have proper grouping variable I can >> evaluate it with lme and get intercepts and/or slopes. >> > >> > My question is: >> > >> > Does anybody know about a way/package/function which can give me >> appropriate grouping of such data or which can give me separate >> slope/intercept for each set. >> > >> > I hope I expressed my problem clearly. >> > >> > Best regards >> > Petr >> > >> > > > ________________________________ > 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 či > zpožděním přenosu e-mailu. > > V případě, že je tento e-mail součástí obchodního jednání: > - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, > a to z jakéhokoliv důvodu i bez uvedení důvodu. > - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; > Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany > příjemce s dodatkem či odchylkou. > - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným > dosažením shody na všech jejích náležitostech. > - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost > žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně > pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu > případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je > adresátovi či osobě jím zastoupené známá. > > This e-mail and any documents attached to it may be confidential and are > intended only for its intended recipients. > If you received this e-mail by mistake, please immediately inform its sender. > Delete the contents of this e-mail with all attachments and its copies from > your system. > If you are not the intended recipient of this e-mail, you are not authorized > to use, disseminate, copy or disclose this e-mail in any manner. > The sender of this e-mail shall not be liable for any possible damage caused > by modifications of the e-mail or by delay with transfer of the email. > > In case that this e-mail forms part of business dealings: > - the sender reserves the right to end negotiations about entering into a > contract in any time, for any reason, and without stating any reasoning. > - if the e-mail contains an offer, the recipient is entitled to immediately > accept such offer; The sender of this e-mail (offer) excludes any acceptance > of the offer on the part of the recipient containing any amendment or > variation. > - the sender insists on that the respective contract is concluded only upon > an express mutual agreement on all its aspects. > - the sender of this e-mail informs that he/she is not authorized to enter > into any contracts on behalf of the company except for cases in which he/she > is expressly authorized to do so in writing, and such authorization or power > of attorney is submitted to the recipient or the person represented by the > recipient, or the existence of such authorization is known to the recipient > of the person represented by the recipient. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.