similar to: Extracting lists in the dataframe $ format

Displaying 20 results from an estimated 1000 matches similar to: "Extracting lists in the dataframe $ format"

2008 Dec 13
2
weird pasting of ".value" when list is returned
could someone explain why the name of FPVAL gets " .value" concatenated onto it when the code below is run and temp is returned. I've been trying to figure this out for too long. It doesn't matter when I put the FPVAL in the return statement. It happens regardless of whether it's first or last. Thanks. f.lmmultenhanced <- function(response, pred1, pred2) {
2004 Jun 16
2
gam
hi, i'm working with mgcv packages and specially gam. My exemple is: >test<-gam(B~s(pred1)+s(pred2)) >plot(test,pages=1) when ploting test, you can view pred1 vs s(pred1, edf[1] ) & pred2 vs s(pred2, edf[2] ) I would like to know if there is a way to access to those terms (s(pred1) & s(pred2)). Does someone know how? the purpose is to access to equation of smooths terms
2012 Mar 19
1
glm: getting the confidence interval for an Odds Ratio, when using predict()
Say I fit a logistic model and want to calculate an odds ratio between 2 sets of predictors. It is easy to obtain the difference in the predicted logodds using the predict() function, and thus get a point-estimate OR. But I can't see how to obtain the confidence interval for such an OR. For example: model <- glm(chd ~age.cat + male + lowed, family=binomial(logit)) pred1 <-
2005 Mar 03
3
creating a formula on-the-fly inside a function
I have a function that, among other things, runs a linear model and returns r2. But, the number of predictor variables passed to the function changes from 1 to 3. How can I change the formula inside the function depending on the number of variables passed in? An example: get.model.fit <- function(response.dat, pred1.dat, pred2.dat = NULL, pred3.dat = NULL) { res <- lm(response.dat ~
2011 Apr 06
3
ROCR - best sensitivity/specificity tradeoff?
Hi, My questions concerns the ROCR package and I hope somebody here on the list can help - or point me to some better place. When evaluating a model's performane, like this: pred1 <- predict(model, ..., type="response") pred2 <- prediction(pred1, binary_classifier_vector) perf <- performance(pred, "sens", "spec") (Where "prediction" and
2010 May 28
1
Comparing and Interpreting GAMMs
Dear R users I have a question related to the interpretation of results based on GAMMs using Simon Woods package gamm4. I have repeated measurements (hours24) of subjects (vpnr) and one factor with three levels (pred). The outcome (dv) is binary. In the first model I'd like to test for differences among factor levels (main effects only): gamm.11<-gamm4(dv ~ pred +s(hours24), random = ~
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
Full_Name: Renaud Lancelot Version: Version 2.3.0 (2006-04-24) OS: MS Windows XP Pro SP2 Submission from: (NULL) (82.239.219.108) I think there is a bug in predict.lme, when a polynomial generated by poly() is used as an explanatory variable, and a new data.frame is used for predictions. I guess this is related to * not * using, for predictions, the coefs used in constructing the orthogonal
2011 Sep 03
2
ROCR package question for evaluating two regression models
Hello All,  I have used logistic regression glm in R and I am evaluating two models both learned with glm but with different predictors. model1 <- glm (Y ~ x4+ x5+ x6+ x7, data = dat, family = binomial(link=logit))model2 <- glm (Y~ x1 + x2 +x3 , data = dat, family = binomial(link=logit))  and I would like to compare these two models based on the prediction that I get from each model: pred1 =
2009 Apr 01
3
How to prevent inclusion of intercept in lme with interaction
Dear friends of lme, After so many year with lme, I feel ashamed that I cannot get this to work. Maybe it's a syntax problem, but possibly a lack of understanding. We have growth curves of new dental bone that can well be modeled by a linear growth curve, for two different treatments and several subjects as random parameter. By definition, newbone is zero at t=0, so I tried to force the
2016 Nov 01
2
as.formula("x") error on C stack limit
Dear all, I tried to run as.formula("x") and got an error message "Error: C stack usage 7971120 is too close to the limit" whether x exists or not. This is not the case in as.formula("y"), where "object 'y' not found" is the error message if y not exists, or "invalid formula" error or a formula depending on y. Can anyone confirm this is
2009 Jun 12
1
coupled ODE population model
I'm fairly new to R, and I'm trying to write out a population model that satisfies the following; the system consists of s species, i= 1, 2,...,s network of interactions between species is specified by a (s x s) real matrix, C[i,j] x[i] being the relative population of the "ith" species (0 =< x[i] =< 1, sum(x[i]=1) the evolution rule being considered is as follows;
2011 Apr 15
1
GLM and normality of predictors
Hi, I have found quite a few posts on normality checking of response variables, but I am still in doubt about that. As it is easy to understand I'm not a statistician so be patient please. I want to estimate the possible effects of some predictors on my response variable that is nº of males and nº of females (cbind(males,females)), so, it would be:
2007 Sep 04
1
data.frame loses name when constructed with one column
Not sure why the data.frame function does not capture the name of the column field when its being built with only one column. Can anyone help? > data out pred1 predd2 1 1 2.0 3.0 2 2 3.5 5.5 3 3 5.5 11.0 > data1=data.frame(data[,1]) > data1 data...1. 1 1 2 2 3 3 > data1=data.frame(data[,1:2]) > data1 out pred1 1 1 2.0 2 2
2006 Aug 04
0
training svm's with probability flag
Hi- I'm seeing some weirdness with svm and tune.svm that I can't figure out- was wondering if anyone else has seen this? Perhaps I'm failing to make something the expected class? Below is my repro case, though it *sometimes* doesn't repro. I'm using R2.3.1 on WindowsXP. I was also seeing it happen with R2.1.1 and have seen it on 2 different machines. data(iris) attach(iris)
2006 Aug 04
0
training svm's with probability flag (re-send in plain text)
Hi- I'm seeing some weirdness with svm and tune.svm that I can't figure out- was wondering if anyone else has seen this? Perhaps I'm failing to make something the expected class? Below is my repro case, though it *sometimes* doesn't repro. I'm using R2.3.1 on WindowsXP. I was also seeing it happen with R2.1.1 and have seen it on 2 different machines. data(iris) attach(iris)
2010 Aug 16
1
Problem with cast {reshape}: Error in match.fun(FUN) : could not find function "Negate"
Dear All I'm having problem with some script which worked a few months ago (on a different computer that might well have had a different version of R installed, so perhaps it has to do with the old version of R?): library(reshape) Loading required package: plyr > tble.data <- melt.array(interp, varnames=c("tme","lon","lat")) > > allyrs.interp <-
2011 Jul 26
1
nls - can't get published AICc and parameters
Hi I'm trying to replicate Smith et al.'s (http://www.sciencemag.org/content/330/6008/1216.abstract) findings by fitting their Gompertz and logistic models to their data (given in their supplement). I'm doing this as I want to then apply the equations to my own data. Try as a might, I can't quite replicate them. Any thoughts why are much appreciated. I've tried contacting the
2016 Nov 01
0
as.formula("x") error on C stack limit
Another example uses formula.character's other arguments: > as.formula("env") Error: object of type 'special' is not subsettable > as.formula("...") Error in eval(expr, envir, enclos) : '...' used in an incorrect context It may happen for the same reason that the following does not give an error: > y <- "response ~ pred1 + pred2" >
2008 May 13
0
Un-reproductibility of SVM classification with 'e1071' libSVM package
Hello, When calling several times the svm() function, I get different results. Do I miss something, or is there some random generation in the C library? In this second hypothesis, is it possible to fix an eventual seed? Thank you Pierre ### Example library('e1071') x = rnorm(100) # train set y = rnorm(100) c = runif(100)>0.5 x2 = rnorm(100)# test set y2 = rnorm(100) # learning a
2012 Nov 01
0
oblique.tree : the predict function asserts the dependent variable to be included in "newdata"
Dear R community, I have recently discovered the package oblique.tree and I must admit that it was a nice surprise for me, since I have actually made my own version of a kind of a classifier which uses the idea of oblique splits (splits by means of hyperplanes). So I am now interested in comparing these two classifiers. But what I do not seem to understand is why the function