[R] Panel regression in R

2005-08-24 Thread Haibo Huang
I am currently trying to replicate the results I got
from RATS for a panel regression. The codes in RATS
looks like this: 

* Final equation for Office Cap Rate Spread
* Regression, Panel Data
preg(effects=time, method=random) CapRate
# CapRate{1} RentCycle{1} VacancyChangeYTY
InflationYTY RealGDPyty 

Just wonder what R package also allow me to have the
options like (effects=time, method=random). Could
anyone share some thoughts with me? Any input will be
helpful. Thank you very much!

Best,
Ed.

__
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] How to do log normal regression?

2005-08-18 Thread Haibo Huang

I want to fit a Log-Normal CDF function between two
variables, and estimate the parameters. Is there any
package/functions designed for this purpose? 

Basically, I have data for Y and X, and I suspect the
relationship between Y and X is Y = CDF Log-Normal
(X), and I want to run this regression to verify this
and estimate the parameters. Anyone has any thoughts?

Any input is valuable to me, so please do not hesitate
to share your thoughts. Thank you!

Ed.

__
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] Help with non-integer #successes in a binomial glm

2005-08-08 Thread Haibo Huang
Hi,

I had a logit regression, but don't really know how to
handle the Warning message: non-integer #successes in
a binomial glm! in: eval(expr, envir, enclos)
problem. I had the same logit regression without
weights and it worked out without the warning, but I
figured it makes more sense to add the weights. The
weights sum up to one. 

Could anyone give me some hint? Thanks a lot!

FYI, I have posted both regressions (with and without
weights) below.

Ed


 setwd(P:/Work in Progress/Haibo/Hans)
 
 Lease=read.csv(lease.csv, header=TRUE)
 Lease$ET - factor(Lease$EarlyTermination)
 SICCode=factor(Lease$SIC.Code)
 Lease$TO=factor(Lease$TenantHasOption)
 Lease$LO=factor(Lease$LandlordHasOption)
 Lease$TEO=factor(Lease$TenantExercisedOption)
 
 RegA=glm(ET~1+TO, 
+ family=binomial(link=logit), data=Lease)
 summary(RegA)

Call:
glm(formula = ET ~ 1 + TO, family = binomial(link =
logit), data = Lease)

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-0.5839  -0.5839  -0.5839  -0.3585   2.3565  

Coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept) -1.682710.02363  -71.20   2e-16 ***
TO1 -1.029590.09012  -11.43   2e-16 ***
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.'
0.1 ` ' 1 

(Dispersion parameter for binomial family taken to be
1)

Null deviance: 12987  on 15809  degrees of freedom
Residual deviance: 12819  on 15808  degrees of freedom
AIC: 12823

Number of Fisher Scoring iterations: 5

 setwd(P:/Work in Progress/Haibo/Hans)
 
 Lease=read.csv(lease.csv, header=TRUE)
 Lease$ET - factor(Lease$EarlyTermination)
 SICCode=factor(Lease$SIC.Code)
 Lease$TO=factor(Lease$TenantHasOption)
 Lease$LO=factor(Lease$LandlordHasOption)
 Lease$TEO=factor(Lease$TenantExercisedOption)
 
 RegA=glm(ET~1+TO, 
+ family=binomial(link=logit), data=Lease,
weights=PortionSF)
Warning message: 
non-integer #successes in a binomial glm! in:
eval(expr, envir, enclos) 
 summary(RegA)

Call:
glm(formula = ET ~ 1 + TO, family = binomial(link =
logit), data = Lease, 
weights = PortionSF)

Deviance Residuals: 
  Min 1Q Median 3QMax 

-0.055002  -0.003434   0.00   0.00   0.120656 


Coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)   -1.120  2.618  -0.4280.669
TO1   -1.570  9.251  -0.1700.865

(Dispersion parameter for binomial family taken to be
1)

Null deviance: 1.0201  on 9302  degrees of freedom
Residual deviance: 0.9787  on 9301  degrees of freedom
AIC: 4

Number of Fisher Scoring iterations: 5

__
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] calculate likelihood based on logit regression

2005-08-05 Thread Haibo Huang
Hi,

I just ran the following logit regression. But can
anyone tell me how to calculate how much more likely
males (Male=1) could show such symptom than
females(Male=0)? I know it must be simple to get once
I have the coefficients, but I just don't recall.
Thank you very much!

Call:
glm(formula = Symptoms ~ 1 + Male, family =
binomial(link = logit), 
data = HA)
Deviance Residuals: 
   Min  1Q  Median  3Q
Max  
-6.038e+03  -2.067e-06   0.000e+00   0.000e+00  
6.720e+03  
Coefficients:
  Estimate Std. Errorz value
Pr(|z|)
(Intercept)  5.711e+00  8.466e-02  6.746e+01  
2e-16 ***
Male-6.493e+00  8.540e-02 -7.603e+01   2e-16
***


Best,
Ed

__
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


Re: [R] calculate likelihood based on logit regression

2005-08-05 Thread Haibo Huang
I think males are z times more likely to show such
symptom, where:

z=(1+exp(6.493-5.711))/(1+exp(-5.711))

Is this right? Thanks!
Ed.

--- Haibo Huang [EMAIL PROTECTED] wrote:

 Hi,
 
 I just ran the following logit regression. But can
 anyone tell me how to calculate how much more likely
 males (Male=1) could show such symptom than
 females(Male=0)? I know it must be simple to get
 once
 I have the coefficients, but I just don't recall.
 Thank you very much!
 
 Call:
 glm(formula = Symptoms ~ 1 + Male, family =
 binomial(link = logit), 
 data = HA)
 Deviance Residuals: 
Min  1Q  Median  3Q  
  
 Max  
 -6.038e+03  -2.067e-06   0.000e+00   0.000e+00  
 6.720e+03  
 Coefficients:
   Estimate Std. Errorz value
 Pr(|z|)
 (Intercept)  5.711e+00  8.466e-02  6.746e+01
  
 2e-16 ***
 Male-6.493e+00  8.540e-02 -7.603e+01  
 2e-16
 ***
 
 
 Best,
 Ed
 
 __
 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-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 regarding logit regression using glm

2005-08-05 Thread Haibo Huang
I got the following warning messages when I did a
binomial logit regression using glm():

Warning messages: 
1: Algorithm did not converge in: glm.fit(x = X, y =
Y, weights = weights, start = start, etastart =
etastart,  
2: fitted probabilities numerically 0 or 1 occurred
in: glm.fit(x = X, y = Y, weights = weights, start =
start, etastart = etastart,  

Can some one share your thoughts on how to solve this
problem? Please read the following for details. Thank
you very much!

Best,
Ed


 Lease=read.csv(lease.csv, header=TRUE)
 Lease$ET = factor(Lease$EarlyTermination)
 SICCode=factor(Lease$SIC.Code)
 TO=factor(Lease$TenantHasOption)
 LO=factor(Lease$LandlordHasOption)
 TEO=factor(Lease$TenantExercisedOption)
 
 RegA=glm(ET~1+MSA, 
+ family=binomial(link=logit), data=Lease,
weights=Origil.SQFT)
Warning messages: 
1: Algorithm did not converge in: glm.fit(x = X, y =
Y, weights = weights, start = start, etastart =
etastart,  
2: fitted probabilities numerically 0 or 1 occurred
in: glm.fit(x = X, y = Y, weights = weights, start =
start, etastart = etastart,  
 summary(RegA)

Call:
glm(formula = ET ~ 1 + MSA, family = binomial(link =
logit), 
data = Lease, weights = Origil.SQFT)

Deviance Residuals: 
   Min  1Q  Median  3Q
Max  
-6.038e+03  -2.066e-06   0.000e+00   0.000e+00  
6.720e+03  

Coefficients:
  Estimate Std. Errorz value
Pr(|z|)
(Intercept)  5.711e+00  8.466e-02  6.745e+01  
2e-16 ***
MSAAnchorage-6.493e+00  8.541e-02 -7.602e+01  
2e-16 ***
MSAAtlanta   6.894e+14  2.310e+04  2.985e+10  
2e-16 ***
MSAAustin   -9.362e+14  4.954e+04 -1.890e+10  
2e-16 ***
MSABoston   -2.474e+15  2.151e+04 -1.150e+11  
2e-16 ***
MSACharlotte-2.150e+15  7.265e+04 -2.960e+10  
2e-16 ***
MSAChicago  -1.174e+15  2.057e+04 -5.707e+10  
2e-16 ***
MSACleveland-7.607e+14  7.046e+04 -1.080e+10  
2e-16 ***
MSAColumbus -2.768e+15  1.685e+05 -1.642e+10  
2e-16 ***
MSADallas2.061e+14  3.261e+04  6.321e+09  
2e-16 ***
MSADenver5.470e+14  3.366e+04  1.625e+10  
2e-16 ***
MSAEast Bay -6.191e+01  1.344e+05  -4.61e-04  
 1
MSAFt. Worth-6.565e+00  8.483e-02 -7.739e+01  
2e-16 ***
MSAHouston  -2.735e+15  3.576e+04 -7.648e+10  
2e-16 ***
MSAIndianapolis -7.483e+14  6.588e+04 -1.136e+10  
2e-16 ***
MSALos Angeles  -1.388e+15  2.887e+04 -4.809e+10  
2e-16 ***
MSAMinneapolis  -1.011e+15  2.731e+04 -3.702e+10  
2e-16 ***
MSANashville 2.143e+01  9.395e+04   2.28e-04  
 1
MSANew Orleans  -3.370e+15  5.038e+04 -6.689e+10  
2e-16 ***
MSANew York -2.526e+15  2.969e+04 -8.507e+10  
2e-16 ***
MSANorfolk  -5.614e+01  2.020e+06  -2.78e-05  
 1
MSAOakland-East Bay -2.272e+15  3.642e+04 -6.239e+10  
2e-16 ***
MSAOrange County-5.165e+14  2.428e+04 -2.128e+10  
2e-16 ***
MSAOrlando  -3.215e+15  1.096e+05 -2.933e+10  
2e-16 ***
MSAPhiladelphia -8.871e+14  4.948e+04 -1.793e+10  
2e-16 ***
MSAPhoenix  -1.156e+01  8.807e-02 -1.313e+02  
2e-16 ***
MSAPortland  7.604e+14  3.841e+04  1.980e+10  
2e-16 ***
MSARaleigh-Durham   -4.312e+01  1.294e+05  -3.33e-04  
 1
MSARiverside 1.626e+15  4.645e+05  3.500e+09  
2e-16 ***
MSASacramento   -9.873e+14  5.345e+04 -1.847e+10  
2e-16 ***
MSASalt Lake City1.793e+15  2.029e+05  8.839e+09  
2e-16 ***
MSASan Antonio   9.451e+14  9.473e+04  9.977e+09  
2e-16 ***
MSASan Diego-3.740e+15  6.651e+04 -5.623e+10  
2e-16 ***
MSASan Francisco 3.109e+14  2.394e+04  1.299e+10  
2e-16 ***
MSASan Jose  7.392e+14  2.961e+04  2.497e+10  
2e-16 ***
MSASeattle  -2.250e+15  1.581e+04 -1.423e+11  
2e-16 ***
MSASt. Louis-2.606e+15  1.801e+05 -1.447e+10  
2e-16 ***
MSAStamford -6.592e+00  8.469e-02 -7.784e+01  
2e-16 ***
MSAWashington DC 8.460e+13  3.319e+04  2.549e+09  
2e-16 ***
MSAWest Palm Beach  -3.924e+01  2.308e+05  -1.70e-04  
 1
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.'
0.1 ` ' 1 

