search for: coef

Displaying 20 results from an estimated 2193 matches for "coef".

2002 Oct 09
5
polynomial
Any better (more efficient, built-in) ideas for computing coef[1]+coef[2]*x+coef[3]*x^2+ ... than polynom <- function(coef,x) { n <- length(coef) sum(coef*apply(matrix(c(rep(x,n),seq(0,n-1)),ncol=2),1,function(z)z[1]^z[2])) } ? Ben -- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida...
2009 Jun 05
1
Bug in print.Arima and patch
Dear List, A posting to R-Help exposed this problem with the print method for objects of class Arima: > set.seed(1) > x <- arima.sim(n = 100, list(ar = 0.8897, ma = -0.2279)) > mod <- arima(x, order = c(1,0,1)) > coefs <- coef(mod) > mod2 <- arima(x, order = c(1,0,1), fixed = coefs) > mod2 Call: arima(x = x, order = c(1, 0, 1), fixed = coefs) Coefficients: Error in se && nrow(x$var.coef) : invalid 'y' type in 'x && y' > print(mod2, se = FALSE) Call: arima(x = x,...
2003 Oct 12
6
Rd problems
Hola! I have the following in a .Rd file: \eqn{\mbox{coef} = c(\mbox{coef}[1],\ldots, \mbox{coef}[n]) } {coef = c(coef[1], coef[2], \dots, coef[n])} However, both arguments come out in the latex file! Whats happening? Kjetil Halvorsen
2010 Apr 19
3
nls for piecewise linear regression not converging to least square
...lp), yint, yint + (x1-(xint+(yint/slp)))*slp), data=dat, control=list(minFactor=1e-5,maxiter=500,warnOnly=T), start=list(xint=39.27464924, yint=0.09795576, slp=2.15061064), na.action=na.omit, trace=T) ##plotting the function plot(dat$x1,dat$y1) segments(x0=0, x1=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3], y0=coef(nlmod)[2], y1=coef(nlmod)[2]) segments(x0=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3],x1=80, y0=coef(nlmod)[2], y1=80*coef(nlmod)[3]+coef(nlmod)[2]) As you can see from the plot, the line is above all data points on the seco...
2005 Feb 24
2
a question about function eval()
Hi, I have a question about the usage of eval(). Wonder if any experienced user can help me out of it. I use eval() in the following function: semireg.pwl <- function(coef.s=rnorm(1),coef.a=rnorm(1),knots.pos=knots.x,knots.ini.val=knots.val){ knotn <- length(knots.pos) def.par.env <- sys.frame(1) print(def.par.env) print(environment(coef.s)) tg <- eval( (parse(text= paste( "function(coef.sex=coef...
2006 May 03
2
Outreg-like command?
It would be nice to have something like stata's outreg that lets regression output go into a form like Specification (1) Specification (2) Var 1 coef(1,1) coef(1,2) se(1,1) se(1,2) Var 2 coef(2,1) coef(2,2) se(2,1) se(2,2) I don't think this can be done in xtable? Thomas Davidoff Assistant Professor Haas School of Business UC Berkeley Berkeley, CA 94618 Phone: (510) 643-1425 Fax: (510) 643-7357 email: davidoff at haas.be...
2010 Apr 19
2
nls minimum factor error
...yint/slp), yint, yint + (x2-(xint+(yint/slp)))*slp), data=dat, control=list(minFactor=1e-5,maxiter=500,warnOnly=T), start=list(xint=40.49782, yint=1.013981, slp=0.8547828), na.action=na.omit, trace=T) ##plotting the function plot(dat$x2,dat$y2) segments(x0=0, x1=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3], y0=coef(nlmod)[2], y1=coef(nlmod)[2]) segments(x0=coef(nlmod)[1]+coef(nlmod)[2]*coef(nlmod)[3],x1=80, y0=coef(nlmod)[2], y1=80*coef(nlmod)[3]+coef(nlmod)[2]) Karen [[alternative HTML version deleted]]
2010 Sep 29
1
Trying to avoid loop structure
Dear R-helpers, I'm trying to associate linear coefficients (intercept and slope) to tens of thousands of observations based on a table with benchmark values. #####Example - Value table and their corresponding coefficients (intercept and slope) coef = data.frame(cbind(st=c(1:5),b = runif(5,0.3,5),a = seq(0.5,5,1)))print(coef) #Example of observation...
2008 Mar 20
1
Use of Factors
...l in interplated values for each visit. interp_out[1:9,4]=hrv1;interp_out[10:18,4]=hrv2; # hrv1 & hrv2 come from the following function, the "lm" parameter is output from the standard lm() function: interpolateToXL = function(lm,maxxl){ int_values=matrix(nrow=9,ncol=1) int_values[1,]=coef(lm)[1]; if (maxxl>25) int_values[2,]=coef(lm)[1]+coef(lm)[2] * 25 if (maxxl>50) int_values[3,]=coef(lm)[1]+coef(lm)[2] * 50 if (maxxl>75) int_values[4,]=coef(lm)[1]+coef(lm)[2] * 75 if (maxxl>100) int_values[5,]=coef(lm)[1]+coef(lm)[2] * 100 if (maxxl>125) int_values[6,]=co...
2009 Nov 02
2
using exists with coef from an arima fit
Dear R People: I have the output from an arima model fit in an object xxx. I want to verify that the ma1 coefficient is there, so I did the following: > xxx$coef ar1 ar2 ma1 intercept 1.3841297 -0.4985667 -0.9999996 -0.1091657 > str(xxx$coef) Named num [1:4] 1.384 -0.499 -1 -0.109 - attr(*, "names")= chr [1:4] "ar1" "ar2" "ma1" "in...
2001 Aug 10
1
bug in dummy.coef.lm? (PR#1048)
Hi - I'm running R 1.3.0 on i686-pc-linux-gnu > rm(x, y, z) > df <- data.frame(x=1:20,y=1:20,z=factor(1:20 <= 10)) dummy.coef falls over: > dummy.coef.lm(lm(y ~ z * poly(x,1), data=df)) Error in poly(x, 1): Object "x" not found > dummy.coef.lm(lm(y ~ z * I(x), data=df)) Error in unique(c("AsIs", class(x))): Object "x" not found but works OK with: > dummy.coef.lm(lm(y ~ z * x,...
2016 Mar 31
2
Ask if an object will respond to a function or method
In the rockchalk package, I want to provide functions for regression objects that are "well behaved." If an object responds to the methods that lm or glm objects can handle, like coef(), nobs(), and summary(), I want to be able to handle the same thing. It is more difficult than expected to ask a given fitted model object "do you respond to these functions: coef(), nobs(), summary()." How would you do it? I tried this with the methods() function but learned that all...
2007 Dec 17
2
Capture warning messages from coxph()
...em to fit. > library(survival) Loading required package: splines > time= c(4,3,1,1,2,2,3,3,2) > status=c(1,0,0,0,1,1,1,1,1) > TIME=Surv(time,status) > x= cbind(c(0,2,1,1,0,0,0,2,0),c(0,2,1,1,0,0,0,0,0)) > > results=matrix(NA,ncol=3,nrow=ncol(x)) > colnames(results)=c("coef","se","p") > > for(i in 1:ncol(x)){ + fit=summary(coxph(TIME~x[,i])) + results[i,1]=fit$coef[1] + results[i,2]=fit$coef[3] + results[i,3]=fit$coef[5] + rm(fit) + } Warning message: Loglik converged before variable 1 ; beta may be infinite. in: fitter(X, Y, strats, o...
2010 Dec 31
2
Class "coef.mer" into a data.frame?
Hello, Could somebody please tell me what am I doing wrong in following? I try extract coefficients (using arm-package) from the lmer frunction, but I get the following warning: a<-data.frame(coef(res)) Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class "coef.mer" into a data.fram I think I have done it b...
2010 Apr 27
2
when setting environment: target of assignment expands to non-language object
Hi, I am trying to place my own functions in the nlme environment: The following statement works: environment(coef.corSPT) <- environment(getS3method("coef","corSpatial")) but this one returns an error: environment(get("coef<-.corSPT")) <- environment(getS3method("coef<-","corSpatial")) Error in environment(get("coef<-.corSPT")) <-...
2007 Apr 17
3
Extracting approximate Wald test (Chisq) from coxph(..frailty)
Dear List, How do I extract the approximate Wald test for the frailty (in the following example 17.89 value)? What about the P-values, other Chisq, DF, se(coef) and se2? How can they be extracted? ######################################################> kfitm1 Call: coxph(formula = Surv(time, status) ~ age + sex + disease + frailty(id, dist = "gauss"), data = kidney) coef se(coef) age...
2015 Aug 05
0
[PATCH 7/8] Add Neon intrinsics for Silk noise shape feedback loop.
...12, NSQ->sLF_AR_shp_Q14, Tilt_Q14 ); diff --git a/silk/NSQ.h b/silk/NSQ.h index a18a951..df856e6 100644 --- a/silk/NSQ.h +++ b/silk/NSQ.h @@ -62,6 +62,33 @@ static OPUS_INLINE opus_int32 silk_noise_shape_quantizer_short_prediction_c(cons #define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) ((void)arch,silk_noise_shape_quantizer_short_prediction_c(in, coef, order)) +static OPUS_INLINE opus_int32 silk_NSQ_noise_shape_feedback_loop_c(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order) +{ + opus_int32 out; + opus_int32 tmp1,...
2015 Nov 21
0
[Aarch64 v2 06/18] Add Neon intrinsics for Silk noise shape feedback loop.
...12, NSQ->sLF_AR_shp_Q14, Tilt_Q14 ); diff --git a/silk/NSQ.h b/silk/NSQ.h index a18a951..df856e6 100644 --- a/silk/NSQ.h +++ b/silk/NSQ.h @@ -62,6 +62,33 @@ static OPUS_INLINE opus_int32 silk_noise_shape_quantizer_short_prediction_c(cons #define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) ((void)arch,silk_noise_shape_quantizer_short_prediction_c(in, coef, order)) +static OPUS_INLINE opus_int32 silk_NSQ_noise_shape_feedback_loop_c(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order) +{ + opus_int32 out; + opus_int32 tmp1,...
2017 Nov 07
0
New vcov(*, complete=TRUE) etc -- coef(<lm>) vs coef(<aov>)
...a bad thing that the difference is now explicit and documented. I expect that that other problems like this will surface, particularly with contributed packages (and I know that you're aware that this has already happened with the car package). That is, packages that made provision for aliased coefficients based on the old behaviour of coef() and vcov() will now have to adapt to the new, more consistent behaviour. Best, John > -----Original Message----- > From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Martin > Maechler > Sent: Tuesday, November 7, 2017 4:4...
2013 Feb 08
3
On p-values presented in the summary of Linear Models
Dear list members I have a doubt on how p-values for t-statistics are calculated in the summary of Linear Models. Here goes an example: x <- rnorm(100,50,10) y <- rnorm(100,0,5) fit1<-lm(y~x) summary(fit1) summary(fit1)$coef[2] # b summary(fit1)$coef[4] # Std. Error summary(fit1)$coef[6] # t-statistic summary(fit1)$coef[8] # Pr(>|t| summary(fit1)$df [2] # degrees of freedom # t-statistic can be calculated as: t<-(summary(fit1)$coef[2])/summary(fit1)$coef[4] t # t-statistic # the critical value for t0.05(2)df ca...