Displaying 20 results from an estimated 700 matches similar to: "environments: functions within functions"
2023 May 25
1
environments: functions within functions
? Thu, 25 May 2023 10:18:13 -0400
Sarah Goslee <sarah.goslee at gmail.com> ?????:
> print called on this object gets passed to print.mixfitEM(), which is:
>
>
> function (x, digits = getOption("digits"), ...)
> {
> family <- x$family
> mc <- match.call()
> mc$digits <- digits
> fun.name <- paste0("print", family)
2003 Jun 17
1
User-defined functions in rpart
This question concerns rpart's facility for user-defined functions that
accomplish splitting.
I was interested in modifying the code so that in each terminal node,
a linear regression is fit to the data.
It seems that from the allowable inputs in the user-defined functions,
that this may not be possible, since they have the form:
function(y, wt, parms) (in the case of the
2007 Aug 16
3
multiple colors within same line of text
Hi, I'm interested in using mtext(), but with the option of having multiple
colors in the same line of text.
For example, creating a line of text where:
Red is red and blue is blue
How do you create a text argument that lets you do this within mtext()?
Thanks,
Andrew
MGH Cancer Center
[[alternative HTML version deleted]]
2013 Mar 05
1
Reading Wyoming radiosonde data files with RadioSonde package
Hi,
I need to do some analysis on historic daily radiosonde data I download
from the Wyoming Univ. web page (
http://weather.uwyo.edu/upperair/sounding.html).
I am trying to use the RadioSonde package (V 1.3), but the format of the
files from Wyoming don't match what RadioSonde is expecting.
Has anyone used the Radiosonde package on the Wyoming data?
Here is a sample of the Wyoming file
2009 Mar 11
2
Question about datatypes/plotting issue
Hi,
I am trying to plot the Case-Shiller index found at: http://www2.standardandpoors.com/spf/pdf/index/CSHomePrice_History_022445.xls
The way I'm importing it into R is as follows:
library(gdata)
W <- read.xls("http://www2.standardandpoors.com/spf/pdf/index/CSHomePrice_History_022445.xls
", header=TRUE)
attach(W)
To give you and idea of what the data looks like:
>
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
#
2005 Jul 21
1
About object of class mle returned by user defined functions
Hi,
There is something I don't get with object of class "mle" returned by a
function I wrote. More precisely it's about the behaviour of method
"confint" and "profile" applied to these object.
I've written a short function (see below) whose arguments are:
1) A univariate sample (arising from a gamma, log-normal or whatever).
2) A character string
2009 Apr 15
2
AICs from lmer different with summary and anova
Dear R Helpers,
I have noticed that when I use lmer to analyse data, the summary function
gives different values for the AIC, BIC and log-likelihood compared with the
anova function.
Here is a sample program
#make some data
set.seed(1);
datx=data.frame(array(runif(720),c(240,3),dimnames=list(NULL,c('x1','x2','y'
))))
id=rep(1:120,2); datx=cbind(id,datx)
#give x1 a
2011 Mar 25
2
A question on glmnet analysis
Hi,
I am trying to do logistic regression for data of 104 patients, which
have one outcome (yes or no) and 15 variables (9 categorical factors
[yes or no] and 6 continuous variables). Number of yes outcome is 25.
Twenty-five events and 15 variables mean events per variable is much
less than 10. Therefore, I tried to analyze the data with penalized
regression method. I would like please some of the
2004 Jun 11
1
comparing regression slopes
Dear List,
I used rlm to calculate two regression models for two data sets (rlm
due to two outlying values in one of the data sets). Now I want to
compare the two regression slopes. I came across some R-code of Spencer
Graves in reply to a similar problem:
http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg06666.html
The code was:
> df1 <- data.frame(x=1:10, y=1:10+rnorm(10))
2012 Nov 08
2
Comparing nonlinear, non-nested models
Dear R users,
Could somebody please help me to find a way of comparing nonlinear, non-nested
models in R, where the number of parameters is not necessarily different? Here
is a sample (growth rates, y, as a function of internal substrate
concentration, x):
x <- c(0.52, 1.21, 1.45, 1.64, 1.89, 2.14, 2.47, 3.20, 4.47, 5.31, 6.48)
y <- c(0.00, 0.35, 0.41, 0.49, 0.58, 0.61, 0.71, 0.83, 0.98,
2004 Dec 13
1
AIC, glm, lognormal distribution
I'm attempting to do model selection with AIC, using a glm and a lognormal
distribution, but:
fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian(link="log"))
## gives the same result as either of the following:
fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian)
fit1<-lm(BA~Year,data=pdat.sp1.65.04)
fit1
#Coefficients:
#(Intercept) Year2004
# -1.6341
2008 Jan 05
1
Likelihood ratio test for proportional odds logistic regression
Hi,
I want to do a global likelihood ratio test for the proportional odds
logistic regression model and am unsure how to go about it. I am using
the polr() function in library(MASS).
1. Is the p-value from the likelihood ratio test obtained by
anova(fit1,fit2), where fit1 is the polr model with only the intercept
and fit2 is the full polr model (refer to example below)? So in the
case of the
2010 Nov 10
1
standardized/studentized residuals with loess
Hi all,
I'm trying to apply loess regression to my data and then use the fitted
model to get the *standardized/studentized residuals. I understood that for
linear regression (lm) there are functions to do that:*
*
*
fit1 = lm(y~x)
stdres.fit1 = rstandard(fit1)
studres.fit1 = rstudent(fit1)
I was wondering if there is an equally simple way to get
the standardized/studentized residuals for a
2012 May 28
0
GLMNET AUC vs. MSE
Hello -
I am using glmnet to generate a model for multiple cohorts i. For each i, I
run 5 separate models, each with a different x variable. I want to compare
the fit statistic for each i and x combination.
When I use auc, the output is in some cases is < .5 (.49). In addition, if
I compare mean MSE (with upper and lower bounds) ... there is no difference
across my various x variables, but
2011 Oct 06
1
anova.rq {quantreg) - Why do different level of nesting changes the P values?!
Hello dear R help members.
I am trying to understand the anova.rq, and I am finding something which I
can not explain (is it a bug?!):
The example is for when we have 3 nested models. I run the anova once on
the two models, and again on the three models. I expect that the p.value
for the comparison of model 1 and model 2 would remain the same, whether or
not I add a third model to be compared
2011 Jan 24
5
Train error:: subscript out of bonds
Hi,
I am trying to construct a svmpoly model using the "caret" package (please
see code below). Using the same data, without changing any setting, I am
just changing the seed value. Sometimes it constructs the model
successfully, and sometimes I get an ?Error in indexes[[j]] : subscript out
of bounds?.
For example when I set seed to 357 following code produced result only for 8
2008 Feb 23
3
using subset() in data frame
R folks,
As an R novice, I struggle with the mystery of subsetting. Textbook and
online examples of this seem quite straightforward yet I cannot get my
mind around it. For practice, I'm using the code in MASS Ch. 6,
"whiteside data" to analyze a different data set with similar variables
and structure.
Here is my data frame:
###subset one of three cases for the variable
2009 Feb 12
0
Comparing slopes in two linear models
Hi everyone,
I have a data frame (d), wich has the results of mosquitoes trapping in
three different places.
I suspect that one of these places (Local=='Palm') is biased by low
numbers and will yield slower slopes in the variance-mean regression over
the areas. I wonder if these slopes are diferents.
I've looked trought the support list for methods for comparing slopes and
found the
2008 Dec 01
1
Comparing output from linear regression to output from quasipoisson to determine the model that fits best.
R 2.7
Windows XP
I have two model that have been run using exactly the same data, both fit using glm(). One model is a linear regression (gaussian(link = "identity")) the other a quasipoisson(link = "log"). I have log likelihoods from each model. Is there any way I can determine which model is a better fit to the data? anova() does not appear to work as the models have the