[R] pgmm error message, Error in terms.default(formula) : no terms component nor attribute

2016-01-22 Thread Xin Shi
Dear

I try to use pgmm to estimate dynamic model for panel data. I got the message 
below. It is appreciate that you could help on this. 
data<-read.csv("G:/MMU/Research/Urbanlisation/paneldata.csv",sep=",", 
header=TRUE) library(plm) library(Formula) urban<-pdata.frame(data, 
index=c("id","year_begin")) y<-urban[,7] x1<-urban[,8] x2<-urban[,9] 
x3<-urban[,10] x4<-urban[,11] 
z1<-pgmm(formula=y~lag(y,0:1)+x2+x3+x4,data=urban, effect = "twoways", model = 
"twosteps") Error in terms.default(formula) : no terms component nor attribute

Xin
---
Dr.Xin Shi
Reader in Applied Statistics
Director of DBA Programme
Room 609
Department of Marketing, Operations and Digital Business
Business School
All Saints Campus
Manchester Metropolitan University
Oxford Road
Manchester
M15 6BH
United Kingdom
E-mail: x@mmu.ac.uk
Telephone: +44 (0)161 247 3841
Fax: +44(0)161 247 6305
Office Hours: Wed 1-3pm.
http://www.business.mmu.ac.uk/staff/staffdetails.php?uref=423
http://www.mmu.ac.uk/dba

"Before acting on this email or opening any attachments you should read the 
Manchester Metropolitan University email disclaimer available on its website 
http://www.mmu.ac.uk/emaildisclaimer "

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] regularised incomplete beta function

2009-12-16 Thread Xin Shi
Dear:
 
I am trying to work out the regularised incomplete beta function in R. I 
searched google
on this and found UCS library. But I can not find this in R packages. Does 
anyone have use
this before or how to insert UCS in R?
 
Many Thanks!
 
Xin
 
 
Xin
---
Dr.Xin Shi
Senior Lecturer in Statistics
Manchester Metropolitan University Business School
Aytoun Building
Aytoun Street
Manchester
M1 3GH
United Kingdom

Telephone: +44 (0)161 247 3841
Fax: +44(0)161 247 6916
E-mail: x@mmu.ac.uk 
 
Before acting on this email or opening any attachments you should read the 
Manchester
Metropolitan University's email disclaimer
available on its website:
http://www.mmu.ac.uk/emaildisclaimer 

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] how to take away the same varible when I use "merge"

2009-05-12 Thread Xin Shi
Dear:

 

I am trying to merge two tables by a common variable. However, there are a
few same variables which are in both of two tables. How can I take them away
when I merge the two tables?

 

Thanks!

 

Xin

 

 

 

__
R-help@r-project.org 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] problem with ci for lmer

2009-05-21 Thread Xin Shi
Hi,

I am trying to calculate ci from lmer. However, I have the error message
below:

 

library(gmodels)

library(lme4)

fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)

ci(fm2)

 

Error in as.vector(x, mode) : 

  cannot coerce type 'S4' to vector of type 'any'

In addition: Warning message:

In mean.default(x, na.rm = na.rm) :

  argument is not numeric or logical: returning NA

 

I also tried another example below and got the same problem.

 

y=c(1,0,1,1,0,1,0,1,1,1)

x1=c(1,2,3,4,5,1,2,3,4,5)

x2=c(1.5,2,1.3,3.2,2.7,9.1,5.4,2,4,1)

fit<-lmer(y~x2+(1|x1))

ci(fit)

 

Does anyone know the solution?

 

In addition, I want to do the daily update for R. I run the code below and
it is not working.

 

svn log -v -r HEAD:\{`date +%Y-%m-%d -d'7 days ago'`\}
https://svn.r-project.org/R

 

Does anyone use this code before?

 

Thanks!

 

Xin

__
R-help@r-project.org 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] how to do trend.test for subset data

2009-03-24 Thread Xin Shi
Dear:

I try to do the trend.test {pastecs} for a subset data. Anyone have this
experience?

Many thanks!

Xin 




__
R-help@r-project.org 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] integrate of function f(x,y,z) respect to x only

2010-07-20 Thread Xin Shi
Dear:

Anyone has experience to use R integrate a function with more than two 
dimensions, but
you only need to integrate the function respect to one variable, say x. Because 
I also
want to maximise the log-likelihood after integration of function respect to x. 

Thanks!

Xin
---
Dr.Xin Shi
Senior Lecturer in Statistics
Manchester Metropolitan University Business School
Aytoun Building
Aytoun Street
Manchester
M1 3GH
United Kingdom

Telephone: +44 (0)161 247 3841
Fax: +44(0)161 247 6317
E-mail: x@mmu.ac.uk
 
Before acting on this email or opening any attachments you should read the 
Manchester
Metropolitan University's email disclaimer
available on its website:
http://www.mmu.ac.uk/emaildisclaimer

__
R-help@r-project.org 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] problem with installing packages

2011-02-11 Thread xin shi

Dear:
 
I am recnetly trying to install some libraries. However, I found this issue for 
both my laptop and desktop even I uninstall and install it again.
 
I even can not update the R now.
 
I wonder if you have the similar issue.
 
Thakns!
 
Xin
 
> chooseCRANmirror()
Warning message:
In open.connection(con, "r") :
  unable to connect to 'cran.r-project.org' on port 80.
> setRepositories()
> utils:::menuInstallPkgs()
Warning: unable to access index for repository 
http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.12
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = 
type) : 
  no packages were specified
  
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] how to plot histogram plot and fitted distributions on the same graph

2009-01-08 Thread Xin Shi
Dear:

 

I am trying to plot the histogram graph for my observed data. Then plot
fitted distribution on the same graph of histogram plot in R.

 

1.  histogram plot y.
2.  based on "1", plotting y1 v. x;
3.  based on "1", plotting y2 v. x;
4.  based on "1", plotting y3 v. x;

 

All of these four plots must be on the same graph.

 

However, I found the difficulty is that the y-axis and x-axis for histogram
plot and fitted distribution plot are different.

 

For histogram plot, y presents the frequency and x presents events.

 

For fitted distribution plots, y presents the probability and x presents
another variable.

 

However, I found out I need histogram plot rather than barplot. This is
major problem of this work.

 

The code I used:

 

par(font=1,font.lab=10,font.axis=6)

pts18=barplot(y,
ylim=c(0,0.2),xlim=c(2,52),axes=FALSE,border=TRUE,names.arg=x,col="white")

axis(2,las=1)

lines(spline(pts18,y1,n=300,method="natural"),type="l",lty=1) 

lines(spline(pts18,y2,n=300,method="natural"),type="l",lty=2)

lines(spline(pts18,y3,n=300,method="natural"),type="l",lty=5)

 

The data are:

 

The observed data:

 

y<-c(0.098441926, 0.166430595, 0.121813031, 0.104815864, 0.074362606, 

0.075779037, 0.055949008, 0.040368272, 0.03470255, 0.029745042, 

0.032577904, 0.02266289, 0.014872521, 0.014872521, 0.010623229, 

0.01203966, 0.01203966, 0.008498584, 0.009206799, 0.009915014, 

0.006373938, 0.003541076, 0.001416431, 0.001416431, 0.005665722, 

0.002124646, 0.000708215, 0.001416431, 0.004249292, 0.002832861, 

0.004957507, 0.002124646, 0.000708215, 0, 0.000708215, 0.002124646, 

0.001416431, 0.001416431, 0.001416431, 0, 0.000708215)

 

Fitted distribution 1:

 

y1<-c(0.03419162, 0.154201321, 0.129581481, 0.108892454, 0.091506645, 

0.07689666, 0.064619311, 0.054302168, 0.045632264, 0.0383466, 

0.032224168, 0.027079245, 0.022755763, 0.01912257, 0.016069453, 

0.013503798, 0.01134, 0.009535987, 0.008013468, 0.006734034, 

0.005658876, 0.004755378, 0.003996132, 0.003358108, 0.002821952, 

0.002371398, 0.00199278, 0.001674612, 0.001407243, 0.001182562, 

0.000993753, 0.00083509, 0.00070176, 0.000589716, 0.000495562, 

0.00041644, 0.000349951, 0.000294078, 0.000247125, 0.000207669, 

0.000174513)

 

