[R] lme in R and Splus-7

2007-02-05 Thread yyan liu
Hi:
  I used the function lme in R and Splus-7. With the same dataset and same 
argument for the function, I got quite different estimation results from these 
two software. Anyone has this experience before?

zhong

 
-
 Get your own web address.

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] question about the solve function in library Matrix

2006-11-22 Thread yyan liu
Hi:
I have some problems when I use the function solve function in a loop. In 
the following code, I have a diagonal martix ttt whose  elements change in 
every iteration in a loop. I defined a dpoMatrixclass  before the loop so I 
do not need to define this class every time in the loop. The reason is to save 
some computing time. The code is below. The inverse of the matrix ttt
 should change according to the change of ttt in the loop. However, the 
values in sigma.dpo.solve, which is the inverse of ttt does not change.  
Can anybody figure out what is wrong with my code? Thanks a lot in advance!
 
 liu 
 
 library(Matrix)
 ttt-diag(1,2)
 sigma.dpo-as(ttt, dpoMatrix)
 for(i in 1:5)
   { ttt-diag(i,2)
 [EMAIL PROTECTED]-as.vector(ttt)
 sigma.dpo.solve-solve(sigma.dpo)
 print(-)
 print(sigma.dpo)
 print(sigma.dpo.solve)
   }
 ##
 
 

-

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] question about function gls in library nlme

2006-11-05 Thread yyan liu
Hi:
   The gls function I used in my code is the following
   fm-gls(y~x,correlation=corARMA(p=2) )
  My question is how to extact the AR(2) parameters from fm.
  The object fm is the following.  How can I extract the correlation 
parameters 
 Phi1 and Phi2 from fm? These two parametrs is not in the coef componenet  
of fm.
 Thanks a lot!
 
 liu
 
--
  fm
 Generalized least squares fit by REML
   Model: y ~ x 
   Data: NULL 
   Log-restricted-likelihood: -1634.588
 
 Coefficients:
 (Intercept)   x 
  16.0728672   0.2917921 
 
 Correlation Structure: ARMA(2,0)
  Formula: ~1 
  Parameter estimate(s):
   Phi1   Phi2 
  1.3368230 -0.4539957 
 Degrees of freedom: 480 total; 478 residual
 Residual standard error: 20.80244 
 
--
 

-

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] polynomial expansion in R

2006-06-30 Thread yyan liu
Hi:
   I have two vectors of data, x and y and I want to get the polynomial 
expansion of (x+y)^p with any integer power p in R. Suppose p=2, then I want a 
matrix of five vectors, namely, x y x^2 y^2 x*y. The coefficient of the 
polynomial is not needed. I can write it manully if p is small. But I want it 
in the case of p=10 or even bigger, is there any function in R can do that 
automatically for me with certain choice of p?
   Thx a lot!
 
 liu
 

-


[[alternative HTML version deleted]]

__
R-help@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


[R] bivariate case in Local Polynomials regression

2006-03-28 Thread yyan liu
Hi:
I am using the package KernSmooth to do the local polynomial regression. 
However, it seems the function locpoly can only deal with univariate 
covaraite. I wonder is there any kernel smoothing package in R can deal with 
bivariate covariates? I also checked the package lcofit in which function 
lcofit can indeed deal with bivariate case. The code below is an example from 
the its help document I found on http://www.locfit.info  However, first, it is 
a local regression method. I am not sure how to specify the degree of the 
regression model. second, i dont know what are scale and alpha. Are they 
associated with the bandwidth? 
   Thanks very much!
 
  
 
data(ethanol)
 
# a bivariate local regression with smaller smoothing parameter
fit - locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5)
plot(fit)
 

-

[[alternative HTML version deleted]]

__
R-help@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


[R] bivariate case in Local Polynomials regression

2006-03-28 Thread yyan liu
Hi:
I am using the package KernSmooth to do the local polynomial regression. 
However, it seems the function locpoly can only deal with univariate 
covaraite. I wonder is there any kernel smoothing package in R can deal with 
bivariate covariates? I also checked the package lcofit in which function 
lcofit can indeed deal with bivariate case. The code below is an example from 
the its help document I found on http://www.locfit.info  However, first, it is 
a local regression method. I am not sure how to specify the degree of the 
regression model. second, i dont know what are scale and alpha. Are they 
associated with the bandwidth? 
   Thanks very much!
 
  
 
