Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Translating an R expression (diff <- pchisq(d, p) - (0.5:n)/n) into Stata code


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Translating an R expression (diff <- pchisq(d, p) - (0.5:n)/n) into Stata code
Date   Sat, 30 May 2009 10:31:44 +0200

<>

Here is an attempt to translate your code. What is "d", btw?

***
clear*

local d 4

//# of rows
set obs 100
//# of columns set to 3
gen x=.
gen y=.
gen z=.

forv i=0.05(0.1)`=c(N)/10'{
di chi2(`d', c(k))-`i'
}
***


HTH
Martin
_______________________
----- Original Message ----- From: "Ben Dwamena" <bdwamena@med.umich.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Saturday, May 30, 2009 8:28 AM
Subject: st: Translating an R expression (diff <- pchisq(d, p) - (0.5:n)/n) into Stata code


Dear Listers with R experience,

What is an equivalent Stata code for the following R expression:

diff <- pchisq(d, p) -  (0.5:n)/n

where  x is dataset (n x p)
n is number of rows of x
p is number of columns of x

Thanks,
Ben

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index