Package cwm. R topics documented: February 19, 2015

Similar documents
Package FisherEM. February 19, 2015

Package sensory. R topics documented: February 23, Type Package

Package flexcwm. May 20, 2018

Package rpst. June 6, 2017

Package longclust. March 18, 2018

Package hsiccca. February 20, 2015

Package PrivateLR. March 20, 2018

Package intccr. September 12, 2017

Package ICsurv. February 19, 2015

Package mrm. December 27, 2016

Package cgh. R topics documented: February 19, 2015

Package Rambo. February 19, 2015

Package glmmml. R topics documented: March 25, Encoding UTF-8 Version Date Title Generalized Linear Models with Clustering

Package gppm. July 5, 2018

Package clusternomics

Package FMsmsnReg. March 30, 2016

Package mtsdi. January 23, 2018

Package hiernet. March 18, 2018

Package SeleMix. R topics documented: November 22, 2016

Package RPMM. September 14, 2014

Package PTE. October 10, 2017

Package mwa. R topics documented: February 24, Type Package

Package SAM. March 12, 2019

Package GLDreg. February 28, 2017

Package ridge. R topics documented: February 15, Title Ridge Regression with automatic selection of the penalty parameter. Version 2.

Package ssmn. R topics documented: August 9, Type Package. Title Skew Scale Mixtures of Normal Distributions. Version 1.1.

Package ICEbox. July 13, 2017

Package glassomix. May 30, 2013

Package RPMM. August 10, 2010

Package optimus. March 24, 2017

Expectation Maximization (EM) and Gaussian Mixture Models

Package robustfa. February 15, 2013

Package robustreg. R topics documented: April 27, Version Date Title Robust Regression Functions

Package mnlogit. November 8, 2016

Package rfsa. R topics documented: January 10, Type Package

Package permuco. February 14, Type Package

Package gibbs.met. February 19, 2015

Package FWDselect. December 19, 2015

Package marqlevalg. February 20, 2015

Package edrgraphicaltools

Package AnDE. R topics documented: February 19, 2015

Package naivebayes. R topics documented: January 3, Type Package. Title High Performance Implementation of the Naive Bayes Algorithm

Package DRaWR. February 5, 2016

Package glinternet. June 15, 2018

Package survivalmpl. December 11, 2017

Package r.jive. R topics documented: April 12, Type Package

Package PedCNV. February 19, 2015

Package sparsereg. R topics documented: March 10, Type Package

Package robustfa. February 20, 2015

Package penalizedlda

Package esabcv. May 29, 2015

Package CepLDA. January 18, 2016

Package rknn. June 9, 2015

Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Package mixphm. July 23, 2015

Clustering Lecture 5: Mixture Model

Package hmeasure. February 20, 2015

Package ConvergenceClubs

Package cosinor. February 19, 2015

Package manet. September 19, 2017

Package svalues. July 15, 2018

Package CausalImpact

Package SSLASSO. August 28, 2018

Package StVAR. February 11, 2017

Package datasets.load

Package maboost. R topics documented: February 20, 2015

Package listdtr. November 29, 2016

Package svapls. February 20, 2015

Package msda. February 20, 2015

Package tclust. May 24, 2018

Package SmoothHazard

Package palmtree. January 16, 2018

Package approximator

Package MSwM. R topics documented: February 19, Type Package Title Fitting Markov Switching Models Version 1.

Package pnmtrem. February 20, Index 9

Package lga. R topics documented: February 20, 2015

Package abe. October 30, 2017

Package mgc. April 13, 2018

Package CVR. March 22, 2017

Package RAMP. May 25, 2017

Package JGEE. November 18, 2015

Package subtype. February 20, 2015

Package lvm4net. R topics documented: August 29, Title Latent Variable Models for Networks

Package GWRM. R topics documented: July 31, Type Package

Package flam. April 6, 2018

Package gee. June 29, 2015

Package Funclustering

Package clustvarsel. April 9, 2018

Package UPMASK. April 3, 2017

Package glmnetutils. August 1, 2017

Package mcemglm. November 29, 2015

Package RCA. R topics documented: February 29, 2016

Package clustmd. May 8, 2017

Package dglm. August 24, 2016

Package orthodr. R topics documented: March 26, Type Package

