Displaying 20 results from an estimated 10000 matches similar to: "Optimizing"
2009 Oct 31
1
Help me improving my code
Hi,
I am new to R. My problem is with the ordered logistic model. Here is my
question:
Generate an order discrete variable using the variable
wrwage1 = wages in first full calendar quarter after benefit application
in the following way:
*
wage*1*Ordered *=
1 *if*0 *· wrwage*1 *< *1000
2 *if*1000 *· wrwage*1 *< *2000
3 *if*2000 *· wrwage*1 *< *3000
4 *if*3000 *· wrwage*1 *<
2009 Sep 03
2
How can I appoint a small part of the whole data
Dear all,
I have 1980~1990 eleven datas,
every year have three variables,
wage
gender(1=female, 2=male)
race(1=black, 2=white)
My original commands is:
fig2b<-reldist(y=mu1990$wage,yo=mu1980$wage,.......)
I have three questions:
1. If I want to appoint y=women's wage in 1990
yo=women's wage in 1980
2. If I want to appoint y=women's wage in
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a
time-series. How do we correctly create a lagged value of the
time-series variable?
As an example, suppose I create:
A <- data.frame(year=rep(c(1980:1984),3),
person= factor(sort(rep(1:3,5))),
wage=c(rnorm(15)))
> A
year person wage
1 1980 1 0.17923212
2 1981
2004 Oct 03
1
How might one write this better?
I am trying to simulate the trajectory of the pension assets of one
person. In C-like syntax, it looks like this:
daily.wage.growth = 1.001 # deterministic
contribution.rate = 0.08 # deterministic 8%
Wage = 10 # initial
Asset = 0 # initial
for (10,000 days) {
Asset += contribution.rate * Wage
2009 Nov 27
1
problem with "dynformula" from "plm" package [RE-POST]
Hello list,
I'm following the paper (http://www.jstatsoft.org/v27/i02/paper) on
how to use "plm" to run panel regressions, and am having trouble with
what I believe should be something very basic.
When I run the command (p.9 in the paper):
R>
dynformula(emp~wage+capital,log=list(capital=FALSE,TRUE),lag=list(emp=2,c(2,3)),diff=list(FALSE,capital=TRUE))
I see:
emp ~ wage +
2024 Jan 28
1
2SLS with Fixed Effects and Control Variables
Dear John Fox, Christian Kleiber, and Achim Zeileis,
I am attempting to run various independent variable parameters to assess
their suitability. Unfortunately, I hit a snag and couldn't get the tests
to run properly. When I used ivreg, I got an error message saying: "Error
in eval(predvars, data, env) : object 'WageInequality' not found."
Can you please help?
Model:
2005 Feb 16
1
Setting log(0) to 0
Hi,
I'm trying to do a regression like this:
wage.r = lm( log(WAGE) ~ log(EXPER)
where EXPER is an integer that goes from 0 to about 50. EXPER contains
some zeros, so you can't take its log, and the above regression
therefore fails. I would like to make R accept log(0) as 0, is that
possible? Or do I have first have to turn the 0's into 1's to be able to
do the above
2012 Apr 25
4
"Conditional" average
Hello, I have a set of data including age, wage and education level each
called age76, wage76 and grade76 I want to know how i can calculate the
average wage of people age 15 to 65 (each year separetly) , only for those
who have an education level of 10 12 and 16...
--
View this message in context: http://r.789695.n4.nabble.com/Conditional-average-tp4585313p4585313.html
Sent from the R help
2010 Feb 28
1
"Types" of missingness
Dear R-List,
My questions concerns missing values. Specifically, is is possible to
use different "types" of missingness in a dataset and not a
one-size-fits-all NA?
For example, data may be missing because of an outright refusal by a
respondent to answer a question, or because she didn't know an answer,
or because the item simply did not apply. In later analysis it is
sometimes
2005 Nov 05
3
solve the quadratic equation ax^2+bx+c=0
If I have matrics as follows:
> a <- c(1,1,0,0)
> b <- c(4,4,0,0)
> c <- c(3,5,5,6)
How can I use R code to solve the equation ax^2+bx+c=0.
thanks!
yuying shi
[[alternative HTML version deleted]]
2012 Nov 29
1
instrumental variables regression using ivreg (AER) or tsls (sem)
Dear friends,
I am trying to understand and implement instrumental variables
regression using R.
I found a small (simple) example here which purportedly illustrates the
mechanics (using 2-stage least-squares):
http://www.r-bloggers.com/a-simple-instrumental-variables-problem/
Basically, here are the R commands (reproducible example) from that
site:
# ------ begin R
library(AER)
2013 May 13
2
reduce three columns to one with the colnames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130513/fe848ce7/attachment.pl>
2012 May 20
5
removeing only rows/columns with "na" value from square ( symmetrical ) matrix.
I have some square matrices with na values in corresponding rows and
columns.
M<-matrix(1:2,10,10)
M[6,1:2]<-NA
M[10,9]<-NA
M<-as.matrix(as.dist(M))
print (M)
1 2 3 4 5 6 7 8 9 10
1 0 2 1 2 1 NA 1 2 1 2
2 2 0 1 2 1 NA 1 2 1 2
3 1 1 0 2 1 2 1 2 1 2
4 2 2 2 0 1 2 1 2 1 2
5 1 1 1 1 0 2 1 2 1 2
6 NA NA 2 2 2 0 1 2 1 2
7 1 1 1 1 1 1 0 2 1 2
8
2010 Oct 04
1
Simultaneous equation with one ordinal reponses
Dear R users,
I had a research question which involves a simultaneous equation system, one
is the common continuous dependent variable, y1, say wage, or log wage,
another one is a latent variable, y*, which I only observe up to a ordinal
scale, say attitudes toward a problem, taking values as y2= 1, 2, 3 or 4.
Both of them have other exogeneious variables. I have been search on
internet for
2012 Mar 31
3
clear console
hi,
I use R - 2.15(32bit), and want to make a code to clear a console.
Actually, I used to run following code to do that but after update the
version of R from 2.14 to 2.15, it doesn't work.
cls <- function (t) {
require(RDCOMClient)
wsh <- COMCreate("Wscript.Shell")
wsh$SendKeys("\f")
invisible(wsh)
}
cls()
or
cls <-
2012 Feb 13
3
Change dataframe-structure
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120213/d2a5afa6/attachment.pl>
2012 May 02
2
Problem with 'nls' fitting logistic model (5PL)
Dear R-Helpers,
I'm working with immunoassay data and 5PL logistic model. I wanted to
experiment with different forms of weighting and parameter selection,
which is not possible in instrument software, so I turned to R.
I am using R 2.14.2 under Win7 64bit, and the 'nls' library to fit the
model - I started with the same model and weighting type (1/y) as in the
instrument to see
2012 Mar 08
1
Panel models: Fixed effects & random coefficients in plm
Hello,
I am using {plm} to estimate panel models. I want to estimate a model that
includes fixed effects for time and individual, but has a random individual
effect for the coefficient on the independent variable.
That is, I would like to estimate the model:
Y_it = a_i + a_t + B_i * X_it + e_it
Where i denotes individuals, t denotes time, X is my independent variable,
and B (beta) is the
2011 Dec 04
3
Vectorization instead of loops problem
Hello,
I am having problems vectorizing the following (i/o using a for/next/while
loop):
I have 2 sequences such as:
x, y
1, 30
2, -40
0, 50
0, 25
1, -5
2, -10
1, 5
0, 40
etc etc
The first sequence (x) takes integer numbers only: 0, 1, 2
The sequence y can be anything...
I want to be able to retrieve (in a list if possible) the 3 last values of
the y sequence before a value of 1 is
2007 May 28
5
CTI in ActiveRecord
I search an plugin or gem, but don''t find nothing satisfactory. I
believe to be stranger a technology that nails the DRY, have that create
you vary equal tables, instead of using inheritance.
Exists an soluction for this? I want a solution similar to this:
create_table :people |t| do
t.column :name
t.column :address
end
create_table :customer |t| do
t.column :person_id