(Dispersion parameter for binomial family taken to be
1)

Null deviance:  123111026  on 9302  degrees of
freedom
Residual deviance: 3028559052  on 9263  degrees of
freedom
AIC: 3028559132

Number of Fisher Scoring iterations: 25

 anova(RegA)
Analysis of Deviance Table

Model: binomial, link: logit

Response: ET

Terms added sequentially (first to last)


   Df   Deviance Resid. Df Resid. Dev
NULL  9302  123111026
MSA39  0  9263 3028559052


__
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] Convert numeric to factor

2005-08-03 Thread Haibo Huang
Hi,

I tried to do a logistic regression with polr(MASS). I
thought I already converted the response to factor,
but obvious I was wrong. Could anyone tell me what I
did wrong and how to correct it? Thank you very much!

 Lease=read.csv(LeaseDummy.csv, header=TRUE)
 Lease$ID -
as.integer(factor(Lease$EarlyTermination)) 
 

RegA=polr(ID~1+MSA+SIC.Code+TenantOption+LLOption+TOExercised,

+  data=Lease, method=c(logistic))
Error in polr(ID ~ 1 + MSA + SIC.Code + TenantOption +
LLOption + TOExercised,  : 
response must be a factor
 summary(RegA)


Best,
Ed.




--- Jean Eid [EMAIL PROTECTED] wrote:

 
 if labda is the elements of the vector and you know
 what kexp is , you can
 use apply
 
 apply(your_vector, 1, function(x) 1-
 exp^(kexp^(-x)))
 
 
 HTH
 
 Jean
 On Wed, 3 Aug 2005, Rangesh Kunnavakkam wrote:
 
  I  have a large vector of around 12597 elements
 and I wish to calculate
  p-value for each element using a formula of
 something like:
  p-value= 1-
 exp^(kexp^(-labda))
  I was wondering someone could give some ideas how
 to implement for each element.
  thankyou very much
  Rangesh.K
 
  __
  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-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-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] NA when using read.csv

