similar to: glm inside one self-defined function

Displaying 20 results from an estimated 10000 matches similar to: "glm inside one self-defined function"

2017 Jun 18
3
R_using non linear regression with constraints
I am not as expert as John, but I thought it worth pointing out that the variable substitution technique gives up one set of constraints for another (b=0 in this case). I also find that plots help me see what is going on, so here is my reproducible example (note inclusion of library calls for completeness). Note that NONE of the optimizers mentioned so far appear to be finding the true best
2017 Jun 18
0
R_using non linear regression with constraints
I ran the following script. I satisfied the constraint by making a*b a single parameter, which isn't always possible. I also ran nlxb() from nlsr package, and this gives singular values of the Jacobian. In the unconstrained case, the svs are pretty awful, and I wouldn't trust the results as a model, though the minimum is probably OK. The constrained result has a much larger sum of squares.
2017 Jun 18
0
R_using non linear regression with constraints
I've seen a number of problems like this over the years. The fact that the singular values of the Jacobian have a ration larger than the usual convergence tolerances can mean the codes stop well before the best fit. That is the "numerical analyst" view. David and Jeff have given geometric and statistical arguments. All views are useful, but it takes some time to sort them all out and
2017 Jun 18
3
R_using non linear regression with constraints
https://cran.r-project.org/web/views/Optimization.html (Cran's optimization task view -- as always, you should search before posting) In general, nonlinear optimization with nonlinear constraints is hard, and the strategy used here (multiplying by a*b < 1000) may not work -- it introduces a discontinuity into the objective function, so gradient based methods may in particular be
2009 Sep 03
1
Help with GLM please!
Dear experts, I have a few quick questions related to GLMs: 1) Suppose my response is of the type Yes/No, How can I control which response I'm modelling? 2) How can I perform Type III tests? Is it with -> drop1(mymodel, test="Chisq") ? 3) I have a numerical variable which I converted to an ordered factor as shown below, but in the summary results of the logistic regression I
2017 Jun 18
2
R_using non linear regression with constraints
I am using nlsLM {minpack.lm} to find the values of parameters a and b of function myfun which give the best fit for the data set, mydata. mydata=data.frame(x=c(0,5,9,13,17,20),y = c(0,11,20,29,38,45)) myfun=function(a,b,r,t){ prd=a*b*(1-exp(-b*r*t)) return(prd)} and using nlsLM myfit=nlsLM(y~myfun(a,b,r=2,t=x),data=mydata,start=list(a=2000,b=0.05), lower = c(1000,0),
2017 Jun 18
0
R_using non linear regression with constraints
> On Jun 18, 2017, at 6:24 AM, Manoranjan Muthusamy <ranjanmano167 at gmail.com> wrote: > > I am using nlsLM {minpack.lm} to find the values of parameters a and b of > function myfun which give the best fit for the data set, mydata. > > mydata=data.frame(x=c(0,5,9,13,17,20),y = c(0,11,20,29,38,45)) > > myfun=function(a,b,r,t){ > prd=a*b*(1-exp(-b*r*t)) >
2004 Feb 04
3
Various newbie questions
Hello, 1) What is the difference between a "data frame" (J H Maindonald, Using R, p. 12) and a "vector"? In Using R, the author asks the reader to enter the following data in a data frame, which I will call "mydata": year snow.cover 1970 6.5 1971 12.0 1972 14.9 1973 10.0 1974 10.7 1975 7.9 ... mydata=data.frame(year=c(1970,...),snow.cover=c(6.5,...)) 2) How to
2010 Jan 01
1
Questions bout SVM
Hi everyone, Can someone please help me in these questions?: 1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?: mymodel <- svm(myformula,data=mydata,cross=10) sqrt(mean(mymodel$MSE)) But if I don’t use crossvalidation, I have to use the following to calculate RMSE: mymodel <- svm(myformula,data=mydata) mytest
2010 Jul 12
1
Custom nonlinear self starting function w/ 2 covariates
Hello, I'm trying to adjust a non linear model in which the biological response variable (ratio of germinated fungus spores) is dependent on 2 covariates (temperature and time). The response to temperature is modeled by a kind of beta function with 2 parameters (optimal and maximum temperatures) and the time function is a 2-parameter Weibull. Adjustments with nls or gnls work, but I need to
2013 May 01
2
Factors and Multinomial Logistic Regression
Dear All, I am trying to reproduce the example that I found online here http://bit.ly/11VG4ha However, when I run my script (pasted at the end of the email), I notice that there is a factor 2 between the values for the coefficients for the categorical variable female calculated by my script and in the online example. Any idea about where this difference comes from? Besides, how can I
2005 May 04
3
How to intepret a factor response model?
Hello, I'd like to create a model with a factor-type response variable. This is an example: > mydata <- data.frame(factor_var = as.factor(c(rep('one', 100), rep('two', 100), rep('three', 100))), real_var = c(rnorm(150), rnorm(150) + 5)) > summary(mydata) factor_var real_var one :100 Min. :-2.742877 three:100 1st Qu.:-0.009493 two
2010 Aug 06
2
How to read a file inside a function?
Hi I wish to read a file from my local directory from inside a function. I am passing the filename as the argument but this does not work. Say for example function(dat) { dat1=read.csv("D:\\dat.csv",header=TRUE) } If I call funtion(dat) I get the following error. 'Intuitively' i understand this is a mistake but how do I overcome this and how can I read a file name passed as an
2011 Feb 25
1
help please ..simple question regarding output the p-value inside a function and lm
Dear R community members and R experts I am stuck at a point and I tried with my colleagues and did not get it out. Sorry, I need your help. Here my data (just created to show the example): # generating a dataset just to show how my dataset look like, here I have x variables # x1 .........to X1000 plus ind and y ind <- c(1:100) y <- rnorm(100, 10,2) set.seed(201) P <-
2011 Mar 13
3
Mumble gamers' VOIP server (murmur)
I was unable to build the whole Mumble system on CentOS but it's available for Fedora Development. I just wanted the server part on my headless server, and a static build is available from the Mumble project on Sourceforge. So I grabbed the Mumble SRPM from Fedora Development, the static build from Sourceforge, and stripped the spec file down to the minimum needed to just install the
2011 Feb 12
2
Predictions with missing inputs
Dear users, I'll appreciate your help with this (hopefully) simple problem. I have a model object which was fitted to inputs X1, X2, X3. Now, I'd like to use this object to make predictions on a new data set where only X1 and X2 are available (just use the estimated coefficients for these variables in making predictions and ignoring the coefficient on X3). Here's my attempt but, of
2008 Apr 17
1
How to extract vectors from an arima() object and into a data frame?
This should be very easy, but alas, I'm very new to R. My end goal is to calculate p-values from arima(). Let's say I just ran this: > MyModel <- arima(y[1:58], order=c(1,0,0), xreg=MyData[1:58,7:14], > method="ML") > MyModel And I see: arima(x = y[1:58], order = c(1, 0, 0), xreg = MyData[1:58, 7:14], method = "ML") Coefficients: ar1
2011 Jun 29
0
Problem: Update of glm-object cannot find where the data object is located
Hi everybody, I want to ask your help to explain what is going on with my following code: > mydata <- data.frame(y=rbinom(100, 1, 0.5), x1=rnorm(100), x2=rnorm(100)) > glm.fit.method <- function(model,data,...){glm(formula=model,data=data,family="binomial",. ..)} > fit1 <- glm(y ~ x1 + x2, data=mydata, family=binomial()) > update(fit1, .~1) Call: glm(formula =
2013 Feb 18
2
How to label percentage values inside stacked bar plot using R-base
Hello, I am new to R. I would like others to explain to me how to add absolute values inside the individual stacked bars in a consistent way using the basic R plotting function (R base). I tried to plot a stacked bar graph using R base but the values appear in an inconsistent/illogical way in such a way that its supposed to be 100% for each village but they don't sum up to 100%. Here is the
2008 Apr 28
1
error in summary.Design
Dear list, after fitting an lrm with the Design package (stored as "mymodel") I try running a summary, but I get the following error: dim(mydata) [1] 235 9 names(mydata) [1] "id" "VAR1" "VAR2" "VAR3" "VAR4" "VAR5" "VAR6" "VAR7" "VAR8" summary(mymodel) Error in `contrasts<-`(`*tmp*`,