Package acebayes. R topics documented: November 21, Type Package

Package quickreg. R topics documented:

Package DSBayes. February 19, 2015

Package vbmp. March 3, 2018

Package sspline. R topics documented: February 20, 2015

Transcription:

Package cwm February 19, 2015 Type Package Title Cluster Weighted Models by EM algorithm Version 0.0.3 Date 2013-03-26 Author Giorgio Spedicato, Simona C. Minotti Depends R (>= 2.14), MASS Imports methods, stats, matlab, permute Maintainer Giorgio Spedicato <spedicato_giorgio@yahoo.it> This package estimates gaussian cluster weighted linear regressions by EM algorithm. License GPL (>= 2) NeedsCompilation no Repository CRAN Date/Publication 2014-01-09 07:26:17 R topics documented: cwm-package........................................ 2 bestpermutation....................................... 2 betaplasma......................................... 4 cwrem............................................ 5 loglik.cwrobj........................................ 7 plot.cwrobj......................................... 8 predict.cwrobj....................................... 9 print.cwrobj......................................... 10 stepcwr........................................... 11 summary.cwrobj...................................... 12 Index 14 1

2 bestpermutation cwm-package The package performs cluster weighed modelling assuming normal distribution It is a R porting of Original Code from Murphy Package: cwm Type: Package Version: 0.0.1 Date: 2013-03-17 License: GPL Giorgio A. Spedicato Murphy library(mass) data(geyser) cwmexample=cwrem(x,y,nc=2) print(cwmexample) bestpermutation Function to obtain the best permutation for a classification problem When a classificator is run on a set of 1,2,..., k groups it returns a possibile classification schemes, but it does not know the correspondence of original gruoups and given groups. This function return the permutation of original group versus output group that maximizes the trace of the confusion matrix.

bestpermutation 3 bestpermutation(origclass, inizoutput) origclass inizoutput original group identification vector classified group identification vector Program fails if number of original groups differs from identified groups as in inizoutput. An object of class bestpermutation containing: permutation groups Best permutation Classification with respect to best permutation Note Shall be improved Giorgio Spedicato Giorgio Spedicato cwrem #non sense example x=c(1,2,3) y=c(1,2,3) bestpermutation(x,y)

4 betaplasma betaplasma Betaplasma dataset Format Source Example dataset data(betaplasma) A data frame with 315 observations on the following 15 variables. id a numeric vector age a numeric vector sex a factor with levels F M smokestat a factor with levels Never Former Current bmi a numeric vector vituse a factor with levels Often Not often No calories a numeric vector fat a numeric vector fiber a numeric vector alcohol a numeric vector chol a numeric vector betadiet a numeric vector retdiet a numeric vector betacaro a numeric vector retplasma a numeric vector Unknown Unknown unknown data(betaplasma)

cwrem 5 cwrem Function to estimate Cluster Weighted Regression (CWR) models This function estimates CWR models via EM algoritms. An object of class cwrobj is returned containing posterior probabilities and group parameters. cwrem(x, Y, nc, max_iter = 1000, thresh = 0.01, cov_typex = "full", cov_typey = "full", clamp_weights = FALSE, create_init_params = TRUE, cwrstart = NULL, cov_priorx = NULL, cov_priory = NULL, verbose = TRUE, regress = TRUE, clamp_covx = FALSE, clamp_covy = FALSE) X Y nc X data matrix Y data matrix Number of clusters max_iter Max iterations. Default 1000 thresh threshold to assess numerical convergence. Default 0.01 cov_typex cov_typey clamp_weights Type of covariance of groups in X space. May be: "full" (default), "spherical", "diagonal" Type of covariance of groups in Y space. May be: "full" (default), "spherical", "diagonal" Fixed weights create_init_params Creates initial parameters cwrstart cov_priorx cov_priory verbose regress clamp_covx clamp_covy cwrobj to initialize. If autostart -> NULL Prior X covariance if not autostart. See cov_typex Prior Y covariance if not autostart. See cov_typey Prints details of estimation process Regression model. Default TRUE Fixed covx matrix. Fixed covy matrix. This is the main function to estimate CWR models