2005-08-01 Thread Haibo Huang
Hi, when I used:

Dist=read.csv(test.csv,header=TRUE)

to read data from CSV file. For some cells, R
mistakenly put in as NA, while most of the cells still
appears to be right, and there is no error message in
R. I am pretty sure the csv file is all right, but
just can't figure out what went wrong. Can someone
share your thoughts with me? Thanks!

Ed

__
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


Re: [R] can we manage memory usage to increase speed?

2005-08-01 Thread Haibo Huang
Please refer to the following post.

Ed

--- Mike Lawrence [EMAIL PROTECTED] wrote:

 Date: Mon,  1 Aug 2005 00:19:06 -0300
 From: Mike Lawrence [EMAIL PROTECTED]
 To: Briggs, Meredith M
 [EMAIL PROTECTED]
 CC: r-help@stat.math.ethz.ch
 Subject: Re: [R] How do you increase memeory?
 
 memory.limit(size = x)
 
 where x is the desired memory limit in MB.
 
 
 
 Quoting Briggs, Meredith M
 [EMAIL PROTECTED]:
 
  Hello
 
 
  Function memory.size() =435109888. How do I
 increase it by, say 30%?
 
  Thanks
  Meredith
 
  [[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
 
 
 
 
 -- 
 
 Mike Lawrence, BA(Hons)
 Research Assistant to Dr. Gail Eskes
 Dalhousie University  QEII Health Sciences Centre
 (Psychiatry)
 
 [EMAIL PROTECTED]
 
 The road to Wisdom? Well, it's plain and simple to
 express:
 Err and err and err again, but less and less and
 less.
 - Piet Hein
 
 __
 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
 


--- Zhilin Liu [EMAIL PROTECTED] wrote:

 Hi,
  
 Thanks for reading.
  
 I am running  a process in R for microarray data
 analysis. RedHat Enterprise Linux 4, dual AMD CPU,
 6G memory. However, the R process use only a total
 of 200M memory. And the CPU usage is total to ~110%
 for two. The program takes at least 2 weeks to run
 at the current speed. Is there some way we can
 increase the usage of CPUs and memories and speed
 up? Any suggestion is appreciated.
  
 Thanks again.
  
 Zhilin 
 
   [[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-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] logistic regression: categorical value, and multinomial

2005-07-27 Thread Haibo Huang
I have two questions:

1. If I want to do a binomial logit, how to handle the
categorical response variable? Data for the response
variables are not numerical, but text.

2. What if I want to do a multinomial logit, still
with categorical response variable? The variable has 5
non-numerical response levels, I have to do it with a
multinomial logit.

Any input is highly appreciated! Thanks!

Ed

__
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] Convert quarterly data to monthly data

2005-07-25 Thread Haibo Huang
Hi,

I am new to use R, but can anyone tell me how to
tranform quarterly data to monthly data? I know SAS
has this procedure, so may I assume it is also
available in R?

Thanks a lot!

Ed

__
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] cubic spline curves

2005-07-25 Thread Haibo Huang
I have a question about how to generate monthly data
from quarterly data:

What I want to do is basically fits cubic spline
curves to the quarterly data to form continuous-time
approximations of the input series, and then generate
output series (monthly data) from the spline
approximations. 

SAS can do it using proc expand:
http://support.sas.com/rnd/app/examples/ets/expa/

Anyone know how to do it in R? Any input is
appreciated.

Best,
Ed

__
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