Displaying 20 results from an estimated 300 matches similar to: "beta regression in R"
2011 Jun 14
1
Using MLE Method to Estimate Regression Coefficients
Good Afternoon,
I am relatively new to R and have been trying to figure out how to estimate regression coefficients using the MLE method. Some background: I am trying to examine scenarios in which certain estimators might be preferred to others, starting with MLE. I understand that MLE will (should) produce the same results as Ordinary Least Squares if the assumption of normality holds. That
2009 Feb 23
1
predicting cumulative hazard for coxph using predict
Hi
I am estimating the following coxph function with stratification and frailty?where each person had multiple events.
m<-coxph(Surv(dtime1,status1)~gender+cage+uplf+strata(enum)+frailty(id),xmodel)
?
> head(xmodel)
id enum dtime status gender cage uplf
1 1008666 1 2259.1412037 1 MA 0.000 0
2 1008666 2 36.7495023 1 MA 2259.141 0
3 1008666
2011 Jul 01
2
Help fix last line of my optimization code
Hi
I need help figure out how to fix my code.
When I call into R
>optimize(llik,init.params=F)
I get this error message
####Error in optimize(llik, init.params = F) : element 1 is empty;
the part of the args list of 'min' being evaluated was:
(interval)####
My data and my code looks like below.
R_j R_m
0.002 0.026567296
0.01 0.003194435
. .
. .
. .
. .
0.0006
2009 Jul 19
1
trouble using optim for maximalisation of 2-parameter function
Hello, I am having trouble using "optim".
I want to maximalise a function to its parameters [kind of like: univariate
maximum likelihood estimation, but i wrote the likelihood function myself
because of data issues ]
When I try to optimize a function for only one parameter there is no
problem:
llik.expo<-function(x,lam){(length(x)*log(lam))-(length(x)*log(1-exp(-1*lam*
2007 Apr 18
3
Problems in programming a simple likelihood
As part of carrying out a complicated maximum likelihood estimation, I
am trying to learn to program likelihoods in R. I started with a simple
probit model but am unable to get the code to work. Any help or
suggestions are most welcome. I give my code below:
************************************
mlogl <- function(mu, y, X) {
n <- nrow(X)
zeta <- X%*%mu
llik <- 0
for (i in 1:n) {
if
2011 May 11
1
Problem with constrained optimization with maxBFGS
Dear all,
I need to maximize the v:
v= D' W D
D is a column vector ( n , 1)
W is a given matrix (n, n)
subject to:
sum D= 1
(BTW, n is less than 300)
I´ve tried to use maxBFGS, as follows:
#####################################
objectiveFunction<-function(x)
{
return(t(D)%*%W%*%D)
}
Amat<-diag(nrow(D))
Amat<-rbind((rep(-1, nrow(D))), Amat)
bvec<-matrix( c(0), nrow(D)+1,
2003 Sep 08
1
Probit and optim in R
I have had some weird results using the optim() function. I wrote a
probit likelihood and wanted to run it with optim() with simulated
data. I did not include a gradient at first and found that optim()
would not even iterate using BFGS and would only occasionally work
using SANN. I programmed in the gradient and it iterates fine but the
estimates it returns are wrong. The simulated data work
2007 May 18
1
A programming question
Dear Friends,
My problem is related to how to measure probabilities from a probit model by changing one independent variable keeping the others constant.
A simple toy example is like this
Range for my variables is defined as follows
y=0 or 1, x1 = -10 to 10, x2=-40 to 100, x3 = -5 to 5
Model
output <- glim(y ~ x1+x2+x3 -1, family=binomial(link="probit"))
outcoef <-
2011 Jul 03
3
Hint improve my code
Hi
I have developed the code below. I am worried that the parameters I want to
be estimated are "not being found" when I ran my code. Is there a way I can
code them so that R recognize that they should be estimated.
This is the error I am getting.
> out1=optim(llik,par=start.par)
Error in pnorm(au_j, mean = b_j * R_m, sd = sigma_j) :
object 'au_j' not found
#Yet
2003 Jun 13
1
R 1.7.0 startup error: .addMethodFrom...
Does anyone know what could be causing the following error message on
startup of R:
Error in .addMethodFrom(def,argName[1],class[1],fromClass) :
object "*tmp*" not found.
I'm using R 1.7.0 and Windows 2000.
This happened shortly after I installed 1.7.0. Once it occurs, R freezes.
>From then on R will always freeze with this error message.
I reinstalled 1.7.0 and it worked
2005 Mar 09
2
Structural equation models with R
Hello useRs,
I`m running structural equation models with R, but for one of my models the
below error message apears. I`m trying to change startvalues but without
success. The manual for sem package did not help me. Does anyone knows how to
change startvalues for iteration in sem package? Or it can be another problem
with the model?
Error in startvalues(S, ram, debug = debug, tol = start.tol)
2002 Dec 13
0
Migrating Samba PDC to new machine (with different name)
The machine we are currently using as our existing PDC is getting old
and tired, so we have built a new machine and are attempting to migrate
users across to the new machine. However, since there can only be one
PDC on a network, this involves an "all nighter" moving users profiles
across to the new machine and then cranking it up as the PDC.
Everything appeared to go well until we
2010 Jun 25
1
Different standard errors from R and other software
Hi all,
Sorry to bother you. I'm estimating a discrete choice model in R using
the maxBFGS command. Since I wrote the log-likelihood myself, in order to
double check, I run the same model in Limdep. It turns out that the
coefficient estimates are quite close; however, the standard errors are very
different. I also computed the hessian and outer product of the gradients in
R using the
2011 Jul 23
1
Extend my code to run several data at once.
Hi
I have a code that calculate maximisation using optimx and it is working
just fine. I want to extend the code to run several colomns of R_j where j
runs from 1 to 200. If I am to run the code in its current state, it means I
will have to run it 200 times manually. May you help me adjust it to
accomodate several rows of R_j and print the 200 results.
***Please do not get intimidated by the
2013 Jan 02
1
Need help with self-defined function to perform nonlinear regression and get prediction interval
Dear All,
I was trying to call a self-defined function that performs nonlinear
regression and gets the corresponding prediction upper limit using nls2
package. However, weird thing happened. When I called the function in the
main program, an error message "fitted(nlsmodel): object 'nlsmodel' not
found" came up. But when I directly ran the codes inside the function, no
error came
2011 Jul 04
3
loop in optim
Hi
May you help me correct my loop function.
I want optim to estimates al_j; au_j; sigma_j; b_j by looking at 0 to 20,
21 to 40, 41 to 60 data points.
The final result should have 4 columns of each of the estimates AND 4 rows
of each of 0 to 20, 21 to 40, 41 to 60.
###MY code is
n=20
runs=4
out=matrix(0,nrow=runs)
llik = function(x)
{
al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4]
2003 Sep 17
2
Date on x-axis of xyplot
xyplot doesn't seem to want to label my x-axis with dates but instead puts
the day-number for each date.
begdate is the number of days since January 1, 1960 and was initially
created by
library(date)
...
polls$begdate<-mdy.date(begmm,begdd,begyy)
I create a new dataframe (pollstack) which includes begdate. In the process
begdate seems to lose its date attribute so I redo it as:
>
2007 Jul 20
0
Simultaneous logit/probit models
Dear R Users,
I'm currently working on simultaneous multinomial models and wonder whether R has any package that can estimate such models.
I've got a survey dataset that contains 2,000 individuals and one of the survey questions asked the respondents to chose two main reasons to work out of eight options (e.g., pay, pepople, to use abilities, etc.) . Now I'd like to model the
2011 Jul 06
1
Group Data indexed by n Variables
Hello,
the more general thing I'd like to learn here is how to compute Function of
Data on the basis of grouping determiend by n variables.
In terms of the reason why I am interested in this, I need to compute the
average of my data based on the value of the month and day across years. I
have come up withy the code below which, as far as I can see, does what I
need but getting either a more
2012 Jan 19
2
.Net 4 through WINE??
Specifically, I'm trying to find out if anyone is able to install or use applications that require dotnet 4. There is a econometrics package called SHAZAM 11 that I'd like to be able to install. If anyone has a clue for me, it'd be greatly appreciated.
Thanks!