Klaus Nordhausen
2009-Jul-28 16:58 UTC
[Rd] How to use formulas for multivariate clustered data?
Dear R experts, I wrote already a couple of weeks ago but did not get any reply. Therefore I'll rephrase my question and hope some of you can give me some answers or some advice where better to look for an answer. In general I'm looking for information on how to program functions using formulas in order to write a nonparametric multivariate regression function with possible clustering of the data. I would assume that the formulas for my function would have the form y1 + y2 + y3 ~ x | z or Y ~ x | z, where y1, y2 and y3 are continuous response variables, or Y the matrix of responses and x an explaining variable and z a factor indicating the cluster membership. I'm looking for general information about writing functions using formulas. But more concrete I would need to know what would be the best way to make sure that the response should be multivariate and numeric? What is the best way to define the hierarchical structure, is it the "|" or is there another, better way? How can I restrict the number of hierarchical levels? And how to use in this context, the data, subset, weights and na.action arguments? Thanks in advance, Klaus -- Klaus Nordhausen Researcher Tampere School of Public Health FIN-33014 University of Tampere phone: +358 3 3551 4153 fax: +358 3 3551 4150 e-mail: Klaus.Nordhausen at uta.fi
Gabor Grothendieck
2009-Jul-28 17:16 UTC
[Rd] How to use formulas for multivariate clustered data?
Have a look at the source code for the Formula package. On Tue, Jul 28, 2009 at 12:58 PM, Klaus Nordhausen<Klaus.Nordhausen at uta.fi> wrote:> Dear R experts, > > I wrote already a couple of weeks ago but did not get any reply. Therefore > I'll rephrase my question and hope some of you can give me some answers or > some advice where better to look for an answer. > > In general I'm looking for information on how to program functions using > formulas in order to write a nonparametric multivariate regression function > with possible clustering of the data. > > I would assume that the formulas for my function would have the form > y1 + y2 + y3 ~ x | z > or > Y ~ x | z, > > where y1, y2 and y3 are continuous response variables, or Y the matrix of > responses and x an explaining variable and z a factor indicating the cluster > membership. > > I'm looking for general information about writing functions using formulas. > But more concrete I would need to know what would be the best way to make > sure that the response should be multivariate and numeric? What is the best > way to define the hierarchical structure, is it the "|" or is there another, > better way? How can I restrict the number of hierarchical levels? > And how to use in this context, the data, subset, weights and na.action > arguments? > > Thanks in advance, > > Klaus > > -- > Klaus Nordhausen > Researcher > Tampere School of Public Health > FIN-33014 University of Tampere > > phone: ?+358 3 3551 4153 > fax: ? ?+358 3 3551 4150 > e-mail: Klaus.Nordhausen at uta.fi > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Achim Zeileis
2009-Jul-28 17:23 UTC
[Rd] How to use formulas for multivariate clustered data?
Klaus:> I wrote already a couple of weeks ago but did not get any reply. Therefore > I'll rephrase my question and hope some of you can give me some answers or > some advice where better to look for an answer. > > In general I'm looking for information on how to program functions using > formulas in order to write a nonparametric multivariate regression function > with possible clustering of the data. > > I would assume that the formulas for my function would have the form > y1 + y2 + y3 ~ x | z > or > Y ~ x | z, > > where y1, y2 and y3 are continuous response variables, or Y the matrix of > responses and x an explaining variable and z a factor indicating the cluster > membership. > > I'm looking for general information about writing functions using formulas. > But more concrete I would need to know what would be the best way to make > sure that the response should be multivariate and numeric? What is the best > way to define the hierarchical structure, is it the "|" or is there another, > better way? How can I restrict the number of hierarchical levels? > And how to use in this context, the data, subset, weights and na.action > arguments?The CRAN package "Formula" has some functionality which might assist you in what you want to do. It provides several tools for extracting information from formulas like Y ~ x1 + x2 | z The version on R-Forge also has some tools for y1 + y2 + y3 ~ x1 + x2 | z1 | z2 + z3 etc. But the version on R-Forge is not yet quite stable, however, we hope to get something new to CRAN over the summer. The package just assists you with accessing the different parts of the formula. All the checking of types, dimensions, etc. you have to do yourself. I hope it solves some of your problems, though... hth, Z> Thanks in advance, > > Klaus > > -- > Klaus Nordhausen > Researcher > Tampere School of Public Health > FIN-33014 University of Tampere > > phone: +358 3 3551 4153 > fax: +358 3 3551 4150 > e-mail: Klaus.Nordhausen at uta.fi > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >