[R] things that are difficult/impossible to do in SAS or SPSS but simple in R

Roland Rau roland.rproject at gmail.com
Tue Jan 15 22:26:26 CET 2008


Hi,

maybe I missed something while using SAS or SPSS. So please make sure 
that I am not talking nonsense here.

- How would you re-use results in SPSS or SAS? If it is possible for SAS 
and SPSS, I am fairly sure it is not as easy as in R:
lmmodel1 <- lm(Y~X)
myslope <- coef(lmmodel1)[2]
- You have population and death data on the individual level classified 
by year, age, sex, and country. Now you want to calculate the 
probability of dying by year, age, sex, and country.
In R, i would do:
pop.array <- tapply(X=popdata$Count,
			INDEX=list(Age=popdata$Age,
				Year=popdata$Year,
				Sex=popdata$Sex,
				Country=popdata$Country),
			FUN=sum)
dth.array <- tapply(X=dthdata$Count,
			INDEX=list(Age=dthdata$Age,
				Year=dthdata$Year,
				Sex=dthdata$Sex,
				Country=dthdata$Country),
			FUN=sum)
prop.dying.array <- dth.array / pop.array

Now you can easily extract a vector of the probability of dying of 85 
year-old men dying in the first year of observation in all countries by 
writing:
prop.dying.array[86,1,1,]
- I hope I am wrong on this one. But when I was using SPSS, I could not 
find any possibility to include left truncated data in survival 
analysis. Maybe I did not find this possibility or maybe it has been 
included since.
- The function outer()
- Data are not always rectangular data frames.


Those are just a few thoughts which came to my mind.
I hope this helps,
Roland

				

Matthew Keller wrote:
> Hi all,
> 
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
> 
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
> 
> Best,
> 
> Matt
>




More information about the R-help mailing list