6 cwrem A CWR object with the following component: mux muy aic X Y SigmaY SigmaX weightsy Means matrix of X component Means matrix of X component AIC of model X matrix Y matrix Array containing Y Variances Array containing X Variances Matrix containing posterior probabilities Warning Estimation can be slow. Convergence is not guaranteeted. Note This is the main function. X and Y may be vectors or matrices. cwrobj objects containing parameters and posterior probabilities are returned. Giorgio Spedicato Murphy stepcwr ##using Geyser dataset from package MASS library(mass) data(geyser) cwremexample=cwrem(x,y,nc=2) print(cwremexample)

loglik.cwrobj 7 loglik.cwrobj Generic log - likelihood method for cwrobjects This function extracts the loglikelihood. ## S3 method for class cwrobj loglik(object,...) object A cwrobj... Additional data (not yet implemented) In the future this function will perform log-likelihood calculation directly. A numeric value Giorgio A. Spedicato Murphy cwrem ## Not run: library(mass) data(geyser, package="mass") ciao=stepcwr(x,y,nc=2) loglik(ciao) ## End(Not run)

8 plot.cwrobj plot.cwrobj S3 generic method for CWR objects Generic S3 plot method for CWR objects. It only works when data dimension is R2. ## S3 method for class cwrobj plot(x,...) x CWR object to plot... Optional argument passed to plot method. Use of dots implemented yet. Only if data dimension lies in R2 it works. No value is returned. Note S3 method. Giorgio Spedicato Murphy cwrem

predict.cwrobj 9 ## Not run: data(geyser, package="mass") ciao=cwrem(x,y,nc=2) plot(ciao) ## End(Not run) predict.cwrobj S3 predict method for cwrobj Method to return predicted group membership ## S3 method for class cwrobj predict(object,...) object A cwr obj... additional parameters Get the max coulmn index of the matrix A numeric vector Giorgio A. Spedicato Murphy cwrem

10 print.cwrobj data(geyser) ciao=cwrem(x,y,nc=2) predict(ciao) print.cwrobj S3 print method for CWR objects This method prints estimation summary values. ## S3 method for class cwrobj print(x,...) x CWR object to be printed... Further arguments. Not implemented yet. This is a short summary. This method returns no value. Note S3 method. Giorgio Spedicato Murphy cwrem,plot.cwrobj

stepcwr 11 data(geyser) ciao=cwrem(x,y,nc=2) print(ciao) stepcwr Function to estimate CWR models via multiple EM algorithm restarts This function iteratens niter times a single estimation of CWR models by cwrem function. Then the one that has best loglikelihood is chosen. stepcwr(x, Y, nc, prop = 0.1, niter = 10, changetrainingset = FALSE) X Y nc Note X data vector Y data vector number of clusters. prop Proportion of samples. Default 0.1. niter Number of iteration. Default 10. changetrainingset Boolean. If TRUE the training set is changed. This function allows the estimation of models where the structure of the data set lies to probable convergence problems. A cwr object. Uses try. Giorgio Spedicato

12 summary.cwrobj Murphy, Bettina. cwrem data(geyser) ciao=stepcwr(x,y,nc=2) summary.cwrobj Generic summary S3 method for CWR object. This function prints out a detailed summary of CWR object. ## S3 method for class cwrobj summary(object,...) Note object cwrobj... Further arguments to be passed. Not implemented yet This function expands output from summary method. This function returns no value. Will be converted in S4 method. Giorgio Spedicato

summary.cwrobj 13 Murphy cwrem, print.cwrobj, plot.cwrobj data(geyser) ciao=cwrem(x,y,nc=2) summary(ciao)

Index Topic datasets betaplasma, 4 Topic methods bestpermutation, 2 cwrem, 5 loglik.cwrobj, 7 plot.cwrobj, 8 predict.cwrobj, 9 print.cwrobj, 10 stepcwr, 11 summary.cwrobj, 12 Topic package cwm-package, 2 bestpermutation, 2 betaplasma, 4 cwm (cwm-package), 2 cwm-package, 2 cwrem, 3, 5, 7 10, 12, 13 loglik.cwrobj, 7 plot.cwrobj, 8, 10, 13 predict.cwrobj, 9 print.cwrobj, 10, 13 stepcwr, 6, 11 summary.cwrobj, 12 14