data(ethanol)
 
# a bivariate local regression with smaller smoothing parameter
fit - locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5)
plot(fit)
 

-

[[alternative HTML version deleted]]

__
R-help@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


[R] include C functions from nmath in my own C functions

2005-08-11 Thread yyan liu
Hi:
  I followed the README in src/nmath/standalone/
to make the use the command make shared to make the
libRmath.so file. I also add the directories containg
libRmath.so to  LD_LIBRARY_PATH by using command 
export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon
e

However, when I try to run the following codes. 
/***/
#define MATHLIB_STANDALONE 1
#include Rmath.h

int
main()
{
/* something to force the library to be included */
qnorm(0.7, 0.0, 1.0, 0, 0); 
return 0;
}
/**/

It gives me the following error message. It seems
definitions of some R functions can not be found in
the libRmath.so file. Anyone has any idea about this
problem? Thank you very much!


/usr/local/lib/libRmath.so: undefined reference to
`expm1'
/usr/local/lib/libRmath.so: undefined reference to
`log'
/usr/local/lib/libRmath.so: undefined reference to
`sqrt'
/usr/local/lib/libRmath.so: undefined reference to
`rint'
/usr/local/lib/libRmath.so: undefined reference to
`cos'
/usr/local/lib/libRmath.so: undefined reference to
`sin'
/usr/local/lib/libRmath.so: undefined reference to
`pow'
/usr/local/lib/libRmath.so: undefined reference to
`sinh'
/usr/local/lib/libRmath.so: undefined reference to
`log10'
/usr/local/lib/libRmath.so: undefined reference to
`exp'
/usr/local/lib/libRmath.so: undefined reference to
`tan'
/usr/local/lib/libRmath.so: undefined reference to
`log1p'
/usr/local/lib/libRmath.so: undefined reference to
`hypot'
collect2: ld returned 1 exit status

__
R-help@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


[R] time series regression

2005-07-08 Thread yyan liu
Hi:
  I have two time series y(t) and x(t). I want to
regress Y on X. Because Y is a time series and may
have autocorrelation such as AR(p), so it is not
efficient to use OLS directly. The model I am trying
to fit is like
Y(t)=beta0+beta1*X(t)+rho*Y(t-1)+e(t)

e(t) is iid normal random error. Anybody know whether
there is a function in R can fit such models? The
function can also let me specify how many beta's and
rho's I can have in the model. 

Thx a lot!

liu

__
R-help@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


[R] spurious regression in R

2005-07-07 Thread yyan liu
Hi:
 I am trying to do a spurious regression in R but I
can not find the function. Anybody used it before? The
problem I have is try to do a regression with several
time series. An alternative is to use the GLS function
to fit the linear regression with the correlation
structure AR(3) for the response (or residual). I hope
the residuals after the GLS regression will be
independent judged by Box-Ljung test. However, I dont
know how the residuals are defined in the GLS
function. Is it just y-yhat or y-yhat times the
(covariance matrix)^(-1/2). Because y-yhat still has
the AR(3) covariance structure and surely be rejected
by the Box-Ljung test. The latter will be independent
if the assumption of AR(3) correlation structure is
right. Any suggestion are highly appreciated. 
Thx!

__
R-help@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


[R] question about boxplot axis

2005-07-04 Thread yyan liu
Hi:
  I have a question making side by side boxplot. 
  My response is numeric and I want to make a side by
side boxplot of it accroding to a factor vector. So,
there are several boxplots on the same plot. Each
boxplot is with respect to one level for a factor. The
levels of
the factor are some characters. When I make the plot,
the boxplots are arranged according to the alphabetic
order of the levels. My question is that how I can
change the order the boxplots are arranged. For
example, 
 
   fac-c(a,b,c,d)
   boxplot(time.vec~fac,xlab=Events,ylab=Time In
Days,col=yellow)

Then the boxplots are arranged in the order of
a,b,c,d. But for some reason, I want it to be
c,a,d,b. Any suggestion about this question?

thx a lot!

liu zhong

__
R-help@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


[R] images and maps in R

2005-05-27 Thread yyan liu
Hi:
  I have a question arising from my project. 
  A sample of the data is below. The first row stands
for the names of state in USA. The second row stand
for some numeric value in that state. Some of them are
NA. I can use the commands data(stateMapEnv) and
map('state', fill = F) in library maps to make a
plot of USA states. What I want to do is: 1. put the
corresponding state name on the Map 2. give different
state different colors which is related to their
value. For example, red for values ranging from
0-30, green for values from 80-90, etc. 3. if
possible, put the value of each state within the state
on the map. here, take the numeric value as some text.

Thank you very much!

AB  AK  AL  AR  AZ  CT   CA
91  80  NA  NA  17  33   20

__
R-help@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


[R] Confirmatory Factor Analysis in Non-Normal case

2005-03-22 Thread yyan liu
Hi:
  I am doing a confirmatory factor analysis now. In
the analysis, I have null hypothesis test which
specify some special structure for the loading matrix.
And the alternative is there is no such special
structure. Then the log likelihood ratio test can be
used. The problem I have is my data comes from a
questionnaire and all the variables are discrete from
1 to 7, which makes the normality assumption a
problem. I wonder if there is any other test can do
this job or at least I can make some sensible
transformation to make the variables normal?
  Thank you very much!

liu

__
R-help@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


[R] from long/lat to UTM

2005-03-08 Thread yyan liu
Hi:
  Is there any function in R which can convert the
long/lat to UTM(Universal Transverse Mercator)?
  There are quite a few converters on Internet.
However, the interface is designed as input-output
which I can not convert lots of locations at the same
time.
  Another question is whether there is a function in R
which can tell the time zone from the location's
lat/long?
  Thank you!

liu

__
R-help@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


[R] include C functions from nmath in my own C functions

2005-02-22 Thread yyan liu
Hi:
  I am writing a C program which need a gamma random
number generator. I download the source file of R and
compile, make it myself. There is a rgamma.c
function in the installing directory of
R(/home/zhliu/Backup/R-2.0.1/src/nmath/rgamma.c). My
question is how to call this function in my own
program which is in another directory. I can not copy
this rgamma.c to my working directory and use
#inclucdergamma.c because in the file rgamma.c, it
includes other header files. Or I can use makefile,
but I do not know how to edit my makefile to do this
job. 
  A related question is whether are similar .c files
contains the matrix functions(product, invert) in the
nmath library which I can use for my own C program?
  Thanks a lot!

liu

__
R-help@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


[R] adjacent category model in ordinal regression

2004-11-21 Thread yyan liu
Hi:
  I want to analyze some multinomial data. And the
response has a natural ordinal sturcture. I want to
fit a adjacent category model to the data by logit,
probit and complementary log-log link functions. I
found a package VGAM
(www.stat.auckland.ac.nz/~yee/VGAM/ ) whose function
acat can fit the adjacent category model but it only
has log and identity link functions. Does anybody
know there is a package or function can do the
analysis I want?
  Thank you!

liu

__

Log on to Messenger with your mobile phone!

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] integrate a function in R

2004-10-27 Thread yyan liu
Hi:
  I want to integrate the following function with
respect to z, u is another argument in the
function. My program is a loop and in each loop the
argument u will be given a specified numeric values.
But how can I use the integrate function with u in
R?
  The function is:
zfz-function(z,u)
{ 
  return(z*dnorm(z,u,1) )   
}

And in each loop, the integration interval is [0,u+3].
I can not just use integrate(zfz,0,u+3) because u
can not be specified. 
Thank you!

liu 

__

Download the latest ringtones, games, and more!

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] memory in R

2004-10-11 Thread yyan liu
Hi:
  I am doing a MCMC algorithm which is well known to
consume much computer memory. And I have a problem
everytime I run my R program. It stopped at certain
iteration and says can not allocate a vector of 19
kb.
It seems that the computer's memory has been
exhausted. However, it is said that after each
iteration the objects (such as a huge matrix) can be
set to NULL. And the memory will be released so the
program will consume as much memory as before. I
wonder how to do that, that is, set the object to be
NULL. Say, A is a matrix in each iteration. I just
need to write A-NULL ?? And this approach really
works?
  Thank you very much!

liu 



___

Declare Yourself - Register online to vote today!

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html