Displaying 20 results from an estimated 65 matches for "carb".
Did you mean:
car
2005 Apr 02
2
An exercise in the use of 'substitute'
...rch list.
The second part is relatively easy. The default method for "with" has body
eval(substitute(expr), data, enclos = parent.frame())
and you just change this to
eval(substitute(expr), eval(data$call$data), enclos = parent.frame())
So, for example
> fm <- lm(optden ~ carb, Formaldehyde)
> with.lm <- function(data, expr, ...) eval(substitute(expr),
eval(data$call$data), enclos = parent.frame())
> with(fm, carb)
[1] 0.1 0.3 0.5 0.6 0.7 0.9
However, I haven't been able to work out a clever way of using
substitute to get the first part. I would like t...
2011 Feb 03
3
interpret significance from the contr.poly() function
Hello R-help
I don’t know how to interpret significance from the contr.poly() function . From
the example below
: how can I tell if data has a significant Linear/quadratic/cubic trend?
> contr.poly(4, c(1,2,4,8))
.L .Q .C
[1,] -0.51287764 0.5296271 -0.45436947
[2,] -0.32637668 -0.1059254 0.79514657
[3,] 0.04662524 -0.7679594 -0.39757328
[4,] 0.79262909
2002 Jun 26
1
Bug? (PR#1710)
Hi,
I tried to do a multiple linear model from the example
dataset Formaldehyde. However, the function lm() did not
estimate the coefficient of the term carb^2. The same
problem occurred with the (nlme)dataset Pixel with both
function lme() and lm(). I am using the windows version of
R 1.5.1
Lauri Mehtatalo
The Formaldehyde example:
> data(Formaldehyde)
> lm(optden~carb+carb^2,data=Formaldehyde)
Call:
lm(formula = optden ~ carb + carb^2, dat...
2013 Jun 25
1
F statistic in add1.lm vs add1.glm
....
MASS:addterm shows the same discrepancy. It looks like the deviance (==residual sum of squares) gets
divided by the number of degrees of freedom for the term twice in add1.glm. Using anova() on the output
of lm and glm(family=gaussian) gives the save F statistic as add1.lm gives.
> # factor(carb) consumes 5 degrees of freedom, am 1, compare their F values.
> fit <- lm(mpg ~ hp, data=mtcars) ; add1(fit, ~ hp + factor(carb) + am, test="F")
Single term additions
Model:
mpg ~ hp
Df Sum of Sq RSS AIC F value Pr(>F)
<none> 447...
2002 Dec 13
2
how to get Residual Standard Error
Hi,
I use lm or loess to make smoothing. After smoothing I need "Residual
Standard Error" in my script. Could you please tell me how can I get
this information?
Thanks,
1997 Dec 02
1
R-alpha: NextMethod in 0.50-a4
...isher = {Springer-Verlag},
pages = {37--48}
}
I created an artificial example using the "acid" data so it can be
reproduced by others. (BTW, the acid.doc file has a misprint. The
name of the second column is "optden", not "opt".)
R> data(acid)
R> acid
carb optden
1 0.1 0.086
2 0.3 0.269
3 0.5 0.446
4 0.6 0.538
5 0.7 0.626
6 0.9 0.782
R> class(acid)
[1] "data.frame"
R> attr(acid, "formula") <- optden ~ carb
R> class(acid) <- c("groupedData", "data.frame")
R> print.grouped...
2020 Jun 17
2
subset data.frame at C level
Hi,
Hope you are well.
I was wondering if there is a function at C level that is equivalent to
mtcars$carb or .subset2(mtcars, "carb").
If I have the index of the column then the answer would be VECTOR_ELT(df,
asInteger(idx)) but I was wondering if there is a way to do it directly
from the name of the column without having to loop over columns names to
find the index?
Thank you
Best regards...
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
version.
data(mtcars)
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of 1st
principal component
mtcars$PC2 <- .PC$scores[,2] # extract un-rotated scores of 2nd
principal c...
2012 Apr 05
2
count() function
I keep expecting R to have something analogous to the =count function in
Excel, but I can't find anything. I simply want to count the data for a
given category.
I've been using the ddply() function in the plyr package to summarize
means and st dev of my data, with this code:
ddply(NZ_Conifers,.(ElevCat, DataSource, SizeClass), summarise,
avgDensity=mean(Density),
2016 Apr 14
4
Bug in by() function which works for some FUN argument and does not work for others
...Median :17.82 Median :0.0000 Median :0
Mean :3.286 Mean :3.769 Mean :18.18 Mean :0.3684 Mean :0
3rd Qu.:3.695 3rd Qu.:3.842 3rd Qu.:19.17 3rd Qu.:1.0000 3rd Qu.:0
Max. :3.920 Max. :5.424 Max. :22.90 Max. :1.0000 Max. :0
gear carb
Min. :3.000 Min. :1.000
1st Qu.:3.000 1st Qu.:2.000
Median :3.000 Median :3.000
Mean :3.211 Mean :2.737
3rd Qu.:3.000 3rd Qu.:4.000
Max. :4.000 Max. :4.000
------------------------------------------------------------
: 1
mpg cyl disp...
2016 Apr 14
0
Bug in by() function which works for some FUN argument and does not work for others
...Try:
> by(data=mtcars, INDICES=list(as.factor(mtcars$am)), FUN=colMeans)
: 0
mpg cyl disp hp drat wt
qsec vs
17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947
18.1831579 0.3684211
am gear carb
0.0000000 3.2105263 2.7368421
---------------------------------------------------------------------------
: 1
mpg cyl disp hp drat wt
qsec vs
24.3923077 5.0769231 143.5307692 126.8461538 4.0500000 2.4110000
17.3600000 0.538...
2016 Apr 15
4
Bug in by() function which works for some FUN argument and does not work for others
...ES=list(as.factor(mtcars$am)), FUN=colMeans)
> : 0
> mpg cyl disp hp drat wt
> qsec vs
> 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947
> 18.1831579 0.3684211
> am gear carb
> 0.0000000 3.2105263 2.7368421
>
> ---------------------------------------------------------------------------
> : 1
> mpg cyl disp hp drat wt
> qsec vs
> 24.3923077 5.0769231 143.5307692 126.8461538 4.05...
2020 Oct 18
1
Resultado de la consola como un tibble
...100
3: disp 2.080657e-02 0.9200127
4: hp 4.880824e-02 0.9334193
5: drat 1.100608e-01 0.9458839
6: wt 9.265499e-02 0.9432577
7: qsec 5.935176e-01 0.9732509
8: vs 9.737376e-08 0.6322635
9: am 7.836354e-08 0.6250744
10: gear 1.306844e-05 0.7727856
11: carb 4.382405e-04 0.8510972
Saludos,
Carlos Ortega
www.qualityexcellence.es
El dom., 18 oct. 2020 a las 11:53, Carlos Ortega (<cof en qualityexcellence.es>)
escribió:
> Hola,
>
> No hace falta (en este caso) capturarlo de la consola.
> El resultado de la función apply se puede cap...
2009 Apr 27
0
VIF's in R using BIGLM
...rom the regression output of BIGLM. Traditionally, this has
been possible with the regular lm() function. Follows a quick
illustration (the model below is pretty silly, only for illustration
purposes).
Example dataset:
> mtcars
mpg cyl disp hp drat wt qsec vs am gear
carb
Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4
4
Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4
4
Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4
1
Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3
1
Hornet Sportabout 18....
2020 Oct 18
2
Resultado de la consola como un tibble
Buen día
estimados
Estoy tratando de hacer un tibble con los resultados de un apply que se
muestran en la consola que me da R, no estoy seguro si eso se pueda hacer,
pero me gustaría organizar los resultados de esa manera.
mi código es:
data("mtcars")
Mtcars_matriz <- as.matrix(mtcars)
apply(Mtcars_matriz, MARGIN =2, FUN = shapiro.test)
DF2 <- tibble(Variable = NA, W = NA, Pvalue =
2016 Apr 15
0
Bug in by() function which works for some FUN argument and does not work for others
...tcars$am)), FUN=colMeans)
>> : 0
>> mpg cyl disp hp drat wt
>> qsec vs
>> 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947
>> 18.1831579 0.3684211
>> am gear carb
>> 0.0000000 3.2105263 2.7368421
>>
>> ---------------------------------------------------------------------------
>> : 1
>> mpg cyl disp hp drat wt
>> qsec vs
>> 24.3923077 5.0769231 143.5...
2008 Mar 05
0
Using tune with gbm --grid search for best hyperparameters
...rid search for hyperparameter
values in gbm. However, I can not get this to work. I note that there is no
wrapper for gbm but that it is possible to use non-wrapped functions (like
lm) without problem. Here's a snippet of code to illustrate.
> data(mtcars) obj <-
> gbm(mpg~disp+wt+carb,data=mtcars,distribution="gaussian",n.trees=1000,n.minobsinnode=5)
> summary(obj) #just to demonstrate that gbm worked
var rel.inf
1 disp 55.185469
2 wt 40.198605
3 carb 4.615926
# now let's find the best value for n.minobsinnode using tune
> tune.obj <-
> tune(g...
2011 Aug 27
1
Grouping variables in a data frame
Hi All,
I have a data frame as follow:
user_id time age location gender
.....
and I learn a logistic regression to learn the weights (glm with family= (link = logit))), my response value is either zero or one. I would like to group the users based on user_id and time and see the y values and predicted y values at the same time. Or plot them some how. Is there any way to somehow group them
2000 Dec 30
0
editor in Windows doesn't like a data frame with row names (PR#797)
...is a collaborative project with many contributors.
Type `contributors()' for more information.
Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.
> data(Formaldehyde)
> Formaldehyde
carb optden
1 0.1 0.086
2 0.3 0.269
3 0.5 0.446
4 0.6 0.538
5 0.7 0.626
6 0.9 0.782
> edit(Formaldehyde) # no problem here
carb optden
1 0.1 0.086
2 0.3 0.269
3 0.5 0.446
4 0.6 0.538
5 0.7 0.626
6 0.9 0.782
> rownames(Formaldehyde)
[1] "1" "2" "...
2016 Apr 16
2
Bug in by() function which works for some FUN argument and does not work for others
...>> : 0
> >> mpg cyl disp hp drat wt
> >> qsec vs
> >> 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947
> >> 18.1831579 0.3684211
> >> am gear carb
> >> 0.0000000 3.2105263 2.7368421
> >>
> >>
> ---------------------------------------------------------------------------
> >> : 1
> >> mpg cyl disp hp drat wt
> >> qsec vs
>...