Fitted distribution 2:

 

y2<-c(0.078909441, 0.188048499, 0.117871979, 0.089827482, 0.072368317, 

0.059928019, 0.050453301, 0.042948906, 0.036851702, 0.031809247, 

0.027584779, 0.024010745, 0.020963795, 0.01835029, 0.016097393, 

0.014147335, 0.012453559, 0.010978051, 0.009689433, 0.008561564, 

0.007572497, 0.006703683, 0.005939358, 0.005266055, 0.00467, 

0.004147912, 0.003684531, 0.003274633, 0.002911751, 0.00259025, 

0.002305216, 0.002052353, 0.001827898, 0.001628552, 0.001451415, 

0.001293939, 0.001153881, 0.001029262, 0.000918338, 0.000819567, 

0.000731589)

 

Fitted distribution 3:

 

y3<-c(0.09844545, 0.174856171, 0.1190666, 0.093021492, 0.075639902, 

0.062740817, 0.052668044, 0.044568247, 0.037931599, 0.032423244, 

0.027808545, 0.023915327, 0.020612892, 0.01779946, 0.015394205, 

0.013331948, 0.011559483, 0.010032949, 0.008715898, 0.007577845, 

0.006593146, 0.005740133, 0.005000424, 0.004358371, 0.003800615, 

0.003315725, 0.002893892, 0.002526689, 0.002206859, 0.001928146, 

0.001685148, 0.001473194, 0.001288243, 0.001126794, 0.00098581, 

0.000862657, 0.000755047, 0.000660991, 0.000578759, 0.000506847, 

0.000443945)

 

x<- c(0, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 

60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 

120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 

175, 180, 185, 190, 200)

 

Many Thanks!

 

Xin

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] how to read data from the different worksheets in the same Excel file

2009-01-14 Thread Xin Shi
Dear All:

 

I am trying to read the data from the different sheet but in the same Excel
file. Does R provide this kind of command to do it?

 

Anyone has experience on this?

 

Thanks!

 

Xin

 

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] how can I compare two vector by a factor

2009-02-27 Thread Xin Shi
Hi, I used Wilcox.test to carry out mann whiteney test when paired=false. 
However, I want to see the comparison of two variables, e.g. pre and post, 
grouped by treatment.

Anyone has this experience?

Thanks!

Xin


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] how to add labels to existing plot for the subset of data

2009-03-13 Thread Xin Shi
Dear:

I am trying to plot x against y for a particular subset of data, say z=1,
and labelling data by another variable say, k.

My data are:

y<-c(69.7, 82.3, 66.3, 107.3, 90.1, 63.7, 82, 74.4, 61.7, 93.4, 
73.4, NA, NA, 70.7, 67.7, NA, NA)

x<-c(71.2, 82.6, 67.4, 107.1, 90.5, 66.7, 83.9, 73.9, 61, 93.1, 
75.8, 79, 83.8, 73.1, 69.7, 73.3, 85.5)

z<-c(1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1)

k<-c(9, 10, 11, 12, 16, 23, 24, 25, 20, 19, 8, 21, 13, 17, 14, 15, 
18)

plot(y~x,subset=z==1)
text(x=x,y=y,labels=k)---for this command, how can I only plot the label for
z=1? For example, give a constrict: subet=z==1. however this command is not
working for "text".

Anyone has this experience?

Thanks! 


__
R-help@r-project.org 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] multinomial losgitic regression--vglm()

2008-12-08 Thread Xin Shi
Dear:

 

I try to analysis multinomial logistic regression using vglm in VGAM package. 
However, I wonder how many levels of responses variable this command is 
suitable. I saw the examples in google search works for 3 levels, say 1,2,3. 
However, my response variable is more than 3 levels. Is it working for my case 
or have alternative approach?

 

Many thanks!

 

Xin


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] keep function in stepAIC

2008-12-09 Thread Xin Shi
Dear:

 

Does anyone use keep function in stepAIC command? If so, could you give an 
example? I try to use this function to choose some variables in all of possible 
models.

 

Many Thanks!

 

Xin


[[alternative HTML version deleted]]

__
R-help@r-project.org 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.