[R] Linear Trend Analysis?

Tim F Liao tfliao at uiuc.edu
Wed Jan 26 22:39:04 CET 2005


Chris,

While there might be certain functions in R that I'm not aware
of for such purposes, anything (well, almost) can be done in R
if you're willing to write a line or two of code, and that's
the beauty of R.  In a course I recently taught, I used the
following code to generate individual data from grouped data,
which would give the same results as using fweight=count in Stata.

Ind.Data<-data.frame(cbind(rep(Y,freq),rep(X1,freq),rep(X2,freq)))

where Y is the dependent variables and X1 and X2 are two
explanatory variables and freq is your count variable.

Hope this helps,

Tim F Liao
Professor of Sociology & Statistics
University of Illinois
Urbana, IL 61801

---- Original message ----
>Date: Wed, 26 Jan 2005 12:54:11 -0600
>From: "Chris Bergstresser" <chris at subtlety.com>  
>Subject: [R] Linear Trend Analysis?  
>To: <R-help at stat.math.ethz.ch>
>
>Hi all --
>
>   I'm trying to use R for my "Analysis of Categorical Data"
class, but I
>can't figure out how to do a weighted linear trend analysis.
 I have a table
>of categorical data, to which I've assigned weights to the
rows and columns.
>I need to calculate r and M^2, which is apparently done in
SAS using "PROC
>FREQ" and in STATA using "correlate var1 var2 fw=count". 
What's the command
>for R?
>
>-- Chris
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list